Exemple #1
0
    protected override void OnPreInit(EventArgs e)
    {
        // Checks all permissions for web analytics
        CMSWebAnalyticsPage.CheckAllPermissions();

        string         conversionName = QueryHelper.GetString("conversionName", String.Empty);
        int            conversionID   = QueryHelper.GetInteger("conversionID", 0);
        ConversionInfo ci             = null;

        if (conversionName != String.Empty)
        {
            // Try to check dialog mode
            conversionName = conversionName.Trim(';');
            ci             = ConversionInfoProvider.GetConversionInfo(conversionName, CMSContext.CurrentSiteName);
        }

        if (conversionID != 0)
        {
            ci = ConversionInfoProvider.GetConversionInfo(conversionID);
        }

        // Test whether conversion is in current site, if not - test if user is authorized for conversion's site
        if (ci != null)
        {
            int siteID = CMSContext.CurrentSiteID;
            if (ci.ConversionSiteID != siteID)
            {
                if (!CMSContext.CurrentUser.IsInSite(SiteInfoProvider.GetSiteName(ci.ConversionSiteID)))
                {
                    RedirectToAccessDenied(GetString("conversion.currentsite"));
                    return;
                }
            }
        }

        if ((conversionName != String.Empty) && (ci == null))
        {
            // Set warning text
            infoText = String.Format(GetString("conversion.editedobjectnotexits"), conversionName);

            // Create new conversion info based on conversion name
            ci = new ConversionInfo();
            ci.ConversionName        = conversionName;
            ci.ConversionDisplayName = conversionName;
        }

        modalDialog = QueryHelper.GetBoolean("modalDialog", false);
        if (modalDialog)
        {
            MasterPageFile = "~/CMSMasterPages/UI/Dialogs/ModalDialogPage.master";
            if (ci != null)
            {
                this.CurrentMaster.Title.TitleText  = GetString("analytics.conversion");
                this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Analytics_Conversion/object.png");
            }
            else
            {
                this.CurrentMaster.Title.TitleText  = GetString("conversion.conversion.new");
                this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Analytics_Conversion/new.png");
            }
            SetDialogButtons();
        }

        if (ci != null)
        {
            EditedObject = ci;
        }

        base.OnPreInit(e);
    }
Exemple #2
0
    protected override void OnPreInit(EventArgs e)
    {
        // Checks all permissions for web analytics
        CMSWebAnalyticsPage.CheckAllPermissions();

        string       campaignName = QueryHelper.GetString("campaignName", String.Empty);
        int          campaignID   = QueryHelper.GetInteger("campaignID", 0);
        CampaignInfo ci           = null;

        if (campaignName != String.Empty)
        {
            // Try to check dialog mode
            ci = CampaignInfoProvider.GetCampaignInfo(campaignName, CMSContext.CurrentSiteName);
        }

        if ((campaignName != String.Empty) && (ci == null))
        {
            // Set warning text
            infoText = String.Format(GetString("campaign.editedobjectnotexits"), campaignName);

            // Create campaign info based on campaign name
            ci = new CampaignInfo();
            ci.CampaignDisplayName = campaignName;
            ci.CampaignName        = campaignName;
        }

        if (campaignID != 0)
        {
            ci = CampaignInfoProvider.GetCampaignInfo(campaignID);
        }

        // Validate SiteID for non administrators
        if ((ci != null) && (!CMSContext.CurrentUser.IsGlobalAdministrator))
        {
            if (ci.CampaignSiteID != CMSContext.CurrentSiteID)
            {
                RedirectToAccessDenied(GetString("cmsmessages.accessdenied"));
            }
        }

        modalDialog = QueryHelper.GetBoolean("modalDialog", false);
        if (modalDialog)
        {
            MasterPageFile = "~/CMSMasterPages/UI/Dialogs/ModalDialogPage.master";
            if (ci != null)
            {
                this.CurrentMaster.Title.TitleText  = GetString("analytics.campaign");
                this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Analytics_Campaign/object.png");
            }
            else
            {
                this.CurrentMaster.Title.TitleText  = GetString("campaign.campaign.new");
                this.CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Analytics_Campaign/new.png");
            }
            SetDialogButtons();
        }

        if (ci != null)
        {
            EditedObject = ci;
        }

        CurrentMaster.Title.HelpTopicName = "campaign_general";
        CurrentMaster.Title.HelpName      = "helpTopic";

        base.OnPreInit(e);
    }