From 7eadd9de8f50d140898aa4cf0b072809c802f2f1 Mon Sep 17 00:00:00 2001 From: Franz Gerhard Reinisch Date: Sun, 28 Aug 2016 00:12:23 +0200 Subject: [PATCH 1/3] make thumb size in folder contents listing adjustable/supressable (uses site control panel settings: thumb_size_tables ...) clean up deprecated icon related code replace paperclip icon with mime type icons https://github.com/plone/Products.CMFPlone/issues/1734 --- CHANGES.rst | 6 ++++++ plone/app/content/browser/contents/__init__.py | 16 +++++++++++++++- .../browser/templates/select_default_page.pt | 4 ---- plone/app/content/browser/vocabulary.py | 18 ++++++++++++++++++ 4 files changed, 39 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 5102c902..cd735167 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,12 @@ Breaking changes: - *add item here* New features: +- make thumbsize in folder contents listing adjustable/supressable + (uses site control panel settings: thumb_size_tables ...) + clean up deprecated icon related code + replace paperclip icon with mime type icons + https://github.com/plone/Products.CMFPlone/issues/1734 + [fgrcon] - Folder Contents: Construct the list of sortable indexes from the available catalog indexes, using a blacklist and a default set - likewise as it's done with metadata columns. [thet] diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py index 4a038d51..a2612c9f 100644 --- a/plone/app/content/browser/contents/__init__.py +++ b/plone/app/content/browser/contents/__init__.py @@ -7,8 +7,10 @@ from plone.app.content.utils import json_dumps from plone.app.content.utils import json_loads from plone.protect.postonly import check as checkpost +from plone.registry.interfaces import IRegistry from plone.uuid.interfaces import IUUID from Products.CMFCore.utils import getToolByName +from Products.CMFPlone.interfaces.controlpanel import ISiteSchema from Products.CMFPlone import PloneMessageFactory as _ from Products.CMFPlone import utils from Products.CMFPlone.utils import get_top_site_from_url @@ -170,6 +172,7 @@ def ignored_columns(self): 'effective', 'expires', 'getIcon', + 'getMimeIcon', 'getId', 'getRemoteUrl', 'in_response_to', @@ -216,6 +219,16 @@ def get_columns(self): columns[column] = translate(_(column), context=self.request) return columns + def get_thumbSize(self): + registry = getUtility(IRegistry) + settings = registry.forInterface( + ISiteSchema, prefix="plone", check=False) + if settings.no_thumbs_tables: + # thumbs to be supressed + return 'none' + thumb_size_table = settings.thumb_size_table + return thumb_size_table + @property def ignored_indexes(self): ignored = [ @@ -290,7 +303,7 @@ def get_options(self): 'contextInfoUrl': '%s{path}/@@fc-contextInfo' % base_url, 'setDefaultPageUrl': '%s{path}/@@fc-setDefaultPage' % base_url, 'availableColumns': columns, - 'attributes': ['Title', 'path', 'getURL', 'getIcon', 'portal_type'] + columns.keys(), # noqa + 'attributes': ['Title', 'path', 'getURL', 'getIcon', 'getMimeIcon', 'portal_type'] + columns.keys(), # noqa 'buttons': self.get_actions(), 'rearrange': { 'properties': self.get_indexes(), @@ -303,6 +316,7 @@ def get_options(self): 'initialFolder': IUUID(self.context, None), 'useTus': TUS_ENABLED }, + 'thumbSize' : self.get_thumbSize(), } return options diff --git a/plone/app/content/browser/templates/select_default_page.pt b/plone/app/content/browser/templates/select_default_page.pt index 7eb16462..3799454c 100644 --- a/plone/app/content/browser/templates/select_default_page.pt +++ b/plone/app/content/browser/templates/select_default_page.pt @@ -11,7 +11,6 @@ -

Select default page

@@ -36,14 +35,11 @@
-