﻿addNamespace("Aspacts.Idios3.I_CAP.Scripting.InlineWin"); Aspacts.Idios3.I_CAP.Scripting.InlineWin.System_class = function() { }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.System_class.prototype = { windowItems: [], boolInitialized: false, refBlockLayerElement: null, intZIndex: 1001, pageOffsetX: 0, pageOffsetY: 0, Initialize: function() { if (!this.boolInitialized) { if (MS.Browser.isIE) { Aspacts.Idios3.I_CAP.Scripting.Core.ImplementEvent(document.body); document.body.addEventListener("resize", function() { Aspacts.Idios3.I_CAP.Scripting.InlineWin.System.HandleResize() }, true) } else { Aspacts.Idios3.I_CAP.Scripting.Core.ImplementEvent(window); window.addEventListener("resize", function() { Aspacts.Idios3.I_CAP.Scripting.InlineWin.System.HandleResize() }, true) } this.refBlockLayerElement = document.createElement("div"); document.body.insertBefore(this.refBlockLayerElement, document.body.firstChild); this.refBlockLayerElement.className = "InlineWin_ModalBlock"; this.refIEBugInput = document.createElement("input"); this.refIEBugInput.style.display = "none"; this.refIEBugInput.style.position = "absolute"; this.refIEBugInput.style.top = "0px"; this.refIEBugInput.style.left = "0px"; this.refIEBugInput.style.width = "1px"; this.refIEBugInput.style.height = "1px"; this.refIEBugInput.style.zIndex = -1000; document.body.insertBefore(this.refIEBugInput, document.body.firstChild); this.boolInitialized = true } }, OpenWindow: function(a, b, c, d, e) { if (document.body) { this.Initialize(); this.intZIndex++; this.intZIndex++; a = new Aspacts.Idios3.I_CAP.Scripting.InlineWin.WindowItem_class(this, this.intZIndex, a, b, c, d, e, false, true); this.windowItems.push(a); this.HandleResize(); this.UpdateBlockLayer(); return a } else alert("Document.body not yet initialized. Cannot open window.") }, UpdatePageOffset: function() { if (window.pageXOffset) { this.pageOffsetX = window.pageXOffset; this.pageOffsetY = window.pageYOffset } else { this.pageOffsetX = document.documentElement.scrollLeft; this.pageOffsetY = document.documentElement.scrollTop } }, OpenLoadingWindow: function(a, b, c, d, e, f, g) { f = !f; g || (g = b); if (typeof a == "string") { f = Array(); var h = document.createElement("p"); h.style.textAlign = "center"; h.innerHTML = a; f.push(h); a = f; f = false } b = this.OpenMessageWindow(b, g, null, c, d, e, f, false); b.RenderNodes(a); b.ClearButtons(); return b }, OpenMessageWindow: function(a, b, c, d, e, f, g, h) { if (document.body) { this.Initialize(); this.intZIndex++; this.intZIndex++; this.windowItems.length == 0 && this.UpdatePageOffset(); a = new Aspacts.Idios3.I_CAP.Scripting.InlineWin.WindowItem_class(this, this.intZIndex, "", a, d, e, f, g, h); this.windowItems.push(a); this.HandleResize(); this.UpdateBlockLayer(); a.SetTitle(b); c && a.RenderMessage(c); return a } else alert("Document.body not yet initialized. Cannot open window.") }, CloseWindow: function(a) { for (var b = [], c = 0; c < this.windowItems.length; c++) this.windowItems[c].intId == a && b.push(this.windowItems[c]); for (c = 0; c < b.length; c++) this.windowItems.deleteNode(b[c]); this.UpdateBlockLayer(); if (this.windowItems.length == 0) { document.body.blur(); document.body.focus(); if (MS.Browser.isIE) { this.refIEBugInput.style.display = "block"; window.setTimeout(this.RemoveHiddenInputBox.bind(this), 100) } a = document.getElementsByTagName("input"); for (c = 0; c < a.length; c++) try { if (a[c].type == "text") { a[c].select(); a[c].blur(); break } } catch (d) { } } else (c = this.windowItems[this.windowItems.length - 1].refContentFrame) && c.contentWindow && c.contentWindow.focus && c.contentWindow.focus() }, FindWindow: function(a) { for (var b = 0; b < this.windowItems.length; b++) if (this.windowItems[b].strName == a) return this.windowItems[b]; return null }, UpdateBlockLayer: function() { for (var a = 0, b = 0; b < this.windowItems.length; b++) a = Math.max(a, this.windowItems[b].intZIndex); a--; if (a > 0) { if (MS.Browser.isIE && this.refBlockLayerElement.style.display != "block") { var c = document.getElementsByTagName("select"); for (b = 0; b < c.length; b++) { if (c[b].style.visibility && c[b].style.visibility != "") c[b].inlineWin_originalVisibility = c[b].style.visibility; c[b].style.visibility = "hidden" } } c = document.getElementsByTagName("object"); for (b = 0; b < c.length; b++) { if (c[b].style.visibility && c[b].style.visibility != "") c[b].inlineWin_originalVisibility = c[b].style.visibility; c[b].style.visibility = "hidden" } this.refBlockLayerElement.style.display = "block"; this.refBlockLayerElement.style.zIndex = a; document.documentElement.style.overflow = "hidden"; if (!MS.Browser.isFirefox && !MS.Browser.isOpera) { document.documentElement.style.marginTop = 0 - this.pageOffsetY + "px"; document.documentElement.style.marginLeft = 0 - this.pageOffsetX + "px" } document.documentElement.style.paddingRight = "17px"; this.HandleResize() } else { if (MS.Browser.isIE) { c = document.getElementsByTagName("select"); for (b = 0; b < c.length; b++) { c[b].style.visibility = c[b].inlineWin_originalVisibility ? c[b].inlineWin_originalVisibility : ""; c[b].inlineWin_originalVisibility = null } } c = document.getElementsByTagName("object"); for (b = 0; b < c.length; b++) { c[b].style.visibility = c[b].inlineWin_originalVisibility ? c[b].inlineWin_originalVisibility : ""; c[b].inlineWin_originalVisibility = null } this.refBlockLayerElement.style.display = "none"; document.documentElement.style.overflow = ""; document.documentElement.style.marginTop = ""; document.documentElement.style.marginLeft = ""; document.documentElement.style.paddingRight = ""; window.scrollTo(this.pageOffsetX, this.pageOffsetY) } }, RemoveHiddenInputBox: function() { this.refIEBugInput.style.display = "none" }, HandleResize: function() { var a, b; if (typeof window.innerWidth == "number") { a = window.innerWidth; b = window.innerHeight } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { a = document.documentElement.clientWidth; b = document.documentElement.clientHeight } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { a = document.body.clientWidth; b = document.body.clientHeight } this.UpdatePageOffset(); this.refBlockLayerElement.style.top = this.pageOffsetY + "px"; this.refBlockLayerElement.style.left = this.pageOffsetX + "px"; this.refBlockLayerElement.style.width = a + "px"; this.refBlockLayerElement.style.height = b + "px"; for (var c = 0; c < this.windowItems.length; c++) this.windowItems[c].ResetPosition(a, b, this.pageOffsetX, this.pageOffsetY) }, ShowToolTip: function(a, b, c, d, e) { it = document.getElementById(b); img = document.getElementById(c); if (it.originalParent == null) it.originalParent = it.parentNode; if (d + it.offsetWidth > img.offsetWidth) d = img.offsetWidth - it.offsetWidth; x = this.FindElementPosX(img) + d; y = this.FindElementPosY(img) + e; if (a) { this.UpdatePageOffset(); it.style.top = "0px"; it.style.left = "0px"; b = a.clientY - this.FindElementPosY(it) + e + this.pageOffsetY; a = a.clientX - this.FindElementPosX(it) + d + this.pageOffsetX; b = Math.max(b, 0); a = Math.max(a, 0); it.style.top = b + "px"; it.style.left = a + "px" } it.style.visibility = "visible" }, HideToolTip: function(a) { it = document.getElementById(a); it.style.visibility = "hidden" }, FindElementPosY: function(a) { var b = 0; if (a.offsetParent) for (; a.offsetParent; ) { b += a.offsetTop; a = a.offsetParent } else if (a.y) b += a.y; return b }, FindElementPosX: function(a) { var b = 0; if (a.offsetParent) for (; a.offsetParent; ) { b += a.offsetLeft; a = a.offsetParent } else if (a.x) b += a.x; return b } }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.System = new Aspacts.Idios3.I_CAP.Scripting.InlineWin.System_class; Aspacts.Idios3.I_CAP.Scripting.InlineWin.WindowItem_class = function(a, b, c, d, e, f, g, h, i) { this.windowSystem = a; this.intZIndex = this.intId = b; this.strUrl = c; this.btCloseButton = i; if (this.strName) this.strName = d; if (e) this.intWidth = e; if (f) this.intHeight = f; if (g) this.strStylePrefix = g; this.intHtmlVersion = 1; if (this.strStylePrefix && this.strStylePrefix.indexOf("V2_") == 0) this.intHtmlVersion = 2; this.btEmpty = h; this.Initialize() }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.WindowItem_class.prototype = { strName: "", strUrl: "", intId: 0, windowSystem: null, intWidth: 800, intHeight: 600, strStylePrefix: "", strTitle: "", refElement: null, refTitleElement: null, intZIndex: 0, buttonCollection: [], OnClose: null, OnButtonClose: null, Initialize: function() { this.InitializeElement(); this.refElement.style.position = "absolute"; this.refElement.style.zIndex = this.intZIndex; this.refElement.style.width = this.intWidth + 1 + "px"; this.refElement.style.height = this.intHeight + 1 + "px"; this.refElement.style.top = "0px"; this.refElement.style.left = "0px"; this.refBackgroundFrame.style.position = "absolute"; this.refBackgroundFrame.style.zIndex = "10000"; this.refBackgroundFrame.style.margin = "0"; this.refBackgroundFrame.style.padding = "0"; this.refElement2.style.position = "absolute"; this.refElement2.style.width = this.intWidth - 2 + "px"; this.refElement2.style.height = this.intHeight - 2 + "px"; this.ResetSize() }, InitializeElement: function() { this.refElement = document.createElement("div"); this.refElement.className = this.strStylePrefix + "InlineWin_container"; this.refBackgroundFrame = document.createElement("iframe"); this.refBackgroundFrame.frameBorder = "0"; this.refElement.appendChild(this.refBackgroundFrame); if (this.intHtmlVersion < 2) { this.refElement.style.border = "solid 0px black"; this.refBackgroundFrame.style.position = "absolute"; this.refBackgroundFrame.style.width = "100%"; this.refBackgroundFrame.style.height = "100%"; this.refBackgroundFrame.style.zIndex = "10000"; this.refBackgroundFrame.style.margin = "0"; this.refBackgroundFrame.style.padding = "0"; this.refBackgroundFrame.style.display = "block"; this.refBackgroundFrame.style.backgroundColor = "transparent" } else this.refBackgroundFrame.style.display = "none"; this.refElement2 = document.createElement("div"); this.refElement.appendChild(this.refElement2); this.refTargetElement = this.refElement2; if (this.intHtmlVersion < 2) { this.refElement2.style.position = this.btEmpty ? "relative" : "absolute"; this.refElement2.style.width = "100%"; this.refElement2.style.height = "100%"; this.refElement2.style.margin = "0"; this.refElement2.style.padding = "0"; this.refElement2.style.border = "solid 0px black" } else { this.refElement2.className = this.strStylePrefix + "InlineWin_Corner"; this.refToolBarCornerTop = document.createElement("div"); this.refElement2.appendChild(this.refToolBarCornerTop); this.refToolBarCornerTop.className = this.strStylePrefix + "InlineWin_CornerTop"; this.refToolBarCornerTopChild = document.createElement("div"); this.refToolBarCornerTop.appendChild(this.refToolBarCornerTopChild); this.refToolBarBorderLeft = document.createElement("div"); this.refElement2.appendChild(this.refToolBarBorderLeft); this.refToolBarBorderLeft.className = this.strStylePrefix + "InlineWin_BorderLeft"; this.refToolBarBorderRight = document.createElement("div"); this.refToolBarBorderLeft.appendChild(this.refToolBarBorderRight); this.refToolBarBorderRight.className = this.strStylePrefix + "InlineWin_BorderRight"; this.refToolBarBorderCenter = document.createElement("div"); this.refToolBarBorderRight.appendChild(this.refToolBarBorderCenter); this.refToolBarBorderCenter.className = this.strStylePrefix + "InlineWin_BorderCenter"; this.refTargetElement = this.refToolBarBorderCenter } this.refElement2.style.zIndex = "10001"; if (this.btEmpty && this.intHtmlVersion < 2) document.body.insertBefore(this.refElement, document.body.firstChild); else { this.refHeader = document.createElement("div"); this.refTargetElement.appendChild(this.refHeader); this.refHeader.className = this.strStylePrefix + "InlineWin_subHeader"; this.refHeader.style.zIndex = "12000"; refTitleContainer = document.createElement("span"); this.refHeader.appendChild(refTitleContainer); refTitleContainer.className = this.strStylePrefix + "InlineWin_title"; this.refTitleElement = document.createElement("h1"); refTitleContainer.appendChild(this.refTitleElement); if (this.btCloseButton) { headerButtonContainer = document.createElement("span"); this.refHeader.appendChild(headerButtonContainer); headerButtonContainer.className = this.strStylePrefix + "InlineWin_closeButton"; buttonClose = document.createElement("button"); buttonClose.refWindow = this; headerButtonContainer.appendChild(buttonClose); buttonClose.className = this.strStylePrefix + "InlineWin_btnImgDefault " + this.strStylePrefix + "InlineWin_btnImgClose"; buttonClose.title = "Venster sluiten"; Aspacts.Idios3.I_CAP.Scripting.Core.ImplementEvent(buttonClose); buttonClose.addEventListener("click", function() { this.refWindow.ButtonClose() }, true); buttonLabel = document.createElement("span"); buttonClose.appendChild(buttonLabel); buttonLabel.appendChild(document.createTextNode("Venster sluiten")) } this.refContent = document.createElement("div"); this.refTargetElement.appendChild(this.refContent); this.refContent.className = this.strStylePrefix + "InlineWin_formContent"; this.refContent.style.zIndex = "12000"; if (this.strUrl != "") { this.refContentFrame = document.createElement("iframe"); this.refContentFrame.frameBorder = "0"; this.refContent.appendChild(this.refContentFrame); this.refContentFrame.width = "100%"; this.refContentFrame.height = "100%"; this.refContentFrame.style.width = "100%"; this.refContentFrame.style.height = "100%"; this.refContentFrame.style.borderWidth = "0px"; this.refContentFrame.src = this.strUrl } else { this.refContentFrame = document.createElement("div"); this.refContent.appendChild(this.refContentFrame); this.refContentFrame.width = "100%"; this.refContentFrame.height = "100%"; this.refContentFrame.style.width = "100%"; this.refContentFrame.style.height = "100%"; this.refContentFrame.style.borderWidth = "0px" } this.refContentFrame.refWindow = this; this.refContentFrame.focus(); this.refFooter = document.createElement("div"); this.refTargetElement.appendChild(this.refFooter); this.refFooter.className = this.strStylePrefix + "InlineWin_formFooter"; this.refFooterText = document.createElement("span"); this.refFooter.appendChild(this.refFooterText); this.refFooterText.className = this.strStylePrefix + "InlineWin_formFooterText"; this.refFooterContent = document.createElement("div"); this.refFooter.appendChild(this.refFooterContent); this.refFooterContent.className = this.strStylePrefix + "InlineWin_contPageIndex"; document.body.insertBefore(this.refElement, document.body.firstChild); if (this.intHtmlVersion > 1) { this.refToolBarCornerBottom = document.createElement("div"); this.refElement2.appendChild(this.refToolBarCornerBottom); this.refToolBarCornerBottom.className = this.strStylePrefix + "InlineWin_CornerBottom"; this.refToolBarCornerBottomChild = document.createElement("div"); this.refToolBarCornerBottom.appendChild(this.refToolBarCornerBottomChild) } } }, ResetSize: function() { var a = 0; if (!this.btEmpty) { a += this.refFooter.offsetHeight; a += this.refHeader.offsetHeight; this.refContentFrame.style.width = "10px"; this.refContentFrame.style.height = "10px"; this.refContent.style.width = this.intWidth; this.refFooter.style.width = this.intWidth; this.refHeader.style.width = this.intWidth; this.refContent.style.height = Math.max(this.intHeight - a, 0) + "px" } this.refElement.style.width = this.intWidth + "px"; this.refElement.style.height = this.intHeight + "px"; a = this.intWidth; this.btEmpty || (a += 20); this.refElement2.style.width = a + "px"; this.refElement2.style.height = this.intHeight + "px"; if (!this.btEmpty) { this.refContentFrame.style.width = "100%"; this.refContentFrame.style.height = "100%" } }, ResetPosition: function(a, b, c, d) { var e = this.intWidth, f = this.intHeight; if (!this.altWidth) this.altWidth = this.intWidth; if (!this.altHeight) this.altHeight = this.intHeight; this.intWidth = this.altWidth; this.intHeight = this.altHeight; b -= 40; if (this.intHeight > b) this.intHeight = Math.max(b, 0); a = Math.max((a - this.intWidth) / 2, 0) + c; b = Math.max((b - this.intHeight) / 2, 0) + d; this.refElement.style.left = a + "px"; this.refElement.style.top = b + "px"; this.refElement.style.width = this.intWidth + "px"; this.refElement.style.height = this.intHeight + "px"; if (e != this.intWidth || f != this.intHeight) this.ResetSize() }, ButtonClose: function(a) { this.OnButtonClose != null ? this.OnButtonClose(a) : this.Close(a) }, Close: function(a) { this.LoadingWin && this.LoadingWin.Close(); this.refElement && this.refElement.parentNode && this.refElement.parentNode.removeChild(this.refElement); this.windowSystem.CloseWindow(this.intId); this.OnClose != null && this.OnClose(a) }, SetTitle: function(a) { if (this.refTitleElement) { this.strTitle = a; if (this.refTitleElement.childNodes) for (; this.refTitleElement.childNodes.length > 0; ) this.refTitleElement.removeChild(this.refTitleElement.childNodes[0]); this.refTitleElement.appendChild(document.createTextNode(this.strTitle)) } }, SetTitleNodes: function(a) { if (this.refTitleElement && this.refTitleElement.childNodes) { for (; this.refTitleElement.childNodes.length > 0; ) this.refTitleElement.removeChild(this.refTitleElement.childNodes[0]); for (var b = 0; b < a.length; b++) this.refTitleElement.appendChild(a[b]) } }, OpenLoadingWin: function(a) { var b = ""; if (a) b = a; this.LoadingWin = Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenAspactsPopinLoading(b) }, ClearFooterText: function() { for (; this.refFooterText.childNodes.length > 0; ) this.refFooterText.removeChild(this.refFooterText.childNodes[0]); this.refFooterText.style.display = "none" }, SetFooterText: function(a) { this.ClearFooterText(); this.refFooterText.style.display = ""; this.refFooterText.appendChild(document.createTextNode(a)) }, AddButton: function(a, b, c, d, e, f) { var g = document.createElement("button"); this.refFooterContent.appendChild(g); g.className = f ? f : this.strStylePrefix + "InlineWin_btnDefault"; g.title = c; g.id = "winBtn" + this.intId + "_" + a; g.refWindow = this; a = document.createElement("span"); g.appendChild(a); a.appendChild(document.createTextNode(b)); if (d == "CloseWindow") { Aspacts.Idios3.I_CAP.Scripting.Core.ImplementEvent(g); g.addEventListener("click", function() { this.refWindow.Close() }, true) } else g.onclick = d; if (!e) g.disabled = true; return this.buttonCollection[this.buttonCollection.length] = g }, ClearButtons: function() { for (var a = 0; a < this.buttonCollection.length; a++) this.buttonCollection[a].parentNode && this.buttonCollection[a].parentNode.removeChild(this.buttonCollection[a]); this.buttonCollection = [] }, GetButton: function(a) { for (var b = 0; b < this.buttonCollection.length; b++) if (this.buttonCollection[b].id == "winBtn" + this.intId + "_" + a) return this.buttonCollection[b]; return null }, ResizeTo: function(a, b) { this.intWidth = a; this.intHeight = b; this.altWidth = a; this.altHeight = b; this.ResetSize(); this.windowSystem.HandleResize() }, RenderMessage: function(a) { this.refContentFrame.style.textAlign = "center"; this.refContentFrame.appendChild(document.createTextNode(a)) }, RenderNodes: function(a) { for (var b = 0; b < a.length; b++) this.refContentFrame ? this.refContentFrame.appendChild(a[b]) : this.refElement2.appendChild(a[b]) } }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenPopinUrl = function(a, b, c, d) { return Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenPopinUrlStyle(a, b, c, d, "") }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenPopinUrlStyle = function(a, b, c, d, e) { b || (b = 800); c || (c = 500); var f; if (window.frameElement) if (window.frameElement.refWindow) f = window.frameElement.refWindow.windowSystem.OpenWindow(a, "aPopin", b, c, e); f || (f = Aspacts.Idios3.I_CAP.Scripting.InlineWin.System.OpenWindow(a, "aPopin", b, c, e)); d || (e == "V2_Aspacts" ? f.AddButton("btnClose", "Sluiten", "Venster sluiten", "CloseWindow", true) : f.AddButton("btnClose", "Sluiten", "Venster sluiten", "CloseWindow", true, "btnTxt btnBackGrnd")); return f }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenAspactsPopinLoading = function(a, b, c, d) { b || (b = 600); c || (c = 200); var e = document; if (window.frameElement) if (window.frameElement.refWindow) e = window.frameElement.refWindow.windowSystem.refBlockLayerElement.ownerDocument; d || (d = ""); a || (a = "Een moment geduld"); var f = [], g = e.createElement("div"); g.className = "loading"; var h = e.createElement("img"); h.src = "/downloadattachment.aspx?strResource=IdiosLoader.gif"; h.alt = "Loading"; h.className = "loading"; g.appendChild(h); h = e.createElement("p"); h.appendChild(e.createTextNode(a)); g.appendChild(h); f.push(g); var i; if (window.frameElement) if (window.frameElement.refWindow) i = window.frameElement.refWindow.windowSystem.OpenLoadingWindow(f, d, b, c, "V2_Aspacts"); i || (i = Aspacts.Idios3.I_CAP.Scripting.InlineWin.System.OpenLoadingWindow(f, d, b, c, "V2_Aspacts")); return i }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenAspactsPopinMessage = function(a, b, c, d) { c || (c = 600); d || (d = 200); var e; if (window.frameElement) if (window.frameElement.refWindow) e = window.frameElement.refWindow.windowSystem.OpenMessageWindow("aPopin", a, b, c, d, "V2_Aspacts", false, true); e || (e = Aspacts.Idios3.I_CAP.Scripting.InlineWin.System.OpenMessageWindow("aPopin", a, b, c, d, "V2_Aspacts", false, true)); e.AddButton("btnClose", "Sluiten", "Venster sluiten", "CloseWindow", true); return e }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenAspactsPopinUrl = function(a, b, c, d) { return Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenPopinUrlStyle(a, b, c, d, "V2_Aspacts") }; Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenPopinControl = function(a, b, c, d, e, f) { a = Aspacts.Idios3.I_CAP.Scripting.InlineWin.OpenPopinUrlStyle(a + "&btPPIN=1&strControl=" + b, c, d, f, "V2_Aspacts"); a.opener = window; if (e) a.OnClose = e == "action" ? function(g) { this.opener.fnISE_ActionWithParam(g) } : e == "actionEditor" ? function(g) { this.opener.fnISE_Action(g) } : function() { this.opener.fnISE_RefreshPopup() }; return a };
