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)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }

            XmlUtil.SetAttribute(node, "border", 0);

            if (this.BackColor != Color.Empty && this.BackColor != Color.White)
            {
                XmlUtil.SetAttribute(node, "bgColor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            }


            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style);
            WebPageCompilerUtility.CreateElementPosition(this, style, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false);
            if (this.ForeColor != Color.Empty && this.ForeColor != Color.Black)
            {
                style.Append(" color:");
                style.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
                style.Append(";");
            }
            style.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
            XmlUtil.SetAttribute(node, "style", style.ToString());
            //
            XmlNode tr = node.OwnerDocument.CreateElement("tr");

            node.AppendChild(tr);
            for (int i = 0; i < MenuItems.Count; i++)
            {
                createTD(tr, MenuItems[i]);
            }
            //
        }
示例#3
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            //
            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("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            if (borderStyle != EnumBorderStyle.none && (borderWidth > 0 || (borderWidthStyle != EnumBorderWidthStyle.inherit && borderWidthStyle != EnumBorderWidthStyle.useNumber)))
            {
                sb.Append("border:");
                if (borderWidthStyle != EnumBorderWidthStyle.inherit && borderWidthStyle != EnumBorderWidthStyle.useNumber)
                {
                    sb.Append(borderWidthStyle);
                    sb.Append(" ");
                }
                else
                {
                    sb.Append(borderWidth);
                    sb.Append("px ");
                }
                sb.Append(borderStyle);
                if (borderColor != Color.Empty)
                {
                    sb.Append(" ");
                    sb.Append(ObjectCreationCodeGen.GetColorString(borderColor));
                }
                sb.Append(";");
            }
            //
            bool b;

            if (!string.IsNullOrEmpty(_bkImgFile))
            {
                if (File.Exists(_bkImgFile))
                {
                    WebResourceFile wf = new WebResourceFile(_bkImgFile, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _bkImgFile = wf.ResourceFile;
                    }
                    sb.Append("background-image:url(");
                    sb.Append(WebResourceFile.WEBFOLDER_Images);
                    sb.Append("/");
                    sb.Append(Path.GetFileName(_bkImgFile));
                    sb.Append(");");
                }
            }
            if (!BackgroundImageTile)
            {
                sb.Append("background-repeat: no-repeat;");
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", 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("disabled:true; ");
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            if (this.Controls.Count == 0)
            {
                node.InnerText = "";
            }
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
示例#4
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            if (ReadOnly)
            {
                XmlUtil.SetAttribute(node, "readonly", true);
            }
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();
            Dictionary <int, Dictionary <int, List <Control> > > ctrls = new Dictionary <int, Dictionary <int, List <Control> > >();

            for (int r = 0; r < RowCount; r++)
            {
                Dictionary <int, List <Control> > cr = new Dictionary <int, List <Control> >();
                ctrls.Add(r, cr);
                for (int c = 0; c < ColumnCount; c++)
                {
                    List <Control> cs = new List <Control>();
                    cr.Add(c, cs);
                }
            }
            foreach (Control ct in this.Controls)
            {
                int i = this.GetRow(ct);
                int j = this.GetColumn(ct);
                if (i >= 0 && i < RowCount)
                {
                    if (j >= 0 && j < ColumnCount)
                    {
                        Dictionary <int, List <Control> > cr;
                        ctrls.TryGetValue(i, out cr);
                        List <Control> cs;
                        cr.TryGetValue(j, out cs);
                        cs.Add(ct);
                    }
                }
            }
            for (int r = 0; r < RowCount; r++)
            {
                Dictionary <int, List <Control> > cr;
                ctrls.TryGetValue(r, out cr);
                XmlNode rNode = node.OwnerDocument.CreateElement("tr");
                node.AppendChild(rNode);
                if (_eventHandlers != null)
                {
                    foreach (KeyValuePair <string, string> kv in _eventHandlers)
                    {
                        if (string.CompareOrdinal(kv.Key, "onRowClick") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onclick", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseDown") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmousedown", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseUp") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmouseup", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }

                        else if (string.CompareOrdinal(kv.Key, "onRowMouseMove") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmousemove", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseOver") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmouseover", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                        else if (string.CompareOrdinal(kv.Key, "onRowMouseOut") == 0)
                        {
                            XmlUtil.SetAttribute(rNode, "onmouseout", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                        }
                    }
                }
                for (int c = 0; c < ColumnCount; c++)
                {
                    XmlNode cNode = node.OwnerDocument.CreateElement("td");
                    rNode.AppendChild(cNode);
                    if (_eventHandlers != null)
                    {
                        foreach (KeyValuePair <string, string> kv in _eventHandlers)
                        {
                            if (string.CompareOrdinal(kv.Key, "onCellClick") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onclick", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseDown") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmousedown", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseUp") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmouseup", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }

                            else if (string.CompareOrdinal(kv.Key, "onCellMouseMove") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmousemove", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseOver") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmouseover", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                            else if (string.CompareOrdinal(kv.Key, "onCellMouseOut") == 0)
                            {
                                XmlUtil.SetAttribute(cNode, "onmouseout", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value));
                            }
                        }
                    }
                    List <Control> cs;
                    cr.TryGetValue(c, out cs);
                    foreach (Control ct in cs)
                    {
                        createControlWebContents(ct, cNode, groupId);
                    }
                }
            }
            //
            XmlUtil.SetAttribute(node, "border", _cellBorderWidth);
            //
            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("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            IDataSetSource ids = DataSource as IDataSetSource;

            if (ids != null && !string.IsNullOrEmpty(ids.TableName))
            {
                XmlUtil.SetAttribute(node, "jsdb", ids.TableName);
            }
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            OnSetType(node);
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            if (IncludeDatetimePickerButton)
            {
                bool   b;
                string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css");
                if (File.Exists(btimg))
                {
                    _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
                }
                string[] jsFiles = new string[8];
                jsFiles[0] = "backstripes.gif";
                jsFiles[1] = "bg_header.jpg";
                jsFiles[2] = "bullet1.gif";
                jsFiles[3] = "bullet2.gif";
                jsFiles[4] = "cal.gif";
                jsFiles[5] = "cal-grey.gif";
                jsFiles[6] = "datepicker.js";
                jsFiles[7] = "gradient-e5e5e5-ffffff.gif";
                for (int i = 0; i < jsFiles.Length; i++)
                {
                    btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]);
                    if (File.Exists(btimg))
                    {
                        _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b));
                    }
                }
                bool    inDataRepeater = false;
                Control p = this.Parent;
                while (p != null)
                {
                    if (p is HtmlDataRepeater)
                    {
                        inDataRepeater = true;
                        break;
                    }
                    p = p.Parent;
                }
                if (inDataRepeater)
                {
                    string fs = "10px";
                    if (!string.IsNullOrEmpty(this.DatetimePickerFontSize))
                    {
                        fs = DatetimePickerFontSize.Trim();
                        if (fs.Length == 0)
                        {
                            fs = "10px";
                        }
                    }
                    string includeTime = DatetimePickerIncludeTime ? "true" : "false";
                    XmlUtil.SetAttribute(node, "useDP", true);
                    XmlUtil.SetAttribute(node, "useDPTime", includeTime);
                    XmlUtil.SetAttribute(node, "useDPSize", fs);
                }
            }
            if (this.ReadOnly)
            {
                XmlUtil.SetAttribute(node, "readonly", "true");
            }
            if (this.MaxLength > 0 && this.MaxLength < int.MaxValue)
            {
                XmlUtil.SetAttribute(node, "maxlength", this.MaxLength.ToString(CultureInfo.InvariantCulture));
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap);
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlNode okNode = node.OwnerDocument.CreateElement("img");

            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(okNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(okNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(okNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.onOK();", CodeName));
            node.AppendChild(okNode);
            bool            b;
            string          imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ok.png");
            WebResourceFile wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);

            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(okNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            //
            XmlNode spaceNode = node.OwnerDocument.CreateElement("span");

            spaceNode.InnerText = " ";
            node.AppendChild(spaceNode);
            //
            XmlNode cancelNode = node.OwnerDocument.CreateElement("img");

            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(cancelNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(cancelNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(cancelNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.onCancel();", CodeName));
            imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "cancel.png");
            wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);
            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(cancelNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            node.AppendChild(cancelNode);
            //
            spaceNode           = node.OwnerDocument.CreateElement("span");
            spaceNode.InnerText = "  ";
            node.AppendChild(spaceNode);
            //
            XmlNode chkAllNode = node.OwnerDocument.CreateElement("img");

            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(chkAllNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.selectAll();", CodeName));
            imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "checkbox.png");
            wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);
            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(chkAllNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            node.AppendChild(chkAllNode);
            //
            spaceNode           = node.OwnerDocument.CreateElement("span");
            spaceNode.InnerText = "  ";
            node.AppendChild(spaceNode);
            //
            chkAllNode = node.OwnerDocument.CreateElement("img");
            if (this.HideButtons)
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:none;cursor:pointer;");
            }
            else
            {
                XmlUtil.SetAttribute(chkAllNode, "style", "display:inline;cursor:pointer;");
            }
            XmlUtil.SetAttribute(chkAllNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.selectNone();", CodeName));
            imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "box.png");
            wf      = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b);
            _resourceFiles.Add(wf);
            if (b)
            {
                imgFile = wf.ResourceFile;
            }
            XmlUtil.SetAttribute(chkAllNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile)));
            node.AppendChild(chkAllNode);
            //
            XmlNode brNode = node.OwnerDocument.CreateElement("br");

            node.AppendChild(brNode);
            XmlNode lstNode = node.OwnerDocument.CreateElement("select");

            node.AppendChild(lstNode);
            XmlUtil.SetAttribute(lstNode, "id", string.Format(CultureInfo.InvariantCulture, "{0}_sel", CodeName));
            for (int i = 0; i < _listBox.Items.Count; i++)
            {
                string v;
                string s = VPLUtil.ObjectToString(_listBox.Items[i]);
                if (!string.IsNullOrEmpty(s))
                {
                    int n = s.IndexOf('|');
                    if (n >= 0)
                    {
                        v = s.Substring(n + 1).Trim();
                        s = s.Substring(0, n).Trim();
                    }
                    else
                    {
                        v = s;
                    }
                }
                else
                {
                    v = string.Empty;
                }
                XmlElement oNode = node.OwnerDocument.CreateElement("option");
                lstNode.AppendChild(oNode);
                XmlUtil.SetAttribute(oNode, "value", v);
                oNode.InnerText = s;
                oNode.IsEmpty   = false;
            }
            Graphics g  = this.CreateGraphics();
            SizeF    sf = g.MeasureString("H", this.Font);
            float    h  = (float)this.Height / sf.Height;

            XmlUtil.SetAttribute(lstNode, "size", Convert.ToInt32(h + 1));
            XmlUtil.SetAttribute(lstNode, "multiple", "multiple");
            //
            StringBuilder sblst = new StringBuilder();
            StringBuilder sb    = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            sblst.Append(sb.ToString());
            sblst.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
            XmlUtil.SetAttribute(lstNode, "style", sblst.ToString());
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            StringBuilder dbs = new StringBuilder();

            if (this.DataBindings != null && this.DataBindings.Count > 0)
            {
                string tbl2    = null;
                string sIdx    = string.Empty;
                string slItem  = string.Empty;
                string slValue = string.Empty;
                for (int i = 0; i < DataBindings.Count; i++)
                {
                    if (DataBindings[i].DataSource != null)
                    {
                        if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex",
                                                 DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember);
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2   = DataBindings[i].BindingMemberInfo.BindingPath;
                            slItem = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2    = DataBindings[i].BindingMemberInfo.BindingPath;
                            slValue = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(sIdx))
                {
                    dbs.Append(sIdx);
                }
                if (!string.IsNullOrEmpty(tbl2))
                {
                    if (dbs.Length > 0)
                    {
                        dbs.Append(";");
                    }
                    dbs.Append(tbl2);
                    dbs.Append(":");
                    dbs.Append(slItem);
                    dbs.Append(":");
                    dbs.Append(slValue);
                }
                if (dbs.Length > 0)
                {
                    XmlUtil.SetAttribute(lstNode, "jsdb", dbs.ToString());
                }
            }
            if (_listBox.Items.Count == 0)
            {
                lstNode.InnerText = "";
            }
            XmlElement xe = (XmlElement)lstNode;

            xe.IsEmpty = false;
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            if (File.Exists(_filepath))
            {
                bool            b;
                WebResourceFile wf = new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b);
                _resourceFiles.Add(wf);
            }
            XmlUtil.SetAttribute(node, "type", "button");
            XmlUtil.SetAttribute(node, "value", this.Text.Replace("\r", "").Replace('\n', ' '));
            //
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("white-space: normal;");
            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            if (this.RightToLeft == RightToLeft.Yes)
            {
                XmlUtil.SetAttribute(node, "dir", "RTL");
            }
            WebPageCompilerUtility.SetTextContentsToNode(node, this.Text);
            //
            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("; ");
                }
            }
            //
            if (this.Parent != null)
            {
                if (this.ForeColor != this.Parent.ForeColor)
                {
                    sb.Append("color:");
                    sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
                    sb.Append("; ");
                }
            }
            //
            if (_float != EnumInlineFloat.none && positionType == EnumWebElementPositionType.Absolute)
            {
                sb.Append("float:");
                sb.Append(_float.ToString());
                sb.Append("; ");
                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("%; ");
                    }
                }
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap);
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            for (int i = 0; i < Items.Count; i++)
            {
                string v;
                string s = VPLUtil.ObjectToString(Items[i]);
                if (!string.IsNullOrEmpty(s))
                {
                    int n = s.IndexOf('|');
                    if (n >= 0)
                    {
                        v = s.Substring(n + 1).Trim();
                        s = s.Substring(0, n).Trim();
                    }
                    else
                    {
                        v = s;
                    }
                }
                else
                {
                    v = string.Empty;
                }
                XmlElement oNode = node.OwnerDocument.CreateElement("option");
                node.AppendChild(oNode);
                XmlUtil.SetAttribute(oNode, "value", v);
                oNode.InnerText = s;
                oNode.IsEmpty   = false;
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            StringBuilder dbs = new StringBuilder();

            if (this.DataBindings != null && this.DataBindings.Count > 0)
            {
                string tbl2    = null;
                string sIdx    = string.Empty;
                string slItem  = string.Empty;
                string slValue = string.Empty;
                for (int i = 0; i < DataBindings.Count; i++)
                {
                    if (DataBindings[i].DataSource != null)
                    {
                        if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(DataBindings[i].PropertyName, "selectedIndex", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex",
                                                 DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember);
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2   = DataBindings[i].BindingMemberInfo.BindingPath;
                            slItem = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                        else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            tbl2    = DataBindings[i].BindingMemberInfo.BindingPath;
                            slValue = DataBindings[i].BindingMemberInfo.BindingField;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(sIdx))
                {
                    dbs.Append(sIdx);
                }
                if (!string.IsNullOrEmpty(tbl2))
                {
                    if (dbs.Length > 0)
                    {
                        dbs.Append(";");
                    }
                    dbs.Append(tbl2);
                    dbs.Append(":");
                    dbs.Append(slItem);
                    dbs.Append(":");
                    dbs.Append(slValue);
                }
                if (dbs.Length > 0)
                {
                    XmlUtil.SetAttribute(node, "jsdb", dbs.ToString());
                }
                if (this.AddBlankOnDataBinding)
                {
                    XmlUtil.SetAttribute(node, "useblank", "true");
                }
            }
            //
            if (this.Items.Count == 0)
            {
                node.InnerText = "";
            }
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            //
            bool   b;
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
            }
            string[] jsFiles = new string[8];
            jsFiles[0] = "backstripes.gif";
            jsFiles[1] = "bg_header.jpg";
            jsFiles[2] = "bullet1.gif";
            jsFiles[3] = "bullet2.gif";
            jsFiles[4] = "cal.gif";
            jsFiles[5] = "cal-grey.gif";
            jsFiles[6] = "datepicker.js";
            jsFiles[7] = "gradient-e5e5e5-ffffff.gif";
            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]);
                if (File.Exists(btimg))
                {
                    _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b));
                }
            }
            //
            bool    inDataRepeater = false;
            Control p = this.Parent;

            while (p != null)
            {
                if (p is HtmlDataRepeater)
                {
                    inDataRepeater = true;
                    break;
                }
                p = p.Parent;
            }
            if (inDataRepeater)
            {
                string fs          = string.Format(CultureInfo.InvariantCulture, "{0}px", _ftSize);
                string includeTime = IncludeTime ? "true" : "false";
                string cannotMove  = Movable ? "false" : "true";
                string pid         = (this.Parent is Form) ? "*" : (this.Parent.Site != null ? this.Parent.Site.Name : this.Parent.Name);
                XmlUtil.SetAttribute(node, "useDP", true);
                XmlUtil.SetAttribute(node, "useDPTime", includeTime);
                XmlUtil.SetAttribute(node, "useDPSize", fs);
                XmlUtil.SetAttribute(node, "useDPfix", cannotMove);
                XmlUtil.SetAttribute(node, "useDPid", pid);
                XmlUtil.SetAttribute(node, "useDPx", this.Left);
                XmlUtil.SetAttribute(node, "useDPy", this.Top);
                if (!_visible)
                {
                    XmlUtil.SetAttribute(node, "useDPv", true);
                }
            }
            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateElementPosition(this, style, EnumWebElementPositionType.Auto);
            XmlUtil.SetAttribute(node, "style", style.ToString());

            //
            _visible = true;
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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)
                            {
                                _visible = false;
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
        }
