diff --git a/.zfproject.xml b/.zfproject.xml index a3382d3ed..873f96251 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -66,6 +66,7 @@ + @@ -266,6 +267,9 @@ + + + diff --git a/application/controllers/LibraryController.php b/application/controllers/LibraryController.php index c58072fe3..34bbb2778 100644 --- a/application/controllers/LibraryController.php +++ b/application/controllers/LibraryController.php @@ -24,7 +24,6 @@ class LibraryController extends Zend_Controller_Action public function indexAction() { - $this->view->headScript()->appendFile('/js/airtime/onready/library.js','text/javascript'); $this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript'); $this->view->headScript()->appendFile('/js/jplayer/jquery.jplayer.min.js'); $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript'); diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index 575349c14..45240ac5a 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -22,6 +22,7 @@ class ScheduleController extends Zend_Controller_Action ->addActionContext('delete-show', 'json') ->addActionContext('schedule-show', 'json') ->addActionContext('schedule-show-dialog', 'json') + ->addActionContext('show-content-dialog', 'json') ->addActionContext('clear-show', 'json') ->addActionContext('get-current-playlist', 'json') ->addActionContext('find-playlists', 'json') @@ -34,6 +35,7 @@ class ScheduleController extends Zend_Controller_Action public function indexAction() { $this->view->headScript()->appendFile('/js/fullcalendar/fullcalendar.min.js','text/javascript'); + //$this->view->headScript()->appendFile('/js/qtip/jquery.qtip-1.0.0.min.js','text/javascript'); $this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript'); $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/schedule/full-calendar-functions.js','text/javascript'); @@ -179,33 +181,38 @@ class ScheduleController extends Zend_Controller_Action { $id = $this->_getParam('id'); $start_timestamp = $this->_getParam('start'); - $today_timestamp = date("Y-m-d H:i:s"); + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + $user = new User($userInfo->id, $userInfo->type); + $params = '/format/json/id/#id#/start/#start#/end/#end#'; if(strtotime($today_timestamp) < strtotime($start_timestamp)) { - $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), - 'title' => 'Delete'); - - $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), - 'title' => 'Clear'); + if($user->isHost($id)) { - $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'), - 'title' => 'Schedule'); - } - else { + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), + 'title' => 'Delete'); + + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/clear-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), + 'title' => 'Clear'); + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/schedule-show-dialog'.$params, 'callback' => 'window["buildScheduleDialog"]'), + 'title' => 'Schedule'); + } } + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'), + 'title' => 'Show Contents'); + //returns format jjmenu is looking for. die(json_encode($menu)); } public function scheduleShowAction() - { - $start_timestamp = $this->sched_sess->showStart; + { + $start_timestamp = $this->sched_sess->showStart; $end_timestamp = $this->sched_sess->showEnd; $showId = $this->sched_sess->showId; $search = $this->_getParam('search', null); @@ -253,7 +260,7 @@ class ScheduleController extends Zend_Controller_Action public function findPlaylistsAction() { - $show_id = $this->sched_sess->showId; + $show_id = $this->sched_sess->showId; $start_timestamp = $this->sched_sess->showStart; $end_timestamp = $this->sched_sess->showEnd; $post = $this->getRequest()->getPost(); @@ -297,6 +304,12 @@ class ScheduleController extends Zend_Controller_Action $this->sched_sess->showId = $showId; $this->sched_sess->showStart = $start_timestamp; $this->sched_sess->showEnd = $end_timestamp; + + $start = explode(" ", $start_timestamp); + $end = explode(" ", $end_timestamp); + $startTime = explode(":", $start[1]); + $endTime = explode(":", $end[1]); + $dateInfo = getDate(strtotime($start_timestamp)); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); @@ -304,43 +317,41 @@ class ScheduleController extends Zend_Controller_Action $show = new Show($user, $showId); $this->view->showContent = $show->getShowContent($start_timestamp); - $this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp); $this->view->showName = $show->getName(); $this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp); $this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp); - $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); - $this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml'); - - unset($this->view->showContent); - } - - /* Commented out for the 1.6 RC1 release. - public function showListAction() - { - $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript'); - $this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript'); - $this->view->headScript()->appendFile('/js/playlist/showlistview.js','text/javascript'); - $this->view->headLink()->appendStylesheet('/css/contextmenu.css'); - $this->view->headLink()->appendStylesheet('/css/pro_dropdown_3.css'); - $this->view->headLink()->appendStylesheet('/css/styles.css'); - } - - public function getShowDataAction() - { - $this->view->data = Show::getShows("2011-01-27"); - $this->view->showContent = $show->getShowContent($start_timestamp); - $this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp); - $this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp); - $this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp); + $this->view->wday = $dateInfo['weekday']; + $this->view->month = $dateInfo['month']; + $this->view->day = $dateInfo['mday']; + $this->view->startTime = sprintf("%d:%02d", $startTime[0], $startTime[1]); + $this->view->endTime = sprintf("%d:%02d", $endTime[0], $endTime[1]); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); $this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml'); unset($this->view->showContent); } - */ + + public function showContentDialogAction() + { + $start_timestamp = $this->_getParam('start'); + $end_timestamp = $this->_getParam('end'); + $showId = $this->_getParam('id'); + + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); + + $user = new User($userInfo->id, $userInfo->type); + $show = new Show($user, $showId); + + $this->view->showContent = $show->getShowListContent($start_timestamp); + $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); + + unset($this->view->showContent); + } } + + diff --git a/application/controllers/SearchController.php b/application/controllers/SearchController.php index 7a8981d9f..93f3d40c5 100644 --- a/application/controllers/SearchController.php +++ b/application/controllers/SearchController.php @@ -45,7 +45,6 @@ class SearchController extends Zend_Controller_Action { $this->_helper->layout->setLayout('search'); - $this->view->headScript()->appendFile('/js/airtime/onready/search.js','text/javascript'); $this->view->headScript()->appendFile('/js/contextmenu/jjmenu.js','text/javascript'); $this->view->headLink()->appendStylesheet('/css/contextmenu.css'); diff --git a/application/models/Schedule.php b/application/models/Schedule.php index b8be30c16..037093c3e 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -353,14 +353,7 @@ class Schedule { return $percent; } - // public function onAddTrackToPlaylist($playlistId, $audioTrackId) { - // - // } - // - // public function onRemoveTrackFromPlaylist($playlistId, $audioTrackId) { - // - // } - + /** * Return TRUE if file is going to be played in the future. * diff --git a/application/models/Shows.php b/application/models/Shows.php index 736ea2339..40ff45d75 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -330,10 +330,10 @@ class Show { return !Schedule::isScheduleEmptyInRange($start_timestamp, $length); } - public function getShowContent($day) { - global $CC_DBC; + public function getShowListContent($start_timestamp) { + global $CC_DBC; - $timeinfo = explode(" ", $day); + $timeinfo = explode(" ", $start_timestamp); $sql = "SELECT * FROM (cc_show_schedule AS ss LEFT JOIN cc_schedule AS s USING(group_id) @@ -342,9 +342,15 @@ class Show { WHERE ss.show_day = '{$timeinfo[0]}' AND ss.show_id = '{$this->_showId}' ORDER BY starts"; - $res = $CC_DBC->GetAll($sql); + return $CC_DBC->GetAll($sql); + } - if(count($res) <= 0) { + public function getShowContent($start_timestamp) { + global $CC_DBC; + + $res = $this->getShowListContent($start_timestamp); + + if(count($res) <= 0) { return $res; } @@ -429,14 +435,12 @@ class Show { $sql = "DELETE FROM cc_show_days WHERE first_show >= '{$date}' AND show_id = '{$this->_showId}'"; $CC_DBC->query($sql); - //echo $sql; - + $sql = "UPDATE cc_show_days SET last_show = '{$date}' WHERE show_id = '{$this->_showId}' AND first_show <= '{$date}' "; $CC_DBC->query($sql); - //echo $sql; - + $sql = "SELECT group_id FROM cc_show_schedule WHERE show_day >= '{$date}' AND show_id = '{$this->_showId}'"; $rows = $CC_DBC->GetAll($sql); @@ -449,11 +453,9 @@ class Show { $sql = "DELETE FROM cc_show_schedule WHERE ($groups) AND show_id = '{$this->_showId}' AND show_day >= '{$date}' "; $CC_DBC->query($sql); - //echo $sql; $sql = "DELETE FROM cc_schedule WHERE ($groups)"; $CC_DBC->query($sql); - //echo $sql; } else { $groups = CcShowScheduleQuery::create()->filterByDbShowId($this->_showId)->find(); diff --git a/application/views/scripts/schedule/schedule-show-dialog.phtml b/application/views/scripts/schedule/schedule-show-dialog.phtml index 5781eaf74..80962ce76 100644 --- a/application/views/scripts/schedule/schedule-show-dialog.phtml +++ b/application/views/scripts/schedule/schedule-show-dialog.phtml @@ -1,5 +1,5 @@
-

showName; ?>, showLength; ?>

+

showName; ?>: wday." ".$this->month." ".$this->day.", ".$this->startTime." - ".$this->endTime; ?>

diff --git a/application/views/scripts/schedule/show-content-dialog.phtml b/application/views/scripts/schedule/show-content-dialog.phtml new file mode 100644 index 000000000..dcfb943af --- /dev/null +++ b/application/views/scripts/schedule/show-content-dialog.phtml @@ -0,0 +1,12 @@ +
+showContent as $row): ?> +
+ + + + + + +
+ +
diff --git a/public/js/airtime/library/advancedsearch.js b/public/js/airtime/library/advancedsearch.js index 85ae0b85a..cff0065c9 100644 --- a/public/js/airtime/library/advancedsearch.js +++ b/public/js/airtime/library/advancedsearch.js @@ -36,7 +36,7 @@ function ajaxAddGroup() { }); } -function setUpSearch() { +$(document).ready(function() { $("#search_add_group").click(ajaxAddGroup); @@ -45,4 +45,4 @@ function setUpSearch() { $('[id^="fieldset-row_"]').each(function(i, el){ addRemove(el); }); -} +}); diff --git a/public/js/airtime/library/library.js b/public/js/airtime/library/library.js index 56f0f2afc..6537e8a35 100644 --- a/public/js/airtime/library/library.js +++ b/public/js/airtime/library/library.js @@ -71,7 +71,7 @@ function dtDrawCallback() { addLibraryItemEvents(); } -function setUpLibrary() { +$(document).ready(function() { $('.tabs').tabs(); @@ -103,5 +103,5 @@ function setUpLibrary() { "sPaginationType": "full_numbers", "bJQueryUI": true, "bAutoWidth": false - } ); -} + }); +}); diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index 7627d6af4..d3105084b 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -377,7 +377,7 @@ function openDiffSPL(json) { setUpSPL(); } -function setUpSPL() { +$(document).ready(function() { $("#spl_sortable").sortable(); $("#spl_sortable" ).bind( "sortstop", moveSPLItem); @@ -401,5 +401,4 @@ function setUpSPL() { $("#spl_sortable").droppable(); $("#spl_sortable" ).bind( "drop", addSPLItem); -} - +}); diff --git a/public/js/airtime/onready/library.js b/public/js/airtime/onready/library.js deleted file mode 100644 index 55920fff9..000000000 --- a/public/js/airtime/onready/library.js +++ /dev/null @@ -1,5 +0,0 @@ -$(document).ready(function() { - - setUpLibrary(); - setUpSPL(); -}); diff --git a/public/js/airtime/onready/search.js b/public/js/airtime/onready/search.js deleted file mode 100644 index cfd22d817..000000000 --- a/public/js/airtime/onready/search.js +++ /dev/null @@ -1,7 +0,0 @@ -$(document).ready(function() { - - setUpLibrary(); - setUpSearch(); - setUpSPL(); - -}); diff --git a/public/js/airtime/schedule/full-calendar-functions.js b/public/js/airtime/schedule/full-calendar-functions.js index 2a7e58446..c26041c4f 100644 --- a/public/js/airtime/schedule/full-calendar-functions.js +++ b/public/js/airtime/schedule/full-calendar-functions.js @@ -22,10 +22,11 @@ function dayClick(date, allDay, jsEvent, view) { } function viewDisplay( view ) { - + + $('.schedule_change_slots').remove(); + if(view.name === 'agendaDay' || view.name === 'agendaWeek') { - $('.schedule_change_slots').remove(); var calendarEl = this; var select = $('