Ver Fonte

윈도우팝업 공통 함수 추가

gagamel há 5 anos atrás
pai
commit
17b466b8ff
1 ficheiros alterados com 62 adições e 0 exclusões
  1. 62 0
      src/main/webapp/ux/js/admin.popup.js

+ 62 - 0
src/main/webapp/ux/js/admin.popup.js

@@ -1,3 +1,65 @@
+/*
+ * Popup Java Script
+ * 
+ * 모든 팝업은 공통으로 사용할 수 있기 때문에 여기에 함수를 등록해 처리한다.
+ * 
+ * Copyright (c) 2014 gagamel (exrkorea.com)
+ *
+ * $Date: 2014-06-13$
+ */
+
+/**
+ * @type   : function
+ * @access : public
+ * @desc   : 팝업창 window.open 에서 사용되는 방식으로 features 설정
+ * <pre>
+ *     cfOpenWindowPopup('/popup.do?cmd=getIDPassword', 'popup', 710, 610);
+ *     
+ *     or
+ *     
+ *     cfOpenWindowPopup('/popup.do?cmd=getIDPassword', 'popup', 710, 610, 1, 400, 200, 'no', '');
+ * </pre>
+ * @param  : theURL - 새창의 Url
+ * @param  : winName - 새창의 name
+ * @param  : width	- 넓이
+ * @param  : height - 높이
+ * @param  : center - 위치센터여부 1: 센터 else 임의 0
+ * @param  : left - center 1 이 아닐 경우 세팅
+ * @param  : top - center 1 이 아닐 경우 세팅
+ * @param  : scrollbars - 스크롤 사용여부 'yes' or 'no'
+ * @param  : resizable - 사이즈 조정여부 'yes' or 'no'
+ * @param  : fstate - 새창의 기타 세부 설정
+ * @return : None
+ */
+function cfOpenWindowPopup(theURL, winName, width, height, center, left, top, scrollbars, resizable, fstate) {
+	var features = "width=" + width;
+	features += ",height=" + height;
+
+	var state = "";
+	if (center == undefined) center = 1;
+	if (scrollbars == undefined) scrollbars = 'no';
+	if (fstate == undefined) fstate = '';
+	if (left == undefined) left = 100;
+	if (top == undefined) top = 100;
+	if (resizable == undefined) resizable = 'no';
+		
+	if (center == 1) {
+		if (fstate == "") {
+			state = features + ", left=" + (screen.width-width)/2 + ",top=" + (screen.height-height)/2+",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=0,menubar=0";
+		} else {
+			state = fstate + ", " + features + ", left=" + (screen.width-width)/2 + ",top=" + (screen.height-height)/2+",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=0,menubar=0";
+		}
+	} else {
+		if (fstate == "") {
+			state = features + ", left=" + left + ",top=" + top +",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=0,menubar=0";
+		} else {
+			state = fstate + ", " + features + ", left=" + left + ",top=" + top +",scrollbars=" + scrollbars + ",resizable=" + resizable + ",toolbar=0,menubar=0";
+		}
+	}
+
+	var win = window.open(theURL, winName, state);
+	win.focus();
+}
 
 /**
  * @type   : function