Permalink
Browse files

base megafolder dexterity type added

  • Loading branch information...
1 parent 9def508 commit 3e938e36885f71a2fb547c2d5c540428905009af @lukebrannon committed Jan 22, 2012
View
7 collective/megadrop/configure.zcml
@@ -1,12 +1,15 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
+ xmlns:grok="http://namespaces.zope.org/grok"
i18n_domain="collective.megadrop">
<includeDependencies package="." />
-
+ <grok:grok package="." />
+
+
<include package=".browser" />
-
+
<include file="skins.zcml" />
<genericsetup:registerProfile
View
21 collective/megadrop/megafolder.py
@@ -2,9 +2,26 @@
from zope import schema
from plone.directives import form, dexterity
+from plone.app.textfield import RichText
from collective.megadrop import _
-class IDropFolder():
+class IDropFolder(form.Schema):
"""A folder to include richtext content for megadrop navigation.
- """
+ """
+
+ use_body_text = schema.Bool(
+ title=_(u"Custom View"),
+ description=_(u"Check this box display the custom content below."),
+ required=False,
+ )
+
+ body = RichText(
+ title=_(u"Drop Down Custom Content"),
+ description=_(u"Custom content to be displayed in your drop down menu"),
+ required=False,
+ )
+
+class View(grok.View):
+ grok.context(IDropFolder)
+ grok.require('zope2.View')
View
31 collective/megadrop/megafolder_templates/view.pt
@@ -0,0 +1,31 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
+ xmlns:tal="http://xml.zope.org/namespaces/tal"
+ xmlns:metal="http://xml.zope.org/namespaces/metal"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+ lang="en"
+ metal:use-macro="context/main_template/macros/master"
+ i18n:domain="collective.megadrop">
+<body>
+
+<metal:main fill-slot="main">
+ <tal:main-macro metal:define-macro="main">
+
+ <div tal:replace="structure provider:plone.abovecontenttitle" />
+
+ <h1 class="documentFirstHeading" tal:content="context/title" />
+
+ <div tal:replace="structure provider:plone.belowcontenttitle" />
+
+ <p class="documentDescription" tal:content="context/description" />
+
+ <div tal:replace="structure provider:plone.abovecontentbody" />
+
+ <div tal:content="structure context/body/output" />
+
+ <div tal:replace="structure provider:plone.belowcontentbody" />
+
+ </tal:main-macro>
+</metal:main>
+
+</body>
+</html>
View
5 collective/megadrop/profiles/default/metadata.xml
@@ -1,4 +1,7 @@
<?xml version="1.0"?>
<metadata>
- <version>1</version>
+ <version>1</version>
+ <dependencies>
+ <dependency>profile-plone.app.z3cform:default</dependency>
+ </dependencies>
</metadata>
View
3 collective/megadrop/profiles/default/types.xml
@@ -0,0 +1,3 @@
+<object name="portal_types">
+ <object name="collective.megadrop.megafolder" meta_type="Dexterity FTI" />
+</object>
View
52 collective/megadrop/profiles/default/types/collective.megadrop.megafolder.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<object name="collective.megadrop.megafolder" meta_type="Dexterity FTI"
+ i18n:domain="collective.megadrop" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+
+ <!-- Basic metadata -->
+ <property name="title" i18n:translate="">Megadrop Navigation Folder</property>
+ <property name="description" i18n:translate="">Megadrop Navigation Folder</property>
+ <property name="content_icon">Folder_icon.gif</property>
+ <property name="allow_discussion">False</property>
+ <property name="global_allow">True</property>
+ <property name="filter_content_types">False</property>
+ <property name="allowed_content_types"></property>
+
+ <!-- schema interface -->
+ <property name="schema">collective.megadrop.megafolder.IDropFolder</property>
+
+ <!-- class used for content items -->
+ <property name="klass">plone.dexterity.content.Container</property>
+
+ <!-- add permission -->
+ <property name="add_permission">cmf.AddPortalContent</property>
+
+ <!-- enabled behaviors -->
+ <property name="behaviors">
+ <element value="plone.app.content.interfaces.INameFromTitle" />
+ <element value="plone.app.dexterity.behaviors.metadata.IDublinCore" />
+ <element value="plone.app.dexterity.behaviors.exclfromnav.IExcludeFromNavigation" />
+ </property>
+
+ <!-- View information -->
+ <property name="default_view">view</property>
+ <property name="default_view_fallback">False</property>
+ <property name="view_methods">
+ <element value="view"/>
+ </property>
+
+ <!-- Method aliases -->
+ <alias from="(Default)" to="(selected layout)"/>
+ <alias from="edit" to="@@edit"/>
+ <alias from="sharing" to="@@sharing"/>
+ <alias from="view" to="@@view"/>
+
+ <!-- Actions -->
+ <action title="View" action_id="view" category="object" condition_expr=""
+ url_expr="string:${object_url}" visible="True">
+ <permission value="View"/>
+ </action>
+ <action title="Edit" action_id="edit" category="object" condition_expr=""
+ url_expr="string:${object_url}/edit" visible="True">
+ <permission value="Modify portal content"/>
+ </action>
+</object>
View
2 setup.py
@@ -27,6 +27,8 @@
zip_safe=False,
install_requires=[
'setuptools',
+ 'plone.app.z3cform',
+ 'plone.directives.form',
],
extras_require={
'tests': ['collective.testcaselayer',]

0 comments on commit 3e938e3

Please sign in to comment.