コード例 #1
0
    /// <summary>
    /// Page load
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        FormEngineUserControl label = LoadUserControl("~/CMSFormControls/Basic/LabelControl.ascx") as FormEngineUserControl;

        if (label != null)
        {
            label.Value = GetString("validation.accessibility.standard");
        }

        // Add validation standard
        FormEngineUserControl standard = LoadUserControl("~/CMSFormControls/Basic/DropDownListControl.ascx") as FormEngineUserControl;

        if (standard != null)
        {
            mStandardList = standard.FindControl(standard.InputControlID) as CMSDropDownList;
            mStandardList.Attributes.Add("class", "form-control input-width-60");
        }
        ControlsHelper.FillListControlWithEnum <AccessibilityStandardEnum>(mStandardList, "validation.accessibility.standard");

        // Set default standard value
        if (!RequestHelper.IsPostBack() && (standard != null))
        {
            standard.Value = AccessibilityStandardCode.FromEnum(AccessibilityStandardEnum.WCAG2_0A);
        }

        HeaderActions.AdditionalControls.Add(label);
        HeaderActions.AdditionalControls.Add(standard);
        HeaderActions.AdditionalControlsCssClass = "HeaderActionsLabel control-group-inline";
        HeaderActions.ReloadAdditionalControls();
    }
コード例 #2
0
    /// <summary>
    /// Page load.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="e">Arguments</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StopProcessing)
        {
            return;
        }
        else
        {
            // Set up drop down list
            if (ShowSearchMode)
            {
                if (!RequestHelper.IsPostBack())
                {
                    // Fill dropdownlist option with values
                    ControlsHelper.FillListControlWithEnum <SearchModeEnum>(drpSearchMode, "srch.dialog", useStringRepresentation: true);
                    drpSearchMode.SelectedValue = QueryHelper.GetString("searchmode", SearchMode.ToStringRepresentation());
                }
            }

            // Set up search text
            if (!RequestHelper.IsPostBack() && (!ShowOnlySearchButton))
            {
                txtSearchFor.Text = QueryHelper.GetString("searchtext", "");
            }
        }
    }
コード例 #3
0
    /// <summary>
    /// Initializes control due to settings
    /// </summary>
    private void SetupControl(Type enumType)
    {
        chkEnum.Visible = false;
        drpEnum.Visible = false;
        radEnum.Visible = false;

        var ctrl = CurrentSelector;

        ctrl.Visible = true;
        ctrl.Items.Clear();

        // Fill special items
        SpecialItems.FillItems(ctrl.Items);

        // Fill the control with enumeration values
        var excludedValues     = !string.IsNullOrEmpty(ExcludedValues) ? ExcludedValues.Split(';').ToList() : null;
        var selectedCategories = !string.IsNullOrEmpty(SelectedCategories) ? SelectedCategories.Split(';').ToList() : null;

        ControlsHelper.FillListControlWithEnum(ctrl, enumType, null, Sort, UseStringRepresentation, excludedValues, selectedCategories);

        if (!String.IsNullOrEmpty(CssClass))
        {
            ctrl.AddCssClass(CssClass);
        }
    }
コード例 #4
0
 /// <summary>
 /// Initializes operator filter dropdown list.
 /// </summary>
 private void InitFilterDropDown()
 {
     if (drpOperator.Items.Count == 0)
     {
         ControlsHelper.FillListControlWithEnum <TextCompareOperatorEnum>(drpOperator, "filter");
     }
 }
コード例 #5
0
    /// <summary>
    /// Loads drop-down lists.
    /// </summary>
    private void LoadDropDowns()
    {
        // Init operands
        if (drpLanguage.Items.Count == 0)
        {
            drpLanguage.Items.Add(new ListItem(GetString("transman.translatedto"), "="));
            drpLanguage.Items.Add(new ListItem(GetString("transman.nottranslatedto"), "<>"));
        }

        // Get site indexes
        var indexes = SearchIndexSiteInfoProvider.GetSiteIndexes(SiteContext.CurrentSiteID)
                      .Where("IndexType", QueryOperator.Equals, TreeNode.OBJECT_TYPE)
                      .Where("IndexProvider", QueryOperator.Equals, SearchIndexInfo.LUCENE_SEARCH_PROVIDER);

        foreach (SearchIndexInfo index in indexes)
        {
            drpIndexes.Items.Add(new ListItem(index.IndexDisplayName, index.IndexName));
        }

        drpIndexes.Items.Insert(0, new ListItem(GetString("search.sqlsearch"), SQL));

        // Init Search for drop down list
        ControlsHelper.FillListControlWithEnum <SearchModeEnum>(drpSearchMode, "srch.dialog", useStringRepresentation: true);
        drpSearchMode.SelectedValue = QueryHelper.GetString("searchmode", EnumHelper.GetDefaultValue <SearchModeEnum>().ToStringRepresentation());
    }
