Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check if parent object exists
        if ((PollId > 0) && !IsLiveSite)
        {
            UIContext.EditedObject = PollInfoProvider.GetPollInfo(PollId);
        }

        ScriptHelper.RegisterDialogScript(Page);

        uniGrid.IsLiveSite            = IsLiveSite;
        uniGrid.OnAction             += new OnActionEventHandler(uniGrid_OnAction);
        uniGrid.GridView.AllowSorting = false;
        uniGrid.WhereCondition        = "AnswerPollID=" + PollId;
        uniGrid.ZeroRowsText          = GetString("general.nodatafound");
        uniGrid.OnExternalDataBound  += UniGrid_OnExternalDataBound;
        uniGrid.OnBeforeDataReload   += UniGrid_OnBeforeDataReload;

        if (!AllowEdit)
        {
            uniGrid.ShowObjectMenu = false;
        }

        bizFormsAvailable = ModuleManager.IsModuleLoaded(ModuleName.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.BIZFORM, SiteContext.CurrentSiteName);
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        // Check the license
        if (!string.IsNullOrEmpty(DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty)))
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Newsletters);
        }

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Newsletter", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Newsletter");
        }

        var user = MembershipContext.AuthenticatedUser;

        // Check permissions for CMS Desk -> Tools -> Newsletter
        if (!user.IsAuthorizedPerUIElement("CMS.Newsletter", "Newsletter"))
        {
            RedirectToUIElementAccessDenied("CMS.Newsletter", "Newsletter");
        }

        // Check 'NewsletterRead' permission
        if (!user.IsAuthorizedPerResource("CMS.Newsletter", "Read"))
        {
            RedirectToAccessDenied("CMS.Newsletter", "Read");
        }
    }
Ejemplo n.º 3
0
    protected void Page_Init(object sender, EventArgs e)
    {
        var issue = EditedObject as IssueInfo;

        if (issue == null)
        {
            RedirectToAccessDenied(GetString("general.invalidparameters"));
        }

        if (!issue.CheckPermissions(PermissionsEnum.Read, CurrentSiteName, CurrentUser))
        {
            RedirectToAccessDenied(issue.TypeInfo.ModuleName, "AuthorIssues");
        }

        // Check the license
        if (!string.IsNullOrEmpty(DataHelper.GetNotEmpty(RequestContext.CurrentDomain, string.Empty)))
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Newsletters);
        }

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Newsletter", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Newsletter");
        }
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Required field validator error messages initialization
        rfvAnswerText.ErrorMessage = GetString("Polls_Answer_Edit.AnswerTextError");

        // Set if it is live site
        txtAnswerText.IsLiveSite = IsLiveSite;

        // Set edited object
        EditedObject = PollAnswer;

        // Load BizForm selector if BizForms module is available
        if (ModuleEntryManager.IsModuleLoaded(ModuleName.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.BIZFORM, SiteContext.CurrentSiteName))
        {
            bizFormElem         = (FormEngineUserControl)Page.LoadUserControl("~/CMSModules/BizForms/FormControls/SelectBizForm.ascx");
            bizFormElem.ShortID = "bizFormElem";
            bizFormElem.SetValue("ShowSiteFilter", false);
            plcBizFormSelector.Controls.Add(bizFormElem);
            bizFormElem.Visible = true;

            UniSelector uniSelector = bizFormElem.GetValue("UniSelector") as UniSelector;
            if (uniSelector != null)
            {
                uniSelector.OnSelectionChanged += BizFormSelector_OnSelectionChanged;
            }
        }

        if (!RequestHelper.IsPostBack() && !IsLiveSite)
        {
            LoadData();
        }
    }
Ejemplo n.º 5
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Check the license
        if (!string.IsNullOrEmpty(DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), string.Empty)))
        {
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.Newsletters);
        }

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Newsletter", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Newsletter");
        }

        CurrentUserInfo user = CMSContext.CurrentUser;

        // Check permissions for CMS Desk -> Tools -> Newsletter
        if (!user.IsAuthorizedPerUIElement("CMS.Tools", "Newsletter"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Tools", "Newsletter");
        }

        // Check 'AuthorIssues' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.Newsletter", "Read"))
        {
            RedirectToCMSDeskAccessDenied("CMS.Newsletter", "Read");
        }
    }
    /// <summary>
    /// Init event handler
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        SiteID = CurrentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.GlobalAdmin) ? 0 : SiteContext.CurrentSiteID;

        // Set site id for the control
        prmhdrHeader.SiteID = SiteID;

        CurrentUserInfo user = MembershipContext.AuthenticatedUser;

        if (user != null)
        {
            // Check site availability
            if (!user.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))
            {
                if (!ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.PERMISSIONS, SiteContext.CurrentSiteName))
                {
                    RedirectToResourceNotAvailableOnSite(ModuleName.PERMISSIONS);
                }
            }

            // Check "read" permission
            if (!user.IsAuthorizedPerResource(ModuleName.PERMISSIONS, "Read"))
            {
                RedirectToAccessDenied(ModuleName.PERMISSIONS, "Read");
            }
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// On button filtered handler.
    /// </summary>
    bool ucUIToolbar_OnButtonFiltered(UIElementInfo uiElement)
    {
        bool   moduleOnSite = true;
        string siteName     = CMSContext.CurrentSiteName;

        // Check whether modules are assigned to current site
        switch (uiElement.ElementName.ToLower())
        {
        case "myfriends":
            moduleOnSite = ResourceSiteInfoProvider.IsResourceOnSite("CMS.Friends", siteName);
            break;

        case "mymessages":
            moduleOnSite = ResourceSiteInfoProvider.IsResourceOnSite("CMS.Messaging", siteName);
            break;

        case "myblogs":
            moduleOnSite = ResourceSiteInfoProvider.IsResourceOnSite("CMS.Blog", siteName);
            break;

        case "myprojects":
            moduleOnSite = ResourceSiteInfoProvider.IsResourceOnSite("CMS.ProjectManagement", siteName);
            break;
        }

        // Check whether separable modules are loaded
        return(moduleOnSite && IsMyDeskUIElementAvailable(uiElement.ElementName));
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Raises the <see cref="E:Init"/> event.
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        CurrentUserInfo cui = CMSContext.CurrentUser;

        // Check UI Permissions
        if ((cui == null) || !cui.IsAuthorizedPerUIElement("CMS.Content", "Properties.Variants"))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.Content", "Properties.Variants");
        }

        // Check module availability on site
        if (!ResourceSiteInfoProvider.IsResourceOnSite("cms.contentpersonalization", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.ContentPersonalization");
        }

        // Check license
        if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "")
        {
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetCurrentDomain(), FeatureEnum.ContentPersonalization);
        }

        // Check the Read permissions
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.contentpersonalization", "Read"))
        {
            RedirectToAccessDenied(String.Format(GetString("general.permissionresource"), "Read", "Content personalization"));
        }
    }
Ejemplo n.º 9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.MediaLibrary");
        }

        string output = QueryHelper.GetString("output", "");

        bool checkUI = true;

        if ((output == "copy") || (output == "move") || (output == "relationship") || (output == "selectpath"))
        {
            checkUI = false;
        }

        if (checkUI)
        {
            string errorMessage = "";

            OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false));
            if ((outputFormat == OutputFormatEnum.HTMLLink) && !CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                errorMessage = "InsertLink";
            }
            else if ((outputFormat == OutputFormatEnum.HTMLMedia) && !CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia"))
            {
                errorMessage = "InsertImageOrMedia";
            }

            if (errorMessage != "")
            {
                RedirectToCMSDeskUIElementAccessDenied("CMS.WYSIWYGEditor", errorMessage);
            }

            if (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "MediaLibrariesTab"))
            {
                errorMessage = "MediaLibrariesTab";
            }

            if (errorMessage != "")
            {
                RedirectToCMSDeskUIElementAccessDenied("CMS.MediaDialog", errorMessage);
            }
        }

        if (QueryHelper.ValidateHash("hash"))
        {
            ScriptHelper.RegisterJQuery(this.Page);
            CMSDialogHelper.RegisterDialogHelper(this.Page);

            this.linkMedia.InitFromQueryString();
        }
        else
        {
            this.linkMedia.StopProcessing = true;
        }
    }
Ejemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.MediaLibrary");
        }

        string output = QueryHelper.GetString("output", "");

        bool checkUI = (output != "copy") && (output != "move") && (output != "relationship") && (output != "selectpath");

        if (checkUI)
        {
            string errorMessage = "";

            OutputFormatEnum outputFormat = CMSDialogHelper.GetOutputFormat(output, QueryHelper.GetBoolean("link", false));
            if ((outputFormat == OutputFormatEnum.HTMLLink) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertLink"))
            {
                errorMessage = "InsertLink";
            }
            else if ((outputFormat == OutputFormatEnum.HTMLMedia) && !MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.WYSIWYGEditor", "InsertImageOrMedia"))
            {
                errorMessage = "InsertImageOrMedia";
            }

            if (errorMessage != "")
            {
                RedirectToUIElementAccessDenied("CMS.WYSIWYGEditor", errorMessage);
            }

            if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerUIElement("CMS.MediaDialog", "MediaLibrariesTab"))
            {
                errorMessage = "MediaLibrariesTab";
            }

            if (errorMessage != "")
            {
                RedirectToUIElementAccessDenied("CMS.MediaDialog", errorMessage);
            }
        }

        // CKEditor's plugin filebrowser add custom params to url.
        // This ensures that custom params aren't validated
        if (QueryHelper.ValidateHash("hash", "CKEditor;CKEditorFuncNum;langCode", validateWithoutExcludedParameters: true))
        {
            ScriptHelper.RegisterJQuery(Page);
            CMSDialogHelper.RegisterDialogHelper(Page);

            linkMedia.InitFromQueryString();
        }
        else
        {
            linkMedia.StopProcessing = true;
        }
    }
