Commit d22ccfd2 authored by Fabien Morin's avatar Fabien Morin

improve page navigation. Now it use a separate template, so we are able to have

the same page navigation on all listbox styles.

Make it working with gadgets
fix name and title on some buttons
force to table style in table page template
force to search style in search page template

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26762 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent f67b3c0a
...@@ -59,8 +59,8 @@ ...@@ -59,8 +59,8 @@
show_select_column here/showSelectColumn;\n show_select_column here/showSelectColumn;\n
show_anchor_column here/showAnchorColumn;\n show_anchor_column here/showAnchorColumn;\n
show_search_line here/showSearchLine;\n show_search_line here/showSearchLine;\n
list_style request/list_style | nothing;\n
is_web_mode request/is_web_mode | nothing;\n is_web_mode request/is_web_mode | nothing;\n
list_style python:request.get(\'list_style\', is_web_mode and \'table\' or None);\n
is_gadget_mode request/is_gadget_mode | nothing;">\n is_gadget_mode request/is_gadget_mode | nothing;">\n
<!-- ListBox starts here. -->\n <!-- ListBox starts here. -->\n
<input type="hidden" name="list_selection_name" value="default" tal:attributes="value selection_name" />\n <input type="hidden" name="list_selection_name" value="default" tal:attributes="value selection_name" />\n
...@@ -142,10 +142,10 @@ ...@@ -142,10 +142,10 @@
<tal:block tal:condition="python: list_style == \'search\'">\n <tal:block tal:condition="python: list_style == \'search\'">\n
<span metal:use-macro="real_context/ListBox_asSearchStyleHTML/macros/main"/>\n <span metal:use-macro="real_context/ListBox_asSearchStyleHTML/macros/main"/>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: list_style != \'search\' and is_web_mode">\n <tal:block tal:condition="python: list_style == \'table\'">\n
<span metal:use-macro="real_context/ListBox_asTableStyleHTML/macros/main"/>\n <span metal:use-macro="real_context/ListBox_asTableStyleHTML/macros/main"/>\n
</tal:block>\n </tal:block>\n
<tal:block tal:condition="python: list_style != \'search\' and not is_web_mode">\n <tal:block tal:condition="python: list_style not in (\'search\', \'table\')">\n
<span metal:use-macro="real_context/ListBox_asStandardHTML/macros/main"/>\n <span metal:use-macro="real_context/ListBox_asStandardHTML/macros/main"/>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
......
...@@ -319,7 +319,8 @@ ...@@ -319,7 +319,8 @@
\n \n
<tal:block tal:repeat="p python: range(0, here.total_pages)">\n <tal:block tal:repeat="p python: range(0, here.total_pages)">\n
<a tal:condition="is_gadget_mode"\n <a tal:condition="is_gadget_mode"\n
tal:define = "params python: {\'setPage:method\':\'\', \'list_start\': p*listbox_max_lines}"\n tal:define = "params python: {\'setPage:method\':\'\',\n
\'list_start\': p*listbox_max_lines, \'list_style\':\'search\'}"\n
style="cursor:pointer;"\n style="cursor:pointer;"\n
tal:content="python: p+1"\n tal:content="python: p+1"\n
tal:attributes="class python: p == here.current_page and \'selected\' or nothing;\n tal:attributes="class python: p == here.current_page and \'selected\' or nothing;\n
......
...@@ -118,50 +118,9 @@ ...@@ -118,50 +118,9 @@
<tal:block tal:condition="python: here.total_pages > 1">\n <tal:block tal:condition="python: here.total_pages > 1">\n
<tal:block tal:condition="not: is_gadget_mode">\n <tal:block tal:condition="not: is_gadget_mode">\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n <td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n
<tal:block tal:condition="python: here.current_page > 0">\n <tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
<input\n
id="listbox_first_page" type="image" src="2leftarrowv.png"\n
title="First Page" name="firstPage:method"\n
class="listbox_first_page"\n
tal:attributes="id string:${field_id}_first_page;\n
name string:${field_id}_firstPage:method;\n
src string:${portal_url_string}/images/2leftarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
<input\n
id="listbox_previous_page" type="image" src="1leftarrowv.png"\n
title="Previous Page" name="previousPage:method"\n
class="listbox_previous_page"\n
tal:attributes="id string:${field_id}_previous_page;\n
name string:${field_id}_previousPage:method;\n
src string:${portal_url_string}/images/1leftarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
</tal:block>\n
<input id="listbox_set_page" name="page_start" onblur="this.value=this.defaultValue"\n
tal:attributes="id string:${field_id}_set_page;\n
name string:${field_id}_page_start;\n
value python:here.current_page + 1;\n
size python:len(str(here.total_pages));\n
onkeyup string:submitFormOnEnter(event, this.form, \'${field_id}_setPage\')" />\n
/ <tal:block content="here/total_pages" />\n
<tal:block tal:condition="python: here.current_page < here.total_pages - 1">\n
<input\n
id="listbox_next_page" type="image" src="1rightarrowv.png"\n
title="Next Page" name="nextPage:method" class="listbox_next_page"\n
tal:attributes="id string:${field_id}_next_page;\n
name string:${field_id}_nextPage:method;\n
src string:${portal_url_string}/images/1rightarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
<input\n
id="listbox_last_page" type="image" src="2rightarrowv.png"\n
title="Last Page" name="lastPage:method" class="listbox_last_page"\n
tal:attributes="id string:${field_id}_last_page;\n
name string:${field_id}_lastPage:method;\n
src string:${portal_url_string}/images/2rightarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
</tal:block>\n
</td>\n </td>\n
</tal:block> \n </tal:block>\n
\n
<tal:block tal:condition="is_gadget_mode">\n <tal:block tal:condition="is_gadget_mode">\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n <td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n
<img tal:condition="python: here.current_page > 0"\n <img tal:condition="python: here.current_page > 0"\n
......
...@@ -321,67 +321,34 @@ ...@@ -321,67 +321,34 @@
</tal:block>\n </tal:block>\n
</tr>\n </tr>\n
<tr tal:condition="python: int(here.total_size) > int(here.getMaxLineNumber())"\n <tr tal:condition="python: int(here.total_size) > int(here.getMaxLineNumber())"\n
class="tfoot"\n class="tfoot">\n
tal:define="max_lines python: here.getMaxLineNumber();\n <td style="white-space: nowrap; vertical-align: middle;"\n
total_page python: here.total_pages;\n tal:condition = "not: is_gadget_mode"\n
page_id python: here.current_page;\n tal:attributes="colspan python: len(here.getSelectedColumnList()) + bool(show_select_column)">\n
current_page python: page_id + 1;\n <tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
previous_page python: current_page - 1;\n
next_page python: current_page + 1;\n
">\n
<td class="pageNavigation"\n
tal:condition = "not:is_gadget_mode"\n
tal:attributes="colspan python: len(here.getSelectedColumnList()) + bool(show_select_column)">\n
<tal:block tal:condition="python: current_page > 1">\n
\n
<button title="First page: Page 1" name="firstPage:method"\n
tal:attributes="id string:${field_id}_first_page;\n
name string:${field_id}_firstPage:method;">|&lt;</button>\n
<button name="previousPage:method"\n
tal:attributes="title python: \'Previous Page: page %s\' % previous_page;\n
id string:${field_id}_previous_page;\n
name string:${field_id}_previousPage:method;">&lt;&lt;</button>\n
</tal:block>\n
<select\n
name="list_start" title="Change Page" size="1"\n
tal:attributes="id string:${field_id}_page_selection;\n
name string:${field_id}_list_start;\n
onChange string:submitAction(this.form, \'${context_url}/${field_id}_setPage\')"\n
i18n:domain="ui" i18n:attributes="title">\n
<option\n
tal:repeat="p python: range(total_page)"\n
tal:attributes="selected python: p == page_id;\n
value python: p * max_lines"\n
i18n:domain="ui" i18n:translate="">Page <tal:block tal:replace="python: p + 1" i18n:name="page">0</tal:block> of <tal:block tal:replace="total_page" i18n:name="total_pages">1</tal:block></option>\n
</select>\n
<tal:block tal:condition="python: current_page < total_page">\n
<button\n
name="nextPage:method"\n
tal:attributes="title python: Base_translateString(\'Next page: Page ${next_page}\', mapping={\'next_page\': next_page});\n
id string:${field_id}_next_page;\n
name string:${field_id}_nextPage:method;">&gt;&gt;</button>\n
<button\n
name="lastPage:method"\n
tal:attributes="title python: Base_translateString(\'Last page: Page ${total_page}\', mapping={\'total_page\': total_page});\n
id string:${field_id}_last_page;\n
name string:${field_id}_lastPage:method;">&gt;|</button>\n
</tal:block>\n
</td>\n </td>\n
\n
<!-- Page navigation for gadget mode -->\n <!-- Page navigation for gadget mode -->\n
\n \n
<td class="pageNavigation"\n <td class="pageNavigation"\n
tal:condition = "is_gadget_mode"\n tal:condition = "is_gadget_mode"\n
tal:define="max_lines python: here.getMaxLineNumber();\n
total_page python: here.total_pages;\n
page_id python: here.current_page;\n
current_page python: page_id + 1;\n
previous_page python: current_page - 1;\n
next_page python: current_page + 1;"\n
tal:attributes="colspan python: len(here.getSelectedColumnList()) + bool(show_select_column)">\n tal:attributes="colspan python: len(here.getSelectedColumnList()) + bool(show_select_column)">\n
\n \n
<tal:block tal:condition="python: current_page > 1">\n <tal:block tal:condition="python: current_page > 1">\n
<button tal:define ="params python: {field_id+\'_firstPage:method\':\'\'}"\n <button tal:define ="params python: {field_id+\'_firstPage:method\':\'\', \'list_style\':\'table\'}"\n
title="First page: Page 1" name="firstPage"\n title="First page: Page 1" name="firstPage"\n
name = firstPage"\n
type = "button" \n type = "button" \n
tal:attributes="id string:${field_id}_first_page;\n tal:attributes="id string:${field_id}_first_page;\n
value string:|&lt;;\n value string:|&lt;;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">|&lt;</button>\n onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">|&lt;</button>\n
<button tal:define ="params python: {field_id+\'_previousPage:method\':\'\'}"\n <button tal:define ="params python: {field_id+\'_previousPage:method\':\'\', \'list_style\':\'table\'}"\n
title="Previous"\n
name="previous"\n name="previous"\n
type="button"\n type="button"\n
tal:attributes="title python: \'Previous Page: page %s\' % previous_page;\n tal:attributes="title python: \'Previous Page: page %s\' % previous_page;\n
...@@ -389,8 +356,9 @@ ...@@ -389,8 +356,9 @@
value string:&lt;&lt;;\n value string:&lt;&lt;;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">&lt;&lt;</button>\n onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">&lt;&lt;</button>\n
</tal:block>\n </tal:block>\n
<select tal:define ="params python: {field_id+\'_setPage:method\':\'\',\'list_start\':\'this.value\'}"\n <select tal:define ="params python: {field_id+\'_setPage:method\':\'\',\'list_start\':\'this.value\',\'list_style\':\'table\'}"\n
title="Change Page" size="1"\n title="Change Page" size="1"\n
name="changePage"\n
tal:attributes=\'id string:${field_id}_page_selection;\n tal:attributes=\'id string:${field_id}_page_selection;\n
onChange python: real_context.KnowledgePad_generateAjaxCall(context_url+"/"+form_id,box,dom_id,params).replace("\\"this.value\\"","this.value")\'\n onChange python: real_context.KnowledgePad_generateAjaxCall(context_url+"/"+form_id,box,dom_id,params).replace("\\"this.value\\"","this.value")\'\n
i18n:domain="ui" i18n:attributes="title">\n i18n:domain="ui" i18n:attributes="title">\n
...@@ -401,13 +369,15 @@ ...@@ -401,13 +369,15 @@
i18n:domain="ui" i18n:translate="">Page <tal:block tal:replace="python: p + 1" i18n:name="page">0</tal:block> of <tal:block tal:replace="total_page" i18n:name="total_pages">1</tal:block></option>\n i18n:domain="ui" i18n:translate="">Page <tal:block tal:replace="python: p + 1" i18n:name="page">0</tal:block> of <tal:block tal:replace="total_page" i18n:name="total_pages">1</tal:block></option>\n
</select>\n </select>\n
<tal:block tal:condition="python: current_page < total_page">\n <tal:block tal:condition="python: current_page < total_page">\n
<button tal:define ="params python: {field_id+\'_nextPage:method\':\'\'}"\n <button tal:define ="params python: {field_id+\'_nextPage:method\':\'\',\'list_style\':\'table\'}"\n
title="Next"\n
name="next"\n name="next"\n
type="button"\n type="button"\n
tal:attributes="title python: \'Next Page: page %s\' % next_page;\n tal:attributes="title python: \'Next Page: page %s\' % next_page;\n
id string:${field_id}_next_page;\n id string:${field_id}_next_page;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">&gt;&gt;</button>\n onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">&gt;&gt;</button>\n
<button tal:define ="params python: {field_id+\'_lastPage:method\':\'\',\'total_size\':int(here.total_size)}"\n <button tal:define ="params python: {field_id+\'_lastPage:method\':\'\',\'total_size\':int(here.total_size), \'list_style\':\'table\'}"\n
title="Last Page"\n
name="lastPage"\n name="lastPage"\n
type="button"\n type="button"\n
tal:attributes="title python: Base_translateString(\'Last page: Page ${total_page}\', mapping={\'total_page\': total_page});\n tal:attributes="title python: Base_translateString(\'Last page: Page ${total_page}\', mapping={\'total_page\': total_page});\n
...@@ -416,8 +386,6 @@ ...@@ -416,8 +386,6 @@
</tal:block>\n </tal:block>\n
</td>\n </td>\n
</tr>\n </tr>\n
\n
\n
</table>\n </table>\n
\n \n
<!-- Advanced Search footer -->\n <!-- Advanced Search footer -->\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<tal:block tal:replace="nothing"\n
xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<tal:block metal:define-macro="page_navigation">\n
<tal:block tal:condition="python: here.current_page > 0">\n
<input\n
id="listbox_first_page" type="image" src="2leftarrowv.png"\n
title="First Page" name="firstPage:method"\n
class="listbox_first_page"\n
tal:attributes="id string:${field_id}_first_page;\n
name string:${field_id}_firstPage:method;\n
src string:${portal_url_string}/images/2leftarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
<input\n
id="listbox_previous_page" type="image" src="1leftarrowv.png"\n
title="Previous Page" name="previousPage:method"\n
class="listbox_previous_page"\n
tal:attributes="id string:${field_id}_previous_page;\n
name string:${field_id}_previousPage:method;\n
src string:${portal_url_string}/images/1leftarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
</tal:block>\n
<input id="listbox_set_page" name="page_start" onblur="this.value=this.defaultValue"\n
tal:attributes="id string:${field_id}_set_page;\n
name string:${field_id}_page_start;\n
value python:here.current_page + 1;\n
size python:len(str(here.total_pages));\n
onkeyup string:submitFormOnEnter(event, this.form, \'${field_id}_setPage\')" />\n
/ <tal:block content="here/total_pages" />\n
<tal:block tal:condition="python: here.current_page < here.total_pages - 1">\n
<input\n
id="listbox_next_page" type="image" src="1rightarrowv.png"\n
title="Next Page" name="nextPage:method" class="listbox_next_page"\n
tal:attributes="id string:${field_id}_next_page;\n
name string:${field_id}_nextPage:method;\n
src string:${portal_url_string}/images/1rightarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
<input\n
id="listbox_last_page" type="image" src="2rightarrowv.png"\n
title="Last Page" name="lastPage:method" class="listbox_last_page"\n
tal:attributes="id string:${field_id}_last_page;\n
name string:${field_id}_lastPage:method;\n
src string:${portal_url_string}/images/2rightarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
]]></string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>page_navigation_render</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
735 736
\ 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