コード例 #6
0
 /// <summary>
 /// Reloads the data in the selector.
 /// </summary>
 public void ReloadData()
 {
     if (drpEmailType.Items.Count == 0)
     {
         drpEmailType.Items.Add(new ListItem(ResHelper.GetString("general.selectall"), string.Empty));
         ControlsHelper.FillListControlWithEnum <EmailTemplateTypeEnum>(drpEmailType, "emailtemplate.type", true, true);
     }
 }
    private void InitializeForm()
    {
        // Initialize first dropdown lists
        ControlsHelper.FillListWithNumberedSqlOperators(drpAvatarName);

        ControlsHelper.FillListControlWithEnum <AvatarTypeEnum>(drpAvatarType, "avat.type", useStringRepresentation: true);
        drpAvatarType.Items.Insert(0, new ListItem(GetString("general.selectall"), ""));

        drpAvatarKind.Items.Add(new ListItem(GetString("general.selectall"), "0"));
        drpAvatarKind.Items.Add(new ListItem(GetString("avat.filter.shared"), "1"));
        drpAvatarKind.Items.Add(new ListItem(GetString("avat.filter.custom"), "2"));
        // Preselect shared
        drpAvatarKind.SelectedIndex = 1;
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (WorkflowStepID <= 0)
        {
            StopProcessing = true;
            return;
        }

        EditedObject = WorkflowStep;

        if (SourcePointGuid != null)
        {
            ShowInformation(GetString("workflowsteppoint.securityInfo"));
        }
        else if (WorkflowStep.StepAllowBranch)
        {
            ShowInformation(GetString("workflowstep.securityInfo"));
        }

        if (Workflow.IsAutomation)
        {
            headRoles.ResourceString = "processstep.rolessecurity";
            headUsers.ResourceString = "processstep.userssecurity";
        }
        else
        {
            headRoles.ResourceString = (SourcePointGuid == null) ? "workflowstep.rolessecurity" : "workflowsteppoint.rolessecurity";
            headUsers.ResourceString = (SourcePointGuid == null) ? "workflowstep.userssecurity" : "workflowsteppoint.userssecurity";
        }

        SetupRolesSelector();
        SetupUsersSelector();

        rbRoleType.SelectedIndexChanged += rbRoleType_SelectedIndexChanged;
        rbUserType.SelectedIndexChanged += rbUserType_SelectedIndexChanged;

        if (!RequestHelper.IsPostBack())
        {
            string resPrefix = (SourcePointGuid == null) ? "workflowstep" : "workflowsteppoint";
            ControlsHelper.FillListControlWithEnum <WorkflowStepSecurityEnum>(rbRoleType, resPrefix + ".security");
            ControlsHelper.FillListControlWithEnum <WorkflowStepSecurityEnum>(rbUserType, resPrefix + ".usersecurity");
            rbRoleType.SelectedValue = ((int)RolesSecurity).ToString();
            rbUserType.SelectedValue = ((int)UsersSecurity).ToString();
        }

        // Get the active roles for this site
        string where = $"[StepID] = {WorkflowStepID} AND [StepSourcePointGuid] {(SourcePointGuid == null ? "IS NULL" : $"= '{SourcePointGuid}'")}";
コード例 #9
0
 /// <summary>
 /// Initializes advanced export dialog.
 /// </summary>
 private void InitializeAdvancedExport()
 {
     // Initialize dropdown lists
     drpExportTo.Items.Clear();
     ControlsHelper.FillListControlWithEnum <DataExportFormatEnum>(drpExportTo, "export");
     drpDelimiter.Items.Clear();
     ControlsHelper.FillListControlWithEnum <Delimiter>(drpDelimiter, "export");
     // Initialize rest of dialog
     InitializeDelimiter();
     InitializeExportHeader();
     InitializeColumns(false);
     plcWhere.Visible            = MembershipContext.AuthenticatedUser.IsGlobalAdministrator;
     plcExportRawData.Visible    = MembershipContext.AuthenticatedUser.IsGlobalAdministrator;
     orderByElem.Visible         = !MembershipContext.AuthenticatedUser.IsGlobalAdministrator;
     txtOrderBy.Visible          = MembershipContext.AuthenticatedUser.IsGlobalAdministrator;
     btnDefaultSelection.Visible = MembershipContext.AuthenticatedUser.IsGlobalAdministrator;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        bool reloadTree = QueryHelper.GetBoolean("reloadtree", true);

        ScriptHelper.RegisterClientScriptBlock(Page, typeof(string), "PostListingScripts",
                                               ScriptHelper.GetScript(
                                                   "function ViewPost(postId) { \n" +
                                                   "   location.href = 'ForumPost_View.aspx?postid=' + postId+'&listingpost=" + PostId + ";" + ForumId + "'; \n" +
                                                   "} \n" +
                                                   "function SelectPost(postId, forumId) { \n" +
                                                   "   location.href = 'ForumPost_Listing.aspx?postid=' + postId + ';' + forumId; \n" +
                                                   "} \n" +
                                                   "function SelectInTree(postId, force) { \n" +
                                                   "   var treeFrame = parent.frames['posts_tree']; \n" +
                                                   "   if (treeFrame != null) { \n" +
                                                   "      // Refresh tree if necessary \n" +
                                                   "      if ((treeFrame.selectedPostId != postId) || force) { \n" +
                                                   "          treeFrame.RefreshTree(postId); \n" +
                                                   "      } \n" +
                                                   "   } \n" +
                                                   "} \n" +
                                                   "SelectInTree(" + PostId + ", false); \n"
                                                   ));


        if (!RequestHelper.IsPostBack())
        {
            ControlsHelper.FillListControlWithEnum <Action>(drpAction, "Forums.ListingActions");
            drpAction.Items.Insert(0, new ListItem(GetString("general.SelectAction"), "-1"));
            //DataHelper.FillListControlWithEnum(typeof(What), drpWhat, "Forums.ListingWhat.", null);
        }

        string where             = (PostId > 0) ? "PostParentID = " + PostId : "PostParentID IS NULL AND PostForumID=" + ForumId;
        gridPosts.WhereCondition = where;

        gridPosts.ZeroRowsText         = GetString("forums.listing.nochildposts");
        gridPosts.FilteredZeroRowsText = GetString("forums.listing.nochildpostssearch");

        //gridPosts.OnDataReload += gridPosts_OnDataReload;
        gridPosts.OnExternalDataBound += gridPosts_OnExternalDataBound;
        gridPosts.OnAction            += gridPosts_OnAction;
        btnOk.Click += btnOk_Click;

        currentUserInfo = MembershipContext.AuthenticatedUser;
        currentSiteInfo = SiteContext.CurrentSite;
    }
コード例 #11
0
    /// <summary>
    /// Initializes advanced export dialog.
    /// </summary>
    private void InitializeAdvancedExport()
    {
        // Initialize dropdown lists
        drpExportTo.Items.Clear();
        ControlsHelper.FillListControlWithEnum <DataExportFormatEnum>(drpExportTo, "export");
        drpDelimiter.Items.Clear();
        ControlsHelper.FillListControlWithEnum <Delimiter>(drpDelimiter, "export");
        // Initialize rest of dialog
        InitializeDelimiter();
        InitializeExportHeader();
        InitializeColumns(false);

        plcWhere.Visible            = UserCanEditSql;
        plcExportRawData.Visible    = UserCanEditSql;
        orderByElem.Visible         = !UserCanEditSql;
        txtOrderBy.Visible          = UserCanEditSql;
        btnDefaultSelection.Visible = UserCanEditSql;
    }
コード例 #12
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Content", "Properties.URLs"))
        {
            RedirectToUIElementAccessDenied("CMS.Content", "Properties.URLs");
        }

        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.Content", "URLs.Aliases"))
        {
            RedirectToUIElementAccessDenied("CMS.Content", "URLs.Aliases");
        }

        ControlsHelper.FillListControlWithEnum <AliasActionModeEnum>(drpAction, "aliasaction", useStringRepresentation: true);


        // Disable document manager events
        DocumentManager.RegisterEvents = false;
    }
    /// <summary>
    /// Loads control with items.
    /// </summary>
    public void ReLoadUserControl()
    {
        drpType.Items.Clear();
        drpType.SelectedValue = null;
        drpType.ClearSelection();

        // Load control dynamically with limited set of available types
        if (!String.IsNullOrEmpty(DataType))
        {
            drpType.DataTextField  = "text";
            drpType.DataValueField = "value";

            DataSet ds = FormHelper.GetAvailableControlTypes(DataType, FieldEditorControls, (IsPrimary && !External));
            if (!DataHelper.DataSourceIsEmpty(ds))
            {
                // Sort result by 'text' column
                ds.Tables[0].DefaultView.Sort = "text";
                drpType.DataSource            = ds.Tables[0].DefaultView;
                drpType.DataBind();
            }
        }
        // Load control with all types
        else
        {
            ControlsHelper.FillListControlWithEnum <FormUserControlTypeEnum>(drpType, null, true);
        }

        // Remove all item (unspecified) if not allowed
        if (!IncludeAllItem)
        {
            var allItem = drpType.Items.FindByValue("-1");
            if (allItem != null)
            {
                drpType.Items.Remove(allItem);
            }
        }
    }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (WorkflowStepID <= 0)
        {
            StopProcessing = true;
            return;
        }

        EditedObject = WorkflowStep;

        if (SourcePointGuid != null)
        {
            ShowInformation(GetString("workflowsteppoint.securityInfo"));
        }
        else if (WorkflowStep.StepAllowBranch)
        {
            ShowInformation(GetString("workflowstep.securityInfo"));
        }

        if (Workflow.IsAutomation)
        {
            headRoles.ResourceString = "processstep.rolessecurity";
            headUsers.ResourceString = "processstep.userssecurity";
        }
        else
        {
            headRoles.ResourceString = (SourcePointGuid == null) ? "workflowstep.rolessecurity" : "workflowsteppoint.rolessecurity";
            headUsers.ResourceString = (SourcePointGuid == null) ? "workflowstep.userssecurity" : "workflowsteppoint.userssecurity";
        }

        // Set site selector
        siteSelector.AllowGlobal = true;
        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.AllowAll         = false;
        siteSelector.OnlyRunningSites = false;
        siteSelector.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;
        usRoles.OnSelectionChanged      += usRoles_OnSelectionChanged;
        usUsers.OnSelectionChanged      += usUsers_OnSelectionChanged;
        usRoles.ObjectType               = RoleInfo.OBJECT_TYPE;
        usUsers.ObjectType               = UserInfo.OBJECT_TYPE;
        rbRoleType.SelectedIndexChanged += rbRoleType_SelectedIndexChanged;
        rbUserType.SelectedIndexChanged += rbUserType_SelectedIndexChanged;

        if (!RequestHelper.IsPostBack())
        {
            siteId             = SiteID;
            siteSelector.Value = siteId;
            string resPrefix = (SourcePointGuid == null) ? "workflowstep" : "workflowsteppoint";
            ControlsHelper.FillListControlWithEnum <WorkflowStepSecurityEnum>(rbRoleType, resPrefix + ".security");
            ControlsHelper.FillListControlWithEnum <WorkflowStepSecurityEnum>(rbUserType, resPrefix + ".usersecurity");
            rbRoleType.SelectedValue = ((int)RolesSecurity).ToString();
            rbUserType.SelectedValue = ((int)UsersSecurity).ToString();
        }
        else
        {
            // Make sure the current site is always selected
            int selectedId = ValidationHelper.GetInteger(siteSelector.Value, 0);
            if (selectedId == 0)
            {
                selectedId         = SiteID;
                siteSelector.Value = SiteID;
            }
            siteId = selectedId;
        }

        // If global role selected - set siteID to 0
        if (siteSelector.GlobalRecordValue == siteId.ToString())
        {
            siteId = 0;
        }

        string siteIDWhere = (siteId == 0) ? "SiteID IS NULL" : "SiteID = " + siteId;

        usRoles.WhereCondition = siteIDWhere + " AND RoleGroupID IS NULL";
        usUsers.WhereCondition = "(UserIsHidden = 0 OR UserIsHidden IS NULL)";

        // Get the active roles for this site
        string where = $"[StepID] = {WorkflowStepID} AND [StepSourcePointGuid] {(SourcePointGuid == null ? "IS NULL" : $"= '{SourcePointGuid}'")}";
    protected void Page_Load(object sender, EventArgs e)
    {
        // Controls initialization
        radBanIP.Text   = GetString("banip.radBanIP");
        radAllowIP.Text = GetString("banip.radAllowIP");

        lblIPAddressBanType.Text    = GetString("banip.IPAddressBanType") + ResHelper.Colon;
        lblIPAddressBanEnabled.Text = GetString("general.enabled") + ResHelper.Colon;
        lblIPAddress.Text           = GetString("banip.IPAddress") + ResHelper.Colon;
        lblIPAddressBanReason.Text  = GetString("banip.IPAddressBanReason") + ResHelper.Colon;

        rfvIPAddress.ErrorMessage      = GetString("banip.IPAddressEmpty");
        lblIPAddressAllowOverride.Text = GetString("banip.IPAddressAllowOverride") + ResHelper.Colon;

        if (!RequestHelper.IsPostBack())
        {
            // Add list items to ban type drop down list
            ControlsHelper.FillListControlWithEnum <BanControlEnum>(drpIPAddressBanType, "banip.bantype", useStringRepresentation: true);
            drpIPAddressBanType.SelectedValue = BanControlEnum.AllNonComplete.ToStringRepresentation();
        }

        string currentBannedIP = GetString("banip.NewItemCaption");

        // Get bannedIP id from querystring
        itemid = QueryHelper.GetInteger("itemid", 0);
        if (itemid > 0)
        {
            BannedIPInfo bannedIPObj = BannedIPInfoProvider.GetBannedIPInfo(itemid);
            EditedObject = bannedIPObj;

            if (bannedIPObj != null)
            {
                //Check whether the item truly belogs to specified site
                if (((SiteID > 0) && (bannedIPObj.IPAddressSiteID != SiteID)) ||
                    ((SelectedSiteID > 0) && (bannedIPObj.IPAddressSiteID != SelectedSiteID)))
                {
                    RedirectToAccessDenied(GetString("banip.invaliditem"));
                }

                currentBannedIP = bannedIPObj.IPAddress;

                // Add site info to breadcrumbs
                if (SiteID == 0)
                {
                    if (bannedIPObj.IPAddressSiteID == 0)
                    {
                        currentBannedIP += " (global)";
                        radAllowIP.Text  = GetString("banip.radAllowIPglobal");

                        plcIPOveride.Visible = true;
                    }
                    else
                    {
                        SiteInfo si = SiteInfoProvider.GetSiteInfo(bannedIPObj.IPAddressSiteID);
                        if (si != null)
                        {
                            currentBannedIP += " (" + si.DisplayName + ")";
                        }
                    }
                }

                // Fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(bannedIPObj);

                    // Show that the bannedIP was created or updated successfully
                    if ((QueryHelper.GetInteger("saved", 0) == 1) && !RequestHelper.IsPostBack())
                    {
                        ShowChangesSaved();
                    }
                }
            }
        }

        // Initializes page title control
        SetBreadcrumb(0, GetString("banip.listHeaderCaption"), ResolveUrl("BannedIP_List.aspx?siteId=" + SiteID + "&selectedsiteid=" + SelectedSiteID), null, null);
        SetBreadcrumb(1, currentBannedIP, null, null, null);

        // Add info about selected site in Site manager for new item
        if ((SiteID == 0) && (itemid == 0))
        {
            if (SelectedSiteID > 0)
            {
                // Site banned IP
                SiteInfo si = SiteInfoProvider.GetSiteInfo(SelectedSiteID);
                if (si != null)
                {
                    SetBreadcrumb(1, currentBannedIP + " (" + si.DisplayName + ")", null, null, null);
                }
            }
            else
            {
                // Global banned IP
                SetBreadcrumb(1, currentBannedIP + " (global)", null, null, null);

                radAllowIP.Text = GetString("banip.radAllowIPglobal");

                plcIPOveride.Visible = true;
            }
        }

        // Different header and icon if it is new item
        if (itemid <= 0)
        {
            SetTitle(GetString("banip.newHeaderCaption"));
        }
    }
コード例 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        imgAvatar.Visible = false;

        avatarId = QueryHelper.GetInteger("avatarid", 0);

        if ((QueryHelper.GetInteger("saved", 0) == 1) && !URLHelper.IsPostback())
        {
            ShowChangesSaved();
        }

        // new avatar
        if (avatarId == 0)
        {
            PageTitle.TitleText        = GetString("avat.newavatar");
            drpAvatarType.AutoPostBack = false;
        }
        // Edit avatar
        else
        {
            PageTitle.TitleText        = GetString("avat.properties");
            drpAvatarType.AutoPostBack = true;
        }

        // initializes breadcrumbs
        BreadcrumbItem breadCrumb = new BreadcrumbItem()
        {
            Text        = GetString("avat.newavatar"),
            RedirectUrl = "",
        };

        lblSharedInfo.Text = String.Format(GetString("avat.convertinfo") + "<br /><br />", "<a href=\"javascript:" + Page.ClientScript.GetPostBackEventReference(this, "shared") + "\">" + GetString("General.clickhere") + "</a>");

        valAvatarName.ErrorMessage = GetString("avat.requiresname");

        if (!RequestHelper.IsPostBack())
        {
            // Fill the drop down list
            ControlsHelper.FillListControlWithEnum <AvatarTypeEnum>(drpAvatarType, "avat.type", useStringRepresentation: true);
        }

        if (avatarId > 0)
        {
            plcImage.Visible = true;

            ai = AvatarInfoProvider.GetAvatarInfoWithoutBinary(avatarId);
            // Set edited object
            EditedObject = ai;

            if (ai != null)
            {
                if (ai.AvatarIsCustom)
                {
                    lblSharedInfo.Visible = true;
                }

                breadCrumb.Text = HTMLHelper.HTMLEncode(!string.IsNullOrEmpty(ai.AvatarName) ? ai.AvatarName : ai.AvatarFileName.Substring(0, ai.AvatarFileName.LastIndexOfCSafe(".")));

                // Load avatars data
                if (!RequestHelper.IsPostBack())
                {
                    txtAvatarName.Text                 = ai.AvatarName;
                    drpAvatarType.SelectedValue        = ai.AvatarType.ToLowerCSafe();
                    chkDefaultUserAvatar.Checked       = ai.DefaultUserAvatar;
                    chkDefaultMaleUserAvatar.Checked   = ai.DefaultMaleUserAvatar;
                    chkDefaultFemaleUserAvatar.Checked = ai.DefaultFemaleUserAvatar;
                    chkDefaultGroupAvatar.Checked      = ai.DefaultGroupAvatar;
                    imgAvatar.AlternateText            = HTMLHelper.HTMLEncode(ai.AvatarName);
                }

                imgAvatar.Visible  = true;
                imgAvatar.ImageUrl = ResolveUrl("~/CMSModules/Avatars/CMSPages/GetAvatar.aspx?maxsidesize=250&avatarguid=" + ai.AvatarGUID);

                // Display default avatar options, only for global avatars
                if (!ai.AvatarIsCustom)
                {
                    switch (AvatarInfoProvider.GetAvatarTypeEnum(drpAvatarType.SelectedValue))
                    {
                    case AvatarTypeEnum.User:
                        plcDefaultUserAvatar.Visible = true;
                        break;

                    case AvatarTypeEnum.Group:
                        plcDefaultGroupAvatar.Visible = true;
                        break;

                    case AvatarTypeEnum.All:
                        plcDefaultGroupAvatar.Visible = true;
                        plcDefaultUserAvatar.Visible  = true;
                        break;
                    }
                }
            }
        }

        PageBreadcrumbs.Items.Add(new BreadcrumbItem()
        {
            Text        = GetString("avat.title"),
            RedirectUrl = ResolveUrl("~/CMSModules/Avatars/Avatar_List.aspx"),
        });
        PageBreadcrumbs.Items.Add(breadCrumb);
    }
