Example #1
0
    /// <summary>
    /// Gets and bulk updates report categories. Called when the "Get and bulk update categories" button is pressed.
    /// Expects the CreateReportCategory method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateReportCategories()
    {
        // Prepare the parameters
        string where = "CategoryCodeName LIKE N'MyNewCategory%'";

        // Get the data
        DataSet categories = ReportCategoryInfoProvider.GetCategories(where, null);

        if (!DataHelper.DataSourceIsEmpty(categories))
        {
            // Loop through the individual items
            foreach (DataRow categoryDr in categories.Tables[0].Rows)
            {
                // Create object from DataRow
                ReportCategoryInfo modifyCategory = new ReportCategoryInfo(categoryDr);

                // Update the properties
                modifyCategory.CategoryDisplayName = modifyCategory.CategoryDisplayName.ToUpper();

                // Save the changes
                ReportCategoryInfoProvider.SetReportCategoryInfo(modifyCategory);
            }

            return(true);
        }

        return(false);
    }
    /// <summary>
    /// Sets data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // check 'modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }

        string errorMessage = new Validator().NotEmpty(txtCategoryCodeName.Text, GetString("ReportCategory_Edit.ErrorCodeName")).NotEmpty(txtCategoryDisplayName.Text, GetString("ReportCategory_Edit.ErrorDisplayName")).Result;

        //Test codename if root is not edited
        if ((!mIsRoot) && (errorMessage == "") && (!ValidationHelper.IsCodeName(txtCategoryCodeName.Text.Trim())))
        {
            errorMessage = GetString("ReportCategory_Edit.InvalidCodeName");
        }

        if (errorMessage == "")
        {
            ReportCategoryInfo rcCodeNameCheck = ReportCategoryInfoProvider.GetReportCategoryInfo(txtCategoryCodeName.Text.Trim());
            //check reportCategory codename
            if ((rcCodeNameCheck == null) || (rcCodeNameCheck.CategoryID == mCategoryID))
            {
                string             script            = string.Empty;
                ReportCategoryInfo reportCategoryObj = ReportCategoryInfoProvider.GetReportCategoryInfo(mCategoryID);

                // if reportCategory doesnt already exist, create new one
                if (reportCategoryObj == null)
                {
                    reportCategoryObj = new ReportCategoryInfo();
                }

                if (reportCategoryObj.CategoryDisplayName != txtCategoryDisplayName.Text.Trim())
                {
                    // Refresh the breadcrumb
                    ScriptHelper.RefreshTabHeader(Page, GetString("general.general"));
                }

                reportCategoryObj.CategoryDisplayName = txtCategoryDisplayName.Text.Trim();
                reportCategoryObj.CategoryCodeName    = txtCategoryCodeName.Text.Trim();

                ReportCategoryInfoProvider.SetReportCategoryInfo(reportCategoryObj);

                script += @"if (parent.parent.frames['reportcategorytree']) {
                    parent.parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?categoryid=" + reportCategoryObj.CategoryID + @"';
                }";

                ltlScript.Text = ScriptHelper.GetScript(script);
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = GetString("ReportCategory_Edit.ReportCategoryAlreadyExists");
            }
        }
        else
        {
            lblError.Visible = true;
            lblError.Text    = errorMessage;
        }
    }
Example #3
0
    /// <summary>
    /// Creates report. Called when the "Create report" button is pressed.
    /// </summary>
    private bool CreateReport()
    {
        // Get the report category
        ReportCategoryInfo category = ReportCategoryInfoProvider.GetReportCategoryInfo("MyNewCategory");

        if (category != null)
        {
            // Create new report object
            ReportInfo newReport = new ReportInfo();

            // Set the properties
            newReport.ReportDisplayName = "My new report";
            newReport.ReportName        = "MyNewReport";
            newReport.ReportCategoryID  = category.CategoryID;
            newReport.ReportAccess      = ReportAccessEnum.All;
            newReport.ReportLayout      = "";
            newReport.ReportParameters  = "";

            // Save the report
            ReportInfoProvider.SetReportInfo(newReport);

            return(true);
        }
        return(false);
    }
