コード例 #1
0
ファイル: Pages.ascx.cs プロジェクト: wforney/portal
        /// <summary>
        /// The UpDown_Click server event handler on this page is
        ///   used to move a portal module up or down on a tab's layout pane
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        //protected void UpDownClick(object sender, ImageClickEventArgs e)
        //{
        //    var cmd = ((ImageButton)sender).CommandName;

        //    if (this.tabList.SelectedIndex > -1)
        //    {
        //        int delta;

        //        // Determine the delta to apply in the order number for the module
        //        // within the list.  +3 moves down one item; -3 moves up one item
        //        if (cmd == "down")
        //        {
        //            delta = 3;
        //        }
        //        else
        //        {
        //            delta = -3;
        //        }

        //        var t = this.PortalPages[this.tabList.SelectedIndex];
        //        t.Order += delta;
        //        this.OrderPages();
        //        this.Response.Redirect(
        //            HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, this.PageID, "selectedtabID=" + t.ID));
        //    }
        //}

        /// <summary>
        /// The OrderPages helper method is used to reset
        ///   the display order for tabs within the portal
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void OrderPages()
        {
            var i = 1;

            this.PortalPages.Sort();

            foreach (var t in this.PortalPages)
            {
                // number the items 1, 3, 5, etc. to provide an empty order
                // number when moving items up and down in the list.
                t.Order = i;
                i      += 2;

                // rewrite tab to database
                var tabs = new PagesDB();

                // 12/16/2002 Start - Cory Isakson
                tabs.UpdatePageOrder(t.ID, t.Order);

                // 12/16/2002 End - Cory Isakson
            }

            // gbs: Invalidate cache, fix for bug RBM-220
            CurrentCache.RemoveAll("_PageNavigationSettings_");
        }
コード例 #2
0
        /// <summary>
        /// The OnUpdate on this page is used to save
        ///   the current tab settings to the database and
        ///   then redirect back to the main admin page.
        /// </summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected override void OnUpdate(EventArgs e)
        {
            // Only Update if Input Data is Valid
            if (this.Page.IsValid)
            {
                try
                {
                    this.SavePageData();

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    CurrentCache.RemoveAll("_PageNavigationSettings_");
                    PortalSettings.RemovePortalSettingsCache(PageID, PortalSettings.PortalAlias);

                    // Clear AppleseedSiteMapCache
                    AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();

                    // redirect back to the admin page
                    // int adminIndex = portalSettings.DesktopPages.Count-1;
                    // 3_aug_2004 Cory Isakson use returntabid from QueryString
                    // Updated 6_Aug_2004 by Cory Isakson to accomodate addtional Page Management
                    var    retPage = this.Request.QueryString["returnPageID"];
                    string returnPage;

                    if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                    {
                        Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
                    }
                    else
                    {
                        if (retPage != null)
                        {
                            // user is returned to the calling tab.
                            returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                        }
                        else
                        {
                            // user is returned to updated tab
                            returnPage = HttpUrlBuilder.BuildUrl(this.PageID);
                        }

                        this.Response.Redirect(returnPage);
                    }
                }
                catch
                {
                    this.lblErrorNotAllowed.Visible = true;
                }
            }
        }
コード例 #3
0
        public JsonResult moveNode(int pageID, int newParent, int idOldNode, int selectedposition)
        {
            //Cache clearing
            Appleseed.Framework.Web.SqlUrlBuilderProvider.ClearCachePageUrl(pageID);
            Appleseed.Framework.Web.UrlBuilderHelper.ClearUrlElements(pageID);
            CurrentCache.RemoveAll("_PageNavigationSettings_");
            PortalSettings.RemovePortalSettingsCache(pageID, PortalSettings.PortalAlias);
            Appleseed.Framework.Providers.AppleseedSiteMapProvider.AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();
            PortalSettings.UpdatePortalSettingParentPageCache(newParent, pageID);

            if (UserProfile.isCurrentUserAdmin || UserProfile.CurrentUser.HasPermission(AccessPermissions.PAGE_EDITING))
            {
                PagesDB db = new PagesDB();
                this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID);
                db.UpdatePageParent(Convert.ToInt32(pageID), Convert.ToInt32(newParent), this.PortalSettings.PortalID);
                int order;
                if (Convert.ToInt32(idOldNode) == -1)
                {
                    order = 9999;
                }
                else
                {
                    List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, newParent).Where(pg => pg.PageID != pageID).ToList();
                    if (childPages.Count == 0)
                    {
                        order = 0;
                    }
                    else
                    {
                        if (selectedposition < childPages.Count)
                        {
                            order = childPages[selectedposition].PageOrder - 1;
                        }
                        else
                        {
                            order = childPages[childPages.Count - 1].PageOrder + 1;
                        }
                    }
                }
                db.UpdatePageOrder(Convert.ToInt32(pageID), order);
                this.OrderPages();
                return(Json(""));
            }
            else
            {
                this.OrderPages();
                string errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to move page", this);
                return(Json(new { error = true, errorMess = errorMessage }));
            }
        }
