コード例 #1
0
ファイル: Roles.aspx.cs プロジェクト: SMEWebmaster/Kentico16
    /// <summary>
    /// Gets user effective UI permission HTML content.
    /// </summary>
    private void GenerateBeforeRowsContent()
    {
        // Check if every necessary property is set
        if ((SelectedUser != null) && (Element != null) && (ElementResource != null))
        {
            // Initialize variables used during rendering
            string userName = HTMLHelper.HTMLEncode(TextHelper.LimitLength(Functions.GetFormattedUserName(SelectedUser.UserName, SelectedUser.FullName), 50));
            bool   authorizedToUIElement = UserInfoProvider.IsAuthorizedPerUIElement(ElementResource.ResourceName,
                                                                                     new[] { Element.ElementName },
                                                                                     siteSelector.SiteName,
                                                                                     SelectedUser,
                                                                                     true,
                                                                                     siteSelector.SiteID <= 0);
            // Create header table cell
            var tcHeader = new TableCell
            {
                CssClass = "matrix-header",
                ToolTip  = userName,
                Text     = userName
            };
            gridMatrix.ContentBeforeRow.Cells.Add(tcHeader);

            // Create UI permission cell
            var tc  = new TableCell();
            var chk = new CMSCheckBox
            {
                Checked = SelectedUser.IsGlobalAdministrator || authorizedToUIElement,
                Enabled = false,
                ToolTip = GetString("Administration-Permissions_Matrix.NotAdjustable")
            };
            tc.Controls.Add(chk);
            gridMatrix.ContentBeforeRow.Cells.Add(tc);
        }
    }
コード例 #2
0
    /// <summary>
    /// Setups checkbox for inheriting value.
    /// </summary>
    /// <param name="fieldName">Name of field which can have inherited value</param>
    private void SetupInheritCheckbox(string fieldName)
    {
        CMSCheckBox checkBox = GetCheckBox(fieldName);

        if (checkBox == null)
        {
            return;
        }

        checkBox.AutoPostBack    = true;
        checkBox.CheckedChanged += checkBox_CheckedChanged;

        // Check if node has saved some value
        if ((Node.GetValue(fieldName) == null) && (!URLHelper.IsPostback()))
        {
            checkBox.Checked = true;

            // Init inherited value
            FormEngineUserControl mainControl = Control.FieldControls[fieldName];
            if (!String.IsNullOrEmpty(Node.NodeSiteName) && (mainControl != null))
            {
                mainControl.Text    = ValidationHelper.GetString(Node.GetInheritedValue(fieldName, SiteInfoProvider.CombineWithDefaultCulture(Node.NodeSiteName)), "");
                mainControl.Enabled = false;
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// On RowDataBound add CMSCheckbox to the row.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void gvObjects_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var    row      = (DataRowView)e.Row.DataItem;
            string codeName = ValidationHelper.GetString(row[codeNameColumnName], "");

            CMSCheckBox checkBox = GetCheckBox(codeName);
            if (!e.Row.Cells[0].Controls.OfType <CMSCheckBox>().Any(ccb => ccb.ID == checkBox.ID))
            {
                e.Row.Cells[0].Controls.Add(checkBox);
            }
            AddAvailableItem(codeName);

            if (IsInConflict(codeName))
            {
                // Adjust warning message for existing object - it will be either overwritten, or just a binding will be added (if allowed in import settings)
                string warningMessage = Settings.ImportOnlyNewObjects ? "importgridview.import.warningNewObjects" : "importgridview.import.warning";

                var icon = new CMSIcon
                {
                    ID       = "warning-icon",
                    CssClass = "RightAlignAlign icon-exclamation-triangle color-orange-80 warning-icon",
                    ToolTip  = GetString(warningMessage),
                };

                if (!e.Row.Cells[1].Controls.OfType <CMSIcon>().Any(ci => ci.ID == icon.ID))
                {
                    e.Row.Cells[1].Controls.Add(icon);
                }
            }
        }
    }
コード例 #4
0
    /// <summary>
    /// Setups checkbox for inheriting value.
    /// </summary>
    /// <param name="fieldName">Name of field which can have inherited value</param>
    private void SetupInheritCheckbox(string fieldName)
    {
        CMSCheckBox checkBox = GetCheckBox(fieldName);

        if (checkBox == null)
        {
            return;
        }

        checkBox.AutoPostBack    = true;
        checkBox.CheckedChanged += checkBox_CheckedChanged;

        // Check if node has saved some value
        if ((Node.GetValue(fieldName) == null) && (!RequestHelper.IsPostBack()))
        {
            checkBox.Checked = true;

            // Init inherited value
            FormEngineUserControl mainControl = Control.FieldControls[fieldName];
            if (!String.IsNullOrEmpty(Node.NodeSiteName) && (mainControl != null))
            {
                var inheritedValue = Node.GetInheritedValue(fieldName, false);
                inheritedValues.Add(fieldName, inheritedValue);
                mainControl.Text    = ValidationHelper.GetString(inheritedValue, "");
                mainControl.Enabled = false;
            }
        }
    }
コード例 #5
0
    protected void GridViewCountries_DataBound(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridViewCountries.Rows)
        {
            // Copy id from 5th column to invisible label in last column
            Label id = new Label();
            id.Visible = false;
            id.Text    = row.Cells[3].Text;
            row.Cells[3].Controls.Add(id);

            TextBox txtValue = ControlsHelper.GetChildControl(row, typeof(TextBox), "txtTaxValue") as TextBox;
            if (txtValue != null)
            {
                txtValue.ID = "txtTaxValue" + id.Text;
            }

            CMSCheckBox chkIsFlat = ControlsHelper.GetChildControl(row, typeof(CMSCheckBox), "chkIsFlatValue") as CMSCheckBox;
            if (chkIsFlat != null)
            {
                chkIsFlat.ID = "chkIsFlatValue" + id.Text;

                // Bind script for changing absolute/relative marks
                Label lblCurrency = ControlsHelper.GetChildControl(row, typeof(Label), "lblCurrency") as Label;
                if (lblCurrency != null)
                {
                    chkIsFlat.InputAttributes["onclick"]  = "switchCurrency(this.checked, '" + lblCurrency.ClientID + "')";
                    chkIsFlat.InputAttributes["onchange"] = "switchCurrency(this.checked, '" + lblCurrency.ClientID + "')";
                }
            }
        }
    }
コード例 #6
0
 /// <summary>
 /// Checks checkbox if provided value is true.
 /// </summary>
 protected void SetCheckBoxWithNativePermission(CMSCheckBox chkBox, bool value)
 {
     if (value)
     {
         chkBox.Checked = true;
     }
 }
コード例 #7
0
    /// <summary>
    /// CheckedChanged event handler.
    /// </summary>
    protected void checkBox_CheckedChanged(object sender, EventArgs e)
    {
        CMSCheckBox checkBox = (CMSCheckBox)sender;

        // Get field name that can be set as inherited by checkbox
        KeyValuePair <string, CMSCheckBox> item = checkboxes.FirstOrDefault(x => x.Value.ClientID == checkBox.ClientID);

        if (item.Key != null)
        {
            FormEngineUserControl mainControl = Control.FieldControls[item.Key];

            if (checkBox.Checked)
            {
                // Value is inherited
                mainControl.Enabled = false;

                var inheritedValue = Node.GetInheritedValue(item.Key, false);
                inheritedValues.Add(item.Key, inheritedValue);
                mainControl.Value = inheritedValue;
            }
            else
            {
                // Text area is enabled
                mainControl.Enabled = true;
            }

            if (item.Key == "DocumentTagGroupID")
            {
                EnableTagSelector();
            }
        }
    }
コード例 #8
0
 /// <summary>
 /// Sets value to enabled checkbox.
 /// </summary>
 /// <param name="chkBox">Checkbox to use</param>
 /// <param name="checkedIdent">Checked value</param>
 private static void CheckEnabledCheckbox(CMSCheckBox chkBox, bool checkedIdent)
 {
     if (chkBox.Enabled)
     {
         chkBox.Checked = checkedIdent;
     }
 }
コード例 #9
0
    /// <summary>
    /// Sets display attribute on prerender, because here the viewstate values are loaded to checkboxes.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (StopProcessing)
        {
            return;
        }

        base.OnPreRender(e);

        // Hide the checkboxes if only one gateway is specified
        if (NotificationGateways.Count == 1)
        {
            CMSCheckBox chk = controls[0, 0] as CMSCheckBox;
            if (chk != null)
            {
                chk.Visible = false;
            }
        }
        else
        {
            for (int i = 0; i < NotificationGateways.Count; i++)
            {
                // Set the correct visibility of the panel
                CMSCheckBox chk = controls[i, 0] as CMSCheckBox;
                Panel       pnl = controls[i, 1] as Panel;
                if ((pnl != null) && (chk != null))
                {
                    pnl.Attributes.Add("style", "display: " + (chk.Checked ? "block" : "none") + ";");
                }
            }
        }
    }
