public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); bool isInGroup = (this.Parent is HtmlFileUploadGroup); if (isInGroup) { } else { string idCust = string.Format(CultureInfo.InvariantCulture, "c{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); XmlUtil.SetAttribute(node, "id", FormName); XmlUtil.SetAttribute(node, "action", _serverPage); XmlUtil.SetAttribute(node, "method", "post"); XmlUtil.SetAttribute(node, "enctype", "multipart/form-data"); XmlUtil.SetAttribute(node, HIDDENRequest, idCust); // XmlNode jsonNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(jsonNode); XmlUtil.SetAttribute(jsonNode, "type", "hidden"); XmlUtil.SetAttribute(jsonNode, "id", idCust); XmlUtil.SetNameAttribute(jsonNode, HIDDENRequest); // jsonNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(jsonNode); XmlUtil.SetAttribute(jsonNode, "type", "hidden"); XmlUtil.SetAttribute(jsonNode, "value", this.MaximumFileSize * 1024); XmlUtil.SetNameAttribute(jsonNode, HIDDENMaxSize); } // StringBuilder sb = new StringBuilder(); if (this.BorderStyle != BorderStyle.None) { sb.Append("border: solid 2px #40a0c0;"); } WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); XmlUtil.SetAttribute(node, "style", sb.ToString()); // if (isInGroup) { XmlUtil.SetAttribute(node, "type", "file"); XmlUtil.SetNameAttribute(node, Site.Name); } else { XmlNode f = node.OwnerDocument.CreateElement("input"); node.AppendChild(f); XmlUtil.SetAttribute(f, "type", "file"); XmlUtil.SetNameAttribute(f, Site.Name); XmlUtil.SetAttribute(f, "id", Site.Name); XmlUtil.SetAttribute(f, "style", string.Format(CultureInfo.InvariantCulture, "width:{0}px;", this.Width)); string ifId = HtmlFileUploadGroup.CreateIFrame(node.ParentNode); XmlUtil.SetAttribute(node, "target", ifId); } }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); bool b; _resourceFiles = new List <WebResourceFile>(); if (!string.IsNullOrEmpty(_displayFilepath)) { if (File.Exists(_displayFilepath)) { _resourceFiles.Add(new WebResourceFile(_displayFilepath, WebResourceFile.WEBFOLDER_Images, out b)); } } string idCust = string.Format(CultureInfo.InvariantCulture, "c{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); XmlUtil.SetAttribute(node, "action", _serverPage); XmlUtil.SetAttribute(node, "method", "post"); XmlUtil.SetAttribute(node, "enctype", "multipart/form-data"); XmlUtil.SetAttribute(node, HtmlFileUpload.HIDDENRequest, idCust); XmlNode jsonNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(jsonNode); XmlUtil.SetAttribute(jsonNode, "type", "hidden"); XmlUtil.SetAttribute(jsonNode, "id", idCust); XmlUtil.SetNameAttribute(jsonNode, HtmlFileUpload.HIDDENRequest); // string ifId = HtmlFileUploadGroup.CreateIFrame(node); XmlUtil.SetAttribute(node, "target", ifId); // XmlNode imgNode = node.OwnerDocument.CreateElement("img"); node.AppendChild(imgNode); if (string.IsNullOrEmpty(_filepath)) { _filepath = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "browse.jpg"); } if (File.Exists(_filepath)) { _resourceFiles.Add(new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b)); XmlUtil.SetAttribute(imgNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_filepath))); } XmlUtil.SetAttribute(imgNode, "style", "z-index: 0; position: absolute; left:0px; top:0px;"); // StringBuilder sb = new StringBuilder(); // WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); // if (_xmlNode != null) { XmlNode pNode = _xmlNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='Visible']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } } XmlUtil.SetAttribute(node, "style", sb.ToString()); }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { string idCust = string.Format(CultureInfo.InvariantCulture, "c{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); XmlUtil.SetAttribute(node, "action", _serverPage); XmlUtil.SetAttribute(node, "method", "post"); XmlUtil.SetAttribute(node, "enctype", "multipart/form-data"); XmlUtil.SetAttribute(node, HtmlFileUpload.HIDDENRequest, idCust); // XmlNode jsonNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(jsonNode); XmlUtil.SetAttribute(jsonNode, "type", "hidden"); XmlUtil.SetAttribute(jsonNode, "id", idCust); XmlUtil.SetNameAttribute(jsonNode, HtmlFileUpload.HIDDENRequest); // string ifId = HtmlFileUploadGroup.CreateIFrame(node); XmlUtil.SetAttribute(node, "target", ifId); // StringBuilder sb = new StringBuilder(); if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); } } IWebPageLayout wl = this.Parent as IWebPageLayout; if (wl != null) { sb.Append("width:100%; height:100%; "); } else { if (WidthType != SizeType.AutoSize) { sb.Append("width:"); if (WidthType == SizeType.Absolute) { sb.Append(Width.ToString(CultureInfo.InvariantCulture)); sb.Append("px; "); } else { sb.Append(WidthInPercent.ToString(CultureInfo.InvariantCulture)); sb.Append("%; "); } } // if (HeightType != SizeType.AutoSize) { sb.Append("height:"); if (HeightType == SizeType.Absolute) { sb.Append(Height.ToString(CultureInfo.InvariantCulture)); sb.Append("px; "); } else { sb.Append(HeightInPercent.ToString(CultureInfo.InvariantCulture)); sb.Append("%; "); } } } sb.Append("border: solid 1px #40a0c0;"); if (_xmlNode != null) { XmlNode pNode = _xmlNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='Visible']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } } WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); XmlUtil.SetAttribute(node, "style", sb.ToString()); // }