Commit 6117f5bc authored by Kevin Deldycke's avatar Kevin Deldycke

First dirty versions of custom page template to display listboxes in websites...

First dirty versions of custom page template to display listboxes in websites as standard table or search result list.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8594 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 49b301a2
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<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\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:define="field_id here/getId;\n
form_id python: here.getForm().id;\n
selection_name here/getSelectionName;\n
requested_selection_name here/getRequestedSelectionName;\n
selection_index here/getSelectionIndex;\n
selection here/getSelection;\n
portal_url_string here/getPortalUrlString;\n
real_context here/getContext;\n
context_url real_context/getUrl;\n
md5_string here/getMD5Checksum;\n
line_list here/query;\n
is_domain_tree_mode here/isDomainTreeMode;\n
is_report_tree_mode here/isReportTreeMode;\n
is_domain_tree_supported here/isDomainTreeSupported;\n
is_report_tree_supported here/isReportTreeSupported;\n
show_select_column here/showSelectColumn;\n
show_search_line here/showSearchLine;\n
">\n
<!-- ListBox starts here. -->\n
<input type="hidden" name="list_selection_name" value="default" tal:attributes="value selection_name" />\n
<input tal:condition="md5_string" type="hidden" name="md5_object_uid_list" value="checksum" tal:attributes="value md5_string" />\n
\n
<tal:replace tal:content="nothing">\n
Because TAL cannot accept unbalanced tags, the support for a domain tree is realized by a macro.\n
The macro ListBoxContainer is a no-op, if not in domain tree mode. Otherwise, the macro constructs\n
a domain tree and extracts the body in an extra table.\n
</tal:replace>\n
\n
<tal:block tal:define="expand python: 0">\n
<tal:block metal:define-macro="ListBoxContainer">\n
<tal:block tal:condition="expand">\n
<tal:block tal:condition="not: is_domain_tree_mode">\n
<tal:block metal:define-slot="ListBoxBody" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:define="expand python: 1">\n
<tal:block metal:use-macro="template/macros/ListBoxContainer">\n
<tal:block metal:fill-slot="ListBoxBody">\n
\n
<table class="listbox">\n
\n
<caption>\n
<div>\n
<span class="left"><em tal:content="here/field/title" tal:condition="here/field/title"/></span>\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">\n
Resultats\n
<em tal:content="current_page_start"/> -\n
<em tal:content="current_page_stop"/>\n
sur un total de <em tal:content="total_line"/>.\n
</tal:block>\n
<span tal:condition="python: total_line == 0" class="warning">No result !</span>\n
</span>\n
</div>\n
<div class="clear"></div>\n
</caption>\n
\n
<thead>\n
<tr>\n
<tal:block tal:repeat="value here/getLabelValueList">\n
<tal:block tal:define="sql python: value[0];\n
title python: value[1];\n
sort_order python: value[2]">\n
<th tal:condition="sql">\n
<a href="portal_selections/setSelectionQuickSortOrder?selection_name=default&amp;sort_on=id&amp;form_id=view"\n
tal:attributes="href string:portal_selections/setSelectionQuickSortOrder?selection_name=${selection_name}&amp;sort_on=${sql}&amp;form_id=${form_id}"\n
tal:content="title" i18n:domain="ui" i18n:translate=""/>\n
<img tal:condition="python: sort_order == \'ascending\'"\n
src="1bottomarrow.png" alt="Ascending Display" title="Ascending Display"\n
tal:attributes="src string:${portal_url_string}/images/1bottomarrow.png"\n
i18n:domain="ui" i18n:attributes="title"/>\n
<img tal:condition="python: sort_order == \'descending\'"\n
src="1toparrow.png" alt="Descending Display" title="Descending Display"\n
tal:attributes="src string:${portal_url_string}/images/1toparrow.png"\n
i18n:domain="ui" i18n:attributes="title"/>\n
</th>\n
<th tal:condition="not: sql" tal:content="title"\n
i18n:domain="ui" i18n:translate=""/>\n
</tal:block>\n
</tal:block>\n
</tr>\n
</thead>\n
\n
<tfoot tal:condition="python: int(here.total_size) > int(here.getMaxLineNumber())">\n
<tr>\n
<td tal:attributes="colspan python: len(here.getSelectedColumnList())">\n
<a class="pageNavigation"\n
tal:condition="python: here.current_page > 0"\n
href="portal_selections/firstPage:method"\n
title="First Page: page 1">\xe2\x86\x90</a>\n
<a class="pageNavigation"\n
href="portal_selections/previousPage:method"\n
tal:condition="python: here.current_page > 0"\n
tal:attributes="title python: \'Previous Page: page \' + str(here.current_page - 1)"\n
title="Previous Page: page 67">&lt;&lt;</a>\n
<select id="listbox_page_selection" name="list_start" title="Change Page" size="1"\n
onChange="submitAction(this.form, \'context/portal_selections/setPage\')"\n
tal:define="lines here/getMaxLineNumber"\n
tal:attributes="id string:${field_id}_page_selection;\n
onChange string:submitAction(this.form, \'${context_url}/portal_selections/setPage\')"\n
i18n:domain="ui" i18n:attributes="title">\n
<option\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="">\n
Page <tal:block tal:replace="python: p + 1" i18n:name="page">0</tal:block>\n
of <tal:block tal:replace="here/total_pages" i18n:name="total_pages">1</tal:block>\n
</option>\n
</select>\n
<a class="pageNavigation"\n
href="portal_selections/nextPage:method"\n
tal:condition="python: here.current_page + 1 < here.total_pages"\n
tal:attributes="title python: \'Next Page: page \' + str(here.current_page + 1)"\n
>&gt;&gt;</a>\n
<a class="pageNavigation"\n
tal:condition="python: here.current_page + 1 < here.total_pages"\n
href="portal_selections/lastPage:method"\n
tal:attributes="title python: \'Last Page: page \' + str(here.total_pages)">\xe2\x86\x92</a>\n
</td>\n
</tr>\n
</tfoot>\n
\n
<tbody>\n
<tal:block tal:repeat="line line_list" tal:define="checked_uid_set here/getCheckedUidSet">\n
<tr>\n
<tal:block tal:repeat="value line/render">\n
<tal:block tal:define="html python: value[0];\n
original_value python: value[1];\n
error python: value[2];\n
empty python: original_value in (\'\', None)">\n
<td tal:attributes="class python: empty and \'emptyCell\' or nothing">\n
<input tal:condition="not: repeat/value/index"\n
type="hidden" value="1" name="listbox_uid:list"\n
tal:attributes="value python: line.getUid() or \'\';\n
name string:${field_id}_uid:list" />\n
<tal:block tal:condition="empty">-</tal:block>\n
<tal:block tal:condition="not: empty"\n
tal:replace="structure html">value</tal:block>\n
</td>\n
</tal:block>\n
</tal:block>\n
</tr>\n
</tal:block>\n
</tbody>\n
\n
\n
</table>\n
\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
<!-- ListBox ends here. -->\n
\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>ListBox_asWebStyleHTML</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PageTemplates.ZopePageTemplate</string>
<string>ZopePageTemplate</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<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\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:define="field_id here/getId;\n
form_id python: here.getForm().id;\n
selection_name here/getSelectionName;\n
requested_selection_name here/getRequestedSelectionName;\n
selection_index here/getSelectionIndex;\n
selection here/getSelection;\n
portal_url_string here/getPortalUrlString;\n
real_context here/getContext;\n
context_url real_context/getUrl;\n
md5_string here/getMD5Checksum;\n
line_list here/query;\n
is_domain_tree_mode here/isDomainTreeMode;\n
is_report_tree_mode here/isReportTreeMode;\n
is_domain_tree_supported here/isDomainTreeSupported;\n
is_report_tree_supported here/isReportTreeSupported;\n
show_select_column here/showSelectColumn;\n
show_search_line here/showSearchLine;\n
search_query python: here.request.has_key(\'SearchableText\') and here.request[\'SearchableText\'] or \'\';\n
">\n
<!-- ListBox starts here. -->\n
<input type="hidden" name="list_selection_name" value="default" tal:attributes="value selection_name" />\n
<input tal:condition="md5_string" type="hidden" name="md5_object_uid_list" value="checksum" tal:attributes="value md5_string" />\n
\n
<tal:replace tal:content="nothing">\n
Because TAL cannot accept unbalanced tags, the support for a domain tree is realized by a macro.\n
The macro ListBoxContainer is a no-op, if not in domain tree mode. Otherwise, the macro constructs\n
a domain tree and extracts the body in an extra table.\n
</tal:replace>\n
\n
<tal:block tal:define="expand python: 0">\n
<tal:block metal:define-macro="ListBoxContainer">\n
<tal:block tal:condition="expand">\n
<tal:block tal:condition="not: is_domain_tree_mode">\n
<tal:block metal:define-slot="ListBoxBody" />\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
\n
<tal:block tal:define="expand python: 1">\n
<tal:block metal:use-macro="template/macros/ListBoxContainer">\n
<tal:block metal:fill-slot="ListBoxBody">\n
\n
<!-- top search -->\n
<div class="centeredInner searchBar">\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
tal:attributes="value search_query"/>\n
<input class="button" value="Chercher" name="WebSite_viewSearchResultList:method" type="submit"/>\n
<a href="advanced_search" class="tinyFont">Advanced search</a>\n
</form>\n
</div>\n
\n
<!-- result header -->\n
<div class="searchResultHeader">\n
<div>\n
<span class="left"><em tal:content="here/field/title" tal:condition="here/field/title"/></span>\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">\n
Resultats\n
<em tal:content="current_page_start"/> -\n
<em tal:content="current_page_stop"/>\n
sur un total de <em tal:content="total_line"/><tal:block tal:condition="search_query"> pour <em tal:content="search_query"/></tal:block>.\n
</tal:block>\n
<span tal:condition="python: total_line == 0" class="warning">No result !</span>\n
</span>\n
</div>\n
<div class="clear"></div>\n
</div>\n
\n
<!-- search results -->\n
<ul class="searchResult">\n
<li tal:repeat="line line_list" tal:define="checked_uid_set here/getCheckedUidSet">\n
<div class="typeIcon">\n
<a href="#" title="Download original file"><img src="pictures/type-image.png"/></a>\n
</div>\n
<div class="detail"\n
tal:define="line_details python: line.render();\n
html_list python: [(x[1] not in (\'\', None) and x[0] or None) for x in line_details];\n
main_link python: html_list[0];\n
context_result python: html_list[1];\n
details_links python: html_list[2:6];\n
related_links python: html_list[6:9]">\n
<h4 tal:content="structure python: main_link"/>\n
<p>\n
<tal:block tal:condition="python: context_result != None"><tal:block replace="structure python: context_result"/><br/></tal:block>\n
<span class="searchDetails">\n
<tal:block repeat="link details_links"><tal:block tal:condition="python: link != None"><tal:block replace="structure python: link"/><tal:block tal:condition="not: repeat/link/end"> - </tal:block></tal:block></tal:block>\n
</span>\n
<span class="relatedLinks">\n
<tal:block repeat="link related_links"><tal:block tal:condition="python: link != None"> - <tal:block replace="structure python: link"/></tal:block></tal:block>\n
</span>\n
</p>\n
</div>\n
<div class="clear"></div>\n
</li>\n
</ul>\n
\n
<!-- result page -->\n
<div class="centeredInner searchPages" tal:condition="python: int(here.total_size) > int(here.getMaxLineNumber())">\n
<p>Result Page:\n
<a href="#"\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:\n
\n
\n
\'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
\n
<!--\n
\n
\'portal_selections/setPage?form_id=PersonModule_viewPersonList&amp;is_list=1&amp;language_select=fr&amp;SearchableText=&amp;action_select=&amp;selection_name=person_selection&amp;list_selection_name=person_selection&amp;list_start=30&amp;title=&amp;subordination_title=&amp;description=&amp;translated_validation_state_title=&amp;listbox_uid%3Alist=77406\'"/>\n
\n
-->\n
\n
</p>\n
</div>\n
\n
<!-- bottom search -->\n
<!-- TODO: macro-ize / widget-ize this part of code (duplicate with top search) -->\n
<div class="centeredInner extendedSearchBar">\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
tal:attributes="value search_query"/>\n
<input class="button" value="Chercher" name="WebSite_viewSearchResultList:method" type="submit"/>\n
</form>\n
<p>\n
<a href="advanced_search">Search within results</a> |\n
<a href="advanced_search">Search Tips</a> |\n
<a href="advanced_search">Advanced search</a>\n
</p>\n
</div>\n
\n
</tal:block>\n
</tal:block>\n
</tal:block>\n
<!-- ListBox ends here. -->\n
\n
</tal:block>
]]></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>ListBox_asWebStyleSearchResultHTML</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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