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:{ Calendar:{
overview:function(){ overview:function(){
if(oc_cal_opendialog == 0){ if($('#choosecalendar_dialog').dialog('isOpen') == true){
$("#dialog_holder").load(oc_webroot + "/apps/calendar/ajax/choosecalendar.php"); $('#choosecalendar_dialog').dialog('moveToTop');
oc_cal_opendialog = 1;
}else{ }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) activation:function(checkbox, calendarid)
@ -802,8 +808,6 @@ $(document).ready(function(){
//event vars //event vars
Calendar.UI.loadEvents(); Calendar.UI.loadEvents();
var oc_cal_opendialog = 0;
function validate_event_form(url){ function validate_event_form(url){
var post = $( "#event_form" ).serialize(); var post = $( "#event_form" ).serialize();
$("#errorbox").html(""); $("#errorbox").html("");

View File

@ -23,17 +23,6 @@ for($i = 0; $i < count($option_calendars); $i++){
</table> </table>
<script type="text/javascript"> <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'; ?>"; 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){ function showcaldavurl(username, calname){
document.getElementById("caldav_url").value = totalurl + "/" + username + "/" + calname; document.getElementById("caldav_url").value = totalurl + "/" + username + "/" + calname;
document.getElementById("caldav_url").style.display = "block"; document.getElementById("caldav_url").style.display = "block";