Commit de342a90 authored by Ivan Tyagov's avatar Ivan Tyagov

Add support for gadget mode (i.e. asynchronous listbox page navigation).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23139 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d543bd9b
......@@ -41,6 +41,12 @@
</object>
</value>
</item>
<item>
<key> <string>_owner</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
......@@ -65,15 +71,27 @@
is_domain_tree_supported here/isDomainTreeSupported;\n
is_report_tree_supported here/isReportTreeSupported;\n
show_select_column here/showSelectColumn;\n
\t show_anchor_column here/showAnchorColumn;\n
\t show_anchor_column here/showAnchorColumn;\n
show_search_line here/showSearchLine;\n
">\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_%s\' %box.getId();">\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
tal:attributes="value selection_name;\n
name string:${field_id}_list_selection_name" />\n
<input tal:condition="md5_string" type="hidden" name="md5_object_uid_list" value="checksum" tal:attributes="value md5_string" />\n
\n
<input tal:condition="python:form_id and is_gadget_mode" \n
type="hidden" name="gadget_form_id"\n
tal:attributes="value form_id" />\n
\n
<input tal:condition="python:is_gadget_mode" \n
type="hidden" name="list_start" \n
tal:attributes="value here/getLineStart" />\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
......@@ -84,7 +102,7 @@
<tal:block tal:define="expand python: 0">\n
<tal:block metal:define-macro="ListBoxContainer">\n
<tal:block tal:condition="expand">\n
<table tal:condition="is_domain_tree_mode"\n
<table tal:condition="python: not is_gadget_mode and is_domain_tree_mode"\n
style="width: 100%;" cellpadding="0" cellspacing="0"\n
summary="This table contains the domain tree with the switch button"\n
tal:define="selected_domain_path here/getSelectedDomainPath">\n
......@@ -110,7 +128,7 @@
<tal:block tal:repeat="i python: range(report_tree.depth)">\n
<td width="12" nowrap="nowrap">&nbsp;</td>\n
</tal:block>\n
\t\t <td colspan="1" style="text-align: left; vertical-align: top; white-space: nowrap;"\n
\t\t <td colspan="1" style="text-align: left; vertical-align: top; white-space: nowrap;"\n
tal:attributes="colspan python: total_depth - report_tree.depth + 1">\n
<a href="method" class="tree_open"\n
tal:condition="report_tree/is_open"\n
......@@ -162,31 +180,32 @@
<img src="spacer.png" style="width: 5px; height: 5px" alt="spacer"\n
tal:attributes="src string:${portal_url_string}/images/spacer.png" />\n
</td>\n
\t <td style="white-space: nowrap; vertical-align: middle">\n
\t <td style="white-space: nowrap; vertical-align: middle"\n
tal:condition="not: is_gadget_mode">\n
<input tal:condition="python: is_domain_tree_supported or is_report_tree_supported"\n
type="image" src="text_block.png" id="listbox_flat_list_mode"\n
title="Flat List" name="setFlatListMode:method"\n
value="1" alt="Flat List"\n
tal:attributes="src string:${portal_url_string}/images/text_block.png;\n
id string:${field_id}_flat_list_mode;\n
class string:listbox_flat_list_mode"\n
i18n:domain="ui" i18n:attributes="title" />\n
type="image" src="text_block.png" id="listbox_flat_list_mode"\n
title="Flat List" name="setFlatListMode:method"\n
value="1" alt="Flat List"\n
tal:attributes="src string:${portal_url_string}/images/text_block.png;\n
id string:${field_id}_flat_list_mode;\n
class string:listbox_flat_list_mode"\n
i18n:domain="ui" i18n:attributes="title" />\n
<input tal:condition="is_report_tree_supported"\n
type="image" src="view_tree.png" id="listbox_report_tree_mode"\n
title="Report Tree" name="setReportTreeMode:method"\n
value="1" alt="Report Tree"\n
tal:attributes="src string:${portal_url_string}/images/view_tree.png;\n
id string:${field_id}_report_tree_mode;\n
class string:listbox_report_tree_mode"\n
i18n:domain="ui" i18n:attributes="title" />\n
type="image" src="view_tree.png" id="listbox_report_tree_mode"\n
title="Report Tree" name="setReportTreeMode:method"\n
value="1" alt="Report Tree"\n
tal:attributes="src string:${portal_url_string}/images/view_tree.png;\n
id string:${field_id}_report_tree_mode;\n
class string:listbox_report_tree_mode"\n
i18n:domain="ui" i18n:attributes="title" />\n
<input tal:condition="is_domain_tree_supported"\n
type="image" src="view_choose.png" id="listbox_domain_tree_mode"\n
title="Domain Tree" name="setDomainTreeMode:method"\n
value="1" alt="Domain Tree"\n
tal:attributes="src string:${portal_url_string}/images/view_choose.png;\n
id string:${field_id}_domain_tree_mode;\n
class string:listbox_domain_tree_mode"\n
i18n:domain="ui" i18n:attributes="title" />\n
type="image" src="view_choose.png" id="listbox_domain_tree_mode"\n
title="Domain Tree" name="setDomainTreeMode:method"\n
value="1" alt="Domain Tree"\n
tal:attributes="src string:${portal_url_string}/images/view_choose.png;\n
id string:${field_id}_domain_tree_mode;\n
class string:listbox_domain_tree_mode"\n
i18n:domain="ui" i18n:attributes="title" />\n
</td>\n
<td style="width: 100%; vertical-align: middle">\n
&nbsp;\n
......@@ -203,41 +222,84 @@
class string:listbox_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
\t <td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n
<input tal:condition="python: here.current_page > 0"\n
id="listbox_previous_page" type="image" src="1leftarrowv.png"\n
title="Previous Page" name="previousPage:method"\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
class string:listbox_previous_page"\n
i18n:domain="ui" i18n:attributes="title" />\n
</td>\n
\t <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
tal:define="lines here/getMaxLineNumber"\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
class string:listbox_page_selection"\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
\t <td style="white-space: nowrap; vertical-align: middle; text-align: center">\n
<input tal:condition="python: here.current_page < here.total_pages - 1"\n
id="listbox_next_page" type="image" src="1rightarrowv.png"\n
title="Next Page" name="nextPage:method"\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
class string:listbox_next_page"\n
i18n:domain="ui" i18n:attributes="title" />\n
</td>\n
\n
<tal:block tal:condition="not: is_gadget_mode">\n
<td style="white-space: nowrap; vertical-align: middle; text-align: center;">\n
<input tal:condition="python: here.current_page > 0"\n
id="listbox_previous_page" type="image" src="1leftarrowv.png"\n
title="Previous Page" name="previousPage:method"\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
class string:listbox_previous_page"\n
i18n:domain="ui" i18n:attributes="title" />\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
tal:define="lines here/getMaxLineNumber"\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
class string:listbox_page_selection"\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">\n
<input tal:condition="python: here.current_page < here.total_pages - 1"\n
id="listbox_next_page" type="image" src="1rightarrowv.png"\n
title="Next Page" name="nextPage:method"\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
class string:listbox_next_page"\n
i18n:domain="ui" i18n:attributes="title" />\n
</td>\n
</tal:block> \n
\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,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
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
class string:listbox_page_selection;\n
onChange python: real_context.KnowledgePad_generateAjaxCall(context_url+"/"+form_id,box,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
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
class string:listbox_next_page;\n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,box_id,params)"/>\n
</td>\n
</tal:block>\n
</tr>\n
</table>\n
</div>\n
......@@ -246,7 +308,7 @@
summary="This table contains the listbox content">\n
<tr id="listbox_label_line" tal:attributes="id string:${field_id}_label_line;\n
class string:listbox_label_line">\n
<td tal:condition="is_report_tree_mode"\n
<td tal:condition="python: not is_gadget_mode and is_report_tree_mode"\n
class="Data" style="width: 50px; text-align: left; vertical-align: middle">\n
<select name="report_root_url"\n
tal:attributes="onChange string:submitAction(this.form, \'${context_url}/setReportRoot\')">\n
......@@ -259,7 +321,7 @@
</select>\n
</td>\n
<td class="AnchorColumn Data" tal:condition="show_anchor_column">&nbsp;</td>\n
<td tal:condition="show_select_column"\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
<input id="listbox_check_all" type="image"\n
name="checkAll:method" value="1"\n
......@@ -282,12 +344,21 @@
sort_order python: value[2]">\n
<td tal:condition="sql" class="Data">\n
<button type="submit" class="sort_button"\n
tal:condition="not: is_gadget_mode"\n
name="setSelectionQuickSortOrder:method"\n
tal:attributes="title string:${title}; \n
value string:${field_id}.${sql}"\n
i18n:domain="ui" i18n:attributes="title">\n
<span tal:content="title" i18n:domain="ui" i18n:translate="">ID</span>\n
</button>\n
<button tal:condition="is_gadget_mode" \n
tal:define ="params python: {\'setSelectionQuickSortOrder:method\':field_id+\'.\'+sql};"\n
type="button" class="sort_button"\n
tal:attributes="title string:${title}; \n
onclick python: real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+form_id,box,box_id,params);"\n
i18n:domain="ui" i18n:attributes="title">\n
<span tal:content="title" i18n:domain="ui" i18n:translate="">ID</span>\n
</button>\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
......@@ -308,7 +379,7 @@
<tr tal:condition="python: show_search_line or is_report_tree_mode"\n
id="listbox_search_line"\n
tal:attributes="id python: show_search_line and (\'%s_search_line\' % field_id) or (\'%s_report_depth_line\' % field_id)">\n
<tal:block tal:condition="is_report_tree_mode">\n
<tal:block tal:condition="python: not is_gadget_mode and is_report_tree_mode">\n
<td class="Data" style="width: 50px; text-align: left; vertical-align: middle" colspan="1"\n
tal:attributes="colspan python: show_search_line and 1 or (len(here.getSelectedColumnList()) + show_select_column + show_anchor_column + 1)"\n
tal:define="index python: selection_index is not None and \'&amp;selection_index=%s\' % selection_index or \'\';\n
......@@ -340,8 +411,13 @@
<span tal:condition="alias" style="font-size: -3">\n
<tal:block tal:condition="python: search_field is not None"\n
tal:replace="structure python: search_field.render(value = param, key = alias)" />\n
<input tal:condition="python: search_field is None" name="id" size="8" value=""\n
<input tal:condition="python: not is_gadget_mode and search_field is None" name="id" size="8" value=""\n
tal:attributes="name alias; value param" />\n
<input tal:condition="python: is_gadget_mode and search_field is None" \n
tal:define ="params python: {alias:\'this.value\'};"\n
size="8" type="textarea" \n
tal:attributes=\'value python: selection.getParams().get(alias,"");\n
onkeypress python:"if(event.keyCode==13){" + real_context.KnowledgePad_generateAjaxCall(context_url+"/"+form_id,box,box_id,params).replace("\\"this.value\\"","this.value")+ "return false;;}"\'/>\n
</span>\n
</td>\n
</tal:block>\n
......@@ -431,6 +507,12 @@
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>uid</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
......
584
\ No newline at end of file
585
\ 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