Ejemplo n.º 11
0
    public void InitFromQueryString()
    {
        // Get format definition from URL
        string output = QueryHelper.GetString("output", "html");
        bool   link   = QueryHelper.GetBoolean("link", false);

        OutputFormat = CMSDialogHelper.GetOutputFormat(output, link);
        if (OutputFormat == OutputFormatEnum.Custom)
        {
            CustomOutputFormat = output;
        }

        // Get selectable content
        string content = QueryHelper.GetString("content", "all");

        SelectableContent = CMSDialogHelper.GetSelectableContent(content);

        // Get user dialog configuration
        XmlData userConfig = MembershipContext.AuthenticatedUser.UserSettings.UserDialogsConfiguration;

        // Get selected tab from URL
        SelectedTab = QueryHelper.GetString("tab", (string)userConfig["selectedtab"]);

        // Get hidden tabs from URL
        bool hasFormGuid   = (QueryHelper.GetGuid("formguid", Guid.Empty) != Guid.Empty);
        bool hasDocumentId = (QueryHelper.GetInteger("documentid", 0) > 0);
        bool hasParentId   = (QueryHelper.GetInteger("parentid", 0) > 0);

        HideAttachments = QueryHelper.GetBoolean("attachments_hide", false) || !((hasFormGuid && hasParentId) || hasDocumentId || HasMetaFileObjectInfo);

        HideContent = QueryHelper.GetBoolean("content_hide", false);
        if (!HideContent)
        {
            // Check site availability
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Content", SiteContext.CurrentSiteName))
            {
                HideContent = true;
            }
        }

        HideMediaLibraries = QueryHelper.GetBoolean("libraries_hide", false);
        if (!HideMediaLibraries)
        {
            // Check site availability
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", SiteContext.CurrentSiteName))
            {
                HideMediaLibraries = true;
            }
        }

        HideWeb    = QueryHelper.GetBoolean("web_hide", false);
        HideAnchor = QueryHelper.GetBoolean("anchor_hide", false);
        HideEmail  = QueryHelper.GetBoolean("email_hide", false);
    }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentUserInfo currentUser = CMSContext.CurrentUser;

        // Setup unigrid
        gridClasses.GridView.ShowHeader  = false;
        gridClasses.GridView.BorderWidth = 0;
        gridClasses.OnExternalDataBound += gridClasses_OnExternalDataBound;
        gridClasses.OnBeforeDataReload  += gridClasses_OnBeforeDataReload;
        gridClasses.OnAfterRetrieveData += gridClasses_OnAfterRetrieveData;

        if (ConvertDocumentID > 0)
        {
            // Hide extra options
            plcNewABTestVariant.Visible = false;
            plcNewLink.Visible          = false;
        }
        else
        {
            imgNewLink.ImageUrl    = GetImageUrl("CMSModules/CMS_Content/Menu/Link.png");
            lblNewLink.Text        = GetString("ContentNew.NewLink");
            lnkNewLink.NavigateUrl = "javascript:modalDialog('" + GetLinkDialogUrl(ParentNodeID) + "', 'contentselectnode', '90%', '85%')";

            plcNewABTestVariant.Visible = false;

            if (ParentNode != null)
            {
                // AB test variant settings
                if (SettingsKeyProvider.GetBoolValue(CMSContext.CurrentSiteName + ".CMSABTestingEnabled") &&
                    AllowNewABTest &&
                    !IsInDialog &&
                    currentUser.IsAuthorizedPerResource("cms.ABTest", "Read") &&
                    ModuleEntry.IsModuleLoaded("cms.onlinemarketing") &&
                    ResourceSiteInfoProvider.IsResourceOnSite("CMS.ABTest", CMSContext.CurrentSiteName) &&
                    LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.ABTesting) &&
                    (ParentNode.NodeAliasPath != "/"))
                {
                    string url = URLHelper.AddParameterToUrl(NewVariantUrl, "parentnodeid", ParentNodeID.ToString());
                    url = URLHelper.AddParameterToUrl(url, "parentculture", ParentCulture);

                    plcNewABTestVariant.Visible = true;
                    lblNewVariant.Text          = GetString("abtesting.abtestvariant");
                    lnkNewVariant.NavigateUrl   = URLHelper.GetAbsoluteUrl(url);

                    if (pnlFooter.Visible == false)
                    {
                        pnlABVariant.CssClass += "PageSeparator";
                    }
                }
            }

            imgNewVariant.ImageUrl = GetImageUrl("Objects/CMS_Variant/object_small.png");
        }
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var currentUser = MembershipContext.AuthenticatedUser;

        // Setup unigrid
        gridClasses.GridView.ShowHeader  = false;
        gridClasses.GridView.BorderWidth = 0;
        gridClasses.OnExternalDataBound += gridClasses_OnExternalDataBound;
        gridClasses.OnBeforeDataReload  += gridClasses_OnBeforeDataReload;
        gridClasses.OnAfterRetrieveData += gridClasses_OnAfterRetrieveData;

        if (ConvertDocumentID > 0)
        {
            // Hide extra options
            plcNewABTestVariant.Visible = false;
            plcNewLink.Visible          = false;
        }
        else
        {
            if (Scope != null)
            {
                // Initialize control by scope settings
                AllowNewABTest &= Scope.ScopeAllowABVariant;
                AllowNewLink   &= Scope.ScopeAllowLinks;
            }

            lblNewLink.Text        = GetString("content.ui.linkexistingdoc");
            lnkNewLink.NavigateUrl = "javascript:modalDialog('" + GetLinkDialogUrl(ParentNodeID) + "', 'contentselectnode', '90%', '85%')";

            plcNewABTestVariant.Visible = false;

            if (ParentNode != null)
            {
                // AB test variant settings
                if (SettingsKeyInfoProvider.GetBoolValue(SiteContext.CurrentSiteName + ".CMSABTestingEnabled") &&
                    AllowNewABTest &&
                    !IsInDialog &&
                    currentUser.IsAuthorizedPerResource("cms.ABTest", "Read") &&
                    ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) &&
                    ResourceSiteInfoProvider.IsResourceOnSite("CMS.ABTest", SiteContext.CurrentSiteName) &&
                    LicenseHelper.CheckFeature(RequestContext.CurrentDomain, FeatureEnum.ABTesting) &&
                    (ParentNode.NodeAliasPath != "/") &&
                    (ParentNode.NodeClassName != "CMS.Folder"))
                {
                    string url = URLHelper.AddParameterToUrl(NewVariantUrl, "parentnodeid", ParentNodeID.ToString());
                    url = URLHelper.AddParameterToUrl(url, "parentculture", ParentCulture);

                    plcNewABTestVariant.Visible = true;
                    lblNewVariant.Text          = GetString("abtesting.abtestvariant");
                    lnkNewVariant.NavigateUrl   = URLHelper.GetAbsoluteUrl(url);
                }
            }
        }
    }
    /// <summary>
    /// Checks permissions for Reporting module.
    /// </summary>
    private void CheckReportingAvailability()
    {
        if (!ModuleEntryManager.IsModuleLoaded(ModuleName.REPORTING))
        {
            RedirectToUINotAvailable();
        }

        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Reporting", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Reporting");
        }
    }
