summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@0d.be>2011-11-01 18:28:07 (GMT)
committerFrédéric Péters <fpeters@0d.be>2011-11-01 18:28:07 (GMT)
commit7d3bc6e0a171549207c54020fffc999156d3fdbf (patch)
treea1bd8e59cd962cc6c10ca508b0626f6e6341b4e0
parentcf67ef183c606aa60298cd90df9402c74b93254b (diff)
downloadthemis.looks-master.zip
themis.looks-master.tar.gz
themis.looks-master.tar.bz2
add special view for 'all docs' folder (#730)HEADmaster
-rw-r--r--themis/looks/alldocs_folder_view.pt119
-rw-r--r--themis/looks/configure.zcml15
-rw-r--r--themis/looks/interfaces.py5
-rw-r--r--themis/looks/views.py17
4 files changed, 155 insertions, 1 deletions
diff --git a/themis/looks/alldocs_folder_view.pt b/themis/looks/alldocs_folder_view.pt
new file mode 100644
index 0000000..de55b4a
--- /dev/null
+++ b/themis/looks/alldocs_folder_view.pt
@@ -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">&nbsp;<tal:title i18n:translate="listingheader_title"
+ >Title</tal:title>&nbsp;</th>
+ <th class="nosort"
+ tal:condition="show_about">&nbsp;<tal:title i18n:translate="listingheader_author"
+ >Author</tal:title>&nbsp;</th>
+ <th class="nosort">&nbsp;<tal:title i18n:translate="listingheader_type"
+ >Type</tal:title>&nbsp;</th>
+ <th class="nosort"
+ tal:condition="show_about">&nbsp;<tal:modified i18n:translate="listingheader_modified"
+ >Modified</tal:modified>&nbsp;</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 &lt; 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>
diff --git a/themis/looks/configure.zcml b/themis/looks/configure.zcml
index cb5a8c2..1768627 100644
--- a/themis/looks/configure.zcml
+++ b/themis/looks/configure.zcml
@@ -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"
diff --git a/themis/looks/interfaces.py b/themis/looks/interfaces.py
index 76cd135..121f5c0 100644
--- a/themis/looks/interfaces.py
+++ b/themis/looks/interfaces.py
@@ -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"""
diff --git a/themis/looks/views.py b/themis/looks/views.py
index d7b9872..7102d82 100644
--- a/themis/looks/views.py
+++ b/themis/looks/views.py
@@ -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()
+