From 6155c758be26c40cb708a51e4107a57ed0149ae2 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 2 Sep 2011 10:14:56 +0200 Subject: Cleanup javascript in calendar template --- apps/calendar/js/calendar.js | 13 +- apps/calendar/templates/calendar.php | 928 +++-------------------------------- 2 files changed, 86 insertions(+), 855 deletions(-) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 265c66a25b0..27da363c6a9 100755 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -164,7 +164,10 @@ Calendar={ if (view == oc_cal_currentview){ return; } + $('#'+oc_cal_currentview).css('display', "none"); + $('#'+oc_cal_currentview + "_radio").css('color', "#000000"); oc_cal_currentview = view; + //sending ajax request on every change view $("#sysbox").load(oc_webroot + "/apps/calendar/ajax/changeview.php?v="+view); //not necessary to check whether the response is true or not switch(view) { @@ -186,6 +189,9 @@ Calendar={ default: break; } + $('#'+oc_cal_currentview).css('display', "block"); + $('#'+oc_cal_currentview + "_radio").css('color', "#0098E4"); + this.updateView(); }, updateDate:function(direction){ if(direction == "forward") { @@ -193,12 +199,14 @@ Calendar={ if(oc_cal_month == 11){ this.loadEvents(oc_cal_year + 1); } + Calendar.UI.updateView(); } if(direction == "backward") { this.current.backward(); if(oc_cal_month == 0){ this.loadEvents(oc_cal_year - 1); } + Calendar.UI.updateView(); } }, loadEvents:function(year){ @@ -262,7 +270,7 @@ Calendar={ Calendar.Date.backward_day(); }, removeEvents:function(){ - $("#onedayview_wholeday").html(""); + $("#onedayview_allday").html(""); for(var i = 0; i <= 23; i++) { $("#onedayview_" + i).html(""); } @@ -287,9 +295,6 @@ Calendar={ Calendar.UI.createEventsForDate([oc_cal_dayofmonth, oc_cal_month, oc_cal_year], 0, 0); }, getEventContainer:function(week, weekday, when){ - if (when == "allday"){ - when = "wholeday"; - } return $("#onedayview_" + when); }, createEventBox:function(day_events, week, weekday, when, eventnumber){ diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index d98c288881a..1e0614700bb 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -1,15 +1,38 @@ + $l->t('All day'), + 0 => '00:00', + 1 => '01:00', + 2 => '02:00', + 3 => '03:00', + 4 => '04:00', + 5 => '05:00', + 6 => '06:00', + 7 => '07:00', + 8 => '08:00', + 9 => '09:00', + 10 => '10:00', + 11 => '11:00', + 12 => '12:00', + 13 => '13:00', + 14 => '14:00', + 15 => '15:00', + 16 => '16:00', + 17 => '17:00', + 18 => '18:00', + 19 => '19:00', + 20 => '20:00', + 21 => '21:00', + 22 => '22:00', + 23 => '23:00', +); +$weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'); +?> @@ -18,24 +41,24 @@
- - - - - + + + + + " id="listview_radio" onclick="Calendar.UI.setCurrentView('listview');"/>
- - + " onclick="oc_cal_switch2today();"/> + " onclick="oc_cal_choosecalendar();" />
- + - +
@@ -50,106 +73,12 @@ + $time_label): ?> - t("All day");?> - - - - 00:00 - - - - 01:00 - - - - 02:00 - - - - 03:00 - - - - 04:00 - - - - 05:00 - - - - 06:00 - - - - 07:00 - - - - 08:00 - - - - 09:00 - - - - 10:00 - - - - 11:00 - - - - 12:00 - - - - 13:00 - - - - 14:00 - - - - 15:00 - - - - 16:00 - - - - 17:00 - - - - 18:00 - - - - 19:00 - - - - 20:00 - - - - 21:00 - - - - 22:00 - - - - 23:00 - + + + @@ -158,266 +87,20 @@ t("Time");?> - - - - - - - + $weekday): ?> + + + $time_label): ?> - t("All day");?> - - - - - - - - - - 00:00 - - - - - - - - - - 01:00 - - - - - - - - - - 02:00 - - - - - - - - - - 03:00 - - - - - - - - - - 04:00 - - - - - - - - - - 05:00 - - - - - - - - - - 06:00 - - - - - - - - - - 07:00 - - - - - - - - - - 08:00 - - - - - - - - - - 09:00 - - - - - - - - - - 10:00 - - - - - - - - - - 11:00 - - - - - - - - - - 12:00 - - - - - - - - - - 13:00 - - - - - - - - - - 14:00 - - - - - - - - - - 15:00 - - - - - - - - - - 16:00 - - - - - - - - - - 17:00 - - - - - - - - - - 18:00 - - - - - - - - - - 19:00 - - - - - - - - - - 20:00 - - - - - - - - - - 21:00 - - - - - - - - - - 22:00 - - - - - - - - - - 23:00 - - - - - - - + + $weekday): ?> + + + @@ -426,196 +109,25 @@ t("CW");?> - t("Monday");?> - t("Tuesday");?> - t("Wednesday");?> - t("Thursday");?> - t("Friday");?> - t("Saturday");?> - t("Sunday");?> + $weekday): ?> + t(ucfirst($weekday)) ?> + - - - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - - - - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
+ + + + $weekday): ?> + +
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - - - - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - - - - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
+
+ +
@@ -623,280 +135,24 @@ - - - - - - - + $weekday): ?> + + - - - - - - - + $weekday): ?> + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
t("Monday");?> t("Tuesday");?> t("Wednesday");?> t("Thursday");?> t("Friday");?> t("Saturday");?> t("Sunday");?>t(ucfirst($weekday));?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ +
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -911,39 +167,9 @@ - -- cgit v1.2.3