示例#11
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();

            foreach (Control ct in this.Controls)
            {
                createControlWebContents(ct, node, groupId);
            }
            //
            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("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            if (this.BorderStyle != BorderStyle.None)
            {
                sb.Append("border:1px solid black;");
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            if (_resourceFiles == null)
            {
                _resourceFiles = new List <WebResourceFile>();
            }
            string[] jsFiles = new string[120];
            jsFiles[0]  = "go.gif";
            jsFiles[1]  = "go_inact.gif";
            jsFiles[2]  = "folder.gif";
            jsFiles[3]  = "resizer.gif";
            jsFiles[4]  = "newElement.png";
            jsFiles[5]  = "moveup.png";
            jsFiles[6]  = "movedown.png";
            jsFiles[7]  = "undo.png";
            jsFiles[8]  = "undo_inact.png";
            jsFiles[9]  = "redo.png";
            jsFiles[10] = "redo_inact.png";
            jsFiles[11] = "stopTag.png";
            jsFiles[12] = "stopTag_inact.png";
            jsFiles[13] = "expand_res.png";
            jsFiles[14] = "expand_min.png";
            jsFiles[15] = "cancel.png";
            //
            jsFiles[16] = "newAttr.png";
            jsFiles[17] = "removeTag.png";
            jsFiles[18] = "removeOutTag.png";
            jsFiles[19] = "vSep.png";
            jsFiles[20] = "resizeV.png";
            jsFiles[21] = "ok.png";
            jsFiles[22] = "save.png";
            jsFiles[23] = "reset.png";
            jsFiles[24] = "space.png";
            jsFiles[25] = "tglProp.png";
            jsFiles[26] = "elementLocator.png";
            jsFiles[27] = "redbox.png";
            //
            jsFiles[28] = "validate.png";
            jsFiles[29] = "addmeta.png";
            jsFiles[30] = "addscript.png";
            jsFiles[31] = "addcss.png";
            jsFiles[32] = "addlink.png";
            jsFiles[33] = "tableHead.png";
            jsFiles[34] = "tableFoot.png";
            jsFiles[35] = "addthead.png";
            jsFiles[36] = "addtfoot.png";
            jsFiles[37] = "html_col.png";
            jsFiles[38] = "newAbove.png";
            jsFiles[39] = "newBelow.png";
            //
            jsFiles[40] = "newLeft.png";
            jsFiles[41] = "newRight.png";
            jsFiles[42] = "mergeLeft.png";
            jsFiles[43] = "mergeRight.png";
            jsFiles[44] = "mergeAbove.png";
            jsFiles[45] = "mergeBelow.png";
            jsFiles[46] = "splitH.png";
            jsFiles[47] = "splitV.png";
            jsFiles[48] = "html_img.png";
            jsFiles[49] = "newDefinition.png";
            jsFiles[50] = "newOptionGroup.png";
            jsFiles[51] = "html_h1.png";
            jsFiles[52] = "html_h2.png";
            jsFiles[53] = "html_h3.png";
            jsFiles[54] = "html_h4.png";
            jsFiles[55] = "html_h5.png";
            jsFiles[56] = "html_h6.png";
            //
            jsFiles[57] = "addarea.png";
            jsFiles[58] = "newlegend.png";
            jsFiles[59] = "addparam.png";
            jsFiles[60] = "moveleft.png";
            jsFiles[61] = "moveright.png";
            jsFiles[62] = "html_a.png";
            jsFiles[63] = "html_bdo.png";
            jsFiles[64] = "html_blockquote.png";
            jsFiles[65] = "html_button.png";
            jsFiles[66] = "html_checkbox.png";
            jsFiles[67] = "html_cite.png";
            jsFiles[68] = "html_code.png";
            jsFiles[69] = "html_dl.png";
            jsFiles[70] = "html_div.png";
            jsFiles[71] = "html_fieldset.png";
            jsFiles[72] = "html_file.png";
            //
            jsFiles[73] = "html_form.png";
            jsFiles[74] = "html_h.png";
            jsFiles[75] = "html_hr.png";
            jsFiles[76] = "html_hidden.png";
            jsFiles[77] = "html_iframe.png";
            jsFiles[78] = "html_a.png";
            jsFiles[79] = "html_input.png";
            jsFiles[80] = "html_kbd.png";
            jsFiles[81] = "html_label.png";
            jsFiles[82] = "html_br.png";
            jsFiles[83] = "html_ul.png";
            jsFiles[84] = "html_select.png";
            jsFiles[85] = "html_map.png";
            jsFiles[86] = "html_object.png";
            jsFiles[87] = "html_ol.png";
            jsFiles[88] = "html_p.png";
            //
            jsFiles[89]  = "html_password.png";
            jsFiles[90]  = "html_pre.png";
            jsFiles[91]  = "html_span.png";
            jsFiles[92]  = "html_radio.png";
            jsFiles[93]  = "html_reset.png";
            jsFiles[94]  = "html_samp.png";
            jsFiles[95]  = "html_submit.png";
            jsFiles[96]  = "html_table.png";
            jsFiles[97]  = "html_textarea.png";
            jsFiles[98]  = "html_var.png";
            jsFiles[99]  = "html_menu.png";
            jsFiles[100] = "html_treeview.png";
            jsFiles[101] = "html_embed.png";
            jsFiles[102] = "html_music.png";
            jsFiles[103] = "html_video.png";
            jsFiles[104] = "bold_act.png";
            //
            jsFiles[105] = "italic_act.png";
            jsFiles[106] = "underline_act.png";
            jsFiles[107] = "strikethrough_act.png";
            jsFiles[108] = "subscript_act.png";
            jsFiles[109] = "superscript_act.png";
            jsFiles[110] = "alignLeft.png";
            jsFiles[111] = "alignCenter.png";
            jsFiles[112] = "alignRight.png";
            jsFiles[113] = "indent.png";
            jsFiles[114] = "dedent.png";
            jsFiles[115] = "editor.png";
            //
            jsFiles[116] = "arrow.gif";
            jsFiles[117] = "cross.gif";
            jsFiles[118] = "hs.png";
            jsFiles[119] = "hv.png";
            //
            string btimg;
            string dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "libjs");

            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(dir, jsFiles[i]);
                if (File.Exists(btimg))
                {
                    bool b;
                    _resourceFiles.Add(new WebResourceFile(btimg, "libjs", out b));
                }
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            XmlElement xe = (XmlElement)node;

            xe.IsEmpty = false;
        }
