CC-3174 : Show builder, working on date choice pickers, make sure they accomodate client/server timezones.
This commit is contained in:
parent
424206b9a9
commit
ecaebbeb67
13 changed files with 1715 additions and 996 deletions
|
@ -41,33 +41,34 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/contextmenu/jjmenu.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.pluginAPI.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker-0.0.6.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/colorpicker/js/colorpicker.js','text/javascript');
|
||||
|
||||
//full-calendar-functions.js requires this variable, so that datePicker widget can be offset to server time instead of client time
|
||||
$this->view->headScript()->appendScript("var timezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/full-calendar-functions.js','text/javascript');
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/add-show.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/schedule/schedule.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/meioMask/jquery.meio.mask.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery-ui-timepicker.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/colorpicker/css/colorpicker.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/add-show.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/contextmenu.css');
|
||||
|
||||
|
||||
Application_Model_Schedule::createNewFormSections($this->view);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
$this->view->isAdmin = $user->isAdmin();
|
||||
$this->view->isProgramManager = $user->isUserType('P');
|
||||
|
||||
|
||||
$this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";");
|
||||
}
|
||||
|
||||
|
|
|
@ -7,36 +7,22 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
{
|
||||
$ajaxContext = $this->_helper->getHelper('AjaxContext');
|
||||
$ajaxContext->addActionContext('schedule', 'json')
|
||||
->addActionContext('builder-feed', 'json')
|
||||
->initContext();
|
||||
}
|
||||
|
||||
public function indexAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$this->_helper->layout->setLayout('builder');
|
||||
|
||||
$user_id = $request->getParam("uid", 0);
|
||||
$show_instance_id = $request->getParam("sid", 0);
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript');
|
||||
|
||||
try {
|
||||
$user = new Application_Model_User($user_id);
|
||||
$show_instance = new Application_Model_ShowInstance($show_instance_id);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$this->_helper->redirector('denied', 'error');
|
||||
}
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('builder', 'showbuilder');
|
||||
|
||||
//user is allowed to schedule this show.
|
||||
if ($user->isAdmin() || $user->isHost($show_instance->getShowId())) {
|
||||
$this->_helper->layout->setLayout('builder');
|
||||
|
||||
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript');
|
||||
|
||||
$this->_helper->actionStack('library', 'library');
|
||||
$this->_helper->actionStack('builder', 'showbuilder');
|
||||
}
|
||||
else {
|
||||
$this->_helper->redirector('denied', 'error');
|
||||
}
|
||||
//if ($user->isAdmin() || $user->isHost($show_instance->getShowId())) {
|
||||
//}
|
||||
}
|
||||
|
||||
public function builderAction() {
|
||||
|
@ -44,16 +30,39 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$baseUrl = $request->getBaseUrl();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/fullcalendar/fullcalendar_orig.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/timepicker/jquery.ui.timepicker.js','text/javascript');
|
||||
|
||||
$this->view->headScript()->appendScript("var serverTimezoneOffset = ".date("Z")."; //in seconds");
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/js/jquery.dataTables.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColVis.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/datatables/plugin/dataTables.ColReorderResize.js','text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/showbuilder/builder.js','text/javascript');
|
||||
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/fullcalendar.css');
|
||||
$this->view->headLink()->appendStylesheet($baseUrl.'/css/jquery.ui.timepicker.css');
|
||||
|
||||
$this->_helper->viewRenderer->setResponseSegment('builder');
|
||||
}
|
||||
|
||||
public function eventFeedAction() {
|
||||
public function builderFeedAction() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$current_time = microtime(true);
|
||||
|
||||
$starts_epoch = $request->getParam("start", $current_time);
|
||||
//default ends is 24 hours after starts.
|
||||
$ends_epoch = $request->getParam("end", $current_time + (60*60*24));
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U.u", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U.u", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
$scheduled_items = Application_Model_Schedule::GetItems($startsDT->format("Y-m-d H:i:s.u"), $endsDT->format("Y-m-d H:i:s.u"), false);
|
||||
|
||||
foreach ($scheduled_items as &$item) {
|
||||
$itemStartsDT = DateTime::createFromFormat("Y-m-d H:i:s.u", $item["starts"], new DateTimeZone("UTC"));
|
||||
$itemEndsDT = DateTime::createFromFormat("Y-m-d H:i:s.u", $item["ends"], new DateTimeZone("UTC"));
|
||||
}
|
||||
|
||||
$this->view->schedule = $scheduled_items;
|
||||
}
|
||||
|
||||
public function scheduleAction() {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
<div class="wrapper">
|
||||
<!--Set to z-index 254 to make it lower than the top-panel and the ZFDebug info bar, but higher than the side-playlist-->
|
||||
<div id="library_content" class="tabs ui-widget ui-widget-content block-shadow alpha-block padded" style="z-index:254"><?php echo $this->layout()->library ?></div>
|
||||
<div id="show_builder" class="ui-widget ui-widget-content block-shadow omega-block"><?php echo $this->layout()->builder ?></div>
|
||||
<div id="show_builder" class="ui-widget ui-widget-content block-shadow omega-block padded"><?php echo $this->layout()->builder ?></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -155,7 +155,7 @@ class Application_Model_Schedule {
|
|||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, 1),
|
||||
"timezone"=> date("T"),
|
||||
"timezoneOffset"=> date("Z"));
|
||||
|
||||
|
||||
return $range;
|
||||
}
|
||||
|
||||
|
@ -294,6 +294,38 @@ class Application_Model_Schedule {
|
|||
return $rows;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
* @param DateTime $p_startDateTime
|
||||
*
|
||||
* @param DateTime $p_endDateTime
|
||||
*
|
||||
* @return array $scheduledItems
|
||||
*
|
||||
*/
|
||||
public static function GetScheduleDetailItems($p_startDateTime, $p_endDateTime)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
||||
$sql = "SELECT DISTINCT
|
||||
|
||||
showt.name, showt.color, showt.background_color,
|
||||
si.starts, si.ends, si.time_filled, si.record, si.rebroadcast,
|
||||
sched.starts, sched.ends,
|
||||
ft.track_title, ft.artist_name, ft.album_title, ft.length
|
||||
|
||||
FROM
|
||||
((cc_schedule AS sched JOIN cc_files AS ft ON (sched.file_id = ft.id)
|
||||
RIGHT OUTER JOIN cc_show_instances AS si ON (si.id = sched.instance_id))
|
||||
JOIN cc_show AS showt ON (showt.id = si.show_id)
|
||||
)
|
||||
|
||||
ORDER BY sched.starts;";
|
||||
|
||||
$rows = $CC_DBC->GetAll($sql);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
public static function GetShowInstanceItems($instance_id)
|
||||
{
|
||||
global $CC_CONFIG, $CC_DBC;
|
||||
|
@ -533,7 +565,7 @@ class Application_Model_Schedule {
|
|||
|
||||
public static function createNewFormSections($p_view){
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
|
||||
$formWhat = new Application_Form_AddShowWhat();
|
||||
$formWho = new Application_Form_AddShowWho();
|
||||
$formWhen = new Application_Form_AddShowWhen();
|
||||
|
@ -560,16 +592,16 @@ class Application_Model_Schedule {
|
|||
'add_show_duration' => '1h'));
|
||||
|
||||
$formRepeats->populate(array('add_show_end_date' => date("Y-m-d")));
|
||||
|
||||
|
||||
if(!$isSaas){
|
||||
$formRecord = new Application_Form_AddShowRR();
|
||||
$formAbsoluteRebroadcast = new Application_Form_AddShowAbsoluteRebroadcastDates();
|
||||
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
|
||||
|
||||
|
||||
$formRecord->removeDecorator('DtDdWrapper');
|
||||
$formAbsoluteRebroadcast->removeDecorator('DtDdWrapper');
|
||||
$formRebroadcast->removeDecorator('DtDdWrapper');
|
||||
|
||||
|
||||
$p_view->rr = $formRecord;
|
||||
$p_view->absoluteRebroadcast = $formAbsoluteRebroadcast;
|
||||
$p_view->rebroadcast = $formRebroadcast;
|
||||
|
|
|
@ -1 +1,8 @@
|
|||
<div style="width:800px" id="show_builder"></div>
|
||||
<div style="width:800px" id="show_builder">
|
||||
<input type="text" id="show_builder_datepicker_start" class="input_text"></input>
|
||||
<input type="text" id="show_builder_timepicker_start" class="input_text"></input>
|
||||
<input type="text" id="show_builder_datepicker_end" class="input_text"></input>
|
||||
<input type="text" id="show_builder_timepicker_end" class="input_text"></input>
|
||||
<input type="button" id="show_builder_timerange_button" class="ui-button ui-state-default" value="GO"></input>
|
||||
<table id="show_builder_table" cellpadding="0" cellspacing="0" class="datatable"></table>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue