Commit fb1c08e7 authored by Hervé Poulain's avatar Hervé Poulain

Update the page template ListBox_asListStyleHTML to make it compatbile with more gadgets.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30372 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 5d3b0c78
......@@ -58,8 +58,17 @@ box_relative_url = kw.get(\'box_relative_url\')\n
selection_name = kw.get(\'list_selection_name\')\n
portal_selection = getattr(context,\'portal_selections\')\n
selection = portal_selection.getSelectionFor(selection_name)\n
box = context.restrictedTraverse(box_relative_url);\n
preferences = box.KnowledgeBox_getDefaultPreferencesDict()\n
\n
# XXX: This test has been added because currently the "Asynchronous" mode is\n
# the only one supported by gadgets which uses the page templates\n
# ListBox_asListStyleHTML.\n
# More investigation are required to fix this bug\n
if box_relative_url:\n
box = context.restrictedTraverse(box_relative_url)\n
preferences = box.KnowledgeBox_getDefaultPreferencesDict()\n
else:\n
preferences = {}\n
\n
feed_url = str(preferences.get(\'preferred_rss_feed\',\'\'))\n
username = str(preferences.get(\'preferred_username\',\'\'))\n
password = str(preferences.get(\'preferred_password\',\'\'))\n
......
......@@ -59,6 +59,7 @@ params = selection.getParams()\n
readItemList = params.get(\'rss_read_item:list\', {})\n
readItemList[item]=\'\'\n
params[\'rss_read_item:list\'] = readItemList\n
portal_selection.setSelectionParamsFor(selection_name, {\'rss_read_item:list\':params[\'rss_read_item:list\']})\n
</string> </value>
</item>
<item>
......@@ -105,6 +106,7 @@ params[\'rss_read_item:list\'] = readItemList\n
<string>params</string>
<string>readItemList</string>
<string>_write_</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
......
......@@ -91,7 +91,9 @@
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
<list>
<string>listbox_field_img</string>
</list>
</value>
</item>
<item>
......
......@@ -235,13 +235,19 @@
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>list_action</string> </key>
<value> <string></string> </value>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>list_method</string> </key>
......@@ -267,6 +273,10 @@
<key> <string>report_tree</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <string></string> </value>
......@@ -282,7 +292,7 @@
<item>
<key> <string>selection_name</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
......@@ -303,6 +313,12 @@
</item>
<item>
<key> <string>title</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>untranslatable_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
......@@ -400,7 +416,16 @@
<item>
<key> <string>editable_columns</string> </key>
<value>
<list/>
<list>
<tuple>
<string>field_img</string>
<string>field_img</string>
</tuple>
<tuple>
<string>field_date</string>
<string>field_date</string>
</tuple>
</list>
</value>
</item>
<item>
......@@ -421,6 +446,10 @@
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>5</int> </value>
......@@ -432,7 +461,7 @@
<item>
<key> <string>list_method</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
......@@ -461,6 +490,10 @@
<key> <string>report_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
......@@ -477,7 +510,7 @@
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
<value> <string>rss_reader</string> </value>
</item>
<item>
<key> <string>sort</string> </key>
......@@ -506,11 +539,26 @@
<value> <string>Rss reader</string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<key> <string>untranslatable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value>
<list>
<tuple>
<string>field_date</string>
<string></string>
</tuple>
<tuple>
<string>field_img</string>
<string></string>
</tuple>
</list>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -528,12 +576,44 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Base_getListboxGadgetSelectionName(context.REQUEST.get(\'box_relative_url\', \'\'))</string> </value>
<value> <string>python: \'%s\' % context.REQUEST.get(\'rss_link\', \'Rss Link Error\').encode(\'utf-8\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Base_getListboxGadgetSelectionName(context.REQUEST.get(\'box_relative_url\', \'\'))</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: \'%s\' % context.REQUEST.get(\'rss_title\', \'Rss Title Error\').encode(\'utf-8\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ImageField" module="Products.ERP5Form.ImageField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_field_img</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_display</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_format</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_resolution</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_display</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_format</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_resolution</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>left</string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>87</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>image_display</string> </key>
<value> <string>thumbnail</string> </value>
</item>
<item>
<key> <string>image_format</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_resolution</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>listbox_field_img</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: (lambda x: (len(x) and x[0]) or None)(cell.field_img)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -48,13 +48,12 @@
line_start python: here.getLineStart();\n
real_context here/getContext;\n
context_url real_context/absolute_url;\n
box_relative_url python: request.get(\'box_relative_url\', \'\');\n
line_list here/query;\n
selection_params python: here.getSelection().getParams();\n
read_item_list python:selection_params.get(\'rss_read_item:list\', {});\n
read_items_count python:len(read_item_list);\n
rss_title python:request.get(\'rss_title\',\'\');\n
rss_link python:request.get(\'rss_link\',None);\n
rss_title here/getTitle;\n
rss_link here/getListActionUrl;\n
rss_logo python:request.get(\'rss_logo\',None);\n
search_text python: selection_params.get(\'search_text\', \'\');\n
show_select_column here/showSelectColumn;\n
......@@ -76,6 +75,7 @@
dom_id python: request.get(\'dom_id\',None) or box_id;\n
is_gadget_mode request/is_gadget_mode | nothing;\n
list_style python:request.get(\'list_style\', None);\n
field_key_list python:[\'field_title\',\'field_date\',\'field_content\',\'field_img\',\'field_link\',\'field_others_links\',\'field_md5\',\'field_sender\'];\n
dummy python: context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \n
\'text/html;; charset=utf-8\');"\n
metal:define-macro="main">\n
......@@ -140,40 +140,48 @@
\n
<ul>\n
<tal:block tal:repeat="line line_list">\n
<li tal:define="value line/getBrain"\n
tal:attributes="id python: (getattr(value,\'field_img\',None) and \'with_img\') or \'\';">\n
<li tal:define="value_dict python:{}.fromkeys(field_key_list);\n
html_dict python:{}.fromkeys(field_key_list);\n
empty python:value_dict.update(zip(here.getColumnAliasList(), [i[0] for i in line.getValueList()]));\n
empty python:html_dict.update(zip(here.getColumnAliasList(), [i[0] for i in line.render()]));"\n
tal:attributes="id python:(value_dict[\'field_img\'] and \'with_img\') or \'\';">\n
<input tal:condition="not: repeat/line/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
<img alt="" width="87" class="left" tal:condition="python: getattr(value,\'field_img\',None)" tal:attributes="src python: value.field_img[0]"/>\n
<div onmouseover="this.style.backgroundColor=\'#ECECEC\';" \n
<div onmouseover="this.style.backgroundColor=\'#ECECEC\';"\n
onmouseout="this.style.backgroundColor=\'inherit\';"\n
tal:attributes="id python: (getattr(value,\'field_img\',None) and \'title_img\') or \'title\';\n
class python:value.field_md5 in read_item_list and \'read\' or \'\';\n
title python:getattr(value,\'field_sender\',\'\');\n
onclick python:\'if(this.className!=\\\'read\\\'){MochiKit.Async.doSimpleXMLHttpRequest(\\\'Base_setRssItemReadInSelection\\\', {\\\'selection_name\\\':\\\'\'+selection_name+\'\\\',\\\'item\\\':\\\'\'+value.field_md5+\'\\\'});;this.className=\\\'read\\\';;\'+real_context.KnowledgePad_generateAjaxCall(context_url+\'/\'+\'Base_formatRssTitleWithUnreadItemCount\',box,\'rss_title_\'+box.getId(),{\'rss_title\':rss_title,\'total_line\':total_line,\'selection_name\':selection_name})+\'}toggle(\\\'description_\'+box.getId()+\'_\'+str(repeat[\'line\'].index)+\'\\\');;\'">\n
<span tal:content="value/field_title">value</span>\n
<span tal:condition="python:getattr(value,\'field_date\',None)" class="transparent" tal:content="python: \' - \'+str(getattr(value,\'field_date\',\'\'))">value</span>\n
tal:attributes="class python:value_dict[\'field_md5\'] in read_item_list and \'read\' or \'\';\n
title python:value_dict[\'field_sender\'];\n
onclick python:\'if(this.className!=\\\'read\\\'){MochiKit.Async.doSimpleXMLHttpRequest(\\\'Base_setRssItemReadInSelection\\\', {\\\'selection_name\\\':\\\'\'+selection_name+\'\\\',\\\'item\\\':\\\'\'+ \'%s\' % value_dict[\'field_md5\']+\'\\\'});;this.className=\\\'read\\\';;\'+real_context.KnowledgePad_generateAjaxCall(\'%s/Base_formatRssTitleWithUnreadItemCount\' % context_url,box,\'rss_title_\'+box.getId(),{\'rss_title\':rss_title,\'total_line\':total_line,\'selection_name\':selection_name})+\'}toggle(\\\'description_\'+box.getId()+\'_\'+str(repeat[\'line\'].index)+\'\\\');;\'">\n
<tal:block tal:condition="python:value_dict[\'field_img\']"\n
tal:content="structure python:html_dict[\'field_img\']">image</tal:block>\n
<a><span tal:content="python:value_dict[\'field_title\']">title</span>\n
<span tal:attributes="class string: transparent;"\n
tal:condition="python:value_dict[\'field_date\']"\n
tal:content="structure python:\' - %s\' % html_dict[\'field_date\']">date</span></a>\n
</div>\n
<p class="clear"></p>\n
<div tal:attributes="id python:\'description_\'+box.getId()+\'_\'+str(repeat[\'line\'].index)"\n
class="content"\n
style="display:none;">\n
<p tal:condition="python:getattr(value,\'field_content\',None)" tal:content="structure python: getattr(value,\'field_content\',\'\')"/>\n
<p tal:condition="python:value_dict[\'field_content\']"\n
tal:content="structure python:value_dict[\'field_content\']"/>\n
<div id="others_links">\n
<tal:block tal:repeat="other_link python: getattr(value,\'field_others_links\',[])">\n
<tal:block tal:repeat="other_link python:value_dict[\'field_others_links\']">\n
<a tal:content="structure other_link" />\n
<br/>\n
</tal:block>\n
</div>\n
<tal:block tal:condition="python:len(getattr(value,\'field_img\',[]))>1">\n
<img tal:repeat="img python:getattr(value,\'field_img\',[])[1:]"\n
<!-- XXX: See for mutli-image\n
<tal:block tal:condition="python: len(value_dict[\'field_img\']) > 1">\n
<img tal:repeat="img python: value_dict[\'field_img\'][1:]"\n
tal:attributes="src img; alt python:\'\'"/>\n
<br/>\n
</tal:block>\n
<a tal:condition="python:getattr(value,\'field_link\',None)" tal:attributes="href value/field_link;target string:_blank">Show original item</a>\n
\n
-->\n
<a tal:condition="python:value_dict[\'field_link\']"\n
tal:attributes="target string: _blank; href python:value_dict[\'field_link\']">Show original item</a>\n
</div>\n
</li>\n
</tal:block>\n
......
2009-11-06 Herve
* Update the page template ListBox_asListStyleHTML to make it compatbile with more gadgets.
2009-10-16 yusei
* Update for the changes of new portal types of portal types.
......
415
\ No newline at end of file
416
\ 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