コード例 #4
0
        /// <summary>
        /// The SaveButton_Click is used to commit the tab/page
        /// information from the form to the database.
        /// Created by Mike Stone 29/12/2004
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void SaveButton_Click(object sender, EventArgs e)
        {
            //Only Save if Input Data is Valid
            int    NewPageID = 0;
            string returnPage;

            if (Page.IsValid == true)
            {
                try
                {
                    NewPageID = SavePageData();

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    // Copied to here 29/12/2004 by Mike Stone
                    CurrentCache.RemoveAll("_PageNavigationSettings_");

                    //Jump to Page option
                    if (cb_JumpToPage.Checked == true)
                    {
                        // Redirect to New Form - Mike Stone 19/12/2004
                        returnPage =
                            HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, NewPageID,
                                                    "SelectedPageID=" + NewPageID.ToString());
                    }
                    else
                    {
                        // Do NOT Redirect to New Form - Mike Stone 19/12/2004
                        // I guess every .aspx page needs to have a module tied to it.
                        // or you will get an error about edit access denied.
                        // Fix: RBP-594 by mike stone added returntabid to url.
                        returnPage =
                            HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Pages/AddPage.aspx",
                                                    "mID=" + Request.QueryString["mID"] + "&returntabid=" +
                                                    Request.QueryString["returntabid"]);
                    }
                    Response.Redirect(returnPage);
                }
                catch
                {
                    lblErrorNotAllowed.Visible = true;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// The OnUpdate on this page is used to save
        /// the current tab settings to the database and
        /// then redirect back to the main admin page.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnUpdate(EventArgs e)
        {
            // Only Update if Input Data is Valid
            if (Page.IsValid == true)
            {
                try
                {
                    SavePageData();

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    CurrentCache.RemoveAll("_PageNavigationSettings_");
                    // Clear RainbowSiteMapCache
                    RainbowSiteMapProvider.ClearAllRainbowSiteMapCaches();


                    // redirect back to the admin page
                    // int adminIndex = portalSettings.DesktopPages.Count-1;
                    // 3_aug_2004 Cory Isakson use returntabid from QueryString
                    // Updated 6_Aug_2004 by Cory Isakson to accomodate addtional Page Management
                    string retPage = Request.QueryString["returnPageID"];
                    string returnPage;

                    if (retPage != null) // user is returned to the calling tab.
                    {
                        returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                    }
                    else // user is returned to updated tab
                    {
                        returnPage = HttpUrlBuilder.BuildUrl(PageID);
                    }
                    Response.Redirect(returnPage);
                }
                catch
                {
                    lblErrorNotAllowed.Visible = true;
                }
            }
        }
コード例 #6
0
ファイル: AddTab.ascx.cs プロジェクト: AnantLabs/appleseedapp
        /// <summary>
        /// The AddTabButton_Click server event handler
        /// on this page is used to add a new portal module
        /// into the tab
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddTabButton_Click(Object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                // Hide error message in case there was a previous error.
                moduleError.Visible = false;

                // This allows the user to pick what type of people can view the module being added.
                // If Authorised Roles is selected from the dropdown then every role that has view permission for the
                // Add Role module will be added to the view permissions of the module being added.
                string viewPermissionRoles = PermissionDropDown.SelectedValue.ToString();
                if (viewPermissionRoles == "Authorised Roles")
                {
                    viewPermissionRoles = PortalSecurity.GetViewPermissions(ModuleID);
                }

                try
                {
                    // New tabs go to the end of the list
                    PageItem t = new PageItem();
                    t.Name  = TabTitleTextBox.Text;
                    t.ID    = -1;
                    t.Order = 990000;

                    // Get Parent Tab Id Convert only once used many times
                    var parentTabID = int.Parse(parentTabDropDown.SelectedValue);


                    // write tab to database
                    PagesDB tabs = new PagesDB();
                    t.ID =
                        tabs.AddPage(this.PortalSettings.PortalID, parentTabID, t.Name, t.Order, viewPermissionRoles,
                                     cb_ShowMobile.Checked, tb_MobileTabName.Text);

                    CurrentCache.RemoveAll("_TabNavigationSettings_");

                    AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();

                    //Jump to Page option
                    string returnTab = string.Empty;
                    if (rbl_JumpToTab.SelectedValue.ToString() == "Yes")
                    {
                        // Redirect to New Page/Tab - Mike Stone 30/12/2004
                        // modified by Hongwei Shen 9/25/2005
                        // returnTab = HttpUrlBuilder.BuildUrl(""~/"+HttpUrlBuilder.DefaultPage", t.ID, "SelectedTabID=" + t.ID.ToString());
                        string newPage = "~/" + t.Name.Trim().Replace(" ", "_") + ".aspx";
                        returnTab = HttpUrlBuilder.BuildUrl(newPage, t.ID);
                    }
                    else
                    {
                        // Do NOT Redirect to New Form - Mike Stone 30/12/2004
                        // I guess every .aspx page needs to have a module tied to it.
                        // or you will get an error about edit access denied.

                        // Modified by Hongwei Shen 9/25/2005 to fix: QueryString["tabID"] maybe null.
                        // returnTab = HttpUrlBuilder.BuildUrl("~/"+HttpUrlBuilder.DefaultPage, int.Parse(Request.QueryString["tabID"]), "SelectedTabID=" + t.ID.ToString());
                        returnTab =
                            HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, PageID, "SelectedTabID=" + t.ID.ToString());
                    }
                    Response.Redirect(returnTab);
                }
                catch (Exception ex)
                {
                    moduleError.Visible = true;
                    ErrorHandler.Publish(LogLevel.Error,
                                         "There was an error with the Add Tab Module while trying to add a new tab.", ex);
                    return;
                }
                // Reload page to pick up changes
                Response.Redirect(Request.RawUrl, false);
            }
        }
