[gen] Allow to show the cumulative differences performed on historized String fields with format=String.XHTML.

This commit is contained in:
Gaetan Delannay 2013-01-08 16:58:29 +01:00
parent 6caeeb1761
commit ab00917df6
6 changed files with 90 additions and 29 deletions

View file

@ -5,11 +5,12 @@
layoutType The kind of layout: "view"? "edit"? "cell"?
layout The layout object that will dictate how object content
will be rendered.
tagId The ID of the main tag for this layout.
Options:
contextMacro The base folder containing the macros to call for
rendering the elements within the layout.
Defaults to app.ui
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
@ -59,15 +60,19 @@
Optionally:
widgetName If the field to show is within a List, we cheat and
include, within the widgetName, the row index.
showChanges Do we need to show a variant of the field showing
successive changes made to it?
</tal:comment>
<metal:field define-macro="field"
tal:define="contextMacro python: app.ui.widgets;
showChanges showChanges| python:False;
layout python: widget['layouts'][layoutType];
name widgetName| widget/name;
sync python: widget['sync'][layoutType];
outerValue value|nothing;
rawValue python: contextObj.getFieldValue(name,onlyIfSync=True,layoutType=layoutType,outerValue=outerValue);
value python: contextObj.getFormattedFieldValue(name, rawValue);
value python: contextObj.getFormattedFieldValue(name, rawValue, showChanges);
requestValue python: contextObj.getRequestFieldValue(name);
inRequest python: request.has_key(name);
errors errors | python: ();
@ -78,10 +83,20 @@
tagCss tagCss | python:'';
tagCss python: ('%s %s' % (slaveCss, tagCss)).strip();
tagId python: '%s_%s' % (contextObj.UID(), name);
tagName python: widget['master'] and 'slave' or ''">
tagName python: widget['master'] and 'slave' or '';">
<metal:layout use-macro="context/ui/widgets/show/macros/layout"/>
</metal:field>
<tal:comment replace="nothing">Call the previous macro, but from Ajax.</tal:comment>
<metal:afield define-macro="fieldAjax"
tal:define="widgetName request/fieldName;
layoutType request/layoutType;
showChanges python: request.get('showChanges', 'False') == 'True';
widget python: contextObj.getAppyType(widgetName, asDict=True);
page widget/pageName">
<metal:field use-macro="context/ui/widgets/show/macros/field"/>
</metal:afield>
<tal:comment replace="nothing">
This macro displays the widget corresponding to a group of widgets.
It requires:
@ -223,4 +238,4 @@
<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>
<tal:changes metal:define-macro="changes" tal:condition="python: contextObj.hasHistory(name)"><img style="cursor:pointer" tal:condition="not: showChanges" tal:attributes="src string: $appUrl/ui/changes.png; onclick python: 'askField(\'%s\',\'%s\',\'view\',\'True\')' % (tagId, contextObj.absolute_url()); title python: _('changes_show')"/><img style="cursor:pointer" tal:condition="showChanges" tal:attributes="src string: $appUrl/ui/changesNo.png; onclick python: 'askField(\'%s\',\'%s\',\'view\',\'False\')' % (tagId, contextObj.absolute_url()); title python: _('changes_hide')"/></tal:changes>