Commit 1bc4dc93 authored by Ivan Tyagov's avatar Ivan Tyagov

Extend PT to provide additional "text" listbox navigation (i.e. list of...

Extend PT to provide  additional "text" listbox navigation (i.e. list of direct listbox page selection links, 1,2,3,4..n)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37935 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8a5f4dc0
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/> <global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -43,60 +40,64 @@ ...@@ -43,60 +40,64 @@
xmlns:tal="http://xml.zope.org/namespaces/tal"\n xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal"\n xmlns:metal="http://xml.zope.org/namespaces/metal"\n
xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n xmlns:i18n="http://xml.zope.org/namespaces/i18n">\n
<tal:block metal:define-macro="page_navigation">\n \n
<tal:block tal:condition="python: here.total_pages > 1">\n \n
<tal:block tal:condition="not: is_gadget_mode">\n <!-- First & Previous button navigation --> \n
<tal:block metal:define-macro="first_previous_page_navigation">\n
\n
<tal:block tal:condition="python: here.current_page > 0">\n <tal:block tal:condition="python: here.current_page > 0">\n
<input\n <button id="listbox_first_page" \n
id="listbox_first_page" type="image" src="2leftarrowv.png"\n type="image" src="2leftarrowv.png"\n
title="First Page" name="firstPage:method"\n title="First Page" name="firstPage:method"\n
class="listbox_first_page"\n class="listbox_first_page"\n
tal:attributes="id string:${field_id}_first_page;\n tal:attributes="id string:${field_id}_first_page;\n
name string:${field_id}_firstPage:method;\n name string:${field_id}_firstPage:method;\n
src string:${portal_url_string}/images/2leftarrowv.png"\n src string:${portal_url_string}/images/2leftarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n i18n:domain="ui" i18n:attributes="title">\n
<input\n <span class="image"/>\n
id="listbox_previous_page" type="image" src="1leftarrowv.png"\n </button>\n
<button id="listbox_previous_page" type="image" src="1leftarrowv.png"\n
title="Previous Page" name="previousPage:method"\n title="Previous Page" name="previousPage:method"\n
class="listbox_previous_page"\n class="listbox_previous_page"\n
tal:attributes="id string:${field_id}_previous_page;\n tal:attributes="id string:${field_id}_previous_page;\n
name string:${field_id}_previousPage:method;\n name string:${field_id}_previousPage:method;\n
src string:${portal_url_string}/images/1leftarrowv.png"\n src string:${portal_url_string}/images/1leftarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n i18n:domain="ui" i18n:attributes="title">\n
<span class="image"/>\n
</button>\n
\n
</tal:block>\n </tal:block>\n
<input id="listbox_set_page" name="page_start" onblur="this.value=this.defaultValue"\n \n
tal:attributes="id string:${field_id}_set_page;\n </tal:block>\n
name string:${field_id}_page_start;\n \n
value python:here.current_page + 1;\n <!-- Next & Last button navigation --> \n
size python:len(str(here.total_pages));\n <tal:block metal:define-macro="next_last_page_navigation">\n
onkeypress string:submitFormOnEnter(event, this.form, \'${field_id}_setPage\')" />\n \n
/ \n
<tal:block content="here/total_pages" />\n
<tal:block tal:condition="python: here.current_page < here.total_pages - 1">\n <tal:block tal:condition="python: here.current_page < here.total_pages - 1">\n
<input\n <button id="listbox_next_page" type="image" src="1rightarrowv.png"\n
id="listbox_next_page" type="image" src="1rightarrowv.png"\n
title="Next Page" name="nextPage:method" class="listbox_next_page"\n title="Next Page" name="nextPage:method" class="listbox_next_page"\n
tal:attributes="id string:${field_id}_next_page;\n tal:attributes="id string:${field_id}_next_page;\n
name string:${field_id}_nextPage:method;\n name string:${field_id}_nextPage:method;\n
src string:${portal_url_string}/images/1rightarrowv.png"\n src string:${portal_url_string}/images/1rightarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n i18n:domain="ui" i18n:attributes="title">\n
<input\n <span class="image"/>\n
id="listbox_last_page" type="image" src="2rightarrowv.png"\n </button>\n
<button id="listbox_last_page" type="image" src="2rightarrowv.png"\n
title="Last Page" name="lastPage:method" class="listbox_last_page"\n title="Last Page" name="lastPage:method" class="listbox_last_page"\n
tal:attributes="id string:${field_id}_last_page;\n tal:attributes="id string:${field_id}_last_page;\n
name string:${field_id}_lastPage:method;\n name string:${field_id}_lastPage:method;\n
src string:${portal_url_string}/images/2rightarrowv.png"\n src string:${portal_url_string}/images/2rightarrowv.png"\n
i18n:domain="ui" i18n:attributes="title" />\n i18n:domain="ui" i18n:attributes="title" >\n
<span class="image"/>\n
</button>\n
\n
</tal:block>\n </tal:block>\n
\n
</tal:block>\n </tal:block>\n
\n \n
<tal:block tal:condition="is_gadget_mode"\n <!-- First & Previous button navigation (asynchronous mode) --> \n
tal:define="max_lines python: here.getMaxLineNumber();\n <tal:block metal:define-macro="first_previous_page_navigation_asynchronous">\n
total_page python: here.total_pages;\n \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 <tal:block tal:condition="python: here.current_page > 0">\n
<button tal:define ="params python: {field_id+\'_firstPage:method\':\'\', \'list_style\':list_style}"\n <button tal:define ="params python: {field_id+\'_firstPage:method\':\'\', \'list_style\':list_style}"\n
title="First Page" \n title="First Page" \n
...@@ -123,15 +124,11 @@ ...@@ -123,15 +124,11 @@
<span class="image"/>\n <span class="image"/>\n
</button>\n </button>\n
</tal:block>\n </tal:block>\n
<input id="listbox_set_page" name="page_start" onblur="this.value=this.defaultValue"\n \n
tal:define="params python: {field_id+\'_setPage:method\':\'\',field_id+\'_page_start\':\'this.value\',\'list_style\':list_style}"\n </tal:block>\n
tal:attributes=\'id string:${field_id}_set_page;\n \n
name string:${field_id}_page_start;\n <!-- Next & Last button navigation (asynchronous mode) --> \n
value python:here.current_page + 1;\n <tal:block metal:define-macro="next_last_page_navigation_asynchronous">\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 <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 <button tal:define ="params python: {field_id+\'_nextPage:method\':\'\',\'page_start\':here.current_page+1,\'list_style\':list_style}"\n
title="Next Page"\n title="Next Page"\n
...@@ -154,9 +151,109 @@ ...@@ -154,9 +151,109 @@
<span class="image"/>\n <span class="image"/>\n
</button>\n </button>\n
</tal:block>\n </tal:block>\n
\n
</tal:block>\n
\n
<!-- Type in listbox navigation --> \n
<tal:block metal:define-macro="type_in_page_navigation">\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
onkeypress string:submitFormOnEnter(event, this.form, \'${field_id}_setPage\')" />\n
/ <tal:block content="here/total_pages" />\n
</tal:block>\n
\n
<!-- Type in listbox page number navigation (asyncronous) --> \n
<tal:block metal:define-macro="type_in_page_navigation_asynchronous">\n
\n
<input id="listbox_set_page" name="page_start" onblur="this.value=this.defaultValue"\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
/ <tal:block content="here/total_pages" />\n
</tal:block>\n
\n
<!-- Show list of direct listbox page selection -->\n
<tal:block metal:define-macro="text_link_page_navigation">\n
<tal:block tal:repeat="page_index page_index_list ">\n
<a tal:attributes="href python: \'%s_setPage?%s_page_start=%s&list_selection_name=%s&listbox_uid:list=[]\' %(field_id, field_id, page_index, selection_name);\n
class python: test(page_index==current_page, \'selected\', \'\');\n
title string:Page ${page_index}"\n
tal:content="page_index"/>\n
</tal:block>\n
</tal:block>\n
\n
<!-- Show list of direct listbox page selection (asynchronous) -->\n
<tal:block metal:define-macro="text_link_page_navigation_asynchronous">\n
<tal:block tal:repeat="page_index page_index_list ">\n
<a tal:define="params python: {field_id+\'_setPage:method\':\'\',field_id+\'_page_start\':page_index,\'list_style\':list_style, \'list_selection_name\':selection_name, \'listbox_uid\':[]}"\n
tal:attributes="onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,dom_id,params);\n
class python: test(page_index==current_page, \'selected\', \'\');\n
title string:Page ${page_index}"\n
tal:content="page_index"/>\n
</tal:block>\n
</tal:block>\n
\n
\n
<!-- Text navigation (i.e. 1 2 3 4 .. n links)-->\n
<tal:block metal:define-macro="text_navigation"\n
tal:define="offset python: 7;\n
all_page_index_list python: range(1, here.total_pages + 1);\n
page_index_list python: all_page_index_list[max(current_page-offset, 1)-1: min(current_page+offset, len(all_page_index_list))];">\n
\n
<!-- Non gadget mode -->\n
<tal:block tal:condition="not: is_gadget_mode">\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/first_previous_page_navigation" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/text_link_page_navigation" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/next_last_page_navigation" />\n
</tal:block>\n
\n
<!-- Gadget mode -->\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 metal:use-macro="real_context/page_navigation_render/macros/first_previous_page_navigation_asynchronous" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/text_link_page_navigation_asynchronous" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/next_last_page_navigation_asynchronous" />\n
</tal:block>\n
\n
</tal:block>\n
\n
<!-- Slider navigation with input (i.e. first, previous, next, last links)-->\n
<tal:block metal:define-macro="page_navigation">\n
<tal:block tal:condition="python: here.total_pages > 1">\n
\n
<!-- Non gadget mode -->\n
<tal:block tal:condition="not: is_gadget_mode">\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/first_previous_page_navigation" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/type_in_page_navigation" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/next_last_page_navigation" />\n
</tal:block>\n
\n
<!-- Gadget mode -->\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 metal:use-macro="real_context/page_navigation_render/macros/first_previous_page_navigation_asynchronous" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/type_in_page_navigation_asynchronous" />\n
<tal:block metal:use-macro="real_context/page_navigation_render/macros/next_last_page_navigation_asynchronous" />\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
\n
</tal:block>\n </tal:block>\n
......
971 975
\ 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