/// <summary> /// Reloads data. /// </summary> /// <param name="SetAutomatically">Indicates if table should be pre-set according to field type</param> public void ReloadData(bool setAutomatically, bool forceReload) { if ((!loaded) || ((loaded) && (forceReload))) { loaded = true; pnlContent.Controls.Clear(); LoadData(); this.btnAutomatically.Click += new EventHandler(btnAutomatically_Click); // Display checkbox matrix only if field names array is not empty if (attributes.Count > 0) { // Setup controls btnAutomatically.Visible = true; if (this.fields == null) { this.fields = new SearchSettings(); } if (dci != null) { this.fields.LoadData(dci.ClassSearchSettings); } infos = this.fields.GetAllSettingsInfos(); CreateTable(setAutomatically); Literal ltl = new Literal(); ltl.Text = "<br />"; pnlContent.Controls.Add(ltl); } // Setup OK button Button btnOk = new CMSButton(); btnOk.ID = "btnOK"; btnOk.Text = GetString("general.ok"); btnOk.Click += new EventHandler(btnOK_Click); btnOk.CssClass = "SubmitButton"; btnOk.Visible = this.DisplayOkButton; pnlContent.Controls.Add(btnOk); } }
/// <summary> /// Setups the control. /// </summary> private void SetupControl() { if (!StopProcessing) { // Show/Hide manufacturer filter if (ShowManufacturerFilter) { lblManufacturer.Text = ResHelper.GetString("ecommerce.filter.product.manufacturer"); manufacturerSelector.InnerControl.CssClass = "DropDownList"; } else { lblManufacturer.Visible = false; manufacturerSelector.Visible = false; } // Show/Hide public status filter if (ShowPublicStatusFilter) { lblStatus.Text = ResHelper.GetString("ecommerce.filter.product.status"); statusSelector.InnerControl.CssClass = "DropDownList"; } else { lblStatus.Visible = false; statusSelector.Visible = false; } // Show/Hide stock filter if (ShowStockFilter) { chkStock.Text = ResHelper.GetString("ecommerce.filter.product.stock"); } else { chkStock.Visible = false; } // Show/Hide paging filter if (ShowPagingFilter) { lblPaging.Text = ResHelper.GetString("ecommerce.filter.product.paging"); } else { lblPaging.Visible = false; drpPaging.Visible = false; } // Show/Hide sorting filter if (ShowSortingFilter) { lblSort.Text = ResHelper.GetString("ecommerce.filter.product.sort"); } else { lblSort.Visible = false; drpSort.Visible = false; } // Show/Hide search filter if (ShowSearchFilter) { lblSearch.Text = ResHelper.GetString("ecommerce.filter.product.search"); } else { lblSearch.Visible = false; txtSearch.Visible = false; } bool firstRowVisible = (ShowSearchFilter || ShowPublicStatusFilter || ShowManufacturerFilter || ShowStockFilter); bool secondRowVisible = (ShowPagingFilter || ShowSortingFilter); plcFirstRow.Visible = firstRowVisible; plcSecondRow.Visible = secondRowVisible; plcFirstButton.Visible = (firstRowVisible && !secondRowVisible); plcSecButton.Visible = secondRowVisible; button = secondRowVisible ? btnSecFilter : btnFirstFilter; button.Text = ResHelper.GetString("ecommerce.filter.product.filter"); pnlContainer.DefaultButton = button.ID; if (!RequestHelper.IsPostBack()) { // Initialize dropdowns drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.nameasc"), "nameasc")); drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.namedesc"), "namedesc")); drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.priceasc"), "priceasc")); drpSort.Items.Add(new ListItem(ResHelper.GetString("ecommerce.filter.product.pricedesc"), "pricedesc")); drpPaging.Items.Add(new ListItem(ResHelper.GetString("General.SelectAll"), "0")); if ((PagingOptions != null) && (PagingOptions != string.Empty)) { // Parse PagingOptions string and fill dropdown string[] pageOptions = PagingOptions.Split(','); foreach (string pageOption in pageOptions) { if (pageOption.Trim() != string.Empty) { drpPaging.Items.Add(new ListItem(pageOption.Trim())); } } } else { // Hide paging drpPaging.Visible = false; lblPaging.Visible = false; } if (FilterByQuery) { // Get filter setings from query GetFilter(); } } // Section 508 validation lblManufacturer.AssociatedControlClientID = manufacturerSelector.ValueElementID; lblStatus.AssociatedControlClientID = statusSelector.ValueElementID; lblSearch.AssociatedControlClientID = txtSearch.ClientID; } else { statusSelector.StopProcessing = true; manufacturerSelector.StopProcessing = true; } }
private void CreateActions(List <HeaderAction> actions, Control parent) { int actionsCount = actions.Count; // Sort actions by index to be sure the order is ensured for multiple actions if (actionsCount > 1) { // At least one action has index if (actions.Exists(a => (a.Index != -1))) { // Sort the actions actions.Sort((a1, a2) => a1.Index.CompareTo(a2.Index)); } } // Generate the actions for (int i = 0; i < actionsCount; ++i) { var action = actions[i]; // If the text is not specified or visibility is false, skip the action var formButton = action.BaseButton as FormSubmitButton; if (!action.IsVisible() || ((action.BaseButton != null) && (!action.BaseButton.Visible || ((formButton != null) && !formButton.RegisterHeaderAction)))) { // Skip empty action action.Visible = false; continue; } // Check permission if action is enabled if (action.Enabled) { action.Enabled = CheckPermissions(action.ResourceName, action.Permission); } // Set live site flag for resource strings action.IsLiveSite = IsLiveSite; // Get the action parameters string ctrlId = String.Concat(ID, "_HA_", i); WebControl actionControl; // Use multi button when action contains alternative actions if ((action.AlternativeActions != null) && action.AlternativeActions.Any()) { // Get main action var controlActions = new List <CMSButtonAction> { GetControlAction(action) }; if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId); } // Get other actions for (int j = 0; j < action.AlternativeActions.Count; j++) { var alternativeAction = action.AlternativeActions[j]; controlActions.Add(GetControlAction(alternativeAction)); if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId + "_" + j); } } var button = action.Inactive ? (CMSMultiButtonBase) new CMSToggleButton() : new CMSMoreOptionsButton(); button.Enabled = Enabled; button.ID = ctrlId; button.Actions = controlActions; actionControl = button; } // Use classic button else { // Get action var controlAction = GetControlAction(action); var button = new CMSButton { ButtonStyle = action.ButtonStyle, ID = ctrlId, Enabled = controlAction.Enabled, Text = controlAction.Text, OnClientClick = controlAction.OnClientClick, ToolTip = action.Tooltip, UseSubmitBehavior = false }; if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId); } actionControl = button; } if (action.CssClass != null) { actionControl.AddCssClass(action.CssClass); } // Add control to the panel parent.Controls.Add(actionControl); } }
/// <summary> /// Creates filter show button. /// </summary> private void CreateFilterButton(Control filterControl) { if (!HideFilterButton && String.IsNullOrEmpty(FilterFormName)) { Panel filterWrapperPanel = new Panel() { CssClass = "form-group form-group-buttons" }; Panel panelButtons = new Panel() { CssClass = "filter-form-buttons-cell-wide", EnableViewState = false }; // If we remember the grid state we need to add the reset button to allow the user to restore the initial state if (RememberState) { CMSButton resetButton = new CMSButton { ID = "btnReset", Text = GetString("general.reset"), ButtonStyle = ButtonStyle.Default, EnableViewState = false }; resetButton.Click += ResetButton_Click; panelButtons.Controls.Add(resetButton); } mShowButton = new CMSButton { ID = "btnShow", Text = GetString("general.filter"), ButtonStyle = ButtonStyle.Primary, EnableViewState = false }; mShowButton.Click += ShowButton_Click; pnlHeader.DefaultButton = mShowButton.ID; panelButtons.Controls.Add(mShowButton); filterWrapperPanel.Controls.Add(panelButtons); if (mCustomFilterAdded) { plcFilter.Controls.Add(filterWrapperPanel); } else { filterControl.Controls.Add(filterWrapperPanel); } } }
private void CreateActions(List<HeaderAction> actions, Control parent) { int actionsCount = actions.Count; // Sort actions by index to be sure the order is ensured for multiple actions if (actionsCount > 1) { // At least one action has index if (actions.Exists(a => (a.Index != -1))) { // Sort the actions actions.Sort((a1, a2) => a1.Index.CompareTo(a2.Index)); } } // Generate the actions for (int i = 0; i < actionsCount; ++i) { var action = actions[i]; // If the text is not specified or visibility is false, skip the action var formButton = action.BaseButton as FormSubmitButton; if (!action.IsVisible() || ((action.BaseButton != null) && (!action.BaseButton.Visible || ((formButton != null) && !formButton.RegisterHeaderAction)))) { // Skip empty action action.Visible = false; continue; } // Check permission if action is enabled if (action.Enabled) { action.Enabled = CheckPermissions(action.ResourceName, action.Permission); } // Set live site flag for resource strings action.IsLiveSite = IsLiveSite; // Get the action parameters string ctrlId = String.Concat(ID, "_HA_", i); WebControl actionControl; // Use multi button when action contains alternative actions if ((action.AlternativeActions != null) && action.AlternativeActions.Any()) { // Get main action var controlActions = new List<CMSButtonAction> { GetControlAction(action) }; if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId); } // Get other actions for (int j = 0; j < action.AlternativeActions.Count; j++) { var alternativeAction = action.AlternativeActions[j]; controlActions.Add(GetControlAction(alternativeAction)); if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId + "_" + j); } } var button = action.Inactive ? (CMSMultiButtonBase)new CMSToggleButton() : new CMSMoreOptionsButton(); button.Enabled = Enabled; button.ID = ctrlId; button.Actions = controlActions; actionControl = button; } // Use classic button else { // Get action var controlAction = GetControlAction(action); var button = new CMSButton { ButtonStyle = action.ButtonStyle, ID = ctrlId, Enabled = controlAction.Enabled, Text = controlAction.Text, OnClientClick = controlAction.OnClientClick, ToolTip = action.Tooltip, UseSubmitBehavior = false }; if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId); } actionControl = button; } if (action.CssClass != null) { actionControl.AddCssClass(action.CssClass); } // Add control to the panel parent.Controls.Add(actionControl); } }
private void CreateActions(List <HeaderAction> actions, Control parent) { int actionsCount = actions.Count; // Sort actions by index to be sure the order is ensured for multiple actions if (actionsCount > 1) { // At least one action has index if (actions.Exists(a => (a.Index != -1))) { // Sort the actions actions.Sort((a1, a2) => a1.Index.CompareTo(a2.Index)); } } var VersionHistoryID = this.DocumentManager.Node.DocumentCheckedOutVersionHistoryID; //checking that current document is already rejected or not DataSet dsRejected = WorkflowHistoryInfoProvider.GetWorkflowHistories("WasRejected = 1 AND VersionHistoryID = " + VersionHistoryID + " ", null, 100, null); // Generate the actions for (int i = 0; i < actionsCount; ++i) { var action = actions[i]; if (action.EventName != SMEConstant.ACTIONEVENTNAME_DOCUMENTCREATEVERSION && action.EventName != SMEConstant.ACTIONEVENTNAME_DOCUMENTARCHIVE && (action.EventName == "Save" || DataHelper.DataSourceIsEmpty(dsRejected))) { if ((action.AlternativeActions != null) && action.AlternativeActions.Any() && action.AlternativeActions.Count > 1) { action = action.AlternativeActions.First(); } // If the text is not specified or visibility is false, skip the action var formButton = action.BaseButton as FormSubmitButton; // Get the action parameters string ctrlId = String.Concat(ID, "_HA_", i); WebControl actionControl; if (!action.IsVisible() || ((action.BaseButton != null) && (!action.BaseButton.Visible || ((formButton != null) && !formButton.RegisterHeaderAction)))) { // Skip empty action action.Visible = false; continue; } // Check permission if action is enabled if (action.Enabled) { action.Enabled = CheckPermissions(action.ResourceName, action.Permission); } // Set live site flag for resource strings action.IsLiveSite = IsLiveSite; // Use multi button when action contains alternative actions if ((action.AlternativeActions != null) && action.AlternativeActions.Any() && false) { // Get main action var controlActions = new List <CMSButtonAction> { GetControlAction(action) }; if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId); } // Get other actions for (int j = 0; j < action.AlternativeActions.Count; j++) { var alternativeAction = action.AlternativeActions[j]; controlActions.Add(GetControlAction(alternativeAction)); if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId + "_" + j); } } var button = action.Inactive ? (CMSMultiButtonBase) new CMSToggleButton() : new CMSMoreOptionsButton(); button.Enabled = Enabled; button.ID = ctrlId; button.Actions = controlActions; actionControl = button; } // Use classic button else { // Get action var controlAction = GetControlAction(action); var button = new CMSButton { ButtonStyle = action.ButtonStyle, ID = ctrlId, Enabled = controlAction.Enabled, Text = controlAction.Text, OnClientClick = controlAction.OnClientClick, //OnClientClick = string.Concat("if(jQuery('form').validationEngine('validate')){jQuery('.modal-backdrop').show();jQuery('.loading').show();", controlAction.OnClientClick + "}"), ToolTip = action.Tooltip, UseSubmitBehavior = false }; if (Utility.IsUserInAdminRole() && action.EventName == SMEConstant.ACTIONEVENTNAME_DOCUMENTAPPROVE) { var culture = SiteContext.CurrentSite.DefaultVisitorCulture; button.Text = ValidationHelper.GetString(GetString("ApproveButtonText", culture), "Approve & Publish"); button.ToolTip = ValidationHelper.GetString(GetString("ApproveButtonText", culture), "Approve & Publish"); } if (action.EventName == SMEConstant.ACTIONEVENTNAME_DOCUMENTSAVE) { var culture = SiteContext.CurrentSite.DefaultVisitorCulture; button.Text = ValidationHelper.GetString(GetString("SubmitText", culture), "Save"); button.ToolTip = ValidationHelper.GetString(GetString("SubmitTextToolTip", culture), "Save Event"); } if (action.RegisterShortcutScript) { RegisterSaveShortcutScript(action, ctrlId); } actionControl = button; actionControl.AddCssClass(string.Concat(action.CssClass, " modulebtn")); } if (action.CssClass != null) { actionControl.AddCssClass(string.Concat(action.CssClass, " btn-primary")); } // Add control to the panel parent.Controls.Add(actionControl); } } }
/// <summary> /// Setups the control. /// </summary> private void SetupControl() { // Show/Hide manufacturer filter if (ShowManufacturerFilter) { manufacturerSelector.InnerControl.CssClass = "DropDownList"; } else { lblManufacturer.Visible = false; manufacturerSelector.Visible = false; } // Show/Hide public status filter if (ShowPublicStatusFilter) { statusSelector.InnerControl.CssClass = "DropDownList"; } else { lblStatus.Visible = false; statusSelector.Visible = false; } // Show/Hide stock filter if (ShowStockFilter) { chkStock.Text = GetString("ecommerce.filter.product.stock"); } else { chkStock.Visible = false; } // Show/Hide paging filter if (!ShowPagingFilter) { lblPaging.Visible = false; drpPaging.Visible = false; } // Show/Hide sorting filter if (!ShowSortingFilter) { lblSort.Visible = false; drpSort.Visible = false; } // Show/Hide search filter if (!ShowSearchFilter) { lblSearch.Visible = false; txtSearch.Visible = false; } // Show/Hide filter rows bool firstRowVisible = (ShowSearchFilter || ShowPublicStatusFilter || ShowManufacturerFilter || ShowStockFilter); bool secondRowVisible = (ShowPagingFilter || ShowSortingFilter); plcFirstRow.Visible = firstRowVisible; plcSecondRow.Visible = secondRowVisible; plcFirstButton.Visible = (firstRowVisible && !secondRowVisible); plcSecButton.Visible = secondRowVisible; button = secondRowVisible ? btnSecFilter : btnFirstFilter; pnlContainer.DefaultButton = button.ID; // Section 508 validation lblManufacturer.AssociatedControlClientID = manufacturerSelector.ValueElementID; lblStatus.AssociatedControlClientID = statusSelector.ValueElementID; lblSearch.AssociatedControlClientID = txtSearch.ClientID; }