Ejemplo n.º 15
0
    protected override void OnInit(EventArgs e)
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Content", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Content");
        }

        // Check security for content and properties tab
        CMSPropertiesPage.CheckPropertiesSecurity();
        CMSContentPage.CheckSecurity();

        base.OnInit(e);
    }
Ejemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Categories", CMSContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Categories");
        }

        // Check UIProfile
        if ((CMSContext.CurrentUser == null) || (!CMSContext.CurrentUser.IsAuthorizedPerUIElement("CMS.MyDesk", "MyProfile.Categories")))
        {
            RedirectToCMSDeskUIElementAccessDenied("CMS.MyDesk", "MyProfile.Categories");
        }
    }
Ejemplo n.º 17
0
    /// <summary>
    /// Checks security.
    /// </summary>
    private void CheckSecurity()
    {
        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Reporting", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Reporting");
        }

        // Check 'Read' permission
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "Read"))
        {
            RedirectToAccessDenied("CMS.Reporting", "Read");
        }
    }
    protected void Page_Init(object sender, EventArgs e)
    {
        // Check license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, "") != "")
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Polls);
        }

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Polls", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Polls");
        }

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Form", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Form");
        }

        var user = MembershipContext.AuthenticatedUser;

        // Check permissions for CMS Desk -> Tools -> Polls
        if (!user.IsAuthorizedPerUIElement("CMS.Polls", "Polls"))
        {
            RedirectToUIElementAccessDenied("CMS", "Polls");
        }

        // Check permissions for site polls
        if (!user.IsAuthorizedPerResource("CMS.Polls", CMSAdminControl.PERMISSION_READ))
        {
            RedirectToAccessDenied("CMS.Polls", "Read");
        }

        // Check permissions for forms
        if (!user.IsAuthorizedPerResource("CMS.Form", "ReadData"))
        {
            RedirectToAccessDenied("CMS.Form", "ReadData");
        }

        // Load BizForm selector if BizForms module is available
        if (ModuleManager.IsModuleLoaded(ModuleName.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.BIZFORM, SiteContext.CurrentSiteName))
        {
            bizFormData         = this.LoadUserControl("~/CMSModules/BizForms/Controls/BizFormEditData.ascx") as CMSAdminControl;
            bizFormData.ShortID = "bizFormData";
            bizFormData.SetValue("ShowNewRecordButton", false);
            plcBizForm.Controls.Add(bizFormData);
            bizFormData.Visible = true;
        }
    }
