private string GetUtmCampaignNameHtmlOutput()
    {
        CampaignInfo campaign = CampaignInfoProvider.GetCampaignInfo(mIssue.IssueUTMCampaign, CurrentSiteName);

        // Is issue linked to an existing campaign
        if (campaign != null)
        {
            var campaignDetailUrl = Service.Entry <IUILinkProvider>().GetSingleObjectLink(CampaignInfo.TYPEINFO.ModuleName, CAMPAIGN_ELEMENT_CODENAME,
                                                                                          new ObjectDetailLinkParameters
            {
                ObjectIdentifier         = campaign.CampaignID,
                AllowNavigationToListing = true
            });
            var hyperLink = new HyperLink
            {
                NavigateUrl = URLHelper.GetAbsoluteUrl(campaignDetailUrl),
                Text        = HTMLHelper.HTMLEncode(campaign.CampaignDisplayName),
                Target      = "_top",
            };

            return(hyperLink.GetRenderedHTML());
        }

        return(mIssue.IssueUTMCampaign);
    }
Пример #2
0
        private void GenerateActivities(
            string campaignName,
            IReadOnlyDictionary <string, IEnumerable <ActivityDataParameters> > conversionHits,
            int contactsCount)
        {
            var siteName     = _mSite.SiteName;
            var campaignInfo = CampaignInfoProvider.GetCampaignInfo(campaignName, siteName);
            var posterPath   = CampaignDataGeneratorHelpers.GetDocument(PagePathAmericasCoffeePoster);
            var colombiaPath = CampaignDataGeneratorHelpers.GetDocument(PagePathColombia);
            var bizFormInfo  = BizFormInfoProvider.GetBizFormInfo(TryFreeSampleFormCodeName, _mSite.SiteID);

            CampaignDataGeneratorHelpers.DeleteOldActivities(campaignInfo.CampaignUTMCode);
            var contactsIDs = new ContactsIdData(_contactEmailPostfix, contactsCount);

            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[ConversionPagevisitColombia], campaignInfo,
                                                            "pagevisit",
                                                            contactsIDs, colombiaPath.NodeID);

            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[ConversionPagevisitAmericasCoffeePoster],
                                                            campaignInfo,
                                                            "pagevisit", contactsIDs, posterPath.NodeID);

            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[ConversionUserregistration], campaignInfo,
                                                            "userregistration", contactsIDs);

            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[ConversionFormsubmissionTryFreeSample],
                                                            campaignInfo,
                                                            "bizformsubmit", contactsIDs, bizFormInfo.FormID);
        }
Пример #3
0
        private void GenerateCampaignObjective(
            string campaignName,
            string conversionName,
            int objectiveValue)
        {
            var campaignInfo = CampaignInfoProvider.GetCampaignInfo(campaignName, _mSite.SiteName);

            if (campaignInfo == null)
            {
                return;
            }

            var campaignConversionInfo = CampaignConversionInfoProvider.GetCampaignConversions()
                                         .WhereEquals("CampaignConversionDisplayName", conversionName)
                                         .WhereEquals("CampaignConversionCampaignID", campaignInfo.CampaignID)
                                         .FirstOrDefault();

            if (campaignConversionInfo == null)
            {
                return;
            }

            CampaignObjectiveInfoProvider.SetCampaignObjectiveInfo(new CampaignObjectiveInfo
            {
                CampaignObjectiveCampaignID           = campaignInfo.CampaignID,
                CampaignObjectiveCampaignConversionID = campaignConversionInfo.CampaignConversionID,
                CampaignObjectiveValue = objectiveValue
            });
        }
