put skin spec in dialog URLs, making dialog forms customizable

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2432 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-03-05 09:18:58 +00:00
parent a1de35aeb3
commit 255d47f5da
4 changed files with 17 additions and 4 deletions

View file

@ -19,7 +19,7 @@
"""
Base classes (sort of views) for action portlet items.
$Id$
$Id: action.py 2313 2008-01-15 13:00:34Z helmutm $
"""
from urllib import urlencode
@ -68,8 +68,9 @@ class DialogAction(Action):
if self.fixedType:
urlParams['fixed_type'] = 'yes'
urlParams.update(self.addParams)
return self.jsOnClick % (self.dialogName, self.page.virtualTargetUrl,
self.viewName, urlencode(urlParams))
url = self.page.virtualTargetUrlWithSkin
return self.jsOnClick % (self.dialogName, url, self.viewName,
urlencode(urlParams))
@Lazy
def innerHtmlId(self):

View file

@ -225,6 +225,7 @@ class CreateObjectForm(ObjectForm):
def macro(self): return self.template.macros['create']
defaultTitle = u'Create Resource, Type = '
defaultType = '.loops/concepts/textdocument'
form_action = 'create_resource'
dialog_name = 'create'

View file

@ -68,7 +68,7 @@
tal:define="qualifier request/qualifier | string:resource;
innerForm request/inner_form | string:inner_form.html;
typeToken python: request.get('form.type')
or '.loops/concepts/textdocument';
or view.defaultType;
fixedType request/fixed_type | nothing">
<input type="hidden" name="form.action" value="create"
tal:attributes="value view/form_action" />

View file

@ -22,6 +22,7 @@ View class for Node objects.
$Id$
"""
from urlparse import urlparse, urlunparse
from zope import component, interface, schema
from zope.cachedescriptors.property import Lazy
from zope.app import zapi
@ -343,6 +344,16 @@ class NodeView(BaseView):
else:
return self.url
@Lazy
def virtualTargetUrlWithSkin(self):
url = self.virtualTargetUrl
if self.skin:
parts = urlparse(url)
url = urlunparse(parts[:2] +
('/++skin++' + self.skin.__name__ + parts[2],) +
parts[3:])
return url
@Lazy
def realTargetUrl(self):
target = self.virtualTargetObject