Skip to content

Commit

Permalink
Remove code used to show the lock status, expired condition and histo…
Browse files Browse the repository at this point in the history
…ry view was removed from the document byline as this information was not available to anonymous users anyway

We need to review if this is available in the current implementation of the toolbar.
  • Loading branch information
hvelarde committed May 5, 2016
1 parent 1845be1 commit 5505e76
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 78 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ New:
Fixes:

- Document byline viewlet is now displayed only to anonymous users if permited by the `Allow anyone to view 'about' information` option in the `Security Settings` of `Site Setup` (closes `CMFPlone#1556`_).
Code used to show the lock status, expired condition and history view was removed from the document byline as this information was not available to anonymous users anyway.
[hvelarde]

- Fix body class ``pat-markspeciallinks`` not set.
Expand Down
41 changes: 0 additions & 41 deletions plone/app/layout/viewlets/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,42 +73,6 @@ def show(self):
)
return self.anonymous and settings.allow_anon_views_about

def show_history(self):
has_access_preview_versions_permission = _checkPermission(
'CMFEditions: Access previous versions',
self.context
)
if not has_access_preview_versions_permission:
return False
if IViewView.providedBy(self.__parent__):
return True
if IFolderContentsView.providedBy(self.__parent__):
return True
return False

def locked_icon(self):
if not getSecurityManager().checkPermission('Modify portal content',
self.context):
return ""

locked = False
lock_info = queryMultiAdapter((self.context, self.request),
name='plone_lock_info')
if lock_info is not None:
locked = lock_info.is_locked()
else:
context = aq_inner(self.context)
lockable = getattr(
context.aq_explicit, 'wl_isLocked', None) is not None
locked = lockable and context.wl_isLocked()

if not locked:
return ""

portal = self.portal_state.portal()
icon = portal.restrictedTraverse('lock_icon.png')
return icon.tag(title='Locked')

def creator(self):
return self.context.Creator()

Expand All @@ -120,11 +84,6 @@ def authorname(self):
author = self.author()
return author and author['fullname'] or self.creator()

def isExpired(self):
if base_hasattr(self.context, 'expires'):
return self.context.expires().isPast()
return False

def toLocalizedTime(self, time, long_format=None, time_only=None):
"""Convert time to localized time
"""
Expand Down
20 changes: 0 additions & 20 deletions plone/app/layout/viewlets/document_byline.pt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
id="plone-document-byline"
i18n:domain="plone"
tal:condition="view/show">
<span id="lock-icon"
tal:define="lock_icon view/locked_icon"
tal:condition="python:lock_icon">
<img tal:replace="structure lock_icon" />
</span>

<tal:creator tal:define="creator_short_form view/creator;"
tal:condition="creator_short_form">
<tal:name tal:define="creator_long_form string:?author=${creator_short_form};
Expand Down Expand Up @@ -52,20 +46,6 @@
</span>
</tal:dates>

<tal:expired tal:condition="view/isExpired">
<span class="state-expired"
i18n:translate="time_expired">expired</span>
</tal:expired>

<span class="contentHistory" id="content-history"
tal:condition="view/show_history">
<a href="#"
tal:attributes="href string:${here/absolute_url}/@@historyview"
i18n:translate="label_history">History</a>
</span>

<div class="documentContributors"
tal:define="contributors context/Contributors"
tal:condition="contributors"
Expand Down
17 changes: 0 additions & 17 deletions plone/app/layout/viewlets/tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,6 @@ def _get_viewlet(self):
viewlet.update()
return viewlet

def test_anonymous_locked_icon(self):
viewlet = self._get_viewlet()
ILockable(self.context).lock()
self.logout()
viewlet = self._get_viewlet()
self.assertEqual(viewlet.locked_icon(), '')

def test_locked_icon(self):
viewlet = self._get_viewlet()
self.assertEqual(viewlet.locked_icon(), "")
ILockable(self.context).lock()
lockIconUrl = (
'<img src="http://nohost/plone/lock_icon.png" alt="" '
'title="Locked" height="16" width="16" />'
)
self.assertEqual(viewlet.locked_icon(), lockIconUrl)

def test_pub_date(self):
# configure our portal to enable publication date on pages globally on
# the site
Expand Down

0 comments on commit 5505e76

Please sign in to comment.