This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Somtimes useful extensions to Products.slideshowfolder

SlideshowImage

The SlideshowImage content type uses a reference to an existing normal image somewhere else in the site to act as a kind of link or alias. This allows for the creation of a folder as a slideshowfolder that displays images that are actually stored elsewhere.

Start with a couple of normal folders and a normal image.

>>> portal.images
<ATFolder at /plone/images>
>>> portal.images.contentValues()
[<ATImage at /plone/images/foo-image-title>]
>>> foo_image = portal.images['foo-image-title']
>>> folder.contentValues()
[<ATFolder at /plone/Members/test_user_1_/slideshow>]
>>> folder.slideshow.contentValues()
[<ATImage at
  /plone/Members/test_user_1_/slideshow/bar-image-title>]

Open a browser and login as a user who can add SlideshowImages.

>>> from Products.Five import testbrowser
>>> from Products.PloneTestCase import ptc
>>> portal.error_log._ignored_exceptions = ()
>>> member_browser = testbrowser.Browser()
>>> member_browser.handleErrors = False
>>> member_browser.open(portal.absolute_url())
>>> member_browser.getLink('Log in').click()
>>> member_browser.getControl(
...     'Login Name').value = ptc.default_user
>>> member_browser.getControl(
...     'Password').value = ptc.default_password
>>> member_browser.getControl('Log in').click()
>>> member_browser.open(folder.slideshow.absolute_url())

Add a SlideshowImage. Set the “Image Reference” field to the real image in the images folder.

>>> member_browser.getLink(
...     url='createObject?type_name=SlideshowImage').click()
>>> member_browser.getControl(
...     'Image Reference').value = foo_image.UID()

Since all values are taken from the referenced image, none of the normal image fields are editable.

>>> member_browser.getControl('Title')
Traceback (most recent call last):
LookupError: label 'Title'
>>> member_browser.getControl('Description')
Traceback (most recent call last):
LookupError: label 'Description'
>>> member_browser.getControl(name='image_file')
Traceback (most recent call last):
LookupError: name 'image_file'
>>> member_browser.getControl('Creators')
Traceback (most recent call last):
LookupError: label 'Creators'

Save the new SlideshowImage.

>>> member_browser.getControl('Save').click()

The values for the fields are pulled in from the referenced image.

>>> print member_browser.contents
<...
...Changes saved...
...Foo Image Title...
...Foo CreÃtor...
...Foo Image description...
>>> member_browser.getLink('Click to view full-size image')
<Link text='Foo Image Title[IMG] [IMG]
Click to view full-size image...'
url='http://nohost/plone/Members/test_user_1_/slideshow/foo-image-title/image_view_fullscreen'>
>>> member_browser.open(
...     folder.slideshow['foo-image-title'].absolute_url())
>>> print member_browser.contents
GIF...

The catalog also reflects the data from the referenced image.

>>> len(portal.portal_catalog(
...     Type='Slideshow Image',
...     Description='Foo Image description'))
1

The catalogged and indexed values for the fields are also updated when the original image is edited.

Open a browser and log in as the image’s creator.

>>> owner_browser = testbrowser.Browser()
>>> owner_browser.handleErrors = False
>>> owner_browser.open(portal.absolute_url())
>>> owner_browser.getLink('Log in').click()
>>> owner_browser.getControl(
...     'Login Name').value = ptc.portal_owner
>>> owner_browser.getControl(
...     'Password').value = ptc.default_password
>>> owner_browser.getControl('Log in').click()

Change the image metadata.

>>> owner_browser.open(foo_image.absolute_url()+'/edit')
>>> owner_browser.getControl(
...     'Description').value = 'Foo Image edited'
>>> owner_browser.getControl('Save').click()

The catalog now reflects the changes for the SlideshowImage that references the image.

>>> len(portal.portal_catalog(
...     Type='Slideshow Image',
...     Description='Foo Image description'))
0
>>> len(portal.portal_catalog(
...     Type='Slideshow Image',
...     Description='Foo Image edited'))
1