コード例 #17
0
    /// <summary>
    /// OnInit event.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        int querySiteID = QueryHelper.GetInteger("siteid", 0);

        // Do not allow other than current site ID out of global scope.
        SiteID = UIContextHelper.IsInGlobalApplicationScope(UIContext.UIElement) ? querySiteID : SiteContext.CurrentSiteID;

        if (File.Exists(HttpContext.Current.Request.MapPath(ResolveUrl(pathToGroupselector))))
        {
            Control ctrl = LoadUserControl(pathToGroupselector);
            if (ctrl != null)
            {
                selectInGroups    = ctrl as FormEngineUserControl;
                ctrl.ID           = "selGroups";
                ctrl              = LoadUserControl(pathToGroupselector);
                selectNotInGroups = ctrl as FormEngineUserControl;
                ctrl.ID           = "selNoGroups";

                plcGroups.Visible = true;
                plcSelectInGroups.Controls.Add(selectInGroups);
                plcSelectNotInGroups.Controls.Add(selectNotInGroups);

                selectNotInGroups.SetValue("UseFriendlyMode", true);
                selectInGroups.IsLiveSite = false;
                selectInGroups.SetValue("UseFriendlyMode", true);
                selectNotInGroups.IsLiveSite = false;
            }
        }

        if (DisplayScore && SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSEnableOnlineMarketing"))
        {
            Control ctrl = LoadUserControl(pathToScoreSelector);
            if (ctrl != null)
            {
                ctrl.ID       = "selectScore";
                scoreSelector = ctrl as FormEngineUserControl;
                if (scoreSelector != null)
                {
                    plcUpdateContent.Controls.Add(scoreSelector);
                    scoreSelector.SetValue("AllowAll", false);
                    scoreSelector.SetValue("AllowEmpty", true);
                }
            }
        }
        else
        {
            plcScore.Visible             = false;
            lblScore.AssociatedControlID = null;
        }

        // Initialize advanced filter dropdownlists
        if (!RequestHelper.IsPostBack())
        {
            InitAllAnyDropDown(drpTypeSelectInRoles);
            InitAllAnyDropDown(drpTypeSelectNotInRoles);
            InitAllAnyDropDown(drpTypeSelectInGroups);
            InitAllAnyDropDown(drpTypeSelectNotInGroups);

            // Init lock account reason DDL
            drpLockReason.Items.Add(new ListItem(GetString("General.selectall"), ""));
            ControlsHelper.FillListControlWithEnum <UserAccountLockEnum>(drpLockReason, "userlist.account");
        }


        base.OnInit(e);

        plcDisplayAnonymous.Visible = ContactManagementPermission && SessionManager.StoreOnlineUsersInDatabase && EnableDisplayingGuests;
        if (!RequestHelper.IsPostBack())
        {
            chkDisplayAnonymous.Checked = DisplayGuestsByDefault;
        }

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
    }
