Color event background with calendar color

This commit is contained in:
Bart Visscher 2011-09-28 23:16:32 +02:00
parent 45c983e899
commit 3f7d964acd
3 changed files with 20 additions and 9 deletions

View File

@ -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;}

View File

@ -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(){

View File

@ -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);
?>