Subversion Repositories DevTools

Rev

Rev 7003 | Rev 7240 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7003 Rev 7022
Line 321... Line 321...
321
    }
321
    }
322
}
322
}
323
 
323
 
324
//  Load a dialog into a dialog element
324
//  Load a dialog into a dialog element
325
//  Like iFrame, but without the iFrame
325
//  Like iFrame, but without the iFrame
-
 
326
//  Useful options:
-
 
327
//      title   - Window Title
-
 
328
//      onLoad  - Function name to call after load
-
 
329
//      class   - Optional class to add to the dialog
326
//
330
//
327
function vixDialog( theURL, winName ) {
331
function vixDialog( theURL, usrOptions ) {
-
 
332
 
-
 
333
    var options = $.extend({title : 'Dialog '}, usrOptions,);
-
 
334
 
328
	vixIframe.parent = this;
335
	vixIframe.parent = this;
329
	vixIframe.pagetitle = winName;
336
	vixIframe.pagetitle = options.title;
330
	vixIframe.url = theURL;
337
	vixIframe.url = theURL;
331
 
338
 
332
    var $dialog = $('<div></div>');
339
    var $dialog = $('<div></div>');
333
    $(document.body).append($dialog);
340
    $(document.body).append($dialog);
334
    $dialog.load( theURL, function(){
341
    $dialog.load( theURL, function(){
Line 337... Line 344...
337
            modal: true,
344
            modal: true,
338
            height : 'auto', 
345
            height : 'auto', 
339
            //width : 'auto',
346
            //width : 'auto',
340
            resizable: true,
347
            resizable: true,
341
            position : { my:'top', at: 'top+100', of : window },
348
            position : { my:'top', at: 'top+100', of : window },
342
            dialogClass: "rounded_box",
349
            dialogClass: options.class,
-
 
350
            minHeight: 10,
343
            title: 'Loading - ' + vixIframe.pagetitle,
351
            title: 'Loading - ' + vixIframe.pagetitle,
344
            close: function(event, ui){
352
            close: function(event, ui){
345
                //console.log('closing dialog');
353
                //console.log('closing dialog');
346
                $(this).dialog("destroy");
354
                $(this).dialog("destroy");
347
                vixIframe = {};
355
                vixIframe = {};
348
                $(this).remove();
356
                $(this).remove();
349
                window.onbeforeunload = null;
357
                window.onbeforeunload = null;
350
                window.onunload = null;
358
                window.onunload = null;
351
                },
359
                },
352
            // Prevent Chrome from adding scrollbars when dragged
-
 
353
            dragStop: function( event, ui ){
360
            dragStop: function( event, ui ){
-
 
361
                // Dragging adds a height which kill autosizing
354
                vixIframe.IFrame.parentElement.style.overflow = "";
362
                vixIframe.Dialog.closest('.ui-dialog').height('auto');
355
                },
363
                },
356
            dragStart: function( event, ui ){
-
 
357
                vixIframe.IFrame.parentElement.style.overflow = "hidden";
-
 
358
                }
-
 
359
        });
364
        });
360
        vixIframe.Dialog = $dialog;
365
        vixIframe.Dialog = $dialog;
361
        vixIframe.DialogProps = $dialog2;
366
        vixIframe.DialogProps = $dialog2;
362
        //vixIframe.DialogWidget = $($dialog2).dialog('widget');
-
 
363
        //IframeLoaded($dialog);
-
 
364
 
367
 
365
        // Save to resize iframe
368
        // Save to resize iframe
366
        vixIframe.IFrame = $dialog;
369
        vixIframe.IFrame = $dialog;
367
 
370
 
368
        // Reset the title
371
        // Reset the title
369
        vixIframe.Dialog.dialog('option','title', vixIframe.pagetitle);
372
        vixIframe.Dialog.dialog('option','title', vixIframe.pagetitle);
370
 
373
 
371
        // Run init code for the frame
374
        // Run init code for the frame
-
 
375
        // Have a possible function name
-
 
376
        if ( options.onLoad ) {
-
 
377
            try {
-
 
378
                eval (options.onLoad + '();');
-
 
379
            } 
372
        vixFrameInit();
380
            catch (e) {
-
 
381
                console.log ("vixDialog failed to run the onLoad script:" + options.onLoad );
-
 
382
            }
373
 
383
        }
374
    });
384
    });
375
}
385
}
376
 
386
 
377
//
387
//
378
//  Copy the HTML from an element into the clipboard
388
//  Copy the HTML from an element into the clipboard