Пример #4
0
    /// <summary>
    /// Test if campaign is valid.
    /// </summary>
    public override bool IsValid()
    {
        String value = ValidationHelper.GetString(usCampaign.Value, String.Empty).Trim();

        if (value != String.Empty && value != UniSelector.US_NONE_RECORD.ToString())
        {
            String domain = RequestContext.CurrentDomain;
            if (DataHelper.GetNotEmpty(domain, "") != "")
            {
                string parsedDomain = LicenseKeyInfoProvider.ParseDomainName(domain);
                if (!LicenseKeyInfoProvider.IsFeatureAvailable(parsedDomain, FeatureEnum.CampaignAndConversions))
                {
                    ValidationError = GetString("campaignselector.nolicence");
                    return(false);
                }
            }

            if (!ValidationHelper.IsCodeName(value))
            {
                ValidationError = GetString("campaign.validcodename");
                return(false);
            }

            // If campaign object not found
            CampaignInfo ci = CampaignInfoProvider.GetCampaignInfo(value, SiteInfoProvider.GetSiteName(SiteID));

            // Handle info not found
            if (ci == null)
            {
                if (!CreateOnUnknownName)
                {
                    // Selector is not set to create new campaigns so error out
                    ValidationError = GetString("campaign.validcodename");
                    return(false);
                }

                // Or check permissions ..
                if (!MembershipContext.AuthenticatedUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageCampaigns"))
                {
                    ValidationError = GetString("campaign.notallowedcreate");
                    return(false);
                }

                // .. and try to create a new one.
                ci = new CampaignInfo();
                ci.CampaignName        = value;
                ci.CampaignUTMCode     = value;
                ci.CampaignDisplayName = value;
                ci.CampaignEnabled     = true;
                ci.CampaignSiteID      = SiteID;

                CampaignInfoProvider.SetCampaignInfo(ci);
            }
        }

        return(true);
    }
Пример #5
0
    protected void Page_Init(object sender, EventArgs e)
    {
        // Checks all permissions for web analytics
        CheckAllPermissions();

        CampaignInfo ci = EditedObject as CampaignInfo;

        string campaignName = QueryHelper.GetString("campaignName", String.Empty);

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

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

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

        // Validate SiteID for non administrators
        if (ci != null)
        {
            if (!ci.CheckPermissions(PermissionsEnum.Read, CurrentSiteName, CurrentUser))
            {
                RedirectToAccessDenied(ci.TypeInfo.ModuleName, "Read");
            }
        }

        if (modalDialog)
        {
            if (ci != null)
            {
                PageTitle.TitleText = GetString("analytics.campaign");
            }
            else
            {
                PageTitle.TitleText = GetString("campaign.campaign.new");
            }
        }

        if (ci != null)
        {
            EditedObject = ci;
        }
    }
        /// <summary>
        /// Generates campaign.
        /// </summary>
        /// <param name="campaignData">Campaign data for generating.</param>
        private void GenerateCampaign(CampaignData campaignData)
        {
            var siteName = mSite.SiteName;
            var campaign = CampaignInfoProvider.GetCampaignInfo(campaignData.CampaignName, siteName);

            if (campaign != null)
            {
                return;
            }

            campaign = new CampaignInfo
            {
                CampaignName         = campaignData.CampaignName,
                CampaignDisplayName  = campaignData.CampaignDisplayName,
                CampaignDescription  = campaignData.CampaignDescription,
                CampaignOpenFrom     = campaignData.CampaignOpenFrom,
                CampaignCalculatedTo = campaignData.CampaignOpenFrom,
                CampaignOpenTo       = campaignData.CampaignOpenTo,
                CampaignSiteID       = mSite.SiteID,
                CampaignUTMCode      = campaignData.CampaignUTMCode
            };

            CampaignInfoProvider.SetCampaignInfo(campaign);

            /* Add email to campaign promotion section  */
            CampaignDataGeneratorHelpers.AddNewsletterAsset(campaign, campaignData.CampaignEmailPromotion);
            var issue = ProviderHelper.GetInfoByGuid(PredefinedObjectType.NEWSLETTERISSUE, campaignData.CampaignEmailPromotion, campaign.CampaignSiteID);

            if (issue != null)
            {
                issue.SetValue("IssueStatus", 5);
                issue.SetValue("IssueMailoutTime", campaignData.CampaignOpenFrom);

                issue.Update();
            }

            /* Add page assets to campaign content inventory section */
            foreach (var assetUrlGuid in campaignData.CampaignContentInventory)
            {
                CampaignDataGeneratorHelpers.AddPageAsset(campaign.CampaignID, assetUrlGuid);
            }

            /* Add conversions to campaign report setup section */
            foreach (var conversion in campaignData.CampaignReportSetup)
            {
                CampaignDataGeneratorHelpers.CreateConversion(campaign.CampaignID, conversion);
            }
        }
        private void GenerateActivities(string campaignName, Dictionary <string, IEnumerable <ActivityDataParameters> > conversionHits, int contactsCount)
        {
            var siteName = mSite.SiteName;
            var campaignCafePromotion = CampaignInfoProvider.GetCampaignInfo(campaignName, siteName);

            var pageVisitColombia = CampaignDataGeneratorHelpers.GetDocument(PAGE_PATH_COFFEE_SAMPLES);
            var formFreeSample    = BizFormInfoProvider.GetBizFormInfo(COFFEE_SAMPLE_LIST_FORM_CODE_NAME, mSite.SiteID);

            /* Generate activities for campaign */
            CampaignDataGeneratorHelpers.DeleteOldActivities(campaignCafePromotion.CampaignUTMCode);
            var campaignContactsIDs = new ContactsIDData(mContactFirstNamePrefix, contactsCount);

            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[CONVERSION_PAGEVISIT_COFFEE_SAMPLES], campaignCafePromotion, PredefinedActivityType.PAGE_VISIT, campaignContactsIDs, activityUrl: DocumentURLProvider.GetAbsoluteLiveSiteURL(pageVisitColombia));
            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[CONVERSION_FORMSUBMISSION_COFFEE_SAMPLE_LIST], campaignCafePromotion, PredefinedActivityType.BIZFORM_SUBMIT, campaignContactsIDs, formFreeSample.FormID);
            CampaignDataGeneratorHelpers.GenerateActivities(conversionHits[CONVERSION_PURCHASE], campaignCafePromotion, PredefinedActivityType.PURCHASE, campaignContactsIDs);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        usSelectConversion.SelectionMode = SelectionModeEnum.SingleDropDownList;
        usSite.UserId   = MembershipContext.AuthenticatedUser.UserID;
        usSite.AllowAll = MembershipContext.AuthenticatedUser.IsGlobalAdministrator;

        string campaignName = ValidationHelper.GetString(ucSelectCampaign.Value, String.Empty);

        if (campaignName != ucSelectCampaign.AllRecordValue)
        {
            CampaignInfo ci = CampaignInfoProvider.GetCampaignInfo(campaignName, SiteContext.CurrentSiteName);
            if ((ci != null) && (!ci.CampaignUseAllConversions))
            {
                usSelectConversion.WhereCondition = "ConversionID  IN (SELECT ConversionID FROM Analytics_ConversionCampaign WHERE CampaignID =" + ci.CampaignID + ")";
            }
        }

        if (!URLHelper.IsPostback())
        {
            if (ShowVisitsInGoalSelector)
            {
                drpGoals.Items.Add(new ListItem(GetString("analytics.view"), "view"));
            }

            drpGoals.Items.Add(new ListItem(GetString("conversion.count"), "count"));
            drpGoals.Items.Add(new ListItem(GetString("om.trackconversionvalue"), "value"));
            usSite.SiteID = SiteContext.CurrentSiteID;
        }

        // Filter conversions for selected site  (current is site selector not visible)
        int siteID = SiteContext.CurrentSiteID;

        if (pnlSite.Visible)
        {
            siteID = usSite.SiteID;
        }

        // Filter conversions only if not all sites selected
        if (!pnlSite.Visible || (siteID.ToString() != usSite.AllRecordValue))
        {
            usSelectConversion.WhereCondition = SqlHelper.AddWhereCondition(usSelectConversion.WhereCondition, "ConversionSiteID =" + siteID);
        }

        usSelectConversion.ReloadData(true);
        drpGoals.AutoPostBack = true;
    }
