示例#1
0
        /// <summary>
        /// Set pages to dropdown list
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            PagesDB pgdb = new PagesDB();

            // Get all pages
            pages = pgdb.GetPagesFlat(this.PortalSettings.PortalID);

            if (!IsPostBack)
            {
                btnSaveWithoutExtension.Visible = false;
                drpPageList.DataTextField       = "Name";
                drpPageList.DataValueField      = "ID";

                //Set it dropdown list
                drpPageList.DataSource = pages;
                drpPageList.DataBind();

                divDyanamicPage.Visible = false;

                drpPageList.Items.Add(new ListItem()
                {
                    Text = "Dynamic Page", Value = "-1"
                });

                //div for messages will be false when page is loaded
                divErrorMessage.Visible   = false;
                divSuccessMessage.Visible = false;

                // Set the page extension from web.config file to display
                lblFriendlyExtension.Text = System.Configuration.ConfigurationManager.AppSettings["FriendlyUrlExtension"].ToString();

                LoadGrid();
            }
        }
        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
        /// <summary>
        /// Set pages to dropdown list
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            PagesDB pgdb = new PagesDB();

            // Get all pages
            pages = pgdb.GetPagesFlat(this.PortalSettings.PortalID);

            if (!IsPostBack)
            {
                btnSaveWithoutExtension.Visible = false;
                drpPageList.DataTextField       = "Name";
                drpPageList.DataValueField      = "ID";

                //Set it dropdown list
                drpPageList.DataSource = pages;
                drpPageList.DataBind();

                divDyanamicPage.Visible = false;

                for (int i = 0; i < drpPageList.Items.Count; i++)
                {
                    if (drpPageList.Items[i].Value == "345")
                    {
                        drpPageList.Items.Insert(i + 1, new ListItem()
                        {
                            Text = "---Secondary Short URL", Value = "-1"
                        });
                        break;
                    }
                }

                //div for messages will be false when page is loaded
                divErrorMessage.Visible   = false;
                divSuccessMessage.Visible = false;

                // Set the page extension from web.config file to display
                lblFriendlyExtension.Text = System.Configuration.ConfigurationManager.AppSettings["FriendlyUrlExtension"];

                LoadGrid();
            }
        }
        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();
        }
 public JsonResult create(string pageid, string pagename)
 {
     try
     {
         if ((UserProfile.isCurrentUserAdmin) || UserProfile.CurrentUser.HasPermission(AccessPermissions.PAGE_CREATION))
         {
             pageid = pageid.Trim('"');
             PagesDB db = new PagesDB();
             this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID);
             var t = new PageItem
             {
                 Name  = General.GetString("TAB_NAME", "New Page Name"),
                 ID    = -1,
                 Order = 990000
             };
             if (!string.IsNullOrEmpty(pagename))
             {
                 t.Name = pagename;
             }
             this.PortalPages.Add(t);
             var tabs = new PagesDB();
             t.ID = tabs.AddPage(this.PortalSettings.PortalID, t.Name, t.Order);
             db.UpdatePageParent(t.ID, Convert.ToInt32(pageid), this.PortalSettings.PortalID);
             this.OrderPages();
             return(Json(""));
         }
         else
         {
             string errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to add new page", this);
             return(Json(new { error = true, errorMess = errorMessage }));
         }
     }
     catch (Exception)
     {
         string errorMessage = General.GetString("ADD_NEW_PAGE_FAILED", "Failed to add new Page", this);
         return(Json(new { error = true, errorMess = errorMessage }));
     }
 }
        public JsonResult create(int id)
        {
            PagesDB db = new PagesDB();

            this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID);
            var t = new PageItem
            {
                Name  = General.GetString("TAB_NAME", "New Page Name"),
                ID    = -1,
                Order = 990000
            };

            this.PortalPages.Add(t);

            var tabs = new PagesDB();

            t.ID = tabs.AddPage(this.PortalSettings.PortalID, t.Name, t.Order);

            db.UpdatePageParent(t.ID, id, this.PortalSettings.PortalID);

            this.OrderPages();
            //JsonResult treeData = GetTreeData();
            return(Json(""));
        }