コード例 #18
0
ファイル: Security.ascx.cs プロジェクト: isatriya/kentico10
    protected void Page_Load(object sender, EventArgs e)
    {
        if (WorkflowStepID <= 0)
        {
            StopProcessing = true;
            return;
        }

        EditedObject = WorkflowStep;

        if (SourcePointGuid != null)
        {
            ShowInformation(GetString("workflowsteppoint.securityInfo"));
        }
        else if (WorkflowStep.StepAllowBranch)
        {
            ShowInformation(GetString("workflowstep.securityInfo"));
        }

        if (Workflow.IsAutomation)
        {
            headRoles.ResourceString = "processstep.rolessecurity";
            headUsers.ResourceString = "processstep.userssecurity";
        }
        else
        {
            headRoles.ResourceString = (SourcePointGuid == null) ? "workflowstep.rolessecurity" : "workflowsteppoint.rolessecurity";
            headUsers.ResourceString = (SourcePointGuid == null) ? "workflowstep.userssecurity" : "workflowsteppoint.userssecurity";
        }

        // Set site selector
        siteSelector.AllowGlobal = true;
        siteSelector.DropDownSingleSelect.AutoPostBack = true;
        siteSelector.AllowAll         = false;
        siteSelector.OnlyRunningSites = false;
        siteSelector.UniSelector.OnSelectionChanged += UniSelector_OnSelectionChanged;
        usRoles.OnSelectionChanged      += usRoles_OnSelectionChanged;
        usUsers.OnSelectionChanged      += usUsers_OnSelectionChanged;
        usRoles.ObjectType               = RoleInfo.OBJECT_TYPE;
        usUsers.ObjectType               = UserInfo.OBJECT_TYPE;
        rbRoleType.SelectedIndexChanged += rbRoleType_SelectedIndexChanged;
        rbUserType.SelectedIndexChanged += rbUserType_SelectedIndexChanged;

        if (!RequestHelper.IsPostBack())
        {
            siteId             = SiteID;
            siteSelector.Value = siteId;
            string resPrefix = (SourcePointGuid == null) ? "workflowstep" : "workflowsteppoint";
            ControlsHelper.FillListControlWithEnum <WorkflowStepSecurityEnum>(rbRoleType, resPrefix + ".security");
            ControlsHelper.FillListControlWithEnum <WorkflowStepSecurityEnum>(rbUserType, resPrefix + ".usersecurity");
            rbRoleType.SelectedValue = ((int)RolesSecurity).ToString();
            rbUserType.SelectedValue = ((int)UsersSecurity).ToString();
        }
        else
        {
            // Make sure the current site is always selected
            int selectedId = ValidationHelper.GetInteger(siteSelector.Value, 0);
            if (selectedId == 0)
            {
                selectedId         = SiteID;
                siteSelector.Value = SiteID;
            }
            siteId = selectedId;
        }

        // If global role selected - set siteID to 0
        if (siteSelector.GlobalRecordValue == siteId.ToString())
        {
            siteId = 0;
        }

        string siteIDWhere = (siteId == 0) ? "SiteID IS NULL" : "SiteID = " + siteId;

        usRoles.WhereCondition = siteIDWhere + " AND RoleGroupID IS NULL";
        usUsers.WhereCondition = "(UserIsHidden = 0 OR UserIsHidden IS NULL)";

        // Get the active roles for this site
        string where = String.Format("[StepID] = {0} AND [StepSourcePointGuid] {1}", WorkflowStepID, (SourcePointGuid == null ? "IS NULL" : String.Format("= '{0}'", SourcePointGuid.ToString())));

        var roles = WorkflowStepRoleInfoProvider.GetWorkflowStepRoles(where, null, 0, "RoleID").Select <WorkflowStepRoleInfo, string>(r => r.RoleID.ToString());

        currentRoles = string.Join(";", roles.ToArray());

        // Get the active users for this site
        var users = WorkflowStepUserInfoProvider.GetWorkflowStepUsers(where, null, 0, "UserID").Select <WorkflowStepUserInfo, string>(u => u.UserID.ToString());

        currentUsers = string.Join(";", users.ToArray());

        // Init lists when security type changes
        if (!RequestHelper.IsPostBack() || ControlsHelper.GetPostBackControlID(Page).StartsWithCSafe(rbRoleType.UniqueID) || ControlsHelper.GetPostBackControlID(Page).StartsWithCSafe(rbUserType.UniqueID))
        {
            usRoles.Value = currentRoles;
            usUsers.Value = currentUsers;
        }
    }
