You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

206 lines
7.0 KiB

//수정 2014-01-26 김경환: POST 방식으로 변경(option.data 추가처리 위해)
function fn_openDialog(title, url, width, height, fn_callback, options) {
url = url + ( (url.indexOf("?") >= 0) ? "&gbox=d" : "?gbox=d" ) ;
var callerFrameName = self.name
if (!callerFrameName) callerFrameName = "ifr_nm_" + Math.random(); //"nm_detail"
var ifrName = "ifr_nm_" + Math.random(); // ifrmae name
var settings = {
title: title,
autoOpen: false, //true,
width: width,
height: height,
modal: true,
resizable: true
//, autoResize: true //옵션아니라함
//, open: function() {}
, close: function() {
//창닫기 버튼 클릭시 이벤트
//alert("fn_callback"); ////////////////////////////////////////////
//console.log("fn_callback");
//콜백함수
var callback = $(this).dialog("option", 'callback')
var rVal = $(this).dialog("option", 'returnVal')
if (jQuery.isFunction(callback)) callback(rVal); //콜백함수있으면
//자원반납
$(this).attr('src', ""); //iframe의 src 초기화로 링크연결자원 clear!!
//$(this).remove(); //ifrrame 자체 삭제가 더 확실할듯
}
, "callback": fn_callback
, "returnVal": null
, "callerFrameName": callerFrameName
, "calledFrameName": ifrName
}; //setting
$.extend(settings, options);
var horizontalPadding = 3;
var verticalPadding = 3;
//var pop = $('<iframe id="externalSite" name="' + ifrName + '" frameborder="0" scrolling="auto" style="margin:0;" src="' + url + '" />')
var pop = $('<iframe id="externalSite" name="' + ifrName + '" frameborder="0" scrolling="auto" style="margin:0;" />')
.dialog(settings)
.dialog("open")
.width(width - horizontalPadding)
.height(height - verticalPadding)
;
var _frm = $("<form style='display:none;'/>")
.bind("submit", function() {
this.action = url
this.target = ifrName;
this.method = "POST"
})
.appendTo("body");
// if (Boolean(options) && Boolean(options.data)) //POST 데이터가 있으면 : target이 iframd인 form에 post데이터 붙여 submit
// {
// //alert("options");///////////////////////////////////////////
// $.each(options.data, function(i, item) {
// $("<input type='hidden' />").attr({ name: item.key, value: item.val }).appendTo(_frm);
//
// });
// }
_frm.trigger("submit");
$('body').remove(_frm);
//alert("rtn/"+settings.width);//////////////////////////////////////////////
//alert(options.resizable); //////////////////////////////
return pop;
}
function fn_openRefreshDialog(title, url, width, height, fn_callback, options, reurl) {
url = url + ((url.indexOf("?") >= 0) ? "&gbox=d" : "?gbox=d");
var callerFrameName = self.name
if (!callerFrameName) callerFrameName = "ifr_nm_" + Math.random(); //"nm_detail"
var ifrName = "ifr_nm_" + Math.random(); // ifrmae name
var settings = {
title: title,
autoOpen: false, //true,
width: width,
height: height,
modal: true,
resizable: true
//, autoResize: true //옵션아니라함
//, open: function() {}
, close: function() {
//창닫기 버튼 클릭시 이벤트
document.location.href = reurl;
//콜백함수
var callback = $(this).dialog("option", 'callback')
var rVal = $(this).dialog("option", 'returnVal')
if (jQuery.isFunction(callback)) callback(rVal); //콜백함수있으면
//자원반납
$(this).attr('src', ""); //iframe의 src 초기화로 링크연결자원 clear!!
//$(this).remove(); //ifrrame 자체 삭제가 더 확실할듯
}
, "callback": fn_callback
, "returnVal": null
, "callerFrameName": callerFrameName
, "calledFrameName": ifrName
}; //setting
$.extend(settings, options);
var horizontalPadding = 3;
var verticalPadding = 3;
var pop = $('<iframe id="externalSite" name="' + ifrName + '" frameborder="0" scrolling="auto" style="margin:0;" src="' + url + '" />')
.dialog(settings)
.dialog("open")
.width(width - horizontalPadding)
.height(height - verticalPadding)
;
return pop;
}
function fn_closeDialog(calledFrameName, returnVal, callback) {
var ifrm = $("[name='" + calledFrameName + "']")
if (!ifrm.attr('id')) {
return;
}
ifrm.dialog("option", "returnVal", returnVal)
//console.log("fn_closeDialog/returnVal=" + returnVal);
/*
//종료시 호출할 함수가 인자로 넘어온경우
if (jQuery.isFunction(callback)) {
ifrm.dialog("option", "callback", callback)
}*/
ifrm.dialog("close");
ifrm.dialog("destory"); //안해도 될듯
}
//2014-08-07 ZZWEI// 테스트
function t_openDialog(title, url, width, height, fn_callback, options) {
url = url + ((url.indexOf("?") >= 0) ? "&gbox=d" : "?gbox=d");
var callerFrameName = self.name
if (!callerFrameName) callerFrameName = "ifr_nm_" + Math.random(); //"nm_detail"
var ifrName = "ifr_nm_" + Math.random(); // ifrmae name
var settings = {
title: title,
autoOpen: false, //true,
width: width,
height: height,
modal: false,
resizable: false,
position: [100,130]
//, autoResize: true //옵션아니라함
//, open: function() {}
, close: function() {
//창닫기 버튼 클릭시 이벤트
//콜백함수
var callback = $(this).dialog("option", 'callback')
var rVal = $(this).dialog("option", 'returnVal')
if (jQuery.isFunction(callback)) callback(rVal); //콜백함수있으면
//자원반납
$(this).attr('src', ""); //iframe의 src 초기화로 링크연결자원 clear!!
//$(this).remove(); //ifrrame 자체 삭제가 더 확실할듯
}
, "callback": fn_callback
, "returnVal": null
, "callerFrameName": callerFrameName
, "calledFrameName": ifrName
}; //setting
$.extend(settings, options);
var horizontalPadding = 3;
var verticalPadding = 3;
//var pop = $('<iframe id="externalSite" name="' + ifrName + '" frameborder="0" scrolling="auto" style="margin:0;" src="' + url + '" />')
var pop = $('<iframe id="externalSite" name="' + ifrName + '" frameborder="0" scrolling="auto" style="margin:0;" />')
.dialog(settings)
.dialog("open")
.width(width - horizontalPadding)
.height(height - verticalPadding)
;
var _frm = $("<form style='display:none;'/>")
.bind("submit", function() {
this.action = url
this.target = ifrName;
this.method = "POST"
})
.appendTo("body");
if (Boolean(options) && Boolean(options.data)) //POST 데이터가 있으면 : target이 iframd인 form에 post데이터 붙여 submit
{
$.each(options.data, function(i, item) {
$("<input type='hidden' />").attr({ name: item.key, value: item.val }).appendTo(_frm);
});
}
_frm.trigger("submit");
$('body').remove(_frm);
return pop;
}