public void InitializeWithField(SPField field) { EnsureChildControls(); FilteredLookupField _f = null; try { _f = field as FilteredLookupField; } catch { } if (_f != null) { // this bit only happens when field is not null if (!IsPostBack) { cbxAllowMultiValue.Checked = _f.AllowMultipleValues; txtQueryFilter.Text = (!string.IsNullOrEmpty(_f.QueryFilterAsString)) ? SPHttpUtility.HtmlDecode(_f.QueryFilterAsString) : string.Empty; cbxRecursiveFilter.Checked = _f.IsFilterRecursive; TargetWebId = _f.LookupWebId.ToString(); TargetListId = _f.LookupList; TargetColumnId = _f.LookupField; TargetListViewId = _f.ListViewFilter; } } // this bit must always happen, even when field is null if (!IsPostBack) { SetTargetWeb(); lblTargetWeb.Text = listTargetWeb.SelectedItem.Text; lblTargetList.Text = listTargetList.SelectedItem.Text; SetControlVisibility(); } }
public static string HtmlDecode(string value) { if (!string.IsNullOrEmpty(value)) { return(SPHttpUtility.HtmlDecode(value)); } else { return(string.Empty); } }
private static void PublishAssetFromHtml(string html, SPListItem sourceItem) { if (!CommonHelper.IsNullOrWhiteSpace(html)) { Match match = Regex.Match(html, @"\b(?:src|href|url)=(?>(?<dq>"")?|(?<sq>')?)(?<url>(?(dq)[^""]+|(?(sq)[^']+|[^\s]+)))", RegexOptions.IgnoreCase); while (match.Success) { PublishAssetInternal(SPHttpUtility.HtmlDecode(match.Groups["url"].Value), sourceItem); match = match.NextMatch(); } } }
private void MapPFEPermissions() { string basePath = CoreFunctions.getConfigSetting(SPWeb.Site.RootWeb, "epkbasepath"); Assembly assembly = Assembly.Load("PortfolioEngineCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5"); Type type = assembly.GetType("PortfolioEngineCore.Setup.SetupSite", true, true); MethodInfo methodInfo = type.GetMethod("RenamePermissions"); object instance = Activator.CreateInstance(type); methodInfo.Invoke(instance, new object[] { basePath, new Dictionary <string, string> { { "Admins", "Administrators" }, { "DMs", "Resource Managers" }, { "PMs", "Project Managers" }, { "PMO", "Portfolio Managers" }, { "Team", "Team Members" } } }); bool setupErrors = false; string setupMessage = string.Empty; foreach (PropertyInfo propertyInfo in instance.GetType().GetProperties()) { if (propertyInfo.Name.Equals("SetupErrors")) { setupErrors = (bool)propertyInfo.GetValue(instance, null); } else if (propertyInfo.Name.Equals("SetupMessage")) { setupMessage = propertyInfo.GetValue(instance, null) as string; } } string setupMsg = SPHttpUtility.HtmlDecode(setupMessage); if (setupErrors) { LogMessage("\t", setupMsg, 3); } else { foreach (string message in setupMsg.Split(new[] { "<br>" }, StringSplitOptions.None)) { LogMessage("\t", message, 1); } } }
public static string ExtractHtml(string source) { try { XmlDocument x = new XmlDocument(); source = SPHttpUtility.HtmlDecode(source); x.LoadXml(source); return(x.InnerText); } catch (Exception) { return(""); } }
// Private Methods (1) private void UpgradePfeDatabase() { string basePath = CoreFunctions.getConfigSetting(Web.Site.RootWeb, "epkbasepath"); Assembly assembly = Assembly.Load("PortfolioEngineCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5"); Type type = assembly.GetType("PortfolioEngineCore.Setup.SetupSite", true, true); MethodInfo methodInfo = type.GetMethod("UpgradeDB"); object instance = Activator.CreateInstance(type); methodInfo.Invoke(instance, new object[] { basePath }); bool setupErrors = false; string setupMessage = string.Empty; foreach (PropertyInfo propertyInfo in instance.GetType().GetProperties()) { if (propertyInfo.Name.Equals("SetupErrors")) { setupErrors = (bool)propertyInfo.GetValue(instance, null); } else if (propertyInfo.Name.Equals("SetupMessage")) { setupMessage = propertyInfo.GetValue(instance, null) as string; } } string setupMsg = SPHttpUtility.HtmlDecode(setupMessage); if (setupErrors) { LogMessage(setupMsg, MessageKind.FAILURE, 2); } else { setupMsg = setupMsg.Replace("<br><br>", "<br>"); foreach (string message in setupMsg.Split(new[] { "<br>" }, StringSplitOptions.None)) { LogMessage(message, 2); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (this.Request.QueryString.HasKeys() && !(String.IsNullOrEmpty(this.Request.QueryString.Get("webId")))) { string webId = SPHttpUtility.HtmlDecode(this.Request.QueryString.Get("webId")); SPSite site = SPContext.Current.Site; SPWeb web = site.OpenWeb(new Guid(webId)); GetImageLists(web); } else { GetImageLists(SPContext.Current.Web); } SetDefaultSelection(); } }