示例#13
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlNode brNode = node.OwnerDocument.CreateElement("br");

            ((XmlElement)node).IsEmpty = false;
            node.AppendChild(brNode);
            if (_resourceFiles == null)
            {
                _resourceFiles = new List <WebResourceFile>();
            }
            //
            string[] jsFiles = new string[16];
            jsFiles[0]  = "empty_0.png";
            jsFiles[1]  = "empty_dn.png";
            jsFiles[2]  = "empty_up.png";
            jsFiles[3]  = "empty_up_dn.png";
            jsFiles[4]  = "h1.png";
            jsFiles[5]  = "l_up_dn.png";
            jsFiles[6]  = "minus_0.png";
            jsFiles[7]  = "minus_dn.png";
            jsFiles[8]  = "minus_up.png";
            jsFiles[9]  = "minus_up_dn.png";
            jsFiles[10] = "plus_0.png";
            jsFiles[11] = "plus_dn.png";
            jsFiles[12] = "plus_up.png";
            jsFiles[13] = "plus_up_dn.png";
            jsFiles[14] = "vl.png";
            jsFiles[15] = "w20.png";
            string btimg;
            string dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "webTreeView");

            for (int i = 0; i < jsFiles.Length; i++)
            {
                btimg = Path.Combine(dir, jsFiles[i]);
                if (File.Exists(btimg))
                {
                    bool b;
                    _resourceFiles.Add(new WebResourceFile(btimg, "treeview", out b));
                }
            }
            dir   = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "libjs");
            btimg = Path.Combine(dir, "html_file.png");
            if (File.Exists(btimg))
            {
                bool b;
                _resourceFiles.Add(new WebResourceFile(btimg, "libjs", out b));
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            sb.Append("border-style:");
            sb.Append(_borderStyle);
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        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());
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            StringBuilder sb;
            XmlNode       pNode;
            string        id = XmlUtil.GetAttribute(node, "id");

            if (string.IsNullOrEmpty(id))
            {
                id = CodeName;
            }
            XmlUtil.SetAttribute(node, "id", string.Format(CultureInfo.InvariantCulture, "{0}sp", id));
            XmlUtil.RemoveAttribute(node, "name");
            sb = new StringBuilder();
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            if (_dataNode != null)
            {
                pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
            }
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            XmlNode chkNode = node.OwnerDocument.CreateElement("input");

            node.AppendChild(chkNode);
            XmlUtil.SetAttribute(chkNode, "id", id);
            XmlUtil.SetAttribute(chkNode, "type", "radio");
            XmlUtil.SetAttribute(chkNode, "value", this.Value);
            if (this.Parent != null)
            {
                if (groupId >= 0)
                {
                    XmlUtil.SetAttribute(chkNode, "name", string.Format(CultureInfo.InvariantCulture, "r{0}_{1}", this.Parent.Name, groupId));
                }
                else
                {
                    XmlUtil.SetAttribute(chkNode, "name", string.Format(CultureInfo.InvariantCulture, "r{0}", this.Parent.Name));
                }
            }
            if (this.Checked)
            {
                XmlUtil.SetAttribute(chkNode, "checked", this.Checked);
            }
            sb = new StringBuilder();
            if (_dataNode != null)
            {
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(chkNode, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            string st = sb.ToString();

            if (st.Length > 0)
            {
                XmlUtil.SetAttribute(chkNode, "style", st);
            }
            {
                XmlElement tn = node.OwnerDocument.CreateElement("span");
                if (string.IsNullOrEmpty(this.Text))
                {
                    tn.IsEmpty = false;
                }
                else
                {
                    tn.InnerText = this.Text;
                }
                //
                XmlUtil.SetAttribute(tn, "id", string.Format(CultureInfo.InvariantCulture, "{0}tx", id));
                //
                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("; ");
                    }
                }
                //
                sb.Append("color:");
                sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
                sb.Append("; ");
                //
                WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, true);
                //
                XmlUtil.SetAttribute(tn, "style", sb.ToString());
                node.InsertAfter(tn, chkNode);
            }
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            if (!string.IsNullOrEmpty(_imageFilepath))
            {
                if (File.Exists(_imageFilepath))
                {
                    WebResourceFile wf = new WebResourceFile(_imageFilepath, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _imageFilepath = wf.ResourceFile;
                    }
                    XmlNode imgNode = node.OwnerDocument.CreateElement("img");
                    node.AppendChild(imgNode);
                    XmlUtil.SetAttribute(imgNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_imageFilepath)));
                }
            }
            XmlElement ndTxt = node.OwnerDocument.CreateElement("span");

            node.AppendChild(ndTxt);
            ndTxt.InnerText = this.Text;
            ndTxt.IsEmpty   = false;
            //
            XmlUtil.SetAttribute(node, "direction", _direction.ToString().ToLowerInvariant());
            XmlUtil.SetAttribute(node, "scrollamount", _scrollAmount);
            if (_bounce)
            {
                XmlUtil.SetAttribute(node, "behavior", "alternate");
            }
            else
            {
                XmlUtil.SetAttribute(node, "behavior", "scroll");
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            if (!string.IsNullOrEmpty(_bkImageFilepath))
            {
                if (File.Exists(_bkImageFilepath))
                {
                    _resourceFiles.Add(new WebResourceFile(_bkImageFilepath, WebResourceFile.WEBFOLDER_Images, out b));
                    sb.Append("background-image:url(");
                    sb.Append(WebResourceFile.WEBFOLDER_Images);
                    sb.Append("/");
                    sb.Append(Path.GetFileName(_bkImageFilepath));
                    sb.Append("); ");
                }
            }
            //
            sb.Append("border-width:");
            sb.Append(_borderWidth.ToString(CultureInfo.InvariantCulture));
            sb.Append("; ");
            //
            sb.Append("border-style:");
            sb.Append(_borderStyle.ToString().ToLowerInvariant());
            sb.Append("; ");
            //
            sb.Append("border-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(_brColor));
            sb.Append("; ");
            //
            sb.Append("background-color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor));
            sb.Append("; ");
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlElement tNode = node.OwnerDocument.CreateElement("legend");

            node.AppendChild(tNode);
            tNode.InnerText = this.Text;
            tNode.IsEmpty   = false;
            //
            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("; ");
                }
            }
            //
            sb.Append("color:");
            sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor));
            sb.Append("; ");
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
        }
