diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-09-16 17:50:55 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-09-16 17:50:55 +0200 |
commit | 2a84f7f07c58b92b5c2293e0936fd3aec9e8f616 (patch) | |
tree | c83dc53fefb4b21ab5f9c71c4aaafc7ae5829d17 /apps | |
parent | 45d42a96549e8661bb18c5f8d407641d5362240a (diff) | |
download | nextcloud-server-2a84f7f07c58b92b5c2293e0936fd3aec9e8f616.tar.gz nextcloud-server-2a84f7f07c58b92b5c2293e0936fd3aec9e8f616.zip |
Move most javascript to calendar.js
Diffstat (limited to 'apps')
-rw-r--r-- | apps/calendar/js/calendar.js | 48 | ||||
-rw-r--r-- | apps/calendar/templates/calendar.php | 10 | ||||
-rw-r--r-- | apps/calendar/templates/part.choosecalendar.php | 10 | ||||
-rw-r--r-- | apps/calendar/templates/part.choosecalendar.rowfields.php | 2 | ||||
-rw-r--r-- | apps/calendar/templates/part.eventform.php | 9 |
5 files changed, 33 insertions, 46 deletions
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 = "<?php echo $l->t("Weeks");?>"; Calendar.UI.more_before = String('<?php echo $l->t('More before {startdate}') ?>'); Calendar.UI.more_after = String('<?php echo $l->t('More after {enddate}') ?>'); + //use last view as default on the next + Calendar.UI.setCurrentView("<?php echo OC_Preferences::getValue(OC_USER::getUser(), "calendar", "currentview", "onemonthview") ?>"); + var totalurl = "<?php echo OC_Helper::linkTo('calendar', 'caldav.php', null, true) . '/calendars'; ?>"; </script> <div id="sysbox"></div> <div id="controls"> @@ -166,10 +169,3 @@ $weekdays = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'satur <?php echo $l->t("There was a fail, while parsing the file."); ?> </div> <!-- End of Dialogs --> - <script type="text/javascript"> - <?php - //use last view as default on the next - echo "Calendar.UI.setCurrentView(\"" . OC_Preferences::getValue(OC_USER::getUser(), "calendar", "currentview", "onemonthview") . "\");\n"; - - ?> - </script> 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++){ </tr> <tr> <td colspan="4"> - <p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="document.getElementById('caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="../../core/img/actions/delete.svg" alt="close" onclick="document.getElementById('caldav_url').style.display = 'none';document.getElementById('caldav_url_close').style.display = 'none';"/></p> + <p style="margin: 0 auto;width: 90%;"><input style="display:none;width: 90%;float: left;" type="text" id="caldav_url" onmouseover="$('#caldav_url').select();" title="<?php echo $l->t("CalDav Link"); ?>"><img id="caldav_url_close" style="height: 20px;vertical-align: middle;display: none;" src="../../core/img/actions/delete.svg" alt="close" onclick="$('#caldav_url').hide();$('#caldav_url_close').hide();"/></p> </td> </tr> </table> -<script type="text/javascript"> - var totalurl = "<?php echo ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].OC::$WEBROOT.'/apps/calendar/caldav.php/calendars'; ?>"; - function showcaldavurl(username, calname){ - document.getElementById("caldav_url").value = totalurl + "/" + username + "/" + calname; - document.getElementById("caldav_url").style.display = "block"; - document.getElementById("caldav_url_close").style.display = "block"; - } -</script> 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 @@ <?php echo "<td width=\"20px\"><input id=\"active_" . $_['calendar']["id"] . "\" type=\"checkbox\" onClick=\"Calendar.UI.Calendar.activation(this, " . $_['calendar']["id"] . ")\"" . ($_['calendar']["active"] ? ' checked="checked"' : '') . "></td>"; echo "<td><label for=\"active_" . $_['calendar']["id"] . "\">" . $_['calendar']["displayname"] . "</label></td>"; - echo "<td width=\"20px\"><a href=\"#\" onclick=\"showcaldavurl('" . OC_User::getUser() . "', '" . $_['calendar']["uri"] . "');\" title=\"" . $l->t("CalDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?calid=" . $_['calendar']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td>"; + echo "<td width=\"20px\"><a href=\"#\" onclick=\"Calendar.UI.showCalDAVUrl('" . OC_User::getUser() . "', '" . $_['calendar']["uri"] . "');\" title=\"" . $l->t("CalDav Link") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?calid=" . $_['calendar']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Calendar.UI.Calendar.edit(this, " . $_['calendar']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td>"; 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 @@ <td><textarea style="width:350px;height: 150px;" placeholder="<?php echo $l->t("Description of the Event");?>" name="description"><?php echo $_['description'] ?></textarea></td> </tr> </table> -<script type="text/javascript"> - Calendar.UI.lockTime(); - $( "#from" ).datepicker({ - dateFormat : 'dd-mm-yy' - }); - $( "#to" ).datepicker({ - dateFormat : 'dd-mm-yy' - }); -</script> |