diff --git a/CHANGES.rst b/CHANGES.rst index 7017af37..5444acdb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -11,7 +11,9 @@ Breaking changes: New features: -- *add item here* +- navigation-, news-, recent-,review-portlets: add options to supress icons, + read thumbsize from registry plus option to override thumbsize individually + or suppress thumbs. https://github.com/plone/Products.CMFPlone/issues/1734 [fgrcon] Bug fixes: diff --git a/plone/app/portlets/portlets/configure.zcml b/plone/app/portlets/portlets/configure.zcml index 6174b335..08e2bd7a 100644 --- a/plone/app/portlets/portlets/configure.zcml +++ b/plone/app/portlets/portlets/configure.zcml @@ -55,6 +55,7 @@ assignment=".review.Assignment" renderer=".review.Renderer" addview=".review.AddForm" + editview=".review.EditForm" /> "), + required=False, + default=u'') + + no_thumbs = schema.Bool( + title=_(u"Suppress thumbs "), + description=_( + u"If enabled, the portlet will not show thumbs"), + required=True, + default=False) @implementer(INavigationPortlet) class Assignment(base.Assignment): @@ -106,15 +130,23 @@ class Assignment(base.Assignment): includeTop = False topLevel = 1 bottomLevel = 0 + no_icons = False + ov_thumbsize = '' + no_thumbs = False - def __init__(self, name="", root_uid=None, currentFolderOnly=False, includeTop=False, topLevel=1, bottomLevel=0): + def __init__(self, name="", root_uid=None, + currentFolderOnly=False, includeTop=False, topLevel=1, bottomLevel=0, + no_icons = False, ov_thumbsize = '', no_thumbs = False): self.name = name self.root_uid = root_uid self.currentFolderOnly = currentFolderOnly self.includeTop = includeTop self.topLevel = topLevel self.bottomLevel = bottomLevel - + self.no_icons = no_icons + self.ov_thumbsize = ov_thumbsize + self.ov_thumbsize = ov_thumbsize + @property def title(self): """ @@ -278,16 +310,36 @@ def getNavTree(self, _marker=None): return buildFolderTree(context, obj=context, query=queryBuilder(), strategy=strategy) - def update(self): - pass - - def render(self): - return self._template() _template = ViewPageTemplateFile('navigation.pt') recurse = ViewPageTemplateFile('navigation_recurse.pt') + @memoize + def thumb_size(self): + ''' use overrride value or read thumb_size from registry + image sizes must fit to value in allowed image sizes + none will suppress thumb! + ''' + if getattr(self.data,'no_thumbs',False): + #individual setting overrides ... + return 'none' + thsize=getattr(self.data,'ov_thumbsize','') + if thsize > ' ': + return thsize + registry = getUtility(IRegistry) + settings = registry.forInterface( + ISiteSchema, prefix="plone", check=False) + if settings.no_thumbs_portlet: + return 'none' + thumb_size_portlet = settings.thumb_size_portlet + return thumb_size_portlet + + def update(self): + pass + def render(self): + return self._template() + class AddForm(base.AddForm): schema = INavigationPortlet label = _(u"Add Navigation Portlet") diff --git a/plone/app/portlets/portlets/navigation_recurse.pt b/plone/app/portlets/portlets/navigation_recurse.pt index 1768ebb9..ed6c727b 100644 --- a/plone/app/portlets/portlets/navigation_recurse.pt +++ b/plone/app/portlets/portlets/navigation_recurse.pt @@ -1,6 +1,10 @@ @@ -12,27 +16,28 @@ use_remote_url node/useRemoteUrl | nothing; item_type node/portal_type; has_thumb node/item/getIcon; - thumb_url string:${node/item/getURL}/@@images/image/icon; + thumb_url string:${node/item/getURL}/@@images/image/${view/thumb_size}; is_current node/currentItem; is_in_path node/currentParent; li_class python:' navTreeCurrentNode' if is_current else ''; li_extr_class python:' navTreeItemInPath' if is_in_path else ''; li_folder_class python:' navTreeFolderish' if show_children else ''; - normalizeString nocall: context/plone_utils/normalizeString" + normalizeString nocall: context/plone_utils/normalizeString;" tal:condition="python:bottomLevel <= 0 or level <= bottomLevel" tal:attributes="class string:navTreeItem visualNoMarker${li_class}${li_extr_class}${li_folder_class} section-${node/normalized_id}"> - + alt node/Description; + class thumb_class"> Selected Item Title diff --git a/plone/app/portlets/portlets/news.pt b/plone/app/portlets/portlets/news.pt index 4d62e1fe..51f5d465 100644 --- a/plone/app/portlets/portlets/news.pt +++ b/plone/app/portlets/portlets/news.pt @@ -13,23 +13,28 @@ tal:attributes="href all_news_link" i18n:translate="box_news">News -
+