Пример #9
0
        private void GenerateCampaign(CampaignData campaignData)
        {
            var siteName = _mSite.SiteName;

            if (CampaignInfoProvider.GetCampaignInfo(campaignData.CampaignName, siteName) != null)
            {
                return;
            }

            var campaignInfo = new CampaignInfo
            {
                CampaignName         = campaignData.CampaignName,
                CampaignDisplayName  = campaignData.CampaignDisplayName,
                CampaignDescription  = campaignData.CampaignDescription,
                CampaignOpenFrom     = campaignData.CampaignOpenFrom,
                CampaignCalculatedTo = campaignData.CampaignOpenFrom,
                CampaignOpenTo       = campaignData.CampaignOpenTo,
                CampaignSiteID       = _mSite.SiteID,
                CampaignUTMCode      = campaignData.CampaignUtmCode
            };

            CampaignInfoProvider.SetCampaignInfo(campaignInfo);
            CampaignDataGeneratorHelpers.AddNewsletterAsset(campaignInfo, campaignData.CampaignEmailPromotion);
            var infoByGuid = ProviderHelper.GetInfoByGuid("newsletter.issue", campaignData.CampaignEmailPromotion,
                                                          campaignInfo.CampaignSiteID);

            if (infoByGuid != null)
            {
                infoByGuid.SetValue("IssueStatus", 5);
                infoByGuid.SetValue("IssueMailoutTime", campaignData.CampaignOpenFrom);
                infoByGuid.Update();
            }

            foreach (var pagePath in campaignData.CampaignContentInventory)
            {
                CampaignDataGeneratorHelpers.AddPageAsset(campaignInfo.CampaignID, pagePath);
            }

            foreach (var conversionData in campaignData.CampaignReportSetup)
            {
                CampaignDataGeneratorHelpers.CreateConversion(campaignInfo.CampaignID, conversionData);
            }
        }
