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('add-show', 'json')
->addActionContext('cancel-show', 'json')
->addActionContext('get-form', 'json')
->addActionContext('upload-to-sound-cloud', 'json')
->initContext();
@ -48,8 +49,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->headLink()->appendStylesheet('/css/add-show.css');
$this->view->headLink()->appendStylesheet('/css/contextmenu.css');
$request = $this->getRequest();
$formWhat = new Application_Form_AddShowWhat();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
@ -66,7 +65,6 @@ class ScheduleController extends Zend_Controller_Action
$formStyle->removeDecorator('DtDdWrapper');
$formRecord->removeDecorator('DtDdWrapper');
$this->view->what = $formWhat;
$this->view->when = $formWhen;
$this->view->repeats = $formRepeats;
@ -399,6 +397,12 @@ class ScheduleController extends Zend_Controller_Action
public function editShowAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id);
if(!$user->isAdmin()) {
return;
}
$showInstanceId = $this->_getParam('id');
$formWhat = new Application_Form_AddShowWhat();
@ -495,6 +499,38 @@ class ScheduleController extends Zend_Controller_Action
$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()
{
$js = $this->_getParam('data');

View File

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

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").fullCalendar('render');
$("#add-show-form").hide();
$.get("/Schedule/get-form", {format:"json"}, function(json){
$("#add-show-form")
.empty()
.append(json.form);
setAddShowEvents();
});
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>')
.find('span.fc-button:last > a')
.click(function(){
openAddShowForm();
var span = $(this).parent();
$(span).prev().remove();
$(span).remove();
openAddShowForm();
removeAddShowButton();
});
}
function beginEditShow(data){
//alert (data.entries);
function removeAddShowButton(){
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")
.empty()
.append(data.newForm);
removeAddShowButton();
setAddShowEvents();
openAddShowForm();
}

View File

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