コード例 #10
0
    /// <summary>
    /// CheckedChanged event handler.
    /// </summary>
    protected void checkBox_CheckedChanged(object sender, EventArgs e)
    {
        CMSCheckBox checkBox = (CMSCheckBox)sender;

        // Get field name that can be set as inherited by checkbox
        KeyValuePair <string, CMSCheckBox> item = checkboxList.FirstOrDefault(x => x.Value.ClientID == checkBox.ClientID);

        if (item.Key != null)
        {
            FormEngineUserControl mainControl = Control.FieldControls[item.Key];

            if (checkBox.Checked)
            {
                // Value is inherited
                mainControl.Enabled = false;
                if (!String.IsNullOrEmpty(Node.NodeSiteName))
                {
                    mainControl.Value = Node.GetInheritedValue(item.Key, SiteInfoProvider.CombineWithDefaultCulture(Node.NodeSiteName));
                }
            }
            else
            {
                // Text area is enabled
                mainControl.Enabled = true;
            }

            if (item.Key == "DocumentTagGroupID")
            {
                InitializeTagSelector();
            }
        }
    }
コード例 #11
0
    /// <summary>
    /// Change header title for multiple selection.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            ChangeSearchCondition();
        }

        // Load the grid data
        ReloadGrid();

        // Register client scripts
        RegisterBaseClientScripts();

        if (uniGrid.GridView.HeaderRow != null)
        {
            switch (selectionMode)
            {
            // Multiple selection
            case SelectionModeEnum.Multiple:
            case SelectionModeEnum.MultipleTextBox:
            case SelectionModeEnum.MultipleButton:
            {
                // Add checkbox for selection of all items on the current page
                CMSCheckBox chkAll = new CMSCheckBox
                {
                    ID      = "chkAll",
                    ToolTip = GetString("UniSelector.CheckAll"),
                    Checked = allRowsChecked
                };
                chkAll.Attributes.Add("onclick", "SelectAllItems(this)");

                uniGrid.GridView.HeaderRow.Cells[0].Controls.Clear();
                uniGrid.GridView.HeaderRow.Cells[0].Controls.Add(chkAll);
                uniGrid.GridView.Columns[0].ItemStyle.CssClass = "unigrid-selection";

                uniGrid.GridView.HeaderRow.Cells[1].Text = GetString("general.itemname");

                // Register client scripts for multiple modes
                RegisterMultipleModeClientScripts(chkAll.ClientID);
            }
            break;

            // Single selection
            default:
            {
                uniGrid.GridView.Columns[0].Visible      = false;
                uniGrid.GridView.HeaderRow.Cells[1].Text = GetString("general.itemname");
            }
            break;
            }
        }

        base.OnPreRender(e);
    }
コード例 #12
0
    /// <summary>
    /// Creates <see cref="TableCell"/> with a checkbox checked if <param name="value"/> is true for given <paramref name="column"/>.
    /// Checkbox indicates what kind of an action can be performed on given <paramref name="column"/> e.g. faceting.
    /// </summary>
    private TableCell CreateTableCell(string searchField, ColumnDefinition column, bool value, string toolTipResourceString)
    {
        var tc  = new TableCell();
        var chk = new CMSCheckBox();

        chk.ID      = column.ColumnName + searchField;
        chk.Checked = value;
        chk.ToolTipResourceString = toolTipResourceString;
        tc.Controls.Add(chk);

        return(tc);
    }
コード例 #13
0
    /// <summary>
    /// Change header title for multiple selection.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            ChangeSearchCondition();
        }

        // Load the grid data
        ReloadGrid();

        if (uniGrid.GridView.HeaderRow != null)
        {
            switch (selectionMode)
            {
            // Multiple selection
            case SelectionModeEnum.Multiple:
            case SelectionModeEnum.MultipleTextBox:
            case SelectionModeEnum.MultipleButton:
            {
                // Add checkbox for selection of all items on the current page
                CMSCheckBox chkAll = new CMSCheckBox
                {
                    ID      = "chkAll",
                    ToolTip = GetString("UniSelector.CheckAll"),
                    Checked = allRowsChecked
                };

                // Prepare string for hash
                string values = String.Join(valuesSeparator.ToString(), hashItems.Keys);
                chkAll.Attributes.Add("onclick", String.Format("SelectAllItems(this,'{0}')", ValidationHelper.GetHashString(values)));

                uniGrid.GridView.HeaderRow.Cells[0].Controls.Clear();
                uniGrid.GridView.HeaderRow.Cells[0].Controls.Add(chkAll);
                uniGrid.GridView.Columns[0].ItemStyle.CssClass = "unigrid-selection";

                uniGrid.GridView.HeaderRow.Cells[1].Text = GetString("general.itemname");

                ltlScript.Text += ScriptHelper.GetScript(@"function GetCheckboxAllElement() { return document.getElementById('" + chkAll.ClientID + @"'); }");
            }
            break;

            // Single selection
            default:
            {
                uniGrid.GridView.Columns[0].Visible      = false;
                uniGrid.GridView.HeaderRow.Cells[1].Text = GetString("general.itemname");
            }
            break;
            }
        }

        base.OnPreRender(e);
    }
コード例 #14
0
    /// <summary>
    /// Change header title for multiple selection.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            ChangeSearchCondition();
        }

        // Load the grid data
        ReloadGrid();

        if (uniGrid.GridView.HeaderRow != null)
        {
            switch (selectionMode)
            {
            // Multiple selection
            case SelectionModeEnum.Multiple:
            case SelectionModeEnum.MultipleTextBox:
            case SelectionModeEnum.MultipleButton:
            {
                // Prepare string for hash
                StringBuilder sb = new StringBuilder();
                sb.Append(";");
                foreach (var item in hashItems)
                {
                    sb.Append(string.Format("{0};", item.Key));
                }

                // Add checkbox for selection of all items on the current page
                CMSCheckBox chkAll = new CMSCheckBox();
                chkAll.ID      = "chkAll";
                chkAll.ToolTip = GetString("UniSelector.CheckAll");
                chkAll.Attributes.Add("onclick", string.Format("SelectAllItems(this,'{0}')", ValidationHelper.GetHashString(sb.ToString().Trim(new [] { ';' }))));

                uniGrid.GridView.HeaderRow.Cells[0].Controls.Clear();
                uniGrid.GridView.HeaderRow.Cells[0].Controls.Add(chkAll);
                uniGrid.GridView.Columns[0].ItemStyle.CssClass = "unigrid-selection";

                uniGrid.GridView.HeaderRow.Cells[1].Text = GetString(resourcePrefix + ".itemname|general.itemname");
            }
            break;

            // Single selection
            default:
            {
                uniGrid.GridView.Columns[0].Visible      = false;
                uniGrid.GridView.HeaderRow.Cells[1].Text = GetString(resourcePrefix + ".itemname|general.itemname");
            }
            break;
            }
        }

        base.OnPreRender(e);
    }
コード例 #15
0
    /// <summary>
    /// Sets value to TreeNode property given by field name.
    /// </summary>
    /// <param name="node">Current instance of edited node</param>
    /// <param name="fieldName">Name of field which can have inherited value</param>
    private void SetField(TreeNode node, string fieldName)
    {
        node.SetValue(fieldName, null);

        CMSCheckBox chk = GetCheckBox(fieldName);

        if (!chk.Checked)
        {
            // Set not inherited value
            node.SetValue(fieldName, Control.FieldControls[fieldName].Value);
        }
    }
コード例 #16
0
    /// <summary>
    /// Gets <c>CheckBox</c> control used for key value editing.
    /// </summary>
    /// <param name="groupNo">Number representing index of the processing settings group</param>
    /// <param name="keyNo">Number representing index of the processing SettingsKeyInfo</param>
    /// <param name="checked">Checked</param>
    /// <param name="enabled">Enabled</param>
    private CMSCheckBox GetValueCheckBox(int groupNo, int keyNo, bool @checked, bool enabled)
    {
        var chkValue = new CMSCheckBox
        {
            ID = string.Format("chkKey{0}{1}", groupNo, keyNo),
            EnableViewState = false,
            Checked         = @checked,
            Enabled         = enabled,
            CssClass        = "checkbox-no-label"
        };

        return(chkValue);
    }
コード例 #17
0
    /// <summary>
    /// Gets inherit <c>CheckBox</c> instance for the input <c>SettingsKeyInfo</c> object.
    /// </summary>
    /// <param name="groupNo">Number representing index of the processing settings group</param>
    /// <param name="keyNo">Number representing index of the processing SettingsKeyInfo</param>
    private CMSCheckBox GetInheritCheckBox(int groupNo, int keyNo)
    {
        var chkInherit = new CMSCheckBox
        {
            ID              = string.Format(@"chkInherit{0}{1}", groupNo, keyNo),
            Text            = GetString("settings.keys.checkboxinheritglobal"),
            EnableViewState = true,
            AutoPostBack    = true,
            CssClass        = "field-value-override-checkbox"
        };

        return(chkInherit);
    }
    /// <summary>
    /// Creates <see cref="TableCell"/> with a checkbox checked if <param name="value"/> is true for given <paramref name="column"/>.
    /// Checkbox indicates what kind of an action can be performed on given <paramref name="column"/> e.g. faceting.
    /// </summary>
    private TableCell CreateTableCell(string searchField, ColumnDefinition column, bool value, string toolTipResourceString)
    {
        var isRequiredField = IsFieldConfigurationRequired(mDci.ClassName, column.ColumnName, searchField);

        var tc  = new TableCell();
        var chk = new CMSCheckBox();

        chk.ID      = column.ColumnName + searchField;
        chk.Enabled = !isRequiredField;
        chk.Checked = isRequiredField || value;
        chk.ToolTipResourceString = toolTipResourceString;
        tc.Controls.Add(chk);

        return(tc);
    }
