-began progress, not complete yet. Show can be deleted from database while it is playing, need to notify pypo as well
This commit is contained in:
martin 2011-03-09 22:25:02 -05:00
parent bfbca3f724
commit 43a9b63fb5
4 changed files with 37 additions and 0 deletions

View File

@ -71,6 +71,7 @@
<actionMethod actionName="editShow"/>
<actionMethod actionName="addShow"/>
<actionMethod actionName="cancelShow"/>
<actionMethod actionName="cancelCurrentShow"/>
</controllerFile>
<controllerFile controllerName="Api">
<actionMethod actionName="index"/>
@ -335,6 +336,9 @@
<viewControllerScriptsDirectory forControllerName="Recorder">
<viewScriptFile forActionName="getShowSchedule"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Schedule">
<viewScriptFile forActionName="cancelCurrentShow"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>

View File

@ -153,6 +153,15 @@ class ScheduleController extends Zend_Controller_Action
}
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/show-content-dialog'.$params, 'callback' => 'window["buildContentDialog"]'),
'title' => 'Show Content');
if (strtotime($show->getShowStart()) <= strtotime($today_timestamp) &&
strtotime($today_timestamp) < strtotime($show->getShowEnd())) {
$menu[] = array('action' => array('type' => 'fn',
//'url' => '/Schedule/cancel-current-show'.$params,
'callback' => "window['confirmCancelShow']($id)"),
'title' => 'Cancel Current Show');
}
if (strtotime($today_timestamp) < strtotime($show->getShowStart())) {
if ($user->isAdmin()) {
$menu[] = array('action' => array('type' => 'ajax', 'url' => '/Schedule/delete-show'.$params, 'callback' => 'window["scheduleRefetchEvents"]'), 'title' => 'Delete This Instance');
@ -392,6 +401,19 @@ class ScheduleController extends Zend_Controller_Action
$show->cancelShow($showInstance->getShowStart());
}
}
public function cancelCurrentShowAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if($user->isAdmin()) {
$showInstanceId = $this->_getParam('id');
$show = new ShowInstance($showInstanceId);
$show->clearShow();
$show->deleteShow();
}
}
}

View File

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>cancelCurrentShow</b></center>

View File

@ -155,6 +155,16 @@ function makeScheduleDialog(dialog, json) {
setScheduleDialogEvents(dialog);
}
function confirmCancelShow(show_instance_id){
if(confirm('Erase current show and stop playback?')){
var url = "/Schedule/cancel-current-show/id/"+show_instance_id;
$.ajax({
url: url,
success: function(data){scheduleRefetchEvents();}
});
}
}
function buildContentDialog(json){
var dialog = $(json.dialog);