From bc5b9efb4b4cdd70ab7b58ad070368917264183c Mon Sep 17 00:00:00 2001 From: mkonecny Date: Mon, 7 Feb 2011 19:03:14 -0500 Subject: [PATCH 01/21] -changes to list view. Framework so that we may change selected day -changes to add-user. Started implementing Vladimirs design. --- .zfproject.xml | 8 ++ application/configs/navigation.php | 21 ++- .../controllers/NowplayingController.php | 21 ++- application/controllers/UserController.php | 51 ++++--- application/forms/AddUser.php | 23 ++-- application/models/DateHelper.php | 4 + application/models/Nowplaying.php | 14 +- application/models/Schedule.php | 17 +-- application/models/StoredFile.php | 2 +- application/models/Users.php | 6 + .../views/scripts/nowplaying/day-view.phtml | 2 + .../views/scripts/nowplaying/index.phtml | 1 - application/views/scripts/user/add-user.phtml | 125 +++++++++++++++++- .../user/get-user-data-table-info.phtml | 1 + public/css/styles.css | 59 ++++++++- public/js/airtime/user/user.js | 26 ++++ public/js/playlist/dayview.js | 1 + public/js/playlist/nowplayingdatagrid.js | 37 ++++-- public/js/playlist/nowview.js | 1 + 19 files changed, 351 insertions(+), 69 deletions(-) create mode 100644 application/views/scripts/nowplaying/day-view.phtml create mode 100644 application/views/scripts/user/get-user-data-table-info.phtml create mode 100644 public/js/airtime/user/user.js create mode 100644 public/js/playlist/dayview.js create mode 100644 public/js/playlist/nowview.js diff --git a/.zfproject.xml b/.zfproject.xml index c93acc463..d67219e7d 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -76,6 +76,7 @@ + @@ -84,6 +85,7 @@ + @@ -287,6 +289,12 @@ + + + + + + diff --git a/application/configs/navigation.php b/application/configs/navigation.php index 56cd97696..1fc2ada39 100644 --- a/application/configs/navigation.php +++ b/application/configs/navigation.php @@ -10,10 +10,23 @@ $pages = array( array( 'label' => 'Now Playing', - 'module' => 'Nowplaying', - 'controller' => 'index', - 'action' => 'index', - 'order' => -100 //make sure home is the first page + 'uri' => 'javascript:void(null)', + 'pages' => array( + array( + 'label' => 'Current', + 'module' => 'default', + 'controller' => 'Nowplaying', + 'action' => 'index', + 'resource' => 'Nowplaying' + ), + array( + 'label' => 'Daily View', + 'module' => 'default', + 'controller' => 'Nowplaying', + 'action' => 'day-view', + 'resource' => 'Nowplaying' + ) + ) ), array( 'label' => 'Schedule', diff --git a/application/controllers/NowplayingController.php b/application/controllers/NowplayingController.php index 21741574b..4545787d4 100644 --- a/application/controllers/NowplayingController.php +++ b/application/controllers/NowplayingController.php @@ -6,27 +6,38 @@ class NowplayingController extends Zend_Controller_Action public function init() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext->addActionContext('get-data-grid-data', 'json') - ->initContext(); + $ajaxContext->addActionContext('get-data-grid-data', 'json') + ->initContext(); } public function indexAction() { $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript'); $this->view->headScript()->appendFile('/js/playlist/nowplayingdatagrid.js','text/javascript'); + $this->view->headScript()->appendFile('/js/playlist/nowview.js','text/javascript'); } public function getDataGridDataAction() { $viewType = $this->_request->getParam('view'); - $this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType); + $dateString = $this->_request->getParam('date'); + $this->view->entries = Application_Model_Nowplaying::GetDataGridData($viewType, $dateString); } public function livestreamAction() { //use bare bones layout (no header bar or menu) - $this->_helper->layout->setLayout('bare'); + $this->_helper->layout->setLayout('bare'); } + + public function dayViewAction() + { + $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.min.js','text/javascript'); + $this->view->headScript()->appendFile('/js/playlist/nowplayingdatagrid.js','text/javascript'); + $this->view->headScript()->appendFile('/js/playlist/dayview.js','text/javascript'); + } + + } @@ -35,3 +46,5 @@ class NowplayingController extends Zend_Controller_Action + + diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index 9700f2077..8d8110897 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -5,43 +5,54 @@ class UserController extends Zend_Controller_Action public function init() { - $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext->addActionContext('get-hosts', 'json') - ->initContext(); + $ajaxContext = $this->_helper->getHelper('AjaxContext'); + $ajaxContext->addActionContext('get-hosts', 'json') + ->addActionContext('get-user-data-table-info', 'json') + ->initContext(); } public function indexAction() { - } public function addUserAction() - { + { + $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript'); + $this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript'); $request = $this->getRequest(); - $form = new Application_Form_AddUser(); - - if ($request->isPost()) { - if ($form->isValid($request->getPost())) { - - $formdata = $form->getValues(); - User::addUser($formdata); - $form->reset(); - } - } - - $this->view->form = $form; + $form = new Application_Form_AddUser(); + + if ($request->isPost()) { + if ($form->isValid($request->getPost())) { + + $formdata = $form->getValues(); + User::addUser($formdata); + $form->reset(); + } + } + + $this->view->form = $form; } public function getHostsAction() { - $search = $this->_getParam('term'); - - $this->view->hosts = User::getHosts($search); + $search = $this->_getParam('term'); + + $this->view->hosts = User::getHosts($search); } + public function getUserDataTableInfoAction() + { + $post = $this->getRequest()->getPost(); + $users = User::getUsersDataTablesInfo($post); + + die(json_encode($users)); + } } + + diff --git a/application/forms/AddUser.php b/application/forms/AddUser.php index 5fa76dcdb..20a6b5997 100644 --- a/application/forms/AddUser.php +++ b/application/forms/AddUser.php @@ -8,47 +8,54 @@ class Application_Form_AddUser extends Zend_Form // Add login element $this->addElement('text', 'login', array( 'label' => 'Username:', + 'class' => 'input_text', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('NotEmpty') )); - // Add password element + // Add password element $this->addElement('text', 'password', array( 'label' => 'Password:', + 'class' => 'input_text', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('NotEmpty') )); - // Add first name element + // Add first name element $this->addElement('text', 'first_name', array( 'label' => 'Firstname:', + 'class' => 'input_text', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('NotEmpty') )); - // Add last name element + // Add last name element $this->addElement('text', 'last_name', array( 'label' => 'Lastname:', + 'class' => 'input_text', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array('NotEmpty') )); - //Add type select - $this->addElement('select', 'type', array( + //Add type select + $this->addElement('select', 'type', array( 'required' => true, + 'class' => 'input_select', + 'style' => 'width: 40%', 'multiOptions' => array( - "A" => "admin", + "A" => "admin", "H" => "host", - "G" => "guest", + "G" => "guest", ), )); - // Add the submit button + // Add the submit button $this->addElement('submit', 'submit', array( + 'class' => 'ui-button ui-state-default right-floated', 'ignore' => true, 'label' => 'Submit', )); diff --git a/application/models/DateHelper.php b/application/models/DateHelper.php index 6dff44715..6c44dd055 100644 --- a/application/models/DateHelper.php +++ b/application/models/DateHelper.php @@ -12,6 +12,10 @@ class Application_Model_DateHelper return date("Y-m-d H:i:s", $this->_timestamp); } + function setDate($dateString){ + $this->_timestamp = strtotime($dateString); + } + function getNowDayStartDiff(){ $dayStartTS = strtotime(date("Y-m-d", $this->_timestamp)); return $this->_timestamp - $dayStartTS; diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 9aeb549d2..02dd6837c 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -42,13 +42,13 @@ class Application_Model_Nowplaying return $rows; } - public static function GetDataGridData($viewType){ - - $date = Schedule::GetSchedulerTime(); - $timeNow = $date->getDate(); - + public static function GetDataGridData($viewType, $dateString){ + if ($viewType == "now"){ + $date = new Application_Model_DateHelper; + $timeNow = $date->getDate(); + /* When do "ORDER BY x DESC LIMIT 5" to ensure that we get the last 5 previously scheduled items. * However using DESC, puts our scheduled items in reverse order, so we need to reverse it again * with array_reverse. @@ -58,6 +58,10 @@ class Application_Model_Nowplaying $next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, 10, "24 hours"); } else { + $date = new Application_Model_DateHelper; + $timeNow = $date->setDate($dateString); + $timeNow = $date->getDate(); + $previous = array_reverse(Schedule::Get_Scheduled_Item_Data($timeNow, -1, "ALL", $date->getNowDayStartDiff()." seconds")); $current = Schedule::Get_Scheduled_Item_Data($timeNow, 0); $next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, "ALL", $date->getNowDayEndDiff()." seconds"); diff --git a/application/models/Schedule.php b/application/models/Schedule.php index 1383f4b23..d1f9830be 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -419,21 +419,6 @@ class Schedule { return $rows; } - - /** - * Returns the date of the server in the format - * "YYYY-MM-DD HH:mm:SS". - * - * Note: currently assuming that Web Server and Scheduler are on the - * same host. - * - * @return date Current server time. - */ - public static function GetSchedulerTime() { - $date = new Application_Model_DateHelper; - return $date; - } - /** * Returns data related to the scheduled items. * @@ -447,7 +432,7 @@ class Schedule { return array(); } - $date = Schedule::GetSchedulerTime(); + $date = new Application_Model_DateHelper; $timeNow = $date->getDate(); return array("env"=>APPLICATION_ENV, "schedulerTime"=>gmdate("Y-m-d H:i:s"), diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php index a5c730b88..0d2122eb8 100644 --- a/application/models/StoredFile.php +++ b/application/models/StoredFile.php @@ -1797,7 +1797,7 @@ class StoredFile { return StoredFile::searchFiles($fromTable, $datatables); } - private static function searchFiles($fromTable, $data) + public static function searchFiles($fromTable, $data) { global $CC_CONFIG, $CC_DBC; diff --git a/application/models/Users.php b/application/models/Users.php index bcc8c5a8b..62a40e440 100644 --- a/application/models/Users.php +++ b/application/models/Users.php @@ -71,5 +71,11 @@ class User { public static function getHosts($search=NULL) { return User::getUsers(array('H', 'A'), $search); } + + public static function getUsersDataTablesInfo($datatables_post) { + + $fromTable = "cc_subjs"; + return StoredFile::searchFiles($fromTable, $datatables_post); + } } diff --git a/application/views/scripts/nowplaying/day-view.phtml b/application/views/scripts/nowplaying/day-view.phtml new file mode 100644 index 000000000..3f23200ab --- /dev/null +++ b/application/views/scripts/nowplaying/day-view.phtml @@ -0,0 +1,2 @@ + +
diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml index b7faa8336..11d775d98 100644 --- a/application/views/scripts/nowplaying/index.phtml +++ b/application/views/scripts/nowplaying/index.phtml @@ -1,2 +1 @@ -
diff --git a/application/views/scripts/user/add-user.phtml b/application/views/scripts/user/add-user.phtml index 161c48f78..62822df4a 100644 --- a/application/views/scripts/user/add-user.phtml +++ b/application/views/scripts/user/add-user.phtml @@ -1,3 +1,126 @@ form; +//echo $this->form; +?> +
+

+ Manage users +

+
+
+
+
+ +
+
+ +
+
+ + + + + + + + + + +
idNameRoleDelete
+
+
+
+
+ form ?> +
+
+ +
diff --git a/application/views/scripts/user/get-user-data-table-info.phtml b/application/views/scripts/user/get-user-data-table-info.phtml new file mode 100644 index 000000000..64b099bc2 --- /dev/null +++ b/application/views/scripts/user/get-user-data-table-info.phtml @@ -0,0 +1 @@ +

View script for controller User and script/action name getUserDataTableInfo
\ No newline at end of file diff --git a/public/css/styles.css b/public/css/styles.css index 9cae1ced0..4af5bf8ea 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -762,7 +762,7 @@ dt.block-display, dd.block-display { width:98% } div.ui-datepicker { - font-size: 75%; + /*font-size: 75%;*/ } @@ -1059,4 +1059,61 @@ h2#scheduled_playlist_name span { button, input { margin-top:0; margin-bottom:0; +} + +.user-management { + width:810px; +} +.user-data { + float:left; + width:420px; +} +.user-list-wrapper { + float:left; + width:380px; + margin-right:10px; +} + +.user-management div.user-list-wrapper .ui-widget-header:first-child { + background: none repeat scroll 0 0 transparent; + border-width: 0 0 1px; + color: #444444; + font-weight: bold; +} +.user-list-wrapper .ui-widget-header:first-child .dataTables_filter { + margin:0; +} +.user-management h2 { + font-size: 1.7em; + padding-bottom: 16px; +} +.user-management .dataTables_filter .auto-search { + width: 378px; +} +.user-data.simple-formblock dd { + width: 73%; +} + +.user-data fieldset { + margin-bottom:8px; +} +.user-data fieldset:last-child { + margin-bottom:0; +} + +.user-list-wrapper .button-holder { + padding:8px 0; + text-align:right; +} +.user-list-wrapper .button-holder .ui-button { + margin:0; +} +.ui-widget-content .user-list-wrapper .ui-icon.ui-icon-closethick { + background-image:url(redmond/images/ui-icons_666666_256x240.png); + cursor:pointer; + float:right; + margin-right:5px; +} +.ui-widget-content .user-list-wrapper .ui-icon.ui-icon-closethick:hover { + background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png); } \ No newline at end of file diff --git a/public/js/airtime/user/user.js b/public/js/airtime/user/user.js new file mode 100644 index 000000000..7db393244 --- /dev/null +++ b/public/js/airtime/user/user.js @@ -0,0 +1,26 @@ +$(document).ready(function() { + $('#users_datatable').dataTable( { + "bProcessing": true, + "bServerSide": true, + "sAjaxSource": "/User/get-user-data-table-info/format/json", + "fnServerData": function ( sSource, aoData, fnCallback ) { + $.ajax( { + "dataType": 'json', + "type": "POST", + "url": sSource, + "data": aoData, + "success": fnCallback + } ); + }, + "aoColumns": [ + /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false }, + /* user name */ { "sName": "login" }, + /* user type */ { "sName": "type", "bSearchable": false }, + /* del button */ { "sName": "first_name", "bSearchable": false, "bSortable": false} + ], + "bJQueryUI": true, + "bAutoWidth": false, + "bLengthChange": false, + //"bFilter": false + }); +}); diff --git a/public/js/playlist/dayview.js b/public/js/playlist/dayview.js new file mode 100644 index 000000000..7deba409e --- /dev/null +++ b/public/js/playlist/dayview.js @@ -0,0 +1 @@ +var viewType = "day"; diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index 6dbe741a6..3467c5751 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -99,7 +99,6 @@ function createDataGrid(){ } -var viewType = "now" //"day"; var mainLoopRegistered = false; function setViewType(type){ @@ -111,8 +110,29 @@ function setViewType(type){ init2(); } +function getDateString(){ + var date0 = $("#datepicker").datepicker("getDate"); + return (date0.getFullYear() + "-" + date0.getMonth() + "-" + date0.getDate()); +} + +function getAJAXURL(){ + var url = "/Nowplaying/get-data-grid-data/format/json/view/"+viewType; + + if (viewType == "day"){ + url += "/date/" + getDateString(); + } + + return url; +} + function init2(){ - $.ajax({ url: "/Nowplaying/get-data-grid-data/format/json/view/" + viewType, dataType:"json", success:function(data){ + + if (!mainLoopRegistered){ + setTimeout(init2, 5000); + mainLoopRegistered = true; + } + + $.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){ datagridData = data.entries; createDataGrid(); }}); @@ -121,13 +141,14 @@ function init2(){ registered = true; registerSongEndListener(notifySongEnd); } - - if (!mainLoopRegistered){ - setTimeout(init2, 5000); - mainLoopRegistered = true; - } } $(document).ready(function() { - init2(); + if (viewType == "day"){ + $("#datepicker").datepicker(); + var date = new Date(); + $("#datepicker").datepicker("setDate", date); + } + + init2(); }); diff --git a/public/js/playlist/nowview.js b/public/js/playlist/nowview.js new file mode 100644 index 000000000..410cd4957 --- /dev/null +++ b/public/js/playlist/nowview.js @@ -0,0 +1 @@ +var viewType = "now"; From 036adf17e3a0d75bfe1c43f4071041932359f8d8 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 11:55:05 -0500 Subject: [PATCH 02/21] problems with events if items jump around scroll bar. --- public/css/playlist_builder.css | 2 +- public/js/airtime/library/spl.js | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/public/css/playlist_builder.css b/public/css/playlist_builder.css index 9a6edccf5..dd1ad24b1 100644 --- a/public/css/playlist_builder.css +++ b/public/css/playlist_builder.css @@ -36,7 +36,7 @@ list-style: none; padding:0; height: 400px; - overflow: auto; + overflow-y: scroll; width:100%; margin-top:0; } diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index e6db5a7ff..b10ec1642 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -146,21 +146,21 @@ function submitOnEnter(event) { } } -function setCueEvents() { +function setCueEvents(el) { - $(".spl_cue_in span:last").blur(changeCueIn); - $(".spl_cue_out span:last").blur(changeCueOut); + $(el).find(".spl_cue_in span:last").blur(changeCueIn); + $(el).find(".spl_cue_out span:last").blur(changeCueOut); - $(".spl_cue_in span:first, .spl_cue_out span:first") + $(el).find(".spl_cue_in span:first, .spl_cue_out span:first") .keydown(submitOnEnter); } -function setFadeEvents() { +function setFadeEvents(el) { - $(".spl_fade_in span:first").blur(changeFadeIn); - $(".spl_fade_out span:first").blur(changeFadeOut); + $(el).find(".spl_fade_in span:first").blur(changeFadeIn); + $(el).find(".spl_fade_out span:first").blur(changeFadeOut); - $(".spl_fade_in span:first, .spl_fade_out span:first") + $(el).find(".spl_fade_in span:first, .spl_fade_out span:first") .keydown(submitOnEnter); } @@ -198,7 +198,7 @@ function openFadeEditor(event) { .append(json.html) .show(); - setFadeEvents(); + setFadeEvents(li); }); } @@ -231,7 +231,7 @@ function openCueEditor(event) { .append(json.html) .show(); - setCueEvents(); + setCueEvents(li); }); } From 3b4fa1cc1af4533c9337314df8c366a090027bfe Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 13:03:46 -0500 Subject: [PATCH 03/21] -added new users management screen --- .zfproject.xml | 8 + application/Bootstrap.php | 3 +- application/configs/airtime-conf.php | 2 +- .../controllers/ScheduleController.php | 18 +-- application/controllers/UserController.php | 77 ++++++--- application/forms/AddUser.php | 123 ++++++++------- application/models/Users.php | 112 +++++++++++--- .../models/airtime/map/CcSubjsTableMap.php | 3 + application/models/airtime/om/BaseCcSubjs.php | 146 +++++++++++++++++- .../models/airtime/om/BaseCcSubjsPeer.php | 41 +++-- .../models/airtime/om/BaseCcSubjsQuery.php | 78 ++++++++++ application/validate/UserNameValidate.php | 26 ++++ application/views/scripts/user/add-user.phtml | 105 +------------ .../views/scripts/user/get-user-data.phtml | 3 + .../views/scripts/user/remove-user.phtml | 3 + build/build.properties | 2 +- build/schema.xml | 3 + build/sql/schema.sql | 3 + public/css/styles.css | 24 ++- public/js/airtime/user/user.js | 52 ++++++- 20 files changed, 606 insertions(+), 226 deletions(-) create mode 100644 application/validate/UserNameValidate.php create mode 100644 application/views/scripts/user/get-user-data.phtml create mode 100644 application/views/scripts/user/remove-user.phtml diff --git a/.zfproject.xml b/.zfproject.xml index d67219e7d..fcad60637 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -77,6 +77,8 @@ + +
@@ -295,6 +297,12 @@ + + + + + + diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 8c4d878f3..b9389ca7b 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -30,7 +30,8 @@ if (PEAR::isError($CC_DBC)) { } $CC_DBC->setFetchMode(DB_FETCHMODE_ASSOC); -Zend_Session::start(); +//Zend_Session::start(); +Zend_Validate::setDefaultNamespaces("Zend"); class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { diff --git a/application/configs/airtime-conf.php b/application/configs/airtime-conf.php index 1fe0ecb7e..633a32842 100644 --- a/application/configs/airtime-conf.php +++ b/application/configs/airtime-conf.php @@ -1,6 +1,6 @@ array ( diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index 37f5ac8a6..3e5c6dedf 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -50,7 +50,7 @@ class ScheduleController extends Zend_Controller_Action $end = $this->_getParam('end', null); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); if($user->isAdmin()) $editable = true; else @@ -111,7 +111,7 @@ class ScheduleController extends Zend_Controller_Action $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $show = new Show(new User($userInfo->id, $userInfo->type)); + $show = new Show(new User($userInfo->id)); $overlap = $show->addShow($data); if(isset($overlap)) { @@ -137,7 +137,7 @@ class ScheduleController extends Zend_Controller_Action $showInstanceId = $this->_getParam('showInstanceId'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); if($user->isAdmin()) { $show = new ShowInstance($showInstanceId); @@ -155,7 +155,7 @@ class ScheduleController extends Zend_Controller_Action $showInstanceId = $this->_getParam('showInstanceId'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); if($user->isAdmin()) { $show = new ShowInstance($showInstanceId); @@ -171,7 +171,7 @@ class ScheduleController extends Zend_Controller_Action $showInstanceId = $this->_getParam('id'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); if($user->isAdmin()) { $show = new ShowInstance($showInstanceId); @@ -185,7 +185,7 @@ class ScheduleController extends Zend_Controller_Action $today_timestamp = date("Y-m-d H:i:s"); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); $show = new ShowInstance($id); @@ -223,7 +223,7 @@ class ScheduleController extends Zend_Controller_Action } $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); $show = new ShowInstance($showInstanceId); if($user->isHost($show->getShowId())) { @@ -242,7 +242,7 @@ class ScheduleController extends Zend_Controller_Action { $showInstanceId = $this->_getParam('id'); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); $show = new ShowInstance($showInstanceId); if($user->isHost($show->getShowId())) { @@ -273,7 +273,7 @@ class ScheduleController extends Zend_Controller_Action $search = $this->_getParam('search', null); $userInfo = Zend_Auth::getInstance()->getStorage()->read(); - $user = new User($userInfo->id, $userInfo->type); + $user = new User($userInfo->id); $show = new ShowInstance($showInstanceId); if($user->isHost($show->getShowId())) { diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index 8d8110897..2cb2db0b4 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -6,9 +6,11 @@ class UserController extends Zend_Controller_Action public function init() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); - $ajaxContext->addActionContext('get-hosts', 'json') - ->addActionContext('get-user-data-table-info', 'json') - ->initContext(); + $ajaxContext->addActionContext('get-hosts', 'json') + ->addActionContext('get-user-data-table-info', 'json') + ->addActionContext('get-user-data', 'json') + ->addActionContext('remove-user', 'json') + ->initContext(); } public function indexAction() @@ -17,37 +19,66 @@ class UserController extends Zend_Controller_Action public function addUserAction() { + + $this->view->headScript()->appendFile('/js/datatables/js/jquery.dataTables.js','text/javascript'); - $this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript'); - $request = $this->getRequest(); - $form = new Application_Form_AddUser(); - - if ($request->isPost()) { - if ($form->isValid($request->getPost())) { - - $formdata = $form->getValues(); - User::addUser($formdata); - $form->reset(); - } - } - - $this->view->form = $form; + $this->view->headScript()->appendFile('/js/airtime/user/user.js','text/javascript'); + $request = $this->getRequest(); + $form = new Application_Form_AddUser(); + + if ($request->isPost()) { + if ($form->isValid($request->getPost())) { + + $formdata = $form->getValues(); + if ($form->validateLogin($formdata)){ + $user = new User($formdata['user_id']); + $user->setFirstName($formdata['first_name']); + $user->setLastName($formdata['last_name']); + $user->setLogin($formdata['login']); + if ($formdata['password'] != "xxxxxx") + $user->setPassword($formdata['password']); + $user->setType($formdata['type']); + $user->save(); + + $form->reset(); + } + } + } + + $this->view->form = $form; } public function getHostsAction() { $search = $this->_getParam('term'); - $this->view->hosts = User::getHosts($search); } public function getUserDataTableInfoAction() { $post = $this->getRequest()->getPost(); - $users = User::getUsersDataTablesInfo($post); - - die(json_encode($users)); + $users = User::getUsersDataTablesInfo($post); + + + die(json_encode($users)); } + + public function getUserDataAction() + { + $id = $this->_getParam('id'); + $this->view->entries = User::GetUserData($id); + } + + public function removeUserAction() + { + // action body + $id = $this->_getParam('id'); + $user = new User($id); + + $this->view->entries = $user->delete(); + } + + } @@ -56,3 +87,7 @@ class UserController extends Zend_Controller_Action + + + + diff --git a/application/forms/AddUser.php b/application/forms/AddUser.php index 20a6b5997..f6bd24980 100644 --- a/application/forms/AddUser.php +++ b/application/forms/AddUser.php @@ -5,63 +5,78 @@ class Application_Form_AddUser extends Zend_Form public function init() { - // Add login element - $this->addElement('text', 'login', array( - 'label' => 'Username:', - 'class' => 'input_text', - 'required' => true, - 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty') - )); - - // Add password element - $this->addElement('text', 'password', array( - 'label' => 'Password:', - 'class' => 'input_text', - 'required' => true, - 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty') - )); - - // Add first name element - $this->addElement('text', 'first_name', array( - 'label' => 'Firstname:', - 'class' => 'input_text', - 'required' => true, - 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty') - )); - - // Add last name element - $this->addElement('text', 'last_name', array( - 'label' => 'Lastname:', - 'class' => 'input_text', - 'required' => true, - 'filters' => array('StringTrim'), - 'validators' => array('NotEmpty') - )); - - //Add type select - $this->addElement('select', 'type', array( - 'required' => true, - 'class' => 'input_select', - 'style' => 'width: 40%', - 'multiOptions' => array( + /* + $this->addElementPrefixPath('Application_Validate', + '../application/validate', + 'validate'); + * */ + + $hidden = new Zend_Form_Element_Hidden('user_id'); + $hidden->setAttrib('style', 'display: none;'); + $this->addElement($hidden); + + $login = new Zend_Form_Element_Text('login'); + $login->setLabel('Username:'); + $login->setAttrib('class', 'input_text'); + $login->setRequired(true); + $login->addFilter('StringTrim'); + //$login->addValidator('UserNameValidate'); + $this->addElement($login); + + $password = new Zend_Form_Element_Password('password'); + $password->setLabel('Password:'); + $password->setAttrib('class', 'input_text'); + $password->setRequired(true); + $password->addFilter('StringTrim'); + $password->addValidator('NotEmpty'); + $this->addElement($password); + + $firstName = new Zend_Form_Element_Text('first_name'); + $firstName->setLabel('Firstname:'); + $firstName->setAttrib('class', 'input_text'); + $firstName->setRequired(true); + $firstName->addFilter('StringTrim'); + $firstName->addValidator('NotEmpty'); + $this->addElement($firstName); + + $lastName = new Zend_Form_Element_Text('last_name'); + $lastName->setLabel('Lastname:'); + $lastName->setAttrib('class', 'input_text'); + $lastName->setRequired(true); + $lastName->addFilter('StringTrim'); + $lastName->addValidator('NotEmpty'); + $this->addElement($lastName); + + $select = new Zend_Form_Element_Select('type'); + $select->setAttrib('class', 'input_select'); + $select->setAttrib('style', 'width: 40%'); + $select->setMultiOptions(array( "A" => "admin", "H" => "host", "G" => "guest", - ), - )); - - // Add the submit button - $this->addElement('submit', 'submit', array( - 'class' => 'ui-button ui-state-default right-floated', - 'ignore' => true, - 'label' => 'Submit', - )); - + )); + $select->setRequired(true); + $this->addElement($select); + + $submit = new Zend_Form_Element_Submit('submit'); + $submit->setAttrib('class', 'ui-button ui-state-default right-floated'); + $submit->setIgnore(true); + $submit->setLabel('submit'); + $this->addElement($submit); + } + + public function validateLogin($data){ + + if (strlen($data['user_id']) == 0){ + $count = CcSubjsQuery::create()->filterByDbLogin($data['login'])->count(); + + if ($count != 0){ + $this->getElement('login')->setErrors(array("login name is not unique.")); + return false; + } + } + + return true; } - - } diff --git a/application/models/Users.php b/application/models/Users.php index 62a40e440..594f2e9bc 100644 --- a/application/models/Users.php +++ b/application/models/Users.php @@ -2,41 +2,99 @@ class User { - private $_userRole; - private $_userId; + private $_userInstance; - public function __construct($userId, $userType='G') + public function __construct($userId) { - $this->_userRole = $userType; - $this->_userId = $userId; + if (strlen($userId)==0){ + $this->userInstance = $this->createUser(); + } else { + $this->userInstance = CcSubjsQuery::create()->findPK($userId); + } } - public function getType() { - return $this->userRole; - } - public function getId() { - return $this->_userId; + return $this->_userInstance->getDbId(); } public function isHost($showId) { - return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($this->_userId)->count() > 0; + $userId = $this->_userInstance->getDbId(); + return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($_userId)->count() > 0; } public function isAdmin() { - return $this->_userRole === 'A'; + return $userInstance->getDbType() === 'A'; } + + public function setLogin($login){ + $user = $this->userInstance; + $user->setDbLogin($login); + //$user->save(); + } + + public function setPassword($password){ + $user = $this->userInstance; + $user->setDbPass(md5($password)); + //$user->save(); + } + + public function setFirstName($firstName){ + $user = $this->userInstance; + $user->setDbFirstName($firstName); + //$user->save(); + } + + public function setLastName($lastName){ + $user = $this->userInstance; + $user->setDbLastName($lastName); + //$user->save(); + } + + public function setType($type){ + $user = $this->userInstance; + $user->setDbType($type); + //$user->save(); + } + + public function getLogin(){ + $user = $this->userInstance; + return $user->getDbLogin(); + } + + public function getPassword(){ + $user = $this->userInstance; + return $user->getDbPass(); + } + + public function getFirstName(){ + $user = $this->userInstance; + return $user->getDbFirstName(); + } + + public function getLastName(){ + $user = $this->userInstance; + return $user->getDbLastName(); + } + + public function getType(){ + $user = $this->userInstance; + return $user->getDbType(); + } + + public function save(){ + $this->userInstance->save(); + } + + public function delete(){ + if (!$this->userInstance->isDeleted()) + $this->userInstance->delete(); + } - public static function addUser($data) { - + private function createUser() { $user = new CcSubjs(); - $user->setDbLogin($data['login']); - $user->setDbPass(md5($data['password'])); - $user->setDbFirstName($data['first_name']); - $user->setDbLastName($data['last_name']); - $user->setDbType($data['type']); - $user->save(); - + //$user->save(); + + return $user; } public static function getUsers($type, $search=NULL) { @@ -76,6 +134,16 @@ class User { $fromTable = "cc_subjs"; return StoredFile::searchFiles($fromTable, $datatables_post); - } + } + + public static function getUserData($id){ + global $CC_DBC; + + $sql = "SELECT login, first_name, last_name, type, id" + ." FROM cc_subjs" + ." WHERE id = $id"; + + return $CC_DBC->GetRow($sql); + } } diff --git a/application/models/airtime/map/CcSubjsTableMap.php b/application/models/airtime/map/CcSubjsTableMap.php index 14b132c41..2d644a515 100644 --- a/application/models/airtime/map/CcSubjsTableMap.php +++ b/application/models/airtime/map/CcSubjsTableMap.php @@ -46,6 +46,9 @@ class CcSubjsTableMap extends TableMap { $this->addColumn('LAST_NAME', 'DbLastName', 'VARCHAR', true, 255, ''); $this->addColumn('LASTLOGIN', 'DbLastlogin', 'TIMESTAMP', false, null, null); $this->addColumn('LASTFAIL', 'DbLastfail', 'TIMESTAMP', false, null, null); + $this->addColumn('SKYPE_CONTACT', 'DbSkypeContact', 'VARCHAR', false, 255, null); + $this->addColumn('JABBER_CONTACT', 'DbJabberContact', 'VARCHAR', false, 255, null); + $this->addColumn('EMAIL', 'DbEmail', 'VARCHAR', false, 255, null); // validators } // initialize() diff --git a/application/models/airtime/om/BaseCcSubjs.php b/application/models/airtime/om/BaseCcSubjs.php index bc90d9504..3ddc3313c 100644 --- a/application/models/airtime/om/BaseCcSubjs.php +++ b/application/models/airtime/om/BaseCcSubjs.php @@ -77,6 +77,24 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent */ protected $lastfail; + /** + * The value for the skype_contact field. + * @var string + */ + protected $skype_contact; + + /** + * The value for the jabber_contact field. + * @var string + */ + protected $jabber_contact; + + /** + * The value for the email field. + * @var string + */ + protected $email; + /** * @var array CcAccess[] Collection to store aggregation of CcAccess objects. */ @@ -277,6 +295,36 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent } } + /** + * Get the [skype_contact] column value. + * + * @return string + */ + public function getDbSkypeContact() + { + return $this->skype_contact; + } + + /** + * Get the [jabber_contact] column value. + * + * @return string + */ + public function getDbJabberContact() + { + return $this->jabber_contact; + } + + /** + * Get the [email] column value. + * + * @return string + */ + public function getDbEmail() + { + return $this->email; + } + /** * Set the value of [id] column. * @@ -495,6 +543,66 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent return $this; } // setDbLastfail() + /** + * Set the value of [skype_contact] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbSkypeContact($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->skype_contact !== $v) { + $this->skype_contact = $v; + $this->modifiedColumns[] = CcSubjsPeer::SKYPE_CONTACT; + } + + return $this; + } // setDbSkypeContact() + + /** + * Set the value of [jabber_contact] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbJabberContact($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->jabber_contact !== $v) { + $this->jabber_contact = $v; + $this->modifiedColumns[] = CcSubjsPeer::JABBER_CONTACT; + } + + return $this; + } // setDbJabberContact() + + /** + * Set the value of [email] column. + * + * @param string $v new value + * @return CcSubjs The current object (for fluent API support) + */ + public function setDbEmail($v) + { + if ($v !== null) { + $v = (string) $v; + } + + if ($this->email !== $v) { + $this->email = $v; + $this->modifiedColumns[] = CcSubjsPeer::EMAIL; + } + + return $this; + } // setDbEmail() + /** * Indicates whether the columns in this object are only set to default values. * @@ -555,6 +663,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->last_name = ($row[$startcol + 5] !== null) ? (string) $row[$startcol + 5] : null; $this->lastlogin = ($row[$startcol + 6] !== null) ? (string) $row[$startcol + 6] : null; $this->lastfail = ($row[$startcol + 7] !== null) ? (string) $row[$startcol + 7] : null; + $this->skype_contact = ($row[$startcol + 8] !== null) ? (string) $row[$startcol + 8] : null; + $this->jabber_contact = ($row[$startcol + 9] !== null) ? (string) $row[$startcol + 9] : null; + $this->email = ($row[$startcol + 10] !== null) ? (string) $row[$startcol + 10] : null; $this->resetModified(); $this->setNew(false); @@ -563,7 +674,7 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->ensureConsistency(); } - return $startcol + 8; // 8 = CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS). + return $startcol + 11; // 11 = CcSubjsPeer::NUM_COLUMNS - CcSubjsPeer::NUM_LAZY_LOAD_COLUMNS). } catch (Exception $e) { throw new PropelException("Error populating CcSubjs object", $e); @@ -1012,6 +1123,15 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent case 7: return $this->getDbLastfail(); break; + case 8: + return $this->getDbSkypeContact(); + break; + case 9: + return $this->getDbJabberContact(); + break; + case 10: + return $this->getDbEmail(); + break; default: return null; break; @@ -1043,6 +1163,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $keys[5] => $this->getDbLastName(), $keys[6] => $this->getDbLastlogin(), $keys[7] => $this->getDbLastfail(), + $keys[8] => $this->getDbSkypeContact(), + $keys[9] => $this->getDbJabberContact(), + $keys[10] => $this->getDbEmail(), ); return $result; } @@ -1098,6 +1221,15 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent case 7: $this->setDbLastfail($value); break; + case 8: + $this->setDbSkypeContact($value); + break; + case 9: + $this->setDbJabberContact($value); + break; + case 10: + $this->setDbEmail($value); + break; } // switch() } @@ -1130,6 +1262,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if (array_key_exists($keys[5], $arr)) $this->setDbLastName($arr[$keys[5]]); if (array_key_exists($keys[6], $arr)) $this->setDbLastlogin($arr[$keys[6]]); if (array_key_exists($keys[7], $arr)) $this->setDbLastfail($arr[$keys[7]]); + if (array_key_exists($keys[8], $arr)) $this->setDbSkypeContact($arr[$keys[8]]); + if (array_key_exists($keys[9], $arr)) $this->setDbJabberContact($arr[$keys[9]]); + if (array_key_exists($keys[10], $arr)) $this->setDbEmail($arr[$keys[10]]); } /** @@ -1149,6 +1284,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent if ($this->isColumnModified(CcSubjsPeer::LAST_NAME)) $criteria->add(CcSubjsPeer::LAST_NAME, $this->last_name); if ($this->isColumnModified(CcSubjsPeer::LASTLOGIN)) $criteria->add(CcSubjsPeer::LASTLOGIN, $this->lastlogin); if ($this->isColumnModified(CcSubjsPeer::LASTFAIL)) $criteria->add(CcSubjsPeer::LASTFAIL, $this->lastfail); + if ($this->isColumnModified(CcSubjsPeer::SKYPE_CONTACT)) $criteria->add(CcSubjsPeer::SKYPE_CONTACT, $this->skype_contact); + if ($this->isColumnModified(CcSubjsPeer::JABBER_CONTACT)) $criteria->add(CcSubjsPeer::JABBER_CONTACT, $this->jabber_contact); + if ($this->isColumnModified(CcSubjsPeer::EMAIL)) $criteria->add(CcSubjsPeer::EMAIL, $this->email); return $criteria; } @@ -1217,6 +1355,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $copyObj->setDbLastName($this->last_name); $copyObj->setDbLastlogin($this->lastlogin); $copyObj->setDbLastfail($this->lastfail); + $copyObj->setDbSkypeContact($this->skype_contact); + $copyObj->setDbJabberContact($this->jabber_contact); + $copyObj->setDbEmail($this->email); if ($deepCopy) { // important: temporarily setNew(false) because this affects the behavior of @@ -2111,6 +2252,9 @@ abstract class BaseCcSubjs extends BaseObject implements Persistent $this->last_name = null; $this->lastlogin = null; $this->lastfail = null; + $this->skype_contact = null; + $this->jabber_contact = null; + $this->email = null; $this->alreadyInSave = false; $this->alreadyInValidation = false; $this->clearAllReferences(); diff --git a/application/models/airtime/om/BaseCcSubjsPeer.php b/application/models/airtime/om/BaseCcSubjsPeer.php index 202711cbd..3743a4aab 100644 --- a/application/models/airtime/om/BaseCcSubjsPeer.php +++ b/application/models/airtime/om/BaseCcSubjsPeer.php @@ -26,7 +26,7 @@ abstract class BaseCcSubjsPeer { const TM_CLASS = 'CcSubjsTableMap'; /** The total number of columns. */ - const NUM_COLUMNS = 8; + const NUM_COLUMNS = 11; /** The number of lazy-loaded columns. */ const NUM_LAZY_LOAD_COLUMNS = 0; @@ -55,6 +55,15 @@ abstract class BaseCcSubjsPeer { /** the column name for the LASTFAIL field */ const LASTFAIL = 'cc_subjs.LASTFAIL'; + /** the column name for the SKYPE_CONTACT field */ + const SKYPE_CONTACT = 'cc_subjs.SKYPE_CONTACT'; + + /** the column name for the JABBER_CONTACT field */ + const JABBER_CONTACT = 'cc_subjs.JABBER_CONTACT'; + + /** the column name for the EMAIL field */ + const EMAIL = 'cc_subjs.EMAIL'; + /** * An identiy map to hold any loaded instances of CcSubjs objects. * This must be public so that other peer classes can access this when hydrating from JOIN @@ -71,12 +80,12 @@ abstract class BaseCcSubjsPeer { * e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id' */ private static $fieldNames = array ( - BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', ), - BasePeer::TYPE_COLNAME => array (self::ID, self::LOGIN, self::PASS, self::TYPE, self::FIRST_NAME, self::LAST_NAME, self::LASTLOGIN, self::LASTFAIL, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', ), - BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + BasePeer::TYPE_PHPNAME => array ('DbId', 'DbLogin', 'DbPass', 'DbType', 'DbFirstName', 'DbLastName', 'DbLastlogin', 'DbLastfail', 'DbSkypeContact', 'DbJabberContact', 'DbEmail', ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId', 'dbLogin', 'dbPass', 'dbType', 'dbFirstName', 'dbLastName', 'dbLastlogin', 'dbLastfail', 'dbSkypeContact', 'dbJabberContact', 'dbEmail', ), + BasePeer::TYPE_COLNAME => array (self::ID, self::LOGIN, self::PASS, self::TYPE, self::FIRST_NAME, self::LAST_NAME, self::LASTLOGIN, self::LASTFAIL, self::SKYPE_CONTACT, self::JABBER_CONTACT, self::EMAIL, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID', 'LOGIN', 'PASS', 'TYPE', 'FIRST_NAME', 'LAST_NAME', 'LASTLOGIN', 'LASTFAIL', 'SKYPE_CONTACT', 'JABBER_CONTACT', 'EMAIL', ), + BasePeer::TYPE_FIELDNAME => array ('id', 'login', 'pass', 'type', 'first_name', 'last_name', 'lastlogin', 'lastfail', 'skype_contact', 'jabber_contact', 'email', ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); /** @@ -86,12 +95,12 @@ abstract class BaseCcSubjsPeer { * e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0 */ private static $fieldKeys = array ( - BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLogin' => 1, 'DbPass' => 2, 'DbType' => 3, 'DbFirstName' => 4, 'DbLastName' => 5, 'DbLastlogin' => 6, 'DbLastfail' => 7, ), - BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLogin' => 1, 'dbPass' => 2, 'dbType' => 3, 'dbFirstName' => 4, 'dbLastName' => 5, 'dbLastlogin' => 6, 'dbLastfail' => 7, ), - BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOGIN => 1, self::PASS => 2, self::TYPE => 3, self::FIRST_NAME => 4, self::LAST_NAME => 5, self::LASTLOGIN => 6, self::LASTFAIL => 7, ), - BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOGIN' => 1, 'PASS' => 2, 'TYPE' => 3, 'FIRST_NAME' => 4, 'LAST_NAME' => 5, 'LASTLOGIN' => 6, 'LASTFAIL' => 7, ), - BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'first_name' => 4, 'last_name' => 5, 'lastlogin' => 6, 'lastfail' => 7, ), - BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, ) + BasePeer::TYPE_PHPNAME => array ('DbId' => 0, 'DbLogin' => 1, 'DbPass' => 2, 'DbType' => 3, 'DbFirstName' => 4, 'DbLastName' => 5, 'DbLastlogin' => 6, 'DbLastfail' => 7, 'DbSkypeContact' => 8, 'DbJabberContact' => 9, 'DbEmail' => 10, ), + BasePeer::TYPE_STUDLYPHPNAME => array ('dbId' => 0, 'dbLogin' => 1, 'dbPass' => 2, 'dbType' => 3, 'dbFirstName' => 4, 'dbLastName' => 5, 'dbLastlogin' => 6, 'dbLastfail' => 7, 'dbSkypeContact' => 8, 'dbJabberContact' => 9, 'dbEmail' => 10, ), + BasePeer::TYPE_COLNAME => array (self::ID => 0, self::LOGIN => 1, self::PASS => 2, self::TYPE => 3, self::FIRST_NAME => 4, self::LAST_NAME => 5, self::LASTLOGIN => 6, self::LASTFAIL => 7, self::SKYPE_CONTACT => 8, self::JABBER_CONTACT => 9, self::EMAIL => 10, ), + BasePeer::TYPE_RAW_COLNAME => array ('ID' => 0, 'LOGIN' => 1, 'PASS' => 2, 'TYPE' => 3, 'FIRST_NAME' => 4, 'LAST_NAME' => 5, 'LASTLOGIN' => 6, 'LASTFAIL' => 7, 'SKYPE_CONTACT' => 8, 'JABBER_CONTACT' => 9, 'EMAIL' => 10, ), + BasePeer::TYPE_FIELDNAME => array ('id' => 0, 'login' => 1, 'pass' => 2, 'type' => 3, 'first_name' => 4, 'last_name' => 5, 'lastlogin' => 6, 'lastfail' => 7, 'skype_contact' => 8, 'jabber_contact' => 9, 'email' => 10, ), + BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ) ); /** @@ -171,6 +180,9 @@ abstract class BaseCcSubjsPeer { $criteria->addSelectColumn(CcSubjsPeer::LAST_NAME); $criteria->addSelectColumn(CcSubjsPeer::LASTLOGIN); $criteria->addSelectColumn(CcSubjsPeer::LASTFAIL); + $criteria->addSelectColumn(CcSubjsPeer::SKYPE_CONTACT); + $criteria->addSelectColumn(CcSubjsPeer::JABBER_CONTACT); + $criteria->addSelectColumn(CcSubjsPeer::EMAIL); } else { $criteria->addSelectColumn($alias . '.ID'); $criteria->addSelectColumn($alias . '.LOGIN'); @@ -180,6 +192,9 @@ abstract class BaseCcSubjsPeer { $criteria->addSelectColumn($alias . '.LAST_NAME'); $criteria->addSelectColumn($alias . '.LASTLOGIN'); $criteria->addSelectColumn($alias . '.LASTFAIL'); + $criteria->addSelectColumn($alias . '.SKYPE_CONTACT'); + $criteria->addSelectColumn($alias . '.JABBER_CONTACT'); + $criteria->addSelectColumn($alias . '.EMAIL'); } } diff --git a/application/models/airtime/om/BaseCcSubjsQuery.php b/application/models/airtime/om/BaseCcSubjsQuery.php index a38e68049..857fbcdf4 100644 --- a/application/models/airtime/om/BaseCcSubjsQuery.php +++ b/application/models/airtime/om/BaseCcSubjsQuery.php @@ -14,6 +14,9 @@ * @method CcSubjsQuery orderByDbLastName($order = Criteria::ASC) Order by the last_name column * @method CcSubjsQuery orderByDbLastlogin($order = Criteria::ASC) Order by the lastlogin column * @method CcSubjsQuery orderByDbLastfail($order = Criteria::ASC) Order by the lastfail column + * @method CcSubjsQuery orderByDbSkypeContact($order = Criteria::ASC) Order by the skype_contact column + * @method CcSubjsQuery orderByDbJabberContact($order = Criteria::ASC) Order by the jabber_contact column + * @method CcSubjsQuery orderByDbEmail($order = Criteria::ASC) Order by the email column * * @method CcSubjsQuery groupByDbId() Group by the id column * @method CcSubjsQuery groupByDbLogin() Group by the login column @@ -23,6 +26,9 @@ * @method CcSubjsQuery groupByDbLastName() Group by the last_name column * @method CcSubjsQuery groupByDbLastlogin() Group by the lastlogin column * @method CcSubjsQuery groupByDbLastfail() Group by the lastfail column + * @method CcSubjsQuery groupByDbSkypeContact() Group by the skype_contact column + * @method CcSubjsQuery groupByDbJabberContact() Group by the jabber_contact column + * @method CcSubjsQuery groupByDbEmail() Group by the email column * * @method CcSubjsQuery leftJoin($relation) Adds a LEFT JOIN clause to the query * @method CcSubjsQuery rightJoin($relation) Adds a RIGHT JOIN clause to the query @@ -67,6 +73,9 @@ * @method CcSubjs findOneByDbLastName(string $last_name) Return the first CcSubjs filtered by the last_name column * @method CcSubjs findOneByDbLastlogin(string $lastlogin) Return the first CcSubjs filtered by the lastlogin column * @method CcSubjs findOneByDbLastfail(string $lastfail) Return the first CcSubjs filtered by the lastfail column + * @method CcSubjs findOneByDbSkypeContact(string $skype_contact) Return the first CcSubjs filtered by the skype_contact column + * @method CcSubjs findOneByDbJabberContact(string $jabber_contact) Return the first CcSubjs filtered by the jabber_contact column + * @method CcSubjs findOneByDbEmail(string $email) Return the first CcSubjs filtered by the email column * * @method array findByDbId(int $id) Return CcSubjs objects filtered by the id column * @method array findByDbLogin(string $login) Return CcSubjs objects filtered by the login column @@ -76,6 +85,9 @@ * @method array findByDbLastName(string $last_name) Return CcSubjs objects filtered by the last_name column * @method array findByDbLastlogin(string $lastlogin) Return CcSubjs objects filtered by the lastlogin column * @method array findByDbLastfail(string $lastfail) Return CcSubjs objects filtered by the lastfail column + * @method array findByDbSkypeContact(string $skype_contact) Return CcSubjs objects filtered by the skype_contact column + * @method array findByDbJabberContact(string $jabber_contact) Return CcSubjs objects filtered by the jabber_contact column + * @method array findByDbEmail(string $email) Return CcSubjs objects filtered by the email column * * @package propel.generator.airtime.om */ @@ -374,6 +386,72 @@ abstract class BaseCcSubjsQuery extends ModelCriteria return $this->addUsingAlias(CcSubjsPeer::LASTFAIL, $dbLastfail, $comparison); } + /** + * Filter the query on the skype_contact column + * + * @param string $dbSkypeContact The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbSkypeContact($dbSkypeContact = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbSkypeContact)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbSkypeContact)) { + $dbSkypeContact = str_replace('*', '%', $dbSkypeContact); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::SKYPE_CONTACT, $dbSkypeContact, $comparison); + } + + /** + * Filter the query on the jabber_contact column + * + * @param string $dbJabberContact The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbJabberContact($dbJabberContact = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbJabberContact)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbJabberContact)) { + $dbJabberContact = str_replace('*', '%', $dbJabberContact); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::JABBER_CONTACT, $dbJabberContact, $comparison); + } + + /** + * Filter the query on the email column + * + * @param string $dbEmail The value to use as filter. + * Accepts wildcards (* and % trigger a LIKE) + * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL + * + * @return CcSubjsQuery The current query, for fluid interface + */ + public function filterByDbEmail($dbEmail = null, $comparison = null) + { + if (null === $comparison) { + if (is_array($dbEmail)) { + $comparison = Criteria::IN; + } elseif (preg_match('/[\%\*]/', $dbEmail)) { + $dbEmail = str_replace('*', '%', $dbEmail); + $comparison = Criteria::LIKE; + } + } + return $this->addUsingAlias(CcSubjsPeer::EMAIL, $dbEmail, $comparison); + } + /** * Filter the query by a related CcAccess object * diff --git a/application/validate/UserNameValidate.php b/application/validate/UserNameValidate.php new file mode 100644 index 000000000..b6ff6ec92 --- /dev/null +++ b/application/validate/UserNameValidate.php @@ -0,0 +1,26 @@ + "'%value%' is already taken" + ); + + public function isValid($value) + { + $this->_setValue($value); + + $count = CcSubjsQuery::create()->filterByDbLogin($value)->count(); + + if ($count != 0) { + $this->_error(self::LOGIN); + return false; + } + + return true; + } +} + +?> diff --git a/application/views/scripts/user/add-user.phtml b/application/views/scripts/user/add-user.phtml index 62822df4a..5a809ac1f 100644 --- a/application/views/scripts/user/add-user.phtml +++ b/application/views/scripts/user/add-user.phtml @@ -1,26 +1,19 @@ -form; -?>

Manage users

-
-
-
- -
+
+ +
-
+ @@ -34,93 +27,9 @@
-
+
form ?>
-
diff --git a/application/views/scripts/user/get-user-data.phtml b/application/views/scripts/user/get-user-data.phtml new file mode 100644 index 000000000..f9696f033 --- /dev/null +++ b/application/views/scripts/user/get-user-data.phtml @@ -0,0 +1,3 @@ +entries; +?> diff --git a/application/views/scripts/user/remove-user.phtml b/application/views/scripts/user/remove-user.phtml new file mode 100644 index 000000000..845092689 --- /dev/null +++ b/application/views/scripts/user/remove-user.phtml @@ -0,0 +1,3 @@ +entries; +?> diff --git a/build/build.properties b/build/build.properties index 75a77da70..d15498cad 100644 --- a/build/build.properties +++ b/build/build.properties @@ -1,6 +1,6 @@ #Note: project.home is automatically generated by the propel-install script. #Any manual changes to this value will be overwritten. -project.home = /home/naomiaro/dev-campcaster/campcaster +project.home = /home/martin/workspace/airtime project.build = ${project.home}/build #Database driver diff --git a/build/schema.xml b/build/schema.xml index 5b0bbd1b4..43ae63a31 100644 --- a/build/schema.xml +++ b/build/schema.xml @@ -264,6 +264,9 @@ + + + diff --git a/build/sql/schema.sql b/build/sql/schema.sql index 26942a8be..7475c6620 100644 --- a/build/sql/schema.sql +++ b/build/sql/schema.sql @@ -402,6 +402,9 @@ CREATE TABLE "cc_subjs" "last_name" VARCHAR(255) default '' NOT NULL, "lastlogin" TIMESTAMP, "lastfail" TIMESTAMP, + "skype_contact" VARCHAR(255), + "jabber_contact" VARCHAR(255), + "email" VARCHAR(255), PRIMARY KEY ("id"), CONSTRAINT "cc_subjs_id_idx" UNIQUE ("id"), CONSTRAINT "cc_subjs_login_idx" UNIQUE ("login") diff --git a/public/css/styles.css b/public/css/styles.css index b5825d80e..3e70bbfb2 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -516,6 +516,25 @@ dl.inline-list dd { padding: 0.2em 1em; margin-right:3px; } +.dataTables_filter input { + background: url("images/search_auto_bg.png") no-repeat scroll 0 0 #DDDDDD; + text-indent: 25px; + width: 60%; + border: 1px solid #5B5B5B; + height: 23px; + margin: 0; + padding: 0; +} +.dataTables_length select { + background-color: #DDDDDD; + border: 1px solid #5B5B5B; + font-family: Arial,Helvetica,sans-serif; + font-size: 12px; + height: 25px; + margin: 0; + padding: 2px 2px 2px 0; + vertical-align: top; +} /*----END Data Table----*/ @@ -848,7 +867,6 @@ div.ui-datepicker { margin-right:22px; } - #schedule_playlist_chosen li > div > div > span { float: right; margin-right:46px; @@ -1088,7 +1106,7 @@ button, input { font-size: 1.7em; padding-bottom: 16px; } -.user-management .dataTables_filter .auto-search { +.user-management .dataTables_filter input { width: 378px; } .user-data.simple-formblock dd { @@ -1119,4 +1137,6 @@ button, input { background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png); } + #ui-datepicker-div { z-index: 10 !important } + diff --git a/public/js/airtime/user/user.js b/public/js/airtime/user/user.js index 7db393244..03edafc8a 100644 --- a/public/js/airtime/user/user.js +++ b/public/js/airtime/user/user.js @@ -1,3 +1,42 @@ +function populateForm(entries){ + //$('#user_details').show(); + + $('.errors').remove(); + + $('#user_id').val(entries.id); + $('#login').val(entries.login); + $('#first_name').val(entries.first_name); + $('#last_name').val(entries.last_name); + $('#type').val(entries.type); + + if (entries.id.length != 0){ + $('#login').attr('readonly', 'readonly'); + $('#password').val("xxxxxx"); + } else { + $('#login').removeAttr('readonly'); + $('#password').val(""); + } +} + +function rowClickCallback(row_id){ + $.ajax({ url: '/User/get-user-data/id/'+ row_id +'/format/json', dataType:"json", success:function(data){ + populateForm(data.entries); + }}); +} + +function removeUserCallback(row_id, nRow){ + $.ajax({ url: '/User/remove-user/id/'+ row_id +'/format/json', dataType:"text", success:function(data){ + var o = $('#users_datatable').dataTable().fnDeleteRow(nRow); + }}); +} + +function rowCallback( nRow, aData, iDisplayIndex ){ + $(nRow).click(function(){rowClickCallback(aData[0])}); + $('td:eq(2)', nRow).append( '').children('span').click(function(e){e.stopPropagation(); removeUserCallback(aData[0], nRow)}); + + return nRow; +} + $(document).ready(function() { $('#users_datatable').dataTable( { "bProcessing": true, @@ -12,15 +51,22 @@ $(document).ready(function() { "success": fnCallback } ); }, + "fnRowCallback": rowCallback, "aoColumns": [ /* Id */ { "sName": "id", "bSearchable": false, "bVisible": false }, /* user name */ { "sName": "login" }, /* user type */ { "sName": "type", "bSearchable": false }, - /* del button */ { "sName": "first_name", "bSearchable": false, "bSortable": false} + /* del button */ { "sName": "null as delete", "bSearchable": false, "bSortable": false} ], "bJQueryUI": true, "bAutoWidth": false, - "bLengthChange": false, - //"bFilter": false + "bLengthChange": false }); + + //$('#user_details').hide(); + + var newUser = {login:"", first_name:"", last_name:"", type:"G", id:""}; + + $('#add_user_button').click(function(){populateForm(newUser)}); + }); From d86577716bb95231dfeb664f2443b2de5de008db Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 13:31:39 -0500 Subject: [PATCH 04/21] CC-1124 filetype incon in search --- public/css/images/icon_audioclip.png | Bin 0 -> 1143 bytes public/css/images/icon_playlist.png | Bin 0 -> 1125 bytes public/js/airtime/library/library.js | 7 +++++++ 3 files changed, 7 insertions(+) create mode 100644 public/css/images/icon_audioclip.png create mode 100644 public/css/images/icon_playlist.png diff --git a/public/css/images/icon_audioclip.png b/public/css/images/icon_audioclip.png new file mode 100644 index 0000000000000000000000000000000000000000..4142603efe3aa3784b536da5d1ee01b5e1044fc6 GIT binary patch literal 1143 zcmaJ>Pi)gx7bTHKTqjL}l@1{U2m$wM0wz~erA`$GCO};1q}?{)vT>*e&!s6lEcoE}y{F&r z_x--_efCmmnJb6>8*Bt->)R;l8uG|VeVkH{V-;^-z}Q&ckLn6ferF{r^w%@FA4t9NOjsRBLL zFR_xDg;QE#-h!j^BNb(SS{YR7)DTEIJQ2_#mVu+s7&h++^o}l1V(*xt!43pZ3-nu4 zRjCBB$bz6h!iE(#&Vo1>;bMJ>L?Q&DEXOizl;NUbF2Tp5Jj;UJhbGx9b%HO8`Q2P( zC(u(En>@qR>-9)I7D3h|!wn7&dK%Gam>|OToPlL0Y}h>w1rgecrI}bm2JjT+8k)rd zO`N_hK{xkg4STmuq+yIBn+z9Wy^_qPg)p+GkO{J*{a{QpR8+Tj(2~R#4I9gb0*j(R6MjU~RKBk- zk;&v(E*8rSa9obfWTSbpFP4j+&gR9qC^onvQf75%;09NH$Bj1SdV`>wB(n%D?JKC} zEu@2;f_bf(7crl2s<+Ekn|ooKav5TV@vikh*W5TFv*U$(LrXS$V-F27>lPVm;neMA z@r|k3p+&rM^=hrKu`GOa;&AMTmz$ST?DY>p+`sin$GQC%u9tol z20|@Mo4zf{>{~rt4U84WxG4OBu+SofGyMhS{0A76 z;nk_()CN_$xZFGb`SFevwbc!l54e}p+rEi=7KnfQB>3}B0|$M%-#fuj(0#mO%J+Y~ y^TB6b%2K|=^w+Y$xYyO%>$sx}k3M#NZ7fx|z@0zv%gK!QD=6kh#9ODw&%OaB1#w{j literal 0 HcmV?d00001 diff --git a/public/css/images/icon_playlist.png b/public/css/images/icon_playlist.png new file mode 100644 index 0000000000000000000000000000000000000000..a0a5a71816695f36237c10bdb44cd24c8c4b59bd GIT binary patch literal 1125 zcmaJ=OH30%7+$SK1+{nrHR`xN4r;r*Em&Bowe1#ZVo6gP#RKYgcYqD-&ayk$g&1Q@ zB$^nb2Ol>zUIYmsTud+#BZ-fMa8VC>P$U7o2#N1kbQURkutENLJtDJXhx0>AHuGZ-H8Sf48R~W4uY4pA;zdjd zrL5=aW>x($x_i@&uCBCDBrRCk-`~HeGIU`4w+gQ>Sr4X8 ze42jg>#iHTIQHe;(|#*s7Zuf8gp^>{`d(Y5$PFWq8H##YDGr z_^DN=zZzN~k4%C5Q@vxY_f8fRB|Z-{jOMjD4m@1bTX1&m&W;To^`}-IEYe$AxT9a+ zFO4o6aZX;IiJm`qu5i}~=)2%NwDsG!PmIIma^1hg9O{cPj_Bs`pFeL8EPPVw1ZVS{ f#ScfP-cVqO3g+!|R9%~XW' ); + } + else if(type == "pl") { + $('td:eq(5)', nRow).html( '' ); + } + $(nRow).attr("id", type+'_'+id); $(nRow).qtip({ From c0d5cc4809684199cbedf301b86942e59107a6ab Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 14:09:42 -0500 Subject: [PATCH 05/21] -list view updated --- application/models/Nowplaying.php | 6 +- application/models/Users.php | 53 ++++++++--------- public/js/playlist/nowplayingdatagrid.js | 73 +++++++++--------------- public/js/playlist/showlistview.js | 2 +- 4 files changed, 54 insertions(+), 80 deletions(-) diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 02dd6837c..a3441c47d 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -43,7 +43,8 @@ class Application_Model_Nowplaying } public static function GetDataGridData($viewType, $dateString){ - + + //echo $dateString; if ($viewType == "now"){ $date = new Application_Model_DateHelper; @@ -57,9 +58,8 @@ class Application_Model_Nowplaying $current = Schedule::Get_Scheduled_Item_Data($timeNow, 0); $next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, 10, "24 hours"); } else { - $date = new Application_Model_DateHelper; - $timeNow = $date->setDate($dateString); + $date->setDate($dateString); $timeNow = $date->getDate(); $previous = array_reverse(Schedule::Get_Scheduled_Item_Data($timeNow, -1, "ALL", $date->getNowDayStartDiff()." seconds")); diff --git a/application/models/Users.php b/application/models/Users.php index 594f2e9bc..6cb618cbc 100644 --- a/application/models/Users.php +++ b/application/models/Users.php @@ -7,9 +7,9 @@ class User { public function __construct($userId) { if (strlen($userId)==0){ - $this->userInstance = $this->createUser(); + $this->_userInstance = $this->createUser(); } else { - $this->userInstance = CcSubjsQuery::create()->findPK($userId); + $this->_userInstance = CcSubjsQuery::create()->findPK($userId); } } @@ -19,81 +19,74 @@ class User { public function isHost($showId) { $userId = $this->_userInstance->getDbId(); - return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($_userId)->count() > 0; + return CcShowHostsQuery::create()->filterByDbShow($showId)->filterByDbHost($userId)->count() > 0; } public function isAdmin() { - return $userInstance->getDbType() === 'A'; + return $this->_userInstance->getDbType() === 'A'; } public function setLogin($login){ - $user = $this->userInstance; - $user->setDbLogin($login); - //$user->save(); + $user = $this->_userInstance; + $user->setDbLogin($login); } public function setPassword($password){ - $user = $this->userInstance; - $user->setDbPass(md5($password)); - //$user->save(); + $user = $this->_userInstance; + $user->setDbPass(md5($password)); } public function setFirstName($firstName){ - $user = $this->userInstance; - $user->setDbFirstName($firstName); - //$user->save(); + $user = $this->_userInstance; + $user->setDbFirstName($firstName); } public function setLastName($lastName){ - $user = $this->userInstance; - $user->setDbLastName($lastName); - //$user->save(); + $user = $this->_userInstance; + $user->setDbLastName($lastName); } public function setType($type){ - $user = $this->userInstance; - $user->setDbType($type); - //$user->save(); + $user = $this->_userInstance; + $user->setDbType($type); } public function getLogin(){ - $user = $this->userInstance; + $user = $this->_userInstance; return $user->getDbLogin(); } public function getPassword(){ - $user = $this->userInstance; + $user = $this->_userInstance; return $user->getDbPass(); } public function getFirstName(){ - $user = $this->userInstance; + $user = $this->_userInstance; return $user->getDbFirstName(); } public function getLastName(){ - $user = $this->userInstance; + $user = $this->_userInstance; return $user->getDbLastName(); } public function getType(){ - $user = $this->userInstance; + $user = $this->_userInstance; return $user->getDbType(); } public function save(){ - $this->userInstance->save(); + $this->_userInstance->save(); } public function delete(){ - if (!$this->userInstance->isDeleted()) - $this->userInstance->delete(); + if (!$this->_userInstance->isDeleted()) + $this->_userInstance->delete(); } private function createUser() { - $user = new CcSubjs(); - //$user->save(); - + $user = new CcSubjs(); return $user; } diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index 3467c5751..ec003fbfc 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -3,17 +3,17 @@ var datagridData; function getDateText(obj){ var str = obj.aData[ obj.iDataColumn ].toString(); - if (str.indexOf(" ") != -1){ - return changeTimePrecision(str.substring(0, str.indexOf(" "))); - } + datetime = str.split(" "); + if (datetime.length == 2) + return datetime[0]; return str; } function getTimeText(obj){ var str = obj.aData[ obj.iDataColumn ].toString(); - if (str.indexOf(" ") != -1){ - return changeTimePrecision(str.substring(str.indexOf(" ")+1)); - } + datetime = str.split(" "); + if (datetime.length == 2) + return changeTimePrecision(datetime[1]); return str; } @@ -23,16 +23,16 @@ function changeTimePrecisionInit(obj){ } function changeTimePrecision(str){ - if (str.indexOf(".") != -1){ - if (str.length - str.indexOf(".") > 2) - var extraLength = str.length - str.indexOf(".") -3; - return str.substring(0, str.length - extraLength); - } - return str; + + var temp = str.split(".") + if (temp.length == 2){ + if (temp[1].length > 2) + return temp[0]+"."+temp[1].substr(0, 2); + } + return str; } function notifySongEnd(){ - //alert("length " + datagridData.rows.length); for (var i=0; i Date: Wed, 9 Feb 2011 14:12:07 -0500 Subject: [PATCH 06/21] working on editing shows --- .zfproject.xml | 4 ++ .../controllers/ScheduleController.php | 60 ++++++++++++------- .../scripts/schedule/add-show-dialog.phtml | 7 --- .../views/scripts/schedule/show-overlap.phtml | 4 -- public/js/airtime/schedule/schedule.js | 4 ++ 5 files changed, 46 insertions(+), 33 deletions(-) delete mode 100644 application/views/scripts/schedule/show-overlap.phtml diff --git a/.zfproject.xml b/.zfproject.xml index 66290e350..9aa1d3fdd 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -69,6 +69,7 @@ + @@ -291,6 +292,9 @@ + + + diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index a59c00fad..9dfa22f63 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -2,16 +2,12 @@ class ScheduleController extends Zend_Controller_Action { + protected $sched_sess = null; public function init() { - if(!Zend_Auth::getInstance()->hasIdentity()) - { - $this->_redirect('login/index'); - } - - $ajaxContext = $this->_helper->getHelper('AjaxContext'); + $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('event-feed', 'json') ->addActionContext('make-context-menu', 'json') ->addActionContext('add-show-dialog', 'json') @@ -26,6 +22,7 @@ class ScheduleController extends Zend_Controller_Action ->addActionContext('get-current-playlist', 'json') ->addActionContext('find-playlists', 'json') ->addActionContext('remove-group', 'json') + ->addActionContext('edit-show', 'json') ->initContext(); $this->sched_sess = new Zend_Session_Namespace("schedule"); @@ -112,14 +109,8 @@ class ScheduleController extends Zend_Controller_Action $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $show = new Show(new User($userInfo->id, $userInfo->type)); - $overlap = $show->addShow($data); - - if(isset($overlap)) { - $this->view->overlap = $overlap; - } - else { - $this->_redirect('Schedule'); - } + $show->addShow($data); + $this->_redirect('Schedule'); } } @@ -169,7 +160,7 @@ class ScheduleController extends Zend_Controller_Action public function deleteShowAction() { $showInstanceId = $this->_getParam('id'); - + $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $user = new User($userInfo->id, $userInfo->type); @@ -214,7 +205,7 @@ class ScheduleController extends Zend_Controller_Action public function scheduleShowAction() { - $showInstanceId = $this->sched_sess->showInstanceId; + $showInstanceId = $this->sched_sess->showInstanceId; $search = $this->_getParam('search', null); $plId = $this->_getParam('plId'); @@ -245,9 +236,8 @@ class ScheduleController extends Zend_Controller_Action $user = new User($userInfo->id, $userInfo->type); $show = new ShowInstance($showInstanceId); - if($user->isHost($show->getShowId())) { + if($user->isHost($show->getShowId())) $show->clearShow(); - } } public function getCurrentPlaylistAction() @@ -257,8 +247,8 @@ class ScheduleController extends Zend_Controller_Action public function findPlaylistsAction() { - $post = $this->getRequest()->getPost(); - + $post = $this->getRequest()->getPost(); + $show = new ShowInstance($this->sched_sess->showInstanceId); $playlists = $show->searchPlaylistsForShow($post); @@ -289,7 +279,7 @@ class ScheduleController extends Zend_Controller_Action public function scheduleShowDialogAction() { - $showInstanceId = $this->_getParam('id'); + $showInstanceId = $this->_getParam('id'); $this->sched_sess->showInstanceId = $showInstanceId; $show = new ShowInstance($showInstanceId); @@ -331,13 +321,39 @@ class ScheduleController extends Zend_Controller_Action public function showContentDialogAction() { - $showInstanceId = $this->_getParam('id'); + $showInstanceId = $this->_getParam('id'); $show = new ShowInstance($showInstanceId); $this->view->showContent = $show->getShowListContent(); $this->view->dialog = $this->view->render('schedule/show-content-dialog.phtml'); unset($this->view->showContent); } + + public function editShowAction() + { + $formWhat = new Application_Form_AddShowWhat(); + $formWhat->removeDecorator('DtDdWrapper'); + $formWho = new Application_Form_AddShowWho(); + $formWho->removeDecorator('DtDdWrapper'); + $formWhen = new Application_Form_AddShowWhen(); + $formWhen->removeDecorator('DtDdWrapper'); + $formRepeats = new Application_Form_AddShowRepeats(); + $formRepeats->removeDecorator('DtDdWrapper'); + $formStyle = new Application_Form_AddShowStyle(); + $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->dialog = $this->view->render('schedule/edit-show.phtml'); + } + + } + + diff --git a/application/views/scripts/schedule/add-show-dialog.phtml b/application/views/scripts/schedule/add-show-dialog.phtml index 4550f6756..dc152e89e 100644 --- a/application/views/scripts/schedule/add-show-dialog.phtml +++ b/application/views/scripts/schedule/add-show-dialog.phtml @@ -11,13 +11,6 @@
- overlap)) : ?> -
-
Overlap
- partialLoop('schedule/show-overlap.phtml', $this->overlap); ?> -
- -
what ?>
diff --git a/application/views/scripts/schedule/show-overlap.phtml b/application/views/scripts/schedule/show-overlap.phtml deleted file mode 100644 index 8b365fff8..000000000 --- a/application/views/scripts/schedule/show-overlap.phtml +++ /dev/null @@ -1,4 +0,0 @@ -
- name ?> - start_time ?>-end_time ?> -
diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js index 40b9865a9..99e5fadf1 100644 --- a/public/js/airtime/schedule/schedule.js +++ b/public/js/airtime/schedule/schedule.js @@ -191,6 +191,10 @@ function buildScheduleDialog(json){ dialog.dialog('open'); } +function buildEditDialog(json){ + +} + function scheduleRefetchEvents() { $("#schedule_calendar").fullCalendar( 'refetchEvents' ); } From c4893e9d363f0c8821bafb66dbc9200ebbea299d Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 15:23:32 -0500 Subject: [PATCH 07/21] -updated list-view UI --- .gitignore | 1 + .../views/scripts/nowplaying/day-view.phtml | 6 ++- .../views/scripts/nowplaying/index.phtml | 4 ++ public/css/styles.css | 53 +++++++++++++++++-- public/js/playlist/nowplayingdatagrid.js | 14 +++-- 5 files changed, 69 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 83a739f21..47bb04716 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.pyc files/ pypo/liquidsoap/liquidsoap +build/build.properties diff --git a/application/views/scripts/nowplaying/day-view.phtml b/application/views/scripts/nowplaying/day-view.phtml index 3f23200ab..050fe1683 100644 --- a/application/views/scripts/nowplaying/day-view.phtml +++ b/application/views/scripts/nowplaying/day-view.phtml @@ -1,2 +1,6 @@ - +
+ Date: + Now View + Day View +
diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml index 11d775d98..627c96a86 100644 --- a/application/views/scripts/nowplaying/index.phtml +++ b/application/views/scripts/nowplaying/index.phtml @@ -1 +1,5 @@ +
diff --git a/public/css/styles.css b/public/css/styles.css index 070512a5f..90144827b 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -867,7 +867,6 @@ div.ui-datepicker { margin-right:22px; } - #schedule_playlist_chosen li > div > div > span { float: right; margin-right:46px; @@ -932,7 +931,7 @@ h2#scheduled_playlist_name span { } .time { - width: 100px; + width: 80px; margin: 5px; text-align: left; } @@ -1083,15 +1082,21 @@ button, input { .user-management { width:810px; + width:380px; +} +.user-management-expanded { + width:810px; } .user-data { float:left; width:420px; + margin-left:10px; + display:none; } .user-list-wrapper { float:left; width:380px; - margin-right:10px; + /*margin-right:10px;*/ } .user-management div.user-list-wrapper .ui-widget-header:first-child { @@ -1105,10 +1110,11 @@ button, input { } .user-management h2 { font-size: 1.7em; - padding-bottom: 16px; + padding-bottom: 12px; } .user-management .dataTables_filter input { width: 378px; + margin-bottom:8px; } .user-data.simple-formblock dd { width: 73%; @@ -1122,8 +1128,9 @@ button, input { } .user-list-wrapper .button-holder { - padding:8px 0; + padding:0; text-align:right; + height:37px; } .user-list-wrapper .button-holder .ui-button { margin:0; @@ -1141,3 +1148,39 @@ button, input { #ui-datepicker-div { z-index: 10 !important } +.button-bar-top { + text-align:right; + height:30px; +} + +.toggle-button, .toggle-button-active { + border: 1px solid #505050; + background-color: #5e5e5e; + background: -moz-linear-gradient(top, #757575 0, #5e5e5e 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #757575), color-stop(100%, #5e5e5e)); + color: #ffffff; + margin:0; + font-size:12px; + padding:5px 12px; + text-decoration:none; + text-shadow: #343434 0px -1px; + border-width:1px 0 1px 1px; +} +.toggle-button:hover { + background-color: #292929; + background: -moz-linear-gradient(top, #3b3b3b 0, #292929 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #292929)); + text-shadow: #000000 0px -1px; +} + +.toggle-button-active { + background-color: #c6c6c6; + background: -moz-linear-gradient(top, #767676 0, #c6c6c6 20%, #c6c6c6 35%, #a0a0a0 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #767676), color-stop(20%, #c6c6c6), color-stop(35%, #c6c6c6), color-stop(100%, #a0a0a0)); + color: #2e2e2e; + cursor:default; + text-shadow: #d8d8d8 0px 1px; +} +.end-button { + border-width:1px; +} \ No newline at end of file diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index ec003fbfc..749738bb0 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -123,12 +123,20 @@ function init2(){ } +function redirect(url){ + document.location.href = url; +} + $(document).ready(function() { if (viewType == "day"){ + $('#now_view').click(function(){redirect('/Nowplaying/index')}); + $("#datepicker").datepicker({ - onSelect: function(dateText, inst) { updateData();}}); - var date = new Date(); - $("#datepicker").datepicker("setDate", date); + onSelect: function(dateText, inst) + { updateData();}}); + $("#datepicker").datepicker("setDate", new Date()); + } else { + $('#day_view').click(function(){redirect('/Nowplaying/day-view')}); } init2(); From ce23df43d1f272d02b9b096f6ed91ded2255dc1c Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 15:25:16 -0500 Subject: [PATCH 08/21] updated navigation menu --- application/configs/navigation.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/application/configs/navigation.php b/application/configs/navigation.php index 1fc2ada39..795f97dea 100644 --- a/application/configs/navigation.php +++ b/application/configs/navigation.php @@ -9,24 +9,11 @@ */ $pages = array( array( - 'label' => 'Now Playing', - 'uri' => 'javascript:void(null)', - 'pages' => array( - array( - 'label' => 'Current', - 'module' => 'default', - 'controller' => 'Nowplaying', - 'action' => 'index', - 'resource' => 'Nowplaying' - ), - array( - 'label' => 'Daily View', - 'module' => 'default', - 'controller' => 'Nowplaying', - 'action' => 'day-view', - 'resource' => 'Nowplaying' - ) - ) + 'label' => 'Now Playing', + 'module' => 'default', + 'controller' => 'Nowplaying', + 'action' => 'index', + 'resource' => 'Nowplaying' ), array( 'label' => 'Schedule', From 28f3a77246fe0df3de776a89bb3235480e339739 Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 15:45:45 -0500 Subject: [PATCH 09/21] -day view now highlights current show --- application/models/DateHelper.php | 4 ++++ application/models/Nowplaying.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/application/models/DateHelper.php b/application/models/DateHelper.php index 6c44dd055..e24d9c7ec 100644 --- a/application/models/DateHelper.php +++ b/application/models/DateHelper.php @@ -12,6 +12,10 @@ class Application_Model_DateHelper return date("Y-m-d H:i:s", $this->_timestamp); } + function getTime(){ + return date("H:i:s", $this->_timestamp); + } + function setDate($dateString){ $this->_timestamp = strtotime($dateString); } diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index a3441c47d..9f883c55c 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -59,7 +59,8 @@ class Application_Model_Nowplaying $next = Schedule::Get_Scheduled_Item_Data($timeNow, 1, 10, "24 hours"); } else { $date = new Application_Model_DateHelper; - $date->setDate($dateString); + $time = $date->getTime(); + $date->setDate($dateString." ".$time); $timeNow = $date->getDate(); $previous = array_reverse(Schedule::Get_Scheduled_Item_Data($timeNow, -1, "ALL", $date->getNowDayStartDiff()." seconds")); From a43da4e887491c76a080f3c12b8047d44c00d976 Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 15:54:57 -0500 Subject: [PATCH 10/21] -fix gap between buttons --- application/views/scripts/nowplaying/day-view.phtml | 3 +-- application/views/scripts/nowplaying/index.phtml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/application/views/scripts/nowplaying/day-view.phtml b/application/views/scripts/nowplaying/day-view.phtml index 050fe1683..294fb95d3 100644 --- a/application/views/scripts/nowplaying/day-view.phtml +++ b/application/views/scripts/nowplaying/day-view.phtml @@ -1,6 +1,5 @@
diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml index 627c96a86..e06b49810 100644 --- a/application/views/scripts/nowplaying/index.phtml +++ b/application/views/scripts/nowplaying/index.phtml @@ -1,5 +1,4 @@
From d15019c168b02b942abb6c8894f1f5790870ef70 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 16:29:15 -0500 Subject: [PATCH 11/21] CC-1883 pressing enter now takes entered data. --- public/js/airtime/library/spl.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index b10ec1642..b4555aba7 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -334,9 +334,9 @@ function newSPL() { url = '/Playlist/new/format/json'; $.post(url, function(json){ - var submit; + var submit, form; - submit = $('') + submit = $('') .button() .click(function(){ var url, data; @@ -353,9 +353,20 @@ function newSPL() { }) }); + form = $(json.form); + + form.find("input, description") + .keydown(function(event){ + //enter was pressed + if(event.keyCode === 13) { + event.preventDefault(); + $("#new_playlist_submit").click(); + } + }) + $("#side_playlist") .empty() - .append(json.form) + .append(form) .append(submit); }); } From 0da5c340b306b7e47687fcb1088b951ba01be733 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 16:31:12 -0500 Subject: [PATCH 12/21] typo. --- public/js/airtime/library/spl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index b4555aba7..7c2535b82 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -355,7 +355,7 @@ function newSPL() { form = $(json.form); - form.find("input, description") + form.find("input, textarea") .keydown(function(event){ //enter was pressed if(event.keyCode === 13) { From 86d1aafed478bef64bed16dffde598426b7291f9 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 16:53:11 -0500 Subject: [PATCH 13/21] can now change name/description of a playlist. --- application/controllers/LibraryController.php | 3 + .../views/scripts/playlist/metadata.phtml | 5 +- public/js/airtime/library/spl.js | 74 ++++++++++--------- 3 files changed, 42 insertions(+), 40 deletions(-) diff --git a/application/controllers/LibraryController.php b/application/controllers/LibraryController.php index 281b33385..6b334c6d0 100644 --- a/application/controllers/LibraryController.php +++ b/application/controllers/LibraryController.php @@ -80,6 +80,9 @@ class LibraryController extends Zend_Controller_Action 'title' => 'Close'); } + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/metadata/format/json/id/#id#', 'callback' => 'window["createPlaylistMetaForm"]'), + 'title' => 'Edit Metadata'); + $menu[] = array('action' => array('type' => 'ajax', 'url' => '/Playlist/delete'.$params, 'callback' => 'window["deletePlaylist"]'), 'title' => 'Delete'); diff --git a/application/views/scripts/playlist/metadata.phtml b/application/views/scripts/playlist/metadata.phtml index 41276c253..440203443 100644 --- a/application/views/scripts/playlist/metadata.phtml +++ b/application/views/scripts/playlist/metadata.phtml @@ -1,4 +1 @@ -form->setAction($this->url()); -echo $this->form; +form; ?> diff --git a/public/js/airtime/library/spl.js b/public/js/airtime/library/spl.js index 7c2535b82..1885329a8 100644 --- a/public/js/airtime/library/spl.js +++ b/public/js/airtime/library/spl.js @@ -328,47 +328,49 @@ function closeSPL() { $.post(url, noOpenPL); } +function createPlaylistMetaForm(json) { + var submit, form; + + submit = $('') + .button() + .click(function(){ + var url, data; + + url = '/Playlist/metadata/format/json'; + data = $("#side_playlist form").serialize(); + + $.post(url, data, function(json){ + if(json.form){ + + } + + openDiffSPL(json); + }) + }); + + form = $(json.form); + + form.find("input, textarea") + .keydown(function(event){ + //enter was pressed + if(event.keyCode === 13) { + event.preventDefault(); + $("#new_playlist_submit").click(); + } + }) + + $("#side_playlist") + .empty() + .append(form) + .append(submit); +} + function newSPL() { var url; url = '/Playlist/new/format/json'; - $.post(url, function(json){ - var submit, form; - - submit = $('') - .button() - .click(function(){ - var url, data; - - url = '/Playlist/metadata/format/json'; - data = $("#side_playlist form").serialize(); - - $.post(url, data, function(json){ - if(json.form){ - - } - - openDiffSPL(json); - }) - }); - - form = $(json.form); - - form.find("input, textarea") - .keydown(function(event){ - //enter was pressed - if(event.keyCode === 13) { - event.preventDefault(); - $("#new_playlist_submit").click(); - } - }) - - $("#side_playlist") - .empty() - .append(form) - .append(submit); - }); + $.post(url, createPlaylistMetaForm); } function deleteSPL() { From a447839745384716f551697cc46f89bb503dc697 Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 17:02:32 -0500 Subject: [PATCH 14/21] -UI changes. -Blank row now displays start and end time -Changed default playlist name --- application/controllers/PlaylistController.php | 2 +- application/models/Nowplaying.php | 9 ++++++--- application/views/scripts/user/add-user.phtml | 12 +++++------- public/css/styles.css | 6 +++--- public/js/playlist/playlist.js | 15 ++++++++------- 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/application/controllers/PlaylistController.php b/application/controllers/PlaylistController.php index 11de58a57..17d604c46 100644 --- a/application/controllers/PlaylistController.php +++ b/application/controllers/PlaylistController.php @@ -88,7 +88,7 @@ class PlaylistController extends Zend_Controller_Action $userInfo = Zend_Auth::getInstance()->getStorage()->read(); $pl = new Playlist(); - $pl_id = $pl->create("Test Zend Auth"); + $pl_id = $pl->create("Untitled Playlist"); $pl->setPLMetaData('dc:creator', $userInfo->login); $this->changePlaylist($pl_id); diff --git a/application/models/Nowplaying.php b/application/models/Nowplaying.php index 9f883c55c..966470528 100644 --- a/application/models/Nowplaying.php +++ b/application/models/Nowplaying.php @@ -4,8 +4,11 @@ class Application_Model_Nowplaying { public static function InsertBlankRow($i, $rows){ - $startDate = explode(".", $rows[$i-1][3]); - $endDate = explode(".", $rows[$i][2]); + $startDateFull = $rows[$i-1][3]; + $endDateFull = $rows[$i][2]; + + $startDate = explode(".", $startDateFull); + $endDate = explode(".", $endDateFull); $epochStartMS = strtotime($startDate[0])*1000; $epochEndMS = strtotime($endDate[0])*1000; @@ -15,7 +18,7 @@ class Application_Model_Nowplaying if (count($endDate) > 1) $epochEndMS += $endDate[1]; - $blankRow = array(array("b", "-", "-", "-", Application_Model_DateHelper::ConvertMSToHHMMSSmm($epochEndMS - $epochStartMS), "-", "-", "-", "-" , "-", "", "")); + $blankRow = array(array("b", $startDateFull, $startDateFull, $endDate, Application_Model_DateHelper::ConvertMSToHHMMSSmm($epochEndMS - $epochStartMS), "-", "-", "-", "-" , "-", "", "")); array_splice($rows, $i, 0, $blankRow); return $rows; } diff --git a/application/views/scripts/user/add-user.phtml b/application/views/scripts/user/add-user.phtml index 5a809ac1f..5760e28ae 100644 --- a/application/views/scripts/user/add-user.phtml +++ b/application/views/scripts/user/add-user.phtml @@ -6,13 +6,11 @@
-
-
- -
-
+
+ +
diff --git a/public/css/styles.css b/public/css/styles.css index 90144827b..1cbd252d0 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -1082,7 +1082,7 @@ button, input { .user-management { width:810px; - width:380px; + /*width:380px;*/ } .user-management-expanded { width:810px; @@ -1091,7 +1091,7 @@ button, input { float:left; width:420px; margin-left:10px; - display:none; + /* display:block;*/ } .user-list-wrapper { float:left; @@ -1183,4 +1183,4 @@ button, input { } .end-button { border-width:1px; -} \ No newline at end of file +} diff --git a/public/js/playlist/playlist.js b/public/js/playlist/playlist.js index e59dcc548..2993a8a52 100644 --- a/public/js/playlist/playlist.js +++ b/public/js/playlist/playlist.js @@ -104,23 +104,24 @@ function updateProgressBarValue(){ //calculate how much time left to next song if there is any if (nextSongs.length > 0 && nextSongPrepare){ var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime; - if (diff < serverUpdateInterval && diff >= 0){ + if (diff < serverUpdateInterval){ + if (diff < 0) + diff=0; + nextSongPrepare = false; setTimeout(newSongStart, diff); - } else if (diff < 0 && APPLICATION_ENV == "development"){ - alert ("Warning: estimatedSchedulePosixTime > songStartPosixTime"); - alert (estimatedSchedulePosixTime + " " + nextSongs[0].songStartPosixTime); } } //calculate how much time left to next show if there is any if (nextShow.length > 0 && nextShowPrepare){ var diff = nextShow[0].showStartPosixTime - estimatedSchedulePosixTime; - if (diff < serverUpdateInterval && diff >= 0){ + if (diff < serverUpdateInterval){ + if (diff < 0) + diff=0; + nextShowPrepare = false; setTimeout(nextShowStart, diff); - } else if (diff < 0 && APPLICATION_ENV == "development"){ - alert ("Warning: estimatedSchedulePosixTime > showStartPosixTime"); } } From d210a363585223b3c06037700886de7ca89ce43f Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 18:10:46 -0500 Subject: [PATCH 15/21] new add show html. --- .../controllers/ScheduleController.php | 20 +------ application/models/Shows.php | 32 +++++++++- .../scripts/form/add-show-checkbox.phtml | 2 +- .../views/scripts/form/add-show-style.phtml | 5 +- .../scripts/schedule/add-show-dialog.phtml | 50 ++++++++-------- .../views/scripts/schedule/edit-show.phtml | 4 -- public/css/add-show.css | 9 +-- public/css/styles.css | 58 ++++++++++++++++++- public/js/airtime/schedule/add-show.js | 4 +- 9 files changed, 120 insertions(+), 64 deletions(-) diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index 13cdc8d7f..a6792d84a 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -331,24 +331,10 @@ class ScheduleController extends Zend_Controller_Action public function editShowAction() { - $formWhat = new Application_Form_AddShowWhat(); - $formWhat->removeDecorator('DtDdWrapper'); - $formWho = new Application_Form_AddShowWho(); - $formWho->removeDecorator('DtDdWrapper'); - $formWhen = new Application_Form_AddShowWhen(); - $formWhen->removeDecorator('DtDdWrapper'); - $formRepeats = new Application_Form_AddShowRepeats(); - $formRepeats->removeDecorator('DtDdWrapper'); - $formStyle = new Application_Form_AddShowStyle(); - $formStyle->removeDecorator('DtDdWrapper'); + $showInstanceId = $this->_getParam('id'); + $showInstance = new ShowInstance($showInstanceId); - $this->view->what = $formWhat; - //$this->view->when = $formWhen; - //$this->view->repeats = $formRepeats; - $this->view->who = $formWho; - $this->view->style = $formStyle; - - $this->view->dialog = $this->view->render('schedule/edit-show.phtml'); + $show = new Show($showInstance->getShowId()); } diff --git a/application/models/Shows.php b/application/models/Shows.php index 6d6ee9356..20a3a122b 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -11,16 +11,44 @@ class Show { public function getName() { $show = CcShowQuery::create()->findPK($this->_showId); - return $show->getDbName(); } public function setName($name) { $show = CcShowQuery::create()->findPK($this->_showId); - $show->setDbName($name); } + public function getDescription() { + $show = CcShowQuery::create()->findPK($this->_showId); + return $show->getDbDescription(); + } + + public function setDescription($description) { + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbDescription($description); + } + + public function getColor() { + $show = CcShowQuery::create()->findPK($this->_showId); + return $show->getDbColor(); + } + + public function setColor($color) { + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbColor($color); + } + + public function getBackgroundColor() { + $show = CcShowQuery::create()->findPK($this->_showId); + return $show->getDbBackgroundColor(); + } + + public function setBackgroundColor($backgroundColor) { + $show = CcShowQuery::create()->findPK($this->_showId); + $show->setDbBackgroundColor($backgroundColor); + } + //end dates are non inclusive. public static function addShow($data) { diff --git a/application/views/scripts/form/add-show-checkbox.phtml b/application/views/scripts/form/add-show-checkbox.phtml index 2d7f95bd1..f1012d1c7 100644 --- a/application/views/scripts/form/add-show-checkbox.phtml +++ b/application/views/scripts/form/add-show-checkbox.phtml @@ -10,5 +10,5 @@ - formErrors($this->element->getMessages()) ?> + element->hasErrors()) { echo $this->formErrors($this->element->getMessages());} ?> diff --git a/application/views/scripts/form/add-show-style.phtml b/application/views/scripts/form/add-show-style.phtml index 7ab679a6f..86f42ff24 100644 --- a/application/views/scripts/form/add-show-style.phtml +++ b/application/views/scripts/form/add-show-style.phtml @@ -9,8 +9,5 @@ $this->element->getAttribs() ) ?> - element->hasErrors()) { - echo $this->formErrors($this->element->getMessages()); - } - ?> + element->hasErrors()) { echo $this->formErrors($this->element->getMessages());} ?> diff --git a/application/views/scripts/schedule/add-show-dialog.phtml b/application/views/scripts/schedule/add-show-dialog.phtml index dc152e89e..aba2daf40 100644 --- a/application/views/scripts/schedule/add-show-dialog.phtml +++ b/application/views/scripts/schedule/add-show-dialog.phtml @@ -1,31 +1,29 @@
-
-
- -
-
-
-
- what ?> -
-
- when ?> - repeats ?> -
-
- who ?> -
-
- style ?> -
-
- +
+
+
+ +
+
+
+ what ?> +
+

When

+
+ when ?> + repeats ?> +
+

Who

+
+ who ?> +
+

Style

+
+ style ?> +
+
+
diff --git a/application/views/scripts/schedule/edit-show.phtml b/application/views/scripts/schedule/edit-show.phtml index 3efef5486..bce09e6c8 100644 --- a/application/views/scripts/schedule/edit-show.phtml +++ b/application/views/scripts/schedule/edit-show.phtml @@ -2,10 +2,6 @@
what ?>
-
- when ?> - repeats ?> -
who ?>
diff --git a/public/css/add-show.css b/public/css/add-show.css index 106027531..3f53ff6b0 100644 --- a/public/css/add-show.css +++ b/public/css/add-show.css @@ -1,4 +1,3 @@ - #schedule-add-show, #fullcalendar_show_display { float: left; @@ -12,7 +11,7 @@ #schedule-add-show textarea { width: 99%; - height: 100px; + height: 80px; } #fullcalendar_show_display { @@ -78,9 +77,7 @@ label.wrapp-label input[type="checkbox"] { float:left; margin:-1px 4px 0 0; } -#schedule-add-show fieldset { - min-height:70px; -} + #schedule-add-show fieldset:last-child { margin-bottom:0; } @@ -107,4 +104,4 @@ label.wrapp-label input[type="checkbox"] { padding:8px; color:#902d2d; display:none; -} +} \ No newline at end of file diff --git a/public/css/styles.css b/public/css/styles.css index 1cbd252d0..c92abe916 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -721,7 +721,7 @@ dt.block-display, dd.block-display { .floated-panel { margin-top:0; width:99.99%; - z-index:9999; + z-index:999; } @@ -820,7 +820,8 @@ div.ui-datepicker { #schedule_playlist_chosen li > h3 > div > span.ui-icon { margin-top: 0px; } -#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-e { +#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-e, +#schedule_playlist_chosen li > h3 > span.ui-icon.ui-icon-triangle-1-s { float:left; margin-right: 8px; } @@ -1091,7 +1092,7 @@ button, input { float:left; width:420px; margin-left:10px; - /* display:block;*/ + /*display:none;*/ } .user-list-wrapper { float:left; @@ -1184,3 +1185,54 @@ button, input { .end-button { border-width:1px; } + + +ul.errors { + display:block; + clear:left; + padding:3px 0 0 0; + margin:0; +} + +ul.errors li { + color:#902d2d; + font-size:11px; + padding:2px 4px; + background:#c6b4b4; + margin-bottom:2px; + border:1px solid #c83f3f; +} +.collapsible-header { + border: 1px solid #8f8f8f; + background-color: #cccccc; + background: -moz-linear-gradient(top, #cccccc 0, #b9b9b9 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #cccccc), color-stop(100%, #b9b9b9)); + font-size:13px; + color:#353535; + font-weight:bold; + padding:6px 0 6px 20px; + margin:8px 0 0 0; + cursor:pointer; + position:relative; +} +.collapsible-content { + margin-top:-1px; + display:none; +} +.collapsible-header .arrow-icon { + display:block; + background:url(images/arrows_collapse.png) no-repeat 0 0; + height:11px; + width:11px; + position:absolute; + left:5px; + top:8px; + +} +.collapsible-header.close .arrow-icon { + background-position: 0 -11px; + +} +#schedule-add-show .button-bar { + height: 28px; + margin: 0 0 8px 0; \ No newline at end of file diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index e06090265..8280bd40e 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -60,7 +60,9 @@ function findHosts(request, callback) { function setAddShowEvents() { var start, end; - $(".tabs").tabs(); + $("h3").click(function(){ + $(this).next().toggle(); + }); if(!$("#add_show_repeats").attr('checked')) { $("#schedule-show-when > fieldset:last").hide(); From 40be54e82f2c7797cbed7b9d903ac514e4910ec0 Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 18:25:33 -0500 Subject: [PATCH 16/21] -completed CC-1808 --- application/views/scripts/nowplaying/index.phtml | 2 +- public/css/images/progressbar_show_red.png | Bin 0 -> 150 bytes public/css/styles.css | 5 ++++- public/js/playlist/playlist.js | 11 +++++++---- 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 public/css/images/progressbar_show_red.png diff --git a/application/views/scripts/nowplaying/index.phtml b/application/views/scripts/nowplaying/index.phtml index e06b49810..897b6bb65 100644 --- a/application/views/scripts/nowplaying/index.phtml +++ b/application/views/scripts/nowplaying/index.phtml @@ -1,4 +1,4 @@
diff --git a/public/css/images/progressbar_show_red.png b/public/css/images/progressbar_show_red.png new file mode 100644 index 0000000000000000000000000000000000000000..59f7a899b2ed4fd70f686725b7e37fb3c96513ad GIT binary patch literal 150 zcmeAS@N?(olHy`uVBq!ia0vp^j6lr7#0(^jw(VUB5-1LGcVbv~PUa<$!xP{W;<|@H z>`sfZ6;1Je)Y~fItPG4 o0-i38Asp9}Ee>2b@ZbPYgrkG8v6p2pP%i_6r>mdKI;Vst0GJXbR{#J2 literal 0 HcmV?d00001 diff --git a/public/css/styles.css b/public/css/styles.css index 1cbd252d0..aecf909bb 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -174,7 +174,7 @@ select { border-width:1px 1px 0 1px; background:#141414 url(images/progressbar_bg.png) repeat-x 0 0; } -.progressbar .progress-song, .progressbar .progress-show { +.progressbar .progress-song, .progressbar .progress-show, .progress-show-red { height:4px; width:0%; background:#f97202 url(images/progressbar_song.png) repeat-x 0 0; @@ -182,6 +182,9 @@ select { .progressbar .progress-show { background:#02cef9 url(images/progressbar_show.png) repeat-x 0 0; } +.progressbar .progress-show-red { + background:#02cef9 url(images/progressbar_show_red.png) repeat-x 0 0; +} .now-playing-info .lenght { color:#c4c4c4; padding-left:6px; diff --git a/public/js/playlist/playlist.js b/public/js/playlist/playlist.js index 2993a8a52..de404356e 100644 --- a/public/js/playlist/playlist.js +++ b/public/js/playlist/playlist.js @@ -92,13 +92,16 @@ function updateProgressBarValue(){ if (currentSong.length > 0){ songPercentDone = (estimatedSchedulePosixTime - currentSong[0].songStartPosixTime)/currentSong[0].songLengthMs*100; if (songPercentDone < 0 || songPercentDone > 100){ - songPercentDone = 0; - currentSong = new Array(); + songPercentDone = 0; + currentSong = new Array(); } else { $('#on-air-info').attr("class", "on-air-info on"); + $('#progress-show').attr("class", "progress-show"); } - } else + } else { $('#on-air-info').attr("class", "on-air-info off"); + $('#progress-show').attr("class", "progress-show-red"); + } $('#progress-bar').attr("style", "width:"+songPercentDone+"%"); //calculate how much time left to next song if there is any @@ -132,7 +135,7 @@ function updatePlaybar(){ /* Column 0 update */ $('#previous').empty(); $('#prev-length').empty(); - $('#current').text("Current:"); + $('#current').html("Current: Nothing Scheduled"); $('#next').empty(); $('#next-length').empty(); if (previousSongs.length > 0){ From e95b877960f01eda40cb52bb66fe06dfedbb2277 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 18:47:49 -0500 Subject: [PATCH 17/21] adding class input_select, changing problem with min resolution select html. --- application/forms/AddShowRepeats.php | 3 ++- public/js/airtime/schedule/full-calendar-functions.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/application/forms/AddShowRepeats.php b/application/forms/AddShowRepeats.php index 7744b35e9..dba0f4309 100644 --- a/application/forms/AddShowRepeats.php +++ b/application/forms/AddShowRepeats.php @@ -8,7 +8,8 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm //Add type select $this->addElement('select', 'add_show_repeat_type', array( 'required' => true, - 'label' => 'Repeat Type:', + 'label' => 'Repeat Type:', + 'class' => ' input_select', 'multiOptions' => array( "0" => "weekly", "1" => "bi-weekly", diff --git a/public/js/airtime/schedule/full-calendar-functions.js b/public/js/airtime/schedule/full-calendar-functions.js index 74f5cb61a..d877cca7a 100644 --- a/public/js/airtime/schedule/full-calendar-functions.js +++ b/public/js/airtime/schedule/full-calendar-functions.js @@ -23,13 +23,15 @@ function dayClick(date, allDay, jsEvent, view) { function viewDisplay( view ) { - $('.schedule_change_slots').remove(); + var td = $('.schedule_change_slots').parent(); + td.prev().remove(); + td.remove(); if(view.name === 'agendaDay' || view.name === 'agendaWeek') { var calendarEl = this; - var select = $('') .append('') .append('') .append('') From 292996fc5b5cac616e744136f30e74daa71c6360 Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 18:54:15 -0500 Subject: [PATCH 18/21] -list-view doesn't reset to the top every 5 seconds anymore. --- public/js/playlist/nowplayingdatagrid.js | 20 +++++++++++++++----- public/js/playlist/playlist.js | 24 ++++++++---------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index 749738bb0..a558d13a7 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -73,7 +73,6 @@ function createDataGrid(){ "bInfo": false, "bLengthChange": false, "bPaginate": false, - "aaData": datagridData.rows, "aoColumns": columns, "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { if (aData[aData.length-2] == "t") @@ -83,7 +82,8 @@ function createDataGrid(){ else if (aData[0] == "b") $(nRow).attr("style", "background-color:#EE3B3B"); return nRow; - } + }, + "bAutoWidth":false } ); @@ -104,15 +104,23 @@ function getAJAXURL(){ return url; } -function updateData(){ +function updateDataTable(){ + var table = $('#nowplayingtable').dataTable(); + + table.fnClearTable(false); + table.fnAddData(datagridData.rows); + +} + +function getData(){ $.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){ datagridData = data.entries; - createDataGrid(); + updateDataTable(); }}); } function init2(){ - updateData(); + getData(); if (typeof registerSongEndListener == 'function' && !registered){ registered = true; @@ -128,6 +136,8 @@ function redirect(url){ } $(document).ready(function() { + + createDataGrid(); if (viewType == "day"){ $('#now_view').click(function(){redirect('/Nowplaying/index')}); diff --git a/public/js/playlist/playlist.js b/public/js/playlist/playlist.js index de404356e..0c1dd227d 100644 --- a/public/js/playlist/playlist.js +++ b/public/js/playlist/playlist.js @@ -73,8 +73,6 @@ function nextShowStart(){ nextShowPrepare = true; currentShow[0] = nextShow.shift(); updatePlaybar(); - - //notifySongEndListener(); } /* Called every "uiUpdateInterval" mseconds. */ @@ -108,6 +106,9 @@ function updateProgressBarValue(){ if (nextSongs.length > 0 && nextSongPrepare){ var diff = nextSongs[0].songStartPosixTime - estimatedSchedulePosixTime; if (diff < serverUpdateInterval){ + + //sometimes the diff is negative (-100ms for example). Still looking + //into why this could sometimes happen. if (diff < 0) diff=0; @@ -195,22 +196,13 @@ function calcAdditionalShowData(show){ if (show.length > 0){ show[0].showStartPosixTime = convertDateToPosixTime(show[0].start_timestamp); show[0].showEndPosixTime = convertDateToPosixTime(show[0].end_timestamp); - - //hack to fix case where show end is next day, but we have it set - //as the same day. - if (show[0].showEndPosixTime - show[0].showStartPosixTime < 0) - show[0].showEndPosixTime += 1000*3600*24; - show[0].showLengthMs = show[0].showEndPosixTime - show[0].showStartPosixTime; } } function parseItems(obj){ APPLICATION_ENV = obj.env; - - var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime); - schedulePosixTime += parseInt(obj.timezoneOffset)*1000; - + $('#time-zone').text(obj.timezone); previousSongs = obj.previous; @@ -227,10 +219,10 @@ function parseItems(obj){ calcAdditionalShowData(obj.currentShow); calcAdditionalShowData(obj.nextShow); - if (localRemoteTimeOffset == null){ - var date = new Date(); - localRemoteTimeOffset = date.getTime() - schedulePosixTime; - } + var schedulePosixTime = convertDateToPosixTime(obj.schedulerTime); + schedulePosixTime += parseInt(obj.timezoneOffset)*1000; + var date = new Date(); + localRemoteTimeOffset = date.getTime() - schedulePosixTime; } From 2c66c1801e8b3024db4731c74f1edff8e8f6d2bc Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 9 Feb 2011 19:08:27 -0500 Subject: [PATCH 19/21] close button hides add show box. --- .../scripts/schedule/add-show-dialog.phtml | 53 +++++++++---------- public/js/airtime/schedule/add-show.js | 9 ++++ 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/application/views/scripts/schedule/add-show-dialog.phtml b/application/views/scripts/schedule/add-show-dialog.phtml index aba2daf40..b1c44eb1b 100644 --- a/application/views/scripts/schedule/add-show-dialog.phtml +++ b/application/views/scripts/schedule/add-show-dialog.phtml @@ -1,29 +1,28 @@ -
- -
-
-
- -
-
-
- what ?> -
-

When

-
- when ?> - repeats ?> -
-

Who

-
- who ?> -
-

Style

-
- style ?> -
+ +
+
+ +
- +
+
+ what ?> +
+

When

+
+ when ?> + repeats ?> +
+

Who

+
+ who ?> +
+

Style

+
+ style ?> +
+
+ + +
-
-
diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index 8280bd40e..68ea9a2a3 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -116,6 +116,15 @@ function setAddShowEvents() { } }); + + $("#add-show-close") + .button() + .click(function(event){ + event.stopPropagation(); + event.preventDefault(); + $("#add-show-form").hide(); + }); + $("#add-show-submit") .button() .click(function(){ From ea13b32ccff1220046a933a9caf4d560af6180eb Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 19:45:22 -0500 Subject: [PATCH 20/21] -clean up install script a little...removed some errors. --- install/airtime-install.php | 202 ++++++++++-------------------------- install/installInit.php | 3 +- 2 files changed, 53 insertions(+), 152 deletions(-) diff --git a/install/airtime-install.php b/install/airtime-install.php index 83ea99997..833a5ab7c 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -15,40 +15,72 @@ if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) { exit(1); } - require_once(dirname(__FILE__).'/../application/configs/conf.php'); require_once(dirname(__FILE__).'/../application/models/GreenBox.php'); -//require_once(dirname(__FILE__).'/../application/models/cron/Cron.php'); -require_once(dirname(__FILE__)."/installInit.php"); +require_once(dirname(__FILE__).'/installInit.php'); -// Need to check that we are superuser before running this. -if(exec("whoami") != "root"){ - echo "Must be root user.\n"; - exit(1); +function checkIfRoot(){ + // Need to check that we are superuser before running this. + if(exec("whoami") != "root"){ + echo "Must be root user.\n"; + exit(1); + } } // Need to check if build.properties project home is set correctly. +function setBuildPropertiesPath(){ + $property = 'project.home'; + $lines = file('../build/build.properties'); + foreach ($lines as $key => &$line) { + if ($property == substr($line, 0, strlen($property))){ + $line = $property." = ".realpath(__dir__.'/../')."\n"; + } + } -$property = 'project.home'; -$lines = file('../build/build.properties'); -foreach ($lines as $key => &$line) { - if ($property == substr($line, 0, strlen($property))){ - $line = $property." = ".realpath(__dir__.'/../')."\n"; - } + $fp=fopen('../build/build.properties', 'w'); + foreach($lines as $key => $line){ + fwrite($fp, $line); + } + fclose($fp); } -$fp=fopen('../build/build.properties', 'w'); -foreach($lines as $key => $line){ - fwrite($fp, $line); +function directorySetup($CC_CONFIG){ + //------------------------------------------------------------------------ +// Install storage directories +//------------------------------------------------------------------------ +echo " *** Directory Setup ***\n"; + foreach (array('baseFilesDir', 'storageDir') as $d) { + $test = file_exists($CC_CONFIG[$d]); + if ( $test === FALSE ) { + @mkdir($CC_CONFIG[$d], 02775); + if (file_exists($CC_CONFIG[$d])) { + $rp = realpath($CC_CONFIG[$d]); + echo " * Directory $rp created\n"; + } else { + echo " * Failed creating {$CC_CONFIG[$d]}\n"; + exit(1); + } + } elseif (is_writable($CC_CONFIG[$d])) { + $rp = realpath($CC_CONFIG[$d]); + echo " * Skipping directory already exists: $rp\n"; + } else { + $rp = realpath($CC_CONFIG[$d]); + echo " * WARNING: Directory already exists, but is not writable: $rp\n"; + //exit(1); + } + $CC_CONFIG[$d] = $rp; + } } -fclose($fp); - + + + +checkIfRoot(); +setBuildPropertiesPath(); echo "******************************** Install Begin *********************************\n"; echo " *** Database Installation ***\n"; -//sudo -u postgres createuser --no-superuser --no-createdb --no-createrole -A -P myuser // Create the database user $command = "sudo -u postgres psql postgres --command \"CREATE USER {$CC_CONFIG['dsn']['username']} " @@ -86,148 +118,18 @@ if ($langIsInstalled == '0') { echo " * Creating database tables\n"; // Put Propel sql files in Database $command = __DIR__."/../library/propel/generator/bin/propel-gen ../build/ insert-sql 2>propel-error.log"; -//echo $command."\n"; @exec($command, $output, $results); +directorySetup($CC_CONFIG); -//------------------------------------------------------------------------ -// Install default data -//------------------------------------------------------------------------ -echo " *** Inserting Default Users ***\n"; - -// Add the "Station Preferences" group -if (!empty($CC_CONFIG['StationPrefsGr'])) { - if (!Subjects::GetSubjId('scheduler')) { - echo " * Creating group '".$CC_CONFIG['StationPrefsGr']."'..."; - $stPrefGr = Subjects::AddSubj($CC_CONFIG['StationPrefsGr']); - Subjects::AddSubjectToGroup('root', $CC_CONFIG['StationPrefsGr']); - echo "done.\n"; - } else { - echo " * Skipping: group already exists: '".$CC_CONFIG['StationPrefsGr']."'\n"; - } -} - -// Add the root user if it doesnt exist yet. -//$rootUid = Subjects::GetSubjId('root'); -//if (!$rootUid) { -// echo " * Creating user 'root'..."; -// $rootUid = BasicStor::addSubj("root", $CC_CONFIG['tmpRootPass']); - - // Add root user to the admin group - //$r = Subjects::AddSubjectToGroup('root', $CC_CONFIG['AdminsGr']); - //if (PEAR::isError($r)) { - //return $r; - //} -// echo "done.\n"; -//} else { -// echo " * Skipping: user already exists: 'root'\n"; -//} - -// Create the user named 'scheduler'. -if (!Subjects::GetSubjId('scheduler')) { - echo " * Creating user 'scheduler'..."; - $subid = Subjects::AddSubj('scheduler', $CC_CONFIG['schedulerPass']); - $res = Alib::AddPerm($subid, 'read', '0', 'A'); - //$r = Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['AllGr']); - echo "done.\n"; -} else { - echo " * Skipping: user already exists: 'scheduler'\n"; -} - -// Need to add 'scheduler' to group StationPrefs -Subjects::AddSubjectToGroup('scheduler', $CC_CONFIG['StationPrefsGr']); - - -//------------------------------------------------------------------------ -// Install storage directories -//------------------------------------------------------------------------ -echo " *** Directory Setup ***\n"; -foreach (array('baseFilesDir', 'storageDir') as $d) { - $test = file_exists($CC_CONFIG[$d]); - if ( $test === FALSE ) { - @mkdir($CC_CONFIG[$d], 02775); - if (file_exists($CC_CONFIG[$d])) { - $rp = realpath($CC_CONFIG[$d]); - echo " * Directory $rp created\n"; - } else { - echo " * Failed creating {$CC_CONFIG[$d]}\n"; - exit(1); - } - } elseif (is_writable($CC_CONFIG[$d])) { - $rp = realpath($CC_CONFIG[$d]); - echo " * Skipping directory already exists: $rp\n"; - } else { - $rp = realpath($CC_CONFIG[$d]); - echo " * WARNING: Directory already exists, but is not writable: $rp\n"; - //exit(1); - } - $CC_CONFIG[$d] = $rp; -} - -//------------------------------------------------------------------------ -// Storage directory writability test -//------------------------------------------------------------------------ - -//echo " * Testing writability of ".$CC_CONFIG['storageDir']."..."; -//if (!($fp = @fopen($CC_CONFIG['storageDir']."/_writeTest", 'w'))) { -// echo "\nPlease make directory {$CC_CONFIG['storageDir']} writeable by your webserver". -// "\nand run install again\n\n"; -// exit(1); -//} else { -// fclose($fp); -// unlink($CC_CONFIG['storageDir']."/_writeTest"); -//} -//echo "done.\n"; - - -// -// Make sure the Smarty Templates Compiled directory has the right perms -// echo " * Setting dir permissions...\n"; -//install_setDirPermissions($CC_CONFIG["smartyTemplateCompiled"]); install_setDirPermissions($CC_CONFIG["storageDir"]); -//install_setDirPermissions($CC_CONFIG["bufferDir"]); -//install_setDirPermissions($CC_CONFIG["transDir"]); -//install_setDirPermissions($CC_CONFIG["accessDir"]); - - -//------------------------------------------------------------------------ -// Install Cron job -//------------------------------------------------------------------------ -//$m = '*/2'; -//$h ='*'; -//$dom = '*'; -//$mon = '*'; -//$dow = '*'; -//$command = realpath("{$CC_CONFIG['cronDir']}/transportCron.php"); -//$old_regex = '/transportCron\.php/'; -//echo " * Install storageServer cron job...\n"; -// -//$cron = new Cron(); -//$access = $cron->openCrontab('write'); -//if ($access != 'write') { -// do { -// $r = $cron->forceWriteable(); -// } while ($r); -//} -// -//foreach ($cron->ct->getByType(CRON_CMD) as $id => $line) { -// if (preg_match($old_regex, $line['command'])) { -// echo " * Removing old entry: ".$line['command']."\n"; -// $cron->ct->delEntry($id); -// } -//} -//echo " * Adding new entry: ".$command."\n"; -//$cron->ct->addCron($m, $h, $dom, $mon, $dow, $command); -//$cron->closeCrontab(); -//echo " Done.\n"; echo " * Importing sample audio clips \n"; $command = __DIR__."/../utils/airtime-import --copy ../audio_samples/ > /dev/null"; @exec($command, $output, $results); $command = "python ".__DIR__."/../pypo/install/pypo-install.py"; - system($command); echo "******************************* Install Complete *******************************\n"; ?> diff --git a/install/installInit.php b/install/installInit.php index cef850345..525aa6945 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -3,9 +3,8 @@ if (!function_exists('pg_connect')) { trigger_error("PostgreSQL PHP extension required and not found.", E_USER_ERROR); exit(2); } -//require_once('DB.php'); + require_once(dirname(__FILE__).'/../library/pear/DB.php'); -//require_once('File/Find.php'); function camp_db_table_exists($p_name) { From 210a71c21304503841ae968bacbbb6dd4134d893 Mon Sep 17 00:00:00 2001 From: mkonecny Date: Wed, 9 Feb 2011 20:13:30 -0500 Subject: [PATCH 21/21] -bug fixes --- public/js/playlist/nowplayingdatagrid.js | 5 +++-- public/js/playlist/playlist.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/public/js/playlist/nowplayingdatagrid.js b/public/js/playlist/nowplayingdatagrid.js index a558d13a7..da8fb5472 100644 --- a/public/js/playlist/nowplayingdatagrid.js +++ b/public/js/playlist/nowplayingdatagrid.js @@ -108,7 +108,8 @@ function updateDataTable(){ var table = $('#nowplayingtable').dataTable(); table.fnClearTable(false); - table.fnAddData(datagridData.rows); + table.fnAddData(datagridData.rows, false); + table.fnDraw(true); } @@ -143,7 +144,7 @@ $(document).ready(function() { $("#datepicker").datepicker({ onSelect: function(dateText, inst) - { updateData();}}); + { getData();}}); $("#datepicker").datepicker("setDate", new Date()); } else { $('#day_view').click(function(){redirect('/Nowplaying/day-view')}); diff --git a/public/js/playlist/playlist.js b/public/js/playlist/playlist.js index 0c1dd227d..7ba2b689f 100644 --- a/public/js/playlist/playlist.js +++ b/public/js/playlist/playlist.js @@ -77,14 +77,15 @@ function nextShowStart(){ /* Called every "uiUpdateInterval" mseconds. */ function updateProgressBarValue(){ + var showPercentDone = 0; if (currentShow.length > 0){ - var showPercentDone = (estimatedSchedulePosixTime - currentShow[0].showStartPosixTime)/currentShow[0].showLengthMs*100; + showPercentDone = (estimatedSchedulePosixTime - currentShow[0].showStartPosixTime)/currentShow[0].showLengthMs*100; if (showPercentDone < 0 || showPercentDone > 100){ showPercentDone = 0; currentShow = new Array(); } - $('#progress-show').attr("style", "width:"+showPercentDone+"%"); } + $('#progress-show').attr("style", "width:"+showPercentDone+"%"); var songPercentDone = 0; if (currentSong.length > 0){