123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- XFormsBrowser.prototype = new XFormsControl;
- function XFormsBrowser (strParentId, strAlert, strHelp, strHint, strAccesskey, strClass, bDisabled, strId, nNavindex, strSrc, strStyle, strTag, strVisibility, strUserDefineAttrib)
- {
- XFormsControl.call(this, strParentId, strAlert, strHelp, strHint, strAccesskey, strClass, bDisabled, strId, nNavindex, strStyle, strTag, strVisibility, strUserDefineAttrib);
- this.attribute["src"] = strSrc;
-
- this.document;
- this.window;
- };
- XFormsBrowser.prototype.init = function ()
- {
- XFormsControl.prototype.init.call(this);
- this.document = this.m_heControl.contentWindow.document;
- this.window = this.m_heControl.contentWindow;
- this.resizeControl();
- var strId = this.id;
- if (this.m_heControl.attachEvent)
- {
- this.m_heControl.attachEvent("onload", function() {XFormsBrowser.setIviewerDoc(strId);});
- }
- else
- {
- this.m_heControl.addEventListener("load", function() {XFormsBrowser.setIviewerDoc(strId);}, false);
- }
- };
- XFormsBrowser.prototype.setAttribute = function (strAttribute, strValue)
- {
- switch (strAttribute)
- {
- case "src":
- {
- this.attribute["src"] = strValue;
- this.m_heControl.src = strValue;
- break;
- }
- default:
- {
- break;
- }
- }
- };
- XFormsBrowser.prototype.Stop = function ()
- {
- if (is_ie)
- {
- this.m_heControl.contentWindow.document.execCommand('Stop');
- }
- else
- {
- // TODO 동작확인 해야함.
- this.m_heControl.contentWindow.stop();
- }
- };
- XFormsBrowser.prototype.Refresh = function ()
- {
- // TODO firefox 동작확인해야함
- this.m_heControl.contentWindow.location.reload(false);
- };
- XFormsBrowser.prototype.Navigate = function (strNewURL)
- {
- if (is_ie)
- {
- this.m_heControl.contentWindow.navigate(strNewURL);
- }
- else
- {
- this.m_heControl.contentWindow.location.href = strNewURL;
- }
- };
- XFormsBrowser.prototype.GoBack = function ()
- {
- // TODO firefox 동작확인해야함
- if(history)
- {
- this.m_heControl.contentWindow.history.back();
- }
- else
- {
- this.m_heControl.contentWindow.back();
- }
- };
- XFormsBrowser.prototype.GoForward = function ()
- {
- // TODO firefox 동작확인해야함
- if(history)
- {
- this.m_heControl.contentWindow.history.forward();
- }
- else
- {
- this.m_heControl.contentWindow.forward();
- }
- };
- XFormsBrowser.create = function (strParentId, clAttribute, strStyle)
- {
- // 메인노드 생성
- var xnBrowser = XFormsBrowser.createMainNode(clAttribute);
- var xnParent = document.getElementById("HE_"+strParentId);
- xnParent.appendChild(xnBrowser);
-
- // 하위노드 생성
- xnBrowser = XFormsBrowser.createSubNodes(xnBrowser, clAttribute);
- // object 생성
- return XFormsBrowser.createObject(strParentId, xnBrowser, clAttribute, strStyle);
- };
- XFormsBrowser.createMainNode = function (clAttribute)
- {
- var xnBrowser = document.createElement("iframe");
- xnBrowser = XFormsBrowser.createAttribute(xnBrowser, clAttribute);
- xnBrowser.frameBorder = "0";
-
- return xnBrowser;
- };
- XFormsBrowser.createSubNodes = function (xnBrowser, clAttribute)
- {
- return xnBrowser;
- };
- XFormsBrowser.createObject = function (strParentId, xnBrowser, clAttribute, strStyle)
- {
- var bDisabled = false;
- var strId = "";
- var nNavindex = 9007199254740992;
- var strSrc = "";
- var strUserDefineAttrib = "";
-
- for (var i=0; i<clAttribute.count(); i++)
- {
- var strAttributeName = clAttribute.keys()[i];
- switch (strAttributeName)
- {
- case "disabled" :
- {
- if ("true" == clAttribute.item(strAttributeName))
- {
- bDisabled = true;
- }
- break;
- }
- case "id" :
- {
- strId = clAttribute.item(strAttributeName);
- break;
- }
- case "navindex" :
- {
- nNavindex = parseInt(clAttribute.item(strAttributeName));
- break;
- }
- case "src" :
- {
- strRef = clAttribute.item(strAttributeName);
- break;
- }
-
- default :
- {
- if (!STYLE_LIST[strAttributeName])
- {
- strUserDefineAttrib += strAttributeName + ":" + clAttribute.item(strAttributeName) + "; ";
- }
- break;
- }
- }
- }
- var objBrowser = new XFormsBrowser (strParentId, "", "", "", "", "", bDisabled, strId, nNavindex, strSrc, strStyle, "xforms:browser", "visible", strUserDefineAttrib);
- return objBrowser;
- };
- XFormsBrowser.createAttribute = function (xnHtmlNode, clAttribute)
- {
- xnHtmlNode = XFormsControl.createAttribute(xnHtmlNode, clAttribute);
- return xnHtmlNode;
- };
- XFormsBrowser.setIviewerDoc = function (strId)
- {
- try
- {
- var objBrowser = document.controls.item(strId);
- objBrowser.document =objBrowser.m_heControl.contentWindow.document;
- objBrowser.window =objBrowser.m_heControl.contentWindow;
- }
- catch(e)
- {
- if (null != window.console)
- {
- console.log(" browser error : " + e);
- }
- }
- };
|