示例#18
0
        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)
        {
            //
            _resourceFiles = new List <WebResourceFile>();
            _htmlParts     = new Dictionary <string, string>();

            bool   b;
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "limnortabs.css");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b));
            }
            //
            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            WebPageCompilerUtility.GetElementStyleSize(this, out _widthStyle, out _heighStyle);
            //
            StringBuilder sb = new StringBuilder();

            //
            if (this.Parent is HtmlFlowLayout)
            {
                sb.Append("min-height:");
                sb.Append(this.Height.ToString(CultureInfo.InvariantCulture));
                sb.Append("px;overflow:hidden;");
            }
            else
            {
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positiontype);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            //
            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            string   fnt = ObjectCreationCodeGen.GetFontStyleString(this.Font);
            Graphics g   = this.CreateGraphics();

            g.PageUnit = GraphicsUnit.Pixel;
            float tabloc = (float)10;

            //
            for (int i = 0; i < TabPages.Count; i++)
            {
                TabPage p        = this.TabPages[i];
                XmlNode pageNode = node.OwnerDocument.CreateElement("section");
                node.AppendChild(pageNode);
                XmlUtil.SetAttribute(pageNode, "id", p.Name);
                XmlNode h2 = node.OwnerDocument.CreateElement("h2");
                pageNode.AppendChild(h2);
                XmlNode a = node.OwnerDocument.CreateElement("a");
                h2.AppendChild(a);
                a.InnerText = p.Text;
                XmlUtil.SetAttribute(a, "href", string.Format(CultureInfo.InvariantCulture, "#{0}", p.Name));
                SizeF         txtSize  = g.MeasureString(p.Text, this.Font);
                float         txtwidth = txtSize.Width + (float)6.0;
                StringBuilder h2style  = new StringBuilder(fnt);
                h2style.Append(string.Format(CultureInfo.InvariantCulture, "width:{0}px;", Math.Round(txtwidth, 2)));
                if (i > 0)
                {
                    h2style.Append(string.Format(CultureInfo.InvariantCulture, "left:{0}px;", Math.Round(tabloc, 2)));
                }
                tabloc = tabloc + txtwidth + (float)3;
                XmlUtil.SetAttribute(h2, "style", h2style.ToString());
                foreach (Control ct in p.Controls)
                {
                    createControlWebContents(ct, pageNode);
                }
                StringBuilder sbPageStyle = new StringBuilder();
                if (p.BackColor != Color.Empty && p.BackColor != Color.Transparent)
                {
                    sbPageStyle.Append("background-color:");
                    sbPageStyle.Append(ObjectCreationCodeGen.GetColorString(p.BackColor));
                    sbPageStyle.Append(";");
                }
                if (!string.IsNullOrEmpty(_widthStyle))
                {
                    sbPageStyle.Append("width:");
                    sbPageStyle.Append(_widthStyle);
                }
                if (!string.IsNullOrEmpty(_heighStyle))
                {
                    sbPageStyle.Append("height:");
                    sbPageStyle.Append(_heighStyle);
                }
                if (sbPageStyle.Length > 0)
                {
                    XmlUtil.SetAttribute(pageNode, "style", sbPageStyle.ToString());
                }
            }
        }