Example #4
0
    /// <summary>
    /// Initializes Master Page.
    /// </summary>
    protected void InitializeMasterPage()
    {
        //Load category name
        ReportCategoryInfo rci          = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryId);
        string             categoryName = GetString("Report_New.ReportList");

        if (rci != null)
        {
            categoryName = rci.CategoryDisplayName;
        }

        // Initializes page title label
        string[,] tabs = new string[3, 4];
        tabs[0, 0]     = GetString("tools.ui.reporting");
        tabs[0, 1]     = ResolveUrl("~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx");
        tabs[0, 2]     = "";
        tabs[0, 3]     = "if (parent.frames['reportcategorytree']) { parent.frames['reportcategorytree'].location.href = 'reportcategory_tree.aspx'}";

        tabs[1, 0] = categoryName;
        tabs[1, 1] = "~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx?categoryid=" + categoryId;
        tabs[1, 2] = "";

        tabs[2, 0] = GetString("Report_New.NewReport");
        tabs[2, 1] = "";
        tabs[2, 2] = "";

        CurrentMaster.Title.Breadcrumbs = tabs;

        // Initialize title and help
        Title = "Report new";
        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "new_report";
        CurrentMaster.Title.TitleText     = GetString("report_new.newreport");
        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/Reporting_report/new.png");
    }
Example #5
0
    /// <summary>
    /// Handles delete action.
    /// </summary>
    /// <param name="eventArgument">Objecttype(report or reportcategory);objectid</param>
    public void RaisePostBackEvent(string eventArgument)
    {
        string[] values = eventArgument.Split(';');
        if ((values != null) && (values.Length == 3))
        {
            int id                 = ValidationHelper.GetInteger(values[1], 0);
            int parentId           = ValidationHelper.GetInteger(values[2], 0);
            ReportCategoryInfo rci = ReportCategoryInfoProvider.GetReportCategoryInfo(parentId);

            //Test permission
            if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
            {
                String denyScript = @"var redirected = false;if (!redirected) {if ((window.parent != null) && (window.parent.frames['reportcategorytree'] != null)) {
                parent.frames['reportedit'].location = '" + ResolveUrl(AccessDeniedPage) + @"?resource=cms.reporting&permission=Modify';redirected = true;         
                }}";
                if (rci != null)
                {
                    denyScript = SelectAtferLoad(rci.CategoryPath + "/", id, values[0], parentId, false) + denyScript;
                }
                ltlScript.Text += ScriptHelper.GetScript(denyScript);
                return;
            }

            string script = String.Empty;

            switch (values[0])
            {
            case "report":
                ReportInfoProvider.DeleteReportInfo(id);
                break;

            case "reportcategory":
                try
                {
                    ReportCategoryInfoProvider.DeleteReportCategoryInfo(id);
                }
                catch (Exception ex)
                {
                    // Make alert with exception message, most probable cause is deleting category with subcategories
                    script = String.Format("alert('{0}');\n", ex.Message);

                    // Current node stays selected
                    parentId = id;
                }
                break;
            }

            // Select parent node after delete
            if (rci != null)
            {
                script          = SelectAtferLoad(rci.CategoryPath + "/", parentId, "reportcategory", rci.CategoryParentID, true) + script;
                ltlScript.Text += ScriptHelper.GetScript(script);
            }

            treeElem.ReloadData();
        }
    }
Example #6
0
    /// <summary>
    /// Deletes report category. Called when the "Delete category" button is pressed.
    /// Expects the CreateReportCategory method to be run first.
    /// </summary>
    private bool DeleteReportCategory()
    {
        // Get the report category
        ReportCategoryInfo deleteCategory = ReportCategoryInfoProvider.GetReportCategoryInfo("MyNewCategory");

        // Delete the report category
        ReportCategoryInfoProvider.DeleteReportCategoryInfo(deleteCategory);

        return(deleteCategory != null);
    }
