Commit 16ddf07b authored by Kevin Deldycke's avatar Kevin Deldycke

Move up pre-calculated stuff for pagination to factorize code.

Hide bottom search form & results if no results found.
Add some comments to not forget bugs and ToDos.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8831 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 052174af
...@@ -93,10 +93,18 @@ ...@@ -93,10 +93,18 @@
\n \n
<tal:block tal:define="expand python: 1">\n <tal:block tal:define="expand python: 1">\n
<tal:block metal:use-macro="template/macros/ListBoxContainer">\n <tal:block metal:use-macro="template/macros/ListBoxContainer">\n
<tal:block metal:fill-slot="ListBoxBody">\n <tal:block\n
metal:fill-slot="ListBoxBody"\n
tal:define="listbox_max_lines python: int(here.getMaxLineNumber());\n
total_line python: int(here.total_size);\n
current_page python: int(here.current_page) + 1;\n
current_page_max python: listbox_max_lines * current_page;\n
current_page_start python: (listbox_max_lines * (current_page - 1)) + 1;\n
current_page_stop python: (total_line < current_page_max) and total_line or current_page_max;">\n
\n \n
<!-- top search -->\n <!-- top search -->\n
<div class="centeredInner searchBar">\n <div class="centeredInner searchBar">\n
<!-- TODO: get dynamic path here -->\n
<form method="POST" id="main_form" enctype="" tal:attributes="action python:\'erp5/medicentre/site/search/WebSite_viewSearchResult\'">\n <form method="POST" id="main_form" enctype="" tal:attributes="action python:\'erp5/medicentre/site/search/WebSite_viewSearchResult\'">\n
<input class="text" id="SearchableText" name="SearchableText" type="text" size="40"\n <input class="text" id="SearchableText" name="SearchableText" type="text" size="40"\n
tal:attributes="value search_query"/>\n tal:attributes="value search_query"/>\n
...@@ -109,25 +117,22 @@ ...@@ -109,25 +117,22 @@
<!-- result header -->\n <!-- result header -->\n
<div class="searchResultHeader">\n <div class="searchResultHeader">\n
<div>\n <div>\n
<span class="left"><em tal:content="here/field/title" tal:condition="here/field/title"/></span>\n <span class="left"><em tal:content="here/getTitle" tal:condition="here/getTitle"/></span>\n
<span class="right"\n <span class="right">\n
tal:define="listbox_max_lines python: int(here.getMaxLineNumber());\n
total_line python: int(here.total_size);\n
current_page python: int(here.current_page) + 1;\n
current_page_max python: listbox_max_lines * current_page;\n
current_page_start python: (listbox_max_lines * (current_page - 1)) + 1;\n
current_page_stop python: (total_line < current_page_max) and total_line or current_page_max;">\n
<tal:block condition="python: total_line > 0">Resultats <em tal:content="current_page_start"/> - <em tal:content="current_page_stop"/> sur un total de <em tal:content="total_line"/><tal:block tal:condition="search_query"> pour <em tal:content="search_query"/></tal:block>.</tal:block>\n <tal:block condition="python: total_line > 0">Resultats <em tal:content="current_page_start"/> - <em tal:content="current_page_stop"/> sur un total de <em tal:content="total_line"/><tal:block tal:condition="search_query"> pour <em tal:content="search_query"/></tal:block>.</tal:block>\n
<span tal:condition="python: total_line == 0" class="warning">No result !</span>\n <span tal:condition="python: total_line == 0" class="warning">No result !</span>\n
</span>\n </span>\n
</div>\n </div>\n
<div class="clear"></div>\n <div class="clear"></div>\n
</div>\n </div>\n
\n
<tal:block tal:condition="total_line">\n
\n \n
<!-- search results -->\n <!-- search results -->\n
<ul class="searchResult">\n <ul class="searchResult">\n
<li tal:repeat="line line_list" tal:define="checked_uid_set here/getCheckedUidSet">\n <li tal:repeat="line line_list" tal:define="checked_uid_set here/getCheckedUidSet">\n
<div class="typeIcon">\n <div class="typeIcon">\n
<!-- TODO: get dynamic icon here -->\n
<a href="#" title="Download original file"><img src="pictures/type-image.png"/></a>\n <a href="#" title="Download original file"><img src="pictures/type-image.png"/></a>\n
</div>\n </div>\n
<div class="detail"\n <div class="detail"\n
...@@ -153,19 +158,21 @@ ...@@ -153,19 +158,21 @@
</ul>\n </ul>\n
\n \n
<!-- result page -->\n <!-- result page -->\n
<div class="centeredInner searchPages" tal:condition="python: int(here.total_size) > int(here.getMaxLineNumber())">\n <div class="centeredInner searchPages" tal:condition="python: total_line > listbox_max_lines">\n
<p>Result Page:\n <p>Result Page:\n
<a href="#"\n <a href="#"\n
tal:repeat="p python: range(0, here.total_pages)"\n tal:repeat="p python: range(0, here.total_pages)"\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
href python: \'portal_selections/setPage?%s_page_selection=%s&amp;selection_name=%s&amp;form_id=%s&amp;listbox_uid:list=&amp;list_selection_name=%s&amp;SearchableText=%s&amp;list_start=%s&amp;reset=1\' % (field_id, p+1, selection_name, form_id, selection_name, search_query, p*int(here.getMaxLineNumber()))"/>\n href python: \'portal_selections/setPage?%s_page_selection=%s&amp;selection_name=%s&amp;form_id=%s&amp;listbox_uid:list=&amp;list_selection_name=%s&amp;SearchableText=%s&amp;list_start=%s&amp;reset=1\' % (field_id, p+1, selection_name, form_id, selection_name, search_query, p*listbox_max_lines)"/>\n
</p>\n </p>\n
</div>\n </div>\n
\n \n
<!-- bottom search -->\n <!-- bottom search -->\n
<!-- TODO: macro-ize / widget-ize this part of code (duplicate with top search) -->\n <!-- TODO: macro-ize / widget-ize this part of code (duplicate with top search) -->\n
<div class="centeredInner extendedSearchBar">\n <div class="centeredInner extendedSearchBar">\n
<!-- TODO: get dynamic path here -->\n
<!-- TODO: when switch to another page, search_query is lost -->\n
<form method="POST" id="main_form" enctype="" tal:attributes="action python:\'erp5/medicentre/site/search/WebSite_viewSearchResult\'">\n <form method="POST" id="main_form" enctype="" tal:attributes="action python:\'erp5/medicentre/site/search/WebSite_viewSearchResult\'">\n
<input class="text" id="SearchableText" name="SearchableText" type="text" size="40"\n <input class="text" id="SearchableText" name="SearchableText" type="text" size="40"\n
tal:attributes="value search_query"/>\n tal:attributes="value search_query"/>\n
...@@ -178,6 +185,8 @@ ...@@ -178,6 +185,8 @@
<a href="advanced_search">Advanced search</a>\n <a href="advanced_search">Advanced search</a>\n
</p-->\n </p-->\n
</div>\n </div>\n
\n
</tal:block>\n
\n \n
</tal:block>\n </tal:block>\n
</tal:block>\n </tal:block>\n
......
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