示例#20
0
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            XmlUtil.SetAttribute(node, "classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
            XmlUtil.SetAttribute(node, "width", this.Width);
            XmlUtil.SetAttribute(node, "height", this.Height);
            XmlUtil.SetAttribute(node, "align", "middle");
            if (!string.IsNullOrEmpty(PlayerDownloadUrl))
            {
                XmlUtil.SetAttribute(node, "codebase", PlayerDownloadUrl);
            }
            _resourceFiles = new List <WebResourceFile>();
            WebResourceFile wf;
            string          swf = string.Empty;

            if (!string.IsNullOrEmpty(_swfFile))
            {
                if (File.Exists(_swfFile))
                {
                    wf = new WebResourceFile(_swfFile, WebResourceFile.WEBFOLDER_Images, out b);
                    _resourceFiles.Add(wf);
                    if (b)
                    {
                        _swfFile = wf.ResourceFile;
                    }
                    swf = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_swfFile));
                }
            }
            string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif");

            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png");
            if (File.Exists(btimg))
            {
                _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b));
            }
            setParam(node, "movie", swf);
            //
            setParam(node, "quality", Quality.ToString());
            //
            setParam(node, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            if (!Play)
            {
                setParam(node, "play", "false");
            }
            if (!Loop)
            {
                setParam(node, "loop", "false");
            }
            if (Menu)
            {
                setParam(node, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                setParam(node, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                setParam(node, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                setParam(node, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                setParam(node, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                setParam(node, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                setParam(node, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }
            //
            XmlNode embedNode = node.OwnerDocument.CreateElement("embed");

            node.AppendChild(embedNode);
            XmlUtil.SetNameAttribute(embedNode, this.CodeName);
            XmlUtil.SetAttribute(embedNode, "src", swf);
            XmlUtil.SetAttribute(embedNode, "width", this.Width);
            XmlUtil.SetAttribute(embedNode, "height", this.Height);
            XmlUtil.SetAttribute(embedNode, "bgcolor", ObjectCreationCodeGen.GetColorString(this.BackColor));
            XmlUtil.SetAttribute(embedNode, "quality", this.Quality);
            XmlUtil.SetAttribute(embedNode, "name", Path.GetFileName(swf));
            XmlUtil.SetAttribute(embedNode, "type", "application/x-shockwave-flash");
            XmlUtil.SetAttribute(embedNode, "PLUGINSPAGE", "http://www.macromedia.com/go/getflashplayer");
            if (!Play)
            {
                XmlUtil.SetAttribute(embedNode, "play", "false");
            }
            if (!Loop)
            {
                XmlUtil.SetAttribute(embedNode, "loop", "false");
            }
            if (Menu)
            {
                XmlUtil.SetAttribute(embedNode, "menu", "true");
            }
            if (PlayScale != EnumFlashScale.@default)
            {
                XmlUtil.SetAttribute(embedNode, "scale", PlayScale.ToString());
            }
            if (Align != EnumFlashAlign.Default)
            {
                XmlUtil.SetAttribute(embedNode, "salign", Align.ToString());
            }
            if (WindowMode != EnumFlashWindowMode.window)
            {
                XmlUtil.SetAttribute(embedNode, "wmode", WindowMode.ToString());
            }
            if (!string.IsNullOrEmpty(BaseUrl))
            {
                XmlUtil.SetAttribute(embedNode, "base", BaseUrl);
            }
            if (AllowFullScreen)
            {
                XmlUtil.SetAttribute(embedNode, "allowFullScreen", "true");
            }
            if (FullScreenAspectRatio != EnumFlashFullScreenAspectRatio.Default)
            {
                XmlUtil.SetAttribute(embedNode, "fullScreenAspectRatio", FullScreenAspectRatio.ToString());
            }

            StringBuilder style = new StringBuilder();

            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style);
            WebPageCompilerUtility.CreateElementPosition(this, style, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false);

            XmlUtil.SetAttribute(node, "style", style.ToString());
            //
        }
        public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId)
        {
            bool b;

            XmlUtil.SetAttribute(node, "tabindex", this.TabIndex);
            WebPageCompilerUtility.SetWebControlAttributes(this, node);
            _resourceFiles = new List <WebResourceFile>();
            if (File.Exists(_filepath))
            {
                WebResourceFile wf = new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b);
                _resourceFiles.Add(wf);
                if (b)
                {
                    _filepath = wf.ResourceFile;
                }
                XmlUtil.SetAttribute(node, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_filepath)));
            }
            if (!string.IsNullOrEmpty(Description))
            {
                XmlUtil.SetAttribute(node, "alt", Description);
            }
            if (!string.IsNullOrEmpty(MouseOverText))
            {
                XmlUtil.SetAttribute(node, "title", MouseOverText);
            }
            //
            StringBuilder sb = new StringBuilder();

            //
            if (ImageSizeMode == EnumHtmlImageSizeMode.Stretch)
            {
                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("%; ");
                    }
                }
            }
            //
            WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb);
            WebPageCompilerUtility.CreateElementPosition(this, sb, positionType);
            WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false);
            //
            if (_dataNode != null)
            {
                XmlNode pNode = _dataNode.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
                        {
                        }
                    }
                }
                sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font));
                //
                pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture,
                                                                 "{0}[@name='disabled']", XmlTags.XML_PROPERTY));
                if (pNode != null)
                {
                    string s = pNode.InnerText;
                    if (!string.IsNullOrEmpty(s))
                    {
                        try
                        {
                            b = Convert.ToBoolean(s, CultureInfo.InvariantCulture);
                            if (b)
                            {
                                XmlUtil.SetAttribute(node, "disabled", "disabled");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }

            XmlUtil.SetAttribute(node, "style", sb.ToString());
            //
            WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap);
        }