Ejemplo n.º 19
0
    protected string[] tabElem_OnTabCreated(UIElementInfo element, string[] parameters, int tabIndex)
    {
        bool   splitViewSupported = true;
        string elementName        = element.ElementName.ToLower();

        switch (elementName)
        {
        case "properties.languages":
            splitViewSupported = false;
            if (!CultureInfoProvider.IsSiteMultilignual(CMSContext.CurrentSiteName) || !CultureInfoProvider.LicenseVersionCheck())
            {
                return(null);
            }
            break;

        case "properties.security":
        case "properties.relateddocs":
        case "properties.linkeddocs":
            splitViewSupported = false;
            break;

        case "properties.variants":
            // Check license
            if (DataHelper.GetNotEmpty(URLHelper.GetCurrentDomain(), "") != "")
            {
                if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.ContentPersonalization, ModuleEntry.ONLINEMARKETING) ||
                    !ResourceSiteInfoProvider.IsResourceOnSite("CMS.ContentPersonalization", CMSContext.CurrentSiteName))
                {
                    return(null);
                }
            }
            break;
        }

        // Ensure tab preselection
        if (elementName.StartsWith("properties.") && (elementName.Substring("properties.".Length) == selected))
        {
            CurrentMaster.Tabs.SelectedTab = tabIndex;
        }

        // Ensure split view mode
        if (splitViewSupported && CMSContext.DisplaySplitMode)
        {
            parameters[2] = GetSplitViewUrl(parameters[2]);
        }

        return(parameters);
    }
    /// <summary>
    /// Sets tabs for tab menu
    /// </summary>
    private void InitializeTabMenu()
    {
        if (ModuleEntry.IsModuleLoaded(ModuleEntry.NEWSLETTER) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.NEWSLETTER, CMSContext.CurrentSiteName))
        {
            TabItem newsletter = new TabItem();
            newsletter.Text        = GetString("newsletter_edit.newsletters");
            newsletter.RedirectUrl = "#NewsletterGroup";
            tabControlElem.TabItems.Add(newsletter);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.BLOGS) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.BLOGS, CMSContext.CurrentSiteName))
        {
            TabItem blog = new TabItem();
            blog.Text        = GetString("blog.blogs");
            blog.RedirectUrl = "#BlogGroup";
            tabControlElem.TabItems.Add(blog);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.MESSAGEBOARD) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.MESSAGEBOARD, CMSContext.CurrentSiteName))
        {
            TabItem board = new TabItem();
            board.Text        = GetString("board.header.messageboards");
            board.RedirectUrl = "#BoardGroup";
            tabControlElem.TabItems.Add(board);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.FORUMS) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.FORUMS, CMSContext.CurrentSiteName))
        {
            TabItem forum = new TabItem();
            forum.Text        = GetString("forum_list.headercaption");
            forum.RedirectUrl = "#ForumGroup";
            tabControlElem.TabItems.Add(forum);
        }

        if (ModuleEntry.IsModuleLoaded(ModuleEntry.REPORTING) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.REPORTING, CMSContext.CurrentSiteName))
        {
            TabItem report = new TabItem();
            report.Text        = GetString("reporting.reports");
            report.RedirectUrl = "#ReportGroup";
            tabControlElem.TabItems.Add(report);
        }

        tabControlElem.SelectedTab = -1;
        tabControlElem.UrlTarget   = "_self";
    }
    protected void Header_OnTabCreated(object sender, TabCreatedEventArgs e)
    {
        if (e.Tab == null)
        {
            return;
        }

        switch (e.TabIndex)
        {
        case 1:
            if ((!ModuleEntryManager.IsModuleLoaded(ModuleName.ONLINEMARKETING) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.ONLINEMARKETING, SiteContext.CurrentSiteName)))
            {
                // Hide tab if module is not loaded
                e.Tab = null;
            }
            break;
        }
    }
Ejemplo n.º 22
0
    /// <summary>
    /// Checks permissions for Reporting module.
    /// </summary>
    private void CheckReportingAvailability()
    {
        if (!ModuleEntryManager.IsModuleLoaded(ModuleName.REPORTING))
        {
            RedirectToUINotAvailable();
        }

        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Reporting", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Reporting");
        }

        // Check additional read permission to Reporting module
        if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.Reporting", "Read"))
        {
            RedirectToAccessDenied("CMS.Reporting", "Read");
        }
    }
