From 548b73db429109d8a25dfb49de274ecc0585d8a8 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 23 Jan 2013 18:31:45 -0500 Subject: [PATCH] CC-4873: Airtime takes 7 seconds to load 32K (very small) from db -remove an unnecessary roundtrip to server --- .../application/controllers/ScheduleController.php | 10 +++++++++- airtime_mvc/public/js/airtime/schedule/add-show.js | 4 ++-- airtime_mvc/public/js/airtime/schedule/schedule.js | 5 +++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index 15dca0621..3348cbbe5 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -96,7 +96,15 @@ class ScheduleController extends Zend_Controller_Action $this->view->preloadShowForm = true; } - $this->view->headScript()->appendScript("var weekStart = ".Application_Model_Preference::GetWeekStartDay().";"); + $this->view->headScript()->appendScript( + "var calendarPref = {};\n". + "calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n". + "calendarPref.timestamp = ".time().";\n". + "calendarPref.timezoneOffset = ".date("Z").";\n". + "calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n". + "calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n". + "calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n" + ); } public function eventFeedAction() diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index 2242f3c66..4f33ccdc7 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -37,7 +37,7 @@ function createDateInput(el, onSelect) { dayNamesMin: i18n_days_short, closeText: $.i18n._('Close'), //showButtonPanel: true, - firstDay: weekStart + firstDay: calendarPref.weekStart }); } @@ -324,7 +324,7 @@ function setAddShowEvents() { dayNamesMin: i18n_days_short, closeText: 'Close', showButtonPanel: true, - firstDay: weekStart + firstDay: calendarPref.weekStart }); form.find('input[name^="add_show_rebroadcast_time"]').timepicker({ amPmText: ['', ''], diff --git a/airtime_mvc/public/js/airtime/schedule/schedule.js b/airtime_mvc/public/js/airtime/schedule/schedule.js index 2de53cdb5..beb1381cd 100644 --- a/airtime_mvc/public/js/airtime/schedule/schedule.js +++ b/airtime_mvc/public/js/airtime/schedule/schedule.js @@ -328,8 +328,9 @@ function alertShowErrorAndReload(){ } $(document).ready(function() { - $.ajax({ url: baseUrl+"Api/calendar-init/format/json", dataType:"json", success:createFullCalendar - , error:function(jqXHR, textStatus, errorThrown){}}); + var data = {}; + data.calendarInit = calendarPref; + createFullCalendar(data); setInterval(checkCalendarSCUploadStatus, 5000);