コード例 #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
        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 }));
            }
        }
コード例 #3
0
        public void moveNode(int pageID, int newParent, int idOldNode)
        {
            PagesDB db = new PagesDB();

            this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID);

            db.UpdatePageParent(pageID, newParent, this.PortalSettings.PortalID);
            int order;

            if (idOldNode == -1)
            {
                order = 9999;
            }
            else
            {
                order = this.getPageOrder(idOldNode) - 1;
            }

            db.UpdatePageOrder(pageID, order);
            this.OrderPages();
        }