From a1eda425ed8db211a8432ed3a375e641246e067c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 21 Oct 2011 18:19:44 +0200 Subject: [PATCH] added transition function from 'old' calendar to fullcalendar (fixed currentview bug) --- apps/calendar/ajax/changeview.php | 5 ++--- apps/calendar/index.php | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php index b396ff4945b..ef05c7cd496 100644 --- a/apps/calendar/ajax/changeview.php +++ b/apps/calendar/ajax/changeview.php @@ -7,10 +7,9 @@ */ require_once ("../../../lib/base.php"); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $currentview = $_GET["v"]; OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview); +OC_JSON::success(); ?> diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 7150fb8490e..2442d27db49 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -19,6 +19,17 @@ $eventSources = array(); foreach($calendars as $calendar){ $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar); } +//Fix currentview for fullcalendar +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "agendaWeek"); +} +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); +} +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "list"); +} + OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addScript('calendar', 'calendar');