diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-09-29 01:16:32 +0400 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-09-29 01:17:25 +0400 |
commit | 3f7d964acd5c83d62f91599ca95db55bdbbd8e69 (patch) | |
tree | d64cab59e365c0169368ae849fa4d4d2043a1d03 /apps | |
parent | 45c983e899388d78bf9b9087aa40f894ca8cf74e (diff) |
Color event background with calendar color
Diffstat (limited to 'apps')
-rw-r--r-- | apps/calendar/css/style.css | 1 | ||||
-rw-r--r-- | apps/calendar/js/calendar.js | 14 | ||||
-rw-r--r-- | apps/calendar/templates/part.getcal.php | 14 |
3 files changed, 20 insertions, 9 deletions
diff --git a/apps/calendar/css/style.css b/apps/calendar/css/style.css index f1bd0f9a9c4..e28bedb6677 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 1b345452912..f9393acdc1a 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 900a43b3df2..af29a3e369c 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); ?> |