コード例 #19
0
    /// <summary>
    /// Ensures special handling for DocumentTagGroup field on subpages. If any tag group is selected, inherited configuration is set.
    /// </summary>
    protected void Control_OnAfterSave(object sender, EventArgs e)
    {
        if (!tagsVisible || (Node.DocumentTagGroupID > 0) || Node.IsRoot())
        {
            return;
        }

        CMSCheckBox           checkBox    = GetCheckBox("DocumentTagGroupID");
        FormEngineUserControl mainControl = Control.FieldControls["DocumentTagGroupID"];

        if ((checkBox != null) && (mainControl != null))
        {
            checkBox.Checked    = true;
            mainControl.Enabled = false;
        }
    }
コード例 #20
0
    /// <summary>
    /// Append display content checkbox to tabs header
    /// </summary>
    private void AppendDesignContentCheckBox()
    {
        pnlContent          = new Panel();
        pnlContent.ID       = "pc";
        pnlContent.CssClass = "design-showcontent";

        chkContent                 = new CMSCheckBox();
        chkContent.Text            = Control.GetString("EditTabs.DisplayContent");
        chkContent.ID              = "chk";
        chkContent.AutoPostBack    = true;
        chkContent.EnableViewState = false;
        chkContent.Checked         = PortalHelper.DisplayContentInDesignMode;
        chkContent.CheckedChanged += ContentCheckBoxCheckedChanged;

        pnlContent.Controls.Add(chkContent);

        Control.Parent.Controls.Add(pnlContent);
    }
    /// <summary>
    /// Append display content checkbox to tabs header
    /// </summary>
    private void AppendDesignContentCheckBox()
    {
        pnlContent = new Panel();
        pnlContent.ID = "pc";
        pnlContent.CssClass = "design-showcontent";

        chkContent = new CMSCheckBox();
        chkContent.Text = Control.GetString("EditTabs.DisplayContent");
        chkContent.ID = "chk";
        chkContent.AutoPostBack = true;
        chkContent.EnableViewState = false;
        chkContent.Checked = PortalHelper.DisplayContentInUIElementDesignMode;
        chkContent.CheckedChanged += ContentCheckBoxCheckedChanged;

        pnlContent.Controls.Add(chkContent);

        Control.Parent.Controls.Add(pnlContent);
    }
コード例 #22
0
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "remove":
            bool rejected = ValidationHelper.GetString(((DataRowView)((GridViewRow)parameter).DataItem).Row["FriendStatus"], string.Empty) == "1";
            // Disable checkbox
            GridViewRow row = (GridViewRow)parameter;

            Control control = ControlsHelper.GetChildControl(row, typeof(CMSCheckBox));
            if (control != null)
            {
                CMSCheckBox checkBox = (CMSCheckBox)control;
                checkBox.Enabled = !rejected;
            }
            // Disable button
            if (rejected || !friendsManagePermission)
            {
                CMSGridActionButton button = ((CMSGridActionButton)sender);
                button.Enabled = false;
            }
            break;

        case "status":
            // Set status (rejected/waiting)
            FriendshipStatusEnum status =
                (FriendshipStatusEnum)Enum.Parse(typeof(FriendshipStatusEnum), parameter.ToString());
            switch (status)
            {
            case FriendshipStatusEnum.Waiting:
                parameter = "<span class=\"Waiting\">" + GetString("friends.waiting") + "</span>";
                break;

            case FriendshipStatusEnum.Rejected:
                parameter = "<span class=\"Rejected\">" + GetString("general.rejected") + "</span>";
                break;
            }
            break;

        case "formattedusername":
            return(HTMLHelper.HTMLEncode(Functions.GetFormattedUserName(Convert.ToString(parameter), IsLiveSite)));
        }
        return(parameter);
    }
コード例 #23
0
    /// <summary>
    /// External unigrid databound.
    /// </summary>
    protected object VariantGrid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        DataRowView row = (DataRowView)parameter;

        switch (sourceName)
        {
        case UniGrid.SELECTION_EXTERNAL_DATABOUND:

            // Disable checkbox if variant already exists
            if (ExistingItems.Contains(ValidationHelper.GetString(row["RowNumber"], string.Empty)))
            {
                CMSCheckBox chkBox = (CMSCheckBox)sender;
                chkBox.Enabled = false;
            }

            break;
        }

        return(parameter);
    }
コード例 #24
0
    /// <summary>
    /// Sets SkinId to all controls in logon form.
    /// </summary>
    private void SetSkinID(string skinId)
    {
        if (skinId != "")
        {
            Login1.SkinID = skinId;

            LocalizedLabel lbl = (LocalizedLabel)Login1.FindControl("lblUserName");
            if (lbl != null)
            {
                lbl.SkinID = skinId;
            }
            lbl = (LocalizedLabel)Login1.FindControl("lblPassword");
            if (lbl != null)
            {
                lbl.SkinID = skinId;
            }

            TextBox txt = (TextBox)Login1.FindControl("UserName");
            if (txt != null)
            {
                txt.SkinID = skinId;
            }
            txt = (TextBox)Login1.FindControl("Password");
            if (txt != null)
            {
                txt.SkinID = skinId;
            }

            CMSCheckBox chk = (CMSCheckBox)Login1.FindControl("chkRememberMe");
            if (chk != null)
            {
                chk.SkinID = skinId;
            }

            LocalizedButton btn = (LocalizedButton)Login1.FindControl("LoginButton");
            if (btn != null)
            {
                btn.SkinID = skinId;
            }
        }
    }
コード例 #25
0
    /// <summary>
    /// For each notification gateway provider validates its notification form data.
    ///	If validation fails returns concatenated error messages from each form otherwise returns empty string.
    /// </summary>
    public override string Validate()
    {
        string errorMessage = String.Empty;

        // Check public user
        if (EventUserID > 0)
        {
            UserInfo ui = UserInfoProvider.GetUserInfo(EventUserID);
            if ((ui != null) && (ui.IsPublic()))
            {
                return(GetString("notifications.subscribe.anonymous"));
            }
        }
        else
        {
            if ((MembershipContext.AuthenticatedUser != null) && (MembershipContext.AuthenticatedUser.IsPublic()))
            {
                return(GetString("notifications.subscribe.anonymous"));
            }
        }

        for (int i = 0; i < NotificationGateways.Count; i++)
        {
            // Validate only loaded forms which are displayed
            CMSCheckBox            chk = controls[i, 0] as CMSCheckBox;
            CMSNotificationGateway g   = controls[i, 2] as CMSNotificationGateway;
            string err = g.NotificationGatewayForm.Validate();
            if ((g.NotificationGatewayForm != null) && (chk != null) && (chk.Checked) && !String.IsNullOrEmpty(err))
            {
                errorMessage += "<br />" + g.NotificationGatewayObj.GatewayDisplayName + ": " + err;
            }
        }

        // Remove first "<br />" which is not needed
        if (errorMessage != String.Empty)
        {
            errorMessage = errorMessage.Substring(6);
        }

        return(errorMessage);
    }
コード例 #26
0
    /// <summary>
    /// Returns list of names of files selected in thumbnails view mode.
    /// </summary>
    private List <string> GetThumbsSelectedItems()
    {
        List <string> result = new List <string>();

        // Go through all repeater items and look for selected ones
        foreach (RepeaterItem item in repThumbnailsView.Items)
        {
            CMSCheckBox chkSelected = item.FindControl("chkSelected") as CMSCheckBox;
            if ((chkSelected != null) && chkSelected.Checked)
            {
                HiddenField hdnItemName = item.FindControl("hdnItemName") as HiddenField;
                if (hdnItemName != null)
                {
                    string alt = hdnItemName.Value;
                    result.Add(alt);
                }
            }
        }

        return(result);
    }
    /// <summary>
    /// Append display content checkbox to tabs header
    /// </summary>
    private void AppendDesignContentCheckBox()
    {
        pnlContent = new Panel
        {
            ID       = "pc",
            CssClass = "design-showcontent"
        };

        chkContent = new CMSCheckBox
        {
            Text            = Control.GetString("EditTabs.DisplayContent"),
            ID              = "chk",
            AutoPostBack    = true,
            EnableViewState = false,
            Checked         = PortalHelper.DisplayContentInUIElementDesignMode
        };
        chkContent.CheckedChanged += ContentCheckBoxCheckedChanged;

        pnlContent.Controls.Add(chkContent);

        Control.Parent.Controls.Add(pnlContent);
    }
コード例 #28
0
    /// <summary>
    /// Gets CheckBox control for given field name
    /// </summary>
    /// <param name="fieldName">Name of field which can have inherited value</param>
    private CMSCheckBox GetCheckBox(string fieldName)
    {
        if (checkboxes.ContainsKey(fieldName))
        {
            // Return from dictionary
            return(checkboxes[fieldName]);
        }

        FormEngineUserControl control = Control.FieldControls[fieldName + SUFFIX_INHERIT];

        if (control != null)
        {
            // Get checkbox from form control
            CMSCheckBox checkbox = ControlsHelper.GetChildControl <CMSCheckBox>(control);
            if (checkbox != null)
            {
                checkboxes[fieldName] = checkbox;
                return(checkbox);
            }
        }

        return(null);
    }