Пример #10
0
    /// <summary>
    /// Loads data from post info object into the dialog.
    /// </summary>
    /// <param name="post">Facebook post info object.</param>
    private void LoadPostIntoDialog(FacebookPostInfo post)
    {
        if ((post == null) || (post.FacebookPostSiteID != SiteContext.CurrentSiteID))
        {
            pnlPostDetail.Visible = false;
            ShowError(GetString("sm.facebook.posts.msg.postnotexist"));
            return;
        }

        lblPostStatus.Text         = FacebookPostInfoProvider.GetPostPublishStateMessage(post, MembershipContext.AuthenticatedUser, SiteContext.CurrentSite, true);
        lblPeopleReachedValue.Text = ValidationHelper.GetString(post.FacebookPostInsightPeopleReached, String.Empty);
        if (post.FacebookPostCampaignID.HasValue)
        {
            CampaignInfo campaign = CampaignInfoProvider.GetCampaignInfo(post.FacebookPostCampaignID.Value);
            if (campaign != null)
            {
                lblCampaign.Text = HTMLHelper.HTMLEncode(campaign.CampaignDisplayName);
            }
        }
        else
        {
            pnlCampaign.Visible = false;
        }

        lblPostText.Text          = GetPostTextHTML(post.FacebookPostText);
        lblPostLikesValue.Text    = ValidationHelper.GetString(post.FacebookPostInsightLikesFromPage, String.Empty);
        lblPostCommentsValue.Text = ValidationHelper.GetString(post.FacebookPostInsightCommentsFromPage, String.Empty);
        lblPostSharesValue.Text   = ValidationHelper.GetString(post.FacebookPostInsightSharesFromPage, String.Empty);

        lblTotalLikesValue.Text    = ValidationHelper.GetString(post.FacebookPostInsightLikesTotal, String.Empty);
        lblTotalCommentsValue.Text = ValidationHelper.GetString(post.FacebookPostInsightCommentsTotal, String.Empty);

        lblHidePostValue.Text     = ValidationHelper.GetString(post.FacebookPostInsightNegativeHidePost, String.Empty);
        lblHideAllPostsValue.Text = ValidationHelper.GetString(post.FacebookPostInsightNegativeHideAllPosts, String.Empty);
        lblReportSpamValue.Text   = ValidationHelper.GetString(post.FacebookPostInsightNegativeReportSpam, String.Empty);
        lblUnlikePageValue.Text   = ValidationHelper.GetString(post.FacebookPostInsightNegativeUnlikePage, String.Empty);
    }
Пример #11
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);
    }
