CC-4873: Airtime takes 7 seconds to load 32K (very small) from db
-we know what month will be the initial view for the user. -Provide this data ahead of time.
This commit is contained in:
parent
548b73db42
commit
091f5ff49f
|
@ -96,6 +96,22 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
$this->view->preloadShowForm = true;
|
$this->view->preloadShowForm = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||||
|
$user = new Application_Model_User($userInfo->id);
|
||||||
|
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||||
|
$editable = true;
|
||||||
|
} else {
|
||||||
|
$editable = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$calendar_interval = Application_Model_Preference::GetCalendarTimeInterval();
|
||||||
|
if ($calendar_interval == "agendaDay") {
|
||||||
|
} else if ($calendar_interval == "agendaWeek") {
|
||||||
|
} else if ($calendar_interval == "month") {
|
||||||
|
}
|
||||||
|
list($start, $end) = Application_Model_Show::getStartEndCurrentMonthView();
|
||||||
|
$events = &Application_Model_Show::getFullCalendarEvents($start, $end, $editable);
|
||||||
|
|
||||||
$this->view->headScript()->appendScript(
|
$this->view->headScript()->appendScript(
|
||||||
"var calendarPref = {};\n".
|
"var calendarPref = {};\n".
|
||||||
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
"calendarPref.weekStart = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||||
|
@ -103,7 +119,8 @@ class ScheduleController extends Zend_Controller_Action
|
||||||
"calendarPref.timezoneOffset = ".date("Z").";\n".
|
"calendarPref.timezoneOffset = ".date("Z").";\n".
|
||||||
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
|
"calendarPref.timeScale = '".Application_Model_Preference::GetCalendarTimeScale()."';\n".
|
||||||
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
|
"calendarPref.timeInterval = ".Application_Model_Preference::GetCalendarTimeInterval().";\n".
|
||||||
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n"
|
"calendarPref.weekStartDay = ".Application_Model_Preference::GetWeekStartDay().";\n".
|
||||||
|
"var calendarEvents = ".json_encode($events).";"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2176,4 +2176,18 @@ SQL;
|
||||||
}
|
}
|
||||||
return $assocArray;
|
return $assocArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getStartEndCurrentMonthView() {
|
||||||
|
$first_day_of_calendar_month_view = mktime(0, 0, 0, date("n"), 1);
|
||||||
|
$weekStart = Application_Model_Preference::GetWeekStartDay();
|
||||||
|
while (date('w', $first_day_of_calendar_month_view) != $weekStart) {
|
||||||
|
$first_day_of_calendar_month_view -= 60*60*24;
|
||||||
|
}
|
||||||
|
$last_day_of_calendar_view = $first_day_of_calendar_month_view + 3600*24*41;
|
||||||
|
|
||||||
|
$start = new DateTime("@".$first_day_of_calendar_month_view);
|
||||||
|
$end = new DateTime("@".$last_day_of_calendar_view);
|
||||||
|
|
||||||
|
return array($start, $end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -326,19 +326,26 @@ function eventResize( event, dayDelta, minuteDelta, revertFunc, jsEvent, ui, vie
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var initialLoad = true;
|
||||||
function getFullCalendarEvents(start, end, callback) {
|
function getFullCalendarEvents(start, end, callback) {
|
||||||
var url, start_date, end_date;
|
|
||||||
|
|
||||||
start_date = makeTimeStamp(start);
|
|
||||||
end_date = makeTimeStamp(end);
|
|
||||||
|
|
||||||
url = baseUrl+'Schedule/event-feed';
|
|
||||||
|
|
||||||
var d = new Date();
|
|
||||||
|
|
||||||
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
|
if (initialLoad) {
|
||||||
callback(json.events);
|
initialLoad = false;
|
||||||
});
|
callback(calendarEvents);
|
||||||
|
} else {
|
||||||
|
var url, start_date, end_date;
|
||||||
|
|
||||||
|
start_date = makeTimeStamp(start);
|
||||||
|
end_date = makeTimeStamp(end);
|
||||||
|
url = baseUrl+'Schedule/event-feed';
|
||||||
|
|
||||||
|
var d = new Date();
|
||||||
|
$.post(url, {format: "json", start: start_date, end: end_date, cachep: d.getTime()}, function(json){
|
||||||
|
callback(json.events);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//TODO: Look at the type of calendar view...we may be returning too much information
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkSCUploadStatus(){
|
function checkSCUploadStatus(){
|
||||||
|
|
Loading…
Reference in New Issue