コード例 #7
0
        /// <summary>
        /// The OnUpdate on this page is used to save
        ///   the current tab settings to the database and
        ///   then redirect back to the main admin page.
        /// </summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected override void OnUpdate(EventArgs e)
        {
            // Only Update if Input Data is Valid
            if (this.Page.IsValid)
            {
                try
                {
                    this.SavePageData();
                    //remove from cache
                    SqlUrlBuilderProvider.ClearCachePageUrl(this.PageID);
                    UrlBuilderHelper.ClearUrlElements(this.PageID);

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    CurrentCache.RemoveAll("_PageNavigationSettings_");
                    PortalSettings.RemovePortalSettingsCache(PageID, PortalSettings.PortalAlias);

                    // Clear AppleseedSiteMapCache
                    AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();

                    PortalSettings.UpdatePortalSettingParentPageCache(Int32.Parse(this.parentPage.SelectedItem.Value), this.PageID);

                    // redirect back to the admin page
                    // int adminIndex = portalSettings.DesktopPages.Count-1;
                    // 3_aug_2004 Cory Isakson use returntabid from QueryString
                    // Updated 6_Aug_2004 by Cory Isakson to accomodate addtional Page Management
                    var    retPage = this.Request.QueryString["returnPageID"];
                    string returnPage;
                    if (Request.QueryString.GetValues("keep") != null)
                    {
                        Response.Write("<script type=\"text/javascript\">window.parent.$('#iframemodal').dialog(\"close\");window.parent.location = window.parent.location;</script>");
                    }
                    else if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                    {
                        if (retPage != null)
                        {
                            // user is returned to the calling tab.
                            returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                        }
                        else
                        {
                            // user is returned to updated tab
                            returnPage = HttpUrlBuilder.BuildUrl(this.PageID);
                        }

                        Response.Write("<script type=\"text/javascript\">window.parent.location = '" + returnPage + "';</script>");
                    }

                    else
                    {
                        if (retPage != null)
                        {
                            // user is returned to the calling tab.
                            returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                        }
                        else
                        {
                            // user is returned to updated tab
                            returnPage = HttpUrlBuilder.BuildUrl(this.PageID);
                        }

                        this.Response.Redirect(returnPage);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.Message == "FriendlyUrlIsAlreadyExists")
                    {
                        this.lblUrlAlreadyExist.Visible = true;
                    }
                    else
                    {
                        this.lblErrorNotAllowed.Visible = true;
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// The AddTabButton_Click server event handler
        /// on this page is used to add a new portal module
        /// into the tab
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddTabButton_Click(Object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                // Hide error message in case there was a previous error.
                moduleError.Visible = false;

                // This allows the user to pick what type of people can view the module being added.
                // If Authorised Roles is selected from the dropdown then every role that has view permission for the
                // Add Role module will be added to the view permissions of the module being added.
                string viewPermissionRoles = PermissionDropDown.SelectedValue.ToString();
                if (viewPermissionRoles == "Authorised Roles")
                {
                    viewPermissionRoles = PortalSecurity.GetViewPermissions(ModuleID);
                }

                try
                {
                    // New tabs go to the end of the list
                    PageItem t = new PageItem();
                    t.Name  = TabTitleTextBox.Text;
                    t.ID    = -1;
                    t.Order = 990000;

                    // Get Parent Tab Id Convert only once used many times
                    int parentTabID = int.Parse(parentTabDropDown.SelectedValue);


                    // write tab to database
                    PagesDB tabs = new PagesDB();
                    //t.ID = tabs.AddTab(portalSettings.PortalID, t.Name, viewPermissionRoles, t.Order);

                    // Changed to use new method in TabsDB.cs now all parms are possible
                    // By Mike Stone ([email protected]) - 30/12/2004
                    t.ID =
                        tabs.AddPage(portalSettings.PortalID, parentTabID, t.Name, t.Order, viewPermissionRoles,
                                     cb_ShowMobile.Checked, tb_MobileTabName.Text);

                    //TODO.. the only way to update a parent id is throught update :S
                    // Changed to AddTab method now supports the parm
                    // Mike Stone - 30/12/2004
                    //tabs.UpdateTab(portalSettings.PortalID, t.ID, parentTabID, t.Name, t.Order, viewPermissionRoles, t.Name, false);

                    //Invalidate cache
                    // Changed to access form directly
                    // mike stone - 30/12/2004
                    //   Cache.Remove(Rainbow.Framework.Settings.Cache.Key.TabSettings(parentTabID));
                    // Copied to here 29/12/2004 by Mike Stone
                    CurrentCache.RemoveAll("_TabNavigationSettings_");
                    //Debug.WriteLine("************* Remove " + Key.TabSettings(parentTabID));

                    //Clear SiteMaps Cache
                    RainbowSiteMapProvider.ClearAllRainbowSiteMapCaches();

                    //Jump to Page option
                    string returnTab = string.Empty;
                    if (rbl_JumpToTab.SelectedValue.ToString() == "Yes")
                    {
                        // Redirect to New Page/Tab - Mike Stone 30/12/2004
                        // modified by Hongwei Shen 9/25/2005
                        // returnTab = HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", t.ID, "SelectedTabID=" + t.ID.ToString());
                        string newPage = "~/" + t.Name.Trim().Replace(" ", "_") + ".aspx";
                        returnTab = HttpUrlBuilder.BuildUrl(newPage, t.ID);
                    }
                    else
                    {
                        // Do NOT Redirect to New Form - Mike Stone 30/12/2004
                        // I guess every .aspx page needs to have a module tied to it.
                        // or you will get an error about edit access denied.

                        // Modified by Hongwei Shen 9/25/2005 to fix: QueryString["tabID"] maybe null.
                        // returnTab = HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", int.Parse(Request.QueryString["tabID"]), "SelectedTabID=" + t.ID.ToString());
                        returnTab =
                            HttpUrlBuilder.BuildUrl("~/DesktopDefault.aspx", PageID, "SelectedTabID=" + t.ID.ToString());
                    }
                    Response.Redirect(returnTab);
                }
                catch (Exception ex)
                {
                    moduleError.Visible = true;
                    ErrorHandler.Publish(LogLevel.Error,
                                         "There was an error with the Add Tab Module while trying to add a new tab.", ex);
                    return;
                }
                // Reload page to pick up changes
                Response.Redirect(Request.RawUrl, false);
            }
        }