/// <summary>
    /// Gets applications matching the given <paramref name="guidCollection"/> and filters them according to the current user permission.
    /// </summary>
    /// <param name="guidCollection">Collection of application Guids to be filtered</param>
    /// <returns>Collection of filtered applications</returns>
    private List <UIElementInfo> GetFilteredApplications(ICollection <Guid> guidCollection)
    {
        var applicationsWhere = new WhereCondition().WhereIn("ElementGUID", guidCollection);
        var applications      = ApplicationUIHelper.FilterApplications(ApplicationUIHelper.LoadApplications(applicationsWhere), CurrentUser, false);

        return(applications.Tables[0].Rows.Cast <DataRow>().Select(row => new UIElementInfo(row)).ToList());
    }
Esempio n. 2
0
    /// <summary>
    /// Setup application list.
    /// </summary>
    private void SetupAppList()
    {
        DataSet ds = ApplicationUIHelper.LoadApplications();
        DataSet filteredDataSet = ApplicationUIHelper.FilterApplications(ds, CurrentUser, true);

        if (filteredDataSet != null && !DataHelper.DataSourceIsEmpty(filteredDataSet))
        {
            // Create grouped data source
            appListUniview.DataSource = new GroupedDataSource(filteredDataSet, "ElementParentID", "ElementLevel");
            appListUniview.ReloadData(true);
        }

        if (SiteContext.CurrentSite != null)
        {
            SetupLiveSiteLink();
        }
    }
    /// <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.
        var uiContext = UIContextHelper.GetUIContext(this);

        SiteID = ApplicationUIHelper.IsAccessibleOnlyByGlobalAdministrator(uiContext.UIElement) ? querySiteID : SiteContext.CurrentSiteID;

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

        InitializeDropDownLists();

        base.OnInit(e);

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

        siteSelector.DropDownSingleSelect.AutoPostBack = true;
    }