Subversion Repositories DevTools

Rev

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

Rev 5506 Rev 5560
Line 67... Line 67...
67
     // Once the dialog has been instantiated the autosize dimensions are known
67
     // Once the dialog has been instantiated the autosize dimensions are known
68
     // and the dialog can be correctly positioned
68
     // and the dialog can be correctly positioned
69
     if (defaults.position == 'center')
69
     if (defaults.position == 'center')
70
     {
70
     {
71
         dd.dialog("widget").center();
71
         dd.dialog("widget").center();
72
         console.log("Center in Window");
72
         //console.log("Center in Window");
73
     }
73
     }
74
     else
74
     else
75
     {
75
     {
76
         dd.dialog("widget").position(defaults.position);
76
         dd.dialog("widget").position(defaults.position);
77
         console.log("Original position");
77
         //console.log("Original position");
78
     }
78
     }
79
     
79
     
80
     // Return false incase this is used as an onClick
80
     // Return false incase this is used as an onClick
81
     return false;
81
     return false;
82
}
82
}
Line 149... Line 149...
149
//--------- Support to open modal dialog in an iFrame
149
//--------- Support to open modal dialog in an iFrame
150
//  Example: <a class="vixIframeDialog" href="aaa.asp" title="Some Title" data-width=500 data-height=300>Link Text</a>
150
//  Example: <a class="vixIframeDialog" href="aaa.asp" title="Some Title" data-width=500 data-height=300>Link Text</a>
151
//
151
//
152
var vixIframe = {};
152
var vixIframe = {};
153
$(document).ready(function () {
153
$(document).ready(function () {
154
    $('.vixIframeDialog').on('click', function (e) {
154
    $('.vixIframeDialog').on('click', function(e){
155
        e.preventDefault();
-
 
156
        vixIframe.parent = this;
155
		vixIframeDialog(e,this)
157
        vixIframe.pagetitle = $(this).attr("title");
-
 
158
        var page = $(this).attr("href");
-
 
159
        var iframe = $('<iframe onload="resizeIframe(this);" id="iframe" style="border:0px; overflow: scroll;" src="' + page + '" width="100%" height="100%" ></iframe>');
-
 
160
        var $dialog = $('<div></div>').html(iframe);
-
 
161
        var $dialog2 = $dialog.dialog({
-
 
162
            autoOpen: true,
-
 
163
            modal: true,
-
 
164
            zheight: $(this).data('height')|| 200,
-
 
165
            zwidth: $(this).data('width') || 300,
-
 
166
            height : 'auto,', width : 'auto',
-
 
167
            dialogClass: "rounded_box",
-
 
168
            title: 'Loading - ' + vixIframe.pagetitle,
-
 
169
            close: function(event, ui){
-
 
170
                //console.log('closing dialog');
-
 
171
                $(this).dialog("destroy");
-
 
172
                vixIframe = {};
-
 
173
                window.onbeforeunload = null;
-
 
174
                window.onunload = null;
-
 
175
 
-
 
176
                },
-
 
177
        });
-
 
178
        vixIframe.Dialog = $dialog;
-
 
179
        vixIframe.DialogWidget = $($dialog2).dialog('widget');
-
 
180
        //$(currentDialogWidget).find(".ui-dialog-titlebar").remove();
-
 
181
        $(vixIframe.DialogWidget).position({my:'top', at: 'top+100', of : window});
-
 
182
        //$dialog.dialog('open');
-
 
183
 
-
 
184
        //  Prevent the user from navigating away from the iframe
-
 
185
 
-
 
186
//      window.onbeforeunload = function(){
-
 
187
//          console.log("confirmBrowseAway");
-
 
188
//          console.log("window.location.href:" + window.location.href);
-
 
189
//          parent.closeIFrame(12);
-
 
190
//          return null};
-
 
191
        window.onunload = function(){
-
 
192
            console.log("Unloading");
-
 
193
            //parent.closeIFrame(12);
-
 
194
        }
-
 
195
 
-
 
196
    });
156
	});
197
 
157
 
198
    //
158
    //
199
    // Prevent (at least control) the user from navigating within the iframe
159
    // Prevent (at least control) the user from navigating within the iframe
200
    // If this invocation is within an iFrame, then close the iFrame if
160
    // If this invocation is within an iFrame, then close the iFrame if
201
    // the user attempt to navigate away from the iFrame.
161
    // the user attempt to navigate away from the iFrame.
202
    //      This means that the iFrame cannot replace itself
162
    //      This means that the iFrame cannot replace itself
203
    // 
163
    // 
204
    if (typeof parent.vixIframe.pagetitle !== 'undefined')
164
    if (typeof parent.vixIframe.pagetitle !== 'undefined')
205
    {
165
    {
206
        console.log("DocumentReady within iframe");
166
        //console.log("DocumentReady within iframe");
207
        //window.onbeforeunload = function(){console.log("onbeforeunload");parent.closeIFrame(13); return null};
-
 
208
        window.onunload = function(){
167
        window.onunload = function(){
209
            console.log("Unloading within iframe");
168
            //console.log("Unloading within iframe");
210
            //parent.closeIFrame(13);
-
 
211
        }
169
        }
212
    }
170
    }
213
 
171
 
214
});
172
});
215
 
