Ejemplo n.º 1
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        string printDialogUrl = string.Format("{0}?reportname={1}&parameters={2}",
                                              ResolveUrl(PrintPageURL),
                                              ReportName,
                                              AnalyticsHelper.GetQueryStringParameters(ReportParameters));

        string printScript = string.Format("myModalDialog('{0}&UILang={1}&hash={2}','PrintReport {3}',800,700);return false",
                                           printDialogUrl,
                                           CultureInfo.CurrentUICulture.IetfLanguageTag,
                                           QueryHelper.GetHash(printDialogUrl),
                                           ReportName);

        string subscriptionScript = String.Format("modalDialog('{0}?reportname={1}&parameters={2}&interval={3}','Subscription',{4},{5});return false",
                                                  ResolveUrl("~/CMSModules/Reporting/Dialogs/EditSubscription.aspx"),
                                                  ReportName,
                                                  AnalyticsHelper.GetQueryStringParameters(ReportParameters),
                                                  HitsIntervalEnumFunctions.HitsConversionToString(SelectedInterval),
                                                  AnalyticsHelper.SUBSCRIPTION_WINDOW_WIDTH,
                                                  AnalyticsHelper.SUBSCRIPTION_WINDOW_HEIGHT);

        string refreshScript = "function RefreshPage() {" + ControlsHelper.GetPostBackEventReference(this, "") + "};";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshScript", ScriptHelper.GetScript(refreshScript));

        // Register special script for print window
        ScriptHelper.RegisterPrintDialogScript(Page);
        ScriptHelper.RegisterDialogScript(Page);

        // Scripts have to be assigned when ReportName and ReportParameters are available!
        AssignClientScriptToAction(mPrintAction, printScript);
        AssignClientScriptToAction(mSubscriptionAction, subscriptionScript);
    }
    /// <summary>
    /// Generates query string parameters.
    /// </summary>
    public string GetQueryStringParameters()
    {
        if (mUcDisplayReport != null)
        {
            return(AnalyticsHelper.GetQueryStringParameters(mUcDisplayReport.ReportParameters));
        }

        return(String.Empty);
    }
Ejemplo n.º 3
0
 protected override void OnPreRender(EventArgs e)
 {
     DisplayReport(true);
     lnkPrint.OnClientClick = "myModalDialog('" + ResolveUrl("~/CMSModules/Reporting/Tools/Analytics_Print.aspx") + "?reportname=" + ucDisplayReport.ReportName + "&parameters=" + HttpUtility.HtmlEncode(AnalyticsHelper.GetQueryStringParameters(ucDisplayReport.ReportParameters)) + "&UILang=" + System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag + "', 'PrintReport" + ucDisplayReport.ReportName + "', 800, 700); return false;";
     base.OnPreRender(e);
 }
 /// <summary>
 /// Create button print onclick event
 /// </summary>
 public string CreatePrintLink()
 {
     DisplayReport(true);
     return("myModalDialog('" + ResolveUrl("~/CMSModules/Reporting/Tools/Analytics_Print.aspx") + "?reportname=" + ucDisplayReport.ReportName + "&parameters=" + HttpUtility.HtmlEncode(AnalyticsHelper.GetQueryStringParameters(ucDisplayReport.ReportParameters)) + "&UILang=" + System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag + "', 'PrintReport" + ucDisplayReport.ReportName + "', 800, 700); return false;");
 }