Пример #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ucDisplayReport = LoadControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport;
        pnlContent.Controls.Add((Control)ucDisplayReport);

        CurrentMaster.PanelContent.CssClass = "";
        UIHelper.AllowUpdateProgress        = false;
        ScriptHelper.RegisterDialogScript(Page);

        // Campaign Info
        int campaignID = QueryHelper.GetInteger("campaignID", 0);

        campaignInfo = CampaignInfoProvider.GetCampaignInfo(campaignID);
        if (campaignInfo == null)
        {
            return;
        }

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

        campaignName = campaignInfo.CampaignName;

        // Text for menu
        mSave       = GetString("general.save");
        mPrint      = GetString("Analytics_Report.Print");
        mDeleteData = GetString("Analytics_Report.ManageData");

        // Images for menu buttons
        imgSave.ImageUrl       = GetImageUrl("CMSModules/CMS_Content/EditMenu/save_small.png");
        imgPrint.ImageUrl      = GetImageUrl("General/printSmall.png");
        imgManageData.ImageUrl = GetImageUrl("CMSModules/CMS_Reporting/managedataSmall.png");

        // Check 'ManageData' permission
        if (CMSContext.CurrentUser.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData"))
        {
            this.lnkDeleteData.OnClientClick = "modalDialog('" +
                                               ResolveUrl("~/CMSModules/Reporting/WebAnalytics/Analytics_ManageData.aspx") +
                                               "?statcodename=singlecampaign;" + campaignName + "', 'AnalyticsManageData', " + AnalyticsHelper.MANAGE_WINDOW_WIDTH + ", " + AnalyticsHelper.MANAGE_WINDOW_HEIGHT + "); return false; ";
            this.lnkDeleteData.Visible = true;
        }

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "myModalDialog",
                                               ScriptHelper.GetScript("function myModalDialog(url, name, width, height) { " +
                                                                      "win = window; " +
                                                                      "var dHeight = height; var dWidth = width; " +
                                                                      "if (( document.all )&&(navigator.appName != 'Opera')) { " +
                                                                      "try { win = wopener.window; } catch (e) {} " +
                                                                      "if ( parseInt(navigator.appVersion.substr(22, 1)) < 7 ) { dWidth += 4; dHeight += 58; }; " +
                                                                      "dialog = win.showModalDialog(url, this, 'dialogWidth:' + dWidth + 'px;dialogHeight:' + dHeight + 'px;resizable:yes;scroll:yes'); " +
                                                                      "} else { " +
                                                                      "oWindow = win.open(url, name, 'height=' + dHeight + ',width=' + dWidth + ',toolbar=no,directories=no,menubar=no,modal=yes,dependent=yes,resizable=yes,scroll=yes,scrollbars=yes'); oWindow.opener = this; oWindow.focus(); } } "));

        ucGraphType.ProcessChartSelectors(false);

        // Enables/disables radio buttons (based on UI elements)
        CurrentUserInfo ui            = CMSContext.CurrentUser;
        bool            checkedButton = false;

        if (!RequestHelper.IsPostBack())
        {
            if (!ui.IsGlobalAdministrator)
            {
                rbCount.Enabled           = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "CampaignConversionCount");
                rbDetail.Enabled          = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "CampaignDetails");
                rbGoalCount.Enabled       = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "goals.numberofconversions");
                rbGoalValue.Enabled       = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "goals.totalvalueofconversions");
                rbGoalView.Enabled        = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "goals.numberofvisitors");
                rbValue.Enabled           = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "campaignsConversionValue");
                rbValuePerVisitor.Enabled = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "valuepervisitor");
                rbViews.Enabled           = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "campaign.overview");

                // Check first enabled button
                foreach (Control ctrl in pnlRadios.Controls)
                {
                    RadioButton rb = ctrl as RadioButton;
                    if (rb != null)
                    {
                        if (rb.Enabled)
                        {
                            rb.Checked    = true;
                            checkedButton = true;
                            break;
                        }
                    }
                }

                // No report avaible -> redirect to access denied
                if (!checkedButton)
                {
                    RedirectToAccessDenied(GetString("campaign.noreportavaible"));
                }
            }
            else
            {
                // Admin check first radio button
                rbViews.Checked = true;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        reportHeaderActions.ActionPerformed += HeaderActions_ActionPerformed;
        ucDisplayReport = this.LoadUserControl("~/CMSModules/Reporting/Controls/DisplayReport.ascx") as IDisplayReport;
        pnlContent.Controls.Add((Control)ucDisplayReport);

        CurrentMaster.PanelContent.CssClass = string.Empty;
        UIHelper.AllowUpdateProgress        = false;
        ScriptHelper.RegisterDialogScript(Page);

        // Campaign Info
        int campaignID = QueryHelper.GetInteger("campaignID", 0);

        campaignInfo = CampaignInfoProvider.GetCampaignInfo(campaignID);
        if (campaignInfo == null)
        {
            return;
        }

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

        campaignName = campaignInfo.CampaignName;

        ScriptHelper.RegisterPrintDialogScript(this);
        ucGraphType.ProcessChartSelectors(false);

        // Enables/disables radio buttons (based on UI elements)
        CurrentUserInfo ui            = CMSContext.CurrentUser;
        bool            checkedButton = false;

        if (!RequestHelper.IsPostBack())
        {
            if (!ui.IsGlobalAdministrator)
            {
                rbCount.Enabled           = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "CampaignConversionCount");
                rbDetail.Enabled          = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "CampaignDetails");
                rbGoalCount.Enabled       = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "goals.numberofconversions");
                rbGoalValue.Enabled       = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "goals.totalvalueofconversions");
                rbGoalView.Enabled        = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "goals.numberofvisitors");
                rbValue.Enabled           = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "campaignsConversionValue");
                rbValuePerVisitor.Enabled = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "valuepervisitor");
                rbViews.Enabled           = ui.IsAuthorizedPerUIElement("cms.WebAnalytics", "campaign.overview");

                // Check first enabled button
                foreach (Control ctrl in pnlRadios.Controls)
                {
                    RadioButton rb = ctrl as RadioButton;
                    if (rb != null)
                    {
                        if (rb.Enabled)
                        {
                            rb.Checked    = true;
                            checkedButton = true;
                            break;
                        }
                    }
                }

                // No report avaible -> redirect to access denied
                if (!checkedButton)
                {
                    RedirectToAccessDenied(GetString("campaign.noreportavaible"));
                }
            }
            else
            {
                // Admin check first radio button
                rbViews.Checked = true;
            }
        }
    }