added viewName parameter to action, + adjustment of building URL

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2300 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-01-07 16:48:15 +00:00
parent 2740774b3d
commit 5263601212

View file

@ -37,6 +37,7 @@ class Action(object):
condition = True condition = True
permission = None permission = None
url = '.' url = '.'
viewName = ''
targetWindow = '' targetWindow = ''
title = '' title = ''
description = '' description = ''
@ -56,14 +57,24 @@ class Action(object):
@Lazy @Lazy
def url(self): def url(self):
return self.view.url return self.getActionUrl(self.view.url)
def getActionUrl(self, baseUrl):
if self.viewName:
return '/'.join((baseUrl, self.viewName))
else:
return baseUrl
class TargetAction(Action): class TargetAction(Action):
@Lazy @Lazy
def url(self): def url(self):
return self.view.virtualTargetUrl if self.page is None:
baseUrl = self.view.virtualTargetUrl
else:
baseUrl = self.page.virtualTargetUrl
return self.getActionUrl(baseUrl)
class DialogAction(Action): class DialogAction(Action):