コード例 #29
0
    /// <summary>
    /// Gets user effective resource permission HTML content.
    /// </summary>
    private void GenerateBeforeRowsContent()
    {
        ResourceInfo resource = ResourceInfo.Provider.Get(Permission.ResourceId);

        // Check if every necessary property is set
        if ((SelectedUser != null) && (Permission != null) && (resource != null))
        {
            // Initialize variables used during rendering
            string userName = HTMLHelper.HTMLEncode(TextHelper.LimitLength(Functions.GetFormattedUserName(SelectedUser.UserName, SelectedUser.FullName), 50));
            bool   authorizedPerResource = UserInfoProvider.IsAuthorizedPerResource(resource.ResourceName, Permission.PermissionName, siteSelector.SiteName, SelectedUser);

            // Create header table cell
            var tcHeader = new TableCell
            {
                CssClass = "matrix-header",
                ToolTip  = userName,
                Text     = userName
            };

            var tr = gridMatrix.ContentBeforeRow;
            tr.Cells.Add(tcHeader);

            // Create resource permission cell
            var tc  = new TableCell();
            var chk = new CMSCheckBox
            {
                Checked = SelectedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin) || authorizedPerResource,
                Enabled = false,
                ToolTip = GetString("Administration-Permissions_Matrix.NotAdjustable")
            };
            tc.Controls.Add(chk);

            tr.Cells.Add(tc);

            UniMatrix.AddFillingCell <TableCell>(tr);
        }
    }
コード例 #30
0
    /// <summary>
    /// On btnVote click event handler.
    /// </summary>
    protected void btnVote_OnClick(object sender, EventArgs e)
    {
        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(SiteContext.CurrentSiteName, BanControlEnum.AllNonComplete))
        {
            lblInfo.CssClass = "ErrorMessage";
            lblInfo.Text     = GetString("General.BannedIP");
            return;
        }

        if (pi != null)
        {
            // Indicates whether user voted or not
            bool voted = false;

            // Indicates wheter all forms of all open-ended answers can be saved
            bool       formsAreValid   = true;
            List <int> selectedAnswers = new List <int>();

            // Check if user has already voted
            if ((CheckVoted) && (PollInfoProvider.HasVoted(pi.PollID)))
            {
                errMessage = GetString("Polls.UserHasVoted");
                voted      = true;
            }
            else if (isOpened)
            {
                // Get poll answers
                DataSet ds = Answers;
                if (!DataHelper.DataSourceIsEmpty(ds))
                {
                    DataRowCollection rows = ds.Tables[0].Rows;

                    CMSCheckBox    chkItem  = null;
                    CMSRadioButton radItem  = null;
                    bool           selected = false;
                    PollAnswerInfo pai      = null;
                    BizForm        bizItem  = null;

                    foreach (DataRow row in rows)
                    {
                        pai = new PollAnswerInfo(row);

                        if ((pai != null) && (pai.AnswerEnabled))
                        {
                            selected = false;

                            // Find specific controls and update pollanswerinfo if controls are checked
                            if (pi.PollAllowMultipleAnswers)
                            {
                                // Find checkbox
                                chkItem = (CMSCheckBox)pnlAnswer.FindControl("chk" + pai.AnswerID);

                                if (chkItem != null)
                                {
                                    selected = chkItem.Checked;
                                }
                            }
                            else
                            {
                                // Find radiobutton
                                radItem = (CMSRadioButton)pnlAnswer.FindControl("rad" + pai.AnswerID);

                                if (radItem != null)
                                {
                                    selected = radItem.Checked;
                                }
                            }

                            if ((selected) && (pai.AnswerCount < Int32.MaxValue))
                            {
                                bool canBeSaved = false;
                                bizItem = (BizForm)pnlAnswer.FindControl("frm" + pai.AnswerID);

                                if (bizItem == null)
                                {
                                    canBeSaved = true;
                                }
                                else if (bizItem != null)
                                {
                                    // Validate form data
                                    canBeSaved = bizItem.ValidateData();
                                }

                                if (canBeSaved)
                                {
                                    selectedAnswers.Add(pai.AnswerID);
                                }
                                else
                                {
                                    formsAreValid = false;
                                }
                            }
                        }
                    }

                    if (formsAreValid)
                    {
                        if (selectedAnswers.Count > 0)
                        {
                            foreach (int aid in selectedAnswers)
                            {
                                // Set the vote
                                PollAnswerInfoProvider.Vote(aid);
                                // Save the bizform data
                                bizItem = (BizForm)pnlAnswer.FindControl("frm" + aid);
                                if (bizItem != null)
                                {
                                    if (bizItem != null)
                                    {
                                        bizItem.SaveData(null, false);
                                    }
                                }
                            }
                            voted = true;
                        }
                        else
                        {
                            // Set error message if no answer selected
                            lblInfo.CssClass = "ErrorMessage";
                            lblInfo.Text     = GetString("Polls.DidNotVoted");
                        }
                    }

                    if (voted)
                    {
                        LogActivity(pi, selectedAnswers);
                    }

                    if ((CheckVoted) && (voted))
                    {
                        // Create cookie about user's voting
                        PollInfoProvider.SetVoted(pi.PollID);
                    }
                }
            }

            if (voted)
            {
                // Clear cache if it's used
                Answers = null;
                // Reload poll control
                ReloadData(true);

                if (OnAfterVoted != null)
                {
                    OnAfterVoted(this, EventArgs.Empty);
                }
            }
        }
    }
コード例 #31
0
    /// <summary>
    /// Generate body of the matrix.
    /// </summary>
    /// <param name="matrixData">Data of the matrix to be generated</param>
    private void GenerateMatrixBody(List<DataRow> matrixData)
    {
        string lastRowId = "";
        int colIndex = 0;
        int rowIndex = 0;

        TableRow tr = null;
        TableCell tc = null;

        // Render matrix rows
        int step = matrixData.Count;
        for (int i = 0; i < ds.Tables[0].Rows.Count; i = i + step)
        {
            foreach (int index in ColumnOrderIndex)
            {
                DataRow rowData = ds.Tables[0].Rows[i + index];
                string rowId = ValidationHelper.GetString(rowData[RowItemIDColumn], "");

                // Detect new matrix row
                if (rowId != lastRowId)
                {
                    if ((ItemsPerPage > 0) && (rowIndex++ >= ItemsPerPage))
                    {
                        break;
                    }

                    // New Table row
                    tr = new TableRow
                    {
                        CssClass = GetAdditionalCssClass(rowData),
                        EnableViewState = false
                    };
                    tblMatrix.Rows.Add(tr);

                    // Header table cell
                    tc = new TableCell
                    {
                        CssClass = "matrix-header",
                        Text = HTMLHelper.HTMLEncode(MacroResolver.Resolve(ValidationHelper.GetString(rowData[RowItemDisplayNameColumn], null))),
                        ToolTip = (RowItemTooltipColumn != null) ? GetTooltip(rowData, RowItemTooltipColumn) : null,
                        EnableViewState = false
                    };
                    tr.Cells.Add(tc);

                    // Add disabled mark if needed
                    if (!IsRowEditable(rowId))
                    {
                        tc.Text += DisabledRowMark;
                    }

                    // Add global suffix if is required
                    if ((index == 0) && (AddGlobalObjectSuffix) && (ValidationHelper.GetInteger(rowData[SiteIDColumnName], 0) == 0))
                    {
                        tc.Text += " " + GetString("general.global");
                    }

                    // Update
                    lastRowId = rowId;
                    colIndex = 0;
                }

                object columnValue = rowData[ColumnItemIDColumn];
                var cellId = string.Format("chk:{0}:{1}", rowId, columnValue);

                // New table cell
                tc = new TableCell
                {
                    EnableViewState = false
                };
                tr.Cells.Add(tc);

                // Checkbox for data
                var chk = new CMSCheckBox
                {
                    ID = cellId,
                    ClientIDMode = ClientIDMode.Static,
                    ToolTip = GetTooltip(rowData, ItemTooltipColumn),
                    Checked = ValidationHelper.GetBoolean(rowData["Allowed"], false),
                    Enabled = Enabled &&
                              !disabledColumns.Contains(colIndex) &&
                              IsColumnEditable(columnValue) &&
                              IsRowEditable(rowId),
                    EnableViewState = false
                };
                tc.Controls.Add(chk);

                // Add click event to enabled checkbox
                if (chk.Enabled)
                {
                    chk.Attributes.Add("onclick", "UM_ItemChanged_" + ClientID + "(this);");
                }

                colIndex++;
            }
        }
    }
