protected void Run(ClientPipelineArgs args) { if (!args.IsPostBack) { var options = new RulesEditorOptions() { ContextItemID = args.Parameters["ContextItemId"], IncludeCommon = true, HideActions = true, RulesPath = args.Parameters["RulesPath"], Value = args.Parameters["Value"] }; options.AllowMultiple = true; var urlString = options.ToUrlString(); urlString.Path = args.Parameters["UrlPath"]; urlString["sc_content"] = Client.ContentDatabase.Name; SheerResponse.ShowModalDialog(urlString.ToString(), "1024px", "768px", string.Empty, true); args.WaitForPostBack(); } else { if (args.HasResult) { var rulesValue = args.Result; if (!string.IsNullOrEmpty(rulesValue)) { _repository.SaveUserRule(rulesValue); Registry.SetBool("/Current_User/Workbox/FieldFilterEnabled", true); Registry.SetString("/Current_User/Workbox/FieldFilter", _repository.GetUserFilter().ID.ToString()); } } } }
protected void EditCondition(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); if (string.IsNullOrEmpty(args.Parameters["id"])) { SheerResponse.Alert("Please select a rule", new string[0]); return; } string str = ID.Decode(args.Parameters["id"]).ToString(); if (args.IsPostBack) { if (args.HasResult) { string result = args.Result; XElement xElement = XElement.Parse(result).Element("rule"); XElement rulesSet = this.RulesSet; if (xElement != null) { XElement xElement1 = ( from node in rulesSet.Elements("rule") where node.GetAttributeValue("uid") == str select node).FirstOrDefault <XElement>(); if (xElement1 != null) { xElement1.ReplaceWith(xElement); this.RulesSet = rulesSet; SheerResponse.SetInnerHtml(string.Concat(args.Parameters["id"], "_rule"), PersonalizationFormWithActions.GetRuleConditionsHtml(xElement)); } } } return; } RulesEditorOptions rulesEditorOption = new RulesEditorOptions() { IncludeCommon = true, RulesPath = "/sitecore/system/settings/Rules/Conditional Renderings", AllowMultiple = false }; RulesEditorOptions rulesEditorOption1 = rulesEditorOption; XElement xElement2 = ( from node in this.RulesSet.Elements("rule") where node.GetAttributeValue("uid") == str select node).FirstOrDefault <XElement>(); if (xElement2 != null) { rulesEditorOption1.Value = string.Concat("<ruleset>", xElement2, "</ruleset>"); } // rulesEditorOption1.HideActions = true; // FIRST CHANGE SheerResponse.ShowModalDialog(rulesEditorOption1.ToUrlString().ToString(), "580px", "712px", string.Empty, true); args.WaitForPostBack(); }
protected void EditCondition(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); var id = args.Parameters["id"]; if (string.IsNullOrEmpty(id)) { SheerResponse.Alert("Please select a rule"); } else { if (!args.IsPostBack) { var rule = Sitecore.Context.ClientPage.ServerProperties[id] as string; if (string.IsNullOrEmpty(rule)) { rule = "<ruleset />"; } var options = new RulesEditorOptions { IncludeCommon = true, RulesPath = "/sitecore/system/Settings/Rules/PowerShell", AllowMultiple = false, Value = rule, HideActions = true, }; SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), "580px", "712px", string.Empty, true); args.WaitForPostBack(); } else if (args.HasResult) { var content = args.Result; Sitecore.Context.ClientPage.ServerProperties[id] = content; SheerResponse.SetInnerHtml(id + "_renderer", GetRuleConditionsHtml(content)); } } }
/// <summary> /// Edits the filter condition. /// </summary> /// <param name="args"> /// The arguments. /// </param> protected void EditFilterCondition([NotNull] ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string conditionId; if (!string.IsNullOrEmpty(args.Parameters["id"])) { conditionId = ID.Decode(args.Parameters["id"]).ToString(); } else { conditionId = ID.NewID.ToString(); } if (!args.IsPostBack) { var options = new RulesEditorOptions { IncludeCommon = false, RulesPath = "/sitecore/system/Settings/Rules/XConnect - Search Queries", AllowMultiple = false, HideActions = true, PreviewRulesExecutionResults = false }; if (options.PreviewRulesExecutionResults) { options.RulesExecutionPreviewerType = null; } var condition = FilterSet.Elements("rule").Where(node => node.GetAttributeValue("uid") == conditionId).FirstOrDefault(); if (condition != null) { options.Value = "<ruleset>" + condition + "</ruleset>"; } SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), true); args.WaitForPostBack(); } else if (args.HasResult && string.Compare(args.Result.Trim(), "-", true, CultureInfo.InvariantCulture) != 0) { var result = args.Result; var ruleNode = XElement.Parse(result).Element("rule"); var filterSet = FilterSet; if (ruleNode != null) { var originalRule = filterSet.Elements("rule").Where(node => node.GetAttributeValue("uid") == conditionId). FirstOrDefault(); if (originalRule != null) { originalRule.ReplaceWith(ruleNode); FilterSet = filterSet; SheerResponse.SetInnerHtml(args.Parameters["id"] + "_rule", GetRuleConditionsHtml(ruleNode)); SheerResponse.SetInnerHtml(conditionId + "_count", Translate.Text("Calculating...")); int position; var ruleElements = filterSet.Elements("rule"); for (position = 0; position < ruleElements.Count(); position++) { if (string.Compare(ruleElements.ElementAt(position).GetAttributeValue("uid"), conditionId, true, CultureInfo.InvariantCulture) == 0) { break; } } RecalculateVisitorCount(position); } else { var newRule = new XElement("rule"); newRule.SetAttributeValue("uid", conditionId); newRule.Add(from el in ruleNode.Elements() select el); filterSet.Add(newRule); FilterSet = filterSet; var html = GetFilterSectionHtml(newRule, false); SheerResponse.Insert("non-default-container", "append", html); SheerResponse.Remove("no-rules-added"); RecalculateVisitorCount(filterSet.Elements("rule").Count() - 1); } UpdateTotalVisitorsInSegment(); } } }
protected void EditCondition(ClientPipelineArgs args) { Assert.ArgumentNotNull(args, "args"); string id = args.Parameters["id"]; if (string.IsNullOrEmpty(id)) { SheerResponse.Alert("Please select a rule"); } else { if (!args.IsPostBack) { string rule = Sitecore.Context.ClientPage.ServerProperties[id] as string; if (string.IsNullOrEmpty(rule)) { rule = "<ruleset />"; } var options = new RulesEditorOptions { IncludeCommon = true, RulesPath = "/sitecore/system/Settings/Rules/PowerShell", AllowMultiple = false, Value = rule, HideActions = true, }; SheerResponse.ShowModalDialog(options.ToUrlString().ToString(), "580px", "712px", string.Empty, true); args.WaitForPostBack(); } else if (args.HasResult) { var content = args.Result; Sitecore.Context.ClientPage.ServerProperties[id] = content; SheerResponse.SetInnerHtml(id + "_renderer", GetRuleConditionsHtml(content)); } } }