Skip to main content

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

Metadata

Release files for collective.slideshowfolder 0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for collective.slideshowfolder 0.8
File Size Uploaded Provenance
collective.slideshowfolder-0.8.tar.gz 12.6 kB Without provenance Details

Release files / collective.slideshowfolder-0.8.tar.gz

Download URL collective.slideshowfolder-0.8.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a4058050901b46bf0355982669fe0e8125ba109daefa25802cbf58a1c211688
BLAKE2b-256 checksum
How to use checksums
55f7527f609c087b834390c881a6a08bdc33b43e4ea097a4b63bed53149f0a52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for collective.slideshowfolder 0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page