public static bool CodeCheck(System.Web.HttpServerUtility server, XmlNode renderingDocument) { string val = (renderingDocument.Attributes["src"]).Value; // decode value val = server.HtmlDecode(val.Replace("'", "'")); // not allowed code val = val.Replace(" ", "").ToLower(); if (val.Contains("<script") || val.Contains("<iframe") || val.Contains("</body") || val.Contains("</html") ) { return(false); } int commStart = val.LastIndexOf("<!--"); if (commStart >= 0 && val.LastIndexOf("-->") < commStart) { return(false); } return(true); }
/// <summary> /// 生成一个单键 cookie. 如果指定的名称已存在, 则删除原有cookie. /// </summary> /// <param name="cookieName">要生成的cookie名 </param> /// <param name="value">键值 </param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="server"></param> /// <returns>生成成功则返回真, 否则返回假.</returns> public static bool GenCookie(string cookieName, string value, System.Web.HttpRequest request, System.Web.HttpResponse response, System.Web.HttpServerUtility server) { if (CheckCookie(cookieName, request) == true) { if (!RemoveCookie(cookieName, request, response)) { return(false); } } System.Web.HttpCookie objCookie = new System.Web.HttpCookie(cookieName); objCookie.Value = server.UrlEncode(value); try { response.AppendCookie(objCookie); } catch (Exception ex) { return(false); } return(true); }
/// <summary> /// 静态构造函数,创建路径 /// </summary> static ReportBase() { System.Web.HttpServerUtility Server = System.Web.HttpContext.Current.Server; if (Option.IsSendScriptFile) { string tempStr = Server.MapPath(_ScriptPath).Substring(Server.MapPath(@"\").Length).Split('\\')[0]; _ScriptPath = (string.Compare(tempStr, "Skyever", true) == 0?"":@"\" + tempStr) + @"\" + _ScriptPath; if (!System.IO.Directory.Exists(Server.MapPath(_ScriptPath))) { try { System.IO.Directory.CreateDirectory(Server.MapPath(_ScriptPath)); } catch { Option.IsSendScriptFile = false; } } } else { try { foreach (string fileName in System.IO.Directory.GetFiles(Server.MapPath(_ScriptPath), "*.js")) { System.IO.File.Delete(fileName); } } catch {} } }
public static void ErrorHandler(Exception Ex, System.Web.HttpServerUtility Server) { if (Ex != null) { return; } ErrorHandler(Ex, "", Server); }
public Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument) { UpdatePanel up = new UpdatePanel(); ChoicePanel cp = new ChoicePanel(renderingDocument, namedChoice, schemas, value); up.ContentTemplateContainer.Controls.Add(cp); return(up); }
/// <summary> /// 得到周计划的项目明细 /// </summary> /// <param name="f1"></param> /// <param name="saveFileName"></param> /// <returns></returns> public List <Tb_PlanDetailDD> GetWeekPlanDetailListByExcel(System.Web.UI.WebControls.FileUpload f1, ref String saveFileName) { List <Tb_PlanDetailDD> list1 = new List <Tb_PlanDetailDD>(); try { if (f1.HasFile) { System.Web.HttpServerUtility server = System.Web.HttpContext.Current.Server; saveFileName = "/Attachment/Plan/" + WebFrame.Util.JString.GetUnique32ID() + System.IO.Path.GetExtension(f1.FileName); String fname = server.MapPath(saveFileName); UExcel u1 = new UExcel(XlsFormat.Xls2003); f1.SaveAs(fname); DataSet ds1 = u1.XlsToDataSet(fname); DataTable dt1 = ds1.Tables[0]; /* * 分类/编号/计划内容/计划开始时间/计划结束时间/工作量预估(人天)/责任人/交付物/备注 */ for (int i = 2; i < dt1.Rows.Count; i++) { if (String.IsNullOrEmpty(dt1.Rows[i][1].ToString()) == false && String.IsNullOrEmpty(dt1.Rows[i][2].ToString()) == false) { Tb_PlanDetailDD dd1 = new Tb_PlanDetailDD(); dd1.PlanKind = dt1.Rows[i][0].ToString(); dd1.PlanNum = dt1.Rows[i][1].ToString(); dd1.PlanTitel = dt1.Rows[i][2].ToString(); dd1.BegTime = DateTime.Parse(dt1.Rows[i][3].ToString()); dd1.EndTime = DateTime.Parse(dt1.Rows[i][4].ToString()); dd1.Workload = double.Parse(dt1.Rows[i][5].ToString()); //设置责任人 String zren1 = dt1.Rows[i][6].ToString(); String zrenid = KORWeb.BUL.JUserBU.GetUserIDByUserName(zren1); dd1.ExecuteManID = zrenid; dd1.ExecuteManName = zren1; dd1.PayMemo = dt1.Rows[i][7].ToString(); dd1.Remark = dt1.Rows[i][8].ToString(); dd1.ParentNum = dd1.PlanNum.Substring(0, 3); //取前3位 dd1.MaonthPlanNum = dd1.PlanNum.Substring(0, 5); //取前5位 list1.Add(dd1); } } } } catch (Exception err) { list1.Clear(); } return(list1); }
public SessionVariableManager(System.Web.SessionState.HttpSessionState session, System.Web.HttpServerUtility server, string userHostAddress, string pageName, Cache cache, System.Web.HttpApplicationState application) { _application = application; _session = session; _server = server; _userHostAddress = userHostAddress; _pageName = pageName; _cache = cache; }
public Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument) { Label lbl = new Label(); lbl.Text = (renderingDocument.Attributes["value"]).Value.FromXmlValue2Render(server); lbl.Text = lbl.Text + "<br />"; lbl.CssClass = "staticLabel"; return(lbl); }
/// <summary> /// 根据计划文件Excel得到计划明细的数据 /// </summary> /// <param name="f1"></param> /// <returns></returns> public List <Tb_PlanDetailDD> GetPlanDetailListByExcel(System.Web.UI.WebControls.FileUpload f1, ref String saveFileName) { List <Tb_PlanDetailDD> list1 = new List <Tb_PlanDetailDD>(); try { if (f1.HasFile) { System.Web.HttpServerUtility server = System.Web.HttpContext.Current.Server; saveFileName = "/Attachment/Plan/" + WebFrame.Util.JString.GetUnique32ID() + System.IO.Path.GetExtension(f1.FileName); String fname = server.MapPath(saveFileName); UExcel u1 = new UExcel(XlsFormat.Xls2003); f1.SaveAs(fname); DataSet ds1 = u1.XlsToDataSet(fname); DataTable dt1 = ds1.Tables[0]; /* * 分类/编号/计划内容/计划开始时间/计划结束时间/工作量预估(人天)/关键节点/交付物/备注 */ for (int i = 2; i < dt1.Rows.Count; i++) { if (String.IsNullOrEmpty(dt1.Rows[i][1].ToString()) == false && String.IsNullOrEmpty(dt1.Rows[i][2].ToString()) == false) { Tb_PlanDetailDD dd1 = new Tb_PlanDetailDD(); dd1.PlanKind = dt1.Rows[i][0].ToString(); dd1.PlanNum = dt1.Rows[i][1].ToString(); dd1.PlanTitel = dt1.Rows[i][2].ToString(); dd1.BegTime = DateTime.Parse(dt1.Rows[i][3].ToString()); dd1.EndTime = DateTime.Parse(dt1.Rows[i][4].ToString()); dd1.Workload = double.Parse(dt1.Rows[i][5].ToString()); dd1.KeyPlan = false; if (dt1.Rows[i][6].ToString() != String.Empty) { if (dt1.Rows[i][6].ToString() == "是" || dt1.Rows[i][6].ToString() == "1" || dt1.Rows[i][6].ToString().ToLower() == "yes" || dt1.Rows[i][6].ToString().ToLower() == "true") { dd1.KeyPlan = true; } } dd1.PayMemo = dt1.Rows[i][7].ToString(); dd1.Remark = dt1.Rows[i][8].ToString(); list1.Add(dd1); } } } } catch (Exception err) { list1.Clear(); } return(list1); }
/// <summary> /// 读取一个单键cookie /// </summary> /// <param name="cookieName"></param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="server"></param> /// <returns>返回读取到的键值</returns> public static string ReadCookie(string cookieName, System.Web.HttpRequest request, System.Web.HttpResponse response, System.Web.HttpServerUtility server) { if (CheckCookie(cookieName, request) == false) { return(""); } System.Web.HttpCookie objCookie = request.Cookies[cookieName]; return(server.UrlDecode(objCookie.Value)); }
public static void Eval_AppendJs( System.Web.HttpServerUtility Server , ref StringBuilder Sb , string ClientID , string ElementProperty , string Value ) { Sb.Append(@"var Elem = document.getElementById('" + ClientID + "');"); Sb.Append(@"if(Elem!=null){Elem." + ElementProperty + @" = unescape('" + GlobalObject.escape(Server.HtmlEncode(Value)) + "')};"); }
// Check validity of the user public static void checkValidUser(System.Web.HttpContext objHttpContext) { System.Web.SessionState.HttpSessionState objSession = objHttpContext.Session; System.Web.HttpServerUtility objServerUtil = objHttpContext.Server; string strAppUser = (String)objSession["AppUser"]; if (strAppUser == null) { objServerUtil.Transfer("Unauthorized.aspx", false); } }
public void Init(ThreadEntity threadEntity, WebSetting.WebSettingItem webSetting) { _threadEntity = threadEntity; _htmlContainer = new HTMLContainer(_threadEntity.WebSetting.Encoding); _server = _threadEntity.WebContext.Server; _url = threadEntity.URL; _updateLocalCache = false; _response = new PageResponse(_threadEntity, _htmlContainer); _request = new PageRequest(_threadEntity); _pageData = new PageData(); _pageSession = PageSessionCollection.GetInstance().GetSession(_threadEntity); _webSetting = webSetting; }
public static void Log(string sData, System.Web.HttpServerUtility s) { try { string sPath = null; sPath = s.MapPath("usgd.log"); System.IO.StreamWriter sw = new System.IO.StreamWriter(sPath, true); sw.WriteLine(System.DateTime.Now.ToString() + ", " + sData); sw.Close(); } catch (Exception) { } }
public void Init(PageAbstract page, WebSetting.WebSettingItem webSetting, HTMLContainer container) { _threadEntity = page._threadEntity; _server = page._server; _updateLocalCache = page._updateLocalCache; _request = page._request; _pageData = page._pageData; _pageSession = page._pageSession; _url = page._url; _webSetting = webSetting; _response = page._response; _response.SetNewContainer(container); _htmlContainer = container; }
public System.Data.DataSet GetDataSource(System.Web.HttpServerUtility encode) { for (int i = 0; i < assignmentDS.Tables[0].Rows.Count; i++) { for (int j = 0; j < assignmentDS.Tables[0].Columns.Count; j++) { try { assignmentDS.Tables[0].Rows[i][j] = encode.HtmlEncode(assignmentDS.Tables[0].Rows[i][j].ToString()); } catch {} } } return(assignmentDS); }
public static void ErrorHandler(Exception Ex, string ModuleName, System.Web.HttpServerUtility Server) { if (Ex == null) { return; } string Msg = "Error Log: " + ModuleName + ": " + Ex.Message; try { Msg += " : " + Ex.Source + " : " + Ex.TargetSite.Name; } catch { } string FilePath = Server.MapPath(Layer01_Constants_Web.CnsLogPath); Do_Methods.LogWrite(Msg, FilePath); }
/// <summary> /// 修改一个多键cookie的值. /// </summary> /// <param name="cookieName"></param> /// <param name="key"></param> /// <param name="value"></param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="server"></param> /// <returns></returns> public static bool ChangeKeyValue(string cookieName, string key, string value, System.Web.HttpRequest request, System.Web.HttpResponse response, System.Web.HttpServerUtility server) { if (CheckCookie(cookieName, request) == false) { return(false); } try { System.Web.HttpCookie objCookie = request.Cookies[cookieName]; objCookie.Values[key] = server.UrlEncode(value); response.AppendCookie(objCookie); } catch (Exception ex) { return(false); } return(true); }
/// <summary>Read text file for markup code.</summary> public static String ReadTextFile(System.Web.HttpServerUtility server, string filePath, bool isReplaceCarraige) { string content = String.Empty; string path = server.MapPath(filePath); // Create StreamReader object. System.IO.Stream file = new System.IO.FileStream(path, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); System.IO.StreamReader streamReader = new System.IO.StreamReader(file); // Read the entire file into a string. content = streamReader.ReadToEnd(); // Replace carraige returns with markup code. if (isReplaceCarraige) { content = content.Replace("\r\n", "<br />"); } // Close StreamReader object. streamReader.Close(); // Return content. return(content); }
public Control GetWebControl(System.Web.HttpServerUtility server, XmlNode renderingDocument) { Label lbl = new Label(); string val = (renderingDocument.Attributes["src"]).Value; // decode value from Xml val = server.HtmlDecode(val.Replace("'", "'")); //check if (StaticHtmlCode.CodeCheck(server, renderingDocument)) { lbl.Text = val + "<br />"; } else { lbl.Text = "<font color='red'>*** Error: Invalid HTML Code ***</font><br />"; } lbl.Style.Add("z-index", "200"); return(lbl); }
public Control GetWebControl(System.Web.HttpServerUtility server, XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); string url = (renderingDocument.Attributes["src"]).Value.FromXmlValue2Render(server); Image img = new Image(); img.ImageUrl = url; XmlAttribute xmlbl = renderingDocument.Attributes["renderedLabel"]; if (xmlbl != null) { Label lb = new Label(); lb.Text = (renderingDocument.Attributes["renderedLabel"]).Value.FromXmlValue2Render(server); ph.Controls.Add(lb); } if (renderingDocument.Attributes["class"] != null) { img.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server); } if (renderingDocument.Attributes["rel"] != null) { img.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server)); } XmlAttribute descr = renderingDocument.Attributes["description"]; if (descr != null) { img.ToolTip = descr.Value.FromXmlValue2Render(server); img.AlternateText = descr.Value.FromXmlValue2Render(server); } ph.Controls.Add(img); return(ph); }
public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); Label lbl = new Label(); if (renderingDocument.Attributes["renderedLabel"] != null) { lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server); } else { lbl.Text = this.Name.FromXmlName2Render(server); } lbl.CssClass = "label"; ph.Controls.Add(lbl); CheckBoxControl cbox = new CheckBoxControl(this); cbox.CausesValidation = false; if (renderingDocument.Attributes["class"] != null) { cbox.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server); } //if (renderingDocument.Attributes["rel"] != null) // cbox.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server)); if (renderingDocument.Attributes["description"] != null) { cbox.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server); } ph.Controls.Add(cbox); //no validators, yay!! return(ph); }
public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); Label lbl = new Label(); if (renderingDocument.Attributes["renderedLabel"] != null) { lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server); } else { lbl.Text = this.Name.FromXmlName2Render(server); } lbl.CssClass = "label"; ph.Controls.Add(lbl); int maxRate = 0; int.TryParse(maxRateFacet.Value, out maxRate); RatingControl starBox = new RatingControl(this, maxRate); // if (renderingDocument.Attributes["class"] != null) // starBox.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server); // if (renderingDocument.Attributes["rel"] != null) // starBox.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server)); //if (renderingDocument.Attributes["description"] != null) // starBox.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server); ph.Controls.Add(starBox); //--- validators --- return(ph); }
public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); Label lbl = new Label(); if (renderingDocument.Attributes["renderedLabel"] != null) { lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server); } else { lbl.Text = this.Name.FromXmlName2Render(server); } lbl.CssClass = "label"; ph.Controls.Add(lbl); bool isRadio = ((XmlSchemaSimpleTypeRestriction)((XmlSchemaSimpleType)elemPointer.SchemaType).Content).Facets.Count <= MAX_ELEM_BEFORE_DROPDOWN; ListControl radio; if (isRadio) { radio = new RadioButtonControl(this); } else { radio = new DropDownListControl(this); } foreach (ListItem i in radio.Items) { i.Text = i.Text.FromXmlValue2Render(server); } if (isRadio && radio.Items.Count > 0) { radio.Items[0].Selected = true; } //--Rendering Document XmlAttribute clas = renderingDocument.Attributes["class"]; XmlAttribute rel = renderingDocument.Attributes["rel"]; if (clas != null && rel != null) { foreach (ListItem el in isRadio ? ((RadioButtonControl)radio).Items : ((DropDownListControl)radio).Items) { el.Attributes.Add("class", clas.Value.FromXmlValue2Render(server)); //el.Attributes.Add("rel", rel.Value.FromXmlValue2Render(server)); } } if (renderingDocument.Attributes["description"] != null) { radio.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server); } //-- if (isRadio) { if (radio.Items.Count > MAX_ELEM_BEFORE_VERTICAL_ALIGN) { ((RadioButtonControl)radio).RepeatDirection = RepeatDirection.Vertical; // ((RadioButtonControl)radio).RepeatColumns = 5; } else { ((RadioButtonControl)radio).RepeatDirection = RepeatDirection.Horizontal; } } /* if (!Common.getElementFromSchema(baseSchema).IsNillable) * { * RequiredFieldValidator rqfv = new RequiredFieldValidator(); * rqfv.ErrorMessage = "Required field: select an option"; * rqfv.ControlToValidate = radio.ID; * rqfv.ValidationGroup = "1"; * ph.Controls.Add(rqfv); * }*/ ph.Controls.Add(radio); return(ph); }
public Metadata(string uilang, System.Web.HttpServerUtility server) { if (uilang != "") { string path = server.MapPath("/loc/" + uilang + ".strings.txt"); if (File.Exists(path)) { StreamReader reader = new StreamReader(path); while (reader.Peek() > -1) { string[] line = reader.ReadLine().Split('\t'); if (line.Length > 1) { this.strings.Add(line[0].Replace("$", ""), line[1]); } } reader.Close(); } } this.languages = new List <Language>(); this.languages.Add(new Language("cs", "Czech", "česky", true)); this.languages.Add(new Language("cy", "Welsh", "Cymraeg", true)); this.languages.Add(new Language("de", "German", "Deutsch", true)); this.languages.Add(new Language("el", "Greek", "ελληνικά", true)); this.languages.Add(new Language("en", "English", "English", true)); this.languages.Add(new Language("es", "Spanish", "español", true)); this.languages.Add(new Language("fr", "French", "français", true)); this.languages.Add(new Language("fy", "Frisian", "Frysk", true)); this.languages.Add(new Language("ga", "Irish", "Gaeilge", true)); this.languages.Add(new Language("gd", "Scottish Gaelic", "Gàidhlig", true)); this.languages.Add(new Language("hr", "Croatian", "hrvatski", true)); this.languages.Add(new Language("hu", "Hungarian", "magyar", true)); this.languages.Add(new Language("nl", "Dutch", "Nederlands", true)); this.languages.Add(new Language("pl", "Polish", "polski", true)); this.languages.Add(new Language("sco", "Scots", "Scots", true)); this.languages.Add(new Language("fi", "Finnish", "suomi", true)); this.languages.Add(new Language("sq", "Albanian", "", false)); this.languages.Add(new Language("hy", "Armenian", "", false)); this.languages.Add(new Language("rup", "Aromanian", "", false)); this.languages.Add(new Language("ast", "Asturian", "", false)); this.languages.Add(new Language("eu", "Basque", "", false)); this.languages.Add(new Language("bg", "Bulgarian", "", false)); this.languages.Add(new Language("ca", "Catalan", "", false)); this.languages.Add(new Language("kw", "Cornish", "", false)); this.languages.Add(new Language("da", "Danish", "", false)); this.languages.Add(new Language("et", "Estonian", "", false)); this.languages.Add(new Language("fo", "Faroese", "", false)); this.languages.Add(new Language("gl", "Galician", "", false)); this.languages.Add(new Language("he", "Hebrew", "", false)); this.languages.Add(new Language("is", "Icelandic", "", false)); this.languages.Add(new Language("it", "Italian", "", false)); this.languages.Add(new Language("krl", "Karelian", "", false)); this.languages.Add(new Language("kom", "Komi", "", false)); this.languages.Add(new Language("la", "Latin", "", false)); this.languages.Add(new Language("lv", "Latvian", "", false)); this.languages.Add(new Language("lt", "Lithuanian", "", false)); this.languages.Add(new Language("lb", "Luxembourgish", "", false)); this.languages.Add(new Language("mk", "Macedonian", "", false)); this.languages.Add(new Language("mt", "Maltese", "", false)); this.languages.Add(new Language("gv", "Manx", "", false)); this.languages.Add(new Language("mord", "Mordvinian", "", false)); this.languages.Add(new Language("no", "Norwegian", "", false)); this.languages.Add(new Language("pt", "Portuguese", "", false)); this.languages.Add(new Language("ro", "Romanian", "", false)); this.languages.Add(new Language("rm", "Romansh", "", false)); this.languages.Add(new Language("ru", "Russian", "", false)); this.languages.Add(new Language("smi", "Sami", "", false)); this.languages.Add(new Language("sc", "Sardinian", "", false)); this.languages.Add(new Language("sr", "Serbian", "", false)); this.languages.Add(new Language("sk", "Slovak", "", false)); this.languages.Add(new Language("sl", "Slovene", "", false)); this.languages.Add(new Language("wen", "Sorbian", "", false)); this.languages.Add(new Language("sv", "Swedish", "", false)); this.languages.Add(new Language("tr", "Turkish", "", false)); this.languages.Add(new Language("uk", "Ukrainian", "", false)); this.languages.Add(new Language("vep", "Vepsian", "", false)); this.languages.Add(new Language("yi", "Yiddish", "", false)); this.languages.Add(new Language("br", "Breton", "", false)); this.languages.Add(new Language("lmo", "Lombard", "", false)); this.languages.Add(new Language("oc", "Occitan", "", false)); this.languages.Add(new Language("sqk", "Albanian Sign Language", "", false, true)); this.languages.Add(new Language("aen", "Armenian Sign Language", "", false, true)); this.languages.Add(new Language("asq", "Austrian Sign Language", "", false, true)); this.languages.Add(new Language("bfi", "British Sign Language", "", false, true)); this.languages.Add(new Language("bqn", "Bulgarian Sign Language", "", false, true)); this.languages.Add(new Language("csc", "Catalan Sign Language", "", false, true)); this.languages.Add(new Language("csq", "Croatia Sign Language", "", false, true)); this.languages.Add(new Language("cse", "Czech Sign Language", "", false, true)); this.languages.Add(new Language("dsl", "Danish Sign Language", "", false, true)); this.languages.Add(new Language("eso", "Estonian Sign Language", "", false, true)); this.languages.Add(new Language("fss", "Finland-Swedish Sign Language", "", false, true)); this.languages.Add(new Language("fse", "Finnish Sign Language", "", false, true)); this.languages.Add(new Language("vgt", "Flemish Sign Language", "", false, true)); this.languages.Add(new Language("sfb", "French Belgian Sign Language", "", false, true)); this.languages.Add(new Language("fsl", "French Sign Language", "", false, true)); this.languages.Add(new Language("gsg", "German Sign Language", "", false, true)); this.languages.Add(new Language("gss", "Greek Sign Language", "", false, true)); this.languages.Add(new Language("hsh", "Hungarian Sign Language", "", false, true)); this.languages.Add(new Language("icl", "Icelandic Sign Language", "", false, true)); this.languages.Add(new Language("isg", "Irish Sign Language", "", false, true)); this.languages.Add(new Language("isr", "Israeli Sign Language", "", false, true)); this.languages.Add(new Language("ise", "Italian Sign Language", "", false, true)); this.languages.Add(new Language("lsl", "Latvian Sign Language", "", false, true)); this.languages.Add(new Language("lls", "Lithuanian Sign Language", "", false, true)); this.languages.Add(new Language("mdl", "Maltese Sign Language", "", false, true)); this.languages.Add(new Language("vsi", "Moldova Sign Language", "", false, true)); this.languages.Add(new Language("nsl", "Norwegian Sign Language", "", false, true)); this.languages.Add(new Language("pso", "Polish Sign Language", "", false, true)); this.languages.Add(new Language("psr", "Portuguese Sign Language", "", false, true)); this.languages.Add(new Language("rms", "Romanian Sign Language", "", false, true)); this.languages.Add(new Language("rsl", "Russian Sign Language", "", false, true)); this.languages.Add(new Language("dse", "Sign Language of the Netherlands", "", false, true)); this.languages.Add(new Language("svk", "Slovak Sign Language", "", false, true)); this.languages.Add(new Language("ssp", "Spanish Sign Language", "", false, true)); this.languages.Add(new Language("swl", "Swedish Sign Language", "", false, true)); this.languages.Add(new Language("ssr", "Swiss-French Sign Language", "", false, true)); this.languages.Add(new Language("sgg", "Swiss-German Sign Language", "", false, true)); this.languages.Add(new Language("slf", "Swiss-Italian Sign Language", "", false, true)); this.languages.Add(new Language("tsm", "Turkish Sign Language", "", false, true)); this.languages.Add(new Language("ukl", "Ukrainian Sign Language", "", false, true)); this.languages.Add(new Language("vsv", "Valencian Sign Language", "", false, true)); this.languages.Add(new Language("ysl", "Yugoslavian Sign Language", "", false, true)); if (uilang != "") { //Localize language names into the UI language: foreach (Language l in this.languages) { string locname = this.getString("lang-" + l.code); if (!locname.StartsWith("$")) { l.name = this.getString("lang-" + l.code); //use default name (= English name) if no localized name is available } } } //StreamWriter writer = new StreamWriter(server.MapPath("/loc/" + uilang + ".langs.txt")); //foreach(Language l in this.languages) { // writer.WriteLine(l.code + "\t" + l.name); //}; //writer.Close(); this.dicTypes = new List <DicType>(); this.dicTypes.Add(new DicType("gen", "General dictionaries", "[General dictionaries] are dictionaries that document contemporary vocabulary and are intended for everyday reference by native and fluent speakers.")); this.dicTypes.Add(new DicType("por", "Portals and aggregators", "[Portals and aggregators] are websites that provide access to more than one dictionary and allow you to search them all at once.")); this.dicTypes.Add(new DicType("lrn", "Learner's dictionaries", "[Learner's dictionaries] are intended for people who are learning the language as a second language.")); this.dicTypes.Add(new DicType("spe", "Dictionaries on special topics", "[Dictionaries on special topics] are dictionaries that focus on a specific subset of the vocabulary (such as new words or phrasal verbs) or which focus on a specific dialect or variant of the language.")); this.dicTypes.Add(new DicType("ort", "Spelling dictionaries", "[Spelling dictionaries] are dictionaries which codify the correct spelling and other aspects of the orthography of words.")); this.dicTypes.Add(new DicType("ety", "Etymological dictionaries", "[Etymological dictionaries] are dictionaries that explain the origins of words.")); this.dicTypes.Add(new DicType("his", "Historical dictionaries", "[Historical dictionaries] are dictionaries that document previous historical states of the language, or dictionaries that trace how the meanings and usage of words have evolved throughout history.")); this.dicTypes.Add(new DicType("trm", "Terminological dictionaries", "[Terminological dictionaries] describe the vocabulary of specialized domains such as biology, mathematics or economics.")); this.aboutPages.Add(new AboutPage("info", "About")); this.aboutPages.Add(new AboutPage("prop", "Suggest a dictionary")); this.aboutPages.Add(new AboutPage("crit", "Criteria for inclusion")); this.aboutPages.Add(new AboutPage("stmp", "Stamp of approval")); this.aboutPages.Add(new AboutPage("crtr", "Curator's manual")); this.aboutPages.Add(new AboutPage("dnld", "Download")); if (uilang != "") { foreach (DicType dt in this.dicTypes) { string locName = this.getString(dt.code + "-name"); string locLegend = this.getString(dt.code + "-legend"); if (!locName.StartsWith("$")) { dt.name = locName; } if (!locLegend.StartsWith("$")) { dt.legend = locLegend; } } foreach (AboutPage ap in this.aboutPages) { ap.title = this.getString("about-" + ap.code); } } }
/// <summary> /// 生成一个多键cookie. /// </summary> /// <param name="cookieName">cookie 文件名</param> /// <param name="arrKey">cookie的键数组</param> /// <param name="arrValue">键值数组</param> /// <param name="request"></param> /// <param name="response"></param> /// <param name="server"></param> /// <returns>生成成功则返回真, 否则返回假</returns> public static bool GenCookie(string cookieName, string[] arrKey, string[] arrValue, System.Web.HttpRequest request, System.Web.HttpResponse response, System.Web.HttpServerUtility server) { if (CheckCookie(cookieName, request) == true) { if (!RemoveCookie(cookieName, request, response)) { return(false); } } if (arrKey.Length != arrValue.Length) { return(false); } System.Web.HttpCookie objCookie = new System.Web.HttpCookie(cookieName); for (int i = 0; i < arrKey.Length; i++) { objCookie.Values[arrKey[i]] = server.UrlEncode(arrValue[i]); } try { response.AppendCookie(objCookie); } catch (Exception ex) { return(false); } return(true); }
public Control GetWebControl(System.Web.HttpServerUtility server, XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); Label lbl = new Label(); if (renderingDocument.Attributes["renderedLabel"] != null) { lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server); } else { lbl.Text = this.Name.FromXmlName2Render(server); } lbl.CssClass = "label"; ph.Controls.Add(lbl); FiscalCodeControl sbox = new FiscalCodeControl(this); //sbox.CausesValidation = false; if (renderingDocument.Attributes["class"] != null) { sbox.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server); } if (renderingDocument.Attributes["rel"] != null) { sbox.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server)); } if (renderingDocument.Attributes["description"] != null) { sbox.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server); } // Setting properties sbox.TextMode = TextBoxMode.SingleLine; if (renderingDocument.Attributes["rows"] != null) { string ns = renderingDocument.Attributes["rows"].Value.FromXmlValue2Render(server); int n; if (int.TryParse(ns, out n) && n > 1) { sbox.TextMode = TextBoxMode.MultiLine; sbox.Rows = n; } } if (renderingDocument.Attributes["hiddentext"] != null) { if (renderingDocument.Attributes["hiddentext"].Value.FromXmlValue2Render(server).ToLower().Equals("true")) { sbox.TextMode = TextBoxMode.Password; } } ph.Controls.Add(sbox); //--- ADD validators --- if (!Common.getElementFromSchema(baseSchema).IsNillable) { RequiredFieldValidator rqfv = new RequiredFieldValidator(); rqfv.ErrorMessage = "Required fields shouldn't be empty"; rqfv.ControlToValidate = sbox.ID; rqfv.ValidationGroup = "1"; rqfv.Display = ValidatorDisplay.Dynamic; ph.Controls.Add(rqfv); } if (((XmlSchemaSimpleType)Common.getElementFromSchema(baseSchema).SchemaType) == null) { return(ph); } XmlSchemaObjectCollection constrColl = ((XmlSchemaSimpleTypeRestriction)((XmlSchemaSimpleType)Common.getElementFromSchema(baseSchema).SchemaType).Content).Facets; // Set validators from XSD foreach (XmlSchemaFacet facet in constrColl) { if (facet is XmlSchemaPatternFacet) { ph.Controls.Add(getPatternValidator(facet.Value, sbox.ID)); } } //--- return(ph); }
public GeneradorWord(System.Web.HttpServerUtility servidor) { Servidor = servidor; }
public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); Label lbl = new Label(); if (renderingDocument.Attributes["renderedLabel"] != null) { lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server); } else { lbl.Text = this.Name.FromXmlName2Render(server); } lbl.CssClass = "label"; ph.Controls.Add(lbl); IntBoxControl ibox = new IntBoxControl(this); //ibox.CausesValidation = false; if (renderingDocument.Attributes["class"] != null) { ibox.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server); } if (renderingDocument.Attributes["rel"] != null) { ibox.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server)); } if (renderingDocument.Attributes["description"] != null) { ibox.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server); } ph.Controls.Add(ibox); if (!Common.getElementFromSchema(baseSchema).IsNillable) { RequiredFieldValidator rqfv = new RequiredFieldValidator(); rqfv.ErrorMessage = "Required fields shouldn't be empty"; rqfv.ControlToValidate = ibox.ID; rqfv.ValidationGroup = "1"; rqfv.Display = ValidatorDisplay.Dynamic; ph.Controls.Add(rqfv); } // Adding the regular expression validator to ensure the content to be an integer RegularExpressionValidator intValidator = new RegularExpressionValidator(); intValidator.ValidationExpression = @"-?[0-9]+"; intValidator.ControlToValidate = ibox.ID; intValidator.ErrorMessage = "Integer required!"; intValidator.ValidationGroup = "1"; intValidator.Display = ValidatorDisplay.Dynamic; ph.Controls.Add(intValidator); if (Common.getElementFromSchema(baseSchema).SchemaType == null) { return(ph); } XmlSchemaObjectCollection constrColl = ((XmlSchemaSimpleTypeRestriction)((XmlSchemaSimpleType)Common.getElementFromSchema(baseSchema).SchemaType).Content).Facets; foreach (XmlSchemaFacet facet in constrColl) { if (facet is XmlSchemaMinInclusiveFacet) { ph.Controls.Add(getGreaterThanValidator(Int32.Parse(facet.Value), ibox.ID)); } else if (facet is XmlSchemaMaxInclusiveFacet) { ph.Controls.Add(getLowerThanValidator(Int32.Parse(facet.Value), ibox.ID)); } } return(ph); }
public Control GetWebControl(System.Web.HttpServerUtility server, XmlNode renderingDocument) { PlaceHolder ph = new PlaceHolder(); Label lbl = new Label(); if (renderingDocument.Attributes["renderedLabel"] != null) { lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server); } else { lbl.Text = this.Name.FromXmlName2Render(server); } lbl.CssClass = "label"; ph.Controls.Add(lbl); ColorPickerControl colp = new ColorPickerControl(this); colp.CausesValidation = false; if (renderingDocument.Attributes["class"] != null) { colp.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server); } if (renderingDocument.Attributes["rel"] != null) { colp.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server)); } if (renderingDocument.Attributes["description"] != null) { colp.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server); } colp.Style.Add("z-index", "1800"); ph.Controls.Add(colp); /*** Validators ***/ // Base validator RegularExpressionValidator rev = new RegularExpressionValidator(); rev.ControlToValidate = colp.ID; rev.Display = ValidatorDisplay.Dynamic; rev.ErrorMessage = "Color code not in the required format"; rev.ValidationExpression = @"^\#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"; // if empty the validator is not checked, that's fine rev.ValidationGroup = "1"; ph.Controls.Add(rev); // Required validator if (!Common.getElementFromSchema(baseSchema).IsNillable) { RequiredFieldValidator rqfv = new RequiredFieldValidator(); rqfv.ErrorMessage = "Required fields shouldn't be empty"; rqfv.ControlToValidate = colp.ID; rqfv.ValidationGroup = "1"; rqfv.Display = ValidatorDisplay.Dynamic; ph.Controls.Add(rqfv); } if (((XmlSchemaSimpleType)Common.getElementFromSchema(baseSchema).SchemaType) == null) { return(ph); } XmlSchemaObjectCollection constrColl = ((XmlSchemaSimpleTypeRestriction) ( (XmlSchemaSimpleType) Common.getElementFromSchema(baseSchema).SchemaType ).Content ).Facets; foreach (XmlSchemaFacet facet in constrColl) { //TODO: No validators by now } return(ph); }