[gen] Bugfix for result-tied POD templates.

This commit is contained in:
Gaetan Delannay 2013-01-08 13:28:35 +01:00
parent 240ce59519
commit 7b94bfb85e
7 changed files with 29 additions and 16 deletions

View file

@ -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'}

View file

@ -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):

View file

@ -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";
}

View file

@ -44,7 +44,7 @@
layout The layout object that will dictate how object content
will be rendered.
</tal:comment>
<metal:show define-macro="show">
<metal:show define-macro="show" tal:define="tagId python: 'content'">
<metal:layout use-macro="context/ui/widgets/show/macros/layout"/>
</metal:show>

View file

@ -66,8 +66,8 @@
<div class="portletContent" tal:define="searchInfo python: tool.getGroupedSearches(rootClass)">
<tal:comment replace="nothing">Section title (link triggers the default search), with action icons</tal:comment>
<a tal:define="queryParam python: searchInfo['default'] and ('&search=%s' % searchInfo['default']['name']) or ''"
tal:attributes="href python: '%s?className=%s%s' % (queryUrl, rootClass, queryParam);
<a tal:define="queryParam python: searchInfo['default'] and searchInfo['default']['name'] or ''"
tal:attributes="href python: '%s?className=%s&search=%s' % (queryUrl, rootClass, queryParam);
class python:test(not currentSearch and (currentClass==rootClass), 'portletCurrent', '')"
tal:content="structure python: _(rootClass + '_plural')">
</a>

View file

@ -2,7 +2,7 @@
<metal:view define-macro="view">
<tal:askAction condition="widget/askAction"
define="doLabel python:'%s_askaction' % widget['labelId'];
chekboxId python: '%s_%s' % (contextObj.UID(), name)">
chekboxId python: '%s_%s_cb' % (contextObj.UID(), name)">
<input type="checkbox" tal:attributes="name doLabel; id chekboxId"/>
<label tal:attributes="for chekboxId" class="discreet"
tal:content="python: _(doLabel)"></label>

View file

@ -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 @@
</tal:comment>
<metal:show define-macro="layout"
tal:define="contextMacro contextMacro| python: app.ui;
tagId tagId|python:'';
tagName tagName|python:'';
tagCss tagCss|python:'';
layoutCss layout/css_class;
isCell python: layoutType == 'cell'">
@ -29,7 +30,7 @@
class python: tagCss and ('%s %s' % (tagCss, layoutCss)).strip() or layoutCss;
style layout/style;
id tagId;
name tagId;">
name tagName;">
<tal:comment replace="nothing">The table header row</tal:comment>
<tr tal:condition="layout/headerRow" tal:attributes="valign layout/headerRow/valign">
<th tal:repeat="cell layout/headerRow/cells"
@ -76,7 +77,8 @@
slaveCss python: widget['master'] and ('slave_%s_%s' % (widget['masterName'], '_'.join(widget['masterValue']))) or '';
tagCss tagCss | python:'';
tagCss python: ('%s %s' % (slaveCss, tagCss)).strip();
tagId python: widget['master'] and 'slave' or ''">
tagId python: '%s_%s' % (contextObj.UID(), name);
tagName python: widget['master'] and 'slave' or ''">
<metal:layout use-macro="context/ui/widgets/show/macros/layout"/>
</metal:field>
@ -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'])">
<fieldset tal:condition="python: widget['style'] == 'fieldset'">
<legend tal:condition="widget/hasLabel">
<i tal:content="structure python: contextObj.translate(widget['labelId'])"></i>
@ -110,7 +113,7 @@
<tal:asTabs condition="python: widget['style'] == 'tabs'">
<table tal:attributes="width widget/wide;
class groupCss;
id tagId; name tagId">
id tagId; name tagName">
<tal:comment replace="nothing">First row: the tabs.</tal:comment>
<tr valign="middle"><td style="border-bottom: 1px solid #ff8040">
<table style="position:relative; bottom:-2px;" cellpadding="0" cellspacing="0">
@ -162,7 +165,7 @@
class groupCss;
cellspacing widget/cellspacing;
cellpadding widget/cellpadding;
id tagId; name tagId">
id tagId; name tagName">
<tal:comment replace="nothing">Display the title of the group if it is not rendered a fieldset.</tal:comment>
<tr tal:condition="python: (widget['style'] != 'fieldset') and widget['hasLabel']">
<td tal:attributes="colspan python: len(widget['columnsWidths']);
@ -218,3 +221,6 @@
<tal:comment replace="nothing">Displays the fact that a field is required.</tal:comment>
<tal:required metal:define-macro="required"><img tal:attributes="src string: $appUrl/ui/required.gif"/></tal:required>
<tal:comment replace="nothing">Button for showing changes to the field.</tal:comment>
<tal:changes metal:define-macro="changes"><img tal:attributes="src string: $appUrl/ui/changes.png"/></tal:changes>