示例#7
0
        private void LoadPageDropDown()
        {
            //load tab names for the dropdown list, then bind them
            // TODO check if this works
            //portalTabs = new PagesDB().GetPagesFlat(portalSettings.PortalID);
            var pgDb = new PagesDB();

            portalTabs = pgDb.GetPagesFlatTable(this.PortalSettings.PortalID);
            ddTabs.DataBind();

            //on initial load, disable the restore button until they make a selection
            restoreButton.Enabled = false;
            if (this._moduleID > 0)
            {
                ddTabs.Items.Insert(0, "--Choose a Page to Restore this Module--");
            }

            if (this._pageID > 0)
            {
                restoreButton.Enabled = true;
                var recyle = pgDb.GetPagesFlat(-1).First(p => p.ID == this._pageID);// get recycle pages
                selecteditem.InnerHtml = "Selected Page : " + recyle.Name.Replace("(Orphan)", string.Empty);
                foreach (DataRow row in portalTabs.Rows)
                {
                    if (recyle.ParentPageId.ToString() == row["PageID"].ToString())
                    {
                        ddTabs.SelectedValue = row["PageID"].ToString();
                        break;
                    }
                }
                ddTabs.Items.Insert(0, new ListItem()
                {
                    Text = "--Root--", Value = "-1"
                });
            }
        }
        public JsonResult Clone(int id, int parentId)
        {
            try
            {
                var      generalModuleDef = Guid.Parse("F9F9C3A4-6E16-43B4-B540-984DDB5F1CD2");
                object[] queryargs        = { generalModuleDef, PortalSettings.PortalID };

                int moduleDefinition;

                try
                {
                    moduleDefinition =
                        new rb_ModuleDefinitions().All(where : "GeneralModDefID = @0 and PortalID = @1", args: queryargs).Single().ModuleDefID;
                }
                catch (Exception e)
                {
                    // Shortcut module doesn't exist in current Portal

                    var modules = new ModulesDB();

                    modules.UpdateModuleDefinitions(
                        generalModuleDef,
                        PortalSettings.PortalID,
                        true);

                    moduleDefinition =
                        new rb_ModuleSettings().All(where : "GeneralModDefID = @0 and PortalID = @1", args: queryargs).Single().ModuleDefID;
                }

                var db = new PagesDB();

                PortalPages = db.GetPagesFlat(PortalSettings.PortalID);
                var t = new PageItem
                {
                    Name  = General.GetString("TAB_NAME", "New Page Name"),
                    ID    = -1,
                    Order = 990000
                };

                PortalPages.Add(t);

                var tabs = new PagesDB();
                t.ID = tabs.AddPage(PortalSettings.PortalID, t.Name, t.Order);

                db.UpdatePageParent(t.ID, parentId, PortalSettings.PortalID);

                OrderPages();
                //JsonResult treeData = GetTreeData();

                // Coping Modules



                var pagesModules = new rb_Modules().All(where : "TabID = @0", args: id);

                foreach (var module in pagesModules)
                {
                    var m = new ModuleItem();
                    m.Title       = module.ModuleTitle;
                    m.ModuleDefID = moduleDefinition;
                    m.Order       = module.ModuleOrder;

                    // save to database
                    var mod = new ModulesDB();

                    m.ID = mod.AddModule(
                        t.ID,
                        m.Order,
                        module.PaneName,
                        module.ModuleTitle,
                        m.ModuleDefID,
                        0,
                        module.AuthorizedEditRoles,
                        module.AuthorizedViewRoles,
                        module.AuthorizedAddRoles,
                        module.AuthorizedDeleteRoles,
                        module.AuthorizedPropertiesRoles,
                        module.AuthorizedMoveModuleRoles,
                        module.AuthorizedDeleteModuleRoles,
                        false,
                        PortalSecurity.GetDeleteModulePermissions(module.ModuleID),
                        false,
                        false,
                        false);

                    var settings = new rb_ModuleSettings();
                    settings.Insert(new { ModuleID = m.ID, SettingName = "LinkedModule", SettingValue = module.ModuleID });
                }



                return(Json(new { pageId = t.ID }));
            }
            catch (Exception e)
            {
                ErrorHandler.Publish(LogLevel.Error, e);
                Response.StatusCode = 500;
                return(Json(""));
            }
        }