]> source.dussan.org Git - nextcloud-server.git/commitdiff
Handle multi open of choosecalendar dialog
authorBart Visscher <bartv@thisnet.nl>
Fri, 16 Sep 2011 12:11:22 +0000 (14:11 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 16 Sep 2011 12:11:22 +0000 (14:11 +0200)
apps/calendar/js/calendar.js
apps/calendar/templates/part.choosecalendar.php

index 31277b716be01bcbc0c6080cbe6f154ec97708c3..d18a9573742003d40700e828b7c4459bc199fed5 100644 (file)
@@ -383,11 +383,17 @@ Calendar={
                },
                Calendar:{
                        overview:function(){
-                               if(oc_cal_opendialog == 0){
-                                       $("#dialog_holder").load(oc_webroot + "/apps/calendar/ajax/choosecalendar.php");
-                                       oc_cal_opendialog = 1;
+                               if($('#choosecalendar_dialog').dialog('isOpen') == true){
+                                       $('#choosecalendar_dialog').dialog('moveToTop');
                                }else{
-                                       alert(t("calendar", "You can't open more than one dialog per site!"));
+                                       $('#dialog_holder').load(oc_webroot + '/apps/calendar/ajax/choosecalendar.php', function(){
+                                               $('#choosecalendar_dialog').dialog({
+                                                       width : 600,
+                                                       close : function(event, ui) {
+                                                               $(this).dialog('destroy').remove();
+                                                       }
+                                               });
+                                       });
                                }
                        },
                        activation:function(checkbox, calendarid)
@@ -802,8 +808,6 @@ $(document).ready(function(){
 //event vars
 Calendar.UI.loadEvents();
 
-var oc_cal_opendialog = 0;
-
 function validate_event_form(url){
        var post = $( "#event_form" ).serialize();
        $("#errorbox").html("");
index 4b4cff6f95edf8b8b4c71f2eb3dc8b5c4b05195d..c355907c9957e1b51e2775cbf54ab632686deccd 100644 (file)
@@ -23,17 +23,6 @@ for($i = 0; $i < count($option_calendars); $i++){
 </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'; ?>";
-       $( "#choosecalendar_dialog" ).dialog({
-               width : 600,
-               close : function() {
-                                       oc_cal_opendialog = 0;
-                                       var lastchild = document.getElementById("body-user").lastChild
-                                       while(lastchild.id != "lightbox"){
-                                               document.getElementById("body-user").removeChild(lastchild);
-                                               lastchild = document.getElementById("body-user").lastChild;
-                                       }
-                       }
-       });
        function showcaldavurl(username, calname){
                document.getElementById("caldav_url").value = totalurl + "/" + username + "/" + calname;
                document.getElementById("caldav_url").style.display = "block";