Ejemplo n.º 5
0
    protected override void OnPreRender(EventArgs e)
    {
        string dataCodeName = string.IsNullOrEmpty(ManageDataCodeName) ? QueryHelper.GetString("dataCodeName", string.Empty) : ManageDataCodeName;

        string deleteScript = string.Format("modalDialog('{0}?statcodename={1}','AnalyticsManageData',{2},{3});",
                                            ResolveUrl("~/CMSModules/Reporting/WebAnalytics/Analytics_ManageData.aspx"),
                                            dataCodeName,
                                            AnalyticsHelper.MANAGE_WINDOW_WIDTH,
                                            AnalyticsHelper.MANAGE_WINDOW_HEIGHT);

        string printScript = string.Format("myModalDialog('{0}?reportname={1}&parameters={2}&UILang={3}','PrintReport {1}',800,700);return false",
                                           ResolveUrl(PrintPageURL),
                                           ReportName,
                                           AnalyticsHelper.GetQueryStringParameters(ReportParameters),
                                           CultureInfo.CurrentUICulture.IetfLanguageTag);

        string subscriptionScript = String.Format("modalDialog('{0}?reportname={1}&parameters={2}&interval={3}','Subscription',{4},{5});return false",
                                                  ResolveUrl("~/CMSModules/Reporting/Dialogs/EditSubscription.aspx"),
                                                  ReportName,
                                                  AnalyticsHelper.GetQueryStringParameters(ReportParameters),
                                                  HitsIntervalEnumFunctions.HitsConversionToString(SelectedInterval),
                                                  AnalyticsHelper.SUBSCRIPTION_WINDOW_WIDTH,
                                                  AnalyticsHelper.SUBSCRIPTION_WINDOW_HEIGHT);

        string refreshScript = "function RefreshPage() {" + ControlsHelper.GetPostBackEventReference(this, "") + "};";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshScript", ScriptHelper.GetScript(refreshScript));

        // Register special script for print window
        ScriptHelper.RegisterPrintDialogScript(Page);

        headerActions.PanelCssClass = PanelCssClass;

        // Create header actions
        SaveAction save = new SaveAction(Page);

        headerActions.ActionsList.Add(save);

        // Print
        HeaderAction print = new HeaderAction
        {
            ControlType   = HeaderActionTypeEnum.LinkButton,
            Text          = GetString("Analytics_Report.Print"),
            SmallImageUrl = GetImageUrl("General/printSmall.png"),
            OnClientClick = printScript
        };

        headerActions.ActionsList.Add(print);

        CurrentUserInfo cui = CMSContext.CurrentUser;

        // Manage data
        if (cui.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData") && DisplayManageData)
        {
            HeaderAction delete = new HeaderAction
            {
                ControlType   = HeaderActionTypeEnum.LinkButton,
                Text          = GetString("Analytics_Report.ManageData"),
                SmallImageUrl = GetImageUrl("CMSModules/CMS_Reporting/managedataSmall.png"),
                OnClientClick = deleteScript
            };
            headerActions.ActionsList.Add(delete);
        }

        // Report subscription enabled test
        GeneralizedInfo ri = ModuleCommands.ReportingGetReportInfo(ReportName);

        if (ri != null)
        {
            bool enableSubscription = ValidationHelper.GetBoolean(ri.GetValue("ReportEnableSubscription"), true);

            // Show enable subscription only for users with subscribe or modify.
            enableSubscription &= (cui.IsAuthorizedPerResource("cms.reporting", "subscribe") || cui.IsAuthorizedPerResource("cms.reporting", "modify"));

            if (enableSubscription)
            {
                // Subscription
                HeaderAction subscription = new HeaderAction
                {
                    ControlType   = HeaderActionTypeEnum.LinkButton,
                    Text          = GetString("notifications.subscribe"),
                    SmallImageUrl = GetImageUrl("CMSModules/CMS_Reporting/Subscription.png"),
                    OnClientClick = subscriptionScript
                };
                headerActions.ActionsList.Add(subscription);
            }
        }

        base.OnPreRender(e);
    }
Ejemplo n.º 6
0
    protected override void OnPreRender(EventArgs e)
    {
        string dataCodeName = string.IsNullOrEmpty(ManageDataCodeName) ? QueryHelper.GetString("dataCodeName", string.Empty) : ManageDataCodeName;

        string deleteDialogUrl = ResolveUrl("~/CMSModules/Reporting/WebAnalytics/Analytics_ManageData.aspx");

        deleteDialogUrl = URLHelper.AddParameterToUrl(deleteDialogUrl, "statcodename", URLHelper.URLEncode(dataCodeName));
        deleteDialogUrl = URLHelper.AddParameterToUrl(deleteDialogUrl, "hash", QueryHelper.GetHash(deleteDialogUrl));

        string deleteScript = string.Format("modalDialog('{0}','AnalyticsManageData',{1},{2});", deleteDialogUrl, 680, 350);

        string printDialogUrl = string.Format("{0}?reportname={1}&parameters={2}",
                                              ResolveUrl(PrintPageURL),
                                              ReportName,
                                              AnalyticsHelper.GetQueryStringParameters(ReportParameters));

        string printScript = string.Format("myModalDialog('{0}&UILang={1}&hash={2}','PrintReport {3}',800,700);return false",
                                           printDialogUrl,
                                           CultureInfo.CurrentUICulture.IetfLanguageTag,
                                           QueryHelper.GetHash(printDialogUrl),
                                           ReportName);

        string subscriptionScript = String.Format("modalDialog('{0}?reportname={1}&parameters={2}&interval={3}','Subscription',{4},{5});return false",
                                                  ResolveUrl("~/CMSModules/Reporting/Dialogs/EditSubscription.aspx"),
                                                  ReportName,
                                                  AnalyticsHelper.GetQueryStringParameters(ReportParameters),
                                                  HitsIntervalEnumFunctions.HitsConversionToString(SelectedInterval),
                                                  AnalyticsHelper.SUBSCRIPTION_WINDOW_WIDTH,
                                                  AnalyticsHelper.SUBSCRIPTION_WINDOW_HEIGHT);

        string refreshScript = "function RefreshPage() {" + ControlsHelper.GetPostBackEventReference(this, "") + "};";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshScript", ScriptHelper.GetScript(refreshScript));

        // Register special script for print window
        ScriptHelper.RegisterPrintDialogScript(Page);

        ScriptHelper.RegisterDialogScript(Page);

        headerActions.PanelCssClass = PanelCssClass;

        // Create header actions
        SaveAction save = new SaveAction(Page);

        headerActions.ActionsList.Add(save);

        // Print
        HeaderAction print = new HeaderAction
        {
            Text          = GetString("Analytics_Report.Print"),
            OnClientClick = printScript,
            Enabled       = PrintEnabled,
            ButtonStyle   = ButtonStyle.Default,
        };

        headerActions.ActionsList.Add(print);

        var cui = MembershipContext.AuthenticatedUser;

        // Manage data
        if (cui.IsAuthorizedPerResource("CMS.WebAnalytics", "ManageData") && DisplayManageData)
        {
            HeaderAction delete = new HeaderAction
            {
                Text          = GetString("Analytics_Report.ManageData"),
                OnClientClick = deleteScript,
                ButtonStyle   = ButtonStyle.Default,
            };
            headerActions.ActionsList.Add(delete);
        }

        // Report subscription enabled test
        GeneralizedInfo ri = BaseAbstractInfoProvider.GetInfoByName(PredefinedObjectType.REPORT, ReportName);

        if (ri != null)
        {
            bool enableSubscription = ValidationHelper.GetBoolean(ri.GetValue("ReportEnableSubscription"), true);

            // Show enable subscription only for users with subscribe or modify.
            enableSubscription &= (cui.IsAuthorizedPerResource("cms.reporting", "subscribe") || cui.IsAuthorizedPerResource("cms.reporting", "modify"));

            if (enableSubscription)
            {
                // Subscription
                HeaderAction subscription = new HeaderAction
                {
                    Text          = GetString("notifications.subscribe"),
                    OnClientClick = subscriptionScript,
                    ButtonStyle   = ButtonStyle.Default,
                };
                headerActions.ActionsList.Add(subscription);
            }
        }

        base.OnPreRender(e);
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Displays the given report
    /// </summary>
    private void DisplayReport()
    {
        // If report was already displayed .. return
        if (reportDisplayed)
        {
            return;
        }

        ucGraphType.ProcessChartSelectors(false);

        // Prepare report parameters
        DataTable dtp = new DataTable();

        // In case of hidden datetime -> for save purpose pass from (to) as now to query parameter
        DateTime from = ((ucGraphType.From == DateTimeHelper.ZERO_TIME) && !pnlHeader.Visible) ? DateTime.Now : ucGraphType.From;
        DateTime to   = ((ucGraphType.To == DateTimeHelper.ZERO_TIME) && !pnlHeader.Visible) ? DateTime.Now : ucGraphType.To;

        dtp.Columns.Add("FromDate", typeof(DateTime));
        dtp.Columns.Add("ToDate", typeof(DateTime));
        dtp.Columns.Add("CodeName", typeof(string));
        dtp.Columns.Add("CampaignName", typeof(string));
        dtp.Columns.Add("ConversionName", typeof(string));
        dtp.Columns.Add("Goal", typeof(string));
        dtp.Columns.Add("SiteID", typeof(int));

        object[] parameters = new object[7];

        parameters[0] = (allowNoTimeSelection && from == DateTimeHelper.ZERO_TIME) ? (DateTime?)null : from;
        parameters[1] = (allowNoTimeSelection && to == DateTimeHelper.ZERO_TIME) ? (DateTime?)null : to;
        parameters[2] = dataCodeName;
        parameters[3] = "";
        parameters[4] = "";
        parameters[5] = ucReportHeader.SelectedGoal;
        parameters[6] = ucReportHeader.SelectedSiteID;

        // Get report name from query
        String reportName = ucGraphType.GetReportName(reportCodeNames);

        // Filter campaign if any campaign selected
        string campaignName = ValidationHelper.GetString(ucReportHeader.SelectedCampaign, String.Empty);

        if ((campaignName != ucReportHeader.AllRecordValue) && (!String.IsNullOrEmpty(campaignName)))
        {
            parameters[3] = campaignName;
        }

        // Filter conversion
        String conversionName = ValidationHelper.GetString(ucReportHeader.SelectedConversion, String.Empty);

        if ((conversionName != ucReportHeader.AllRecordValue) && (!String.IsNullOrEmpty(conversionName)))
        {
            parameters[4] = conversionName;
        }

        dtp.Rows.Add(parameters);
        dtp.AcceptChanges();

        ucDisplayReport.ReportName = reportName;

        // Set display report
        if (!ucDisplayReport.IsReportLoaded())
        {
            lblErrorConversions.Visible = true;
            lblErrorConversions.Text    = String.Format(GetString("Analytics_Report.ReportDoesnotExist"), reportName);
        }
        else
        {
            ucDisplayReport.LoadFormParameters = false;
            ucDisplayReport.DisplayFilter      = false;
            ucDisplayReport.ReportParameters   = dtp.Rows[0];
            ucDisplayReport.GraphImageWidth    = 100;
            ucDisplayReport.IgnoreWasInit      = true;
            ucDisplayReport.ReloadData(true);
            ucDisplayReport.UseExternalReload    = true;
            ucDisplayReport.UseProgressIndicator = true;
        }

        // Create onclick event for print button
        this.lnkPrint.OnClientClick = "myModalDialog('" + ResolveUrl("~/CMSModules/Reporting/Tools/Analytics_Print.aspx") + "?reportname=" + reportName + "&parameters=" + HttpUtility.HtmlEncode(AnalyticsHelper.GetQueryStringParameters(ucDisplayReport.ReportParameters)) + "&UILang=" + System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag + "', 'PrintReport" + reportName + "', 800, 700); return false;";

        // Mark as report displayed
        reportDisplayed = true;
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Displays the given report
    /// </summary>
    private void DisplayReport(bool reloadInnerReport)
    {
        // If report was already displayed .. return
        if (reportDisplayed)
        {
            return;
        }

        ucGraphType.ProcessChartSelectors(false);

        // Prepare report parameters
        DataTable dtp = new DataTable();

        dtp.Columns.Add("FromDate", typeof(DateTime));
        dtp.Columns.Add("ToDate", typeof(DateTime));
        dtp.Columns.Add("CampaignName", typeof(string));

        object[] parameters = new object[3];

        parameters[0] = ucGraphType.From;
        parameters[1] = ucGraphType.To;
        parameters[2] = "";

        // Get report name from query
        string reportName = ucGraphType.GetReportName(QueryHelper.GetString("reportCodeName", String.Empty));

        if (String.Compare(Convert.ToString(ucSelectCampaign.Value), "-1", true) != 0)
        {
            parameters[2] = ucSelectCampaign.Value;
        }
        else
        {
            reportName = "all" + reportName;
        }

        dtp.Rows.Add(parameters);
        dtp.AcceptChanges();

        ucDisplayReport.ReportName = reportName;

        // Set display report
        if (!ucDisplayReport.IsReportLoaded())
        {
            lblError.Visible = true;
            lblError.Text    = String.Format(GetString("Analytics_Report.ReportDoesnotExist"), reportName);
        }
        else
        {
            ucDisplayReport.LoadFormParameters   = false;
            ucDisplayReport.DisplayFilter        = false;
            ucDisplayReport.ReportParameters     = dtp.Rows[0];
            ucDisplayReport.GraphImageWidth      = 100;
            ucDisplayReport.IgnoreWasInit        = true;
            ucDisplayReport.UseExternalReload    = true;
            ucDisplayReport.UseProgressIndicator = true;
            if (reloadInnerReport)
            {
                ucDisplayReport.ReloadData(true);
            }
        }

        // Create onclick event for print button
        this.lnkPrint.OnClientClick = "myModalDialog('" + ResolveUrl("~/CMSModules/Reporting/Tools/Analytics_Print.aspx") + "?reportname=" + reportName + "&parameters=" + HttpUtility.HtmlEncode(AnalyticsHelper.GetQueryStringParameters(ucDisplayReport.ReportParameters)) + "&UILang=" + System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag + "', 'PrintReport" + reportName + "', 800, 700); return false;";

        if (reloadInnerReport)
        {
            // Mark as report displayed
            reportDisplayed = true;
        }
    }
Ejemplo n.º 9
0
    /// <summary>
    /// On PreRender override.
    /// </summary>
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);

        this.btnPrint.OnClientClick = "myModalDialog('Report_Print.aspx?reportid=" + reportId.ToString() + "&parameters=" + HttpUtility.HtmlEncode(AnalyticsHelper.GetQueryStringParameters(DisplayReport1.ReportParameters)) + "&UILang=" + System.Globalization.CultureInfo.CurrentUICulture.IetfLanguageTag + "', 'PrintReport" + DisplayReport1.ReportName + "', 650, 700); return false;";
    }