+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / Intrasite module - creating extra admin page

Intrasite module - creating extra admin page

8 posts, 0 answered
  1. TIOS
    TIOS avatar
    48 posts
    Registered:
    22 Mar 2006
    17 Jun 2011
    Link to this post
    Just been following the blog post and have my main admin page in Modules/auctions/admin/admin.ascx which is created in mymodule.cs install routinue.  How can I add another page to this?  I thought it would be something like this:

    var entryformsPage = pageManager.CreatePageData();
    entryformsPage.Template = pageManager.GetTemplate(SiteInitializer.DefaultBackendTemplateId);
    entryformsPage.HtmlTitle = "Entry Forms";
    entryformsPage.Title = "Entry Forms";
    entryformsPage.Status = ContentLifecycleStatus.Live;
    entryformsPage.Visible = true;
    entryformsPage.Version = 1;

    But as i've already allocated node.Page to pagedata then added the control to pageData.Controls.Add, i'm unsure how you add this extra page.  Did a few searchs and looked at sdk but because it's intrasite it's layed out a bit differently.

    Any ideas?

    Thanks,
    Chris
  2. TIOS
    TIOS avatar
    48 posts
    Registered:
    22 Mar 2006
    17 Jun 2011
    Link to this post
    Actually it may not be 100% clear from that post i've just made - i think if i create multiple nodes it will be fine, if i want it as a subpage however that's what i'm refering to above.
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    17 Jun 2011
    Link to this post
    Hello Chris,

    You should create  a PageNode object. Each PageNode has a property Parent that sets the parent of the node being created.

    sample

    var pageNode = manager.CreatePageNode();
    pageNode.Parent = manager.GetPageNode(SiteInitializer.FrontendRootNodeId);

    All the best,
    Ivan Dimitrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  4. TIOS
    TIOS avatar
    48 posts
    Registered:
    22 Mar 2006
    17 Jun 2011
    Link to this post
    Nearly got it think it's because the first item needs to be a group first.
  5. TIOS
    TIOS avatar
    48 posts
    Registered:
    22 Mar 2006
    17 Jun 2011
    Link to this post
    Still struggling a bit because the example on http://www.sitefinity.com/blogs/joshmorales/posts/11-05-26/creating_intra-site_modules_in_sitefinity_4.aspx doesn't call initializer.CratePageFromConfiguration so must be happening as it goes out of scope.  I've tried adding pageManager.SaveChanges(); but doesnt seem to create the backend page properly when creating that.

    Tried the this way but it won't accept the page control:

                if (landingPage == null)
                {
                    var pageInfo = new PageDataElement()
                    {
                        PageId = this.LandingPageId,
                        Name = "Auctions",
                        MenuName = "Auctions",
                        UrlName = "auctions",
                        Description = "Auctions",
                        HtmlTitle = "Auctions",
                        IncludeScriptManager = true,
                        ShowInNavigation = true,
                        EnableViewState = true,
                        TemplateName = SiteInitializer.BackendTemplateName
                    };
                    pageInfo.Parameters["ModuleName"] = AuctionsModule.ModuleName;
                    var ctrl = pageManager.CreateControl<PageControl>("~/Modules/Auctions/Admin/AuctionsAdmin.ascx", "Content");
                    //pageInfo.Controls.Add(ctrl);
                    //initializer.CreatePageFromConfiguration(pageInfo, auctionsNode, controlPanel);
                    initializer.CreatePageFromConfiguration(pageInfo, auctionsNode, ctrl);

                }
  6. TIOS
    TIOS avatar
    48 posts
    Registered:
    22 Mar 2006
    17 Jun 2011
    Link to this post
    Ummm i'm doing something basic wrong here any advice? When i go into backend pages get object null error.

    var backendPagesNode = pageManager.GetPageNode(SiteInitializer.SitefinityNodeId);
     
    var nodeAuctions = pageManager.CreatePageNode(this.LandingPageId);
    nodeAuctions.NodeType = NodeType.Group;
    nodeAuctions.Name = "Auctions";
    nodeAuctions.Title = "Auctions";
    nodeAuctions.UrlName = "auctions";
    nodeAuctions.Description = "Auctions";
    nodeAuctions.ShowInNavigation = true;
    nodeAuctions.Attributes["ModuleName"] = AuctionsModule.ModuleName;
    pageManager.ChangeParent(nodeAuctions, backendPagesNode);
    backendPagesNode.Nodes.Add(nodeAuctions);
     
    var nodeDashboard = pageManager.CreatePageNode(AuctionsPageDashboardId);
    nodeDashboard.Parent = pageManager.GetPageNode(this.LandingPageId);
    nodeDashboard.Name = "AuctionsDashboard";
    nodeDashboard.Title = "Dashboard";
    nodeDashboard.Description = "Auctions Dashboard";
    nodeDashboard.ShowInNavigation = true;
    nodeDashboard.Attributes["ModuleName"] = AuctionsModule.ModuleName;
     
    var pageDataDashboard = pageManager.CreatePageData();
    pageDataDashboard.Template = pageManager.GetTemplate(SiteInitializer.DefaultBackendTemplateId);
    pageDataDashboard.HtmlTitle = "Dashboard";
    pageDataDashboard.Title = "Dashboard";
    pageDataDashboard.Status = ContentLifecycleStatus.Live;
    pageDataDashboard.Visible = true;
    pageDataDashboard.Version = 1;
     
    nodeDashboard.Page = pageDataDashboard;
     
    var ctrl = pageManager.CreateControl<PageControl>("~/Modules/Auctions/Admin/AuctionsAdmin.ascx", "Content");
    pageDataDashboard.Controls.Add(ctrl);
     
    backendPagesNode.Nodes.Add(nodeDashboard);


    Thanks,
    Chris
  7. TIOS
    TIOS avatar
    48 posts
    Registered:
    22 Mar 2006
    20 Jun 2011
    Link to this post
    anyone?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    19 Sep 2016
    21 Jun 2011
    Link to this post
    Hi Chris,

    For the "module" you want to create you only need one backend page and several child nodes for it. The way that backend pages are created is the same as the way that frontend pages are created. The only difference is the parent that is used for your "root" node and then you need to assign all child nodes to your parent.

    Here is  sample code that will add a new group page and child page to Content menu

    var staticID = new Guid("C70FF3BC-AE2A-4A53-A950-AADF06C6928D");
     
    var parent = App.WorkWith().Pages().Where(root => root.Name == "Modules" && root.IsBackend == true).Get().SingleOrDefault();
    var group1 = App.WorkWith().Page().CreateNewPageGroup(parent.Id, staticID).Do(gr =>
    {
        gr.Name = "IntraModule";
        gr.Title = "IntraModule";
        gr.UrlName = "IntraModule";
    }).Done();
    group1.CreateNewStandardPage(group1.Get().Id, Guid.NewGuid()).Do(pg =>
    {
        pg.Name = "name";
        pg.Title = "title";
        pg.UrlName = "someurlname";
        pg.ShowInNavigation = true;
        pg.Page.Title = "datatitle";
        pg.Page.HtmlTitle = "htmldatatitle";
        pg.Description = "Some description";
    })
    .CheckOut()
    .Publish()
    .SaveChanges();

    Since you don't have a real module with an Install method you should be able to create your pages as shown above in application_start of Global.asax

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

8 posts, 0 answered