Ejemplo n.º 23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (QueryHelper.ValidateHash("hash"))
        {
            // Check site availability
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", CMSContext.CurrentSiteName))
            {
                RedirectToResourceNotAvailableOnSite("CMS.MediaLibrary");
            }

            // Initialize controls
            SetupControls();
        }
        else
        {
            this.createFolder.Visible = false;
            string url = ResolveUrl("~/CMSMessages/Error.aspx?title=" + GetString("dialogs.badhashtitle") + "&text=" + GetString("dialogs.badhashtext") + "&cancel=1");
            ScriptHelper.RegisterStartupScript(Page, typeof(string), "redirect", ScriptHelper.GetScript("if (window.parent != null) { window.parent.location = '" + url + "' }"));
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (QueryHelper.ValidateHash("hash"))
        {
            // Check site availability
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.MediaLibrary", SiteContext.CurrentSiteName))
            {
                RedirectToResourceNotAvailableOnSite("CMS.MediaLibrary");
            }

            // Initialize controls
            SetupControls();
        }
        else
        {
            createFolder.Visible = false;
            string url = ResolveUrl(AdministrationUrlHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext", true));
            ScriptHelper.RegisterStartupScript(Page, typeof(string), "redirect", ScriptHelper.GetScript(String.Format("if (window.parent != null) {{ window.parent.location = '{0}' }}", url)));
        }
    }
Ejemplo n.º 25
0
    /// <summary>
    /// Reloads answer data.
    /// </summary>
    public override void ReloadData()
    {
        ClearForm();
        if (pollAnswerObj == null)
        {
            pollAnswerObj = PollAnswerInfoProvider.GetPollAnswerInfo(ItemID);
        }

        if (pollAnswerObj != null)
        {
            // Load the fields
            txtAnswerText.Text       = pollAnswerObj.AnswerText;
            chkAnswerEnabled.Checked = pollAnswerObj.AnswerEnabled;
            txtVotes.Text            = pollAnswerObj.AnswerCount.ToString();
            pnlGeneral.GroupingText  = GetString("general.general");
            plcVotes.Visible         = true;

            // Check if bizform module is available (for open-ended answers).
            if (ModuleEntry.IsModuleLoaded(ModuleEntry.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.BIZFORM, CMSContext.CurrentSiteName))
            {
                // Show open-ended answer settings only for site poll
                PollInfo pi = PollInfoProvider.GetPollInfo(pollAnswerObj.AnswerPollID);
                plcOpenAnswer.Visible = (pi != null) && (pi.PollSiteID > 0) && (pi.PollGroupID == 0);

                chkAnswerIsOpenEnded.Checked  = plcOpenAnswerSettings.Visible = pollAnswerObj.AnswerIsOpenEnded;
                bizFormElem.Value             = pollAnswerObj.AnswerForm;
                alternativeFormElem.ClassName = "BizForm." + bizFormElem.Text;
                alternativeFormElem.Value     = pollAnswerObj.AnswerAlternativeForm;
                chkAnswerHideForm.Checked     = pollAnswerObj.AnswerHideForm;
                pnlAnswerForm.GroupingText    = GetString("polls.answerformsettings");
            }
        }
        else
        {
            txtAnswerText.Text      = String.Empty;
            plcVotes.Visible        = false;
            pnlGeneral.GroupingText = string.Empty;
        }
    }
Ejemplo n.º 26
0
    /// <summary>
    /// Reloads answer data.
    /// </summary>
    public override void ReloadData()
    {
        ClearForm();
        // Force reloading of PollAnswer info object if ID changed. The getter does the actual load.
        if ((PollAnswer != null) && (ItemID != PollAnswer.AnswerPollID))
        {
            PollAnswer   = null;
            EditedObject = PollAnswer;
        }

        if ((PollAnswer != null) && (PollAnswer.AnswerPollID > 0))
        {
            // Load the fields
            txtAnswerText.Text        = PollAnswer.AnswerText;
            chkAnswerEnabled.Checked  = PollAnswer.AnswerEnabled;
            txtVotes.Text             = PollAnswer.AnswerCount.ToString();
            plcVotes.Visible          = true;
            pnlGeneralHeading.Visible = true;

            // Check if bizform module is available (for open-ended answers).
            if (ModuleEntryManager.IsModuleLoaded(ModuleName.BIZFORM) && ResourceSiteInfoProvider.IsResourceOnSite(ModuleName.BIZFORM, SiteContext.CurrentSiteName))
            {
                // Show open-ended answer settings only for site poll
                PollInfo pi = PollInfoProvider.GetPollInfo(PollAnswer.AnswerPollID);
                plcOpenAnswer.Visible = (pi != null) && (pi.PollSiteID > 0) && (pi.PollGroupID == 0);

                chkAnswerIsOpenEnded.Checked  = updPanelForm.Visible = plcOpenAnswerSettings.Visible = PollAnswer.AnswerIsOpenEnded;
                bizFormElem.Value             = PollAnswer.AnswerForm;
                alternativeFormElem.ClassName = "BizForm." + bizFormElem.Text;
                alternativeFormElem.Value     = PollAnswer.AnswerAlternativeForm;
                chkAnswerHideForm.Checked     = PollAnswer.AnswerHideForm;
            }
        }
        else
        {
            txtAnswerText.Text = String.Empty;
            plcVotes.Visible   = false;
        }
    }
Ejemplo n.º 27
0
    /// <summary>
    /// Page OnInit event.
    /// </summary>
    /// <param name="e">Event args</param>
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Check forums availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Forums", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Forums");
        }

        // Check groups availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Groups", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Groups");
        }

        // Check the license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, "") != "")
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Groups);
        }
    }