コード例 #32
0
    /// <summary>
    /// Creates table.
    /// </summary>
    private void CreateTable(bool setAutomatically)
    {
        Table table = new Table();
        table.CssClass = "table table-hover";
        table.CellPadding = -1;
        table.CellSpacing = -1;

        // Create table header
        TableHeaderRow header = new TableHeaderRow();
        header.TableSection = TableRowSection.TableHeader;
        TableHeaderCell thc = new TableHeaderCell();
        thc.Text = GetString("srch.settings.fieldname");
        thc.Scope = TableHeaderScope.Column;
        header.Cells.Add(thc);
        thc = new TableHeaderCell();
        thc.Text = GetString("development.content");
        thc.Scope = TableHeaderScope.Column;
        header.Cells.Add(thc);
        thc = new TableHeaderCell();
        thc.Text = GetString("srch.settings.searchable");
        thc.Scope = TableHeaderScope.Column;
        header.Cells.Add(thc);
        thc = new TableHeaderCell();
        thc.Text = GetString("srch.settings.tokenized");
        thc.Scope = TableHeaderScope.Column;
        header.Cells.Add(thc);

        if (DisplayIField)
        {
            thc = new TableHeaderCell();
            thc.Text = GetString("srch.settings.ifield");
            header.Cells.Add(thc);
        }

        thc = new TableHeaderCell();
        thc.CssClass = "main-column-100";
        header.Cells.Add(thc);

        table.Rows.Add(header);
        pnlContent.Controls.Add(table);

        // Create table content
        if ((mAttributes != null) && (mAttributes.Count > 0))
        {
            // Create row for each field
            foreach (ColumnDefinition column in mAttributes)
            {
                SearchSettingsInfo ssi = null;
                TableRow tr = new TableRow();
                if (!DataHelper.DataSourceIsEmpty(mInfos))
                {
                    DataRow[] dr = mInfos.Tables[0].Select("name = '" + column.ColumnName + "'");
                    if ((dr.Length > 0) && (mSearchSettings != null))
                    {
                        ssi = mSearchSettings.GetSettingsInfo((string)dr[0]["id"]);
                    }
                }

                // Add cell with field name
                TableCell tc = new TableCell();
                Label lbl = new Label();
                lbl.Text = column.ColumnName;
                tc.Controls.Add(lbl);
                tr.Cells.Add(tc);

                // Add cell with 'Content' value
                tc = new TableCell();
                CMSCheckBox chk = new CMSCheckBox();
                chk.ID = column.ColumnName + SearchSettings.CONTENT;

                if (setAutomatically)
                {
                    chk.Checked = SearchHelper.GetSearchFieldDefaultValue(SearchSettings.CONTENT, column.ColumnType);
                }
                else if (ssi != null)
                {
                    chk.Checked = ssi.Content;
                }

                tc.Controls.Add(chk);
                tr.Cells.Add(tc);

                // Add cell with 'Searchable' value
                tc = new TableCell();
                chk = new CMSCheckBox();
                chk.ID = column.ColumnName + SearchSettings.SEARCHABLE;

                if (setAutomatically)
                {
                    chk.Checked = SearchHelper.GetSearchFieldDefaultValue(SearchSettings.SEARCHABLE, column.ColumnType);
                }
                else if (ssi != null)
                {
                    chk.Checked = ssi.Searchable;
                }

                tc.Controls.Add(chk);
                tr.Cells.Add(tc);

                // Add cell with 'Tokenized' value
                tc = new TableCell();
                chk = new CMSCheckBox();
                chk.ID = column.ColumnName + SearchSettings.TOKENIZED;

                if (setAutomatically)
                {
                    chk.Checked = SearchHelper.GetSearchFieldDefaultValue(SearchSettings.TOKENIZED, column.ColumnType);
                }
                else if (ssi != null)
                {
                    chk.Checked = ssi.Tokenized;
                }

                tc.Controls.Add(chk);
                tr.Cells.Add(tc);

                // Add cell with 'iFieldname' value
                if (DisplayIField)
                {
                    tc = new TableCell();
                    CMSTextBox txt = new CMSTextBox();
                    txt.ID = column.ColumnName + SearchSettings.IFIELDNAME;
                    txt.CssClass += " form-control";
                    txt.MaxLength = 200;
                    if (ssi != null)
                    {
                        txt.Text = ssi.FieldName;
                    }
                    tc.Controls.Add(txt);
                    tr.Cells.Add(tc);
                }
                tc = new TableCell();
                tr.Cells.Add(tc);
                table.Rows.Add(tr);
            }
        }
    }
コード例 #33
0
 /// <summary>
 /// Resets given checkbox. Enables set to true, checked to false.
 /// </summary>
 protected void ResetCheckBox(CMSCheckBox chkBox)
 {
     chkBox.Enabled = true;
     chkBox.Checked = false;
 }
コード例 #34
0
    /// <summary>
    /// Gets <c>CheckBox</c> control used for key value editing.
    /// </summary>
    /// <param name="groupNo">Number representing index of the processing settings group</param>
    /// <param name="keyNo">Number representing index of the processing SettingsKeyInfo</param>
    /// <param name="checked">Checked</param>
    /// <param name="enabled">Enabled</param>
    private CMSCheckBox GetValueCheckBox(int groupNo, int keyNo, bool @checked, bool enabled)
    {
        var chkValue = new CMSCheckBox
        {
            ID = string.Format("chkKey{0}{1}", groupNo, keyNo),
            EnableViewState = false,
            Checked = @checked,
            Enabled = enabled,
            CssClass = "checkbox-no-label"
        };

        return chkValue;
    }
コード例 #35
0
    /// <summary>
    /// Gets user effective resource permission HTML content.
    /// </summary>
    private void GenerateBeforeRowsContent()
    {
        ResourceInfo resource = ResourceInfoProvider.GetResourceInfo(Permission.ResourceId);

        // Check if every necessary property is set
        if ((SelectedUser != null) && (Permission != null) && (resource != null))
        {
            // Initialize variables used during rendering
            string userName = HTMLHelper.HTMLEncode(TextHelper.LimitLength(Functions.GetFormattedUserName(SelectedUser.UserName, SelectedUser.FullName), 50));
            bool authorizedPerResource = UserInfoProvider.IsAuthorizedPerResource(resource.ResourceName, Permission.PermissionName, siteSelector.SiteName, SelectedUser);

            // Create header table cell
            var tcHeader = new TableCell
            {
                CssClass = "matrix-header",
                ToolTip = userName,
                Text = userName
            };
            gridMatrix.ContentBeforeRow.Cells.Add(tcHeader);

            // Create resource permission cell
            var tc = new TableCell();
            var chk = new CMSCheckBox
            {
                Checked = SelectedUser.IsGlobalAdministrator || authorizedPerResource,
                Enabled = false,
                ToolTip = GetString("Administration-Permissions_Matrix.NotAdjustable")
            };
            tc.Controls.Add(chk);
            gridMatrix.ContentBeforeRow.Cells.Add(tc);
        }
    }
コード例 #36
0
    /// <summary>
    /// Change header title for multiple selection.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            ChangeSearchCondition();
        }

        // Load the grid data
        ReloadGrid();

        if (uniGrid.GridView.HeaderRow != null)
        {
            switch (selectionMode)
            {
                // Multiple selection
                case SelectionModeEnum.Multiple:
                case SelectionModeEnum.MultipleTextBox:
                case SelectionModeEnum.MultipleButton:
                    {
                        // Prepare string for hash
                        StringBuilder sb = new StringBuilder();
                        sb.Append(";");
                        foreach (var item in hashItems)
                        {
                            sb.Append(string.Format("{0};", item.Key));
                        }

                        // Add checkbox for selection of all items on the current page
                        CMSCheckBox chkAll = new CMSCheckBox();
                        chkAll.ID = "chkAll";
                        chkAll.ToolTip = GetString("UniSelector.CheckAll");
                        chkAll.Attributes.Add("onclick", string.Format("SelectAllItems(this,'{0}')", ValidationHelper.GetHashString(sb.ToString().Trim(new [] { ';' }))));

                        uniGrid.GridView.HeaderRow.Cells[0].Controls.Clear();
                        uniGrid.GridView.HeaderRow.Cells[0].Controls.Add(chkAll);
                        uniGrid.GridView.Columns[0].ItemStyle.CssClass = "unigrid-selection";

                        uniGrid.GridView.HeaderRow.Cells[1].Text = GetString(resourcePrefix + ".itemname|general.itemname");
                    }
                    break;

                // Single selection
                default:
                    {
                        uniGrid.GridView.Columns[0].Visible = false;
                        uniGrid.GridView.HeaderRow.Cells[1].Text = GetString(resourcePrefix + ".itemname|general.itemname");
                    }
                    break;
            }
        }

        base.OnPreRender(e);
    }