Example #7
0
    /// <summary>
    /// Sets data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // check 'Modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }

        string errorMessage = new Validator().NotEmpty(txtCategoryCodeName.Text, GetString("ReportCategory_Edit.ErrorCodeName")).NotEmpty(txtCategoryDisplayName.Text, GetString("ReportCategory_Edit.ErrorDisplayName")).Result;

        if ((errorMessage == "") && (!ValidationHelper.IsCodeName(txtCategoryCodeName.Text.Trim())))
        {
            errorMessage = GetString("ReportCategory_Edit.InvalidCodeName");
        }

        if (errorMessage == "")
        {
            ReportCategoryInfo rcCodeNameCheck = ReportCategoryInfoProvider.GetReportCategoryInfo(txtCategoryCodeName.Text.Trim());
            //check reportCategory codename
            if ((rcCodeNameCheck == null) || (rcCodeNameCheck.CategoryID == categoryID))
            {
                ReportCategoryInfo reportCategoryObj = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryID);
                // if reportCategory doesnt already exist, create new one
                if (reportCategoryObj == null)
                {
                    reportCategoryObj = new ReportCategoryInfo();
                }

                reportCategoryObj.CategoryDisplayName = txtCategoryDisplayName.Text.Trim();
                reportCategoryObj.CategoryCodeName    = txtCategoryCodeName.Text.Trim();
                reportCategoryObj.CategoryParentID    = parentCategoryID;

                ReportCategoryInfoProvider.SetReportCategoryInfo(reportCategoryObj);

                ltlScript.Text += "<script type=\"text/javascript\">";
                ltlScript.Text += @"if (parent.frames['reportcategorytree']) {
                parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?categoryid=" + reportCategoryObj.CategoryID + @"';
                    }
                 this.location.href = 'ReportCategory_edit_Frameset.aspx?CategoryID=" + Convert.ToString(reportCategoryObj.CategoryID) + @"&saved=1';
                </script>";
            }
            else
            {
                lblError.Visible = true;
                lblError.Text    = GetString("ReportCategory_Edit.ReportCategoryAlreadyExists");
            }
        }
        else
        {
            lblError.Visible = true;
            lblError.Text    = errorMessage;
        }
    }
Example #8
0
    /// <summary>
    /// Creates child controls.
    /// </summary>
    protected override void CreateChildControls()
    {
        if (StopProcessing)
        {
            return;
        }
        drpCategories.AutoPostBack = UseAutoPostBack;
        drpCategories.Items.Clear();

        //// Get categories
        DataSet ds = ReportCategoryInfoProvider.GetCategories(String.Empty, String.Empty);

        if (!DataHelper.DataSourceIsEmpty(ds))
        {
            int counter = 0;

            // Make special collection for "tree mapping"
            Dictionary <int, SortedList <string, object[]> > categories = new Dictionary <int, SortedList <string, object[]> >();

            // Fill collection from dataset
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                int    parentId = ValidationHelper.GetInteger(dr["CategoryParentID"], 0);
                int    id       = ValidationHelper.GetInteger(dr["CategoryID"], 0);
                string name     = ResHelper.LocalizeString(ValidationHelper.GetString(dr["CategoryDisplayName"], String.Empty));

                SortedList <string, object[]> list;
                categories.TryGetValue(parentId, out list);

                try
                {
                    // Sub categories list not created yet
                    if (list == null)
                    {
                        list = new SortedList <string, object[]>();
                        categories.Add(parentId, list);
                    }

                    list.Add(name + "_" + counter, new object[2] {
                        id, name
                    });
                }
                catch
                {
                }
                counter++;
            }

            // Start filling the dropdown from the root(parentId = 0)
            AddSubCategories(categories, 0, 0);
        }
    }
