From: Bart Visscher Date: Fri, 16 Sep 2011 15:50:55 +0000 (+0200) Subject: Move most javascript to calendar.js X-Git-Tag: v3.0~190 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2a84f7f07c58b92b5c2293e0936fd3aec9e8f616;p=nextcloud-server.git Move most javascript to calendar.js --- diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index c0629bab625..77a75c14b2e 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -179,9 +179,12 @@ Calendar={ alert('Unknown view:'+view); break; } - $('#'+this.currentview).show(); - $('#'+this.currentview + "_radio").addClass('active'); - this.updateView(); + $(document).ready(function() { + $('#'+Calendar.UI.currentview).show(); + $('#'+Calendar.UI.currentview + "_radio") + .addClass('active'); + Calendar.UI.updateView() + }); }, updateDate:function(direction){ if(direction == 'forward' && this.current.forward) { @@ -277,6 +280,21 @@ Calendar={ .click(this.editEvent); eventcontainer.append(event_holder); }, + startEventDialog:function(){ + Calendar.UI.lockTime(); + $( "#from" ).datepicker({ + dateFormat : 'dd-mm-yy' + }); + $( "#to" ).datepicker({ + dateFormat : 'dd-mm-yy' + }); + $('#event').dialog({ + width : 500, + close : function(event, ui) { + $(this).dialog('destroy').remove(); + } + }); + }, newEvent:function(selector, time){ var date_info = $(selector).data('date_info'); var dayofmonth = date_info.getDate(); @@ -294,14 +312,7 @@ Calendar={ // TODO: save event $('#event').dialog('destroy').remove(); }else{ - $('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/neweventform.php?d=' + date + '&t=' + time, function(){ - $('#event').dialog({ - width : 500, - close : function(event, ui) { - $(this).dialog('destroy').remove(); - } - }); - }); + $('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/neweventform.php?d=' + date + '&t=' + time, Calendar.UI.startEventDialog); } }, editEvent:function(event){ @@ -312,14 +323,7 @@ Calendar={ // TODO: save event $('#event').dialog('destroy').remove(); }else{ - $('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/editeventform.php?id=' + id, function(){ - $('#event').dialog({ - width : 500, - close : function(event, ui) { - $(this).dialog('destroy').remove(); - } - }); - }); + $('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/editeventform.php?id=' + id, Calendar.UI.startEventDialog); } }, validateEventForm:function(url){ @@ -420,6 +424,11 @@ Calendar={ .removeClass('disabled'); } }, + showCalDAVUrl:function(username, calname){ + $('#caldav_url').val(totalurl + '/' + username + '/' + calname); + $('#caldav_url').show(); + $("#caldav_url_close").show(); + }, Calendar:{ overview:function(){ if($('#choosecalendar_dialog').dialog('isOpen') == true){ @@ -846,4 +855,3 @@ $(document).ready(function(){ }); //event vars Calendar.UI.loadEvents(); - diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index c5717640fb5..dc7bcbc64a5 100644 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -37,6 +37,9 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur Calendar.UI.cws_label = "t("Weeks");?>"; Calendar.UI.more_before = String('t('More before {startdate}') ?>'); Calendar.UI.more_after = String('t('More after {enddate}') ?>'); + //use last view as default on the next + Calendar.UI.setCurrentView(""); + var totalurl = "";
@@ -166,10 +169,3 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur t("There was a fail, while parsing the file."); ?>
- diff --git a/apps/calendar/templates/part.choosecalendar.php b/apps/calendar/templates/part.choosecalendar.php index c355907c995..0081fb08063 100644 --- a/apps/calendar/templates/part.choosecalendar.php +++ b/apps/calendar/templates/part.choosecalendar.php @@ -17,15 +17,7 @@ for($i = 0; $i < count($option_calendars); $i++){ -

">

+

">

- diff --git a/apps/calendar/templates/part.choosecalendar.rowfields.php b/apps/calendar/templates/part.choosecalendar.rowfields.php index ad5daf363f2..6993ad13c36 100644 --- a/apps/calendar/templates/part.choosecalendar.rowfields.php +++ b/apps/calendar/templates/part.choosecalendar.rowfields.php @@ -1,4 +1,4 @@ "; echo ""; - echo "t("CalDav Link") . "\" class=\"action\">t("Download") . "\" class=\"action\">t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\">"; + echo "t("CalDav Link") . "\" class=\"action\">t("Download") . "\" class=\"action\">t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\">"; diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index f80854177d6..c63d709e26e 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -85,12 +85,3 @@ -