CC-2181: No cancel button on Update show

-Pressing "Close" will now clear the form
-Editing show will now hide "+ Show" button
This commit is contained in:
martin 2011-04-13 16:59:53 -04:00
parent 2148de0e92
commit 5b0121712b
6 changed files with 62 additions and 14 deletions

View File

@ -25,6 +25,7 @@ class ScheduleController extends Zend_Controller_Action
->addActionContext('edit-show', 'json') ->addActionContext('edit-show', 'json')
->addActionContext('add-show', 'json') ->addActionContext('add-show', 'json')
->addActionContext('cancel-show', 'json') ->addActionContext('cancel-show', 'json')
->addActionContext('get-form', 'json')
->addActionContext('upload-to-sound-cloud', 'json') ->addActionContext('upload-to-sound-cloud', 'json')
->initContext(); ->initContext();
@ -48,8 +49,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet('/css/add-show.css'); $this->view->headLink()->appendStylesheet('/css/add-show.css');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css'); $this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$request = $this->getRequest();
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho(); $formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen(); $formWhen = new Application_Form_AddShowWhen();
@ -66,7 +65,6 @@ class ScheduleController extends Zend_Controller_Action
$formStyle->removeDecorator('DtDdWrapper'); $formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper'); $formRecord->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat; $this->view->what = $formWhat;
$this->view->when = $formWhen; $this->view->when = $formWhen;
$this->view->repeats = $formRepeats; $this->view->repeats = $formRepeats;
@ -399,6 +397,12 @@ class ScheduleController extends Zend_Controller_Action
public function editShowAction() public function editShowAction()
{ {
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if(!$user->isAdmin()) {
return;
}
$showInstanceId = $this->_getParam('id'); $showInstanceId = $this->_getParam('id');
$formWhat = new Application_Form_AddShowWhat(); $formWhat = new Application_Form_AddShowWhat();
@ -495,6 +499,38 @@ class ScheduleController extends Zend_Controller_Action
$this->view->entries = 5; $this->view->entries = 5;
} }
public function getFormAction(){
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
$formStyle = new Application_Form_AddShowStyle();
$formRecord = new Application_Form_AddShowRR();
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
$this->view->who = $formWho;
$this->view->style = $formStyle;
$this->view->rr = $formRecord;
$this->view->absoluteRebroadcast = $formAbsoluteRebroadcast;
$this->view->rebroadcast = $formRebroadcast;
$this->view->addNewShow = true;
$formWhat->populate(array('add_show_id' => '-1'));
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
}
public function addShowAction() public function addShowAction()
{ {
$js = $this->_getParam('data'); $js = $this->_getParam('data');

View File

@ -1,2 +1 @@
<?php //left empty on purpose
//$this->entries;

View File

@ -0,0 +1 @@
//left empty on purpose

View File

@ -189,6 +189,13 @@ function setAddShowEvents() {
$("#schedule_calendar").width(y+z+50); $("#schedule_calendar").width(y+z+50);
$("#schedule_calendar").fullCalendar('render'); $("#schedule_calendar").fullCalendar('render');
$("#add-show-form").hide(); $("#add-show-form").hide();
$.get("/Schedule/get-form", {format:"json"}, function(json){
$("#add-show-form")
.empty()
.append(json.form);
setAddShowEvents();
});
makeAddShowButton(); makeAddShowButton();
}); });

View File

@ -25,21 +25,26 @@ function makeAddShowButton(){
.append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>Show</a></span>') .append('<span class="fc-button"><a href="#" class="add-button"><span class="add-icon"></span>Show</a></span>')
.find('span.fc-button:last > a') .find('span.fc-button:last > a')
.click(function(){ .click(function(){
openAddShowForm(); openAddShowForm();
removeAddShowButton();
var span = $(this).parent();
$(span).prev().remove();
$(span).remove();
}); });
} }
function beginEditShow(data){ function removeAddShowButton(){
//alert (data.entries); var aTag = $('.fc-header-left')
.find("span.fc-button:last > a");
var span = aTag.parent();
span.prev().remove();
span.remove();
}
function beginEditShow(data){
$("#add-show-form") $("#add-show-form")
.empty() .empty()
.append(data.newForm); .append(data.newForm);
removeAddShowButton();
setAddShowEvents(); setAddShowEvents();
openAddShowForm(); openAddShowForm();
} }

View File

@ -76,7 +76,7 @@ function getDateString(){
return (date0.getFullYear() + "-" + (parseInt(date0.getMonth())+1) + "-" + date0.getDate()); return (date0.getFullYear() + "-" + (parseInt(date0.getMonth())+1) + "-" + date0.getDate());
} }
function getAJAXURL(){ function getAjaxUrl(){
var url = "/Nowplaying/get-data-grid-data/format/json/view/"+viewType; var url = "/Nowplaying/get-data-grid-data/format/json/view/"+viewType;
if (viewType == "day"){ if (viewType == "day"){
@ -99,7 +99,7 @@ function updateDataTable(){
} }
function getData(){ function getData(){
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){ $.ajax({ url: getAjaxUrl(), dataType:"json", success:function(data){
datagridData = data.entries; datagridData = data.entries;
if (datagridData.currentShow.length > 0) if (datagridData.currentShow.length > 0)
currentShowInstanceID = datagridData.currentShow[0].instance_id; currentShowInstanceID = datagridData.currentShow[0].instance_id;