From a4dfb9b2092f3471970c1e415cee7fe8073fa4fe Mon Sep 17 00:00:00 2001 From: helmutm Date: Wed, 19 Sep 2007 15:46:03 +0000 Subject: [PATCH] extend composer.schema for usage for standard form rendering git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2060 fd906abe-77d9-0310-91a1-e0d9ade77398 --- composer/schema/browser/common.py | 9 ++ composer/schema/browser/schema_macros.pt | 123 +++++++++++++++++++++++ composer/schema/field.py | 5 +- 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100755 composer/schema/browser/schema_macros.pt diff --git a/composer/schema/browser/common.py b/composer/schema/browser/common.py index 8b36c0f..456cbac 100644 --- a/composer/schema/browser/common.py +++ b/composer/schema/browser/common.py @@ -23,6 +23,7 @@ $Id$ """ from zope import component +from zope.app.pagetemplate import ViewPageTemplateFile from zope.app.session.interfaces import ISession from zope.cachedescriptors.property import Lazy @@ -30,10 +31,18 @@ from cybertools.composer.interfaces import IInstance from cybertools.composer.schema.interfaces import IClientFactory +schema_macros = ViewPageTemplateFile('schema_macros.pt') +schema_edit_macros = schema_macros # default: no editing + packageId = 'cybertools.composer.schema' class BaseView(object): + """ Base class for views that have schema objects as their context. + + Do not use this base class for views on typical content objects + that are not schemas! + """ clientName = None diff --git a/composer/schema/browser/schema_macros.pt b/composer/schema/browser/schema_macros.pt new file mode 100755 index 0000000..a3d8b4f --- /dev/null +++ b/composer/schema/browser/schema_macros.pt @@ -0,0 +1,123 @@ + + + + + + + + + + + + +
+ + + +
+
+ + + + + + + ??? + + + + + + ... + * + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + +
+
+ + + + + + + + + + +
+ + + + diff --git a/composer/schema/field.py b/composer/schema/field.py index 95a8740..2e18d31 100644 --- a/composer/schema/field.py +++ b/composer/schema/field.py @@ -40,6 +40,7 @@ class Field(Component): required = False standardFieldName = None vocabulary = None + defaultValue = None renderFactory = None def __init__(self, name, title=None, fieldType='textline', **kw): @@ -63,7 +64,9 @@ class Field(Component): voc = (self.vocabulary or '') if isinstance(voc, basestring): voc = voc.splitlines() - return [dict(token=v, title=v) for v in voc if v.strip()] + return [dict(token=t, title=t) for t in voc if t.strip()] + else: + return [dict(token=t.token, title=t.title) for t in voc] def getFieldTypeInfo(self): return fieldTypes.getTerm(self.fieldType)