Example #9
0
    /// <summary>
    /// Creates report category. Called when the "Create category" button is pressed.
    /// </summary>
    private bool CreateReportCategory()
    {
        // Create new report category object
        ReportCategoryInfo newCategory = new ReportCategoryInfo();

        // Set the properties
        newCategory.CategoryDisplayName = "My new category";
        newCategory.CategoryCodeName    = "MyNewCategory";

        // Save the report category
        ReportCategoryInfoProvider.SetReportCategoryInfo(newCategory);

        return(true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Title = "Report category edit";

        rfvCodeName.ErrorMessage    = GetString("ReportCategory_Edit.ErrorCodeName");
        rfvDisplayName.ErrorMessage = GetString("ReportCategory_Edit.ErrorDisplayName");

        // control initializations
        lblCategoryDisplayName.Text = GetString("ReportCategory_Edit.CategoryDisplayNameLabel");
        lblCategoryCodeName.Text    = GetString("ReportCategory_Edit.CategoryCodeNameLabel");

        btnOk.Text = GetString("General.OK");

        string currentReportCategory = GetString("ReportCategory_Edit.NewItemCaption");

        // get reportCategory id from querystring
        mCategoryID = ValidationHelper.GetInteger(Request.QueryString["CategoryID"], 0);
        if (mCategoryID > 0)
        {
            ReportCategoryInfo reportCategoryObj = ReportCategoryInfoProvider.GetReportCategoryInfo(mCategoryID);
            if (reportCategoryObj != null)
            {
                if (reportCategoryObj.CategoryCodeName == "/")
                {
                    plcCategoryName.Visible = false;
                    mIsRoot = true;
                }

                currentReportCategory = reportCategoryObj.CategoryDisplayName;

                // fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(reportCategoryObj);

                    // show that the reportCategory was created or updated successfully
                    if (ValidationHelper.GetString(Request.QueryString["saved"], "") == "1")
                    {
                        lblInfo.Visible = true;
                        lblInfo.Text    = GetString("General.ChangesSaved");
                    }
                }
            }
        }
    }
    private bool IsConversionReport(string reportName)
    {
        var report = ReportInfoProvider.GetReportInfo(reportName);

        if (report != null)
        {
            var category = ReportCategoryInfoProvider.GetReportCategoryInfo(report.ReportCategoryID);
            if (category != null)
            {
                if (!category.CategoryPath.StartsWith("/WebAnalytics/Conversion", StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
    private bool IsBannerManagementReport(string reportCodeName)
    {
        var report = ReportInfoProvider.GetReportInfo(reportCodeName);

        if (report != null)
        {
            var category = ReportCategoryInfoProvider.GetReportCategoryInfo(report.ReportCategoryID);
            if (category != null)
            {
                if (!category.CategoryPath.StartsWith("/BannerManagement", StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
Example #13
0
    /// <summary>
    /// Gets and updates report category. Called when the "Get and update category" button is pressed.
    /// Expects the CreateReportCategory method to be run first.
    /// </summary>
    private bool GetAndUpdateReportCategory()
    {
        // Get the report category
        ReportCategoryInfo updateCategory = ReportCategoryInfoProvider.GetReportCategoryInfo("MyNewCategory");

        if (updateCategory != null)
        {
            // Update the properties
            updateCategory.CategoryDisplayName = updateCategory.CategoryDisplayName.ToLower();

            // Save the changes
            ReportCategoryInfoProvider.SetReportCategoryInfo(updateCategory);

            return(true);
        }

        return(false);
    }
Example #14
0
    /// <summary>
    /// Initializes master page.
    /// </summary>
    protected void InitializeMasterPage(string currentReport, int categoryID)
    {
        // Load category name
        ReportCategoryInfo rci          = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryID);
        string             categoryName = GetString("Report_Header.ReportList");

        if (rci != null)
        {
            categoryName = rci.CategoryDisplayName;
        }

        InitBreadcrumbs(3);
        SetBreadcrumb(0, GetString("tools.ui.reporting"), ResolveUrl("~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx"), "_parent", "if (parent.parent.frames['reportcategorytree']) { parent.parent.frames['reportcategorytree'].location.href = 'reportcategory_tree.aspx'}");
        SetBreadcrumb(1, categoryName, ResolveUrl("~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx?CategoryID=" + categoryID), "_parent", "if (parent.parent.frames['reportcategorytree']) { parent.parent.frames['reportcategorytree'].location.href = 'reportcategory_tree.aspx?categoryID=" + categoryID + "'}");
        SetBreadcrumb(2, currentReport, null, null, null);

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "SetSavedTab", ScriptHelper.GetScript("function SetSavedTab() { SelTab(3,'',''); SetHelpTopic('helpTopic', 'saved_reports_tab'); } \n"));
    }
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "category_edit_list";
        int categoryID = QueryHelper.GetInteger("CategoryID", 0);

        // Initializes page title control
        string[,] tabs = new string[3, 4];
        tabs[0, 0]     = GetString("reporting.reports");
        tabs[0, 1]     = "SetHelpTopic('helpTopic', 'category_edit_list');";
        tabs[0, 2]     = ResolveUrl("Report_List.aspx?CategoryID=" + categoryID);
        tabs[1, 0]     = GetString("general.general");
        tabs[1, 1]     = "SetHelpTopic('helpTopic', 'category_edit');";
        tabs[1, 2]     = ResolveUrl("ReportCategory_general.aspx?CategoryID=" + categoryID);
        tabs[2, 0]     = GetString("macros.macrorules");
        tabs[2, 1]     = "SetHelpTopic('helpTopic', 'macros_macrorule_list');";
        tabs[2, 2]     = ResolveUrl("~/CMSModules/Macros/Pages/Tools/MacroRule/List.aspx?module=cms.reporting&displaytitle=false");

        CurrentMaster.Tabs.Tabs      = tabs;
        CurrentMaster.Tabs.UrlTarget = "categoryContent";

        // Load categoryID
        ReportCategoryInfo rci          = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryID);
        string             categoryName = String.Empty;

        if (rci != null)
        {
            categoryName = rci.CategoryDisplayName;
        }

        string[,] bread = new string[2, 4];

        bread[0, 0] = GetString("tools.ui.reporting");
        bread[0, 1] = ResolveUrl("~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx");
        bread[0, 2] = "_parent";
        bread[0, 3] = "if (parent.parent.frames['reportcategorytree']) { parent.parent.frames['reportcategorytree'].location.href = 'reportcategory_tree.aspx'}";

        bread[1, 0] = categoryName;
        bread[1, 1] = "";
        bread[1, 2] = "";

        CurrentMaster.Title.Breadcrumbs = bread;
    }
Example #16
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        categoryId = QueryHelper.GetInteger("categoryid", 0);

        // Register script for refresh tree after delete/destroy
        string script = @"function RefreshAdditionalContent(){
                            if (parent.parent.frames['reportcategorytree'])
                            {
                                parent.parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?categoryid=" + categoryId + @"';
                            }
                        }";

        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "RefreshTree", ScriptHelper.GetScript(script));

        // Used for clone and delete calls
        int  reportID = QueryHelper.GetInteger("reportid", 0);
        bool clone    = QueryHelper.GetBoolean("clone", false);

        if (clone)
        {
            Clone(reportID);
        }

        ReportCategoryInfo info = new ReportCategoryInfo();

        info = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryId);
        if (info != null)
        {
            string categoryPath = info.CategoryPath;
            // Add the slash character at the end of the categoryPath
            if (!categoryPath.EndsWith("/"))
            {
                categoryPath += "/";
            }
            UniGrid.WhereCondition = "ObjectPath LIKE '" + SqlHelperClass.GetSafeQueryString(categoryPath, false) + "%' AND ObjectType = 'Report'";
        }

        UniGrid.OnAction    += uniGrid_OnAction;
        UniGrid.ZeroRowsText = GetString("general.nodatafound");

        InitializeMasterPage();
    }
Example #17
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        string currentReportCategory = "";

        if (QueryHelper.Contains("categoryid"))
        {
            categoryId = QueryHelper.GetInteger("categoryid", 0);
            ReportCategoryInfo category = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryId);
            if (category != null)
            {
                currentReportCategory = category.CategoryDisplayName;
            }
        }

        if (!RequestHelper.IsPostBack())
        {
            InitalizeMenu();
        }

        this.InitializeMasterPage(currentReportCategory);
    }
