Skip to content
Browse files

* Date now is shown

  • Loading branch information...
1 parent 1388a30 commit 56f705551b19c3f3dfbcd77a4bb9b0a3362ac371 Alessandro Vermeulen committed Mar 23, 2011
View
55 Products/Doormat/browser/views.py
@@ -7,6 +7,7 @@
from zope.interface import implements
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin
+from zope.component import getMultiAdapter
from pprint import pprint
class DoormatView(BrowserView):
@@ -79,21 +80,26 @@ def getDoormatData(self):
elif item.portal_type == "Document":
text = item.getText()
elif item.portal_type == "DoormatCollection":
- if item.limit > 0:
- results = item.getCollection().queryCatalog(sort_limit=item.limit)[:item.limit]
- else:
- results = item.getCollection().queryCatalog()
+ results = self.getCollection(item)
+ # Add links from collections
for nitem in results:
- obj = nitem.getObject()
- link_dict = {
+ obj = nitem.getObject()
+
+ if (item.showTime):
+ title = self.localizedTime(obj.modified()) + ' - ' + obj.title
+ else:
+ title = obj.title
+
+
+ section_links.append({
'content': '',
'link_url': obj.absolute_url(),
- 'link_title': obj.title,
- 'link_class': 'collection',
- }
- section_links.append(link_dict)
+ 'link_title': title,
+ 'link_class': 'collection-item',
+ })
+ # Add the read more link if it is specified
if item.getShowMoreLink():
section_links.append({
'content': '',
@@ -120,25 +126,16 @@ 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)
-
+ def getCollection(self, item):
+ if item.limit > 0:
+ results = item.getCollection().queryCatalog(sort_limit=item.limit)[:item.limit]
+ else:
+ results = item.getCollection().queryCatalog()
+
+ return results
+
+ def localizedTime(self, time):
+ return getMultiAdapter((self.context, self.request), name="plone").toLocalizedTime(time)
##code-section module-footer #fill in your manual code here
##/code-section module-footer
View
8 Products/Doormat/content/DoormatCollection.py
@@ -65,6 +65,14 @@
i18n_domain='Doormat',
),
),
+ BooleanField(
+ name='showTime',
+ widget=BooleanField._properties['widget'](
+ label='Showtime',
+ label_msgid='Doormat_label_showTime',
+ i18n_domain='Doormat',
+ ),
+ ),
),
)
View
5 Products/Doormat/i18n/generated.pot
@@ -52,6 +52,11 @@ msgstr ""
msgid "Doormat_label_showMoreText"
msgstr ""
+#. Default: "Showtime"
+#: content/DoormatCollection.py
+msgid "Doormat_label_showTime"
+msgstr ""
+
#. Default: "Show title in Doormat"
#: content/DoormatMixin.py
msgid "Doormat_label_showTitle"
View
4 Products/Doormat/profiles/default/import_steps.xml
@@ -8,7 +8,7 @@
id="Doormat-Update-RoleMappings"
handler="Products.Doormat.setuphandlers.updateRoleMappings"
title="Update Workflow role mappings for Doormat"
- version="2011-03-22T22:00:08.464499">
+ version="2011-03-23T10:38:49.700908">
<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-22T22:00:08.464499">
+ version="2011-03-23T10:38:49.700908">
<dependency step="Doormat-QI-dependencies"/>
manual coded post-install for Doormat
</import-step>
View
2 Products/Doormat/profiles/default/metadata.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
- <version>0.6.12</version>
+ <version>0.6.13</version>
<!-- ##code-section METADATA -->
<!-- ##/code-section METADATA -->
</metadata>
View
4 Products/Doormat/profiles/default/types/DoormatCollection.xml
@@ -4,7 +4,7 @@
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
- <property name="title" i18n:translate="">DoormataCollection</property>
+ <property name="title" i18n:translate="">DoormatCollection</property>
<property name="description" i18n:translate=""></property>
<property name="content_icon">DoormatCollection.gif</property>
<property name="content_meta_type">DoormatCollection</property>
@@ -41,4 +41,4 @@
visible="True">
<permission value="Modify portal content"/>
</action>
-</object>
+</object>
View
71 uml/doormat.uml
@@ -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 22:00:03 CET 2011'>
+<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML' timestamp = 'Wed Mar 23 10:38:31 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>
@@ -3338,6 +3338,21 @@
<UML:DataType xmi.idref = 'e12f147a-d786-5cd7-a838-1bd9f02fdbf4'/>
</UML:StructuralFeature.type>
</UML:Attribute>
+ <UML:Attribute xmi.id = '-64--88--72-113-78bd338f:12edcfc60e5:-8000:0000000000001361'
+ name = 'showTime' visibility = 'public' isSpecification = 'false' ownerScope = 'instance'
+ changeability = 'changeable' targetScope = 'instance'>
+ <UML:StructuralFeature.multiplicity>
+ <UML:Multiplicity xmi.id = '-64--88--72-113-78bd338f:12edcfc60e5:-8000:0000000000001362'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '-64--88--72-113-78bd338f:12edcfc60e5:-8000:0000000000001363'
+ lower = '1' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:StructuralFeature.multiplicity>
+ <UML:StructuralFeature.type>
+ <UML:DataType xmi.idref = '16a8d020-4c0a-58ce-993f-e6306abf0bbf'/>
+ </UML:StructuralFeature.type>
+ </UML:Attribute>
</UML:Classifier.feature>
</UML:Class>
<UML:Generalization xmi.id = '-64--88--72-113-7b84db25:12edce22535:-8000:0000000000001356'
@@ -5056,7 +5071,7 @@
</path>
</group>
<group name="Fig16"
- description="org.argouml.uml.diagram.static_structure.ui.FigClass[704, 336, 158, 117]pathVisible=false;stereotypeView=0;operationsVisible=true;attributesVisible=true;"
+ description="org.argouml.uml.diagram.static_structure.ui.FigClass[704, 336, 170, 133]pathVisible=true;stereotypeView=0;operationsVisible=true;attributesVisible=true;"
href="-64--88--72-113-37f439a7:12edccb3896:-8000:0000000000000DBD"
fill="1"
fillcolor="white"
@@ -5069,8 +5084,8 @@
<rectangle name="Fig16.0"
x="704"
y="336"
- width="158"
- height="117"
+ width="170"
+ height="133"
fill="1"
fillcolor="white"
stroke="1"
@@ -5079,7 +5094,7 @@
<text name="Fig16.1"
x="705"
y="337"
- width="156"
+ width="168"
height="22"
fill="0"
fillcolor="white"
@@ -5091,7 +5106,7 @@
bold="false"
textsize="12"
justification="Center"
- >DoormatCollection</text>
+ >content::DoormatCollection</text>
<group name="Fig16.2"
description="org.argouml.uml.diagram.ui.FigStereotypesGroup[705, 337, 163, 0]"
href="-64--88--72-113-37f439a7:12edccb3896:-8000:0000000000000DBD"
@@ -5118,15 +5133,15 @@
<rectangle name="Fig16.3"
x="704"
y="359"
- width="158"
+ width="170"
height="1"
fill="1"
fillcolor="black"
stroke="1"
strokecolor="black"
/>
<group name="Fig16.4"
- description="org.argouml.uml.diagram.ui.FigAttributesCompartment[705, 360, 156, 72]"
+ description="org.argouml.uml.diagram.ui.FigAttributesCompartment[705, 360, 168, 88]"
href="-64--88--72-113-37f439a7:12edccb3896:-8000:0000000000000DBD"
fill="0"
fillcolor="white"
@@ -5139,8 +5154,8 @@
<rectangle name="Fig16.4.0"
x="705"
y="360"
- width="156"
- height="72"
+ width="168"
+ height="88"
fill="0"
fillcolor="white"
stroke="0"
@@ -5149,7 +5164,7 @@
<text name="Fig16.4.1"
x="705"
y="360"
- width="156"
+ width="168"
height="16"
fill="0"
fillcolor="white"
@@ -5165,7 +5180,7 @@
<text name="Fig16.4.2"
x="705"
y="376"
- width="156"
+ width="168"
height="16"
fill="0"
fillcolor="white"
@@ -5181,7 +5196,7 @@
<text name="Fig16.4.3"
x="705"
y="392"
- width="156"
+ width="168"
height="16"
fill="0"
fillcolor="white"
@@ -5197,8 +5212,8 @@
<text name="Fig16.4.4"
x="705"
y="408"
- width="156"
- height="22"
+ width="168"
+ height="16"
fill="0"
fillcolor="white"
stroke="0"
@@ -5210,19 +5225,35 @@
textsize="12"
justification="Left"
>limit : int</text>
+ <text name="Fig16.4.5"
+ x="705"
+ y="424"
+ width="168"
+ height="22"
+ fill="0"
+ fillcolor="white"
+ stroke="0"
+ strokecolor="black"
+ textcolor="black"
+ font="Dialog"
+ italic="false"
+ bold="false"
+ textsize="12"
+ justification="Left"
+ >showTime : boolean</text>
</group>
<rectangle name="Fig16.5"
x="704"
- y="431"
- width="158"
+ y="447"
+ width="170"
height="1"
fill="1"
fillcolor="black"
stroke="1"
strokecolor="black"
/>
<group name="Fig16.6"
- description="org.argouml.uml.diagram.ui.FigOperationsCompartment[705, 432, 156, 21]"
+ description="org.argouml.uml.diagram.ui.FigOperationsCompartment[705, 448, 168, 21]"
href="-64--88--72-113-37f439a7:12edccb3896:-8000:0000000000000DBD"
fill="0"
fillcolor="white"
@@ -5234,8 +5265,8 @@
<rectangle name="Fig16.6.0"
x="705"
- y="432"
- width="156"
+ y="448"
+ width="168"
height="21"
fill="0"
fillcolor="white"

0 comments on commit 56f7055

Please sign in to comment.
Something went wrong with that request. Please try again.