コード例 #37
0
    /// <summary>
    /// Creates poll answer section.
    /// </summary>
    /// <param name="reload">Indicates postback</param>
    /// <param name="hasVoted">Indicates if user has voted</param>
    protected void CreateAnswerSection(bool reload, bool hasVoted)
    {
        pnlAnswer.Controls.Clear();

        if (pi != null)
        {
            // Get poll's answers
            DataSet ds = Answers;
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                int count = 0;
                int maxCount = 0;
                long sumCount = 0;
                bool hideSomeForm = false;

                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    // Sum answer counts and get highest
                    if (ValidationHelper.GetBoolean(row["AnswerEnabled"], true))
                    {
                        count = ValidationHelper.GetInteger(row["AnswerCount"], 0);
                        sumCount += count;
                        if (count > maxCount)
                        {
                            maxCount = count;
                        }
                    }

                    // Check if any open-ended answer form should be hidden
                    if (ValidationHelper.GetBoolean(row["AnswerHideForm"], false))
                    {
                        hideSomeForm = true;
                    }
                }

                CMSCheckBox chkItem = null;
                CMSRadioButton radItem = null;
                LocalizedLabel lblItem = null;
                BizForm viewBiz = null;
                string formName = null;
                int index = 0;
                bool enabled = false;

                bool bizFormsAvailable = ModuleManager.IsModuleLoaded(ModuleName.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.BIZFORM, SiteContext.CurrentSiteName);

                pnlAnswer.Controls.Add(new LiteralControl("<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"));

                // Create the answers
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    enabled = ValidationHelper.GetBoolean(row["AnswerEnabled"], true);
                    if (enabled)
                    {
                        pnlAnswer.Controls.Add(new LiteralControl("<tr><td class=\"PollAnswer\" colspan=\"2\">"));

                        if (((reload) && (ShowResultsAfterVote)) || (!hasPermission && !HideWhenNotAuthorized)
                            || (!isOpened && !HideWhenNotOpened) || (CheckVoted && PollInfoProvider.HasVoted(pi.PollID)))
                        {
                            // Add label
                            lblItem = new LocalizedLabel();
                            lblItem.ID = "lbl" + ValidationHelper.GetInteger(row["AnswerID"], 0);
                            lblItem.EnableViewState = false;
                            lblItem.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(row["AnswerText"], string.Empty));
                            lblItem.CssClass = "PollAnswerText";

                            pnlAnswer.Controls.Add(lblItem);
                        }
                        else
                        {
                            if (pi.PollAllowMultipleAnswers)
                            {
                                // Add checkboxes for multiple answers
                                chkItem = new CMSCheckBox();
                                chkItem.ID = "chk" + ValidationHelper.GetInteger(row["AnswerID"], 0);
                                chkItem.AutoPostBack = false;
                                chkItem.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(row["AnswerText"], string.Empty));
                                chkItem.Checked = false;
                                chkItem.CssClass = "PollAnswerCheck";

                                if (hideSomeForm)
                                {
                                    chkItem.AutoPostBack = true;
                                    chkItem.CheckedChanged += AnswerSelectionChanged;
                                }
                                pnlAnswer.Controls.Add(chkItem);
                            }
                            else
                            {
                                // Add radiobuttons
                                radItem = new CMSRadioButton();
                                radItem.ID = "rad" + ValidationHelper.GetInteger(row["AnswerID"], 0);
                                radItem.AutoPostBack = false;
                                radItem.GroupName = pi.PollCodeName + "Group";
                                radItem.Text = HTMLHelper.HTMLEncode(ValidationHelper.GetString(row["AnswerText"], string.Empty));
                                radItem.Checked = false;
                                radItem.CssClass = "PollAnswerRadio";

                                if (hideSomeForm)
                                {
                                    radItem.AutoPostBack = true;
                                    radItem.CheckedChanged += AnswerSelectionChanged;
                                }

                                pnlAnswer.Controls.Add(radItem);
                            }

                            formName = ValidationHelper.GetString(row["AnswerForm"], string.Empty);

                            if (!string.IsNullOrEmpty(formName) && bizFormsAvailable)
                            {
                                // Add forms for open ended answers
                                viewBiz = new BizForm();
                                viewBiz.FormName = formName;
                                viewBiz.SiteName = SiteContext.CurrentSiteName;
                                viewBiz.AlternativeFormFullName = ValidationHelper.GetString(row["AnswerAlternativeForm"], string.Empty);
                                viewBiz.ID = "frm" + ValidationHelper.GetInteger(row["AnswerID"], 0);
                                viewBiz.IsLiveSite = IsLiveSite;
                                viewBiz.OnAfterDataLoad += Form_AfterDataLoad;
                                viewBiz.CssClass = "PollAnswerForm";
                                viewBiz.Visible = !ValidationHelper.GetBoolean(row["AnswerHideForm"], false);
                                viewBiz.FormClearAfterSave = true;
                                viewBiz.FormRedirectToUrl = String.Empty;
                                viewBiz.FormDisplayText = String.Empty;
                                pnlAnswer.Controls.Add(viewBiz);
                            }
                        }

                        pnlAnswer.Controls.Add(new LiteralControl("</td></tr>"));

                        if (ShowGraph || (hasVoted || reload) && ShowResultsAfterVote)
                        {
                            // Create graph under the answer
                            CreateGraph(maxCount, ValidationHelper.GetInteger(row["AnswerCount"], 0), sumCount, index);
                        }

                        index++;
                    }
                }

                pnlAnswer.Controls.Add(new LiteralControl("</table>"));
            }
        }
    }
コード例 #38
0
    /// <summary>
    /// Load options definition.
    /// </summary>
    /// <param name="options">Options configuration</param>
    /// <param name="filterWrapperControl">Wrapper control for filter</param>
    private void LoadOptionsDefinition(UniGridOptions options, Control filterWrapperControl)
    {
        // Add custom filter or filter wrapper panel according to the key value "DisplayFilter"
        displayFilter = options.DisplayFilter;

        if (displayFilter)
        {
            // Add custom filter
            if (!mCustomFilterAdded && !string.IsNullOrEmpty(options.FilterPath))
            {
                UniGridFilterField filterDefinition = new UniGridFilterField();
                CMSAbstractBaseFilterControl filterControl = LoadFilterControl(options.FilterPath, CUSTOM_FILTER_SOURCE_NAME, null, filterDefinition);
                FilterFields[CUSTOM_FILTER_SOURCE_NAME] = filterDefinition;
                mCustomFilterAdded = true;

                plcFilter.Controls.Add(filterControl);

                RaiseOnFilterFieldCreated(null, filterDefinition);
            }
            // Add wrapper panel for default filter
            else
            {
                plcFilter.Controls.Add(filterWrapperControl);
            }
        }

        // Filter limit
        if (options.FilterLimit > -1)
        {
            FilterLimit = options.FilterLimit;
        }

        // Display sort direction images
        showSortDirection = options.ShowSortDirection;

        // Display selection column with checkboxes
        showSelection = options.ShowSelection;
        if (showSelection)
        {
            TemplateField chkColumn = new TemplateField();

            using (CMSCheckBox headerBox = new CMSCheckBox
            {
                ID = "headerBox"
            })
            {
                using (CMSCheckBox itemBox = new CMSCheckBox
                {
                    ID = "itemBox"
                })
                {
                    // Set selection argument
                    itemBox.Attributes["selectioncolumn"] = options.SelectionColumn;
                    chkColumn.HeaderTemplate = new GridViewTemplate(ListItemType.Header, this, headerBox);
                    chkColumn.ItemTemplate = new GridViewTemplate(ListItemType.Item, this, itemBox);
                }
            }
            GridView.Columns.Add(chkColumn);
        }

        // PageSize and DisplayPageSizeDropdown properties are obsolete.
        // This code ensures backward compatibility.
        // #pragma statement disables warnings for using obsolete attribute.
        #pragma warning disable 612, 618
        if (!String.IsNullOrEmpty(options.PageSize))
        {
            Pager.PageSizeOptions = options.PageSize;
        }

        // Set paging according to the key value "DisplayPageSizeDropdown"
        if (options.DisplayPageSizeDropdown != null)
        {
            Pager.ShowPageSize = options.DisplayPageSizeDropdown.Value;
        }
        #pragma warning restore 612, 618
    }
    /// <summary>
    /// Generate control output.
    /// </summary>
    public void GenerateContent()
    {
        string templatePath = DepartmentTemplatePath;
        if (String.IsNullOrEmpty(templatePath))
        {
            ltlContent.Text = ResHelper.GetString("departmentsectionsmanager.notemplate");
            ltlContent.Visible = true;
        }
        else
        {
            if (!DataHelper.DataSourceIsEmpty(TemplateDocuments))
            {
                int counter = 0;
                Table tb = new Table();

                string value = ValidationHelper.GetString(mSelectedValue, "");
                string docAliases = ";" + value.ToLowerCSafe() + ";";

                TreeNode editedNode = (TreeNode)Form.EditedObject;

                if (Form.IsInsertMode)
                {
                    // Alias path for new department has to have special 'child node path' because of correct check for document type scopes
                    editedNode.SetValue("NodeAliasPath", ((TreeNode)Form.ParentObject).NodeAliasPath + "/department");
                }

                TableRow tr = new TableRow();
                foreach (DataRow drDoc in TemplateDocuments.Tables[0].Rows)
                {
                    // For each section td element is generated
                    string docAlias = ValidationHelper.GetString(drDoc["NodeAlias"], "");

                    TableCell td = new TableCell();
                    CMSCheckBox cbCell = new CMSCheckBox();
                    cbCell.ID = "chckSection" + counter;
                    cbCell.Text = docAlias;
                    cbCell.Attributes.Add("Value", docAlias);

                    // Check if child allowed
                    int sourceClassId = ValidationHelper.GetInteger(drDoc["NodeClassID"], 0);
                    if (!DocumentHelper.IsDocumentTypeAllowed(editedNode, sourceClassId))
                    {
                        cbCell.Enabled = false;
                        cbCell.ToolTip = ResHelper.GetString("departmentsectionsmanager.notallowedchild");
                    }

                    // Disable default hidden documents
                    if (HIDDEN_DOCUMENT_ALIAS.Contains(";" + docAlias.ToLowerCSafe() + ";"))
                    {
                        cbCell.Checked = cbCell.Enabled;
                        cbCell.Enabled = false;
                    }

                    // Check for selected value
                    if (docAliases.Contains(";" + docAlias.ToLowerCSafe() + ";") || ((mSelectedValue == null) && (Form.Mode == FormModeEnum.Insert)))
                    {
                        if (cbCell.Enabled)
                        {
                            cbCell.Checked = true;
                        }
                    }

                    // If editing existing document register alert script
                    if ((Form.Mode != FormModeEnum.Insert) && cbCell.Checked)
                    {
                        cbCell.Attributes.Add("OnClick", "if(!this.checked){alert(" + ScriptHelper.GetString(ResHelper.GetString("departmentsectionsmanagerformcontrol.removesectionwarning")) + ");}");
                    }

                    // Add reference to checkbox arraylist
                    CheckboxReferences.Add(cbCell);
                    counter++;

                    td.Controls.Add(cbCell);
                    tr.Cells.Add(td);

                    // If necessary create new row
                    if ((counter % ITEMS_PER_ROW) == 0)
                    {
                        tr.CssClass = "Row";
                        tb.Rows.Add(tr);
                        tr = new TableRow();
                    }
                }
                // If last row contains data add it
                if (counter > 0)
                {
                    tb.Rows.Add(tr);
                }
                pnlContent.Controls.Add(tb);
            }
            else
            {
                ltlContent.Text = ResHelper.GetString("departmentsectionsmanager.notemplate");
                ltlContent.Visible = true;
            }
        }
    }
