]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move most javascript to calendar.js
authorBart Visscher <bartv@thisnet.nl>
Fri, 16 Sep 2011 15:50:55 +0000 (17:50 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 16 Sep 2011 15:50:55 +0000 (17:50 +0200)
apps/calendar/js/calendar.js
apps/calendar/templates/calendar.php
apps/calendar/templates/part.choosecalendar.php
apps/calendar/templates/part.choosecalendar.rowfields.php
apps/calendar/templates/part.eventform.php

index c0629bab6258f4d609e3ae3508e4016d12a2ab22..77a75c14b2e937e9081432c1bf24f9a882a72dce 100644 (file)
@@ -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();
-
index c5717640fb5efa8d8249813c069abaeed1609000..dc7bcbc64a5fb7c76d377f5e4acffcdd0b7174bd 100644 (file)
@@ -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>
index c355907c9957e1b51e2775cbf54ab632686deccd..0081fb080632fa2ef6ca8816fa76688c8203b342 100644 (file)
@@ -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>
index ad5daf363f24d03a3a587f705d579b44aeda10b9..6993ad13c365d6e732bea69958e1a2aed4ec429c 100644 (file)
@@ -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>";
index f80854177d6044236d66652b038150888e66bd6f..c63d709e26e271b5c88039bf958d5e2a2b92f534 100644 (file)
                        <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>