diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css index f1bd0f9a9c..e28bedb667 100644 --- a/apps/calendar/css/style.css +++ b/apps/calendar/css/style.css @@ -45,6 +45,7 @@ .weekend_thead, .weekend_row{height: 20px;text-align: center;text-align: center;background: #F3F3F3;} .thisday{background: #FFFABC;} .event {position:relative;} +.event.colored {border-bottom: 1px solid white;} .popup {display: none; position: absolute; z-index: 1000; background: #eeeeee; color: #000000; border: 1px solid #1a1a1a; font-size: 90%;} .event_popup {width: 280px; height: 40px; padding: 10px;} diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 1b34545291..f9393acdc1 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -178,18 +178,19 @@ Calendar={ if( typeof (this.events[year]) == "undefined") { this.events[year] = [] } - $.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + year, function(newevents, status) { + $.getJSON(oc_webroot + "/apps/calendar/ajax/getcal.php?year=" + year, function(jsondata, status) { if(status == "nosession") { alert("You are not logged in. That can happen if you don't use owncloud for a long time."); document.location(oc_webroot); } - if(status == "parsingfail" || typeof (newevents) == "undefined") { + if(status == "parsingfail" || typeof (jsondata) == "undefined") { $.ready(function() { $( "#parsingfail_dialog" ).dialog(); }); } else { - if (typeof(newevents[year]) != 'undefined'){ - Calendar.UI.events[year] = newevents[year]; + if (typeof(jsondata[year]) != 'undefined'){ + Calendar.UI.calendars = jsondata['calendars']; + Calendar.UI.events[year] = jsondata[year]; } $(document).ready(function() { Calendar.UI.updateView(); @@ -245,6 +246,11 @@ Calendar={ .hover(this.createEventPopup, this.hideEventPopup) .click(this.editEvent); + var color = this.calendars[event['calendarid']]['color']; + if (color){ + event_holder.css('background-color', color) + .addClass('colored'); + } eventcontainer.append(event_holder); }, startEventDialog:function(){ diff --git a/apps/calendar/templates/part.getcal.php b/apps/calendar/templates/part.getcal.php index 900a43b3df..af29a3e369 100644 --- a/apps/calendar/templates/part.getcal.php +++ b/apps/calendar/templates/part.getcal.php @@ -8,12 +8,16 @@ $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser(), 1); $events = array(); +$return = array('calendars'=>array()); foreach($calendars as $calendar) { $tmp = OC_Calendar_Object::all($calendar['id']); $events = array_merge($events, $tmp); + $return['calendars'][$calendar['id']] = array( + 'displayname' => $calendar['displayname'], + 'color' => $calendar['calendarcolor'] + ); } $select_year = $_GET["year"]; -$return_events = array(); $user_timezone = OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone", "Europe/London"); foreach($events as $event) { @@ -44,14 +48,14 @@ foreach($events as $event) { $return_event['allday'] = true; } - if (isset($return_events[$year][$month][$day][$hour])) + if (isset($return[$year][$month][$day][$hour])) { - $return_events[$year][$month][$day][$hour][] = $return_event; + $return[$year][$month][$day][$hour][] = $return_event; } else { - $return_events[$year][$month][$day][$hour] = array(1 => $return_event); + $return[$year][$month][$day][$hour] = array(1 => $return_event); } } -OC_JSON::encodedPrint($return_events); +OC_JSON::encodedPrint($return); ?>