コード例 #40
0
 /// <summary>
 /// Sets value to enabled checkbox.
 /// </summary>
 /// <param name="chkBox">Checkbox to use</param>
 /// <param name="checkedValue">Checked value</param>
 private static void CheckEnabledCheckbox(CMSCheckBox chkBox, bool checkedValue)
 {
     if (chkBox.Enabled)
     {
         chkBox.Checked = checkedValue;
     }
 }
コード例 #41
0
 /// <summary>
 /// Checks checkbox if provided value is true.
 /// </summary>
 protected void SetCheckBoxWithNativePermission(CMSCheckBox chkBox, bool value)
 {
     if (value)
     {
         chkBox.Checked = true;
     }
 }
コード例 #42
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StopProcessing)
        {
            return;
        }

        if ((MembershipContext.AuthenticatedUser == null) || (MembershipContext.AuthenticatedUser.IsPublic()))
        {
            StopProcessing = true;
            Visible = false;
            return;
        }

        if (NotificationGateways.Count == 0)
        {
            StopProcessing = true;
            pnlSubscribe.Visible = false;
            lblError.Text = GetString("notifications.nogateway");
            lblError.Visible = true;
            return;
        }

        // Register show/hide JS
        string script = "function showHide(panelId, checkboxId) { " +
                        "    var panel = document.getElementById(panelId);" +
                        "    var chkBox = document.getElementById(checkboxId);" +
                        "    if ((panel != null) && (chkBox != null)) {" +
                        "        if (chkBox.checked) {" +
                        "            panel.style.display = 'block'" +
                        "        } else {" +
                        "            panel.style.display = 'none'" +
                        "        }" +
                        "    }" +
                        "}";
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "NotificationSubscriptionShowHide", ScriptHelper.GetScript(script));

        btnSubscribe.Text = GetString("notifications.subscribe");
        lblDescription.Text = HTMLHelper.HTMLEncode(EventDescription);

        // Load dynamically notification gateways forms
        controls = new object[NotificationGateways.Count, 3];
        for (int i = 0; i < NotificationGateways.Count; i++)
        {
            CMSNotificationGateway g = NotificationGateways[i];
            if ((g.NotificationGatewayObj != null) && (g.NotificationGatewayForm != null))
            {
                // Checkbox
                Panel pnlCheckbox = new Panel();
                pnlCheckbox.ID = g.NotificationGatewayObj.GatewayName + "_chkboxpanel";
                pnlCheckbox.CssClass = "NotificationSubscriptionCheckbox";
                CMSCheckBox chkSubscribe = new CMSCheckBox();
                if (NotificationGateways.Count == 1)
                {
                    chkSubscribe.Checked = true;
                }
                chkSubscribe.ID = g.NotificationGatewayObj.GatewayName;
                chkSubscribe.Text = HTMLHelper.HTMLEncode(ResHelper.LocalizeString(g.NotificationGatewayObj.GatewayDisplayName));
                pnlCheckbox.Controls.Add(chkSubscribe);
                pnlGateways.Controls.Add(pnlCheckbox);

                // Notification form
                Panel pnlForm = new Panel();
                pnlForm.ID = g.NotificationGatewayObj.GatewayName + "_formpanel";
                pnlForm.Controls.Add(g.NotificationGatewayForm);
                pnlGateways.Controls.Add(pnlForm);

                // Add JS for show/hide functionality
                chkSubscribe.Attributes.Add("onclick", "showHide('" + pnlForm.ClientID + "','" + chkSubscribe.ClientID + "');");

                // Store references in array (we need to set display attribute after the ViewState is loaded into checkboxes)
                controls[i, 0] = chkSubscribe;
                controls[i, 1] = pnlForm;
                controls[i, 2] = g;
            }
        }
    }
コード例 #43
0
    /// <summary>
    /// Gets user effective UI permission HTML content.
    /// </summary>
    private void GenerateBeforeRowsContent()
    {
        // Check if every necessary property is set
        if ((SelectedUser != null) && (Element != null) && (ElementResource != null))
        {
            // Initialize variables used during rendering
            string userName = HTMLHelper.HTMLEncode(TextHelper.LimitLength(Functions.GetFormattedUserName(SelectedUser.UserName, SelectedUser.FullName), 50));
            bool authorizedToUIElement = UserInfoProvider.IsAuthorizedPerUIElement(ElementResource.ResourceName,
                                                      new[] { Element.ElementName },
                                                      siteSelector.SiteName,
                                                      SelectedUser,
                                                      true,
                                                      siteSelector.SiteID <= 0);
            // Create header table cell
            var tcHeader = new TableCell
            {
                CssClass = "matrix-header",
                ToolTip = userName,
                Text = userName
            };

            var tr = gridMatrix.ContentBeforeRow;
            tr.Cells.Add(tcHeader);

            // Create UI permission cell
            var tc = new TableCell();
            var chk = new CMSCheckBox
            {
                Checked = SelectedUser.IsGlobalAdministrator || authorizedToUIElement,
                Enabled = false,
                ToolTip = GetString("Administration-Permissions_Matrix.NotAdjustable")
            };

            tc.Controls.Add(chk);
            tr.Cells.Add(tc);

            UniMatrix.AddFillingCell<TableCell>(tr);
        }
    }
コード例 #44
0
    /// <summary>
    /// Gets user effective permissions HTML content.
    /// </summary>
    /// <param name="siteId">Site ID</param>
    /// <param name="resourceId">ID of particular resource</param>
    /// <param name="selectedType">Permission type</param>
    private void GenerateBeforeRowsContent(int siteId, int resourceId, string selectedType)
    {
        // Check if selected users exists
        UserInfo user = SelectedUser;
        if (user == null)
        {
            gridMatrix.ShowContentBeforeRow = false;
            return;
        }

        string columns = "PermissionID";

        // Ensure tooltip column
        if (!String.IsNullOrEmpty(gridMatrix.ItemTooltipColumn))
        {
            columns += ",Matrix." + gridMatrix.ItemTooltipColumn;
        }

        // Get permission data
        DataSet dsPermissions;
        switch (selectedType)
        {
            case "r":
                dsPermissions = UserInfoProvider.GetUserResourcePermissions(user, siteId, resourceId, true, columns);
                break;

            default:
                dsPermissions = UserInfoProvider.GetUserDataClassPermissions(user, siteId, resourceId, true, columns);
                break;
        }

        if (!DataHelper.DataSourceIsEmpty(dsPermissions))
        {
            // Initialize variables used during rendering
            DataRowCollection rows = dsPermissions.Tables[0].Rows;
            string userName = Functions.GetFormattedUserName(user.UserName, user.FullName);
            var title = GetString("Administration-Permissions_Matrix.NotAdjustable");

            // Table header cell with user name
            var tcHeader = new TableCell
            {
                CssClass = "matrix-header",
                Text = HTMLHelper.HTMLEncode(TextHelper.LimitLength(userName, 50)),
                ToolTip = HTMLHelper.HTMLEncode(userName)
            };

            var tr = gridMatrix.ContentBeforeRow;

            tr.Cells.Add(tcHeader);

            // Process permissions according to matrix order
            foreach (int index in gridMatrix.ColumnOrderIndex)
            {
                DataRow dr = rows[index];

                // Table cell for each permission
                TableCell tc = new TableCell();
                var chk = new CMSCheckBox
                {
                    ID="chk_perm_" + index,
                    ClientIDMode = ClientIDMode.Static,
                    Enabled = false,
                    Checked = (SelectedUser.IsGlobalAdministrator || Convert.ToInt32(dr["Allowed"]) == 1),
                    ToolTip = title,
                };

                tc.Controls.Add(chk);
                tr.Cells.Add(tc);
            }

            UniMatrix.AddFillingCell<TableCell>(tr);
        }
    }
