Permalink
Browse files

* Support for collections now added.

  • Loading branch information...
1 parent 42c80c6 commit d00197397d8fc68119504f2ac03cc617b6f22d29 Alessandro Vermeulen committed Mar 22, 2011
@@ -7,6 +7,8 @@
from zope.interface import implements
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
+from pprint import pprint
+
class DoormatView(BrowserView):
"""
"""
@@ -76,10 +78,27 @@ def getDoormatData(self):
link_class = "external-link"
elif item.portal_type == "Document":
text = item.getText()
- elif item.portal_type == "DoormatCollection"
- text = "Hi, collection"
- link_class = "internal_link"
-
+ elif item.portal_type == "DoormatCollection":
+ for nitem in item.getCollection().queryCatalog():
+ obj = nitem.getObject()
+ link_dict = {
+ 'content': '',
+ 'link_url': obj.absolute_url(),
+ 'link_title': obj.title,
+ 'link_class': 'collection',
+ }
+ section_links.append(link_dict)
+
+ if item.getShowMoreLink():
+ section_links.append({
+ 'content': '',
+ 'link_url': item.getShowMoreLink().absolute_url(),
+ 'link_title': item.showMoreText,
+ 'link_class': 'read-more'
+ })
+
+ continue
+
if not (text or url):
continue
@@ -96,7 +115,24 @@ def getDoormatData(self):
data.append(column_dict)
return data
+ def getCollection(self, collection):
+ collection_path = collection
+ if not collection_path:
+ return None
+
+ if collection_path.startswith('/'):
+ collection_path = collection_path[1:]
+
+ if not collection_path:
+ return None
+ portal_state = getMultiAdapter((self.context, self.request),
+ name=u'plone_portal_state')
+ portal = portal_state.portal()
+ if isinstance(collection_path, unicode):
+ #restrictedTraverse accept only strings
+ collection_path = str(collection_path)
+ return portal.restrictedTraverse(collection_path, default=None)
##code-section module-footer #fill in your manual code here
##/code-section module-footer
@@ -22,9 +22,11 @@
from Products.Doormat.config import *
# additional imports from tagged value 'import'
-from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget
+from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget
##code-section module-header #fill in your manual code here
+from zope import schema
+
##/code-section module-header
schema = Schema((
@@ -36,6 +38,7 @@
label_msgid='Doormat_label_collection',
i18n_domain='Doormat',
),
+ allowed_types=("Topic"),
relationship="internally_references_to_collection",
),
ReferenceField(
@@ -45,6 +48,7 @@
label_msgid='Doormat_label_showMoreLink',
i18n_domain='Doormat',
),
+ relationship="more_link_links_to_internal",
),
StringField(
name='showMoreText',
@@ -85,6 +89,7 @@ class DoormatCollection(BaseContent, DoormatMixin, BrowserDefaultMixin):
# Methods
+
registerType(DoormatCollection, PROJECTNAME)
# end of class DoormatCollection
@@ -8,7 +8,7 @@
id="Doormat-Update-RoleMappings"
handler="Products.Doormat.setuphandlers.updateRoleMappings"
title="Update Workflow role mappings for Doormat"
- version="2011-03-22T10:30:01.730646">
+ version="2011-03-22T11:06:56.427291">
<dependency step="Doormat-QI-dependencies"/>
updates the workflow role mappings for Doormat
</import-step>
@@ -17,7 +17,7 @@
id="Doormat-postInstall"
handler="Products.Doormat.setuphandlers.postInstall"
title="manual coded post-install for Doormat"
- version="2011-03-22T10:30:01.730646">
+ version="2011-03-22T11:06:56.427291">
<dependency step="Doormat-QI-dependencies"/>
manual coded post-install for Doormat
</import-step>
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
- <version>0.6.6</version>
+ <version>0.6.11</version>
<!-- ##code-section METADATA -->
<!-- ##/code-section METADATA -->
</metadata>
View
@@ -48,7 +48,7 @@
UML 1.4
</plugin>
</profile>
-<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML' timestamp = 'Tue Mar 22 10:29:56 CET 2011'>
+<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML' timestamp = 'Tue Mar 22 11:06:47 CET 2011'>
<XMI.header> <XMI.documentation>
<XMI.exporter>ArgoUML (using Netbeans XMI Writer version 1.0)</XMI.exporter>
<XMI.exporterVersion>0.32.1(6) revised on $Date: 2010-01-11 22:20:14 +0100 (Mon, 11 Jan 2010) $ </XMI.exporterVersion>
@@ -3243,7 +3243,7 @@
<UML:ModelElement.taggedValue>
<UML:TaggedValue xmi.id = '-64--88--72-113-7b84db25:12edce22535:-8000:0000000000001354'
isSpecification = 'false'>
- <UML:TaggedValue.dataValue>from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.dataValue>from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget</UML:TaggedValue.dataValue>
<UML:TaggedValue.type>
<UML:TagDefinition xmi.idref = '7fbcc0f1-2d3c-513e-9dd5-3032e2da1bd1'/>
</UML:TaggedValue.type>
@@ -3295,6 +3295,15 @@
</UML:Multiplicity.range>
</UML:Multiplicity>
</UML:StructuralFeature.multiplicity>
+ <UML:ModelElement.taggedValue>
+ <UML:TaggedValue xmi.id = '-64--88--72-113-78bd338f:12edcfc60e5:-8000:0000000000000DE0'
+ isSpecification = 'false'>
+ <UML:TaggedValue.dataValue>more_link_links_to_internal</UML:TaggedValue.dataValue>
+ <UML:TaggedValue.type>
+ <UML:TagDefinition xmi.idref = 'd8173c3e-2367-5adf-9fee-a5f97447736b'/>
+ </UML:TaggedValue.type>
+ </UML:TaggedValue>
+ </UML:ModelElement.taggedValue>
<UML:StructuralFeature.type>
<UML:DataType xmi.idref = 'e85df323-29b1-5d10-98de-7c2a1c60f9da'/>
</UML:StructuralFeature.type>
@@ -5069,7 +5078,7 @@
justification="Center"
>DoormatCollection</text>
<group name="Fig16.2"
- description="org.argouml.uml.diagram.ui.FigStereotypesGroup[705, 337, 154, 0]"
+ description="org.argouml.uml.diagram.ui.FigStereotypesGroup[705, 337, 163, 0]"
href="-64--88--72-113-37f439a7:12edccb3896:-8000:0000000000000DBD"
fill="0"
fillcolor="white"
@@ -5083,7 +5092,7 @@
<rectangle name="Fig16.2.0"
x="705"
y="337"
- width="154"
+ width="163"
height="0"
fill="0"
fillcolor="white"

0 comments on commit d001973

Please sign in to comment.