diff --git a/browser/common.py b/browser/common.py index 16c72e2..687e9b6 100644 --- a/browser/common.py +++ b/browser/common.py @@ -28,7 +28,7 @@ from urllib import urlencode from zope import component from zope.app.form.browser.interfaces import ITerms from zope.app.i18n.interfaces import ITranslationDomain -from zope.app.security.interfaces import IAuthentication +from zope.app.security.interfaces import IAuthentication, IUnauthenticatedPrincipal from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.security.interfaces import IUnauthenticatedPrincipal from zope.app.security.interfaces import PrincipalLookupError @@ -150,6 +150,10 @@ class BaseView(GenericView, I18NView): principal = self.request.principal return principal and principal.id or '' + @Lazy + def isAnonymous(self): + return IUnauthenticatedPrincipal.providedBy(self.request.principal) + def recordAccess(self, viewName, **kw): access.record(self.request, principal=self.principalId, view=viewName, **kw) diff --git a/browser/node.py b/browser/node.py index cb43ed1..3f55699 100644 --- a/browser/node.py +++ b/browser/node.py @@ -117,10 +117,19 @@ class NodeView(BaseView): # TODO: is this useful in any case? self.virtualTargetObject is not None and canWrite(self.virtualTargetObject, 'title')): - cm.register('portlet_right', 'actions', title=_(u'Actions'), - subMacro=node_macros.macros['actions'], - priority=100) - if not IUnauthenticatedPrincipal.providedBy(self.request.principal): + # check if there are any available actions; + # store list of actions in macro object (evaluate only once) + actions = [act for act in self.getActions('portlet') if act.condition] + if actions: + cm.register('portlet_right', 'actions', title=_(u'Actions'), + subMacro=node_macros.macros['actions'], + priority=100, actions=actions) + if self.isAnonymous and self.globalOptions('provideLogin'): + cm.register('portlet_right', 'login', title=_(u'Not logged in'), + subMacro=node_macros.macros['login'], + icon='cybertools.icons/user.png', + priority=10) + if not self.isAnonymous: mi = self.controller.memberInfo title = mi.title.value or _(u'Personal Informations') url=None diff --git a/browser/node_macros.pt b/browser/node_macros.pt index ece06a2..574785c 100644 --- a/browser/node_macros.pt +++ b/browser/node_macros.pt @@ -221,14 +221,21 @@ - + + +
Log in
+
+ +
Log out
diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index f8001a1..94f5e33 100644 Binary files a/locales/de/LC_MESSAGES/loops.mo and b/locales/de/LC_MESSAGES/loops.mo differ diff --git a/locales/de/LC_MESSAGES/loops.po b/locales/de/LC_MESSAGES/loops.po index 29f0710..0f307a5 100644 --- a/locales/de/LC_MESSAGES/loops.po +++ b/locales/de/LC_MESSAGES/loops.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: $Id$\n" "POT-Creation-Date: 2007-05-22 12:00 CET\n" -"PO-Revision-Date: 2010-02-20 12:00 CET\n" +"PO-Revision-Date: 2010-06-27 12:00 CET\n" "Last-Translator: Helmut Merz \n" "Language-Team: loops developers \n" "MIME-Version: 1.0\n" @@ -197,6 +197,15 @@ msgstr "Lesezeichen für aktuelles Objekt hinzufügen" msgid "Remove from favorites" msgstr "Lesezeichen entfernen" +msgid "Personal Informations" +msgstr "Persönliche Informationen" + +msgid "Not logged in" +msgstr "Nicht angemeldet" + +msgid "Log in" +msgstr "Anmelden" + msgid "Presence" msgstr "Anwesenheit" diff --git a/security/common.py b/security/common.py index 3a0cbde..86ae3f7 100644 --- a/security/common.py +++ b/security/common.py @@ -53,7 +53,8 @@ allRolesExceptOwner = ( allRolesExceptOwnerAndMaster = tuple(allRolesExceptOwner[:-1]) minorPrivilegedRoles = ('zope.Anonymous', 'zope.Member',) localRoles = ('zope.Anonymous', 'zope.Member', 'zope.ContentManager', - 'loops.Staff', 'loops.Member', 'loops.Master', 'loops.Owner') + 'loops.SiteManager', 'loops.Staff', 'loops.Member', 'loops.Master', + 'loops.Owner') localPermissions = ('zope.ManageContent', 'zope.View', 'loops.ManageWorkspaces', 'loops.ViewRestricted', 'loops.EditRestricted', 'loops.AssignAsParent',)