コード例 #19
0
 /// <summary>
 /// Populates drop down list with available enum options.
 /// </summary>
 private void ConfigureSelectionTypeControl()
 {
     // Display only appropriate selection types based on selected option category type
     ControlsHelper.FillListControlWithEnum(drpSelectionTypeEnum, typeof(OptionCategorySelectionTypeEnum), "optioncategory_selectiontype", false, true, GetExcludedOptions(OptionCategoryType));
 }
コード例 #20
0
ファイル: UserFilter.ascx.cs プロジェクト: isatriya/kentico10
 /// <summary>
 /// Initializes dropdown list with enum and (all) options.
 /// </summary>
 /// <typeparam name="TEnum"></typeparam>
 /// <param name="dropDownList">Dropdown list to initialize</param>
 /// <param name="resourcePrefix">The resource prefix used for the item text localization</param>
 private void AddItemsFromEnum <TEnum>(CMSDropDownList dropDownList, string resourcePrefix = null)
 {
     AddItemAll(dropDownList);
     ControlsHelper.FillListControlWithEnum <TEnum>(dropDownList, resourcePrefix);
 }
コード例 #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucSelectString.Scope               = ReportInfo.OBJECT_TYPE;
        ConnectionStringRow.Visible        = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("cms.reporting", "SetConnectionString");
        txtQuery.FullScreenParentElementID = pnlWebPartForm_Properties.ClientID;

        // Test permission for query
        txtQuery.Enabled = MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "EditSQLQueries");

        versionList.OnAfterRollback += versionList_onAfterRollback;

        PageTitle.HelpTopicName = HELP_TOPIC_LINK;

        // Register common resize and refresh scripts
        RegisterResizeAndRollbackScript("divFooter", divScrolable.ClientID);

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.general")
        });

        tabControlElem.TabItems.Add(new UITabItem
        {
            Text = GetString("general.preview")
        });

        tabControlElem.UsePostback = true;

        rfvCodeName.ErrorMessage    = GetString("general.requirescodename");
        rfvDisplayName.ErrorMessage = GetString("general.requiresdisplayname");

        Save += (s, ea) =>
        {
            if (SetData(true))
            {
                ltlScript.Text += ScriptHelper.GetScript("window.RefreshContent();CloseDialog();");
            }
        };

        int  reportId = QueryHelper.GetInteger("reportid", 0);
        bool preview  = QueryHelper.GetBoolean("preview", false);

        if (reportId > 0)
        {
            mReportInfo = ReportInfoProvider.GetReportInfo(reportId);
        }

        // If preview by URL -> select preview tab
        bool isPreview = QueryHelper.GetBoolean("preview", false);

        if (isPreview && !RequestHelper.IsPostBack())
        {
            tabControlElem.SelectedTab = 1;
        }

        if (PersistentEditedObject == null)
        {
            if (mReportInfo != null) // Must be valid reportid parameter
            {
                int id = QueryHelper.GetInteger("objectid", 0);

                // Try to load tableName from hidden field (adding new graph & preview)
                if (id == 0)
                {
                    id = ValidationHelper.GetInteger(txtNewTableHidden.Value, 0);
                }

                if (id > 0)
                {
                    PersistentEditedObject = ReportTableInfoProvider.GetReportTableInfo(id);
                    mReportTableInfo       = PersistentEditedObject as ReportTableInfo;
                }
            }
        }
        else
        {
            mReportTableInfo = PersistentEditedObject as ReportTableInfo;
        }

        if (mReportInfo != null)
        {
            ucSelectString.DefaultConnectionString = mReportInfo.ReportConnectionString;

            // Control text initializations
            if (mReportTableInfo != null)
            {
                PageTitle.TitleText = GetString("Reporting_ReportTable_Edit.TitleText");
                mTableId            = mReportTableInfo.TableID;

                if (ObjectVersionManager.DisplayVersionsTab(mReportTableInfo))
                {
                    tabControlElem.TabItems.Add(new UITabItem
                    {
                        Text = GetString("objectversioning.tabtitle")
                    });

                    versionList.Object     = mReportTableInfo;
                    versionList.IsLiveSite = false;
                }
            }
            else // New item
            {
                PageTitle.TitleText = GetString("Reporting_ReportTable_Edit.NewItemTitleText");
                if (!RequestHelper.IsPostBack())
                {
                    ucSelectString.Value      = String.Empty;
                    txtPageSize.Text          = "15";
                    txtQueryNoRecordText.Text = GetString("attachmentswebpart.nodatafound");
                    chkExportEnable.Checked   = true;
                    chkSubscription.Checked   = true;
                }
            }

            if (!RequestHelper.IsPostBack())
            {
                ControlsHelper.FillListControlWithEnum <PagerButtons>(drpPageMode, "PagerButtons");
                // Preselect page numbers paging
                drpPageMode.SelectedValue = ((int)PagerButtons.Numeric).ToString();

                LoadData();
            }
        }

        if ((preview) && (!RequestHelper.IsPostBack()))
        {
            tabControlElem.SelectedTab = 1;
            ShowPreview();
        }

        // In case of preview paging without saving table
        if (RequestHelper.IsPostBack() && tabControlElem.SelectedTab == 1)
        {
            // Reload default parameters
            FormInfo fi = new FormInfo(mReportInfo.ReportParameters);

            // Get datarow with required columns
            ctrlReportTable.ReportParameters = fi.GetDataRow(false);
            fi.LoadDefaultValues(ctrlReportTable.ReportParameters, true);

            // Collect data and put them in table info
            SetData();
            ctrlReportTable.TableInfo = mReportTableInfo;
        }

        CurrentMaster.PanelContent.RemoveCssClass("dialog-content");
        CurrentMaster.PanelContent.RemoveCssClass("ModalDialogContent");
    }
