allow suppressing of 'create resource' action
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3257 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
a9f08097ff
commit
072334486f
3 changed files with 19 additions and 11 deletions
|
@ -496,6 +496,9 @@ class BaseView(GenericView, I18NView):
|
|||
def showObjectActions(self):
|
||||
return not IUnauthenticatedPrincipal.providedBy(self.request.principal)
|
||||
|
||||
def checkAction(self, name, category, target):
|
||||
return True
|
||||
|
||||
def openEditWindow(self, viewName='edit.html'):
|
||||
if self.editable:
|
||||
if checkPermission('loops.ManageSite', self.context):
|
||||
|
|
|
@ -371,6 +371,11 @@ class ConceptView(BaseView):
|
|||
|
||||
actions = dict(object=getObjectActions)
|
||||
|
||||
def checkAction(self, name, category, target):
|
||||
if name in (self.typeOptions('hide_action.' + category) or []):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class ConceptRelationView(ConceptView, BaseRelationView):
|
||||
|
||||
|
|
|
@ -423,10 +423,10 @@ class NodeView(BaseView):
|
|||
actions = []
|
||||
#self.registerDojo()
|
||||
self.registerDojoFormAll()
|
||||
if category in self.actions:
|
||||
actions.extend(self.actions[category](self, target=target))
|
||||
if target is None:
|
||||
target = self.virtualTarget
|
||||
if category in self.actions:
|
||||
actions.extend(self.actions[category](self, target=target))
|
||||
if target is not None:
|
||||
actions.extend(target.getActions(category, page=self, target=target))
|
||||
if target != self.virtualTarget: # self view must be used directly for target
|
||||
|
@ -441,19 +441,19 @@ class NodeView(BaseView):
|
|||
targetWindow='loops_cme',
|
||||
description='Open concept map editor in new window',
|
||||
url=cmeUrl, target=target))
|
||||
actions.append(DialogAction(self, title='Create Resource...',
|
||||
description='Create a new resource object.',
|
||||
page=self, target=target))
|
||||
if self.checkAction('create_resource', 'portlet', target):
|
||||
actions.append(DialogAction(self, title='Create Resource...',
|
||||
description='Create a new resource object.',
|
||||
page=self, target=target))
|
||||
return actions
|
||||
|
||||
def xx_getObjectActions(self, target=None):
|
||||
acts = []
|
||||
if self.globalOptions('organize.allowSendEmail'):
|
||||
acts.append('send_email')
|
||||
return actions.get('object', acts, view=self, page=self, target=target)
|
||||
|
||||
actions = dict(portlet=getPortletActions)
|
||||
|
||||
def checkAction(self, name, category, target):
|
||||
if name in ('create_resource',) and target is not None:
|
||||
return target.checkAction(name, category, target)
|
||||
return True
|
||||
|
||||
@Lazy
|
||||
def popupCreateObjectForm(self):
|
||||
return ("javascript:function%%20openDialog(url){"
|
||||
|
|
Loading…
Add table
Reference in a new issue