Merge branch 'master' of dev.sourcefabric.org:campcaster

This commit is contained in:
mkonecny 2011-02-11 11:56:29 -05:00
commit b43db577dd
6 changed files with 50 additions and 48 deletions

View File

@ -6,11 +6,11 @@ class UserController extends Zend_Controller_Action
public function init() public function init()
{ {
$ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('get-hosts', 'json') $ajaxContext->addActionContext('get-hosts', 'json')
->addActionContext('get-user-data-table-info', 'json') ->addActionContext('get-user-data-table-info', 'json')
->addActionContext('get-user-data', 'json') ->addActionContext('get-user-data', 'json')
->addActionContext('remove-user', 'json') ->addActionContext('remove-user', 'json')
->initContext(); ->initContext();
} }
public function indexAction() public function indexAction()
@ -19,54 +19,51 @@ class UserController extends Zend_Controller_Action
public function addUserAction() public function addUserAction()
{ {
$this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript'); $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript');
$this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript'); $this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript');
$request = $this->getRequest(); $request = $this->getRequest();
$form = new Application_Form_AddUser(); $form = new Application_Form_AddUser();
if ($request->isPost()) { if ($request->isPost()) {
if ($form->isValid($request->getPost())) { if ($form->isValid($request->getPost())) {
$formdata = $form->getValues(); $formdata = $form->getValues();
if ($form->validateLogin($formdata)){ if ($form->validateLogin($formdata)){
$user = new User($formdata['user_id']); $user = new User($formdata['user_id']);
$user->setFirstName($formdata['first_name']); $user->setFirstName($formdata['first_name']);
$user->setLastName($formdata['last_name']); $user->setLastName($formdata['last_name']);
$user->setLogin($formdata['login']); $user->setLogin($formdata['login']);
if ($formdata['password'] != "xxxxxx") if ($formdata['password'] != "xxxxxx")
$user->setPassword($formdata['password']); $user->setPassword($formdata['password']);
$user->setType($formdata['type']); $user->setType($formdata['type']);
$user->save(); $user->save();
$form->reset(); $form->reset();
} }
} }
} }
$this->view->form = $form; $this->view->form = $form;
} }
public function getHostsAction() public function getHostsAction()
{ {
$search = $this->_getParam('term'); $search = $this->_getParam('term');
$this->view->hosts = User::getHosts($search); $this->view->hosts = User::getHosts($search);
} }
public function getUserDataTableInfoAction() public function getUserDataTableInfoAction()
{ {
$post = $this->getRequest()->getPost(); $post = $this->getRequest()->getPost();
$users = User::getUsersDataTablesInfo($post); $users = User::getUsersDataTablesInfo($post);
die(json_encode($users));
die(json_encode($users));
} }
public function getUserDataAction() public function getUserDataAction()
{ {
$id = $this->_getParam('id'); $id = $this->_getParam('id');
$this->view->entries = User::GetUserData($id); $this->view->entries = User::GetUserData($id);
} }
public function removeUserAction() public function removeUserAction()

View File

@ -22,8 +22,7 @@ class Application_Form_AddShowWho extends Zend_Form_SubForm
//Add hosts selection //Add hosts selection
$hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts'); $hosts = new Zend_Form_Element_MultiCheckbox('add_show_hosts');
$hosts->setLabel('Hosts:') $hosts->setLabel('Hosts:')
->setMultiOptions($options) ->setMultiOptions($options);
->setRequired(true);
$this->addElement($hosts); $this->addElement($hosts);
} }

View File

@ -147,13 +147,15 @@ class Show {
} }
} }
//add selected hosts to cc_show_hosts table. if(is_array($data['add_show_hosts'])) {
foreach ($data['add_show_hosts'] as $host) { //add selected hosts to cc_show_hosts table.
$showHost = new CcShowHosts(); foreach ($data['add_show_hosts'] as $host) {
$showHost->setDbShow($showId); $showHost = new CcShowHosts();
$showHost->setDbHost($host); $showHost->setDbShow($showId);
$showHost->save(); $showHost->setDbHost($host);
} $showHost->save();
}
}
Show::populateShowUntilLastGeneratedDate($showId); Show::populateShowUntilLastGeneratedDate($showId);
} }

View File

@ -120,7 +120,7 @@ class User {
} }
public static function getHosts($search=NULL) { public static function getHosts($search=NULL) {
return User::getUsers(array('H', 'A'), $search); return User::getUsers(array('H'), $search);
} }
public static function getUsersDataTablesInfo($datatables_post) { public static function getUsersDataTablesInfo($datatables_post) {

View File

@ -4,7 +4,8 @@
<button id="add-show-submit" class="right-floated">Add this show</button> <button id="add-show-submit" class="right-floated">Add this show</button>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div id="schedule-show-what"> <h3 class="collapsible-header"><span class="arrow-icon"></span>What</h3>
<div id="schedule-show-what" class="collapsible-content">
<?php echo $this->what ?> <?php echo $this->what ?>
</div> </div>
<h3 class="collapsible-header"><span class="arrow-icon"></span>When</h3> <h3 class="collapsible-header"><span class="arrow-icon"></span>When</h3>

View File

@ -181,6 +181,9 @@ function setAddShowEvents() {
function showErrorSections() { function showErrorSections() {
if($("#schedule-show-what .errors").length > 0) {
$("#schedule-show-what").show();
}
if($("#schedule-show-when .errors").length > 0) { if($("#schedule-show-when .errors").length > 0) {
$("#schedule-show-when").show(); $("#schedule-show-when").show();
} }