コード例 #45
0
 /// <summary>
 /// Returns integer value representing permission value of the given checkbox and permission name.
 /// </summary>
 protected int GetCheckBoxValue(CMSCheckBox chkBox, NodePermissionsEnum permission)
 {
     return (chkBox.Enabled && chkBox.Checked) ? Convert.ToInt32(Math.Pow(2, Convert.ToInt32(permission))) : 0;
 }
    protected override void OnPreRender(EventArgs e)
    {
        if (StopProcessing)
        {
            return;
        }

        ScriptHelper.RegisterBootstrapScripts(Page);

        if (!String.IsNullOrEmpty(AdditionalDropDownCSSClass))
        {
            txtAutocomplete.AddCssClass(AdditionalDropDownCSSClass);
            drpSingleSelect.AddCssClass(AdditionalDropDownCSSClass);
        }

        // If control is enabled, then display content
        SelectionModeEnum mode = SelectionMode;
        if ((mode != SelectionModeEnum.Multiple) || !mLoaded || UniGridStatusChanged)
        {
            Reload(mode == SelectionModeEnum.Multiple && UniGridStatusChanged);
        }

        if (mEnsureSelectedField)
        {
            EnsureSelectedField(ValidationHelper.GetString(Value, String.Empty));
        }

        if (mRegisterScripts)
        {
            RegisterScripts();
        }

        // Display two columns when in multiple selection
        var gridView = uniGrid.GridView;

        if ((mode == SelectionModeEnum.Multiple) && (gridView.HeaderRow != null))
        {
            CMSCheckBox chkAll = new CMSCheckBox();
            chkAll.ID = "chkAll";
            chkAll.ToolTip = GetString("General.CheckAll");
            chkAll.InputAttributes.Add("onclick", string.Format("US_SelectAllItems('{0}', {1}, this, 'chk{2}')", UniSelectorClientID, ScriptSafeValueSeparator, mCheckBoxClass));
            chkAll.Enabled = Enabled;

            var headerCell = gridView.HeaderRow.Cells[0];

            headerCell.Controls.Clear();
            headerCell.Controls.Add(chkAll);

            gridView.Columns[0].ItemStyle.CssClass = "unigrid-selection";

            if (DynamicColumnName)
            {
                gridView.HeaderRow.Cells[1].Text = GetString(ResourcePrefix + ".itemname|general.itemname");
            }
        }

        lblStatus.Visible = !String.IsNullOrEmpty(lblStatus.Text);

        // If the page was not changed, deselect all
        if (!mPageChanged)
        {
            hiddenSelected.Value = String.Empty;
        }

        // Always reset the new value from dialog
        hdnDialogSelect.Value = String.Empty;

        InitializeControlEnvelope();

        // Enable/disable buttons when manually set
        SetButtonsEnabled();

        if (mode == SelectionModeEnum.Multiple)
        {
            // Display explanation text for disabled Add button in multiple mode
            if (!String.IsNullOrEmpty(DisabledAddButtonExplanationText) && !btnAddItems.Enabled)
            {
                lblDisabledAddButtonExplanationText.Text = DisabledAddButtonExplanationText;
                lblDisabledAddButtonExplanationText.Visible = true;
            }
            else
            {
                lblDisabledAddButtonExplanationText.Visible = false;
            }
        }

        if (mode == SelectionModeEnum.SingleDropDownList && UseUniSelectorAutocomplete)
        {
            RegisterAutocompleteScripts();
        }

        base.OnPreRender(e);
    }
コード例 #47
0
    /// <summary>
    /// Gets inherit <c>CheckBox</c> instance for the input <c>SettingsKeyInfo</c> object.
    /// </summary>
    /// <param name="groupNo">Number representing index of the processing settings group</param>
    /// <param name="keyNo">Number representing index of the processing SettingsKeyInfo</param>
    private CMSCheckBox GetInheritCheckBox(int groupNo, int keyNo)
    {
        var chkInherit = new CMSCheckBox
        {
            ID = string.Format(@"chkInherit{0}{1}", groupNo, keyNo),
            Text = GetString("settings.keys.checkboxinheritglobal"),
            EnableViewState = true,
            AutoPostBack = true,
            CssClass = "field-value-override-checkbox"
        };

        return chkInherit;
    }
    /// <summary>
    /// Unigrid external data bound handler.
    /// </summary>
    private object uniGrid_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        object val = String.Empty;

        switch (sourceName.ToLowerCSafe())
        {
            case "yesno":
                val = UniGridFunctions.ColoredSpanYesNo(parameter);
                break;

            case "select":
                {
                    // Get item ID
                    DataRowView drv = (DataRowView)parameter;

                    string itemID = drv[ReturnColumnName].ToString();

                    CMSCheckBox chkCheckbox = new CMSCheckBox();
                    chkCheckbox.ClientIDMode = ClientIDMode.Static;
                    chkCheckbox.ID = string.Format("chk{0}_{1}", mCheckBoxClass, itemID);
                    chkCheckbox.InputAttributes.Add("onclick", String.Format("US_ProcessItem('{0}', {1}, this);", UniSelectorClientID, ScriptSafeValueSeparator));
                    chkCheckbox.InputAttributes.Add("class", "chk" + mCheckBoxClass);

                    // Keep the check status if checked
                    chkCheckbox.Checked = mPageChanged && (hiddenSelected.Value.IndexOfCSafe(ValuesSeparator + itemID + ValuesSeparator, true) >= 0);

                    val = chkCheckbox;
                    break;
                }

            case "itemname":
                {
                    DataRowView drv = (parameter as DataRowView);

                    // Get item ID
                    string itemID = drv[ReturnColumnName].ToString();

                    // Get item name
                    string itemName = GetItemName(drv.Row);

                    LinkButton lnkButton = new LinkButton();
                    lnkButton.Text = HTMLHelper.HTMLEncode(TextHelper.LimitLength(itemName, 100));
                    lnkButton.OnClientClick = String.Format(
        @"if(this.href){{
        US_ProcessItem('{0}', {1}, document.getElementById('chk{2}_{3}'), true);
        }}
        return false;", UniSelectorClientID, ScriptSafeValueSeparator, mCheckBoxClass, ScriptHelper.GetString(itemID).Trim('\''));

                    val = lnkButton;
                    break;
                }
        }

        var additionalDataBound = AdditionalDataBound(this, sourceName, parameter, val);

        if (additionalDataBound != null)
        {
            val = additionalDataBound;
            if (!(val is Control))
            {
                val = ValidationHelper.GetString(val, String.Empty);
            }
        }

        return val;
    }
    /// <summary>
    /// Generate control output.
    /// </summary>
    public void GenerateContent()
    {
        string templatePath = DepartmentTemplatePath;

        if (String.IsNullOrEmpty(templatePath))
        {
            ltlContent.Text    = ResHelper.GetString("departmentsectionsmanager.notemplate");
            ltlContent.Visible = true;
        }
        else
        {
            if (!DataHelper.DataSourceIsEmpty(TemplateDocuments))
            {
                int   counter = 0;
                Table tb      = new Table();

                string value      = ValidationHelper.GetString(mSelectedValue, "");
                string docAliases = ";" + value.ToLowerCSafe() + ";";

                TreeNode editedNode = (TreeNode)Form.EditedObject;

                if (Form.IsInsertMode)
                {
                    // Alias path for new department has to have special 'child node path' because of correct check for document type scopes
                    editedNode.SetValue("NodeAliasPath", ((TreeNode)Form.ParentObject).NodeAliasPath + "/department");
                }

                TableRow tr = new TableRow();
                foreach (DataRow drDoc in TemplateDocuments.Tables[0].Rows)
                {
                    // For each section td element is generated
                    string docAlias = ValidationHelper.GetString(drDoc["NodeAlias"], "");

                    TableCell   td     = new TableCell();
                    CMSCheckBox cbCell = new CMSCheckBox();
                    cbCell.ID   = "chckSection" + counter;
                    cbCell.Text = docAlias;
                    cbCell.Attributes.Add("Value", docAlias);

                    // Check if child allowed
                    int sourceClassId = ValidationHelper.GetInteger(drDoc["NodeClassID"], 0);
                    if (!DocumentHelper.IsDocumentTypeAllowed(editedNode, sourceClassId))
                    {
                        cbCell.Enabled = false;
                        cbCell.ToolTip = ResHelper.GetString("departmentsectionsmanager.notallowedchild");
                    }

                    // Disable default hidden documents
                    if (HIDDEN_DOCUMENT_ALIAS.Contains(";" + docAlias.ToLowerCSafe() + ";"))
                    {
                        cbCell.Checked = cbCell.Enabled;
                        cbCell.Enabled = false;
                    }


                    // Check for selected value
                    if (docAliases.Contains(";" + docAlias.ToLowerCSafe() + ";") || ((mSelectedValue == null) && (Form.Mode == FormModeEnum.Insert)))
                    {
                        if (cbCell.Enabled)
                        {
                            cbCell.Checked = true;
                        }
                    }

                    // If editing existing document register alert script
                    if ((Form.Mode != FormModeEnum.Insert) && cbCell.Checked)
                    {
                        cbCell.Attributes.Add("OnClick", "if(!this.checked){alert(" + ScriptHelper.GetString(ResHelper.GetString("departmentsectionsmanagerformcontrol.removesectionwarning")) + ");}");
                    }

                    // Add reference to checkbox arraylist
                    CheckboxReferences.Add(cbCell);
                    counter++;

                    td.Controls.Add(cbCell);
                    tr.Cells.Add(td);

                    // If necessary create new row
                    if ((counter % ITEMS_PER_ROW) == 0)
                    {
                        tr.CssClass = "Row";
                        tb.Rows.Add(tr);
                        tr = new TableRow();
                    }
                }
                // If last row contains data add it
                if (counter > 0)
                {
                    tb.Rows.Add(tr);
                }
                pnlContent.Controls.Add(tb);
            }
            else
            {
                ltlContent.Text    = ResHelper.GetString("departmentsectionsmanager.notemplate");
                ltlContent.Visible = true;
            }
        }
    }
コード例 #50
0
 /// <summary>
 /// Returns integer value representing permission value of the given checkbox and permission name.
 /// </summary>
 protected int GetCheckBoxValue(CMSCheckBox chkBox, NodePermissionsEnum permission)
 {
     return (chkBox.Enabled && chkBox.Checked) ? DocumentSecurityHelper.GetFlagFromPermission(permission) : 0;
 }