Commit 34f259ec authored by Bartek Górny's avatar Bartek Górny

fixed sorting by date fields; limited newest content to 10 items

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12388 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 45e70680
......@@ -76,17 +76,6 @@ from AccessControl import getSecurityManager\n
sm = getSecurityManager()\n
u = sm.getUser()\n
\n
# XXX what\'s the correct way to format date and allow sorting on it?\n
new_sort = []\n
if kw.has_key(\'sort_on\'):\n
for i in range(len(kw[\'sort_on\'])):\n
key = kw[\'sort_on\'][i]\n
if key[0] == \'Base_formatCreationDate\':\n
new_sort.append((\'creation_date\', key[1]))\n
if key[0] == \'Base_formatModificationDate\':\n
new_sort.append((\'modification_date\', key[1]))\n
kw[\'sort_on\'] = new_sort\n
\n
kw[\'portal_type\'] = context.getPortalDocumentTypeList()\n
res = context.portal_catalog(**kw)\n
res = [r.getObject() for r in res]\n
......@@ -142,19 +131,13 @@ return res\n
<string>sm</string>
<string>_getattr_</string>
<string>u</string>
<string>new_sort</string>
<string>_getiter_</string>
<string>range</string>
<string>len</string>
<string>_getitem_</string>
<string>i</string>
<string>key</string>
<string>_write_</string>
<string>context</string>
<string>_write_</string>
<string>_apply_</string>
<string>res</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>r</string>
<string>o</string>
</tuple>
......
......@@ -90,7 +90,10 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
<list>
<string>listbox_creation_date</string>
<string>listbox_modification_date</string>
</list>
</value>
</item>
<item>
......
......@@ -381,11 +381,11 @@
<string>language</string>
</tuple>
<tuple>
<string>Base_formatCreationDate</string>
<string>creation_date</string>
<string>Created</string>
</tuple>
<tuple>
<string>Base_formatModificationDate</string>
<string>modification_date</string>
<string>Modified</string>
</tuple>
</list>
......@@ -402,7 +402,12 @@
<item>
<key> <string>default_params</string> </key>
<value>
<list/>
<list>
<tuple>
<string>limit</string>
<string>10</string>
</tuple>
</list>
</value>
</item>
<item>
......@@ -426,7 +431,16 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>creation_date</string>
<string>creation_date</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
</tuple>
</list>
</value>
</item>
<item>
......@@ -534,7 +548,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Recently added content</string> </value>
<value> <string>10 newest items</string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
......
......@@ -90,7 +90,10 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
<list>
<string>listbox_creation_date</string>
<string>listbox_modification_date</string>
</list>
</value>
</item>
<item>
......
......@@ -342,11 +342,11 @@
<string>Language</string>
</tuple>
<tuple>
<string>Base_formatCreationDate</string>
<string>creation_date</string>
<string>Created</string>
</tuple>
<tuple>
<string>Base_formatModificationDate</string>
<string>modification_date</string>
<string>Modified</string>
</tuple>
</list>
......@@ -389,11 +389,11 @@
<string>Language</string>
</tuple>
<tuple>
<string>Base_formatCreationDate</string>
<string>creation_date</string>
<string>Created</string>
</tuple>
<tuple>
<string>Base_formatModificationDate</string>
<string>modification_date</string>
<string>Modified</string>
</tuple>
</list>
......@@ -434,7 +434,16 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>creation_date</string>
<string>creation_date</string>
</tuple>
<tuple>
<string>modification_date</string>
<string>modification_date</string>
</tuple>
</list>
</value>
</item>
<item>
......@@ -553,11 +562,11 @@
<string>language</string>
</tuple>
<tuple>
<string>Base_formatCreationDate</string>
<string>creation_date</string>
<string>Created</string>
</tuple>
<tuple>
<string>Base_formatModificationDate</string>
<string>modification_date</string>
<string>Modified</string>
</tuple>
</list>
......
448
\ No newline at end of file
449
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment