Commit 69812f77 authored by Fabien Morin's avatar Fabien Morin

unify page navigation on all listboxes. Using page_navigation_render template...

unify page navigation on all listboxes. Using page_navigation_render template (include in erp5_xhtml_style portal_skin).
page_navigation_render is composed by two part, one for gadget_mode (because we use AJAX) on the other part for all other listboxes.

To make page navigation working in gadget mode, I had to remove list_start input from tempates.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26811 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 62c90de9
......@@ -61,7 +61,13 @@
show_search_line here/showSearchLine;\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
box_relative_url python: request.get(\'box_relative_url\', \'\');\n
box python: real_context.restrictedTraverse(box_relative_url); \n
box_id python: \'visual_\'+box.getId();\n
dom_id python: request.get(\'dom_id\',None) or box_id;\n
Base_translateString python: real_context.Base_translateString;\n
">\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"\n
......@@ -75,8 +81,6 @@
<input tal:condition="python:form_id" \n
type="hidden" name="gadget_form_id"\n
tal:attributes="value form_id" />\n
<input type="hidden" name="list_start" \n
tal:attributes="value here/getLineStart" />\n
</tal:block>\n
\n
<tal:replace tal:content="nothing">\n
......
......@@ -296,38 +296,13 @@
</td>\n
</tr>\n
</tal:block>\n
<tr>\n
<td class="pageNavigation" colspan="2" style="white-space: nowrap; vertical-align: middle; text-align: right;">\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
</td>\n
</tr>\n
</table>\n
</div>\n
\n
<!-- result page -->\n
<div class="centeredInner searchPages" tal:condition="python: total_line > listbox_max_lines">\n
<p>Result Page:\n
<!-- Dirty Hack that will generate different setPage urls. This is a bug in selection_tool! -->\n
<a href="#"\n
tal:condition="python: not is_gadget_mode and field_id.strip() != \'listbox\'"\n
tal:repeat="p python: range(0, here.total_pages)"\n
tal:content="python: p+1"\n
tal:attributes="class python: p == here.current_page and \'selected\' or nothing;\n
href python: \'%s_setPage?%s_list_start=%s&amp;listbox_uid:list=&amp;list_selection_name=&amp;list_style=search\' % (field_id, field_id, p*listbox_max_lines)"/>\n
\n
<a href="#"\n
tal:condition="python: not is_gadget_mode and field_id.strip()==\'listbox\'"\n
tal:repeat="p python: range(0, here.total_pages)"\n
tal:content="python: p+1"\n
tal:attributes="class python: p == here.current_page and \'selected\' or nothing;\n
href python: \'setPage?%s_page_selection=%s&amp;selection_name=%s&amp;form_id=%s&amp;listbox_uid:list=&amp;list_selection_name=%s&amp;list_start=%s&amp;reset=1\' % (field_id, p+1, selection_name, form_id, selection_name, p*listbox_max_lines)"/>\n
\n
<tal:block tal:repeat="p python: range(0, here.total_pages)">\n
<a tal:condition="is_gadget_mode"\n
tal:define = "params python: {\'setPage:method\':\'\',\n
\'list_start\': p*listbox_max_lines, \'list_style\':\'search\'}"\n
style="cursor:pointer;"\n
tal:content="python: p+1"\n
tal:attributes="class python: p == here.current_page and \'selected\' or nothing;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,box_id,params)"/>\n
</tal:block>\n
</p>\n
</div>\n
\n
<!-- Advanced Search footer -->\n
<div class="centeredInner extendedSearchBar" tal:condition="python: not is_gadget_mode and show_search_line">\n
......
......@@ -114,53 +114,9 @@
tal:attributes="id string:${field_id}_item_number"\n
i18n:translate="" i18n:domain="ui"> - <tal:block tal:replace="python: len(here.getCheckedUidList())" i18n:name="number">0</tal:block> item(s) selected</span>\n
</td>\n
\n
<tal:block tal:condition="python: here.total_pages > 1">\n
<tal:block tal:condition="not: is_gadget_mode">\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
</td>\n
</tal:block>\n
<tal:block tal:condition="is_gadget_mode">\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n
<img tal:condition="python: here.current_page > 0"\n
style="display: block; cursor: pointer;" \n
alt="Previous Page"\n
id="listbox_previous_page" title="Previous Page" \n
src="1leftarrowv.png" name="previous"\n
tal:define ="params python: {field_id+\'_previousPage:method\':\'\'}"\n
tal:attributes="id string:${field_id}_previous_page;\n
src string:${portal_url_string}/images/1leftarrowv.png;\n
onclick python:\n
real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box_relative_url,box_id,params)"/>\n
</td>\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center">\n
<select id="listbox_page_selection" name="list_start" title="Change Page" size="1"\n
class="listbox_page_selection"\n
tal:define="params python: {field_id+\'_setPage:method\':\'\',\'list_start\':\'this.value\'};\n
lines here/getMaxLineNumber" \n
tal:attributes=\'id string:${field_id}_page_selection;\n
onChange python: real_context.KnowledgePad_generateAjaxCall(context_url+"/"+form_id,box_relative_url,box_id,params).replace("\\"this.value\\"","this.value")\'\n
i18n:domain="ui" i18n:attributes="title">\n
<option value="0"\n
tal:repeat="p python: range(0, here.total_pages)"\n
tal:attributes="selected python: p == here.current_page;\n
value python: p * lines"\n
i18n:domain="ui" i18n:translate=""><tal:block tal:replace="python: p + 1" i18n:name="page">0</tal:block> of <tal:block tal:replace="here/total_pages" i18n:name="total_pages">1</tal:block></option>\n
</select>\n
</td>\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center; padding-right:5px;">\n
<img tal:condition="python: here.current_page < here.total_pages - 1"\n
style="display:block; cursor: pointer;" alt="Previous Page"\n
id="listbox_next_page" title="Next Page" src="1rightarrowv.png" name="next"\n
class="listbox_next_page"\n
tal:define ="params python: {field_id+\'_nextPage:method\':\'\'}"\n
tal:attributes="id string:${field_id}_next_page;\n
src string:${portal_url_string}/images/1rightarrowv.png;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box_relative_url,box_id,params)"/>\n
</td>\n
</tal:block>\n
</tal:block>\n
</tr>\n
</table>\n
</div>\n
......
......@@ -57,17 +57,8 @@
title="Filter" alt="Filter" name="Base_doSelect:method"\n
type="submit" style="display: none"/>\n
\n
<input tal:condition="python:is_gadget_mode" \n
type="hidden" name="list_start" \n
tal:attributes="value here/getLineStart" />\n
\n
<tal:block tal:define="expand python: 1;\n
table_form_id request/current_form_id | form_id;\n
Base_translateString python: real_context.Base_translateString;\n
box_relative_url python: request.get(\'box_relative_url\', \'\');\n
box python: real_context.restrictedTraverse(box_relative_url); \n
box_id python: \'visual_\'+box.getId();\n
dom_id python: request.get(\'dom_id\',None) or box_id;\n
your_search_text python:here.getParamDict().get(\'your_search_text\', None)">\n
<tal:block metal:use-macro="template/macros/ListBoxContainer">\n
<tal:block metal:fill-slot="ListBoxBody">\n
......@@ -195,7 +186,7 @@
\n
<tr class ="thead">\n
<td tal:condition="python:not is_gadget_mode and show_select_column"\n
class="Data" style="width: 50px; text-align: center; vertical-align: middle;">\n
class="Data" style="width: 50px; text-align: center; vertical-align: middle;float:left;">\n
<input id="listbox_check_all" type="image"\n
name="checkAll:method" value="1"\n
src="checkall.png" alt="Check All" title="Check All"\n
......@@ -328,61 +319,9 @@
<tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
</td>\n
<!-- Page navigation for gadget mode -->\n
\n
<td class="pageNavigation"\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
<td class="pageNavigation" style="white-space: nowrap; vertical-align: middle; text-align: right;"\n
tal:attributes="colspan python: len(here.getSelectedColumnList()) + bool(show_select_column)">\n
\n
<tal:block tal:condition="python: current_page > 1">\n
<button tal:define ="params python: {field_id+\'_firstPage:method\':\'\', \'list_style\':\'table\'}"\n
title="First page: Page 1" name="firstPage"\n
type = "button" \n
tal:attributes="id string:${field_id}_first_page;\n
value string:|&lt;;\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\':\'\', \'list_style\':\'table\'}"\n
title="Previous"\n
name="previous"\n
type="button"\n
tal:attributes="title python: \'Previous Page: page %s\' % previous_page;\n
id string:${field_id}_previous_page;\n
value string:&lt;&lt;;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">&lt;&lt;</button>\n
</tal:block>\n
<select tal:define ="params python: {field_id+\'_setPage:method\':\'\',\'list_start\':\'this.value\',\'list_style\':\'table\'}"\n
title="Change Page" size="1"\n
name="changePage"\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
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 tal:define ="params python: {field_id+\'_nextPage:method\':\'\',\'list_style\':\'table\'}"\n
title="Next"\n
name="next"\n
type="button"\n
tal:attributes="title python: \'Next Page: page %s\' % 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
<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
type="button"\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
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">&gt;|</button>\n
</tal:block>\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/page_navigation" />\n
</td>\n
</tr>\n
</table>\n
......
......@@ -44,6 +44,7 @@
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="not: is_gadget_mode">\n
<tal:block tal:condition="python: here.current_page > 0">\n
<input\n
id="listbox_first_page" type="image" src="2leftarrowv.png"\n
......@@ -68,7 +69,8 @@
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
/ \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
......@@ -86,6 +88,69 @@
i18n:domain="ui" i18n:attributes="title" />\n
</tal:block>\n
</tal:block>\n
\n
<tal:block 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:block tal:condition="python: here.current_page > 0">\n
<button tal:define ="params python: {field_id+\'_firstPage:method\':\'\', \'list_style\':list_style}"\n
title="First Page" \n
name="firstPage"\n
type = "button" \n
class = "listbox_first_page"\n
tal:attributes="id string:${field_id}_first_page;\n
value string:|&lt;;\n
onclick python:\n
real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">\n
<img src="images/2leftarrowv.png"/>\n
</button>\n
<button tal:define ="params python: {field_id+\'_previousPage:method\':\'\',\'page_start\':here.current_page+1,\'list_style\':list_style}"\n
title="Previous Page"\n
name="previousPage"\n
type="button"\n
class="listbox_previous_page"\n
tal:attributes="id string:${field_id}_previous_page;\n
value string:&lt;&lt;;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">\n
\n
<img src="images/1leftarrowv.png"/>\n
</button>\n
</tal:block>\n
<input id="listbox_set_page" name="page_start"\n
tal:define="params python: {field_id+\'_setPage:method\':\'\',field_id+\'_page_start\':\'this.value\',\'list_style\':list_style}"\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
onkeypress python:"if(event.keyCode==13){" + real_context.KnowledgePad_generateAjaxCall(context_url+"/"+form_id,box,dom_id,params).replace("\\"this.value\\"","this.value")+ "return false;;}"\'/>\n
/ \n
<tal:block content="here/total_pages" />\n
<tal:block tal:condition="python: current_page < total_page">\n
<button tal:define ="params python: {field_id+\'_nextPage:method\':\'\',\'page_start\':here.current_page+1,\'list_style\':list_style}"\n
title="Next Page"\n
name="nextPage"\n
type="button"\n
class="listbox_next_page"\n
tal:attributes="id string:${field_id}_next_page;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">\n
<img src="images/1rightarrowv.png"/>\n
</button>\n
<button tal:define ="params python: {field_id+\'_lastPage:method\':\'\',\'total_size\':int(here.total_size), \'list_style\':list_style}"\n
title="Last Page"\n
name="lastPage"\n
type="button"\n
class="listbox_last_page"\n
tal:attributes="id string:${field_id}_last_page;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params)">\n
<img src="images/2rightarrowv.png"/>\n
</button>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
......
739
\ No newline at end of file
740
\ 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