From 0ba3049528a1a68814a0525e97e1d6d2b4acbee5 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 22 Feb 2012 13:19:49 +0100 Subject: [PATCH] CC-3174 : showbuilder removing old scheduling method code to avoid confusion. --- .../controllers/ScheduleController.php | 95 -------- airtime_mvc/application/models/StoredFile.php | 12 +- .../schedule/find-playlists-partial.phtml | 11 - .../schedule/find-playlists.ajax.phtml | 8 - .../scripts/schedule/find-playlists.phtml | 8 - .../schedule/schedule-show-dialog.phtml | 34 --- .../scripts/schedule/scheduled-content.phtml | 26 --- .../public/js/airtime/library/library.js | 28 +-- .../public/js/airtime/schedule/schedule.js | 208 ++---------------- 9 files changed, 30 insertions(+), 400 deletions(-) delete mode 100644 airtime_mvc/application/views/scripts/schedule/find-playlists-partial.phtml delete mode 100644 airtime_mvc/application/views/scripts/schedule/find-playlists.ajax.phtml delete mode 100644 airtime_mvc/application/views/scripts/schedule/find-playlists.phtml delete mode 100644 airtime_mvc/application/views/scripts/schedule/schedule-show-dialog.phtml delete mode 100644 airtime_mvc/application/views/scripts/schedule/scheduled-content.phtml diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index e0b326e55..86678e8ba 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -15,12 +15,9 @@ class ScheduleController extends Zend_Controller_Action ->addActionContext('move-show', 'json') ->addActionContext('resize-show', 'json') ->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') ->addActionContext('remove-group', 'json') ->addActionContext('edit-show', 'json') ->addActionContext('add-show', 'json') @@ -43,8 +40,6 @@ class ScheduleController extends Zend_Controller_Action $baseUrl = $request->getBaseUrl(); $this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); - $this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); //full-calendar-functions.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"); @@ -264,37 +259,6 @@ class ScheduleController extends Zend_Controller_Action $this->view->items = $menu; } - public function scheduleShowAction() - { - $showInstanceId = $this->sched_sess->showInstanceId; - $search = $this->_getParam('search', null); - $plId = $this->_getParam('plId'); - - if($search == "") { - $search = null; - } - - $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new Application_Model_User($userInfo->id); - try{ - $show = new Application_Model_ShowInstance($showInstanceId); - }catch(Exception $e){ - $this->view->show_error = true; - return false; - } - - if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST),$show->getShowId())) { - $show->scheduleShow(array($plId)); - } - - $this->view->showContent = $show->getShowContent(); - $this->view->timeFilled = $show->getTimeScheduled(); - $this->view->percentFilled = $show->getPercentScheduled(); - - $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); - unset($this->view->showContent); - } - public function clearShowAction() { $showInstanceId = $this->_getParam('id'); @@ -336,27 +300,6 @@ class ScheduleController extends Zend_Controller_Action $this->view->entries = $range; } - public function findPlaylistsAction() - { - $post = $this->getRequest()->getPost(); - try{ - $show = new Application_Model_ShowInstance($this->sched_sess->showInstanceId); - }catch(Exception $e){ - $this->view->show_error = true; - return false; - } - - $playlists = $show->searchPlaylistsForShow($post); - foreach( $playlists['aaData'] as &$data){ - // calling two functions to format time to 1 decimal place - $sec = Application_Model_Playlist::playlistTimeToSeconds($data['length']); - $data['length'] = Application_Model_Playlist::secondsToPlaylistTime($sec); - } - - //for datatables - die(json_encode($playlists)); - } - public function removeGroupAction() { $showInstanceId = $this->sched_sess->showInstanceId; @@ -383,44 +326,6 @@ class ScheduleController extends Zend_Controller_Action unset($this->view->showContent); } - public function scheduleShowDialogAction() - { - $showInstanceId = $this->_getParam('id'); - $this->sched_sess->showInstanceId = $showInstanceId; - - try{ - $show = new Application_Model_ShowInstance($showInstanceId); - }catch(Exception $e){ - $this->view->show_error = true; - return false; - } - - $start_timestamp = $show->getShowInstanceStart(); - $end_timestamp = $show->getShowInstanceEnd(); - - $dateInfo_s = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($start_timestamp))); - $dateInfo_e = getDate(strtotime(Application_Model_DateHelper::ConvertToLocalDateTimeString($end_timestamp))); - - $this->view->showContent = $show->getShowContent(); - $this->view->timeFilled = $show->getTimeScheduled(); - $this->view->showName = $show->getName(); - $this->view->showLength = $show->getShowLength(); - $this->view->percentFilled = $show->getPercentScheduled(); - - $this->view->s_wday = $dateInfo_s['weekday']; - $this->view->s_month = $dateInfo_s['month']; - $this->view->s_day = $dateInfo_s['mday']; - $this->view->e_wday = $dateInfo_e['weekday']; - $this->view->e_month = $dateInfo_e['month']; - $this->view->e_day = $dateInfo_e['mday']; - $this->view->startTime = sprintf("%02d:%02d", $dateInfo_s['hours'], $dateInfo_s['minutes']); - $this->view->endTime = sprintf("%02d:%02d", $dateInfo_e['hours'], $dateInfo_e['minutes']); - - $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() { $showInstanceId = $this->_getParam('id'); diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index e1016baea..85452efd3 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -582,7 +582,8 @@ class Application_Model_StoredFile { public static function searchFilesForPlaylistBuilder($datatables) { global $CC_CONFIG; - $displayData = array("track_title", "artist_name", "album_title", "genre", "length", "year", "utime", "mtime", "ftype", "track_number"); + $displayData = array("track_title", "artist_name", "album_title", "genre", "length", + "year", "utime", "mtime", "ftype", "track_number"); $plSelect = "SELECT "; $fileSelect = "SELECT "; @@ -656,15 +657,6 @@ class Application_Model_StoredFile { return $results; } - public static function searchPlaylistsForSchedule($datatables) - { - $fromTable = "cc_playlist AS pl LEFT JOIN cc_playlisttimes AS plt USING(id) LEFT JOIN cc_subjs AS sub ON pl.editedby = sub.id"; - //$datatables["optWhere"][] = "INTERVAL '{$time_remaining}' > INTERVAL '00:00:00'"; - $datatables["optWhere"][] = "plt.length > INTERVAL '00:00:00'"; - - return Application_Model_StoredFile::searchFiles($fromTable, $datatables); - } - public static function searchFiles($fromTable, $data) { global $CC_CONFIG, $CC_DBC; diff --git a/airtime_mvc/application/views/scripts/schedule/find-playlists-partial.phtml b/airtime_mvc/application/views/scripts/schedule/find-playlists-partial.phtml deleted file mode 100644 index 6f79a662c..000000000 --- a/airtime_mvc/application/views/scripts/schedule/find-playlists-partial.phtml +++ /dev/null @@ -1,11 +0,0 @@ -
  • - name ?> - length ?> -
    - Creator: creator ?> - state === "edited") : ?> - Editing: login ?> - -
    -
    description ?>
    -
  • diff --git a/airtime_mvc/application/views/scripts/schedule/find-playlists.ajax.phtml b/airtime_mvc/application/views/scripts/schedule/find-playlists.ajax.phtml deleted file mode 100644 index 185ce5f98..000000000 --- a/airtime_mvc/application/views/scripts/schedule/find-playlists.ajax.phtml +++ /dev/null @@ -1,8 +0,0 @@ -playlists) > 0) { - echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists); - } - else { - echo "No Playlists Fit Duration"; - } -?> diff --git a/airtime_mvc/application/views/scripts/schedule/find-playlists.phtml b/airtime_mvc/application/views/scripts/schedule/find-playlists.phtml deleted file mode 100644 index 185ce5f98..000000000 --- a/airtime_mvc/application/views/scripts/schedule/find-playlists.phtml +++ /dev/null @@ -1,8 +0,0 @@ -playlists) > 0) { - echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists); - } - else { - echo "No Playlists Fit Duration"; - } -?> diff --git a/airtime_mvc/application/views/scripts/schedule/schedule-show-dialog.phtml b/airtime_mvc/application/views/scripts/schedule/schedule-show-dialog.phtml deleted file mode 100644 index 2085d67e9..000000000 --- a/airtime_mvc/application/views/scripts/schedule/schedule-show-dialog.phtml +++ /dev/null @@ -1,34 +0,0 @@ -
    -

    - showName; ?>: s_wday." ".$this->s_month." ".$this->s_day." ".$this->startTime. - " - ".$this->e_wday." ".$this->e_month." ".$this->e_day." ".$this->endTime; ?> -

    -
    -
    - - - - - - - - - - - - -
    IdDescriptionTitleCreatorLengthEditing
    -
    - -
    -

    Items In This Show:

    -
      -
      - timeFilled; ?> -
      - showLength; ?> -
      - -
      -
      -
      diff --git a/airtime_mvc/application/views/scripts/schedule/scheduled-content.phtml b/airtime_mvc/application/views/scripts/schedule/scheduled-content.phtml deleted file mode 100644 index c58492027..000000000 --- a/airtime_mvc/application/views/scripts/schedule/scheduled-content.phtml +++ /dev/null @@ -1,26 +0,0 @@ -showContent) > 0) : ?> - showContent as $pl) : ?> -
    • " > -

      - - -
      -
      -
      -

      - -
    • - - -
    • Nothing Scheduled
    • - - diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index 556780747..3098277d5 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -217,6 +217,21 @@ $(document).ready(function() { $('.tabs').tabs(); oTable = $('#library_display').dataTable( { + + "aoColumns": [ + /* Checkbox */ {"sTitle": "", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "library_checkbox"}, + /* Type */ {"sName": "ftype", "bSearchable": false, "mDataProp": "image", "sWidth": "25px", "sClass": "library_type"}, + /* Title */ {"sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sClass": "library_title"}, + /* Creator */ {"sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name", "sClass": "library_creator"}, + /* Album */ {"sTitle": "Album", "sName": "album_title", "mDataProp": "album_title", "sClass": "library_album"}, + /* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sClass": "library_genre"}, + /* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sClass": "library_year"}, + /* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sClass": "library_length"}, + /* Upload Time */ {"sTitle": "Uploaded", "sName": "utime", "mDataProp": "utime", "sClass": "library_upload_time"}, + /* Last Modified */ {"sTitle": "Last Modified", "sName": "mtime", "bVisible": false, "mDataProp": "mtime", "sClass": "library_modified_time"}, + /* Track Number */ {"sTitle": "Track", "sName": "track_number", "bSearchable": false, "bVisible": false, "mDataProp": "track_number", "sClass": "library_track"} + ], + "bProcessing": true, "bServerSide": true, @@ -341,19 +356,6 @@ $(document).ready(function() { $(nHead).find("input[type=checkbox]").attr("checked", false); }, - "aoColumns": [ - /* Checkbox */ {"sTitle": "", "bSortable": false, "bSearchable": false, "mDataProp": "checkbox", "sWidth": "25px", "sClass": "library_checkbox"}, - /* Type */ {"sName": "ftype", "bSearchable": false, "mDataProp": "image", "sWidth": "25px", "sClass": "library_type"}, - /* Title */ {"sTitle": "Title", "sName": "track_title", "mDataProp": "track_title", "sClass": "library_title"}, - /* Creator */ {"sTitle": "Creator", "sName": "artist_name", "mDataProp": "artist_name", "sClass": "library_creator"}, - /* Album */ {"sTitle": "Album", "sName": "album_title", "mDataProp": "album_title", "sClass": "library_album"}, - /* Genre */ {"sTitle": "Genre", "sName": "genre", "mDataProp": "genre", "sClass": "library_genre"}, - /* Year */ {"sTitle": "Year", "sName": "year", "mDataProp": "year", "sClass": "library_year"}, - /* Length */ {"sTitle": "Length", "sName": "length", "mDataProp": "length", "sClass": "library_length"}, - /* Upload Time */ {"sTitle": "Uploaded", "sName": "utime", "mDataProp": "utime", "sClass": "library_upload_time"}, - /* Last Modified */ {"sTitle": "Last Modified", "sName": "mtime", "bVisible": false, "mDataProp": "mtime", "sClass": "library_modified_time"}, - /* Track Number */ {"sTitle": "Track", "sName": "track_number", "bSearchable": false, "bVisible": false, "mDataProp": "track_number", "sClass": "library_track"} - ], "aaSorting": [[2,'asc']], "sPaginationType": "full_numbers", "bJQueryUI": true, diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index b80147442..8cd072b2c 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -26,155 +26,8 @@ function checkShowLength(json) { } } - -function setScheduleDialogHtml(json) { - var dt; - - dt = $('#schedule_playlists').dataTable(); - dt.fnDraw(); - - $("#schedule_playlist_chosen") - .empty() - .append(json.chosen); - - $("#show_time_filled").empty().append(json.timeFilled); - $("#show_progressbar").progressbar( "value" , json.percentFilled ); - - checkShowLength(json); -} - -function setScheduleDialogEvents(dialog) { - - dialog.find(".ui-icon-triangle-1-e").click(function(){ - var span = $(this); - - if(span.hasClass("ui-icon-triangle-1-s")) { - span - .removeClass("ui-icon-triangle-1-s") - .addClass("ui-icon ui-icon-triangle-1-e"); - - $(this).parent().parent().find(".group_list").hide(); - } - else if(span.hasClass("ui-icon-triangle-1-e")) { - span - .removeClass("ui-icon-triangle-1-e") - .addClass("ui-icon ui-icon-triangle-1-s"); - - $(this).parent().parent().find(".group_list").show(); - } - }); - - dialog.find(".ui-icon-close").click(function(){ - var groupId, url; - - groupId = $(this).parent().parent().attr("id").split("_").pop(); - url = '/Schedule/remove-group'; - - $.post(url, - {format: "json", groupId: groupId}, - function(json){ - if(json.show_error == true){ - alertShowErrorAndReload(); - } - var dialog = $("#schedule_playlist_dialog"); - - setScheduleDialogHtml(json); - setScheduleDialogEvents(dialog); - }); - }); -} - -function dtRowCallback( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { - var id = "pl_" + aData['id']; - - $(nRow).attr("id", id); - - return nRow; -} - -function addDtPlaylistEvents() { - - $('#schedule_playlists tbody tr') - .draggable({ - helper: 'clone' - }); -} - -function dtDrawCallback() { - addDtPlaylistEvents(); -} - -function makeScheduleDialog(dialog, json) { - if(json.show_error == true){ - alertShowErrorAndReload(); - } - dialog.find('#schedule_playlists').dataTable( { - "bProcessing": true, - "bServerSide": true, - "sAjaxSource": "/Schedule/find-playlists/format/json", - "fnServerData": function ( sSource, aoData, fnCallback ) { - $.ajax( { - "dataType": 'json', - "type": "POST", - "url": sSource, - "data": aoData, - "success": fnCallback - } ); - }, - "fnRowCallback": dtRowCallback, - "fnDrawCallback": dtDrawCallback, - "aoColumns": [ - /* Id */ {"sTitle": "ID", "sName": "pl.id", "bSearchable": false, "bVisible": false, "mDataProp": "id"}, - /* Description */ {"sTitle": "Description", "sName": "pl.description", "bSearchable": false, "bVisible": false, "mDataProp": "description"}, - /* Name */ {"sTitle": "Title", "sName": "pl.name", "mDataProp": "name"}, - /* Creator */ {"sTitle": "Creator", "sName": "pl.creator", "mDataProp": "creator"}, - /* Length */ {"sTitle": "Length", "sName": "plt.length", "mDataProp": "length"}, - /* Editing */ {"sTitle": "Editing", "sName": "sub.login", "mDataProp": "login"} - ], - "aaSorting": [[2,'asc']], - "sPaginationType": "full_numbers", - "bJQueryUI": true, - "bAutoWidth": false - }); - - //classes added for Vladimir's styles.css - dialog.find("#schedule_playlists_length select").addClass('input_select'); - dialog.find("#schedule_playlists_filter input").addClass('input_text auto-search'); - - dialog.find("#schedule_playlist_chosen") - .append(json.chosen) - .droppable({ - drop: function(event, ui) { - var pl_id, url, search; - - search = $("#schedule_playlist_search").val(); - pl_id = $(ui.helper).attr("id").split("_").pop(); - - url = '/Schedule/schedule-show/format/json'; - - $.post(url, - {plId: pl_id, search: search}, - function(json){ - if(json.show_error == true){ - alertShowErrorAndReload(); - } - var dialog = $("#schedule_playlist_dialog"); - - setScheduleDialogHtml(json); - setScheduleDialogEvents(dialog); - }); - } - }); - - dialog.find("#show_progressbar").progressbar({ - value: json.percentFilled - }); - - setScheduleDialogEvents(dialog); -} - function confirmCancelShow(show_instance_id){ - if(confirm('Erase current show and stop playback?')){ + if (confirm('Erase current show and stop playback?')){ var url = "/Schedule/cancel-current-show/id/"+show_instance_id; $.ajax({ url: url, @@ -184,7 +37,7 @@ function confirmCancelShow(show_instance_id){ } function confirmCancelRecordedShow(show_instance_id){ - if(confirm('Erase current show and stop recording?')){ + if (confirm('Erase current show and stop recording?')){ var url = "/Schedule/cancel-current-show/id/"+show_instance_id; $.ajax({ url: url, @@ -214,45 +67,42 @@ function uploadToSoundCloud(show_instance_id){ } } -function buildContentDialog(json){ - if(json.show_error == true){ +function buildContentDialog (json){ + var dialog = $(json.dialog), + viewportwidth, + viewportheight, + height, + width; + + if (json.show_error == true){ alertShowErrorAndReload(); } - var dialog = $(json.dialog); - + dialog.find("#show_progressbar").progressbar({ value: json.percentFilled }); - var viewportwidth; - var viewportheight; - // the more standards compliant browsers (mozilla/netscape/opera/IE7) use // window.innerWidth and window.innerHeight - if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerWidth, viewportheight = window.innerHeight; } - // IE6 in standards compliant mode (i.e. with a valid doctype as the first // line in the document) - else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { viewportwidth = document.documentElement.clientWidth; viewportheight = document.documentElement.clientHeight; } - // older versions of IE - else { viewportwidth = document.getElementsByTagName('body')[0].clientWidth; viewportheight = document.getElementsByTagName('body')[0].clientHeight; } - var height = viewportheight * 2/3; - var width = viewportwidth * 4/5; + height = viewportheight * 2/3; + width = viewportwidth * 4/5; dialog.dialog({ autoOpen: false, @@ -269,37 +119,6 @@ function buildContentDialog(json){ dialog.dialog('open'); } -function buildScheduleDialog(json){ - var dialog; - if(json.show_error == true){ - alertShowErrorAndReload(); - } - if(json.error) { - alert(json.error); - return; - } - - dialog = $(json.dialog); - makeScheduleDialog(dialog, json); - - dialog.dialog({ - autoOpen: false, - title: 'Schedule Media', - width: 1100, - height: 550, - modal: true, - close: closeDialog, - buttons: {"Ok": function() { - dialog.remove(); - $("#schedule_calendar").fullCalendar( 'refetchEvents' ); - }} - }); - - dialog.dialog('open'); - checkShowLength(json); -} - - /** * Use user preference for time scale; defaults to month if preference was never set */ @@ -412,7 +231,6 @@ $(document).ready(function() { //define a content callback. if (oItems.content !== undefined) { - //delete a single instance callback = function() { $.get(oItems.content.url, {format: "json", id: data.id}, function(json){ buildContentDialog(json);