コード例 #22
0
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        // Get current index id
        int indexId = QueryHelper.GetInteger("indexId", 0);

        // Get current index info object
        SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(indexId);

        // Show warning if indes isn't ready yet
        if ((sii != null) && (sii.IndexStatus == IndexStatusEnum.NEW))
        {
            ShowWarning(GetString("srch.index.needrebuild"));
        }

        if (!RequestHelper.IsPostBack())
        {
            // Get current search text from query string
            string searchText = QueryHelper.GetString("searchtext", "");
            // Check whether search text is defined
            if (!string.IsNullOrEmpty(searchText))
            {
                // Get current search mode from query string
                string         searchMode     = QueryHelper.GetString("searchmode", "");
                SearchModeEnum searchModeEnum = searchMode.ToEnum <SearchModeEnum>();

                // Check whether index info exists
                if (sii != null)
                {
                    // Keep search text in search textbox
                    //txtSearchFor.Text = searchText;
                    var condition = new SearchCondition(null, searchModeEnum, SearchOptionsEnum.FullSearch);

                    searchText = SearchSyntaxHelper.CombineSearchCondition(searchText, condition);

                    // Get positions and ranges for search method
                    int startPosition     = 0;
                    int numberOfProceeded = 100;
                    int displayResults    = 100;
                    if (pgrSearch.CurrentPageSize != 0 && pgrSearch.GroupSize != 0)
                    {
                        startPosition     = (pgrSearch.CurrentPage - 1) * pgrSearch.CurrentPageSize;
                        numberOfProceeded = (((pgrSearch.CurrentPage / pgrSearch.GroupSize) + 1) * pgrSearch.CurrentPageSize * pgrSearch.GroupSize) + pgrSearch.CurrentPageSize;
                        displayResults    = pgrSearch.CurrentPageSize;
                    }

                    // Prepare parameters
                    SearchParameters parameters = new SearchParameters()
                    {
                        SearchFor                 = searchText,
                        SearchSort                = null,
                        Path                      = null,
                        ClassNames                = null,
                        CurrentCulture            = "##ALL##",
                        DefaultCulture            = null,
                        CombineWithDefaultCulture = false,
                        CheckPermissions          = false,
                        SearchInAttachments       = false,
                        User                      = MembershipContext.AuthenticatedUser,
                        SearchIndexes             = sii.IndexName,
                        StartingPosition          = startPosition,
                        DisplayResults            = displayResults,
                        NumberOfProcessedResults  = numberOfProceeded,
                        NumberOfResults           = 0,
                        AttachmentWhere           = null,
                        AttachmentOrderBy         = null,
                    };

                    // Search
                    DataSet results = SearchHelper.Search(parameters);

                    // Fill repeater with results
                    repSearchResults.DataSource = results;
                    repSearchResults.PagerForceNumberOfResults = parameters.NumberOfResults;
                    repSearchResults.DataBind();

                    // Show now results found ?
                    if (parameters.NumberOfResults == 0)
                    {
                        lblNoResults.Text    = "<br />" + GetString("srch.results.noresults.preview");
                        lblNoResults.Visible = true;

                        Exception searchError = SearchContext.LastError;
                        if (searchError != null)
                        {
                            pnlError.Visible = true;
                            lblError.Text    = GetString("smartsearch.searcherror") + " " + searchError.Message;
                        }
                    }
                }
            }

            // Fill CMSDropDownList option with values
            ControlsHelper.FillListControlWithEnum <SearchModeEnum>(drpSearchMode, "srch.dialog", useStringRepresentation: true);
            drpSearchMode.SelectedValue = QueryHelper.GetString("searchmode", EnumHelper.GetDefaultValue <SearchModeEnum>().ToStringRepresentation());

            // Set up search text
            txtSearchFor.Text = QueryHelper.GetString("searchtext", "");
        }
    }