CC-3174 : showbuilder

removing old scheduling method code to avoid confusion.
This commit is contained in:
Naomi Aro 2012-02-22 13:19:49 +01:00
parent 2aae318a5a
commit 0ba3049528
9 changed files with 30 additions and 400 deletions

View File

@ -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');

View File

@ -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;

View File

@ -1,11 +0,0 @@
<li id="sp_<?php echo $this->id ?>" class="ui-widget-content">
<span><?php echo $this->name ?></span>
<span><?php echo $this->length ?></span>
<div>
<span>Creator: <?php echo $this->creator ?></span>
<?php if($this->state === "edited") : ?>
<span>Editing: <?php echo $this->login ?></span>
<?php endif ?>
</div>
<div><?php echo $this->description ?></div>
</li>

View File

@ -1,8 +0,0 @@
<?php
if(count($this->playlists) > 0) {
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
}
else {
echo "No Playlists Fit Duration";
}
?>

View File

@ -1,8 +0,0 @@
<?php
if(count($this->playlists) > 0) {
echo $this->partialLoop('schedule/find-playlists-partial.phtml', $this->playlists);
}
else {
echo "No Playlists Fit Duration";
}
?>

View File

@ -1,34 +0,0 @@
<div id="schedule_playlist_dialog">
<h2 id="scheduled_playlist_name">
<?php echo $this->showName; ?>: <span><?php echo $this->s_wday." ".$this->s_month." ".$this->s_day." ".$this->startTime.
" - ".$this->e_wday." ".$this->e_month." ".$this->e_day." ".$this->endTime; ?></span>
</h2>
<div class="clearfix">
<div class="wrapp-one">
<table id="schedule_playlists" cellpadding="0" cellspacing="0" class="datatable">
<thead>
<tr>
<th>Id</th>
<th>Description</th>
<th>Title</th>
<th>Creator</th>
<th>Length</th>
<th>Editing</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<div class="wrapp-two">
<div><h4>Items In This Show:</h4></div>
<ul id="schedule_playlist_chosen"></ul>
<div id="show_time_info">
<span id="show_time_filled" class="time"><?php echo $this->timeFilled; ?></span>
<div id="show_progressbar"></div>
<span id="show_length" class="time"><?php echo $this->showLength; ?></span>
</div>
<div id="show_time_warning" style="display:none"></div>
</div>
</div>
</div>

View File

@ -1,26 +0,0 @@
<?php if(count($this->showContent) > 0) : ?>
<?php foreach($this->showContent as $pl) : ?>
<li id="g_<?php echo $pl["pl_group"] ?>" >
<h3 class="ui-accordion-header ui-state-default ui-corner-all">
<span class="ui-icon ui-icon-triangle-1-e"></span>
<span class="ui-icon ui-icon-close"></span>
<div class="sh_pl_name"><?php echo $pl["pl_name"] ?></div>
<div class="sh_pl_creator"><?php echo $pl["pl_creator"] ?></div>
<div class="sh_pl_time"><?php echo $pl["pl_length"] ?></div>
</h3>
<div class="group_list ui-widget-content ui-corner-bottom" style="display:none">
<div class="sched_description"><?php echo $pl["pl_description"] ?></div>
<?php foreach($pl["pl_content"] as $file) : ?>
<div>
<span class="sh_file_name"><?php echo $file["f_name"] ?></span>
<span><?php echo $file["f_length"] ?></span>
</div>
<div class="sh_file_artist"><?php echo $file["f_artist"] ?></div>
<?php endforeach; ?>
</div>
</li>
<?php endforeach; ?>
<?php else : ?>
<li>Nothing Scheduled</li>
<?php endif; ?>

View File

@ -217,6 +217,21 @@ $(document).ready(function() {
$('.tabs').tabs();
oTable = $('#library_display').dataTable( {
"aoColumns": [
/* Checkbox */ {"sTitle": "<input type='checkbox' name='pl_cb_all'>", "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": "<input type='checkbox' name='pl_cb_all'>", "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,

View File

@ -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);