2011-08-11 13:22:07 +04:00
|
|
|
<?php
|
2011-09-24 00:59:24 +04:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2012-04-17 21:31:29 +04:00
|
|
|
|
2012-05-02 00:59:38 +04:00
|
|
|
OCP\User::checkLoggedIn();
|
2011-10-01 01:05:10 +04:00
|
|
|
OC_Util::checkAppEnabled('calendar');
|
2012-03-01 23:51:59 +04:00
|
|
|
|
2011-08-22 18:59:16 +04:00
|
|
|
// Create default calendar ...
|
2012-05-01 20:50:31 +04:00
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
|
2011-08-22 18:59:16 +04:00
|
|
|
if( count($calendars) == 0){
|
2012-05-01 20:50:31 +04:00
|
|
|
OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar');
|
|
|
|
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
|
2011-08-22 18:59:16 +04:00
|
|
|
}
|
2012-03-01 23:51:59 +04:00
|
|
|
|
2011-10-17 21:58:56 +04:00
|
|
|
$eventSources = array();
|
|
|
|
foreach($calendars as $calendar){
|
2011-10-19 21:07:56 +04:00
|
|
|
$eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
|
2011-10-17 21:58:56 +04:00
|
|
|
}
|
2012-03-03 18:06:51 +04:00
|
|
|
|
2012-04-23 22:13:55 +04:00
|
|
|
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true');
|
|
|
|
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
|
2012-03-03 18:06:51 +04:00
|
|
|
|
2012-03-01 23:51:59 +04:00
|
|
|
OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
|
2012-04-13 01:06:45 +04:00
|
|
|
$categories = OC_Calendar_App::getCategoryOptions();
|
2012-03-01 23:51:59 +04:00
|
|
|
|
2011-10-21 20:19:44 +04:00
|
|
|
//Fix currentview for fullcalendar
|
2012-05-01 20:50:31 +04:00
|
|
|
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
|
|
|
|
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
|
2011-10-21 20:19:44 +04:00
|
|
|
}
|
2012-05-01 20:50:31 +04:00
|
|
|
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
|
|
|
|
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month");
|
2011-10-21 20:19:44 +04:00
|
|
|
}
|
2012-05-01 20:50:31 +04:00
|
|
|
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
|
|
|
|
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list");
|
2011-10-21 20:19:44 +04:00
|
|
|
}
|
|
|
|
|
2012-05-01 22:03:41 +04:00
|
|
|
OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar');
|
2012-05-01 11:49:22 +04:00
|
|
|
OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
|
2012-05-01 22:03:41 +04:00
|
|
|
OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker');
|
2012-05-01 11:49:22 +04:00
|
|
|
OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker');
|
2012-05-01 20:50:31 +04:00
|
|
|
if(OC_Preferences::getValue(OCP\USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){
|
2012-05-01 22:03:41 +04:00
|
|
|
OCP\Util::addscript('calendar', 'geo');
|
2011-11-11 18:51:44 +04:00
|
|
|
}
|
2012-05-01 22:03:41 +04:00
|
|
|
OCP\Util::addscript('calendar', 'calendar');
|
2012-05-01 11:49:22 +04:00
|
|
|
OCP\Util::addStyle('calendar', 'style');
|
2012-05-01 22:03:41 +04:00
|
|
|
OCP\Util::addscript('', 'jquery.multiselect');
|
2012-05-01 11:49:22 +04:00
|
|
|
OCP\Util::addStyle('', 'jquery.multiselect');
|
2012-05-01 22:03:41 +04:00
|
|
|
OCP\Util::addscript('contacts','jquery.multi-autocomplete');
|
|
|
|
OCP\Util::addscript('','oc-vcategories');
|
2012-05-02 02:50:26 +04:00
|
|
|
OCP\App::setActiveNavigationEntry('calendar_index');
|
2011-10-17 21:58:56 +04:00
|
|
|
$tmpl = new OC_Template('calendar', 'calendar', 'user');
|
|
|
|
$tmpl->assign('eventSources', $eventSources);
|
2012-04-13 01:06:45 +04:00
|
|
|
$tmpl->assign('categories', $categories);
|
2012-01-06 17:36:24 +04:00
|
|
|
if(array_key_exists('showevent', $_GET)){
|
|
|
|
$tmpl->assign('showevent', $_GET['showevent']);
|
|
|
|
}
|
2011-10-17 21:58:56 +04:00
|
|
|
$tmpl->printPage();
|