123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449 |
- /**
- * 브라우저의 window 객체를 확장한다.
- *
- * @author 김지환
- * @since TrustForm Soonsu 0.0.1
- */
- window.bParsed = false;
- window.bDragDrop = false;
- window.unlock = false;
- if (is_ie && window == window.top)window.eval("var parent;");
-
- function XFormsWindow ()
- {
- };
- XFormsWindow.getCurrentEvent = function ()
- {
- return window.m_event;
- };
- XFormsWindow.dummyEvent = function ()
- {
- window.alert("dummy");
- };
- XFormsWindow.onProcessEvent = function (e, strEventName, strId)
- {
- if (!window.bParsed)
- {
- return;
- }
- if (m_event.name == "onfocus")
- {
- return;
- }
- if (null == strEventName && null == strId)
- {
- strEventName = XFormsWindow.getEventName(e);
- strId = "body";
- }
-
- window.initEvent(e, strId);
-
- var strEvent =strEventName;// XFormsWindow.getEventName(e);
- var objControl = document.allElement.item(strId);
- if (null != objControl)
- {
- if (null != objControl.vscroll)
- {
- objControl.vscroll.refresh();
- objControl.hscroll.refresh();
- }
- objControl.dispatch(strEvent, window.m_event);
-
- // 스마트 폰 브라우저에서 그리드를 위한 Body Scroll 처리
- if (is_smartphone && "onscroll" == strEvent && objControl instanceof XHtmlBody)
- {
- var arKeyset = document.allElement.keys();
- for (var i=0; i<arKeyset.length; i++)
- {
- var strChildId = arKeyset[i];
- var objChildControl = document.allElement.item(strChildId);
- if (null != objChildControl && objChildControl instanceof XFormsDataGrid)
- {
- objChildControl.moveGridExpansion();
- }
- else if (null != objChildControl && objChildControl instanceof XFormsTreeView)
- {
- objChildControl.moveTreeViewExpansion();
- }
- else if ("xforms:group" == objChildControl.elementName)
- {
- objChildControl.moveGroupExpansion();
- }
- }
- }
- }
- };
- XFormsWindow.onResize = function (e)
- {
- if (!window.bParsed)
- {
- return;
- }
-
- window.initEvent(e, "body");
- var arKeyset = document.allElement.keys();
- for (var i=0; i<arKeyset.length; i++)
- {
- var strId = arKeyset[i];
- var objControl = document.allElement.item(strId);
- if (null != objControl && (objControl instanceof XFormsLine || objControl instanceof XFormsShape || objControl instanceof XFormsDataGrid))
- {
- // TODO redraw
- objControl.resize();
- }
- }
-
- //XFormsDocument.widnowSizeCapture();
- body.dispatch("onwindowresize", window.m_event);
- };
- XFormsWindow.onProcessMouseEvent = function (e)
- {
- if (!window.bParsed || null != window.m_objModal)
- {
- return;
- }
- var strEvent = XFormsWindow.getEventName(e);
-
- var heEventTarget;
- if (is_ie)
- {
- heEventTarget = e.srcElement;
- }
- else
- {
- heEventTarget = e.target;
- }
-
- var objElement = XFormsWindow.findEventElement(heEventTarget);
- if (null != objElement)
- {
- // Context Menu는 제외한다.
- if (objElement instanceof XFormsContextMenu)
- {
- return;
- }
- var strId = objElement.getId();
- window.initEvent(e, strId);
-
- if ("onmousedown" == strEvent)
- {
- try
- {
- if (null != window.opener)
- {
- if (null != window.opener.m_objModal && window != window.opener)
- {
- window.opener.m_objModal = window;
- }
- }
- }
- catch (e)
- {
- // pass시키기
- }
- // NavIndex 초기화
- }
-
- objElement.dispatch(strEvent, window.m_event);
- }
- };
- XFormsWindow.onProcessFocusedEvent = function (e)
- {
- if (!window.bParsed)
- {
- return;
- }
-
- var strEvent = XFormsWindow.getEventName(e);
-
- var strFocusId = window.m_event.focus;
- if (null != strFocusId && !strFocusId.isEmpty())
- {
- window.initEvent(e, strFocusId);
- var objFocused = document.allElement.item(strFocusId);
-
- if (objFocused instanceof XFormsCell)
- {
- objFocused = objFocused.getElement();
- }
-
- if (null != objFocused)
- {
- objFocused.dispatch(strEvent, window.m_event);
- }
- }
- };
- XFormsWindow.getEventName = function (e)
- {
- switch (e.type)
- {
- // MouseEvent
- case "mousedown" : return "onmousedown";
- case "mousemove" : return "onmousemove";
- case "mouseup" : return "onmouseup";
- case "dblclick" : return "ondblclick";
-
- // KeyEvent
- case "keydown" : return "onkeydown";
- case "keypress" : return "onkeypress";
- case "keyup" : return "onkeyup";
-
- case "mousewheel" : return "onmousewheel";
- case "DOMMouseScroll" : return "onmousewheel";
-
- // scroll
- case "scroll" : return "onscroll";
-
- // Drag & Drop
- // dragstart
- case "dragstart" : return "ondragstart"; // IE, Chrome, Safari, FireFox from 3.5
- case "draggesture" : return "ondragstart"; // Firefox earlier than version 3.5
-
- // dragenter
- case "dragenter" : return "ondragenter"; // IE, Chrome, Safari, FireFox
-
- // dragover
- case "dragover" : return "ondragover"; // IE, Chrome, Safari, FireFox
-
- // dragleave
- case "dragleave" : return "ondragleave"; // IE, Chrome, Safari, FireFox from 3.5
- case "dragexit" : return "ondragleave"; // Firefox earlier than version 3.5
-
- // drop
- case "drop" : return "ondrop"; // IE, Chrome, Safari, FireFox from 3.5
- case "dragdrop" : return "ondrop"; // Firefox earlier than version 3.5
-
- }
- };
- XFormsWindow.findEventElement = function (heEventTarget)
- {
- if (null != heEventTarget)
- {
- var strElementId;
- var strIsParentId;
- var bIsScroll;
-
- var heParentElement = heEventTarget;
- while (null != heParentElement && heParentElement.getAttribute)
- {
- var strId = heParentElement.getAttribute("id");
- if (strId)
- {
- strElementId = strId.replace("HE_", "");
- if (strElementId == "__TF_ContextMenu") return null;
- if (null != strElementId)
- {
- strIsParentId = heParentElement.getAttribute("parentId");
- if (null != strIsParentId)
- {
- bIsScroll = true;
- }
- else
- {
- bIsScroll = false;
- }
- var objElement = document.allElement.item(strElementId);
- if (null != objElement)
- {
- if ((objElement instanceof XFormsCell) ||
- (objElement instanceof XFormsTreeViewItem) ||
- (objElement instanceof XFormsSelectItem))
- {
- var objParent = objElement.parent;
- if (null != objParent)
- {
- objParent.setAttribute("row", objElement.row);
- objParent.setAttribute("col", objElement.col);
- }
- }
- else if (objElement instanceof XFormsDataGrid)
- {
- objElement.mouseCol = -1;
- objElement.mouseRow = -1;
- }
- else if ((objElement instanceof XFormsSelect) || (objElement instanceof XFormsTreeView))
- {
- objElement.m_nSelectedRow = -1;
- objElement.m_nSelectedCol = -1;
- objElement.m_bScoll = bIsScroll;
- }
- return objElement.getElement();
- }
- }
- }
- if (is_firefox)
- {
- heParentElement = heParentElement.parentNode;
- }
- else
- {
- heParentElement = heParentElement.parentElement;
- }
- }
- }
- return null;
- };
- window.initEvent = function (e, strId)
- {
- window.m_event.name = XFormsWindow.getEventName(e);
- window.m_event.target = strId;
-
- window.m_event.altKey = e.altKey;
- window.m_event.ctrlKey = e.ctrlKey;
- window.m_event.shiftKey = e.shiftKey;
- window.m_event.metaKey = e.metaKey;
-
- window.m_event.keyCode = e.keyCode;
-
- if(is_ie)
- {
- switch (e.button)
- {
- case 1 : window.m_event.button = TFEvent.BUTTON_LEFT; break;
- case 2 : window.m_event.button = TFEvent.BUTTON_RIGHT; break;
- case 4 : window.m_event.button = TFEvent.BUTTON_MIDDLE; break;
- }
- }
- else
- {
- switch (e.button)
- {
- case 0 : window.m_event.button = TFEvent.BUTTON_LEFT; break;
- case 1 : window.m_event.button = TFEvent.BUTTON_MIDDLE; break;
- case 2 : window.m_event.button = TFEvent.BUTTON_RIGHT; break;
- }
- }
-
- var objTarget = document.allElement.item(strId);
- if (null != objTarget.m_heControl)
- {
- window.m_event.targetX = e.clientX - objTarget.getClientLeft(true) - objTarget.m_heControl.scrollLeft;
- window.m_event.targetY = e.clientY - objTarget.getClientTop(true) - objTarget.m_heControl.scrollTop;
- }
-
- window.m_event.screenX = e.screenX;
- window.m_event.screenY = e.screenY;
-
- window.m_event.clientX = e.clientX;
- window.m_event.clientY = e.clientY;
-
- window.m_event.m_nRef = 0;
- window.m_event.m_browserEvent = e;
-
- window.m_event.ptarget = objTarget;
-
- if (e.wheelDelta) // IE, Opera
- {
- window.m_event.mouseWheel = e.wheelDelta / 120;
- }
- else // Mozilla
- {
- window.m_event.mouseWheel = -(e.detail / 3);
- }
- };
- XFormsWindow.pause = function (iMilliseconds)
- {
- var startTime = new Date().getTime();
- while (new Date().getTime() < startTime + iMilliseconds);
- };
- /**
- * Property
- */
- function __initWindow ()
- {
- // window에 event를 설정한다.
- if (window.attachEvent)
- {
- // MouseEvent
- document.body.attachEvent("onmousedown", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("onmousemove", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("onmouseup", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("ondblclick", XFormsWindow.onProcessMouseEvent);
-
- // KeyEvent
- document.body.attachEvent("onkeydown", XFormsWindow.onProcessFocusedEvent);
- document.body.attachEvent("onkeypress", XFormsWindow.onProcessFocusedEvent);
- document.body.attachEvent("onkeyup", XFormsWindow.onProcessFocusedEvent);
-
- document.body.attachEvent("onmousewheel", XFormsWindow.onProcessFocusedEvent);
-
- // resize
- //document.body.attachEvent("onresize", XFormsWindow.onResize);
- window.attachEvent("onresize", XFormsWindow.onResize);
-
- // scroll
- document.body.attachEvent("onscroll", XFormsWindow.onProcessEvent);
-
- // Drag & Drop
- document.body.attachEvent("ondragstart", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("ondragenter", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("ondragover", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("ondragleave", XFormsWindow.onProcessMouseEvent);
- document.body.attachEvent("ondrop", XFormsWindow.onProcessMouseEvent);
- }
- else
- {
- // MouseEvent
- window.addEventListener("mousedown", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("mousemove", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("mouseup", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("dblclick", XFormsWindow.onProcessMouseEvent, false);
-
- // KeyEvent
- window.addEventListener("keydown", XFormsWindow.onProcessFocusedEvent, false);
- window.addEventListener("keypress", XFormsWindow.onProcessFocusedEvent, false);
- window.addEventListener("keyup", XFormsWindow.onProcessFocusedEvent, false);
-
- window.addEventListener("mousewheel", XFormsWindow.onProcessFocusedEvent, false);
- window.addEventListener("DOMMouseScroll", XFormsWindow.onProcessFocusedEvent, false);
-
- // resize
- window.addEventListener("resize", XFormsWindow.onResize, false);
-
- // scroll
- window.addEventListener("scroll", XFormsWindow.onProcessEvent, false);
-
- // Drag & Drop
- window.addEventListener("dragstart", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("draggesture", XFormsWindow.onProcessMouseEvent, false);
-
- window.addEventListener("dragenter", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("dragover", XFormsWindow.onProcessMouseEvent, false);
-
- window.addEventListener("dragleave", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("dragexit", XFormsWindow.onProcessMouseEvent, false);
-
- window.addEventListener("drop", XFormsWindow.onProcessMouseEvent, false);
- window.addEventListener("dragdrop", XFormsWindow.onProcessMouseEvent, false);
- }
-
- window.children = new Collection();
- window.clipBoardData;
- window.m_strClipBoardData = "";
- window.hint;
- window.mdi;
- window.mdiChildren = new Collection();
- window.mdiTopmost;
- window.modelessTopmost;
- window.type = "main";
- window.topPos;
- window.left;
- window.width = document.body.offsetWidth;
- window.height = document.body.offsetHeight;
- window.visible = true;
- window.m_nDelayTime = null;
- // Document
- window.m_objDoc;// TODO
-
- //modal
- window.m_objModal = null;
- // Event
- window.m_arGlobalEventFireList = window.makeGlobalEventFireList();
-
- window.m_event = {
- name : "",
- target : "",
- currentTarget : "",
- relatedTarget : "",
- propagate : "",
- defaultAction : "",
- description : "",
-
- hover : "",
- down : "",
- focus : "",
- drag : "",
- capture : "",
-
- altKey : "",
- ctrlKey : "",
- shiftKey : "",
- metaKey : "",
- keyCode : "",
- button : "",
-
- x : -1,
- y : -1,
- clientX : -1,
- clientY : -1,
- screenX : -1,
- screenY : -1,
- targetX : -1,
- targetY : -1,
-
- pTarget : null,
-
- dropData : "",
- dropDataType : "",
-
- m_nRef : 0,
- m_browserEvent : null,
-
- preventDefault : function ()
- {
- this.defaultAction = "cancel";
- if (is_ie)
- {
- this.m_browserEvent.returnValue = false;
- }
- else
- {
- this.m_browserEvent.preventDefault();
- }
- },
-
- routeDefault : function ()
- {
- this.defaultAction = "perform";
- },
-
- stopPropagation : function ()
- {
- this.propagate = "stop";
- }
- };
-
- window.m_bReady = false;
-
- // window.bChildReady = false;
- // if (window.opener && false == window.opener.bChildReady)
- // {
- // window.opener.bChildReady = true;
- // }
-
- window.bParsed = true;
-
- window.m_strPrevClickElement;
- window.m_objPrevClickDate;
-
- //htmlwindow, htmldocument 을 정의한다
- var objTempWindow = window;
- try
- {
- while(true)
- {
- if (objTempWindow.opener)
- {
- if (objTempWindow == objTempWindow.opener)
- {
- htmlwindow = objTempWindow;
- htmldocument = objTempWindow.document;
- break;
- }
- objTempWindow = objTempWindow.opener;
- if (objTempWindow.__SoonsuViewer)
- {
- continue;
- }
- else
- {
- htmlwindow = objTempWindow;
- htmldocument = objTempWindow.document;
- break;
- }
- }
- else
- {
- if (objTempWindow == objTempWindow.parent)
- {
- htmlwindow = objTempWindow;
- htmldocument = objTempWindow.document;
- break;
- }
- objTempWindow = objTempWindow.parent;
- if (objTempWindow.__SoonsuViewer )
- {
- continue;
- }
- else
- {
- htmlwindow = objTempWindow;
- htmldocument = objTempWindow.document;
- break;
- }
- }
- }
- }
- catch (err)
- {
- htmlwindow = window.top;
- htmldocument = window.top.document;
- }
- //부모 관계를 체크하여 값을 설정함
- if (window.opener)
- {
- if (window.parent != window.opener)
- {
- if (is_ie|| is_opera)
- {
- parent = window.opener;
- }
- else
- {
- window.parent = window.opener;
- }
- }
- }
- else
- {
- if (is_firefox)
- {
- opener = window.parent;
- }
- else
- {
- window.opener = window.parent;
- }
- }
-
- };
- // TODO 임시
- window.getClipBoardData = function ()
- {
- var strData = "";
- if (is_ie)
- {
- strData = window.clipboardData.getData("Text");
- }
- return strData;
- };
- window.setClipBoardData = function (strData)
- {
- if (is_ie)
- {
- window.clipboardData.clearData("Text");
- window.clipboardData.setData("Text", strData);
- }
- };
- //
- //-----------------------------------------------------------------//
- window.setWidth = function (nValue)
- {
- window.width = nValue;
- body.style.width = nValue + "px";
- };
- window.setHeight = function (nValue)
- {
- window.height = nValue;
- body.style.height = nValue + "px";
- };
- window.isReady = function ()
- {
- return window.m_bReady;
- };
- /**
- * Function
- */
- window.about = function ()
- {
- window.showModalDialog(__getAppName() + "/kr/comsquare/html/About.html", null, "dialogHeight:130px;dialogWidth:350px;resizable:no;scroll:no;");
- };
- window.activate = function ()
- {
- window.setActive();
- };
- window.showMessageBox = function (strMessage, strTitle, nType)
- {
- if (null == strTitle && null == nType)
- {
- alert(strMessage);
- return 1;
- }
- else
- {
- var nButtonType = nType & 0XF;
- if (0 == nButtonType)
- {
- alert(strMessage);
- return 1;
- }
- else if (1 == nButtonType)
- {
- bReturnValue = confirm(strMessage);
- return (bReturnValue) ? 1 : 2;
- }
- else if (4 == nButtonType)
- {
- bReturnValue = confirm(strMessage);
- return (bReturnValue) ? 6 : 7;
- }
- if (2 == nButtonType || 3 == nButtonType || 5 == nButtonType)
- {
- var htMessage = new Hashtable();
- htMessage["message"] = strMessage;
- htMessage["title"] = strTitle;
- htMessage["type"] = nType;
- return window.showModalDialog(__getAppName() + "/kr/comsquare/html/Alert.html", htMessage, "dialogHeight:120px;dialogWidth:200px;resizable:yes;scroll:no;scrollbars:no;");
- }
- }
- };
- window.docProperty = function ()
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented docProperty()");
- }
- };
- window.exec = function (strAppName, strParam, strWorkDirectory)
- {
- // TODO signed applet 또는 ActiveX 아니면 안될듯
- if (null != window.console)
- {
- console.log("Unimplemented exec()");
- }
- };
- window.fileDialog = function ()
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented fileDialog()");
- }
- };
- window.load = function (strUrl, strType, strID, strProperty, strRef, strResultRef)
- {
- strUrl = strUrl.replace(".xrw", ".html");
- var newWindow;
-
- var strStatus;
- if (strType == "html")
- {
- strStatus = window.makeWindowStatus(strProperty);
- newWindow = window.open(strUrl, "_blank", strStatus);
- }
- else if (strType == "htmlreplace")
- {
- newWindow = window.open(strUrl, "_self");
- }
- else
- {
- if (null != strRef && !strRef.isEmpty()
- && null != strResultRef && !strResultRef.isEmpty())
- {
- // 자식윈도우로 전달할 부모윈도우의 인스턴스를 세팅한다.
- window.setParentData(strRef, strResultRef);
- }
-
- var strTarget = "_self";
- strStatus = window.makeWindowStatus(strProperty);
- if (null == strType || strType.isEmpty() || "replace" == strType)
- {
- strTarget = "_self";
- window.location.href = strUrl;
- newWindow = window;
- }
- else
- {
- strTarget = "_blank";
- newWindow = window.open(strUrl, strTarget, strStatus, false);
- }
-
- if (is_ie)
- {
- while (strTarget != "_self" && (!newWindow || !newWindow.isReady || !newWindow.isReady()))
- {
- XFormsWindow.pause(100);
- }
- }
-
- switch (strType)
- {
- case "modeless" :
- {
- newWindow.type = "modeless";
- break;
- }
- case "modal" :
- {
- newWindow.type = "modal";
- break;
- }
- case "mdi" :
- {
- newWindow.type = "mdi";
- break;
- }
- case "replace" :
- {
- newWindow.type = "main";
- break;
- }
- case "modeless_topmost" :
- {
- newWindow.type = "modeless";
- break;
- }
- case "mdichild_topmost" :
- {
- newWindow.type = "mdi";
- break;
- }
- }
- if ("replace" != strType)
- {
- window.children.add(strID, newWindow);
- }
- if ("mdi" == strType || "mdichild" == strType || "mdichild_topmost" == strType)
- {
- window.mdiChildren.add(strID, newWindow);
- }
- else if ("modal" == strType)
- {
- if (!is_opera)
- {
- var objTargetWindow = window;
- var objTargetDocument = document;
- if (null != window.parent)
- {
- var objParentWindow = window.parent;
- var objParentDocument = window.parent.document;
- while(objTargetWindow != objParentWindow)
- {
- if (null != objParentDocument.userAgent)
- {
- objTargetWindow = objParentWindow;
- objTargetDocument = objParentDocument;
- if (null != objParentWindow.parent)
- {
- objParentWindow = objParentWindow.parent;
- objParentDocument = objParentWindow.parent.document;
- }
- else
- {
- break;
- }
- }
- else
- {
- break;
- }
- }
- }
-
- if (null == objTargetDocument.getElementById("Soonsu_Create_Modal"))
- {
- var heModalDiv = objTargetDocument.createElement("div");
- heModalDiv.id = "Soonsu_Create_Modal";
- heModalDiv.style.left = "0px";
- heModalDiv.style.top = "0px";
- heModalDiv.style.width = "100%";
- heModalDiv.style.height = "100%";
- heModalDiv.style.position = "absolute";
- heModalDiv.style.zIndex = 1000;
- heModalDiv.style.backgroundColor = "#ffffff";
- $(heModalDiv).css({ opacity: 0 });
- heModalDiv.onmousedown = XFormsWindow.shiftModalFocus;
- heModalDiv.onclick = XFormsWindow.shiftModalFocus;
- heModalDiv.ondblclick = XFormsWindow.shiftModalFocus;
- objTargetDocument.body.appendChild(heModalDiv);
- }
- objTargetWindow.m_objModal = newWindow;
- newWindow.openerTargetWindow = objTargetWindow;
- window.m_objModal = newWindow;
- }
- }
- }
- return newWindow;
- };
- XFormsWindow.shiftModalFocus = function ()
- {
- if (null != window.m_objModal)
- {
- window.m_objModal.focus();
- }
- else
- {
- var heModalDiv = document.getElementById("Soonsu_Create_Modal");
- if (null != heModalDiv)
- {
- body.m_heControl.removeChild(heModalDiv);
- }
- }
- };
- window.maximize = function ()
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented window.maximize()");
- }
- };
- window.minimize = function ()
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented window.minimize()");
- }
- };
- window.nextPage = function ()
- {
- if(history)
- {
- history.forward();
- }
- else
- {
- window.forward();
- }
- };
- window.prevPage = function ()
- {
- if(history)
- {
- history.back();
- }
- else
- {
- window.back();
- }
- };
- window.refreshScrollbar = function ()
- {
- if (null != window.console)
- {
- console.log("There is no need to run a window.refreshScrollBar()");
- }
- };
- window.reload = function ()
- {
- window.location.reload(false);
- };
- window.restore = function ()
- {
- window.location.reload(false);
- };
- /**
- * R.G.B. 로 조합한 색상의 색상값을 10진수 정수 형태로 반환한다.
- */
- window.rgb = function (nRed, nGreen, nBlue)
- {
- return ((nRed & 0xFF) << 0) | ((nGreen & 0xFF) << 8) | ((nBlue & 0xFF) << 16);
- };
- window.setIEResizable = function (bResize)
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented window.setIEResizable()");
- }
- };
- window.setPopupMenu = function (bShow, strNodeset, strLabel, strFunctionName, bEvent)
- {
- body.m_bSetPopupMenu = bShow;
- if (bShow)
- {
- new XFormsContextMenu ("body", "__TF_ContextMenu", "xforms:contextmenu", strNodeset, strLabel, strFunctionName, bEvent);
- }
- else
- {
- body.removeChild("__TF_ContextMenu");
- }
- };
- window.setSize = function (nWidth, nHeight)
- {
- window.resizeTo(nWidth, nHeight);
- };
- window.showIEMenu = function (bShow)
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented window.showIEMenu()");
- }
- };
- window.showPopupMenu = function (bShow)
- {
- body.m_bShowPopupMenu = bShow;
- };
- window.viewInstance = function ()
- {
- // TODO 임시코드
- var strValue = "";
- var arKeyset = model.instances.keys();
- for (var i=0; i<arKeyset.length; i++)
- {
- var strKey = arKeyset[i];
- var objInstance = model.instances.item(strKey);
- strValue += objInstance.getXml() + "\n";
- }
-
- alert(strValue);
- };
- window.viewLog = function ()
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented window.viewLog()");
- }
- };
- window.zoom = function ()
- {
- return null;
- };
- window.setZoom = function (nScale)
- {
- if (null == nScale)
- {
- return;
- }
- nScale = nScale / 100;
- if(is_ie || is_webkit)
- {
- document.body.style.zoom = nScale;
- }
- else if (is_firefox)
- {
- $('body').css('-moz-transform','scale('+(nScale)+')');
- $('body').css('-moz-transform-origin','0 0');
- }
- else if (is_opera)
- {
- $('body').css('-o-transform','scale('+(nScale)+')');
- $('body').css('-o-transform-origin','0 0');
- }
- };
- window.viewSource = function ()
- {
- // TODO
- if (null != window.console)
- {
- console.log("Unimplemented window.viewSource()");
- }
- };
- window.getHostURL = function ()
- {
- return window.location.protocol + "//" + window.location.host;
- };
- window.getTrustFormURL = function ()
- {
- return window.location.protocol + "//" + window.location.host + __getAppName();
- };
- window.makeWindowStatus = function (strProperty)
- {
- var strWindowStatus = "";
-
- if (null == strProperty || 0 == strProperty.length)
- {
- return null;
- }
-
- var arStatus = strProperty.split(";");
- for (var i=0; i<arStatus.length; i++)
- {
- var strStatus = arStatus[i];
- if (null != strStatus)
- {
- var arUnit = strStatus.split(":");
- if (2 == arUnit.length)
- {
- var strPropertyName = arUnit[0].trim();
- var strPropertyValue = arUnit[1].trim();
-
- switch (strPropertyName)
- {
- case "left" :
- {
- if (is_ie)
- {
- strWindowStatus += "left=" + strPropertyValue + ",";
- }
- else
- {
- strWindowStatus += "screenX=" + strPropertyValue + ",";
- }
- break;
- }
- case "top" :
- {
- if (is_ie)
- {
- strWindowStatus += "top=" + strPropertyValue + ",";
- }
- else
- {
- strWindowStatus += "screenY=" + strPropertyValue + ",";
- }
- break;
- }
- case "width" :
- {
- strWindowStatus += "width=" + strPropertyValue + ",";
- break;
- }
- case "height" :
- {
- strWindowStatus += "height=" + strPropertyValue + ",";
- break;
- }
- case "sysmenu" :
- {
- break;
- }
- case "min" :
- {
- break;
- }
- case "max" :
- {
- break;
- }
- case "resize" :
- {
- strPropertyValue = ("true" == strPropertyValue)? "yes" : "no";
- strWindowStatus += "resizable=" + strPropertyValue + ",";
- break;
- }
- case "caption" :
- {
- strPropertyValue = ("visible" == strPropertyValue)? "yes" : "no";
- strWindowStatus += "titlebar=" + strPropertyValue + ",";
- strWindowStatus += "location=" + strPropertyValue + ",";
- break;
- }
- case "align" :
- {
- strPropertyValue = ("center" == strPropertyValue) ? "yes" : "no";
- strWindowStatus += "center=" + strPropertyValue + ",";
- break;
- }
- case "icon" :
- {
- break;
- }
- case "menubar" :
- {
- if ("yes" == strPropertyValue)
- {
- strWindowStatus += "menubar=yes,";
- }
- break;
- }
- }
- }
- }
- }
-
- if (0 > strWindowStatus.indexOf("resizable"))
- {
- strWindowStatus += "resizable=yes,";
- }
-
- if (0 > strWindowStatus.indexOf("menubar"))
- {
- strWindowStatus += "menbar=no,";
- }
-
- strWindowStatus += "copyhistory=yes";
-
- return strWindowStatus;
- };
- window.removeChildWindow = function (objWindow, bMdi)
- {
- if (!is_opera)
- {
- if (window.m_objModal == objWindow)
- {
- for (var i=0; i<window.children.length; i++)
- {
- if (window.children.item(i) == objWindow)
- {
-
- window.children.remove(window.children.m_arOrder[i]);
- break;
- }
- }
- if (window.children.length > 0)
- {
- window.m_objModal = window.children.item(window.children.length - 1);
- }
- else
- {
- window.m_objModal = null;
- var heModalDiv = document.getElementById("Soonsu_Create_Modal");
- if (null != heModalDiv)
- {
- body.m_heControl.removeChild(heModalDiv);
- }
- }
- }
- else
- {
- for (var i=0; i<window.children.length; i++)
- {
- if (window.children.item(i) == objWindow)
- {
- window.children.remove(window.children.m_arOrder[i]);
- break;
- }
- }
- }
- }
- };
- window.removeBodyHiddenDiv = function ()
- {
- var heModalDiv = document.getElementById("Soonsu_Create_Modal");
- if (null != heModalDiv)
- {
- body.m_heControl.removeChild(heModalDiv);
- }
- };
- window.getFocus = function ()
- {
- return window.m_event.focus;
- };
- window.setFocus = function (strId)
- {
- var strOldId = window.m_event.focus;
-
- if (strOldId == strId)
- {
- return;
- }
-
- var objOldControl = document.allElement.item(strOldId);
- if (null != objOldControl)
- {
- objOldControl = objOldControl.getElement();
-
- window.m_event.relatedTarget = strId;
-
- objOldControl.dispatch("onblur", window.m_event);
- objOldControl.dispatch("DOMFocusOut", window.m_event);
-
- if (objOldControl.getState(FCS_DISABLE))
- {
- window.m_event.focus = "";
- }
-
- if (!window.m_event.focus.isEmpty())
- {
- return;
- }
- }
-
- var objControl = document.allElement.item(strId);
- if (null != objControl)
- {
- objControl = objControl.getElement();
-
- window.m_event.relatedTarget = strOldId;
- objControl.dispatch("onfocus", window.m_event);
- objControl.dispatch("DOMFocusIn", window.m_event);
-
- if (window.m_event.focus != strId)
- {
- return;
- }
-
- // TODO navIndex 처리
- }
- window.m_event.relatedTarget = "";
- };
- window.getParentData = function ()
- {
- var strData = unescape(model.getProperty("__TF_PARENT_DATA_REF_"));
- if (null != strData && !strData.isEmpty())
- {
- var xnData = XmlLib.loadXMLFromString(strData);
- var strResultRef = model.getProperty("__TF_PARENT_DATA_RESULT_REF_");
-
- if (null != xnData && null != strResultRef && !strResultRef.isEmpty())
- {
- model.setParentData(xnData, strResultRef);
- }
-
- model.deleteProperty("__TF_PARENT_DATA_REF_");
- model.deleteProperty("__TF_PARENT_DATA_RESULT_REF_");
- }
- };
- window.setParentData = function (strRef, strResultRef)
- {
- var xnRefNode = model.getInstanceSinglePart(null, strRef);
-
- model.setProperty("__TF_PARENT_DATA_REF_", escape(XmlLib.serializeToString(xnRefNode)));
- model.setProperty("__TF_PARENT_DATA_RESULT_REF_", strResultRef);
- };
- // 스마트폰에서 일어난 클릭이 더블클릭인지 판단한다.
- window.isSmartPhoneDblClick = function (strId)
- {
- var bResult = false;
- if (is_smartphone)
- {
- var lCurrentTime = new Date().getTime();
- if (window.m_strPrevClickElement == strId && lCurrentTime < window.m_objPrevClickDate + 1000)
- {
- bResult = true;
- }
- }
- return bResult;
- };
- window.setPermitResize = function (bStatus)
- {
- window.bParsed = bStatus;
- };
- // 더블클릭을 위하여 스마트폰에서 일어난 클릭정보를 저장한다.
- window.setPrevClickInfo = function (strId, lTime)
- {
- if (is_smartphone)
- {
- window.m_strPrevClickElement = strId;
- window.m_objPrevClickDate = lTime;
- }
- };
- // 더블클릭을 위하여 스마트폰에서 일어난 클릭정보를 지운다.
- window.removePrevClickInfo = function ()
- {
- if (is_smartphone)
- {
- window.m_strPrevClickElement = null;
- window.m_objPrevClickDate = null;
- }
- };
- window.makeGlobalEventFireList = function ()
- {
- var arGlobalEventFireList = new Hashtable();
-
- if (window.DOMFocusIn) arGlobalEventFireList["DOMFocusIn"] = true;
- if (window.DOMFocusOut) arGlobalEventFireList["DOMFocusOut"] = true;
- if (window.onaccesskey) arGlobalEventFireList["onaccesskey"] = true;
- if (window.onblur) arGlobalEventFireList["onblur"] = true;
- if (window.onclick) arGlobalEventFireList["onclick"] = true;
- if (window.ondblclick) arGlobalEventFireList["ondblclick"] = true;
- if (window.ondelayclick) arGlobalEventFireList["ondelayclick"] = true;
- if (window.onfocus) arGlobalEventFireList["onfocus"] = true;
- if (window.onhidehint) arGlobalEventFireList["onhidehint"] = true;
- if (window.onload) arGlobalEventFireList["onload"] = true;
- if (window.onmousedown) arGlobalEventFireList["onmousedown"] = true;
- if (window.onmouseup) arGlobalEventFireList["onmouseup"] = true;
- if (window.onmousemove) arGlobalEventFireList["onmousemove"] = true;
- if (window.onmouseout) arGlobalEventFireList["onmouseout"] = true;
- if (window.onmouseover) arGlobalEventFireList["onmouseover"] = true;
- if (window.onmousewheel) arGlobalEventFireList["onmousewheel"] = true;
- // if (window.onscroll) arGlobalEventFireList["onscroll"] = true;
- if (window.onscrolldown) arGlobalEventFireList["onscrolldown"] = true;
- if (window.onscrollpagedown) arGlobalEventFireList["onscrollpagedown"] = true;
- if (window.onscrollpageup) arGlobalEventFireList["onscrollpageup"] = true;
- if (window.onscrollpos) arGlobalEventFireList["onscrollpos"] = true;
- if (window.onscrolltrack) arGlobalEventFireList["onscrolltrack"] = true;
- if (window.onscrollup) arGlobalEventFireList["onscrollup"] = true;
- if (window.onshowhint) arGlobalEventFireList["onshowhint"] = true;
- if (window.xforms_help) arGlobalEventFireList["xforms_help"] = true;
- if (window.xforms_hint) arGlobalEventFireList["xforms_hint"] = true;
- if (window.xforms_invalid) arGlobalEventFireList["xforms_invalid"] = true;
- if (window.xforms_next) arGlobalEventFireList["xforms_next"] = true;
- if (window.xforms_optional) arGlobalEventFireList["xforms_optional"] = true;
- if (window.xforms_previous) arGlobalEventFireList["xforms_previous"] = true;
- if (window.xforms_readonly) arGlobalEventFireList["xforms_readonly"] = true;
- if (window.xforms_readwrite) arGlobalEventFireList["xforms_readwrite"] = true;
- if (window.rms_required) arGlobalEventFireList["rms_required"] = true;
- if (window.xforms_required_error) arGlobalEventFireList["xforms_required_error"] = true;
- if (window.xforms_valid) arGlobalEventFireList["xforms_valid"] = true;
- if (window.DOMActivate) arGlobalEventFireList["DOMActivate"] = true;
- if (window.ondayselect) arGlobalEventFireList["ondayselect"] = true;
- if (window.onnextmonth) arGlobalEventFireList["onnextmonth"] = true;
- if (window.onprevmonth) arGlobalEventFireList["onprevmonth"] = true;
- if (window.onaftermovecolumn) arGlobalEventFireList["onaftermovecolumn"] = true;
- if (window.onafteruserresize) arGlobalEventFireList["onafteruserresize"] = true;
- if (window.onbeforemovecolumn) arGlobalEventFireList["onbeforemovecolumn"] = true;
- if (window.onbeforeuserresize) arGlobalEventFireList["onbeforeuserresize"] = true;
- if (window.onbuttonclick) arGlobalEventFireList["onbuttonclick"] = true;
- if (window.onendedit) arGlobalEventFireList["onendedit"] = true;
- if (window.onentercell) arGlobalEventFireList["onentercell"] = true;
- if (window.onstartedit) arGlobalEventFireList["onstartedit"] = true;
- if (window.onrowchanged) arGlobalEventFireList["onrowchanged"] = true;
- if (window.xforms_rebuild) arGlobalEventFireList["xforms_rebuild"] = true;
- if (window.xforms_select) arGlobalEventFireList["xforms_select"] = true;
- if (window.xforms_value_changed) arGlobalEventFireList["xforms_value_changed"] = true;
- if (window.onbuttonclick) arGlobalEventFireList["onbuttonclick"] = true;
- if (window.onkeypress) arGlobalEventFireList["onkeypress"] = true;
- if (window.onkeydown) arGlobalEventFireList["onkeydown"] = true;
- if (window.onkeyup) arGlobalEventFireList["onkeyup"] = true;
- if (window.oninvalidformat) arGlobalEventFireList["oninvalidformat"] = true;
- if (window.onmaxlength) arGlobalEventFireList["onmaxlength"] = true;
- if (window.onvalidformat) arGlobalEventFireList["onvalidformat"] = true;
- if (window.xforms_close) arGlobalEventFireList["xforms_close"] = true;
- if (window.xforms_model_construct) arGlobalEventFireList["xforms_model_construct"] = true;
- if (window.xforms_model_construct_done) arGlobalEventFireList["xforms_model_construct_done"] = true;
- if (window.xforms_model_destruct) arGlobalEventFireList["xforms_model_destruct"] = true;
- if (window.xforms_ready) arGlobalEventFireList["xforms_ready"] = true;
- if (window.xforms_refresh) arGlobalEventFireList["xforms_refresh"] = true;
- if (window.xforms_recalculate) arGlobalEventFireList["xforms_recalculate"] = true;
- if (window.xforms_revalidate) arGlobalEventFireList["xforms_revalidate"] = true;
- if (window.xforms_deselect) arGlobalEventFireList["xforms_deselect"] = true;
- if (window.xforms_select) arGlobalEventFireList["xforms_select"] = true;
- if (window.xforms_submit) arGlobalEventFireList["xforms_submit"] = true;
- if (window.xforms_submit_cancel) arGlobalEventFireList["xforms_submit_cancel"] = true;
- if (window.xforms_submit_done) arGlobalEventFireList["xforms_submit_done"] = true;
- if (window.xforms_submit_error) arGlobalEventFireList["xforms_submit_error"] = true;
- if (window.upload_ext_error) arGlobalEventFireList["upload_ext_error"] = true;
- if (window.upload_filecount_error) arGlobalEventFireList["upload_filecount_error"] = true;
- if (window.upload_filesize_error) arGlobalEventFireList["upload_filesize_error"] = true;
- if (window.upload_revalidate) arGlobalEventFireList["upload_revalidate"] = true;
-
- return arGlobalEventFireList;
- };
|