add special view for 'all docs' folder (#730)
This commit is contained in:
parent
cf67ef183c
commit
7d3bc6e0a1
|
@ -0,0 +1,119 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
|
||||
xmlns:tal="http://xml.zope.org/namespaces/tal"
|
||||
xmlns:metal="http://xml.zope.org/namespaces/metal"
|
||||
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
|
||||
lang="en"
|
||||
metal:use-macro="context/main_template/macros/master"
|
||||
i18n:domain="plone">
|
||||
|
||||
<body>
|
||||
|
||||
<metal:content-core fill-slot="content-core">
|
||||
<metal:block define-macro="listing" extend-macro="context/folder_listing/macros/content-core">
|
||||
<metal:entries fill-slot="entries">
|
||||
|
||||
<div metal:use-macro="context/batch_macros/macros/navigation" />
|
||||
|
||||
<table class="listing"
|
||||
summary="Content listing"
|
||||
i18n:attributes="summary summary_content_listing;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="nosort"> <tal:title i18n:translate="listingheader_title"
|
||||
>Title</tal:title> </th>
|
||||
<th class="nosort"
|
||||
tal:condition="show_about"> <tal:title i18n:translate="listingheader_author"
|
||||
>Author</tal:title> </th>
|
||||
<th class="nosort"> <tal:title i18n:translate="listingheader_type"
|
||||
>Type</tal:title> </th>
|
||||
<th class="nosort"
|
||||
tal:condition="show_about"> <tal:modified i18n:translate="listingheader_modified"
|
||||
>Modified</tal:modified> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody tal:define="folderContents view/entries;
|
||||
Batch python:modules['Products.CMFPlone'].Batch;
|
||||
b_start python:request.get('b_start', 0);
|
||||
limit_display limit_display|request/limit_display|nothing;
|
||||
limit_display python:limit_display and int(limit_display) or None;
|
||||
batch python:Batch(folderContents, limit_display or 100, int(b_start), orphan=1);">
|
||||
<tal:entry tal:repeat="item batch">
|
||||
<tal:block tal:define="item_url item/getURL|item/absolute_url;
|
||||
item_id item/getId|item/id;
|
||||
item_title_or_id item/pretty_title_or_id;
|
||||
item_description item/Description;
|
||||
item_type item/portal_type;
|
||||
item_type_title item/Type;
|
||||
item_modified item/ModificationDate;
|
||||
item_created item/CreationDate;
|
||||
item_icon python:plone_view.getIcon(item);
|
||||
item_type_class python:'contenttype-' + normalizeString(item_type);
|
||||
item_wf_state item/review_state|python: context.portal_workflow.getInfoFor(item, 'review_state', '');
|
||||
item_wf_state_class python:'state-' + normalizeString(item_wf_state);
|
||||
item_creator item/Creator;
|
||||
item_start item/start|item/StartDate|nothing;
|
||||
item_end item/end|item/EndDate|nothing;
|
||||
item_sametime python: item_start == item_end;
|
||||
item_samedate python: (item_end - item_start < 1) if item_type == 'Event' else False">
|
||||
|
||||
<tr metal:define-macro="listitem"
|
||||
tal:define="oddrow repeat/item/odd;"
|
||||
tal:attributes="class python:oddrow and 'even' or 'odd'">
|
||||
|
||||
<td>
|
||||
<img width="16" height="16"
|
||||
src="" alt=""
|
||||
tal:condition="item_icon/url"
|
||||
tal:attributes="src item_icon/url;
|
||||
alt item_icon/description;
|
||||
title item_icon/title;
|
||||
width item_icon/width;
|
||||
height item_icon/height;" />
|
||||
<a href="#"
|
||||
tal:attributes="href python: ((item_type in use_view_action) and (item_url+'/view') or item_url);
|
||||
class string:$item_wf_state_class $item_type_class;
|
||||
title item_description;"
|
||||
tal:content="item_title_or_id">
|
||||
Item Title
|
||||
</a>
|
||||
</td>
|
||||
|
||||
<td tal:condition="show_about">
|
||||
<tal:name tal:condition="item_creator"
|
||||
tal:define="author python:pas_member.info(item_creator)">
|
||||
<a href="#"
|
||||
tal:attributes="href string:${navigation_root_url}/author/${item_creator}"
|
||||
tal:content="author/name_or_id"
|
||||
tal:omit-tag="not:author">
|
||||
Bob Dobalina
|
||||
</a>
|
||||
</tal:name>
|
||||
</td>
|
||||
|
||||
<td tal:content="item_type_title"
|
||||
i18n:translate="">
|
||||
Page
|
||||
</td>
|
||||
|
||||
<td tal:condition="show_about"
|
||||
tal:content="python:toLocalizedTime(item_modified,long_format=1)">
|
||||
August 16, 2001 at 23:35:59
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tal:block>
|
||||
</tal:entry>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</metal:entries>
|
||||
</metal:block>
|
||||
|
||||
<metal:subtopics use-macro="context/atct_topic_view/macros/folderlisting_macro" />
|
||||
|
||||
</metal:content-core>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -41,6 +41,21 @@
|
|||
description="Big blocks view"
|
||||
/>
|
||||
|
||||
<browser:page
|
||||
for=".interfaces.IAllDocsFolderView"
|
||||
name="folder_tabular_view"
|
||||
class=".views.AllDocsFolderView"
|
||||
permission="zope2.View"
|
||||
/>
|
||||
|
||||
<browser:menuItem
|
||||
for=".interfaces.IAllDocsFolderView"
|
||||
menu="plone_displayviews"
|
||||
title="All Docs Folder View"
|
||||
action="@@folder_tabular_view"
|
||||
description="All Docs Folder View"
|
||||
/>
|
||||
|
||||
<interface
|
||||
interface=".interfaces.IThemeSpecific"
|
||||
type="zope.publisher.interfaces.browser.IBrowserSkinType"
|
||||
|
|
|
@ -5,4 +5,7 @@ class IThemeSpecific(IDefaultPloneLayer):
|
|||
"""Marker interface that defines a Zope browser layer."""
|
||||
|
||||
class IBigBlocksFolderView(Interface):
|
||||
"""Marker interface identifying Big Blocks Folder View."""
|
||||
"""Marker interface identifying Big Blocks Folder View."""
|
||||
|
||||
class IAllDocsFolderView(Interface):
|
||||
"""Marker interface identifying All Docs Folder View"""
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
from Products.Five import BrowserView
|
||||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
|
||||
|
||||
from Products.CMFCore.utils import getToolByName
|
||||
|
||||
class BigBlocksFolderView(BrowserView):
|
||||
template = ViewPageTemplateFile('bigblocks_folder_view.pt')
|
||||
|
||||
def __call__(self):
|
||||
return self.template()
|
||||
|
||||
|
||||
class AllDocsFolderView(BrowserView):
|
||||
template = ViewPageTemplateFile('alldocs_folder_view.pt')
|
||||
|
||||
def entries(self):
|
||||
catalog = getToolByName(self.context, 'portal_catalog')
|
||||
folder_path = '/'.join(self.context.getPhysicalPath())
|
||||
results = catalog.searchResults(path={'query': folder_path, 'depth': 1},
|
||||
sort_on='Date', sort_order='descending')
|
||||
return results
|
||||
|
||||
def __call__(self):
|
||||
return self.template()
|
||||
|
||||
|
|
Reference in New Issue