Allow 'No available page types'

Postby:Mark Bagnall on 03 August 2006, 13:08:40
Sometimes we would like to make a pagetype a 'leaf', ie an instnace of this page type can have no children. It isn't possible to specify this at the moment, because no selected page types is equivalent to 'all'. This would obviously affect the 'create' functionality as well as the 'Available Page Types' tab.
Mark Bagnall
Joined: May 02 2007
City:
Country:
Level: Citizen
EPiServer Certified Developer
Mark Bagnall
  1. RE:Allow 'No available page types'
    Post by: Björn Sållarp on: 16 July 2007, 15:07:27
    I think this would be a great idea too! I even once tried to stop pages from being created below some page-types by hooking events but realized it cannot be stopped without spitting out an exception :(
    Björn Sållarp
    Joined: May 15 2007
    City: Stockholm
    Country: Sweden
    Level: Citizen
    EPiServer Certified Developer
    Björn Sållarp
  2. RE:Allow 'No available page types'
    Post by: Silvio Regazzoni on: 05 December 2007, 9:15:05
    I have put in a reuqest for this twice since EPi 4.11 but it seems to end up un-implemented. My solution has been to create a kind of dummy page type that is not available in edit mode and make that the only allowed page type where I want to stop the users from creating new pages. Not extreeeemly pretty, but works.
    Silvio Regazzoni
    Joined: May 08 2007
    City:
    Country:
    Level: Citizen
    Silvio Regazzoni
  3. RE:Allow 'No available page types'
    Post by: Silvio Regazzoni on: 05 December 2007, 9:25:06
    Found my old request for this that EPi put on the shortlist, in 2004: http://www.episerver.com/en/EPiServer_Knowledge_Center/Developer-Forum2/EPiServer-Developer-Forums-/2366/2420/
    Silvio Regazzoni
    Joined: May 08 2007
    City:
    Country:
    Level: Citizen
    Silvio Regazzoni
  4. RE:Allow 'No available page types'
    Post by: Greger Olofsson on: 19 May 2008, 23:40:19
    Content is edited

    Although I agree that it would be a good feature it is possible to implement this rather easily.

    You could subscribe to the CreatingPage event and check what page type name (or id) is used and abort the creation of the new page and supply a message to the editor in order to inform him/her of why creation was cancelled.

    To limit which page types would be affected, you could either create a list of childless page types, or add a pre- or suffix to the page type name which would give you something to look for before aborting creation. I'd use the latter option as all control over page types could still be handled from the page types tab in admin mode.

    I'd also suggest that you create a dummy page type as the only option for child pages as that would tell the editor that no children will be created, given that the dummy page type has a informative name.

    Perhaps it would be possible to abort even sooner, say when trying to load the edit interface for the dummy page type. I'm not sure exactly how to to that or if it is possible. I'll have a quick look at it tomorrow.

    edit:

    As it turns out, this is possible to achive with EPiServer CMS 5. If you create a dummy page type and choose it not to be available in edit mode, you can then select the dummy as the only possible page type under the childless page type to disable the editors from creating children to the given page type.

    If you'd like to build this functionality for EPiServer CMS 4.x, it would be easiest to subscribe to the LoadingDefaultPageData event and take it from there.

    Greger Olofsson
    Joined:
    City:
    Country: Sweden
    Level: Citizen
    EPiServer employee
    Greger Olofsson
  5. RE:Allow 'No available page types'
    Post by: Dominik Juszczyk on: 09 June 2008, 9:05:47

    Hi,

     I did short POC on that and managed to do it in quite simple way by modyfing NewPage.aspx (from edit folder). You can read how I did it here:  http://blog.juszczyk.biz/2008/06/how-to-make-page-type-leaf.html

    Regards,

    Dominik

    Dominik Juszczyk
    Joined: May 14 2007
    City: Kraków
    Country: Poland
    Level: Citizen
    EPiServer Certified Developer
    Dominik Juszczyk
  6. RE:Allow 'No available page types'
    Post by: Thomas Solbjør on: 05 August 2008, 14:42:39

    You could also look at a the plugin in CodeResort:

     

    https://www.coderesort.com/p/epicode/wiki/EPiCodeNewPage

    Thomas Solbjør
    Joined: May 02 2007
    City:
    Country: Norway
    Level: Citizen
    EPiServer Certified Developer
    Thomas Solbjør
FeedBackbutton image