Only create new calendar when there are none. Fix oc-1007.

This commit is contained in:
Thomas Tanghus 2012-06-15 01:55:02 +02:00
parent ad32c20300
commit ad8c4ab182
1 changed files with 4 additions and 2 deletions

View File

@ -11,7 +11,7 @@ OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), false);
if( count($calendars) == 0){
OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(),'Default calendar');
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), true);
@ -19,7 +19,9 @@ if( count($calendars) == 0){
$eventSources = array();
foreach($calendars as $calendar){
$eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
if($calendar['active'] == 1) {
$eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
}
}
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true');