Slideshow Folders

SlideshowImages is in a folder using the slideshowfolder view behave just like regular images.

Make the folder into a slideshowfolder.

>>> member_browser.open(folder.slideshow.absolute_url())
>>> member_browser.getLink('Make slideshow').click()
>>> print member_browser.contents
<...
...This folder is now designated a slideshow...

Check that the SlideshowImage is included in the slideshow by inspecting the JavaScript. The collective.slideshowfolder package also extends the caption to include the image’s creator for credit.

>>> member_browser.open(
...     folder.slideshow.absolute_url()+'/slideshow_settings.js')
>>> print member_browser.contents
registerPloneFunction...
...http://nohost/plone/Members/test_user_1_/slideshow/bar-image-title/image_large...
...Photo: Foo Full NÃme...
...Bar ImÃge description...
...http://nohost/plone/Members/test_user_1_/slideshow/foo-image-title/image_large...
...Photo: Foo CreÃtor...
...Foo Image edited...

Slideshow Portlets

The collective.slideshowfolder package also provides a portlet that renders a Slideshow 2 in a portlet based on the contents of the first folder or collection specified in the “slideshow” refrence for the context.

Turn the a folder into a slideshowfolder.

>>> slideshowfolder = self.folder.slideshow
>>> self.loginAsPortalOwner()
>>> portal.portal_workflow.doActionFor(
...     slideshowfolder, 'publish')
>>> slideshowfolder.unrestrictedTraverse(
...     '@@folder_slideshow_view').makeSlideshow()

Open a browser and login as a user who can add portlets.

>>> from Products.Five import testbrowser
>>> from Products.PloneTestCase import ptc
>>> browser = testbrowser.Browser()
>>> browser.handleErrors = False
>>> browser.open(portal.absolute_url())
>>> browser.getLink('Log in').click()
>>> browser.getControl('Login Name').value = ptc.portal_owner
>>> browser.getControl('Password').value = ptc.default_password
>>> browser.getControl('Log in').click()

Add a slideshowfolder portlet.

>>> browser.getLink('Manage portlets').click()
>>> right_column = browser.getForm(index=3)
>>> right_column.getControl('Slideshow portlet').selected = True
>>> right_column.submit()
>>> browser.getControl('Save').click()
>>> browser.getLink('Log out').click()

Go to an area of the site without a slideshow.

>>> context = portal.news.aggregator
>>> browser.open(context.absolute_url())
>>> 'portletSlideshow' in browser.contents
False

Add a slideshowfolder reference for the context.

>>> context.addReference(slideshowfolder,
...                      relationship="slideshow")
<Reference sid:... tid:... rel:slideshow>

Now the slideshow portlet will be rendered.

>>> browser.open(context.absolute_url())
>>> print browser.contents
<...
...mootools...
...portletSlideshow...
...id="myShow"...
...registerPloneFunction...
...http://nohost/plone/Members/test_user_1_/slideshow/bar-image-title/image_large...

Changelog

0.8 - 2009-07-08

  • Fix the portlet add view

0.7 - 2009-03-22

  • Fix another unicode error in the caption (aaronv)

0.6 - 2009-03-21

  • Fix unicode error in the caption (aaronv)

0.5 - 2009-02-07

  • Fix a type on generated portlet JavaScript (Thanks aaronv!)

0.4 - 2008-12-03

  • Fix the portlet JavaScript
  • Make the portlet fully editable
  • More sensible height and width defaults for portlet

0.3 - 2008-12-02

  • Support for a slideshow portlet based on a reference to a slideshow folder

0.2 - 2008-11-13

  • Add the image creator as a credit in the caption

0.1 - 2008-11-12

  • Initial release
Release History

Release History

0.8

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
collective.slideshowfolder-0.8.tar.gz (12.6 kB) Copy SHA256 Checksum SHA256 Source Jul 8, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting