Handle multi open of choosecalendar dialog

This commit is contained in:
Bart Visscher 2011-09-16 14:11:22 +02:00
parent 0fde26c86c
commit 73d3dc91fd
2 changed files with 10 additions and 17 deletions

View 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("");

View 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";