add rss feed for search results (#916)
This commit is contained in:
parent
5405e6de6c
commit
dcc7b7869d
|
@ -153,5 +153,16 @@ template with a tal:define="batch_base_url YOUR_BASE_URL" tales expression.
|
|||
|
||||
</div>
|
||||
|
||||
<div id="results-feed"
|
||||
metal:define-macro="feed"
|
||||
tal:define="
|
||||
batch batch|nothing;
|
||||
batchformkeys batchformkeys|nothing;
|
||||
batchlinkparams python:batchformkeys and dict([(key, request.form[key]) for key in batchformkeys if key in request]) or request.form;
|
||||
">
|
||||
<a tal:attributes="href python: 'feed?%s' % batch.pageurl(batchlinkparams,1);">Abonnez-vous au flux de cette recherche</a>
|
||||
</div>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -38,6 +38,13 @@
|
|||
class=".form.ListTopicsView"
|
||||
permission="zope2.View"/>
|
||||
|
||||
<browser:page
|
||||
for=".form.IFolderWithDocuments"
|
||||
name="feed"
|
||||
class=".form.SearchView"
|
||||
template="docsearch-feed.pt"
|
||||
permission="zope2.View"/>
|
||||
|
||||
<browser:page
|
||||
for=".form.IFolderWithPfbDocuments"
|
||||
name="folder_listing"
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0"?>
|
||||
<rdf:RDF
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
|
||||
xmlns="http://purl.org/rss/1.0/"
|
||||
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
||||
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
||||
xmlns:metal="http://xml.zope.org/namespaces/metal">
|
||||
|
||||
<tal:block
|
||||
define="
|
||||
Batch python:modules['Products.CMFPlone'].Batch;
|
||||
search_results python: view.document_search_results() or view.dossier_search_results() or view.question_search_results();
|
||||
search_batch python:Batch(search_results[:20] or [], 20, 0);
|
||||
dummy python:request.RESPONSE.setHeader('Content-Type', 'text/xml;; charset=utf-8');
|
||||
">
|
||||
|
||||
<channel rdf:about="" tal:attributes="rdf:about request/URL">
|
||||
<title tal:content="context/pretty_title_or_id">The title</title>
|
||||
<link tal:content="context/portal_url">http://url.to.portal</link>
|
||||
<description>
|
||||
</description>
|
||||
<items>
|
||||
<rdf:Seq>
|
||||
<tal:block repeat="obj_item python: search_batch">
|
||||
<rdf:li rdf:resource=""
|
||||
tal:attributes="rdf:resource obj_item/getURL" />
|
||||
</tal:block>
|
||||
</rdf:Seq>
|
||||
</items>
|
||||
</channel>
|
||||
|
||||
<tal:block repeat="item search_batch">
|
||||
<item rdf:about="" tal:attributes="rdf:about obj_item/absolute_url"
|
||||
tal:define="obj_item python:item.getObject();
|
||||
has_text exists:obj_item/aq_explicit/getText;
|
||||
text python:has_text and obj_item.getText() or '';
|
||||
has_effective exists:obj_item/aq_explicit/effective_date;
|
||||
effective python:has_effective and obj_item.effective().HTML4() or '';
|
||||
modified python:obj_item.modified().HTML4();
|
||||
creator obj_item/Creator|nothing">
|
||||
<title tal:content="obj_item/pretty_title_or_id">Title</title>
|
||||
<link tal:content="obj_item/Identifier">Identifier</link>
|
||||
<description tal:content="obj_item/Description">Description</description>
|
||||
<content:encoded xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
tal:condition="has_text"
|
||||
tal:content="structure python:'<![CDATA[' + text + ']]>'">Content</content:encoded>
|
||||
<dc:publisher tal:content="obj_item/Publisher">Publisher</dc:publisher>
|
||||
<tal:block tal:repeat="item obj_item/Subject">
|
||||
<dc:subject tal:content="item">Item</dc:subject>
|
||||
</tal:block>
|
||||
<dc:date tal:content="python: obj_item.date">Published or last modified date if no published date</dc:date>
|
||||
<dc:type tal:content="obj_item/Type">Type</dc:type>
|
||||
</item>
|
||||
</tal:block>
|
||||
|
||||
</tal:block>
|
||||
</rdf:RDF>
|
|
@ -49,6 +49,7 @@
|
|||
|
||||
<div tal:define="batch search_batch">
|
||||
<div metal:use-macro="view/batch_macros/macros/navigation" />
|
||||
<div metal:use-macro="view/batch_macros/macros/feed" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -81,6 +82,7 @@
|
|||
|
||||
<div tal:define="batch search_batch">
|
||||
<div metal:use-macro="view/batch_macros/macros/navigation" />
|
||||
<div metal:use-macro="view/batch_macros/macros/feed" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -113,6 +115,7 @@
|
|||
|
||||
<div tal:define="batch search_batch">
|
||||
<div metal:use-macro="view/batch_macros/macros/navigation" />
|
||||
<div metal:use-macro="view/batch_macros/macros/feed" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
Reference in New Issue