Example #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        rfvCodeName.ErrorMessage    = GetString("ReportCategory_Edit.ErrorCodeName");
        rfvDisplayName.ErrorMessage = GetString("ReportCategory_Edit.ErrorDisplayName");

        // control initializations
        lblCategoryDisplayName.Text = GetString("ReportCategory_Edit.CategoryDisplayNameLabel");
        lblCategoryCodeName.Text    = GetString("ReportCategory_Edit.CategoryCodeNameLabel");

        btnOk.Text = GetString("General.OK");

        string currentReportCategory = GetString("ReportCategory_Edit.NewItemCaption");

        // get reportCategory id from querystring
        categoryID       = ValidationHelper.GetInteger(Request.QueryString["CategoryID"], 0);
        parentCategoryID = ValidationHelper.GetInteger(Request.QueryString["parentCategoryID"], 0);

        if (categoryID > 0)
        {
            ReportCategoryInfo reportCategoryObj = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryID);
            if (reportCategoryObj != null)
            {
                currentReportCategory = reportCategoryObj.CategoryDisplayName;

                // fill editing form
                if (!RequestHelper.IsPostBack())
                {
                    LoadData(reportCategoryObj);

                    // show that the reportCategory was created or updated successfully
                    if ((ValidationHelper.GetString(Request.QueryString["saved"], "") == "1") && !URLHelper.IsPostback())
                    {
                        ShowChangesSaved();
                    }
                }
            }
        }

        InitializeMasterPage(currentReportCategory, parentCategoryID);
    }
    /// <summary>
    /// Used for maxnodes in collapsed node.
    /// </summary>
    private TreeNode treeElem_OnNodeCreated(DataRow itemData, TreeNode defaultNode)
    {
        if (UseMaxNodeLimit && (MaxTreeNodes > 0))
        {
            //Get parentID from data row
            int    parentID   = ValidationHelper.GetInteger(itemData.ItemArray[4], 0);
            string objectType = ValidationHelper.GetString(itemData.ItemArray[7], String.Empty);

            //Dont use maxnodes limitation for categories
            if (objectType.ToLowerCSafe() == "reportcategory")
            {
                return(defaultNode);
            }

            //Increment index count in collapsing
            mIndex++;
            if (mIndex == MaxTreeNodes)
            {
                //Load parentid
                int parentParentID = 0;
                ReportCategoryInfo parentParent = ReportCategoryInfoProvider.GetReportCategoryInfo(parentID);
                if (parentParent != null)
                {
                    parentParentID = parentParent.CategoryParentID;
                }

                TreeNode node = new TreeNode();
                node.Text = "<span class=\"ContentTreeItem\" onclick=\"SelectReportNode(" + parentID + " ,'reportcategory'," + parentParentID + ",true ); return false;\"><span class=\"Name\">" + GetString("general.seelisting") + "</span></span>";
                return(node);
            }
            if (mIndex > MaxTreeNodes)
            {
                return(null);
            }
        }
        return(defaultNode);
    }
