public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "Visible") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.style.display", CodeName)); } if (string.CompareOrdinal(attributeName, "BackColor") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.style.backgroundColor", CodeName)); } if (string.CompareOrdinal(attributeName, "Text") == 0) { return(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.GetInnerText({0})", CodeName)); } if (string.CompareOrdinal(attributeName, "ForeColor") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.style.color", CodeName)); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
//======================================================================================================== #endregion #endregion #region private methods private void createControlWebContents(Control ct, XmlNode parentNode, int groupId) { XmlNode nodeNext = parentNode; IWebClientControl webc = ct as IWebClientControl; if (webc != null) { XmlNode nd = parentNode.OwnerDocument.CreateElement(webc.ElementName); parentNode.AppendChild(nd); XmlUtil.SetAttribute(nd, "id", webc.CodeName); webc.CreateHtmlContent(nd, EnumWebElementPositionType.Auto, groupId); WebPageCompilerUtility.CreateElementAnchor(webc, nd); _resourceFiles.AddRange(webc.GetResourceFiles()); Dictionary <string, string> hp = webc.HtmlParts; if (hp != null && hp.Count > 0) { foreach (KeyValuePair <string, string> kv in hp) { _htmlParts.Add(kv.Key, kv.Value); } } nodeNext = nd; } IWebPageLayout lt = ct as IWebPageLayout; if (lt == null) { foreach (Control c in ct.Controls) { createControlWebContents(c, nodeNext, groupId); } } }
static HtmlListBox() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("Items"); _propertyNames.Add("Name"); _propertyNames.Add("disabled"); _propertyNames.Add("Font"); _propertyNames.Add("BackColor"); _propertyNames.Add("ForeColor"); _propertyNames.Add("Visible"); _propertyNames.Add("MultiSelection"); _propertyNames.Add("TabIndex"); _propertyNames.Add("Opacity"); _propertyNames.Add("SelectedValue"); _propertyNames.Add("SelectedItem"); _propertyNames.Add("SelectedIndex"); _propertyNames.Add("DataBindings"); // _propertyNames.Add("selectedIndex"); _propertyNames.Add("selectedValue"); _propertyNames.Add("selectedItem"); _propertyNames.Add("AddBlankOnDataBinding"); _propertyNames.Add("length"); }
static HtmlMarquee() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("BackgroundImage"); _propertyNames.Add("BackgroundImageLayout"); _propertyNames.Add("AccessibleDescription"); _propertyNames.Add("AccessibleName"); _propertyNames.Add("AccessibleRole"); _propertyNames.Add("AllowDrop"); _propertyNames.Add("Anchor"); _propertyNames.Add("CausesValidation"); _propertyNames.Add("Dock"); _propertyNames.Add("ContextMenuStrip"); _propertyNames.Add("ImeMode"); _propertyNames.Add("Margin"); _propertyNames.Add("MaximumSize"); _propertyNames.Add("MinimumSize"); _propertyNames.Add("Padding"); _propertyNames.Add("RightToLeft"); // _propertyNames.Add("TabIndex"); _propertyNames.Add("TabStop"); _propertyNames.Add("Tag"); _propertyNames.Add("UseWaitCursor"); _propertyNames.Add("Opacity"); // _clientPropertyNames = new StringCollection(); _clientPropertyNames.Add("BackColor"); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "IsFileTypeValid") == 0) { if (!string.IsNullOrEmpty(returnReceiver)) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}=({1}.value.split('.').pop().toLowerCase()>=0);\r\n", returnReceiver, WebPageCompilerUtility.JsCodeRef(CodeName))); } } else if (string.CompareOrdinal(methodName, "IsFileSizeValid") == 0) { if (!string.IsNullOrEmpty(returnReceiver)) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}.jsData.IsFileSizeValid();\r\n", returnReceiver, WebPageCompilerUtility.JsCodeRef(CodeName))); } } else if (string.CompareOrdinal(methodName, "SetMaxFileSize") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.SetMaxFileSize({1});\r\n", WebPageCompilerUtility.JsCodeRef(CodeName), parameters[0])); } else { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); } }
static HtmlFileBrowser() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("Name"); _propertyNames.Add("TabIndex"); _propertyNames.Add("disabled"); _propertyNames.Add("Visible"); _propertyNames.Add("TabIndex"); _propertyNames.Add("Opacity"); _propertyNames.Add("BorderStyle"); // _propertyNames.Add("StartWebFolder"); _propertyNames.Add("StartWebFolderTitle"); _propertyNames.Add("FileTypes"); _propertyNames.Add("SelectedFilePath"); _propertyNames.Add("SelectedFilename"); _propertyNames.Add("SelectedFolderPath"); _propertyNames.Add("SelectedFolderName"); // _propertyNames.Add("noteFontFamily"); _propertyNames.Add("noteFontSize"); _propertyNames.Add("noteFontColor"); _propertyNames.Add("mouseOverColor"); _propertyNames.Add("nodeBackColor"); _propertyNames.Add("selectedNodeColor"); _propertyNames.Add("DontLoadRootFoldersOnStart"); }
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 string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "FileTypes") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.FileTypes", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFilename") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFile()", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFilePath") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFileFullPath()", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFolderName") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFolder()", CodeName)); } if (string.CompareOrdinal(attributeName, "SelectedFolderPath") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getSelectedFolderFullPath()", CodeName)); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal(methodName, "ClearFiles") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').loader.ClearFiles();\r\n", this.Site.Name)); } else if (string.CompareOrdinal(methodName, "RemoveFile") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').loader.RemoveFile({1});\r\n", this.Site.Name, parameters[0])); } else if (string.CompareOrdinal(methodName, "GetFiles") == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').loader.GetFiles();\r\n", this.Site.Name)); } else { WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); } }
public void OnWebPageLoaded(StringCollection sc) { sc.Add("limnorPage.objects=limnorPage.objects||{};\r\n"); sc.Add("var "); string f = string.Format(CultureInfo.InvariantCulture, "f{0}", Guid.NewGuid().GetHashCode().ToString("x", CultureInfo.InvariantCulture)); sc.Add(f); sc.Add("={};\r\n"); if (_fields != null) { foreach (KeyValuePair <string, string> kv in _fields) { sc.Add(f); sc.Add("."); sc.Add(kv.Key); sc.Add("='"); if (!string.IsNullOrEmpty(kv.Value)) { sc.Add(kv.Value.Replace("'", "\\'")); } sc.Add("';\r\n"); } } sc.Add(CodeName); sc.Add("=limnorUtility.string('"); if (!string.IsNullOrEmpty(_value)) { sc.Add(WebPageCompilerUtility.FormStringContents(this._value)); } sc.Add("',"); sc.Add(f); sc.Add(");\r\n"); }
public string MapJavaScriptCodeName(string name) { string s = WebPageCompilerUtility.MapJavaScriptCodeName(name); if (s != null) { return(s); } if (string.CompareOrdinal(name, "GroupsPerPage") == 0) { return("jsData.groupsPerPage()"); } if (string.CompareOrdinal(name, "CurrentPageIndex") == 0) { return("jsData.getPageIndex()"); } if (string.CompareOrdinal(name, "TotalPages") == 0) { return("jsData.getTotalPages()"); } if (string.CompareOrdinal(name, "CurrentGroupIndex") == 0) { return("jsData.getTotalPages()"); } if (string.CompareOrdinal(name, "PageNavigatorPages") == 0) { return("jsData.getNavigatorPages()"); } return(name); }
public string GetJavaScriptWebMethodReferenceCode(string ownerCodeName, string methodName, StringCollection code, StringCollection parameters) { if (string.CompareOrdinal(methodName, "MoveToNextPage") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.gotoNextPage()", CodeName)); } else if (string.CompareOrdinal(methodName, "MoveToPreviousPage") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.gotoPrevPage()", CodeName)); } else if (string.CompareOrdinal(methodName, "MoveToFirstPage") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.gotoFirstPage()", CodeName)); } else if (string.CompareOrdinal(methodName, "MoveToLastPage") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.gotoLastPage()", CodeName)); } else if (string.CompareOrdinal(methodName, "MoveToPage") == 0) { if (parameters == null || parameters.Count == 0) { throw new WebBuilderException("HtmlDataRepeater is Missing parameters for MoveToPage"); } return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.gotoPage({1})", CodeName, parameters[0])); } else { return(WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(ownerCodeName, methodName, code, parameters)); } //return null; }
public string GetJavaScriptWebMethodReferenceCode(string ownerCodeName, string methodName, StringCollection code, StringCollection parameters) { if (string.CompareOrdinal(methodName, "IsFileTypeValid") == 0) { return(string.Format(CultureInfo.InvariantCulture, "({0}.value.split('.').pop().toLowerCase()>=0)", Site.Name)); } return(WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(ownerCodeName, methodName, code, parameters)); }
static HtmlRichTextEditor() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("Name"); _propertyNames.Add("HeightInPercent"); _propertyNames.Add("WidthInPercent"); _propertyNames.Add("Visible"); }
public string GetJavaScriptWebMethodReferenceCode(string ownerCodeName, string methodName, StringCollection code, StringCollection parameters) { if (string.CompareOrdinal(methodName, "getPrimaryKey") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.jsData.getPrimaryKey()", ownerCodeName)); } return(WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(ownerCodeName, methodName, code, parameters)); }
public virtual string MapJavaScriptVallue(string name, string value) { string s = WebPageCompilerUtility.MapJavaScriptVallue(name, value, _resourceFiles); if (s != null) { return(s); } return(value); }
public string MapJavaScriptCodeName(string name) { string s = WebPageCompilerUtility.MapJavaScriptCodeName(name); if (s != null) { return(s); } return(name); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { if (string.CompareOrdinal("AdjustHeight", methodName) == 0) { code.Add(string.Format(CultureInfo.InvariantCulture, "JsonDataBinding.adjustElementHeight({0});\r\n", WebPageCompilerUtility.JsCodeRef(CodeName))); return; } WebPageCompilerUtility.CreateActionJavaScript(WebPageCompilerUtility.JsCodeRef(CodeName), methodName, code, parameters, returnReceiver); }
static HtmlDatePicker() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("Name"); _propertyNames.Add("disabled"); _propertyNames.Add("Visible"); _propertyNames.Add("FontSize"); _propertyNames.Add("IncludeTime"); _propertyNames.Add("SelectedDateTime"); _propertyNames.Add("Movable"); }
static HtmlFileUploadGroup() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("Name"); _propertyNames.Add("FileUploaders"); _propertyNames.Add("BackColor"); _propertyNames.Add("Visible"); _propertyNames.Add("FileUploaderCount"); _propertyNames.Add("Controls"); _propertyNames.Add("SavedFilePaths"); _propertyNames.Add("Opacity"); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "Started") == 0) { return("handle"); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
public string MapJavaScriptCodeName(string name) { if (string.CompareOrdinal(name, "Text") == 0) { return("innerText"); } string s = WebPageCompilerUtility.MapJavaScriptCodeName(name); if (s != null) { return(s); } return(name); }
public virtual string MapJavaScriptVallue(string name, string value) { string s = WebPageCompilerUtility.MapJavaScriptVallue(name, value, _resourceFiles); if (s != null) { return(s); } if (string.CompareOrdinal(name, "ImageData") == 0) { if (string.IsNullOrEmpty(value)) { return("null"); } return(string.Format(CultureInfo.InvariantCulture, "('data:image/jpg;base64,'+{0})", value)); } if (string.CompareOrdinal(name, "ImageFilePath") == 0) { if (!string.IsNullOrEmpty(value)) { string f = null; if (value.StartsWith("'", StringComparison.Ordinal)) { f = value.Substring(1); if (f.EndsWith("'", StringComparison.Ordinal)) { f = f.Substring(0, f.Length - 1); } } if (!string.IsNullOrEmpty(f)) { if (File.Exists(f)) { bool b; _resourceFiles.Add(new WebResourceFile(f, WebResourceFile.WEBFOLDER_Images, out b)); return(string.Format(CultureInfo.InvariantCulture, "'{0}/{1}'", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(f))); } else { if (value.IndexOf('.') >= 0 && value.IndexOf('/') >= 0) //assume it is an image file path { return(string.Format(CultureInfo.InvariantCulture, "'{0}'", f)); } //otherwise assume it is a variable } } } } return(value); }
public string MapJavaScriptCodeName(string name) { if (string.CompareOrdinal(name, "SelectedIndex") == 0) { return("selectedIndex"); } string s = WebPageCompilerUtility.MapJavaScriptCodeName(name); if (s != null) { return(s); } return(name); }
public string MapJavaScriptCodeName(string name) { if (string.CompareOrdinal(name, "FilePathAtClient") == 0) { return("value"); } string s = WebPageCompilerUtility.MapJavaScriptCodeName(name); if (s != null) { return(s); } return(name); }
static HtmlGroupBox() { _propertyNames = new StringCollection(); WebPageCompilerUtility.AddWebControlProperties(_propertyNames); _propertyNames.Add("Name"); _propertyNames.Add("Text"); _propertyNames.Add("disabled"); _propertyNames.Add("Font"); _propertyNames.Add("BackColor"); _propertyNames.Add("ForeColor"); _propertyNames.Add("Visible"); _propertyNames.Add("Controls"); _propertyNames.Add("Opacity"); }
public string GetJavaScriptReferenceCode(StringCollection method, string attributeName, string[] parameters) { if (string.CompareOrdinal(attributeName, "Text") == 0) { return(string.Format(CultureInfo.InvariantCulture, "{0}.value", WebPageCompilerUtility.JsCodeRef(CodeName))); } string s = WebPageCompilerUtility.GetJavaScriptWebMethodReferenceCode(WebPageCompilerUtility.JsCodeRef(CodeName), attributeName, method, parameters); if (!string.IsNullOrEmpty(s)) { return(s); } return(null); }
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]); } // }
public void CreateActionJavaScript(string methodName, StringCollection code, StringCollection parameters, string returnReceiver) { string nm; if (this.Site == null && (string.IsNullOrEmpty(id) || string.CompareOrdinal(id, "''") == 0) && !string.IsNullOrEmpty(_vaname)) { nm = _vaname; } else { nm = WebPageCompilerUtility.JsCodeRef(CodeName); } WebPageCompilerUtility.CreateActionJavaScript(nm, methodName, code, parameters, returnReceiver); }