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 ...@@ -76,17 +76,6 @@ from AccessControl import getSecurityManager\n
sm = getSecurityManager()\n sm = getSecurityManager()\n
u = sm.getUser()\n u = sm.getUser()\n
\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 kw[\'portal_type\'] = context.getPortalDocumentTypeList()\n
res = context.portal_catalog(**kw)\n res = context.portal_catalog(**kw)\n
res = [r.getObject() for r in res]\n res = [r.getObject() for r in res]\n
...@@ -142,19 +131,13 @@ return res\n ...@@ -142,19 +131,13 @@ return res\n
<string>sm</string> <string>sm</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>u</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>context</string>
<string>_write_</string>
<string>_apply_</string> <string>_apply_</string>
<string>res</string> <string>res</string>
<string>append</string> <string>append</string>
<string>$append0</string> <string>$append0</string>
<string>_getiter_</string>
<string>r</string> <string>r</string>
<string>o</string> <string>o</string>
</tuple> </tuple>
......
...@@ -90,7 +90,10 @@ ...@@ -90,7 +90,10 @@
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list/> <list>
<string>listbox_creation_date</string>
<string>listbox_modification_date</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -381,11 +381,11 @@ ...@@ -381,11 +381,11 @@
<string>language</string> <string>language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatCreationDate</string> <string>creation_date</string>
<string>Created</string> <string>Created</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatModificationDate</string> <string>modification_date</string>
<string>Modified</string> <string>Modified</string>
</tuple> </tuple>
</list> </list>
...@@ -402,7 +402,12 @@ ...@@ -402,7 +402,12 @@
<item> <item>
<key> <string>default_params</string> </key> <key> <string>default_params</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>limit</string>
<string>10</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
...@@ -426,7 +431,16 @@ ...@@ -426,7 +431,16 @@
<item> <item>
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <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> </value>
</item> </item>
<item> <item>
...@@ -534,7 +548,7 @@ ...@@ -534,7 +548,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Recently added content</string> </value> <value> <string>10 newest items</string> </value>
</item> </item>
<item> <item>
<key> <string>url_columns</string> </key> <key> <string>url_columns</string> </key>
......
...@@ -90,7 +90,10 @@ ...@@ -90,7 +90,10 @@
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list/> <list>
<string>listbox_creation_date</string>
<string>listbox_modification_date</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -342,11 +342,11 @@ ...@@ -342,11 +342,11 @@
<string>Language</string> <string>Language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatCreationDate</string> <string>creation_date</string>
<string>Created</string> <string>Created</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatModificationDate</string> <string>modification_date</string>
<string>Modified</string> <string>Modified</string>
</tuple> </tuple>
</list> </list>
...@@ -389,11 +389,11 @@ ...@@ -389,11 +389,11 @@
<string>Language</string> <string>Language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatCreationDate</string> <string>creation_date</string>
<string>Created</string> <string>Created</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatModificationDate</string> <string>modification_date</string>
<string>Modified</string> <string>Modified</string>
</tuple> </tuple>
</list> </list>
...@@ -434,7 +434,16 @@ ...@@ -434,7 +434,16 @@
<item> <item>
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <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> </value>
</item> </item>
<item> <item>
...@@ -553,11 +562,11 @@ ...@@ -553,11 +562,11 @@
<string>language</string> <string>language</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatCreationDate</string> <string>creation_date</string>
<string>Created</string> <string>Created</string>
</tuple> </tuple>
<tuple> <tuple>
<string>Base_formatModificationDate</string> <string>modification_date</string>
<string>Modified</string> <string>Modified</string>
</tuple> </tuple>
</list> </list>
......
448 449
\ No newline at end of file \ 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