CC-3547 : Refactoring Views, removing action stack to better work with permissions. Reorganizing Statistics Dialog.
This commit is contained in:
parent
1b8a967cc0
commit
f48c5ff575
26 changed files with 173 additions and 513 deletions
|
@ -29,16 +29,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
|
||||
public function indexAction() {
|
||||
|
||||
$this->_helper->layout->setLayout('library');
|
||||
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('index', 'playlist');
|
||||
}
|
||||
|
||||
public function libraryAction()
|
||||
{
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('library');
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
|
@ -143,7 +133,6 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
foreach ($files as $id) {
|
||||
Logging::log("deleting file {$id}");
|
||||
|
||||
$file = Application_Model_StoredFile::Recall($id);
|
||||
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
<?php
|
||||
|
||||
class NowplayingController extends Zend_Controller_Action
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('get-data-grid-data', 'json')
|
||||
->addActionContext('register', 'json')
|
||||
->addActionContext('remindme', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
|
||||
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowview.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$refer_sses = new Zend_Session_Namespace('referrer');
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
if ($request->isPost()) {
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$values = $request->getPost();
|
||||
if ($values["Publicise"] != 1 && $form->isValid($values)){
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
if(isset($values["Privacy"])){
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
else if ($values["Publicise"] == '1' && $form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stnName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
|
||||
Application_Model_Preference::SetStationCountry($values["Country"]);
|
||||
Application_Model_Preference::SetStationCity($values["City"]);
|
||||
Application_Model_Preference::SetStationDescription($values["Description"]);
|
||||
Application_Model_Preference::SetStationLogo($imagePath);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
if(isset($values["Privacy"])){
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}else{
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}else{
|
||||
//popup if previous page was login
|
||||
if($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if($logo){
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getDataGridDataAction()
|
||||
{
|
||||
$viewType = $this->_request->getParam('view');
|
||||
$dateString = $this->_request->getParam('date');
|
||||
$this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString);
|
||||
|
||||
}
|
||||
/*
|
||||
public function livestreamAction()
|
||||
{
|
||||
//use bare bones layout (no header bar or menu)
|
||||
$this->_helper->layout->setLayout('bare');
|
||||
}
|
||||
*/
|
||||
|
||||
public function dayViewAction()
|
||||
{
|
||||
global $CC_CONFIG;
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
//nowplayingdatagrid.js requires this variable, so that datePicker widget can be offset to server time instead of client time
|
||||
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/nowplayingdatagrid.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/dayview.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
|
||||
public function remindmeAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
Application_Model_Preference::SetRemindMeDate();
|
||||
die();
|
||||
}
|
||||
|
||||
public function donotshowregistrationpopupAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -75,11 +75,11 @@ class PlaylistController extends Zend_Controller_Action
|
|||
|
||||
$this->view->pl = $pl;
|
||||
$this->view->id = $pl->getId();
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
$this->view->html = $this->view->render('playlist/playlist.phtml');
|
||||
unset($this->view->pl);
|
||||
}
|
||||
else {
|
||||
$this->view->html = $this->view->render('playlist/index.phtml');
|
||||
$this->view->html = $this->view->render('playlist/playlist.phtml');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,6 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('spl');
|
||||
|
||||
try {
|
||||
if (isset($this->pl_sess->id)) {
|
||||
$pl = new Application_Model_Playlist($this->pl_sess->id);
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
<?php
|
||||
|
||||
class SearchController extends Zend_Controller_Action
|
||||
{
|
||||
protected $search_sess = null;
|
||||
|
||||
private function addGroup($group_id) {
|
||||
|
||||
$form = new Application_Form_AdvancedSearch();
|
||||
|
||||
$form->addGroup($group_id, 1);
|
||||
$group = $form->getSubForm('group_'.$group_id);
|
||||
|
||||
return $group->__toString();
|
||||
}
|
||||
|
||||
private function addFieldToGroup($group_id, $row_id) {
|
||||
|
||||
$form = new Application_Form_AdvancedSearch();
|
||||
|
||||
$form->addGroup($group_id);
|
||||
$group = $form->getSubForm('group_'.$group_id);
|
||||
|
||||
$group->addRow($row_id);
|
||||
|
||||
return $group->__toString();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('newfield', 'json')
|
||||
->addActionContext('newgroup', 'json')
|
||||
->addActionContext('index', 'json')
|
||||
->addActionContext('display', 'json')
|
||||
->initContext();
|
||||
|
||||
$this->search_sess = new Zend_Session_Namespace("search");
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
{
|
||||
$data = $this->_getParam('data');
|
||||
$form = new Application_Form_AdvancedSearch();
|
||||
|
||||
// Form has been submitted
|
||||
$form->preValidation($data);
|
||||
|
||||
//if (!$form->isValid($data)) {
|
||||
//$this->view->form = $form->__toString();
|
||||
//return;
|
||||
//}
|
||||
|
||||
// valid form was submitted set as search criteria.
|
||||
$this->search_sess->md = $data;
|
||||
}
|
||||
|
||||
public function displayAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function newfieldAction()
|
||||
{
|
||||
$group_id = $this->_getParam('group', 1);
|
||||
$row_id = $this->search_sess->next_row[$group_id];
|
||||
|
||||
$this->view->html = $this->addFieldToGroup($group_id, $row_id);
|
||||
$this->view->row = $row_id;
|
||||
|
||||
$this->search_sess->next_row[$group_id] = $row_id + 1;
|
||||
}
|
||||
|
||||
public function newgroupAction()
|
||||
{
|
||||
$group_id = $this->search_sess->next_group;
|
||||
|
||||
$this->view->html = $this->addGroup($group_id);
|
||||
|
||||
$this->search_sess->next_group = $group_id + 1;
|
||||
$this->search_sess->next_row[$group_id] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -43,9 +43,6 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/TableTools.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js?'.$CC_CONFIG['airtime_version']),'text/javascript');
|
||||
|
||||
$this->_helper->layout->setLayout('builder');
|
||||
$this->_helper->viewRenderer->setResponseSegment('dialog');
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
|
||||
|
@ -97,76 +94,42 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}
|
||||
else {
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
}
|
||||
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$settings = unserialize($data);
|
||||
|
||||
if ($settings["library"] == "true") {
|
||||
$this->view->headScript()->appendScript("AIRTIME.showLib = true;");
|
||||
}
|
||||
}
|
||||
|
||||
if (!$user->isGuest()) {
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
}
|
||||
|
||||
$this->_helper->actionStack('builder', 'showbuilder');
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$now = floatval(microtime(true));
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
//popup if previous page was login
|
||||
if ($refer_sses->referrer == 'login' && Application_Model_Nowplaying::ShouldShowPopUp()
|
||||
&& !Application_Model_Preference::GetSupportFeedback() && $user->isAdmin()){
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
||||
$menu["preview"] = array("name"=> "Preview");
|
||||
//select the cursor
|
||||
$menu["selCurs"] = array("name"=> "Select Cursor");
|
||||
$menu["delCurs"] = array("name"=> "Remove Cursor");
|
||||
|
||||
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
|
||||
//remove/truncate the item from the schedule
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function builderAction() {
|
||||
|
||||
global $CC_CONFIG;
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('builder');
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$form = new Application_Form_RegisterAirtime();
|
||||
|
||||
$logo = Application_Model_Preference::GetStationLogo();
|
||||
if ($logo) {
|
||||
$this->view->logoImg = $logo;
|
||||
}
|
||||
$this->view->dialog = $form;
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/nowplaying/register.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
}
|
||||
|
||||
//determine whether to remove/hide/display the library.
|
||||
$showLib = false;
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
if (!$user->isGuest()) {
|
||||
$hideLib = false;
|
||||
$data = Application_Model_Preference::GetValue("nowplaying_screen", true);
|
||||
if ($data != "") {
|
||||
$settings = unserialize($data);
|
||||
|
||||
if ($settings["library"] == "true") {
|
||||
$showLib = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$hideLib = true;
|
||||
}
|
||||
$this->view->hideLib = $hideLib;
|
||||
$this->view->showLib = $showLib;
|
||||
|
||||
//populate date range form for show builder.
|
||||
$now = time();
|
||||
$from = $request->getParam("from", $now);
|
||||
$to = $request->getParam("to", $now + (24*60*60));
|
||||
|
@ -194,14 +157,35 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css?'.$CC_CONFIG['airtime_version']);
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/showbuilder.css?'.$CC_CONFIG['airtime_version']);
|
||||
|
||||
$user = Application_Model_User::GetCurrentUser();
|
||||
if (!$user->isGuest()) {
|
||||
$this->view->toggleLib = true;
|
||||
}
|
||||
|
||||
public function contextMenuAction()
|
||||
{
|
||||
$id = $this->_getParam('id');
|
||||
$now = floatval(microtime(true));
|
||||
|
||||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
$menu = array();
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
$item = CcScheduleQuery::create()->findPK($id);
|
||||
$instance = $item->getCcShowInstances();
|
||||
|
||||
$menu["preview"] = array("name"=> "Preview");
|
||||
//select the cursor
|
||||
$menu["selCurs"] = array("name"=> "Select Cursor");
|
||||
$menu["delCurs"] = array("name"=> "Remove Cursor");
|
||||
|
||||
if ($now < floatval($item->getDbEnds("U.u")) && $user->canSchedule($instance->getDbShowId())) {
|
||||
|
||||
//remove/truncate the item from the schedule
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/showbuilder/schedule-remove");
|
||||
}
|
||||
else {
|
||||
$this->view->toggleLib = false;
|
||||
}
|
||||
|
||||
$this->view->items = $menu;
|
||||
}
|
||||
|
||||
public function builderDialogAction() {
|
||||
|
|
|
@ -12,6 +12,8 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
->addActionContext('set-library-datatable', 'json')
|
||||
->addActionContext('get-timeline-datatable', 'json')
|
||||
->addActionContext('set-timeline-datatable', 'json')
|
||||
->addActionContext('register', 'json')
|
||||
->addActionContext('remindme', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
|
@ -65,4 +67,17 @@ class UsersettingsController extends Zend_Controller_Action
|
|||
$this->view->settings = unserialize($data);
|
||||
}
|
||||
}
|
||||
|
||||
public function remindmeAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
Application_Model_Preference::SetRemindMeDate();
|
||||
}
|
||||
|
||||
public function donotshowregistrationpopupAction()
|
||||
{
|
||||
// unset session
|
||||
Zend_Session::namespaceUnset('referrer');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue