Commit 8d158b9e authored by Ivan Tyagov's avatar Ivan Tyagov

Improve Feed reeder to support better:

- images
- marking a feed as read
- RSS provider logo
Move some generic CSS from KM to gadgets' core.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39480 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 04d7ed29
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
......@@ -76,12 +73,22 @@ results = context.Base_getRssDataAsDict(url = feed_url, username = username, pas
readItemList = {}\n
md5_list = []\n
message_list = []\n
context.REQUEST.set(\'rss_title\',results.get(\'title\',\'No title for this feed\'))\n
context.REQUEST.set(\'rss_link\',results.get(\'link\',None))\n
context.REQUEST.set(\'rss_logo\',results.get(\'logo\',None))\n
items = results.get(\'items\',None)\n
\n
rss_title = results.get(\'title\',\'No title for this feed\')\n
if items is not None:\n
rss_title = \'%s (%s)\' %(rss_title, len(items))\n
\n
rss_logo = results.get(\'logo\', None)\n
if rss_logo not in (\'\', None):\n
context.REQUEST.set(\'rss_logo\',rss_logo)\n
\n
context.REQUEST.set(\'rss_title\', rss_title)\n
context.REQUEST.set(\'rss_link\',results.get(\'link\',None))\n
\n
if items is None:\n
return []\n
\n
for result in items:\n
md5_list.append(result[\'md5\'])\n
date = context.Base_getDiffBetweenDateAndNow(result.get(\'date\',None))\n
......@@ -95,12 +102,9 @@ for result in items:\n
field_md5 = result.get(\'md5\',\'\')\n
)\n
message_list.append(message)\n
if selection:\n
params = selection.getParams()\n
readItemList = params.get(\'rss_read_item:list\', {})\n
for readItem in readItemList.keys():\n
if readItem not in md5_list:\n
del(readItemList[readItem])\n
# export to request so rendering form can use \n
context.REQUEST.set(\'rss_documents_count\', len(message_list))\n
\n
return message_list\n
</string> </value>
</item>
......@@ -160,14 +164,14 @@ return message_list\n
<string>message_list</string>
<string>None</string>
<string>items</string>
<string>rss_title</string>
<string>len</string>
<string>rss_logo</string>
<string>_getiter_</string>
<string>result</string>
<string>_getitem_</string>
<string>date</string>
<string>message</string>
<string>params</string>
<string>readItem</string>
<string>_write_</string>
</tuple>
</value>
</item>
......
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
......@@ -56,10 +53,12 @@
<value> <string>portal_selection = getattr(context,\'portal_selections\')\n
selection = portal_selection.getSelectionFor(selection_name)\n
params = selection.getParams()\n
readItemList = params.get(\'rss_read_item:list\', {})\n
readItemList[item]=\'\'\n
params[\'rss_read_item:list\'] = readItemList\n
readItemList = params.get(\'rss_read_item_list\', [])\n
if item not in readItemList:\n
readItemList.append(item)\n
params[\'rss_read_item_list\'] = readItemList\n
portal_selection.setSelectionParamsFor(selection_name, params)\n
return item\n
</string> </value>
</item>
<item>
......
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
......@@ -37,7 +34,7 @@
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<value> <unicode encoding="cdata"><![CDATA[
<div class=\'gadget_advertisement\'>\n
<h4>Management Solutions</h4>\n
......@@ -54,7 +51,7 @@
</div>\n
]]></string> </value>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -68,9 +65,13 @@
<key> <string>id</string> </key>
<value> <string>ERP5Site_viewAnonymousAdvertisementGadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
......
......@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
<tuple/>
</tuple>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
......@@ -37,7 +34,7 @@
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<value> <unicode encoding="cdata"><![CDATA[
<div class=\'gadget_documentation\'>\n
<h4>Join ERP5 Network !</h4>\n
......@@ -54,7 +51,7 @@
</div>\n
]]></string> </value>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -68,9 +65,13 @@
<key> <string>id</string> </key>
<value> <string>ERP5Site_viewAnonymousDocumentationGadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
......
......@@ -192,6 +192,10 @@
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value> <string></string> </value>
......@@ -200,6 +204,10 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_style_list</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value> <string></string> </value>
......@@ -228,6 +236,10 @@
<key> <string>global_attributes</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
......@@ -254,6 +266,10 @@
<key> <string>meta_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_navigation_mode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
......@@ -308,6 +324,10 @@
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value>
......
......@@ -152,9 +152,7 @@
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
......@@ -217,7 +215,7 @@
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string>left gadget-rss-reader-logo</string> </value>
<value> <string>gadget-rss-reader-logo</string> </value>
</item>
<item>
<key> <string>default</string> </key>
......@@ -257,7 +255,7 @@
</item>
<item>
<key> <string>image_display</string> </key>
<value> <string>thumbnail</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>image_format</string> </key>
......@@ -305,20 +303,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: request.get(\'rss_logo\',\'\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: request.get(\'rss_logo\',\'\') not in (\'\', None)</string> </value>
<value> <string>python: request.get(\'rss_logo\',\'images/transparent-image.gif\')</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<value> <unicode encoding="cdata"><![CDATA[
<tal:block tal:define="request python: context.REQUEST;\n
box_relative_url python: request.get(\'box_relative_url\',\'\');\n
......@@ -74,7 +74,7 @@
</tal:block>\n
]]></string> </value>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -88,9 +88,13 @@
<key> <string>id</string> </key>
<value> <string>ERP5Site_viewWorklistGadget</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
......
......@@ -34,7 +34,7 @@
</item>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
<value> <unicode encoding="cdata"><![CDATA[
<tal:block \n
tal:define="title here/field_title;\n
......@@ -45,30 +45,33 @@
link here/field_link;\n
md5 here/field_md5;\n
box_relative_url python: request.get(\'box_relative_url\', \'\');\n
dom_id python: (\'%s-%s\' %(box_relative_url.replace(\'/\',\'_\'), md5))">\n
dom_id python: (\'%s-%s\' %(box_relative_url.replace(\'/\',\'_\'), md5));\n
selection_name python: context.Base_getListboxGadgetSelectionName(context.REQUEST.get(\'box_relative_url\', \'\'));\n
selection python: context.portal_selections.getSelectionFor(selection_name);\n
selection_params python: selection.getParams();\n
read_item_list python:selection_params.get(\'rss_read_item_list\', []);\n
is_read python: md5 in read_item_list">\n
\n
\n
<div class="document-gadget-quick-preview">\n
\n
<div class="teaser"\n
tal:attributes="onclick string:toggle(\'${dom_id}\');">\n
\n
tal:attributes="class python: test(is_read, \'teaser read\', \'teaser unread\');\n
onclick string:if(this.className!=\'teaser read\'){this.className=\'teaser read\';;MochiKit.Async.doSimpleXMLHttpRequest(\'Base_setRssItemReadInSelection\', {\'selection_name\':\'${selection_name}\',\'item\':\'${md5}\'})};;toggle(\'${dom_id}\');">\n
<img class="thumbnail-image"\n
tal:condition="python: image not in ((), None,)"\n
tal:attributes="src python: image[0]" alt="Thumbnail"/>\n
<span class="document-title"\n
tal:content="title"/> - \n
\n
<span class="modification-date"\n
tal:content="date"/>\n
\n
</div>\n
\n
<!-- Hidden thumbnail & description -->\n
<!-- Hidden description -->\n
<div class="body" style="display:none;"\n
tal:attributes="id dom_id">\n
<div class="document-thumbnail"\n
tal:condition="python: image not in ((), None,)"\n
tal:content="structure image"/>\n
<br/>\n
<div class="rss-description"\n
tal:content="structure description"/>\n
<br/>\n
<a target="_blank" \n
class="document-link"\n
title="Original Document"\n
......@@ -80,7 +83,7 @@
</tal:block>\n
]]></string> </value>
]]></unicode> </value>
</item>
<item>
<key> <string>content_type</string> </key>
......@@ -94,9 +97,13 @@
<key> <string>id</string> </key>
<value> <string>RssFeed_getSummaryAsHTML</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
......
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts84987054.12</string> </value>
<value> <string>ts87752153.8</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -478,10 +478,28 @@ div.block div.worklist_list ul li a:hover{\n
text-decoration:none;\n
}\n
\n
/* RSS Feed gadget */\n
/* Some gadgets share same Document_getSummaryAsHTML or RssFeed_getSummaryAsHTML */\n
div.document-gadget-quick-preview div.teaser{\n
cursor: pointer;\n
}\n
\n
div.document-gadget-quick-preview span.document-title,\n
div.document-gadget-quick-preview span.modification-date{\n
font-size:1em;\n
color: #000;\n
}\n
\n
/* Some items can be marked as read and we need a way to visualize it */\n
div.document-gadget-quick-preview div.read span.document-title,\n
div.document-gadget-quick-preview div.read span.modification-date{\n
color: #969696;\n
}\n
\n
div.document-gadget-quick-preview a.document-link{\n
color:#000;\n
font-weight:bold;\n
}\n
\n
/* Rss Feed reader gadget needs no listbox headers or \n
show number of records or show \'No results\' as listbox title is used for this */\n
div.gadget-rss-reader table.listbox thead,\n
......@@ -489,6 +507,22 @@ div.gadget-rss-reader div.listbox-number-of-records,\n
div.gadget-rss-reader table.listbox td.listbox-table-no-result-row{\n
display: none;\n
}\n
\n
div.rss-description{\n
padding-top:4px;\n
}\n
\n
div.teaser .thumbnail-image{\n
margin:4px;\n
float:left;\n
}\n
\n
div.gadget-rss-reader-logo img{\n
float:right;\n
margin:4px;\n
width:auto;\n
}\n
\n
</string> </value>
</item>
<item>
......@@ -497,7 +531,7 @@ div.gadget-rss-reader table.listbox td.listbox-table-no-result-row{\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>8086</int> </value>
<value> <int>8792</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
576
\ No newline at end of file
579
\ 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