/// <summary> /// Loads text into textbox from value or from 'QueryColumnName' column. /// </summary> /// <param name="value">Value parameter</param> /// <returns>Returns text of options or query</returns> private string LoadTextFromData(string value) { InitOptions(); txtValue.Editor.ValueIsMacro = false; // Options data if (!String.IsNullOrEmpty(value)) { lstOptions.SelectedIndex = ListSourceIndex; // Get string representation SpecialFieldsDefinition def = new SpecialFieldsDefinition(null, FieldInfo, ContextResolver); def.LoadFromText(value); return(def.ToString()); } // Query selected if (ContainsColumn(QueryColumnName)) { string query = ValidationHelper.GetString(Form.Data.GetValue(QueryColumnName), string.Empty).Trim(); if (!String.IsNullOrEmpty(query)) { lstOptions.SelectedIndex = SqlSourceIndex; if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Form", "EditSQLQueries")) { mDisabledSql = true; } return(query); } } // Macro data source selected if (ContainsColumn(MacroColumnName)) { string macro = ValidationHelper.GetString(Form.Data.GetValue(MacroColumnName), string.Empty).Trim(); if (!String.IsNullOrEmpty(macro)) { lstOptions.SelectedIndex = MacroSourceIndex; txtValue.Editor.ValueIsMacro = true; return(MacroProcessor.RemoveDataMacroBrackets(macro)); } } return(null); }
protected void Page_Load(object sender, EventArgs e) { RegisterESCScript = false; controlHash = QueryHelper.GetString("controlHash", ""); clientId = QueryHelper.GetString("clientid", ""); SetTitle(GetString("conditionbuilder.title")); PageTitle.HelpTopicName = HELP_TOPIC_LINK; Save += btnSave_Click; designerElem.RuleCategoryNames = QueryHelper.GetString("module", ""); designerElem.DisplayRuleType = QueryHelper.GetInteger("ruletype", 0); designerElem.ShowGlobalRules = QueryHelper.GetBoolean("showglobal", true); designerElem.MacroRuleAvailability = (MacroRuleAvailabilityEnum)QueryHelper.GetInteger("macroruleavailability", 0); // Set correct resolver to the control string resolverName = ValidationHelper.GetString(SessionHelper.GetValue("ConditionBuilderResolver_" + controlHash), ""); if (!string.IsNullOrEmpty(resolverName)) { designerElem.ResolverName = resolverName; } // Set correct default condition text string defaultText = ValidationHelper.GetString(SessionHelper.GetValue("ConditionBuilderDefaultText_" + controlHash), ""); if (!string.IsNullOrEmpty(defaultText)) { designerElem.DefaultConditionText = defaultText; } if (!RequestHelper.IsPostBack()) { string condition = MacroProcessor.RemoveDataMacroBrackets(ValidationHelper.GetString(SessionHelper.GetValue("ConditionBuilderCondition_" + controlHash), "")); designerElem.Value = condition; } CurrentMaster.PanelContent.RemoveCssClass("dialog-content"); }
/// <summary> /// Called when Insert button is clicked - sends selected control info back to the CK editor. /// </summary> protected void btnInsert_Click(object sender, EventArgs e) { string macroValue = MacroProcessor.RemoveDataMacroBrackets(macroEditor.Text.Trim()); ScriptHelper.RegisterStartupScript(this, typeof(string), "InsertMacro", String.Format("InsertMacro('{0}');", ScriptHelper.GetString(macroValue, false)), true); }