Permalink
Browse files

It looks as if the previous/next navigation works now

  • Loading branch information...
1 parent 360c875 commit 96954d70ff8f4ea0aa529fd9814ffac95d49f84d Imke Brandt committed Feb 20, 2012
Showing with 10 additions and 7 deletions.
  1. +7 −3 on/video/browser/videogallery.py
  2. +3 −4 on/video/browser/videogallery_templates/videogallery.pt
@@ -1,3 +1,4 @@
+
# gallery view for folders containing videos
# (c) 2012 oeko.net
@@ -34,6 +35,7 @@
from Products.ATContentTypes.interface import IATFolder
+from Products.CMFPlone.PloneBatch import Batch
from plone.memoize.instance import memoize
from on.video import _
@@ -46,11 +48,11 @@
class FolderItems(object):
"""Collect attributes for folder entries."""
- def __init__(self, data, datatype):
+ def __init__(self, data, datatype, start):
self.data = data
self.datatype = datatype
self.filetype = self.calculateFileType(url)
-
+ self.start = start
def countFolderItems(folder):
"""Filter the given list of folder contents for those elements
@@ -113,7 +115,9 @@ def update(self):
"""Called before rendering the template for this view.
"""
fl = self.getFolderContents()
- self.contents = [ genSmallView(item, self.request) for item in fl ]
+ b_start = int(self.context.REQUEST.get('b_start', 0))
+ self.contents = Batch([ genSmallView(item, self.request) for item in fl ], size=3, start=b_start)
+
# print "VideoGallery.update(): contents = ", self.contents
# import pdb; pdb.set_trace()
@@ -18,19 +18,18 @@
<tal:foldercontents define="limit_display limit_display|request/limit_display|nothing;
limit_display python:limit_display and int(limit_display) or None;
more_url more_url|request/more_url|string:folder_contents;
- fl view/contents;
site_properties context/portal_properties/site_properties;
use_view_action site_properties/typesUseViewActionInListings|python:();
Batch python:modules['Products.CMFPlone'].Batch;
+ foldercontents view/contents;
b_start python:request.get('b_start', 0);
- batch python:isinstance(fl, Batch) and fl or Batch(fl, limit_display or 10, int(b_start), orphan=1);
+ batch python:isinstance(foldercontents, Batch) and foldercontents or Batch(foldercontents, limit_display or 10, b_start, orphan=1);
normalizeString nocall: context/plone_utils/normalizeString;
navigation_root_url context/@@plone_portal_state/navigation_root_url">
<tal:listing condition="batch">
<div metal:use-macro="context/batch_macros/macros/navigation" />
-
- <tal:loop repeat="item view/contents">
+ <tal:loop repeat="item batch">
<a href="#" tal:attributes="href item/id">
<h4 tal:content="item/title" />
<img src="#" tal:attributes="src nocall: item/thumb|item/banner" width="100" height="100" />

0 comments on commit 96954d7

Please sign in to comment.