From 55a811fd0e491bf124cd2fb87f3f056c09bb07f2 Mon Sep 17 00:00:00 2001 From: jensens Date: Fri, 8 Apr 2016 08:57:01 +0200 Subject: [PATCH] [fc] Repository: plone.app.content Branch: refs/heads/master Date: 2016-04-07T00:24:27+02:00 Author: Johannes Raggam (thet) Commit: https://github.com/plone/plone.app.content/commit/115c8dbf6474c9cc70de556a51d8bb9737f42884 Format for easier readability. Files changed: M plone/app/content/browser/contents/__init__.py M plone/app/content/browser/vocabulary.py Repository: plone.app.content Branch: refs/heads/master Date: 2016-04-07T00:24:27+02:00 Author: Johannes Raggam (thet) Commit: https://github.com/plone/plone.app.content/commit/68abf185d7089e1cd7adfb873554442b37736755 More available columns in folder_contents. Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. Exclude ``Creator`` from the list of ``_unsafe_metadata``. Files changed: M CHANGES.rst M plone/app/content/browser/contents/__init__.py M plone/app/content/browser/vocabulary.py Repository: plone.app.content Branch: refs/heads/master Date: 2016-04-07T00:25:27+02:00 Author: Johannes Raggam (thet) Commit: https://github.com/plone/plone.app.content/commit/c7b07b81f3592c42855b4172cac341a41b137ef3 Show attributes from ``_unsafe_metadata`` if user has "Modify Portal Content" permissions. Files changed: M CHANGES.rst M plone/app/content/browser/vocabulary.py Repository: plone.app.content Branch: refs/heads/master Date: 2016-04-07T00:25:27+02:00 Author: Johannes Raggam (thet) Commit: https://github.com/plone/plone.app.content/commit/cbb69387d606b862cde6355ec20a3358facb5610 Remove ``portal_type`` from available columns and use the translated ``Type`` instead. ``portal_type`` is now available on the attributes object. Files changed: M CHANGES.rst M plone/app/content/browser/contents/__init__.py Repository: plone.app.content Branch: refs/heads/master Date: 2016-04-07T00:26:35+02:00 Author: Johannes Raggam (thet) Commit: https://github.com/plone/plone.app.content/commit/3b529a3f93fb2dae4714fb0195eb4a6c17abe70d Extend translation ignore list for metadata values in vocabulary Added most notably `portal_type`, `review_state` and `Subject` but also `exclude_from_nav`, `is_folderish`, `last_comment_date`, `meta_type` and `total_comments` to ``BaseVocabularyView`` ``translate_ignored`` list. Some of them are necessary for frontend logic and others cannot be translated. Fixes https://github.com/plone/plone.app.content/issues/77 Files changed: M CHANGES.rst M plone/app/content/browser/vocabulary.py Repository: plone.app.content Branch: refs/heads/master Date: 2016-04-08T08:57:01+02:00 Author: Jens W. Klein (jensens) Commit: https://github.com/plone/plone.app.content/commit/59f1b2606ed0104a1d34bafe502aaf64aa7c0483 Merge pull request #83 from plone/thet-fcmorecolumns More available columns in folder_contents. Files changed: M CHANGES.rst M plone/app/content/browser/contents/__init__.py M plone/app/content/browser/vocabulary.py --- last_commit.txt | 885 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 739 insertions(+), 146 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index 1e1ceaa97e..eec5e7bf59 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,196 +1,789 @@ -Repository: plone.app.z3cform +Repository: plone.app.content Branch: refs/heads/master -Date: 2016-04-08T00:20:55+02:00 +Date: 2016-04-07T00:24:27+02:00 Author: Johannes Raggam (thet) -Commit: https://github.com/plone/plone.app.z3cform/commit/48a37c56c87bb52a1208322b4fbb3a6961e4d41a +Commit: https://github.com/plone/plone.app.content/commit/115c8dbf6474c9cc70de556a51d8bb9737f42884 -Reduce dependency on plone.app.widgets in tests. +Format for easier readability. + +Files changed: +M plone/app/content/browser/contents/__init__.py +M plone/app/content/browser/vocabulary.py + +diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py +index 7d63e09..5199106 100644 +--- a/plone/app/content/browser/contents/__init__.py ++++ b/plone/app/content/browser/contents/__init__.py +@@ -172,26 +172,43 @@ def get_actions(self): + def get_columns(self): + # Base set of columns + columns = { +- 'id': translate(_('ID'), context=self.request), +- 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa +- 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa +- 'ExpirationDate': translate(_('Expiration date'), context=self.request), #noqa + 'CreationDate': translate(_('Created on'), context=self.request), # noqa +- 'review_state': translate(_('Review state'), context=self.request), # noqa +- 'Subject': translate(_('Tags'), context=self.request), +- 'portal_type': translate(_('Type'), context=self.request), +- 'is_folderish': translate(_('Folder'), context=self.request), ++ 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa + 'exclude_from_nav': translate(_('Excluded from navigation'), context=self.request), # noqa ++ 'ExpirationDate': translate(_('Expiration date'), context=self.request), # noqa + 'getObjSize': translate(_('Object Size'), context=self.request), # noqa ++ 'id': translate(_('ID'), context=self.request), ++ 'is_folderish': translate(_('Folder'), context=self.request), + 'last_comment_date': translate(_('Last comment date'), context=self.request), # noqa ++ 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa ++ 'portal_type': translate(_('Type'), context=self.request), ++ 'review_state': translate(_('Review state'), context=self.request), # noqa ++ 'Subject': translate(_('Tags'), context=self.request), + 'total_comments': translate(_('Total comments'), context=self.request), # noqa + } + # These columns either have alternatives or are probably not useful + ignored = [ +- 'Creator', 'Date', 'Description', 'Title', 'Type', 'author_name', +- 'cmf_uid', 'commentators', 'created', 'effective', 'end', +- 'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to', +- 'listCreators', 'location', 'meta_type', 'modified', 'start', ++ 'Creator', ++ 'Date', ++ 'Description', ++ 'Title', ++ 'Type', ++ 'author_name', ++ 'cmf_uid', ++ 'commentators', ++ 'created', ++ 'effective', ++ 'end', ++ 'expires', ++ 'getIcon', ++ 'getId', ++ 'getRemoteUrl', ++ 'in_response_to', ++ 'listCreators', ++ 'location', ++ 'meta_type', ++ 'modified', ++ 'start', + 'sync_uid' + ] + # Add in extra metadata columns +@@ -221,7 +238,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'] + columns.keys(), ++ 'attributes': ['Title', 'path', 'getURL', 'getIcon'] + columns.keys(), # noqa + 'buttons': self.get_actions(), + 'rearrange': { + 'properties': { +@@ -251,11 +268,25 @@ def __call__(self): + + class ContextInfo(BrowserView): + +- attributes = ['UID', 'Title', 'Type', 'path', 'review_state', +- 'ModificationDate', 'EffectiveDate', 'CreationDate', +- 'is_folderish', 'Subject', 'getURL', 'id', +- 'exclude_from_nav', 'getObjSize', 'last_comment_date', +- 'total_comments', 'portal_type'] ++ attributes = [ ++ 'CreationDate', ++ 'EffectiveDate', ++ 'exclude_from_nav', ++ 'getObjSize', ++ 'getURL', ++ 'id', ++ 'is_folderish', ++ 'last_comment_date', ++ 'ModificationDate', ++ 'path', ++ 'portal_type', ++ 'review_state', ++ 'Subject', ++ 'Title', ++ 'total_comments', ++ 'Type', ++ 'UID' ++ ] + + def __call__(self): + factories_menu = getUtility( +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index 9f70bac..85f510b 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -32,10 +32,10 @@ + + DEFAULT_PERMISSION = 'View' + PERMISSIONS = { +- 'plone.app.vocabularies.Users': 'Modify portal content', + 'plone.app.vocabularies.Catalog': 'View', + 'plone.app.vocabularies.Keywords': 'Modify portal content', +- 'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content' ++ 'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content', ++ 'plone.app.vocabularies.Users': 'Modify portal content', + } + + _permissions = deprecated(PERMISSIONS, 'Use PERMISSION variable instead') +@@ -51,9 +51,18 @@ def _parseJSON(s): + return s + + +-_unsafe_metadata = ['Creator', 'listCreators', 'author_name', 'commentors'] ++_unsafe_metadata = [ ++ 'author_name', ++ 'commentors', ++ 'Creator', ++ 'listCreators', ++] + _safe_callable_metadata = [ +- 'getURL', 'getPath', 'review_state', 'getIcon', 'is_folderish', ++ 'getIcon', ++ 'getPath', ++ 'getURL', ++ 'is_folderish', ++ 'review_state', + ] + + +@@ -143,12 +152,35 @@ def __call__(self): + attributes = attributes.split(',') + + translate_ignored = [ +- 'Creator', 'Date', 'Description', 'Title', 'author_name', +- 'cmf_uid', 'commentators', 'created', 'effective', 'end', +- 'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to', +- 'listCreators', 'location', 'modified', 'start', 'sync_uid', +- 'path', 'getURL', 'EffectiveDate', 'getObjSize', 'id', +- 'UID', 'ExpirationDate', 'ModificationDate', 'CreationDate', ++ 'author_name', ++ 'cmf_uid', ++ 'commentators', ++ 'created', ++ 'CreationDate', ++ 'Creator', ++ 'Date', ++ 'Description', ++ 'effective', ++ 'EffectiveDate', ++ 'end', ++ 'ExpirationDate', ++ 'expires', ++ 'getIcon', ++ 'getId', ++ 'getObjSize', ++ 'getRemoteUrl', ++ 'getURL', ++ 'id', ++ 'in_response_to', ++ 'listCreators', ++ 'location', ++ 'ModificationDate', ++ 'modified', ++ 'path', ++ 'start', ++ 'sync_uid', ++ 'Title', ++ 'UID', + ] + if attributes: + base_path = getNavigationRoot(context) + + +Repository: plone.app.content + + +Branch: refs/heads/master +Date: 2016-04-07T00:24:27+02:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.content/commit/68abf185d7089e1cd7adfb873554442b37736755 + +More available columns in folder_contents. +Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. +Exclude ``Creator`` from the list of ``_unsafe_metadata``. Files changed: M CHANGES.rst -M plone/app/z3cform/tests/test_widgets.py +M plone/app/content/browser/contents/__init__.py +M plone/app/content/browser/vocabulary.py diff --git a/CHANGES.rst b/CHANGES.rst -index 2b95fb4..a7f2f21 100644 +index 2376cc0..116292a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -25,6 +25,9 @@ New: +@@ -10,7 +10,9 @@ Incompatibilities: - Fixes: + New: -+- Reduce dependency on plone.app.widgets in tests. +-- *add item here* ++- Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. ++ Exclude ``Creator`` from the list of ``_unsafe_metadata``. + [thet] -+ - - Enhance test in order to show problem in RelatedItemsWidget with - navigation-roots - [jensens] -diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py -index 619184e..8bbafeb 100644 ---- a/plone/app/z3cform/tests/test_widgets.py -+++ b/plone/app/z3cform/tests/test_widgets.py -@@ -4,9 +4,7 @@ - from mock import Mock - from plone.app.testing import setRoles - from plone.app.testing import TEST_USER_ID --from plone.app.widgets.testing import ExampleVocabulary --from plone.app.widgets.testing import PLONEAPPWIDGETS_DX_INTEGRATION_TESTING --from plone.app.widgets.testing import TestRequest -+from zope.publisher.browser import TestRequest as BaseTestRequest - from plone.app.z3cform.tests.layer import PAZ3CForm_INTEGRATION_TESTING - from plone.app.z3cform.widget import BaseWidget - from plone.dexterity.fti import DexterityFTI -@@ -19,6 +17,7 @@ - from zope.component import provideUtility - from zope.component.globalregistry import base - from zope.interface import alsoProvides -+from zope.interface import implements - from zope.interface import Interface - from zope.schema import Choice - from zope.schema import Date -@@ -27,12 +26,34 @@ - from zope.schema import Set - from zope.schema import TextLine - from zope.schema import Tuple -+from zope.schema.interfaces import IVocabularyFactory -+from zope.schema.vocabulary import SimpleTerm -+from zope.schema.vocabulary import SimpleVocabulary - - import mock - import pytz - import unittest - - -+class ExampleVocabulary(object): -+ implements(IVocabularyFactory) -+ -+ def __call__(self, context, query=None): -+ items = [u'One', u'Two', u'Three'] -+ tmp = SimpleVocabulary([ -+ SimpleTerm(it.lower(), it.lower(), it) -+ for it in items -+ if query is None -+ or query.lower() in it.lower() -+ ]) -+ tmp.test = 1 -+ return tmp -+ -+ -+class TestRequest(BaseTestRequest): -+ pass -+ -+ - class BaseWidgetTests(unittest.TestCase): - def setUp(self): -@@ -1226,7 +1247,7 @@ def _custom_field_widget(field, request): + Fixes: - class RichTextWidgetTests(unittest.TestCase): +diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py +index 5199106..33f7d52 100644 +--- a/plone/app/content/browser/contents/__init__.py ++++ b/plone/app/content/browser/contents/__init__.py +@@ -173,24 +173,27 @@ def get_columns(self): + # Base set of columns + columns = { + 'CreationDate': translate(_('Created on'), context=self.request), # noqa ++ 'Creator': translate(_('Creator'), context=self.request), ++ 'Description': translate(_('Description'), context=self.request), + 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa ++ 'end': translate(_('End Date'), context=self.request), + 'exclude_from_nav': translate(_('Excluded from navigation'), context=self.request), # noqa + 'ExpirationDate': translate(_('Expiration date'), context=self.request), # noqa + 'getObjSize': translate(_('Object Size'), context=self.request), # noqa + 'id': translate(_('ID'), context=self.request), + 'is_folderish': translate(_('Folder'), context=self.request), + 'last_comment_date': translate(_('Last comment date'), context=self.request), # noqa ++ 'location': translate(_('Location'), context=self.request), + 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa + 'portal_type': translate(_('Type'), context=self.request), + 'review_state': translate(_('Review state'), context=self.request), # noqa ++ 'start': translate(_('Start Date'), context=self.request), + 'Subject': translate(_('Tags'), context=self.request), + 'total_comments': translate(_('Total comments'), context=self.request), # noqa + } + # These columns either have alternatives or are probably not useful + ignored = [ +- 'Creator', + 'Date', +- 'Description', + 'Title', + 'Type', + 'author_name', +@@ -198,17 +201,14 @@ def get_columns(self): + 'commentators', + 'created', + 'effective', +- 'end', + 'expires', + 'getIcon', + 'getId', + 'getRemoteUrl', + 'in_response_to', + 'listCreators', +- 'location', + 'meta_type', + 'modified', +- 'start', + 'sync_uid' + ] + # Add in extra metadata columns +@@ -270,22 +270,27 @@ class ContextInfo(BrowserView): -- layer = PLONEAPPWIDGETS_DX_INTEGRATION_TESTING -+ layer = PAZ3CForm_INTEGRATION_TESTING + attributes = [ + 'CreationDate', ++ 'Creator', ++ 'Description', + 'EffectiveDate', ++ 'end', + 'exclude_from_nav', + 'getObjSize', + 'getURL', + 'id', + 'is_folderish', + 'last_comment_date', ++ 'location' + 'ModificationDate', + 'path', + 'portal_type', + 'review_state', ++ 'start', + 'Subject', + 'Title', + 'total_comments', + 'Type', +- 'UID' ++ 'UID', + ] - def setUp(self): - from plone.app.textfield import RichText as RichTextField + def __call__(self): +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index 85f510b..b4cec47 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -54,7 +54,6 @@ def _parseJSON(s): + _unsafe_metadata = [ + 'author_name', + 'commentors', +- 'Creator', + 'listCreators', + ] + _safe_callable_metadata = [ -Repository: plone.app.z3cform +Repository: plone.app.content Branch: refs/heads/master -Date: 2016-04-08T00:21:54+02:00 +Date: 2016-04-07T00:25:27+02:00 Author: Johannes Raggam (thet) -Commit: https://github.com/plone/plone.app.z3cform/commit/cec262e8ade0d7ce55f04ef3fbe0759d81bd2444 +Commit: https://github.com/plone/plone.app.content/commit/c7b07b81f3592c42855b4172cac341a41b137ef3 -Merge pull request #44 from plone/thet-rmwidgetsdep +Show attributes from ``_unsafe_metadata`` if user has "Modify Portal Content" permissions. -remove test dep on plone.app.widgets +Files changed: +M CHANGES.rst +M plone/app/content/browser/vocabulary.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index 116292a..bd30c01 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -11,7 +11,7 @@ Incompatibilities: + New: + + - Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. +- Exclude ``Creator`` from the list of ``_unsafe_metadata``. ++ Show attributes from ``_unsafe_metadata`` if user has "Modify Portal Content" permissions. + [thet] + + Fixes: +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index b4cec47..b628a31 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -54,6 +54,7 @@ def _parseJSON(s): + _unsafe_metadata = [ + 'author_name', + 'commentors', ++ 'Creator', + 'listCreators', + ] + _safe_callable_metadata = [ +@@ -183,6 +184,8 @@ def __call__(self): + ] + if attributes: + base_path = getNavigationRoot(context) ++ sm = getSecurityManager() ++ can_edit = sm.checkPermission('Modify portal content', context) + for vocab_item in results: + if not results_are_brains: + vocab_item = vocab_item.value +@@ -191,7 +194,7 @@ def __call__(self): + key = attr + if ':' in attr: + key, attr = attr.split(':', 1) +- if attr in _unsafe_metadata: ++ if attr in _unsafe_metadata and not can_edit: + continue + if key == 'path': + attr = 'getPath' + + +Repository: plone.app.content + + +Branch: refs/heads/master +Date: 2016-04-07T00:25:27+02:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.content/commit/cbb69387d606b862cde6355ec20a3358facb5610 + +Remove ``portal_type`` from available columns and use the translated ``Type`` instead. +``portal_type`` is now available on the attributes object. Files changed: M CHANGES.rst -M plone/app/z3cform/tests/test_widgets.py +M plone/app/content/browser/contents/__init__.py diff --git a/CHANGES.rst b/CHANGES.rst -index 2b95fb4..a7f2f21 100644 +index bd30c01..42d1d93 100644 --- a/CHANGES.rst +++ b/CHANGES.rst -@@ -25,6 +25,9 @@ New: +@@ -12,6 +12,8 @@ New: + + - Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. + Show attributes from ``_unsafe_metadata`` if user has "Modify Portal Content" permissions. ++ Remove ``portal_type`` from available columns and use the translated ``Type`` instead. ++ ``portal_type`` is now available on the attributes object. + [thet] Fixes: +diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py +index 33f7d52..72aa372 100644 +--- a/plone/app/content/browser/contents/__init__.py ++++ b/plone/app/content/browser/contents/__init__.py +@@ -185,17 +185,16 @@ def get_columns(self): + 'last_comment_date': translate(_('Last comment date'), context=self.request), # noqa + 'location': translate(_('Location'), context=self.request), + 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa +- 'portal_type': translate(_('Type'), context=self.request), + 'review_state': translate(_('Review state'), context=self.request), # noqa + 'start': translate(_('Start Date'), context=self.request), + 'Subject': translate(_('Tags'), context=self.request), ++ 'Type': translate(_('Type'), context=self.request), + 'total_comments': translate(_('Total comments'), context=self.request), # noqa + } + # These columns either have alternatives or are probably not useful + ignored = [ + 'Date', + 'Title', +- 'Type', + 'author_name', + 'cmf_uid', + 'commentators', +@@ -209,6 +208,7 @@ def get_columns(self): + 'listCreators', + 'meta_type', + 'modified', ++ 'portal_type', + 'sync_uid' + ] + # Add in extra metadata columns +@@ -238,7 +238,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'] + columns.keys(), # noqa ++ 'attributes': ['Title', 'path', 'getURL', 'getIcon', 'portal_type'] + columns.keys(), # noqa + 'buttons': self.get_actions(), + 'rearrange': { + 'properties': { + + +Repository: plone.app.content + + +Branch: refs/heads/master +Date: 2016-04-07T00:26:35+02:00 +Author: Johannes Raggam (thet) +Commit: https://github.com/plone/plone.app.content/commit/3b529a3f93fb2dae4714fb0195eb4a6c17abe70d + +Extend translation ignore list for metadata values in vocabulary +Added most notably `portal_type`, `review_state` and `Subject` but also `exclude_from_nav`, `is_folderish`, `last_comment_date`, `meta_type` and `total_comments` to ``BaseVocabularyView`` ``translate_ignored`` list. +Some of them are necessary for frontend logic and others cannot be translated. +Fixes https://github.com/plone/plone.app.content/issues/77 + +Files changed: +M CHANGES.rst +M plone/app/content/browser/vocabulary.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index 42d1d93..88cf599 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -11,13 +11,22 @@ Incompatibilities: + New: -+- Reduce dependency on plone.app.widgets in tests. + - Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. + [thet] + - - Enhance test in order to show problem in RelatedItemsWidget with - navigation-roots - [jensens] -diff --git a/plone/app/z3cform/tests/test_widgets.py b/plone/app/z3cform/tests/test_widgets.py -index 619184e..8bbafeb 100644 ---- a/plone/app/z3cform/tests/test_widgets.py -+++ b/plone/app/z3cform/tests/test_widgets.py -@@ -4,9 +4,7 @@ - from mock import Mock - from plone.app.testing import setRoles - from plone.app.testing import TEST_USER_ID --from plone.app.widgets.testing import ExampleVocabulary --from plone.app.widgets.testing import PLONEAPPWIDGETS_DX_INTEGRATION_TESTING --from plone.app.widgets.testing import TestRequest -+from zope.publisher.browser import TestRequest as BaseTestRequest - from plone.app.z3cform.tests.layer import PAZ3CForm_INTEGRATION_TESTING - from plone.app.z3cform.widget import BaseWidget - from plone.dexterity.fti import DexterityFTI -@@ -19,6 +17,7 @@ - from zope.component import provideUtility - from zope.component.globalregistry import base - from zope.interface import alsoProvides -+from zope.interface import implements - from zope.interface import Interface - from zope.schema import Choice - from zope.schema import Date -@@ -27,12 +26,34 @@ - from zope.schema import Set - from zope.schema import TextLine - from zope.schema import Tuple -+from zope.schema.interfaces import IVocabularyFactory -+from zope.schema.vocabulary import SimpleTerm -+from zope.schema.vocabulary import SimpleVocabulary - - import mock - import pytz - import unittest - - -+class ExampleVocabulary(object): -+ implements(IVocabularyFactory) + Show attributes from ``_unsafe_metadata`` if user has "Modify Portal Content" permissions. +- Remove ``portal_type`` from available columns and use the translated ``Type`` instead. +- ``portal_type`` is now available on the attributes object. + [thet] + + Fixes: + ++- Remove ``portal_type`` from available columns and use ``Type`` instead, which is meant to be read by humans. ++ ``portal_type`` is now available on the attributes object. ++ [thet] + -+ def __call__(self, context, query=None): -+ items = [u'One', u'Two', u'Three'] -+ tmp = SimpleVocabulary([ -+ SimpleTerm(it.lower(), it.lower(), it) -+ for it in items -+ if query is None -+ or query.lower() in it.lower() -+ ]) -+ tmp.test = 1 -+ return tmp ++- Added most notably `portal_type`, `review_state` and `Subject` but also `exclude_from_nav`, `is_folderish`, `last_comment_date`, `meta_type` and `total_comments` to ``BaseVocabularyView`` ``translate_ignored`` list. ++ Some of them are necessary for frontend logic and others cannot be translated. ++ Fixes https://github.com/plone/plone.app.content/issues/77 ++ [thet] + + - Vocabulary permissions are considered View permission by default, if not + stated different in PERMISSION global. Renamed _permissions to PERMISSIONS, + Deprecated BBB name in place. Also minor code-style changes +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index b628a31..37b4104 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -163,6 +163,7 @@ def __call__(self): + 'effective', + 'EffectiveDate', + 'end', ++ 'exclude_from_nav', + 'ExpirationDate', + 'expires', + 'getIcon', +@@ -172,14 +173,21 @@ def __call__(self): + 'getURL', + 'id', + 'in_response_to', ++ 'is_folderish', ++ 'last_comment_date', + 'listCreators', + 'location', ++ 'meta_type', + 'ModificationDate', + 'modified', + 'path', ++ 'portal_type', ++ 'review_state', + 'start', ++ 'Subject', + 'sync_uid', + 'Title', ++ 'total_comments' + 'UID', + ] + if attributes: + + +Repository: plone.app.content + + +Branch: refs/heads/master +Date: 2016-04-08T08:57:01+02:00 +Author: Jens W. Klein (jensens) +Commit: https://github.com/plone/plone.app.content/commit/59f1b2606ed0104a1d34bafe502aaf64aa7c0483 + +Merge pull request #83 from plone/thet-fcmorecolumns + + More available columns in folder_contents. + +Files changed: +M CHANGES.rst +M plone/app/content/browser/contents/__init__.py +M plone/app/content/browser/vocabulary.py + +diff --git a/CHANGES.rst b/CHANGES.rst +index 2376cc0..88cf599 100644 +--- a/CHANGES.rst ++++ b/CHANGES.rst +@@ -10,10 +10,23 @@ Incompatibilities: + + New: + +-- *add item here* ++- Add ``Creator``, ``Description``, ``end``, ``start`` and ``location`` to the available columns and context attributes for folder_contents. ++ [thet] + -+class TestRequest(BaseTestRequest): -+ pass ++ Show attributes from ``_unsafe_metadata`` if user has "Modify Portal Content" permissions. ++ [thet] + + Fixes: + ++- Remove ``portal_type`` from available columns and use ``Type`` instead, which is meant to be read by humans. ++ ``portal_type`` is now available on the attributes object. ++ [thet] + ++- Added most notably `portal_type`, `review_state` and `Subject` but also `exclude_from_nav`, `is_folderish`, `last_comment_date`, `meta_type` and `total_comments` to ``BaseVocabularyView`` ``translate_ignored`` list. ++ Some of them are necessary for frontend logic and others cannot be translated. ++ Fixes https://github.com/plone/plone.app.content/issues/77 ++ [thet] + - class BaseWidgetTests(unittest.TestCase): + - Vocabulary permissions are considered View permission by default, if not + stated different in PERMISSION global. Renamed _permissions to PERMISSIONS, + Deprecated BBB name in place. Also minor code-style changes +diff --git a/plone/app/content/browser/contents/__init__.py b/plone/app/content/browser/contents/__init__.py +index 7d63e09..72aa372 100644 +--- a/plone/app/content/browser/contents/__init__.py ++++ b/plone/app/content/browser/contents/__init__.py +@@ -172,26 +172,43 @@ def get_actions(self): + def get_columns(self): + # Base set of columns + columns = { +- 'id': translate(_('ID'), context=self.request), +- 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa +- 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa +- 'ExpirationDate': translate(_('Expiration date'), context=self.request), #noqa + 'CreationDate': translate(_('Created on'), context=self.request), # noqa +- 'review_state': translate(_('Review state'), context=self.request), # noqa +- 'Subject': translate(_('Tags'), context=self.request), +- 'portal_type': translate(_('Type'), context=self.request), +- 'is_folderish': translate(_('Folder'), context=self.request), ++ 'Creator': translate(_('Creator'), context=self.request), ++ 'Description': translate(_('Description'), context=self.request), ++ 'EffectiveDate': translate(_('Publication date'), context=self.request), # noqa ++ 'end': translate(_('End Date'), context=self.request), + 'exclude_from_nav': translate(_('Excluded from navigation'), context=self.request), # noqa ++ 'ExpirationDate': translate(_('Expiration date'), context=self.request), # noqa + 'getObjSize': translate(_('Object Size'), context=self.request), # noqa ++ 'id': translate(_('ID'), context=self.request), ++ 'is_folderish': translate(_('Folder'), context=self.request), + 'last_comment_date': translate(_('Last comment date'), context=self.request), # noqa ++ 'location': translate(_('Location'), context=self.request), ++ 'ModificationDate': translate(_('Last modified'), context=self.request), # noqa ++ 'review_state': translate(_('Review state'), context=self.request), # noqa ++ 'start': translate(_('Start Date'), context=self.request), ++ 'Subject': translate(_('Tags'), context=self.request), ++ 'Type': translate(_('Type'), context=self.request), + 'total_comments': translate(_('Total comments'), context=self.request), # noqa + } + # These columns either have alternatives or are probably not useful + ignored = [ +- 'Creator', 'Date', 'Description', 'Title', 'Type', 'author_name', +- 'cmf_uid', 'commentators', 'created', 'effective', 'end', +- 'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to', +- 'listCreators', 'location', 'meta_type', 'modified', 'start', ++ 'Date', ++ 'Title', ++ 'author_name', ++ 'cmf_uid', ++ 'commentators', ++ 'created', ++ 'effective', ++ 'expires', ++ 'getIcon', ++ 'getId', ++ 'getRemoteUrl', ++ 'in_response_to', ++ 'listCreators', ++ 'meta_type', ++ 'modified', ++ 'portal_type', + 'sync_uid' + ] + # Add in extra metadata columns +@@ -221,7 +238,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'] + columns.keys(), ++ 'attributes': ['Title', 'path', 'getURL', 'getIcon', 'portal_type'] + columns.keys(), # noqa + 'buttons': self.get_actions(), + 'rearrange': { + 'properties': { +@@ -251,11 +268,30 @@ def __call__(self): + + class ContextInfo(BrowserView): + +- attributes = ['UID', 'Title', 'Type', 'path', 'review_state', +- 'ModificationDate', 'EffectiveDate', 'CreationDate', +- 'is_folderish', 'Subject', 'getURL', 'id', +- 'exclude_from_nav', 'getObjSize', 'last_comment_date', +- 'total_comments', 'portal_type'] ++ attributes = [ ++ 'CreationDate', ++ 'Creator', ++ 'Description', ++ 'EffectiveDate', ++ 'end', ++ 'exclude_from_nav', ++ 'getObjSize', ++ 'getURL', ++ 'id', ++ 'is_folderish', ++ 'last_comment_date', ++ 'location' ++ 'ModificationDate', ++ 'path', ++ 'portal_type', ++ 'review_state', ++ 'start', ++ 'Subject', ++ 'Title', ++ 'total_comments', ++ 'Type', ++ 'UID', ++ ] + + def __call__(self): + factories_menu = getUtility( +diff --git a/plone/app/content/browser/vocabulary.py b/plone/app/content/browser/vocabulary.py +index 9f70bac..37b4104 100644 +--- a/plone/app/content/browser/vocabulary.py ++++ b/plone/app/content/browser/vocabulary.py +@@ -32,10 +32,10 @@ + + DEFAULT_PERMISSION = 'View' + PERMISSIONS = { +- 'plone.app.vocabularies.Users': 'Modify portal content', + 'plone.app.vocabularies.Catalog': 'View', + 'plone.app.vocabularies.Keywords': 'Modify portal content', +- 'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content' ++ 'plone.app.vocabularies.SyndicatableFeedItems': 'Modify portal content', ++ 'plone.app.vocabularies.Users': 'Modify portal content', + } + + _permissions = deprecated(PERMISSIONS, 'Use PERMISSION variable instead') +@@ -51,9 +51,18 @@ def _parseJSON(s): + return s + - def setUp(self): -@@ -1226,7 +1247,7 @@ def _custom_field_widget(field, request): +-_unsafe_metadata = ['Creator', 'listCreators', 'author_name', 'commentors'] ++_unsafe_metadata = [ ++ 'author_name', ++ 'commentors', ++ 'Creator', ++ 'listCreators', ++] + _safe_callable_metadata = [ +- 'getURL', 'getPath', 'review_state', 'getIcon', 'is_folderish', ++ 'getIcon', ++ 'getPath', ++ 'getURL', ++ 'is_folderish', ++ 'review_state', + ] - class RichTextWidgetTests(unittest.TestCase): -- layer = PLONEAPPWIDGETS_DX_INTEGRATION_TESTING -+ layer = PAZ3CForm_INTEGRATION_TESTING +@@ -143,15 +152,48 @@ def __call__(self): + attributes = attributes.split(',') - def setUp(self): - from plone.app.textfield import RichText as RichTextField + translate_ignored = [ +- 'Creator', 'Date', 'Description', 'Title', 'author_name', +- 'cmf_uid', 'commentators', 'created', 'effective', 'end', +- 'expires', 'getIcon', 'getId', 'getRemoteUrl', 'in_response_to', +- 'listCreators', 'location', 'modified', 'start', 'sync_uid', +- 'path', 'getURL', 'EffectiveDate', 'getObjSize', 'id', +- 'UID', 'ExpirationDate', 'ModificationDate', 'CreationDate', ++ 'author_name', ++ 'cmf_uid', ++ 'commentators', ++ 'created', ++ 'CreationDate', ++ 'Creator', ++ 'Date', ++ 'Description', ++ 'effective', ++ 'EffectiveDate', ++ 'end', ++ 'exclude_from_nav', ++ 'ExpirationDate', ++ 'expires', ++ 'getIcon', ++ 'getId', ++ 'getObjSize', ++ 'getRemoteUrl', ++ 'getURL', ++ 'id', ++ 'in_response_to', ++ 'is_folderish', ++ 'last_comment_date', ++ 'listCreators', ++ 'location', ++ 'meta_type', ++ 'ModificationDate', ++ 'modified', ++ 'path', ++ 'portal_type', ++ 'review_state', ++ 'start', ++ 'Subject', ++ 'sync_uid', ++ 'Title', ++ 'total_comments' ++ 'UID', + ] + if attributes: + base_path = getNavigationRoot(context) ++ sm = getSecurityManager() ++ can_edit = sm.checkPermission('Modify portal content', context) + for vocab_item in results: + if not results_are_brains: + vocab_item = vocab_item.value +@@ -160,7 +202,7 @@ def __call__(self): + key = attr + if ':' in attr: + key, attr = attr.split(':', 1) +- if attr in _unsafe_metadata: ++ if attr in _unsafe_metadata and not can_edit: + continue + if key == 'path': + attr = 'getPath'