From f3b30498e02c65ead8b744c83befd1daac26b2e0 Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 19 Jan 2009 13:58:50 +0000 Subject: [PATCH] extend TargetAction, provide CreateConceptPage for page-based add forms; allow suppressing of assignment part on forms git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3160 fd906abe-77d9-0310-91a1-e0d9ade77398 --- browser/action.py | 23 +++++++++-- browser/form.py | 14 +++++++ browser/form_macros.pt | 89 ++++++++++++++++++++-------------------- organize/browser/task.py | 11 ----- 4 files changed, 78 insertions(+), 59 deletions(-) diff --git a/browser/action.py b/browser/action.py index cf10efb..4330f6e 100644 --- a/browser/action.py +++ b/browser/action.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2008 Helmut Merz helmutm@cy55.de +# Copyright (c) 2009 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,9 +33,14 @@ from loops.util import _ class TargetAction(Action): - @Lazy + page = None + qualifier = typeToken = None + fixedType = False + viewTitle = '' + addParams = {} + + #@Lazy def url(self): - #return self.getActionUrl(self.page.getUrlForTarget(self.view)) if self.page is None: # how could this happen? baseUrl = self.view.virtualTargetUrl else: @@ -43,7 +48,17 @@ class TargetAction(Action): baseUrl = self.page.getUrlForTarget(self.target) else: baseUrl = self.page.virtualTargetUrl - return self.getActionUrl(baseUrl) + paramString = '' + urlParams = {} + if self.typeToken: + urlParams['form.type'] = self.typeToken + if self.fixedType: + urlParams['fixed_type'] = 'yes' + urlParams.update(self.addParams) + if urlParams: + paramString = '?' + urlencode(urlParams) + url = self.getActionUrl(baseUrl) + return url + paramString class DialogAction(Action): diff --git a/browser/form.py b/browser/form.py index e6c1265..8849868 100644 --- a/browser/form.py +++ b/browser/form.py @@ -74,6 +74,7 @@ class ObjectForm(NodeView): formState = FormState() # dummy, don't update! isInnerHtml = True isPopup = False + showAssignments = True def __init__(self, context, request): super(ObjectForm, self).__init__(context, request) @@ -375,6 +376,19 @@ class CreateConceptForm(CreateObjectForm): return () +class CreateConceptPage(CreateConceptForm): + + isInnerHtml = False + + def setupController(self): + super(CreateConceptPage, self).setupController() + self.registerDojoFormAll() + + @Lazy + def nextUrl(self): + return self.nodeView.getUrlForTarget(self.context) + + class InnerForm(CreateObjectForm): @property diff --git a/browser/form_macros.pt b/browser/form_macros.pt index dc84537..32697d9 100644 --- a/browser/form_macros.pt +++ b/browser/form_macros.pt @@ -46,12 +46,7 @@ - - Assign Parent Concepts - - @@ -75,6 +70,8 @@ fixedType request/fixed_type | nothing"> + - - - - @@ -125,7 +117,12 @@ - + + + + @@ -153,42 +150,46 @@ + + + + + + + + + - - - - - - -
Assign Parent Concepts
Assign Parent Concepts
Type:
+ +    + + + +
+
+ +
+ +
-    - - - -
-
- -
- -