[Product-Developers] Problem with batching in a viewlet
Vanderson Mota dos Santos
vanderson.mota at gmail.com
Tue Mar 31 21:23:55 UTC 2009
here is:
<span metal:use-macro="here/global_defines/macros/defines" />
<div id="navigation-listing" i18n:domain="plone">
<tal:foldercontents define="filters request/filters| nothing;
terms request/terms | nothing;
folderContents
python:view.getContentsByTermsAndFilters(terms,filters);
Batch python:modules['Products.CMFPlone'].Batch;
b_size python:30;
b_start python:0;
b_start request/b_start | b_start;
use_view_action
site_properties/typesUseViewActionInListings|python:();
batch folderContents|nothing">
<div condition="folderContents"
tal:define="batch python:Batch(folderContents, b_size, int(b_start),
orphan=1);">
<tal:listing>
<tal:block tal:repeat="item folderContents">
<div class="tileItem visualIEFloatFix vevent"
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_type_class python:
'contenttype-' + normalizeString(item_type);
item_modified item/ModificationDate;
item_created item/CreationDate;
item_wf_state
item/review_state|python: wtool.getInfoFor(item, 'review_state', '');
item_wf_state_class python:'state-' +
normalizeString(item_wf_state);
item_creator item/Creator;
item_start
item/start/ISO|item/StartDate|nothing;
item_end
item/end/ISO|item/EndDate|nothing;
item_object item/getObject;
"
tal:attributes="class string:tileItem visualIEFloatFix
vevent ${item_type_class}">
<a href="#"
tal:condition="python:item_type != 'Link'"
tal:attributes="href python: (item_type in
use_view_action) and (item_url+'/view') or item_url">
<img src="" alt=""
tal:condition="exists:item_object/image_thumb"
tal:replace="structure python:
path('nocall:item_object/tag')(scale='thumb', css_class='tileImage')" />
</a>
<a href="#"
class="link-plain"
tal:condition="python:item_type == 'Link'"
tal:attributes="href item/getRemoteUrl">
<img src="" alt=""
tal:condition="exists:item_object/image_thumb"
tal:replace="structure python:
path('nocall:item_object/tag')(scale='thumb', css_class='tileImage')" />
</a>
<h2 class="tileHeadline"
metal:define-macro="listitem">
<a href="#"
class="summary url"
tal:condition="python:item_type != 'Link'"
tal:attributes="href python:(item_type in
use_view_action) and (item_url+'/view') or
item_url"
tal:content="item_title_or_id">
Item Title
</a>
<a href="#"
class="link-plain"
tal:condition="python:item_type == 'Link'"
tal:content="item_title_or_id"
tal:attributes="href item/getRemoteUrl;">
External Link
</a>
</h2>
<div class="documentByLine" tal:condition="python:
site_properties.allowAnonymousViewAbout or not isAnon">
<tal:event condition="python: item_type == 'Event'">
<span tal:condition="python: item_type == 'Event'"
i18n:translate="label_event_byline">
(<span tal:content="string:${item/location}"
class="location"
i18n:name="location">Oslo</span><tal:comma
tal:replace="string:, "
tal:condition="item/location" />from
<abbr class="dtstart"
tal:attributes="title python:item_start"
tal:content="python:toLocalizedTime(item_start,long_format=1)"
i18n:name="start">from date</abbr> to
<abbr class="dtend"
tal:attributes="title python:item_end"
tal:content="python:toLocalizedTime(item_end,long_format=1)"
i18n:name="end">to date</abbr>)
</span>
</tal:event>
<tal:newsitem condition="python: item_type == 'News
Item'">
<tal:name tal:condition="item_creator"
tal:define="author
python:mtool.getMemberInfo(item_creator)">
<span i18n:translate="label_by_author">
by
<a href="#"
tal:attributes="href
string:${portal_url}/author/${item_creator}"
tal:content="python:author and
author['fullname'] or item_creator"
tal:omit-tag="not:author"
i18n:name="author">
Bob Dobalina
</a>
</span>
</tal:name>
—
<span
tal:replace="python:toLocalizedTime(item_modified,long_format=1)">
August 16, 2001 at 23:35:59
</span>
</tal:newsitem>
</div>
<p class="tileBody">
<span tal:omit-tag=""
tal:condition="not:item_description">
</span>
<span class="description"
tal:content="item_description">
description
</span>
</p>
<p class="tileFooter">
<a href=""
tal:attributes="href python: (item_type in
use_view_action) and item_url+'/view' or
item_url"
i18n:translate="read_more">
Read More…
</a>
</p>
<div class="visualClear"><!-- --></div>
</div>
</tal:block>
<!-- TODO: include page system in the navigation-->
</tal:listing>
<div metal:use-macro="here/batch_macros/macros/navigation" />
</div>
<metal:empty>
<div id="navigation-listing" class="discreet"
tal:condition="not: folderContents"
i18n:translate="description_no_items_in_folder">
There are currently no items in this folder.
</div>
</metal:empty>
</tal:foldercontents>
<metal:subtopics
use-macro="here/atct_topic_view/macros/folderlisting_macro" />
</div>
2009/3/31 Andreas Jung <lists at zopyx.com>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 31.03.2009 14:42 Uhr, Vanderson Mota dos Santos wrote:
> > Hi folks, i'm trying to batch the results of a folder's contents that
> > are showed in a viewlet, according with the batching tutorial at:
> > http://old.plone.org/documentation/tutorial/plonebatch/usage/
> >
> > here is the viewlet page template code:
> > http://paste.plone.org/27329
> >
> >
>
> Please: never-ever use a paste server for posting code referenced
> on a mailinglist. Postings get archived, your pastes not.
>
> - -aj
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAknSfOwACgkQCJIWIbr9KYznJgCgrBTaU5+YnkNzfUZeTML4L9li
> g8YAn0pNflubJFI8ESpM8hvfsmtk/6aF
> =BTuK
> -----END PGP SIGNATURE-----
>
--
Vanderson Mota dos Santos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20090331/ca82aaa9/attachment.html>
More information about the Product-Developers
mailing list