Example #20
0
    /// <summary>
    /// Initializes Master Page.
    /// </summary>
    protected void InitializeMasterPage(string currentReportCategory, int parentCategoryID)
    {
        // Initialize help and title
        Title = "Report category edit";
        CurrentMaster.Title.HelpName      = "helpTopic";
        CurrentMaster.Title.HelpTopicName = "category_edit";

        //Load category name
        ReportCategoryInfo rci          = ReportCategoryInfoProvider.GetReportCategoryInfo(parentCategoryID);
        string             categoryName = GetString("reporting.reports");

        if (rci != null)
        {
            categoryName = rci.CategoryDisplayName;
        }

        // initializes breadcrumbs
        string[,] tabs = new string[3, 4];

        tabs[0, 0] = GetString("tools.ui.reporting");
        tabs[0, 1] = ResolveUrl("~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx");
        tabs[0, 2] = "";
        tabs[0, 3] = "if (parent.frames['reportcategorytree']) { parent.frames['reportcategorytree'].location.href = 'reportcategory_tree.aspx'}";

        tabs[1, 0] = categoryName;
        tabs[1, 1] = "~/CMSModules/Reporting/Tools/ReportCategory_Edit_Frameset.aspx?categoryID=" + parentCategoryID;
        tabs[1, 2] = "";

        tabs[2, 0] = currentReportCategory;
        tabs[2, 1] = "";
        tabs[2, 2] = "";

        CurrentMaster.Title.Breadcrumbs = tabs;

        CurrentMaster.Title.TitleText  = GetString("ReportCategory_Edit.HeaderCaption");
        CurrentMaster.Title.TitleImage = GetImageUrl("Objects/Reporting_ReportCategory/new.png");
    }