Ejemplo n.º 28
0
    private static string[] tabElem_OnTabCreated(CMS.SiteProvider.UIElementInfo element, string[] parameters, int tabIndex)
    {
        switch (element.ElementName.ToLower())
        {
        case "myprofile.notifications":
            if (!LicenseHelper.IsFeatureAvailableInUI(FeatureEnum.Notifications, ModuleEntry.NOTIFICATIONS) ||
                !ResourceSiteInfoProvider.IsResourceOnSite(ModuleEntry.NOTIFICATIONS, CMSContext.CurrentSiteName))
            {
                return(null);
            }
            break;

        case "myprofile.categories":
            if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Categories", CMSContext.CurrentSiteName))
            {
                return(null);
            }
            break;
        }

        return(parameters);
    }
Ejemplo n.º 29
0
    /// <summary>
    /// OnLoad override.
    /// Verifies permisisons and module availability
    /// </summary>
    /// <param name="e">Event agrs</param>
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);

        CheckDocPermissions = false;

        // Check the license
        if (DataHelper.GetNotEmpty(RequestContext.CurrentDomain, "") != "")
        {
            LicenseHelper.CheckFeatureAndRedirect(RequestContext.CurrentDomain, FeatureEnum.Forums);
        }

        // Check site availability
        if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Forums", SiteContext.CurrentSiteName))
        {
            RedirectToResourceNotAvailableOnSite("CMS.Forums");
        }

        CurrentUserInfo user = MembershipContext.AuthenticatedUser;

        if ((mode != "subscription") || (userId != user.UserID))
        {
            // Check permissions for CMS Desk -> Tools -> Forums
            if (!user.IsAuthorizedPerUIElement("CMS.Forums", "Forums"))
            {
                RedirectToUIElementAccessDenied("CMS.Forums", "Forums");
            }

            // Check 'Read' permission
            if (!user.IsAuthorizedPerResource("CMS.Forums", "Read"))
            {
                RedirectToAccessDenied("CMS.Forums", "Read");
            }
        }

        SetUpControl();
    }
Ejemplo n.º 30
0
    /// <summary>
    /// Init event handler
    /// </summary>
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        CurrentUserInfo user = MembershipContext.AuthenticatedUser;

        if (user != null)
        {
            // Check site availability
            if (!user.IsGlobalAdministrator)
            {
                if (!ResourceSiteInfoProvider.IsResourceOnSite("CMS.Permissions", SiteContext.CurrentSiteName))
                {
                    RedirectToResourceNotAvailableOnSite("CMS.Permissions");
                }
            }

            // Check "read" permission
            if (!user.IsAuthorizedPerResource("CMS.Permissions", "Read"))
            {
                RedirectToAccessDenied("CMS.Permissions", "Read");
            }
        }
    }