new acl permissions, add show form is done by ajax request now.
This commit is contained in:
parent
2b5927bf33
commit
27b462d638
|
@ -26,14 +26,14 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
|
|||
$ccAcl->allow('guest', 'index')
|
||||
->allow('guest', 'login')
|
||||
->allow('guest', 'error')
|
||||
->allow('guest', 'library')
|
||||
->allow('guest', 'nowplaying')
|
||||
->allow('guest', 'search')
|
||||
->allow('guest', 'api')
|
||||
->allow('guest', 'schedule')
|
||||
->allow('host', 'library')
|
||||
->allow('host', 'search')
|
||||
->allow('host', 'plupload')
|
||||
->allow('host', 'playlist')
|
||||
->allow('host', 'sideplaylist')
|
||||
->allow('host', 'schedule')
|
||||
->allow('admin', 'user')
|
||||
->allow('admin', 'preference');
|
||||
|
||||
|
|
|
@ -304,11 +304,12 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$js = $this->_getParam('data');
|
||||
$data = array();
|
||||
|
||||
|
||||
//need to convert from serialized jQuery array.
|
||||
foreach($js as $j){
|
||||
$data[$j["name"]] = $j["value"];
|
||||
}
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
|
@ -343,10 +344,31 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
if ($what && $when && $repeats && $who && $style) {
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new User($userInfo->id);
|
||||
if($user->isAdmin()) {
|
||||
Show::addShow($data);
|
||||
}
|
||||
//$this->_redirect('Schedule');
|
||||
|
||||
//send back a new form for the user.
|
||||
$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();
|
||||
|
||||
$formWhat->removeDecorator('DtDdWrapper');
|
||||
$formWho->removeDecorator('DtDdWrapper');
|
||||
$formWhen->removeDecorator('DtDdWrapper');
|
||||
$formRepeats->removeDecorator('DtDdWrapper');
|
||||
$formStyle->removeDecorator('DtDdWrapper');
|
||||
|
||||
$this->view->what = $formWhat;
|
||||
$this->view->when = $formWhen;
|
||||
$this->view->repeats = $formRepeats;
|
||||
$this->view->who = $formWho;
|
||||
$this->view->style = $formStyle;
|
||||
$this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
|
||||
}
|
||||
else {
|
||||
|
||||
|
|
|
@ -131,9 +131,15 @@ function setAddShowEvents() {
|
|||
event.preventDefault();
|
||||
|
||||
var data = $("form").serializeArray();
|
||||
var y;
|
||||
var string = $("form").serialize();
|
||||
|
||||
$.post("/Schedule/add-show", {format: "json", data: data}, function(json){
|
||||
var hosts = $('#add_show_hosts-element input').map(function() {
|
||||
if($(this).attr("checked")) {
|
||||
return $(this).val();
|
||||
}
|
||||
}).get();
|
||||
|
||||
$.post("/Schedule/add-show", {format: "json", data: data, hosts: hosts}, function(json){
|
||||
if(json.form) {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
|
@ -143,6 +149,11 @@ function setAddShowEvents() {
|
|||
showErrorSections();
|
||||
}
|
||||
else {
|
||||
$("#add-show-form")
|
||||
.empty()
|
||||
.append(json.newForm);
|
||||
|
||||
setAddShowEvents();
|
||||
scheduleRefetchEvents();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue