This project is read-only.

Adding droppable zones to a masterpage

Topics: Developer Forum, User Forum
Feb 11, 2009 at 1:48 PM
Can you point me in the right direction for allowing my Site Master to have droppable zones?

I've added this to the master:

<head runat="server">
...
<n2:SlidingCurtain ID="sc" runat="server">
        <n2:ControlPanel ID="cp" runat="server">
            <VisibleFooterTemplate>
                <script type="text/javascript">
                 if (window.top != window && window.top.n2)
                 {
                 window.top.n2.select("Go");
                 }
                </script>
            </VisibleFooterTemplate>
        </n2:ControlPanel>
</n2:SlidingCurtain>

And also

<asp:ContentPlaceHolder ID="ContentPlaceHolderRecursive" runat="server">
<n2:DraggableToolbar ID="dt" runat="server" />
<n2:DroppableZone ID="zrb" runat="server" ZoneName="RecursiveBelow" />
</asp:ContentPlaceHolder>

And finally my page that I'm trying it with (not sure it matters)

[Definition("Simple page")]
[WithEditableTitle()]
[WithEditableName()]
[AllowedZones(null)]
[AllowedChildren(typeof(SimplePage),typeof(RssFeed),typeof(NewsContainer),typeof(Redirect))]
public class SimplePage : StartPage
{
...
}

I'm getting a Javascript error though when I click on "organize parts" -  "Line: 11 Error: 'dropZones' is undefined"

Thanks for the help
Feb 11, 2009 at 9:42 PM
It could be that you need an [AvailableZone(...)] on your SimplePage class. I'm looking into getting rid of this for the next release.
Feb 12, 2009 at 9:48 PM
This seemed to be a problem with the way I'd made my hierachy, I had a default.aspx page using the site master, and then had another page using its own template which didn't really make sense.

I need some clarification though with three attributes:

[AllowedChildren(typeof(TextPage)]
Does this take the attribute values from the parent class? When I inherit a page from StartPage it seems to allow all types of page. But when I inherit from AbstractContentPage I get the list restricted.
However, I get the zones tab appearing ("Select a zone to create the item") which is confusing because when I change the zone, it allows more child page types. Shouldn't it be a list of pages set in the AllowedChildren() ? (which have to be pages)

I can see how it's a generic UI though and works for parts too. The problem is the list of allowed children can never be restricted like this. Not a big problem though I just want to check I haven't missed something

[AllowedZones("Custom")]
When I put this on my page, I still get a big list of zones anyway?

[AvailableZone("name","title")]
As above, I still get a full list of zones for pages, so I'm guessing these two properties are for parts only?

My setup is quite basic, I have a site and want to restrict which types of page can be made under the homepage (which I've inherited from Startpage).  I don't need a separate root/startpage. There's a few other little niggles which I've turned into workitems.