Subversion Repositories DevTools

Rev

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

Rev 5560 Rev 5590
Line 145... Line 145...
145
    this.css("left", Math.max(0, ((w - $(this).outerWidth()) / 2) ) + "px");
145
    this.css("left", Math.max(0, ((w - $(this).outerWidth()) / 2) ) + "px");
146
    return this;
146
    return this;
147
}
147
}
148
 
148
 
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">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
		if (!vixIframe.parent) {
-
 
156
			e.preventDefault();
-
 
157
			vixIframe.parent = this;
-
 
158
			vixIframe.pagetitle = $(this).attr("title");
-
 
159
			if (! vixIframe.pagetitle) {
-
 
160
				vixIframe.pagetitle = $(this).text();
-
 
161
			}
-
 
162
			vixIframe.url = $(this).attr("href");
155
		vixIframeDialog(e,this)
163
			vixIframeDialogCommon();
-
 
164
		}
156
	});
165
	});
157
 
166
 
158
    //
167
    //
159
    // Prevent (at least control) the user from navigating within the iframe
168
    // Prevent (at least control) the user from navigating within the iframe
160
    // If this invocation is within an iFrame, then close the iFrame if
169
    // If this invocation is within an iFrame, then close the iFrame if
Line 171... Line 180...
171
 
180
 
172
});
181
});
173
 
182
 
174
//
183
//
175
//	Callable function to instantiate an Iframe Dialog
184
//	Callable function to instantiate an Iframe Dialog
176
//  Need to trigger access from popup menus that cannot be procesed the document ready functions
185
//  Used in a replacement for MM_openBrWindow called MM_openVixIFrame
177
// 	Parameters:
186
// 	Parameters:
178
// 		e       - The event that invoked this call
-
 
179
// 		pthis	- The parent's context
187
// 		pthis	- The parent's context
-
 
188
//		url		- URL of the windoe content
-
 
189
//  	winName	- Title of the new Window
180
//
190
 
181
function vixIframeDialog(e,pthis) {
191
function vixIframeDialog2(pthis, url, winName)
182
	e.preventDefault();
-
 
-
 
192
{
183
	vixIframe.parent = pthis;
193
	vixIframe.parent = pthis;
184
	vixIframe.pagetitle = $(pthis).attr("title");
194
	vixIframe.pagetitle = winName;
185
	if (! vixIframe.pagetitle) {
195
	vixIframe.url = url;
186
		vixIframe.pagetitle = $(pthis).text();
196
	vixIframeDialogCommon();
187
	}
197
}
-
 
198
 
188
	var page = $(pthis).attr("href");
199
function vixIframeDialogCommon()
-
 
200
{
189
	var iframe = $('<iframe onload="resizeIframe(this);" id="iframe" style="border:0px; overflow: scroll;" src="' + page + '" width="100%" height="100%" ></iframe>');
201
	var iframe = $('<iframe onload="IframeLoaded(this);" id="iframe" style="border:0px; overflow: scroll;" src="' + vixIframe.url + '" width="100%" height="100%" ></iframe>');
190
	var $dialog = $('<div></div>').html(iframe);
202
	var $dialog = $('<div></div>').html(iframe);
191
	var $dialog2 = $dialog.dialog({
203
	var $dialog2 = $dialog.dialog({
192
		autoOpen: true,
204
		autoOpen: true,
193
		modal: true,
205
		modal: true,
194
		zheight: $(pthis).data('height')|| 200,
206
		height : 'auto,', 
195
		zwidth: $(pthis).data('width') || 300,
207
		width : 'auto',
-
 
208
		resizable: false,
196
		height : 'auto,', width : 'auto',
209
		//show: { effect: "blind", duration: 800 },
197
		position : { my:'top', at: 'top+100', of : window },
210
		position : { my:'top', at: 'top+100', of : window },
198
		dialogClass: "rounded_box",
211
		dialogClass: "rounded_box",
199
		title: 'Loading - ' + vixIframe.pagetitle,
212
		title: 'Loading - ' + vixIframe.pagetitle,
200
		close: function(event, ui){
213
		close: function(event, ui){
201
			//console.log('closing dialog');
214
			//console.log('closing dialog');
202
			$(this).dialog("destroy");
215
			$(this).dialog("destroy");
203
			vixIframe = {};
216
			vixIframe = {};
204
			window.onbeforeunload = null;
217
			window.onbeforeunload = null;
205
			window.onunload = null;
218
			window.onunload = null;
206
 
-
 
207
			},
219
			},
-
 
220
		// Prevent Chrome from adding scrollbars when dragged
-
 
221
		dragStop: function( event, ui ){
-
 
222
			vixIframe.IFrame.parentElement.style.overflow = "";
-
 
223
			},
-
 
224
		dragStart: function( event, ui ){
-
 
225
			vixIframe.IFrame.parentElement.style.overflow = "hidden";
-
 
226
			}
208
	});
227
	});
209
	vixIframe.Dialog = $dialog;
228
	vixIframe.Dialog = $dialog;
-
 
229
	vixIframe.DialogProps = $dialog2;
210
	vixIframe.DialogWidget = $($dialog2).dialog('widget');
230
	vixIframe.DialogWidget = $($dialog2).dialog('widget');
-
 
231
//	$('body').css('cursor', 'wait');
211
	return false;
232
	return false;
212
}
233
}
-
 
234
//
-
 
235
//	Called when the iframe is loaded or reloaded
-
 
236
//
-
 
237
function IframeLoaded(iframe) {
-
 
238
	// Save to resize iframe
-
 
239
	vixIframe.IFrame = iframe;
-
 
240
 
-
 
241
	// Reset the title
-
 
242
	vixIframe.Dialog.dialog('option','title', vixIframe.pagetitle);
-
 
243
//	vixIframe.Dialog.dialog('open');
-
 
244
//	$('body').css('cursor', 'auto');
213
 
245
 
214
function resizeIframe(iframe) {
-
 
215
    iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
-
 
216
    $(vixIframe.Dialog).height(iframe.height);
-
 
217
    //console.log ("Resize Iframe:",iframe.height );
-
 
218
 
-
 
219
    iframe.width = iframe.contentWindow.document.body.scrollWidth;
-
 
220
    $(vixIframe.Dialog).width(iframe.width);
-
 
221
    //console.log ("Resize Iframe:",iframe.width );
-
 
222
 
-
 
223
    // New reset the title
246
	// Resize the frame
224
    vixIframe.Dialog.dialog('option','title', vixIframe.pagetitle);
-
 
225
    //console.log("Ifame:", vixIframe)
247
	resizeIframe();
226
};
248
};
-
 
249
//
-
 
250
//	This function can be called from within the iframe to have it resized
-
 
251
//	Used if the iframe is too dynamic and extends itself from time to time
-
 
252
//
-
 
253
function resizeIframe()
-
 
254
{
-
 
255
    if (vixIframe.IFrame != null) {
-
 
256
		iframe.height = iframe.contentWindow.document.body.scrollHeight + "px";
-
 
257
		$(vixIframe.Dialog).height(iframe.height);
-
 
258
		//console.log ("Resize Iframe:",iframe.height );
-
 
259
 
-
 
260
		iframe.width = iframe.contentWindow.document.body.scrollWidth + "px";
-
 
261
		$(vixIframe.Dialog).width(iframe.width);
-
 
262
		//console.log ("Resize Iframe:",iframe.width );
227
 
263
 
-
 
264
		// Reposition the dialog
-
 
265
		$(vixIframe.DialogWidget).position($(vixIframe.DialogProps).dialog("option").position);
-
 
266
	}
-
 
267
}
-
 
268
//
-
 
269
//	This function can be called from with the iframe to close the Iframe
-
 
270
//	Often wired up to the cancel button
228
function closeIFrame(aa)
271
function closeIFrame()
229
{
272
{
230
    if (vixIframe.Dialog != null) {
273
    if (vixIframe.Dialog != null) {
231
        console.log('closing iframe:' + aa);
274
        //console.log('closing iframe');
232
        vixIframe.Dialog.dialog('close');
275
        vixIframe.Dialog.dialog('close');
233
        vixIframe = {};
276
        vixIframe = {};
234
    }
277
    }
235
}
278
}
236
 
279