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 ...@@ -58,8 +58,17 @@ box_relative_url = kw.get(\'box_relative_url\')\n
selection_name = kw.get(\'list_selection_name\')\n selection_name = kw.get(\'list_selection_name\')\n
portal_selection = getattr(context,\'portal_selections\')\n portal_selection = getattr(context,\'portal_selections\')\n
selection = portal_selection.getSelectionFor(selection_name)\n selection = portal_selection.getSelectionFor(selection_name)\n
box = context.restrictedTraverse(box_relative_url);\n \n
preferences = box.KnowledgeBox_getDefaultPreferencesDict()\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 feed_url = str(preferences.get(\'preferred_rss_feed\',\'\'))\n
username = str(preferences.get(\'preferred_username\',\'\'))\n username = str(preferences.get(\'preferred_username\',\'\'))\n
password = str(preferences.get(\'preferred_password\',\'\'))\n password = str(preferences.get(\'preferred_password\',\'\'))\n
......
...@@ -59,6 +59,7 @@ params = selection.getParams()\n ...@@ -59,6 +59,7 @@ params = selection.getParams()\n
readItemList = params.get(\'rss_read_item:list\', {})\n readItemList = params.get(\'rss_read_item:list\', {})\n
readItemList[item]=\'\'\n readItemList[item]=\'\'\n
params[\'rss_read_item:list\'] = readItemList\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> </string> </value>
</item> </item>
<item> <item>
...@@ -105,6 +106,7 @@ params[\'rss_read_item:list\'] = readItemList\n ...@@ -105,6 +106,7 @@ params[\'rss_read_item:list\'] = readItemList\n
<string>params</string> <string>params</string>
<string>readItemList</string> <string>readItemList</string>
<string>_write_</string> <string>_write_</string>
<string>_getitem_</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -91,7 +91,9 @@ ...@@ -91,7 +91,9 @@
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list/> <list>
<string>listbox_field_img</string>
</list>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -235,13 +235,19 @@ ...@@ -235,13 +235,19 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>list_action</string> </key> <key> <string>list_action</string> </key>
<value> <string></string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>list_method</string> </key> <key> <string>list_method</string> </key>
...@@ -267,6 +273,10 @@ ...@@ -267,6 +273,10 @@
<key> <string>report_tree</string> </key> <key> <string>report_tree</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -282,7 +292,7 @@ ...@@ -282,7 +292,7 @@
<item> <item>
<key> <string>selection_name</string> </key> <key> <string>selection_name</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -303,6 +313,12 @@ ...@@ -303,6 +313,12 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <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> <value> <string></string> </value>
</item> </item>
<item> <item>
...@@ -400,7 +416,16 @@ ...@@ -400,7 +416,16 @@
<item> <item>
<key> <string>editable_columns</string> </key> <key> <string>editable_columns</string> </key>
<value> <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> </value>
</item> </item>
<item> <item>
...@@ -421,6 +446,10 @@ ...@@ -421,6 +446,10 @@
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item> <item>
<key> <string>lines</string> </key> <key> <string>lines</string> </key>
<value> <int>5</int> </value> <value> <int>5</int> </value>
...@@ -432,7 +461,7 @@ ...@@ -432,7 +461,7 @@
<item> <item>
<key> <string>list_method</string> </key> <key> <string>list_method</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -461,6 +490,10 @@ ...@@ -461,6 +490,10 @@
<key> <string>report_tree</string> </key> <key> <string>report_tree</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
</item> </item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <int>0</int> </value> <value> <int>0</int> </value>
...@@ -477,7 +510,7 @@ ...@@ -477,7 +510,7 @@
</item> </item>
<item> <item>
<key> <string>selection_name</string> </key> <key> <string>selection_name</string> </key>
<value> <string></string> </value> <value> <string>rss_reader</string> </value>
</item> </item>
<item> <item>
<key> <string>sort</string> </key> <key> <string>sort</string> </key>
...@@ -506,11 +539,26 @@ ...@@ -506,11 +539,26 @@
<value> <string>Rss reader</string> </value> <value> <string>Rss reader</string> </value>
</item> </item>
<item> <item>
<key> <string>url_columns</string> </key> <key> <string>untranslatable_columns</string> </key>
<value> <value>
<list/> <list/>
</value> </value>
</item> </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> </dictionary>
</value> </value>
</item> </item>
...@@ -528,12 +576,44 @@ ...@@ -528,12 +576,44 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <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> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <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> <pickle>
<tuple> <tuple>
<global name="Method" module="Products.Formulator.MethodField"/> <global name="Method" module="Products.Formulator.MethodField"/>
......
...@@ -48,13 +48,12 @@ ...@@ -48,13 +48,12 @@
line_start python: here.getLineStart();\n line_start python: here.getLineStart();\n
real_context here/getContext;\n real_context here/getContext;\n
context_url real_context/absolute_url;\n context_url real_context/absolute_url;\n
box_relative_url python: request.get(\'box_relative_url\', \'\');\n
line_list here/query;\n line_list here/query;\n
selection_params python: here.getSelection().getParams();\n selection_params python: here.getSelection().getParams();\n
read_item_list python:selection_params.get(\'rss_read_item:list\', {});\n read_item_list python:selection_params.get(\'rss_read_item:list\', {});\n
read_items_count python:len(read_item_list);\n read_items_count python:len(read_item_list);\n
rss_title python:request.get(\'rss_title\',\'\');\n rss_title here/getTitle;\n
rss_link python:request.get(\'rss_link\',None);\n rss_link here/getListActionUrl;\n
rss_logo python:request.get(\'rss_logo\',None);\n rss_logo python:request.get(\'rss_logo\',None);\n
search_text python: selection_params.get(\'search_text\', \'\');\n search_text python: selection_params.get(\'search_text\', \'\');\n
show_select_column here/showSelectColumn;\n show_select_column here/showSelectColumn;\n
...@@ -76,6 +75,7 @@ ...@@ -76,6 +75,7 @@
dom_id python: request.get(\'dom_id\',None) or box_id;\n dom_id python: request.get(\'dom_id\',None) or box_id;\n
is_gadget_mode request/is_gadget_mode | nothing;\n is_gadget_mode request/is_gadget_mode | nothing;\n
list_style python:request.get(\'list_style\', None);\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 dummy python: context.REQUEST.RESPONSE.setHeader(\'Content-Type\', \n
\'text/html;; charset=utf-8\');"\n \'text/html;; charset=utf-8\');"\n
metal:define-macro="main">\n metal:define-macro="main">\n
...@@ -140,40 +140,48 @@ ...@@ -140,40 +140,48 @@
\n \n
<ul>\n <ul>\n
<tal:block tal:repeat="line line_list">\n <tal:block tal:repeat="line line_list">\n
<li tal:define="value line/getBrain"\n <li tal:define="value_dict python:{}.fromkeys(field_key_list);\n
tal:attributes="id python: (getattr(value,\'field_img\',None) and \'with_img\') or \'\';">\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 <input tal:condition="not: repeat/line/index"\n
type="hidden" value="1" name="listbox_uid:list"\n type="hidden" value="1" name="listbox_uid:list"\n
tal:attributes="value python: line.getUid() or \'\';\n tal:attributes="value python: line.getUid() or \'\';\n
name string:${field_id}_uid:list" />\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 onmouseout="this.style.backgroundColor=\'inherit\';"\n
tal:attributes="id python: (getattr(value,\'field_img\',None) and \'title_img\') or \'title\';\n tal:attributes="class python:value_dict[\'field_md5\'] in read_item_list and \'read\' or \'\';\n
class python:value.field_md5 in read_item_list and \'read\' or \'\';\n title python:value_dict[\'field_sender\'];\n
title python:getattr(value,\'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
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 <tal:block tal:condition="python:value_dict[\'field_img\']"\n
<span tal:content="value/field_title">value</span>\n tal:content="structure python:html_dict[\'field_img\']">image</tal:block>\n
<span tal:condition="python:getattr(value,\'field_date\',None)" class="transparent" tal:content="python: \' - \'+str(getattr(value,\'field_date\',\'\'))">value</span>\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 </div>\n
<p class="clear"></p>\n <p class="clear"></p>\n
<div tal:attributes="id python:\'description_\'+box.getId()+\'_\'+str(repeat[\'line\'].index)"\n <div tal:attributes="id python:\'description_\'+box.getId()+\'_\'+str(repeat[\'line\'].index)"\n
class="content"\n class="content"\n
style="display:none;">\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 <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 <a tal:content="structure other_link" />\n
<br/>\n <br/>\n
</tal:block>\n </tal:block>\n
</div>\n </div>\n
<tal:block tal:condition="python:len(getattr(value,\'field_img\',[]))>1">\n <!-- XXX: See for mutli-image\n
<img tal:repeat="img python:getattr(value,\'field_img\',[])[1:]"\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 tal:attributes="src img; alt python:\'\'"/>\n
<br/>\n <br/>\n
</tal:block>\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 </div>\n
</li>\n </li>\n
</tal:block>\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 2009-10-16 yusei
* Update for the changes of new portal types of portal types. * Update for the changes of new portal types of portal types.
......
415 416
\ 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