Example #21
0
    /// <summary>
    /// Sets data to database.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // Check 'Modify' permission
        if (!CMSContext.CurrentUser.IsAuthorizedPerResource("cms.reporting", "Modify"))
        {
            RedirectToAccessDenied("cms.reporting", "Modify");
        }


        string errorMessage = new Validator().NotEmpty(txtReportDisplayName.Text.Trim(), rfvReportDisplayName.ErrorMessage).NotEmpty(txtReportName.Text.Trim(), rfvReportName.ErrorMessage).Result;

        if ((errorMessage == "") && (!ValidationHelper.IsCodeName(txtReportName.Text.Trim())))
        {
            errorMessage = GetString("general.invalidcodename");
        }

        if (ReportCategoryInfoProvider.GetReportCategoryInfo(categoryId) == null)
        {
            errorMessage = GetString("Report_General.InvalidReportCategory");
        }

        ReportAccessEnum reportAccess = ReportAccessEnum.All;

        if (!chkReportAccess.Checked)
        {
            reportAccess = ReportAccessEnum.Authenticated;
        }

        if (errorMessage == "")
        {
            //if report with given name already exists show error message
            if (ReportInfoProvider.GetReportInfo(txtReportName.Text.Trim()) != null)
            {
                ShowError(GetString("Report_New.ReportAlreadyExists"));
                return;
            }

            ReportInfo ri = new ReportInfo();

            ri.ReportDisplayName        = txtReportDisplayName.Text.Trim();
            ri.ReportName               = txtReportName.Text.Trim();
            ri.ReportCategoryID         = categoryId;
            ri.ReportLayout             = "";
            ri.ReportParameters         = "";
            ri.ReportAccess             = reportAccess;
            ri.ReportEnableSubscription = chkEnableSubscription.Checked;

            ReportInfoProvider.SetReportInfo(ri);

            ltlScript.Text += "<script type=\"text/javascript\">";
            ltlScript.Text += @"if (parent.frames['reportcategorytree'])
                                {
                                    parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?reportid=" + ri.ReportID + @"';
                                }
                                if (parent.parent.frames['reportcategorytree'])
                                {
                                    parent.parent.frames['reportcategorytree'].location.href = 'ReportCategory_tree.aspx?reportid=" + ri.ReportID + @"';
                                }
                 this.location.href = 'Report_Edit.aspx?reportId=" + Convert.ToString(ri.ReportID) + @"&saved=1&categoryID=" + categoryId + @"'
                </script>";
        }
        else
        {
            ShowError(errorMessage);
        }
    }
