From 7b94bfb85eeea4822e0936314951b30c8d8cb958 Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Tue, 8 Jan 2013 13:28:35 +0100 Subject: [PATCH] [gen] Bugfix for result-tied POD templates. --- gen/__init__.py | 10 ++++++++-- gen/layout.py | 5 +++-- gen/ui/appy.js | 2 +- gen/ui/page.pt | 2 +- gen/ui/portlet.pt | 4 ++-- gen/ui/widgets/pod.pt | 2 +- gen/ui/widgets/show.pt | 20 +++++++++++++------- 7 files changed, 29 insertions(+), 16 deletions(-) diff --git a/gen/__init__.py b/gen/__init__.py index fa05a3c..1b8da9e 100644 --- a/gen/__init__.py +++ b/gen/__init__.py @@ -1206,9 +1206,15 @@ class String(Type): def getDefaultLayouts(self): '''Returns the default layouts for this type. Default layouts can vary - acccording to format or multiplicity.''' - if self.format in (String.TEXT, String.XHTML): + acccording to format, multiplicity or history.''' + if self.format == String.TEXT: return {'view': 'l-f', 'edit': 'lrv-d-f'} + elif self.format == String.XHTML: + if self.historized: + view = 'lc-f' + else: + view = 'l-f' + return {'view': view, 'edit': 'lrv-d-f'} elif self.isMultiValued(): return {'view': 'l-f', 'edit': 'lrv-f'} diff --git a/gen/layout.py b/gen/layout.py index 5cf8f07..c72bb9f 100644 --- a/gen/layout.py +++ b/gen/layout.py @@ -25,6 +25,7 @@ # r - "required" The icon that specified that the field is required (if # relevant; typically only used on "edit" layouts) # f - "field" The field value, or input for entering a value. +# c - "changes" The button for displaying changes to a field # For every field of a Appy class, you can define, for every layout context, # what field-related information will appear, and how it will be rendered. @@ -48,7 +49,7 @@ macroDict = { # Field-related elements 'l': ('show', 'label'), 'd': ('show', 'description'), 'h': ('show', 'help'), 'v': ('show', 'validation'), - 'r': ('show', 'required') + 'r': ('show', 'required'), 'c': ('show', 'changes'), } # ------------------------------------------------------------------------------ @@ -119,7 +120,7 @@ class Table(LayoutElement): '''Represents a table where to dispose graphical elements.''' simpleParams = ('style', 'css_class', 'cellpadding', 'cellspacing', 'width', 'align') - derivedRepls = {'view': 'hrvd', 'cell': 'ld'} + derivedRepls = {'view': 'hrvd', 'cell': 'ldc'} def __init__(self, layoutString=None, style=None, css_class='', cellpadding=0, cellspacing=0, width='100%', align='left', other=None, derivedType=None): diff --git a/gen/ui/appy.js b/gen/ui/appy.js index 98059b5..07a26db 100644 --- a/gen/ui/appy.js +++ b/gen/ui/appy.js @@ -408,7 +408,7 @@ function generatePodDocument(contextUid, fieldName, podFormat, queryData) { theForm.podFormat.value = podFormat; theForm.askAction.value = "False"; theForm.queryData.value = queryData; - var askActionWidget = document.getElementById(contextUid + '_' + fieldName); + var askActionWidget = document.getElementById(contextUid + '_' + fieldName + '_cb'); if (askActionWidget && askActionWidget.checked) { theForm.askAction.value = "True"; } diff --git a/gen/ui/page.pt b/gen/ui/page.pt index 73256db..e49082c 100644 --- a/gen/ui/page.pt +++ b/gen/ui/page.pt @@ -44,7 +44,7 @@ layout The layout object that will dictate how object content will be rendered. - + diff --git a/gen/ui/portlet.pt b/gen/ui/portlet.pt index 024267b..88dbd1e 100644 --- a/gen/ui/portlet.pt +++ b/gen/ui/portlet.pt @@ -66,8 +66,8 @@
Section title (link triggers the default search), with action icons - diff --git a/gen/ui/widgets/pod.pt b/gen/ui/widgets/pod.pt index 6c11829..60326ad 100644 --- a/gen/ui/widgets/pod.pt +++ b/gen/ui/widgets/pod.pt @@ -2,7 +2,7 @@ + chekboxId python: '%s_%s_cb' % (contextObj.UID(), name)"> diff --git a/gen/ui/widgets/show.pt b/gen/ui/widgets/show.pt index db67a95..4c35722 100644 --- a/gen/ui/widgets/show.pt +++ b/gen/ui/widgets/show.pt @@ -9,7 +9,8 @@ contextMacro The base folder containing the macros to call for rendering the elements within the layout. Defaults to app.ui - tagId The name and id of the main tag for this layout (used + tagId The ID of the main tag for this layout. + tagName The name of the main tag for this layout (used a.o. for master/slave relationships). tagCss Some additional CSS class for the main tag (ie, the CSS class for a slave). @@ -18,7 +19,7 @@ @@ -29,7 +30,7 @@ class python: tagCss and ('%s %s' % (tagCss, layoutCss)).strip() or layoutCss; style layout/style; id tagId; - name tagId;"> + name tagName;"> The table header row + tagId python: '%s_%s' % (contextObj.UID(), name); + tagName python: widget['master'] and 'slave' or ''"> @@ -92,7 +94,8 @@ tal:define="tagCss python: widget['master'] and ('slave_%s_%s' % (widget['masterName'], '_'.join(widget['masterValue']))) or ''; widgetCss widget/css_class; groupCss python: tagCss and ('%s %s' % (tagCss, widgetCss)) or widgetCss; - tagId python: widget['master'] and 'slave' or ''"> + tagName python: widget['master'] and 'slave' or ''; + tagId python: '%s_%s' % (contextObj.UID(), widget['name'])">
@@ -110,7 +113,7 @@ + id tagId; name tagName"> First row: the tabs.
@@ -162,7 +165,7 @@ class groupCss; cellspacing widget/cellspacing; cellpadding widget/cellpadding; - id tagId; name tagId"> + id tagId; name tagName"> Display the title of the group if it is not rendered a fieldset.
Displays the fact that a field is required. + +Button for showing changes to the field. +