add links to "search for all related items" (#986)

This commit is contained in:
Frédéric Péters 2011-11-23 23:44:44 +01:00
parent 0f14b21a28
commit 53c8b05c4b
6 changed files with 38 additions and 3 deletions

View File

@ -60,6 +60,7 @@
<td class="docdate"><span tal:replace="python: item.getObject().date_str"></span></td>
</tr>
</table>
<a tal:attributes="href view/related_search_url">Rechercher tous les documents proches</a>
</div>
<div tal:replace="structure provider:plone.belowcontentbody" />

View File

@ -1,5 +1,16 @@
from Products.CMFCore.utils import getToolByName
from Products.Five import BrowserView
class View(BrowserView):
pass
def related_search_url(self):
catalog = getToolByName(self.context, 'portal_catalog')
try:
form_url = catalog(
portal_type='Folder',
object_provides=('tabellio.searchform.form.IFolderWithPfbDocuments',
'tabellio.searchform.form.IFolderWithDocuments'),
limit=1)[0].getObject().absolute_url()
except IndexError:
return None
return '%s/?document.widgets.sort_on:list=Session&document.widgets.search_type_is_document=1&document.widgets.topics=%s' % (form_url, ' '.join(self.context.topics))

View File

@ -79,6 +79,7 @@
<td class="docdate"><span tal:replace="python: item.getObject().date_str"></span></td>
</tr>
</table>
<a tal:attributes="href view/related_search_url">Rechercher tous les dossiers proches</a>
</div>
<div id="reflex" tal:condition="python: context.dostype in ('PJD', 'PPD')">

View File

@ -1,5 +1,16 @@
from Products.CMFCore.utils import getToolByName
from Products.Five import BrowserView
class View(BrowserView):
pass
def related_search_url(self):
catalog = getToolByName(self.context, 'portal_catalog')
try:
form_url = catalog(
portal_type='Folder',
object_provides=('tabellio.searchform.form.IFolderWithPfbDocuments',
'tabellio.searchform.form.IFolderWithDocuments'),
limit=1)[0].getObject().absolute_url()
except IndexError:
return None
return '%s/?dossier.widgets.sort_on:list=Session&dossier.widgets.search_type_is_dossier=1&dossier.widgets.topics=%s' % (form_url, ' '.join(self.context.topics))

View File

@ -61,6 +61,7 @@
<td class="docdate"><span tal:replace="python: item.getObject().date_str"></span></td>
</tr>
</table>
<a tal:attributes="href view/related_search_url">Rechercher toutes les questions proches</a>
</div>

View File

@ -1,5 +1,15 @@
from Products.Five import BrowserView
class View(BrowserView):
pass
def related_search_url(self):
catalog = getToolByName(self.context, 'portal_catalog')
try:
form_url = catalog(
portal_type='Folder',
object_provides=('tabellio.searchform.form.IFolderWithPfbDocuments',
'tabellio.searchform.form.IFolderWithDocuments'),
limit=1)[0].getObject().absolute_url()
except IndexError:
return None
return '%s/?question.widgets.sort_on:list=Session&question.widgets.search_type_is_question=1&question.widgets.topics=%s' % (form_url, ' '.join(self.context.topics))