173
 
-
 
174
//
-
 
175
//	Callable function to instantiate an Iframe Dialog
-
 
176
//  Need to trigger access from popup menus that cannot be procesed the document ready functions
-
 
177
// 	Parameters:
-
 
178
// 		e       - The event that invoked this call
-
 
179
// 		pthis	- The parent's context
-
 
180
//
-
 
181
function vixIframeDialog(e,pthis) {
-
 
182
	e.preventDefault();
-
 
183
	vixIframe.parent = pthis;
-
 
184
	vixIframe.pagetitle = $(pthis).attr("title");
-
 
185
	if (! vixIframe.pagetitle) {
-
 
186
		vixIframe.pagetitle = $(pthis).text();
-
 
187
	}
-
 
188
	var page = $(pthis).attr("href");
-
 
189
	var iframe = $('<iframe onload="resizeIframe(this);" id="iframe" style="border:0px; overflow: scroll;" src="' + page + '" width="100%" height="100%" ></iframe>');
-
 
190
	var $dialog = $('<div></div>').html(iframe);
-
 
191
	var $dialog2 = $dialog.dialog({
-
 
192
		autoOpen: true,
-
 
193
		modal: true,
-
 
194
		zheight: $(pthis).data('height')|| 200,
-
 
195
		zwidth: $(pthis).data('width') || 300,
-
 
196
		height : 'auto,', width : 'auto',
-
 
197
		position : { my:'top', at: 'top+100', of : window },
-
 
198
		dialogClass: "rounded_box",
-
 
199
		title: 'Loading - ' + vixIframe.pagetitle,
-
 
200
		close: function(event, ui){
-
 
201
			//console.log('closing dialog');
-
 
202
			$(this).dialog("destroy");
-
 
203
			vixIframe = {};
-
 
204
			window.onbeforeunload = null;
-
 
205
			window.onunload = null;
-
 
206
 
-
 
207
			},
-
 
208
	});
-
 
209
	vixIframe.Dialog = $dialog;
-
 
210
	vixIframe.DialogWidget = $($dialog2).dialog('widget');
-
 
211
	return false;
-
 
212
}
-
 
213
 
216
function resizeIframe(iframe) {
214
function resizeIframe(iframe) {
217
    iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
215
    iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
218
    $(vixIframe.Dialog).height(iframe.height);
216
    $(vixIframe.Dialog).height(iframe.height);
219
    //console.log ("Resize Iframe:",iframe.height );
217
    //console.log ("Resize Iframe:",iframe.height );
220
 
218
 
221
    iframe.width = iframe.contentWindow.document.body.scrollWidth;
219
    iframe.width = iframe.contentWindow.document.body.scrollWidth;
222
    $(vixIframe.Dialog).width(iframe.width);
220
    $(vixIframe.Dialog).width(iframe.width);
223
    //console.log ("Resize Iframe:",iframe.width );
221
    //console.log ("Resize Iframe:",iframe.width );
224
 
222
 
225
    $(vixIframe.DialogWidget).position({my:'top', at: 'top+100', of : window});
-
 
226
 
-
 
227
    // New reset the title
223
    // New reset the title
228
    vixIframe.Dialog.dialog('option','title', vixIframe.pagetitle);
224
    vixIframe.Dialog.dialog('option','title', vixIframe.pagetitle);
229
    //console.log("Ifame:", vixIframe)
225
    //console.log("Ifame:", vixIframe)
230
};
226
};
231
 
227