XFormsButton.prototype = new XFormsCaption; function XFormsButton (strParentId, strAlert, strHelp, strHint, strText, strAccesskey, bAutoresize, strBind, strClass, bDisabled, bEllipsis, strFormat, strGroup, strGroupalign, strId, nNavindex, strRef, strRoundmode, nRoundposition, bSelected, strStyle, strTag, strVisibility, strUserDefineAttrib) { if (!strId) { return; } XFormsCaption.call(this, strParentId, strAlert, strHelp, strHint, strText, strAccesskey, bAutoresize, strBind, strClass, bDisabled, bEllipsis, strFormat, strId, nNavindex, strRef, strRoundmode, nRoundposition, strStyle, strTag, strVisibility, strUserDefineAttrib); /** * Attribute */ this.attribute["group"] = strGroup; this.attribute["groupalign"] = strGroupalign; this.attribute["selected"] = String(bSelected); /** * Property */ this.selected = bSelected; this.m_heControl = document.getElementById("HE_" + this.id); this.m_strTargetGrid = ""; this.m_heLodExcelForm = null; }; /** * 인스턴스 데이터를 실제 컨트롤에 반영 * @return */ XFormsButton.prototype.refresh = function () { XFormsBindableControl.prototype.refresh.call(this); with(this) { if (null != m_heControl) { var strRef = attribute["ref"]; var strValue = (null != strRef && "" != strRef) ? model.getValue(strRef) : getAttribute("text"); if (null != m_heControlText) { m_heControlText.innerHTML = strValue.newlineCharConvert(); } } } }; XFormsButton.prototype.getBindingType = function () { return BT_SINGLE; }; XFormsButton.prototype.init = function () { XFormsCaption.prototype.init.call(this); if (null != this.m_heControlText) { var strText = this.getAttribute("text"); this.m_heControlText.innerHTML = strText.newlineCharConvert(); } if ("xforms:inputbutton" == this.attribute["tag"]) { if (null != this.parent) { var nControlLeft = Number(this.parent.attribute["left"].split("px")[0]); var nControlWidth = this.parent.m_heControl.clientWidth; var nControlTargetWidth = 16 > this.m_heControl.clientWidth ? 16 : this.m_heControl.clientWidth; this.m_heControl.style.left = (nControlLeft + nControlWidth - nControlTargetWidth) + "px"; this.m_heControl.style.height = this.parent.m_heControl.clientHeight + "px"; } } this.m_strTargetGrid = this.getAttribute("loadexcelgrid"); if (null != this.m_strTargetGrid && "" != this.m_strTargetGrid) { this.createExcelButton(); } }; XFormsButton.prototype.createExcelButton = function () { if (null == this.m_heLodExcelForm) { if (is_ie6 || is_ie7 || is_ie8) { this.m_heLodExcelForm = document.createElement("
"); } else { this.m_heLodExcelForm = document.createElement("form"); this.m_heLodExcelForm.setAttribute("enctype","multipart/form-data"); } this.m_heLodExcelForm.action = __getAppName () + "/LoadExcel.tfs"; this.m_heLodExcelForm.method = "post"; this.m_heLodExcelForm.target = "HE___TF_LoadExcel"; this.m_heLodExcelForm.style.filter = "alpha(opacity=0)"; this.m_heLodExcelForm.style.opacity = 0; this.m_heLodExcelForm.style.position = "absolute"; this.m_heLodExcelForm.style.top = this.getAttribute("top"); this.m_heLodExcelForm.style.left = this.getAttribute("left"); this.m_heLodExcelForm.style.width = this.getAttribute("width"); this.m_heLodExcelForm.style.height = this.getAttribute("height"); if (is_ie6 || is_ie7) { var strTag = ""; strTag += ""; this.m_heLodExcelForm.innerHTML = strTag; } else { var heGridStatus = document.createElement("input"); heGridStatus.type = "hidden"; heGridStatus.name = "nodeset"; var heExcelFile = document.createElement("input"); heExcelFile.type = "file"; heExcelFile.name = "excel"; heExcelFile.style.top = "0px"; heExcelFile.style.left = "0px"; heExcelFile.style.width = "100%"; heExcelFile.style.height = "100%"; heExcelFile.style.cursor = "hand"; heExcelFile.setAttribute("onchange",this.id + ".loadExcelGrid();"); this.m_heLodExcelForm.appendChild(heGridStatus); this.m_heLodExcelForm.appendChild(heExcelFile); } if (null != this.parent.m_heControl) { this.parent.m_heControl.appendChild(this.m_heLodExcelForm); } } }; XFormsButton.prototype.loadExcelGrid = function () { var strFileType = this.m_heLodExcelForm.lastChild.value; strFileType = strFileType.substring(strFileType.lastIndexOf(".") + 1, strFileType.length); if ("xlsx" != strFileType && "xls" != strFileType) { if (null != window.console) { console.log("올바른 Excel File 형식이 아닙니다."); } return; } var objTargetGrid = document.allElement.item(this.m_strTargetGrid); if (null != objTargetGrid) { var strNodeSet = objTargetGrid.nodeset + "@"; var bFirst = true; for (var i=0; i