Example #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.RegisterExportScript();

        //// Images
        imgNewCategory.ImageUrl  = GetImageUrl("Objects/CMS_WebPartCategory/add.png");
        imgNewReport.ImageUrl    = GetImageUrl("Objects/Reporting_report/add.png");
        imgDeleteItem.ImageUrl   = GetImageUrl("Objects/CMS_WebPart/delete.png");
        imgExportObject.ImageUrl = GetImageUrl("Objects/CMS_WebPart/export.png");
        imgCloneReport.ImageUrl  = GetImageUrl("CMSModules/CMS_WebParts/clone.png");

        // Resource strings
        lnkDeleteItem.Text   = GetString("Development-Report_Tree.DeleteSelected");
        lnkNewCategory.Text  = GetString("Development-Report_Tree.NewCategory");
        lnkNewReport.Text    = GetString("Development-Report_Tree.NewReport");
        lnkExportObject.Text = GetString("Development-Report_Tree.ExportObject");
        lnkCloneReport.Text  = GetString("Development-Report_Tree.CloneReport");

        // Setup menu action scripts
        lnkNewReport.Attributes.Add("onclick", "NewItem('report');");
        lnkNewCategory.Attributes.Add("onclick", "NewItem('reportcategory');");
        lnkDeleteItem.Attributes.Add("onclick", "DeleteItem();");
        lnkExportObject.Attributes.Add("onclick", "ExportObject();");
        lnkCloneReport.Attributes.Add("onclick", "CloneReport();");

        // Widgets
        lnkDeleteItem.ToolTip   = GetString("Development-Report_Tree.DeleteSelected");
        lnkNewCategory.ToolTip  = GetString("Development-Report_Tree.NewCategory");
        lnkNewReport.ToolTip    = GetString("Development-Report_Tree.NewReport");
        lnkExportObject.ToolTip = GetString("Development-Report_Tree.ExportObject");
        lnkCloneReport.ToolTip  = GetString("Development-Report_Tree.CloneReport");

        pnlSubBox.CssClass = BrowserHelper.GetBrowserClass();

        //// URLs for menu actions
        string script = "var categoryURL = '" + ResolveUrl("ReportCategory_Edit_Frameset.aspx") + "';\n";

        script += "var reportURL = '" + ResolveUrl("Report_Edit.aspx") + "';\n";
        script += "var doNotReloadContent = false;\n";

        // Script for deleting widget or category
        string delPostback  = ControlsHelper.GetPostBackEventReference(this.Page, "##");
        string deleteScript = "function DeleteItem() { \n" +
                              " if ((selectedItemId > 0) && (selectedItemParent > 0) && " +
                              " confirm('" + GetString("general.deleteconfirmation") + "')) {\n " +
                              delPostback.Replace("'##'", "selectedItemType+';'+selectedItemId+';'+selectedItemParent") + ";\n" +
                              "}\n" +
                              "}\n";

        script += deleteScript;

        // Preselect tree item
        if (!RequestHelper.IsPostBack())
        {
            int  categoryId = QueryHelper.GetInteger("categoryid", 0);
            int  reportID   = QueryHelper.GetInteger("reportid", 0);
            bool reload     = QueryHelper.GetBoolean("reload", false);

            // Select category
            if (categoryId > 0)
            {
                ReportCategoryInfo rci = ReportCategoryInfoProvider.GetReportCategoryInfo(categoryId);
                if (rci != null)
                {
                    // If not set explicitly stop reloading of right frame
                    if (!reload)
                    {
                        script += "doNotReloadContent = true;";
                    }
                    script += SelectAtferLoad(rci.CategoryPath, categoryId, "reportcategory", rci.CategoryParentID, true);
                }
            }
            // Select report
            else if (reportID > 0)
            {
                ReportInfo ri = ReportInfoProvider.GetReportInfo(reportID);
                if (ri != null)
                {
                    ReportCategoryInfo rci = ReportCategoryInfoProvider.GetReportCategoryInfo(ri.ReportCategoryID);
                    if (rci != null)
                    {
                        // If not set explicitly stop reloading of right frame
                        if (!reload)
                        {
                            script += "doNotReloadContent = true;";
                        }
                        string path = rci.CategoryPath + "/" + ri.ReportName;
                        script += SelectAtferLoad(path, reportID, "report", ri.ReportCategoryID, true);
                    }
                }
            }
            // Select root by default
            else
            {
                ReportCategoryInfo rci = ReportCategoryInfoProvider.GetReportCategoryInfo("/");
                if (rci != null)
                {
                    script += SelectAtferLoad("/", rci.CategoryID, "reportcategory", 0, true);
                }

                // Directly dispatch an action, if set by URL
                if (QueryHelper.GetString("action", null) == "newcategory")
                {
                    script += "NewItem('reportcategory');";
                }
            }
        }

        ltlScript.Text += ScriptHelper.GetScript(script);
    }