<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:plone="http://namespaces.plone.org/plone"
           xmlns:browser="http://namespaces.zope.org/browser"
           xmlns:five="http://namespaces.zope.org/five">

    <include package="plone.app.portlets"  />

    <browser:resource
        file="resources/idashboard.js"
        name="idashboard.js"
        />

    <browser:resource
        file="resources/jquery.field.0.9.2/jquery.field.min.js"
        name="jquery.field.min.js"
        />

    <browser:page
        for="*"
        attribute="configurePortlet"
        class=".dashboard.DashboardAjax"
        name="configurePortlet"
        permission="zope2.View"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        /> 

    <browser:page
        for="*"
        attribute="portlet_edit_iframe"
        class=".dashboard.DashboardAjax"
        name="portlet_edit_iframe"
        permission="zope2.View"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        /> 

    <browser:page
        for="*"
        attribute="movePortlet"
        class=".dashboard.DashboardAjax"
        name="movePortlet"
        permission="zope2.View"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        /> 

    <browser:page
        for="*"
        attribute="removePortlet"
        class=".dashboard.DashboardAjax"
        name="removePortlet"
        permission="zope2.View"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        /> 
        
    <browser:page
        for="*"
        attribute="submitPortletEditForm"
        class=".dashboard.DashboardAjax"
        name="submitPortletEditForm"
        permission="zope2.View"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        /> 

    <browser:page
        for="*"
        name="dashboard-macros"
        class="plone.app.portlets.browser.manage.ManageContextualPortlets"
        template="templates/dashboard_macros.pt"
        permission="plone.app.portlets.ManageOwnPortlets"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        />

    <!-- These directives used to be in overrides.zcml
         They are now here by virtue of the IIDashboardLayer
    -->
    <browser:page
        for="plone.app.layout.navigation.interfaces.INavigationRoot"
        class="plone.app.layout.dashboard.dashboard.DashboardView"
        name="dashboard"
        template="templates/dashboard.pt"
        permission="plone.app.portlets.ManageOwnPortlets"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        />

    <browser:page
        for="plone.app.layout.navigation.interfaces.INavigationRoot"
        class="plone.app.portlets.browser.manage.ManageDashboardPortlets"
        name="manage-dashboard"
        template="templates/manage-dashboard.pt"
        permission="plone.app.portlets.ManageOwnPortlets"
        layer="collective.idashboard.interfaces.IIDashboardLayer"
        />

    <adapter 
        factory=".dashboard.DashboardPortletManagerRenderer"
        provides="plone.portlets.interfaces.IPortletManagerRenderer" 
        />

    <adapter
        factory=".dashboard.DashboardEditPortletManagerRenderer"
        provides="plone.portlets.interfaces.IPortletManagerRenderer"
        />

    <!-- idashboard page layout for portlet add/edit forms 
        See  plone.app.portlets.browser.configure.zcml
    -->
    <adapter
        for="plone.app.portlets.browser.interfaces.IPortletForm"
        factory=".dashboard.portlets_named_template_adapter"
        name="idashboard"
        provides="zope.formlib.namedtemplate.INamedTemplate"
        />

</configure>

