Commit 3a4affb3 authored by Jérome Perrin's avatar Jérome Perrin Committed by Arnaud Fontaine

ERP5Form/Formulator: Minimal support of Zope4's ZMI

Only the most used forms are updated
parent 4ea0609b
......@@ -93,6 +93,7 @@ class FormBoxWidget(Widget.Widget):
title='Form ID',
description=(
"ID of the form which must be rendered in this box."),
css_class="form-control",
default="",
required=0)
......@@ -101,6 +102,7 @@ class FormBoxWidget(Widget.Widget):
title='Context method ID',
description=(
"ID of the method that returns a context for this box."),
css_class="form-control",
default="",
required=0)
......@@ -109,6 +111,7 @@ class FormBoxWidget(Widget.Widget):
title='Default',
description=(
"A default value (not used)."),
css_class="form-control",
default="",
required=0)
......@@ -179,6 +182,7 @@ class FormBoxValidator(Validator.Validator):
'validator_form_field_prefix',
title='Validator Form Field Prefix',
description= "Field prefix value used when validating fields",
css_class="form-control",
default="my_",
display_width=40,
required=1
......
This diff is collapsed.
......@@ -80,6 +80,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Update Method',
description=(
"The method to call to set the relation. Required."),
css_class="form-control",
default="Base_validateRelation",
required=1)
......@@ -87,6 +88,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Jump Method',
description=(
"The method to call to jump to the relation. Required."),
css_class="form-control",
default="Base_jumpToRelatedDocument",
required=1)
......@@ -94,6 +96,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Allow Jump',
description=(
"Do we allow to jump to the relation ?"),
css_class="form-check-input",
default=1,
required=0)
......@@ -101,6 +104,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Base Category',
description=(
"The method to call to set the relation. Required."),
css_class="form-control",
default="",
required=1)
......@@ -108,6 +112,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Portal Type',
description=(
"The method to call to set the relation. Required."),
css_class="form-control",
default="",
required=0)
......@@ -115,6 +120,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Allow Creation',
description=(
"Do we allow to create new objects ?"),
css_class="form-check-input",
default=1,
required=0)
......@@ -122,6 +128,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Container Getter Method',
description=(
"The method to call to get a container object."),
css_class="form-control",
default="",
required=0)
......@@ -129,6 +136,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Context Getter Method',
description=(
"The method to call to get the context."),
css_class="form-control",
default="",
required=0)
......@@ -136,6 +144,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Catalog Index',
description=(
"The method to call to set the relation. Required."),
css_class="form-control",
default="",
required=1)
......@@ -145,6 +154,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Relation Update Method',
description=(
"The method to invoke in order to update the relation"),
css_class="form-control",
default="",
required=0)
......@@ -152,6 +162,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='Relation Form',
description=(
"Form to display relation choices"),
css_class="form-control",
default="",
required=0)
......@@ -161,6 +172,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
"The display size in rows of the field. If set to 1, the "
"widget will be displayed as a drop down box by many browsers, "
"if set to something higher, a list will be shown. Required."),
css_class="form-control",
default=1,
required=1)
......@@ -168,12 +180,14 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title="Columns",
description=(
"A list of attributes names to display."),
css_class="form-control",
default=[],
required=0)
sort = fields.ListTextAreaField('sort',
title='Default Sort',
description=('The default sort keys and order'),
css_class="form-control",
default=[],
required=0)
......@@ -181,6 +195,7 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title="Parameter List",
description=(
"A list of paramters used for the portal_catalog."),
css_class="form-control",
default=[],
required=0)
......@@ -188,12 +203,14 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
title='List Method',
description=('The method to use to list'
'objects'),
css_class="form-control",
default='',
required=0)
proxy_listbox_ids = fields.ListTextAreaField('proxy_listbox_ids',
title='Proxy Listbox IDs',
description=('A list of listbox that can be used as proxy'),
css_class="form-control",
default='',
required=0)
......
......@@ -90,6 +90,7 @@ class ProxyWidget(Widget.Widget):
title='Form ID',
description= \
"ID of the master form.",
css_class="form-control",
default="",
display_width=40,
required=1)
......@@ -99,6 +100,7 @@ class ProxyWidget(Widget.Widget):
title='Field ID',
description= \
"ID of the field in the master form.",
css_class="form-control",
default="",
display_width=40,
required=1)
......
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">
<main class="container-fluid">
<p class="form-help lead">
Change the display order and grouping of the fields in this form.
</p>
<table border="1" cellspacing="1" cellpadding="3">
<table class="table table-bordered">
<dtml-let all_groups="get_groups(include_empty=1)"
group_length="get_largest_group_length()"
first_group="all_groups and all_groups[0] or None">
......@@ -14,119 +15,91 @@ Change the display order and grouping of the fields in this form.
<dtml-let groups=sequence-item>
<dtml-in groups>
<dtml-let group=sequence-item>
<td nowrap valign="top">
<table border="0" cellspacing="0" cellpadding="0">
<td>
<table class="table">
<form action="." method="POST">
<input type="hidden" name="group" value="&dtml-group;">
<tr><td align="center" class="list-header">
<div class="list-nav">
<tr><td>
<div class="font-weight-bold">
<dtml-var group html_quote>
</div>
</td></tr>
<tr><td align="left">
<dtml-let fields="get_fields_in_group(group, include_disabled=1)" fields_amount="_.len(fields)">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td>
<dtml-let fields="get_fields_in_group(group)" fields_amount="_.len(fields)">
<table class="table table-borderless table-sm">
<dtml-in fields>
<dtml-let field=sequence-item field_id="field.id">
<tr><td height="25">
<div class="list-item">
<dtml-if expr="REQUEST.has_key(field_id)"><input type="checkbox" name="&dtml-field_id;" checked="checked">
<dtml-else><input type="checkbox" name="&dtml-field_id;">
</dtml-if>
&nbsp;<a href="&dtml-field_id;/manage_main"><img src="&dtml-BASEPATH1;/&dtml-icon;" alt="&dtml-meta_type;" title="&dtml-meta_type;" border="0"></a>&nbsp;<a href="&dtml-field_id;/manage_main"><dtml-var field_id></a>
</div>
<tr><td>
<input type="checkbox" name="&dtml-field_id;">&nbsp;<a href="&dtml-field_id;/manage_main"><img src="&dtml-BASEPATH1;/&dtml-icon;" alt="&dtml-meta_type;" title="&dtml-meta_type;" border="0"></a>&nbsp;<a href="&dtml-field_id;/manage_main"><dtml-var field_id></a>
</td></tr>
</dtml-let>
</dtml-in>
<dtml-in "_.range(group_length - fields_amount)">
<tr><td height="25"></td></tr>
<tr><td></td></tr>
</dtml-in>
</dtml-let>
</table>
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_move_field_up:method"
<tr><td>
<input class="btn btn-secondary" type="submit" name="manage_move_field_up:method"
value="Move Up">
<input class="btn btn-secondary" type="submit" name="manage_move_field_down:method"
value="Move Dn">
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_move_field_down:method"
value="Move Dn"><br><br>
</td></tr>
<tr><td align="center">
<div class="form-element">
<select class="form-element" name="to_group" size="1">
<option>Move to:</option>
<tr><td>
<div class="form-group">
<select class="form-control mb-2" name="to_group" size="1">
<option>Transfer Selected Fields to:</option>
<dtml-in all_groups>
<option><dtml-var sequence-item html_quote></option>
</dtml-in>
</select>
</div>
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_move_group:method"
<input type="submit" class="btn btn-secondary mb-2" name="manage_move_group:method"
value="Transfer">
</div>
</td></tr>
<dtml-if "group != first_group">
<tr><td align="center" class="list-header">
<div class="list-item">
Group
<tr><td>
<div class="form-group">
<input class="btn btn-secondary" type="submit" name="manage_move_group_up:method"
value="Move Group Up">
<input class="btn btn-secondary" type="submit" name="manage_move_group_down:method"
value="Move Group Down">
</div>
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_move_group_up:method"
value="Move Up">
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_move_group_down:method"
value="Move Dn"><br><br>
</td></tr>
<tr><td align="center">
<input type="text" name="new_name" value="" size="10">
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_rename_group:method"
value="Rename"><br>
<tr><td>
<div class="form-group">
<input type="text" class="form-control form-control-sm" name="new_name" value="" size="10">
<input class="btn btn-secondary" type="submit" name="manage_rename_group:method"
value="Rename Group">
</div>
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_remove_group:method"
value="Remove"><br>
<tr><td>
<input class="btn btn-secondary" type="submit" name="manage_remove_group:method"
value="Remove Group">
</td></tr>
<dtml-else>
<tr><td align="center" class="list-header">
<div class="list-item">
Group
<tr><td>
<div class="form-group">
<input type="text" class="form-control form-control-sm" name="new_group" value="" size="10">
<input type="submit" class="btn btn-secondary" name="manage_add_group:method" value="Create Group">
</div>
</td></tr>
<tr><td align="center">
<input type="text" name="new_group" value="" size="10">
</td></tr>
<tr><td align="center">
<input type="submit" name="manage_add_group:method" value="Create"><br><br>
</td></tr>
<tr><td align="center">
<input type="text" name="new_name" value="" size="10">
</td></tr>
<tr><td align="center">
<input class="form-element" type="submit" name="manage_rename_group:method"
value="Rename"><br>
<tr><td>
<div class="form-group">
<input type="text" class="form-control form-control-sm" name="new_name" value="" size="10">
<input class="btn btn-secondary" type="submit" name="manage_rename_group:method"
value="Rename Group">
</div>
</td></tr>
</dtml-if>
......@@ -141,5 +114,5 @@ Change the display order and grouping of the fields in this form.
</dtml-in>
</dtml-let>
</table>
</main>
<dtml-var manage_page_footer>
<style>form td:not(:last-child) { padding-right: 1em; }</style>
<dtml-var manage_page_header>
<style>
textarea.form-control {
resize: both;
}
textarea.form-control, input[type=text].form-control {
font-family: monospace;
}
</style>
<dtml-let help_product="'Formulator'" help_topic=meta_type>
<dtml-var manage_tabs>
</dtml-let>
<p class="form-help">
<main class="container-fluid">
<p class="form-help lead">
Surcharge <dtml-var meta_type> properties here.
</p>
<form action="manage_edit" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<dtml-let proxy_field="this()"
current_field="None if proxy_field.getTemplateField() is None else proxy_field.getRecursiveTemplateField()">
......@@ -20,7 +28,7 @@ Surcharge <dtml-var meta_type> properties here.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<td colspan="4" class="font-weight-bold">
Proxy Widget properties <dtml-if "current_field is not None">(<dtml-var expr="current_field.meta_type">)</dtml-if>
</td>
</tr>
......@@ -32,20 +40,20 @@ Surcharge <dtml-var meta_type> properties here.
override="current_field.get_override(field_id)"
tales="current_field.get_tales(field_id)">
<tr>
<td align="left" valign="top">
<div class="form-label">
<td>
<dtml-if "tales or override">[</dtml-if><dtml-var "field.title()"><dtml-if "field.has_value('required') and field.get_value('required')">*</dtml-if><dtml-if "tales or override">]</dtml-if>
</div>
</td>
<td align="left" valign="top">
<td>
<dtml-var "field.render(value)">
</td>
<td><div class="form-element">
<td>
<dtml-var "field.meta_type">
</div></td>
<td><div class="form-element">
<dtml-var "field.get_value('description')">
</div></td>
</td>
<td>
<p class="form-text">
<small><dtml-var "field.get_value('description')"></small>
</p>
</td>
</tr>
</dtml-let>
</dtml-in>
......@@ -55,17 +63,17 @@ Surcharge <dtml-var meta_type> properties here.
</dtml-in>
<tr>
<td align="left" valign="top">
<div class="form-label">Proxy Target</div>
<td>
<div>Proxy Target</div>
</td>
<td align="left" valign="top">
<a href="manage_edit_target">Click to edit the target</a>
<td>
<a href="manage_edit_target" class="btn btn-info">Click to edit the target</a>
</td>
<td></td><td></td>
</tr>
</table>
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<!-- Then, display Template Field properties -->
<dtml-if "current_field is not None">
......@@ -75,7 +83,7 @@ Surcharge <dtml-var meta_type> properties here.
<dtml-let group=sequence-item fields="form.get_fields_in_group(group)">
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<td colspan="5" class="font-weight-bold">
<dtml-var group capitalize> properties
</td>
</tr>
......@@ -84,11 +92,12 @@ Surcharge <dtml-var meta_type> properties here.
<dtml-in fields>
<dtml-let field=sequence-item field_id="field.id"
is_datetime_field="field.meta_type == 'DateTimeField'"
value="proxy_field.get_recursive_orig_value(field_id)"
override="proxy_field.get_recursive_override(field_id)"
tales="proxy_field.get_recursive_tales(field_id)">
<tr>
<td align="left" valign="top">
<td>
<dtml-let checkbox_key="'surcharge_%s' % field_id" >
<dtml-if "proxy_field.is_delegated(field_id)">
<input type="checkbox"
......@@ -102,8 +111,7 @@ Surcharge <dtml-var meta_type> properties here.
</dtml-if >
</dtml-let >
</td>
<td align="left" valign="top">
<div class="form-label">
<td>
<dtml-if "tales or override">[
</dtml-if>
<dtml-var "field.title()">
......@@ -111,23 +119,24 @@ Surcharge <dtml-var meta_type> properties here.
</dtml-if>
<dtml-if "tales or override">]
</dtml-if>
</div>
</td>
<dtml-if "proxy_field.is_delegated(field_id)">
<td align="left" valign="top" class="to_disable delegated">
<td class="to_disable delegated <dtml-if is_datetime_field>form-inline</dtml-if>">
<dtml-var "field.render(value)">
</td>
<dtml-else >
<td align="left" valign="top" class="to_disable">
<td class="to_disable <dtml-if is_datetime_field>form-inline</dtml-if>">
<dtml-var "field.render(value)">
</td>
</dtml-if>
<td><div class="form-element">
<td>
<dtml-var "field.meta_type">
</div></td>
<td><div class="form-element">
<dtml-var "field.get_value('description')">
</div></td>
</td>
<td>
<p class="form-text">
<small><dtml-var "field.get_value('description')"></small>
</p>
</td>
</tr>
</dtml-let>
</dtml-in>
......@@ -140,13 +149,13 @@ Surcharge <dtml-var meta_type> properties here.
</dtml-let>
</table>
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value="Save Changes" />
</div>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</form>
</main>
<script type="text/javascript">
function isClass(object, className) {
if (object.className != undefined){
......
<tr class="list-header">
<td align="left" valign="top">
<div class="form-label">
<thead class="thead-light">
<tr>
<th>
Delegated
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
</th>
<th>
Name
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
</th>
<th class="w-50">
Value
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
</th>
<th>
Field
</div>
</td>
</th>
<dtml-if "_['URL'].endswith(('/manage_main', '/manage_edit'))">
<td align="left" valign="top">
<div class="form-label">
<th>
Description
</div>
</td>
</th>
</dtml-if>
</tr>
</thead>
\ No newline at end of file
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<main class="container-fluid">
<p class="form-help">
<p class="form-help leap">
Edit <dtml-var meta_type> error messages here.
</p>
<form action="manage_messages" method="POST">
<table border="0">
<table class="table table-striped table-hover table-sm">
<dtml-let proxy_field="this()">
<dtml-in "get_error_names()">
<dtml-let name=sequence-item value="get_error_message(name)"
......@@ -21,14 +22,19 @@ Edit <dtml-var meta_type> error messages here.
</dtml-if >
</td>
<td class="form-label"><dtml-var name></td>
<td><textarea name="&dtml-name;" cols="50" rows="4"><dtml-var value></textarea></td>
<td><textarea class="form-control" name="&dtml-name;" cols="50" rows="4"><dtml-var value></textarea></td>
</tr>
</dtml-let>
</dtml-in>
</dtml-let>
<tr><td><input type="submit" value=" OK "></td></tr>
</table>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</main>
<dtml-var manage_page_footer>
<style>form td:not(:last-child) { padding-right: 1em; }</style>
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">
<main class="container-fluid">
<p class="form-help lead">
Edit <dtml-var meta_type> method TALES expressions here.
<dtml-if "not isTALESAvailable()"><br>
<span style="color: #FF0000;">
......@@ -14,7 +14,7 @@ This tab can therefore not be used.
<form action="manage_tales" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<dtml-in "override_form.get_groups()">
......@@ -22,7 +22,7 @@ This tab can therefore not be used.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="font-weight-bold">
Proxy Widget properties
</td>
</tr>
......@@ -34,17 +34,15 @@ This tab can therefore not be used.
<dtml-let field=sequence-item field_id="field.id"
value="current_field.get_tales(field.id)">
<tr>
<td align="left" valign="top">
<div class="form-label">
<td>
<dtml-var "field.title()">
</div>
</td>
<td align="left" valign="top">
<td>
<dtml-var "field.render(value)">
</td>
<td><div class="form-element">
<td>
<dtml-var "current_field.form.get_field(field.id).meta_type">
</div></td>
</td>
</tr>
</dtml-let>
</dtml-in>
......@@ -54,17 +52,17 @@ This tab can therefore not be used.
</dtml-in>
<tr>
<td align="left" valign="top">
<div class="form-label">Proxy Target</div>
<td>
<div>Proxy Target</div>
</td>
<td align="left" valign="top">
<a href="manage_tales_target">Click to edit the target</a>
<td>
<a href="manage_tales_target" class="btn btn-info">Click to edit the target</a>
</td>
<td></td>
</tr>
</table>
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<!-- XXX Loop until find not a proxy field -->
<dtml-let proxy_field="this()"
......@@ -77,7 +75,7 @@ This tab can therefore not be used.
<dtml-let group=sequence-item fields="form.get_fields_in_group(group)">
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<td colspan="4" class="font-weight-bold">
<dtml-var group capitalize> properties
</td>
</tr>
......@@ -86,11 +84,10 @@ This tab can therefore not be used.
<dtml-in fields>
<dtml-let field=sequence-item field_id="field.id"
value="proxy_field.get_recursive_tales(field_id)">
<tr>
<td align="left" valign="top">
<td>
<dtml-let checkbox_key="'surcharge_%s' % field_id" >
<dtml-if "proxy_field.is_delegated(field_id)">
<input type="checkbox"
......@@ -105,25 +102,21 @@ This tab can therefore not be used.
</dtml-let >
</td>
<td align="left" valign="top">
<div class="form-label">
<td>
<dtml-var "field.title()">
</div>
</td>
<dtml-if "proxy_field.is_delegated(field_id)">
<td align="left" valign="top" class="to_disable delegated">
<td class="to_disable delegated">
<dtml-var "field.render(value)">
</td>
<dtml-else >
<td align="left" valign="top" class="to_disable">
<td class="to_disable">
<dtml-var "field.render(value)">
</td>
</dtml-if>
<td><div class="form-element">
<td>
<dtml-var "current_field.form.get_field(field.id).meta_type">
</div></td>
</td>
</tr>
</dtml-let>
......@@ -138,12 +131,14 @@ This tab can therefore not be used.
</dtml-let>
</table>
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value="Save Changes" />
</div>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</main>
<script type="text/javascript">
function isClass(object, className) {
if (object.className != undefined){
......
......@@ -73,6 +73,8 @@ def initializeFieldForm(field_class):
tales_field = fields.TALESField(field.id,
title=field.get_value('title'),
description="",
css_class="form-control code",
extra='id="%s"' % field.id,
default="",
display_width=40,
required=0)
......@@ -81,6 +83,8 @@ def initializeFieldForm(field_class):
method_field = fields.MethodField(field.id,
title=field.get_value("title"),
description="",
css_class="form-control code",
extra='id="%s"' % field.id,
default="",
required=0)
override_form.add_field(method_field, "widget")
......@@ -89,6 +93,8 @@ def initializeFieldForm(field_class):
form.add_field(field, "validator")
tales_field = fields.TALESField(field.id,
title=field.get_value('title'),
css_class="form-control code",
extra='id="%s"' % field.id,
description="",
default="",
display_with=40,
......@@ -97,6 +103,8 @@ def initializeFieldForm(field_class):
method_field = fields.MethodField(field.id,
title=field.get_value("title"),
css_class="form-control code",
extra='id="%s"' % field.id,
description="",
default="",
required=0)
......
......@@ -878,9 +878,12 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
if (len(field_ids) == 1 and
self.move_field_up(field_ids[0], group)):
message = "Field %s moved up." % field_ids[0]
manage_tabs_type = "success"
else:
message = "Can't move field up."
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -892,9 +895,12 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
if (len(field_ids) == 1 and
self.move_field_down(field_ids[0], group)):
message = "Field %s moved down." % field_ids[0]
manage_tabs_type = "success"
else:
message = "Can't move field down."
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -909,9 +915,13 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
message = "Fields %s transferred from %s to %s." % (fields,
group,
to_group)
manage_tabs_type = "success"
else:
message = "Can't transfer fields."
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -923,9 +933,12 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
if (group and group != 'Select group' and
self.add_group(group)):
message = "Group %s created." % (group)
manage_tabs_type = "success"
else:
message = "Can't create group."
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -935,9 +948,12 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
"""
if self.remove_group(group):
message = "Group %s removed." % (group)
manage_tabs_type = "success"
else:
message = "Can't remove group."
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -949,12 +965,16 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
new_name = REQUEST['new_name'].strip()
if self.rename_group(group, new_name):
message = "Group %s renamed to %s." % (group, new_name)
manage_tabs_type = "success"
else:
message = "Can't rename group."
manage_tabs_type = "danger"
else:
message = "No new name supplied."
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -964,9 +984,12 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
"""
if self.move_group_up(group):
message = "Group %s moved up." % group
manage_tabs_type = "success"
else:
message = "Can't move group %s up" % group
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
security.declareProtected('Change Formulator Forms',
......@@ -976,9 +999,12 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
"""
if self.move_group_down(group):
message = "Group %s moved down." % group
manage_tabs_type = "success"
else:
message = "Can't move group %s down" % group
manage_tabs_type = "danger"
return self.formOrder(self, REQUEST,
manage_tabs_type=manage_tabs_type,
manage_tabs_message=message)
PythonForm = ZMIForm # NOTE: backwards compatibility
......
This diff is collapsed.
This diff is collapsed.
<style>form td:not(:last-child) { padding-right: 1em; }</style>
<dtml-var manage_page_header>
<style>
textarea.form-control {
resize: both;
}
textarea.form-control, input[type=text].form-control {
font-family: monospace;
}
</style>
<dtml-let help_product="'Formulator'" help_topic=meta_type>
<dtml-var manage_tabs>
</dtml-let>
<p class="form-help">
<main class="container-fluid">
<p class="form-help lead">
Edit <dtml-var meta_type> properties here.
</p>
<form action="manage_edit" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<dtml-in "form.get_groups()">
<dtml-let group=sequence-item fields="form.get_fields_in_group(group)">
<dtml-if fields>
<tr>
<td colspan="4" class="form-title">
<td colspan="4" class="font-weight-bold">
<dtml-var group capitalize> properties
</td>
</tr>
......@@ -26,24 +35,25 @@ Edit <dtml-var meta_type> properties here.
<dtml-let current_field="this()">
<dtml-in fields>
<dtml-let field=sequence-item field_id="field.id"
is_datetime_field="field.meta_type == 'DateTimeField'"
value="current_field.get_orig_value(field_id)"
override="current_field.get_override(field_id)"
tales="current_field.get_tales(field_id)">
<tr>
<td align="left" valign="top">
<div class="form-label">
<td>
<dtml-if "tales or override">[</dtml-if><dtml-var "field.title()"><dtml-if "field.has_value('required') and field.get_value('required')">*</dtml-if><dtml-if "tales or override">]</dtml-if>
</div>
</td>
<td align="left" valign="top">
<td class="<dtml-if is_datetime_field>form-inline</dtml-if>">
<dtml-var "field.render(value)">
</td>
<td valign="top" ><div class="form-element">
<td>
<dtml-var "field.meta_type">
</div></td>
<td align="left" valign="top"><div class="form-element">
<dtml-var "field.get_value('description')">
</div></td>
</td>
<td>
<p class="form-text">
<small><dtml-var "field.get_value('description')"></small>
</p>
</td>
</tr>
</dtml-let>
</dtml-in>
......@@ -53,13 +63,12 @@ Edit <dtml-var meta_type> properties here.
</dtml-in>
</table>
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value="Save Changes" />
</div>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</main>
<dtml-var manage_page_footer>
......
<tr class="list-header">
<td align="left" valign="top">
<div class="form-label">
<thead class="thead-light">
<tr>
<th>
Name
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
</th>
<th class="w-50">
Value
</div>
</td>
<td align="left" valign="top">
<div class="form-label">
</th>
<th>
Field
</div>
</td>
</th>
<dtml-if "_['URL'].endswith(('/manage_main', '/manage_edit'))">
<td align="left" valign="top">
<div class="form-label">
<th>
Description
</div>
</td>
</th>
</dtml-if>
</tr>
</thead>
\ No newline at end of file
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<main class="container-fluid">
<p class="form-help">
<p class="form-help lead">
Edit <dtml-var meta_type> error messages here.
</p>
<form action="manage_messages" method="POST">
<table border="0">
<table class="table table-striped table-hover table-sm">
<dtml-in "get_error_names()">
<dtml-let name=sequence-item value="get_error_message(name)">
<tr>
<td class="form-label"><dtml-var name></td>
<td><textarea name="&dtml-name;" cols="50" rows="4"><dtml-var value></textarea></td>
<td><textarea class="form-control" name="&dtml-name;" cols="50" rows="4"><dtml-var value></textarea></td>
</tr>
</dtml-let>
</dtml-in>
<tr><td><input type="submit" value=" OK "></td></tr>
</table>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</main>
<dtml-var manage_page_footer>
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<main class="container-fluid">
<p class="form-help">
<p class="form-help lead">
Edit <dtml-var meta_type> method overrides here.
</p>
<form action="manage_override" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<dtml-in "override_form.get_groups()">
<dtml-let group=sequence-item fields="override_form.get_fields_in_group(group)">
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="font-weight-bold">
<dtml-var group capitalize> properties
</td>
</tr>
......@@ -24,19 +25,18 @@ Edit <dtml-var meta_type> method overrides here.
<dtml-in fields>
<dtml-let field=sequence-item field_id="field.id"
value="current_field.get_override(field.id)">
<tr>
<td align="left" valign="top">
<div class="form-label">
<tr>
<td>
<dtml-var "field.title()">
</div>
</td>
<td align="left" valign="top">
<td>
<dtml-var "field.render(value)">
</td>
<td valign="top"><div class="form-element">
<td>
<dtml-var "current_field.form.get_field(field.id).meta_type">
</div></td>
</tr>
</td>
</tr>
</dtml-let>
</dtml-in>
</dtml-let>
......@@ -44,15 +44,12 @@ Edit <dtml-var meta_type> method overrides here.
</dtml-let>
</dtml-in>
<tr>
<td align="left" valign="top">
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value="Save Changes" />
</div>
</td>
</tr>
</table>
</form>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</main>
<dtml-var manage_page_footer>
<style>form td:not(:last-child) { padding-right: 1em; }</style>
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<p class="form-help">
<main class="container-fluid">
<p class="form-help lead">
Edit <dtml-var meta_type> method TALES expressions here.
<dtml-if "not isTALESAvailable()"><br>
<span style="color: #FF0000;">
......@@ -13,50 +13,52 @@ This tab can therefore not be used.
</p>
<form action="manage_tales" method="POST">
<table cellspacing="0" cellpadding="2" border="0">
<table class="table table-striped table-hover table-sm">
<dtml-in "override_form.get_groups()">
<dtml-let group=sequence-item fields="tales_form.get_fields_in_group(group)">
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<td colspan="3" class="font-weight-bold">
<dtml-var group capitalize> properties
</td>
</tr>
<dtml-var fieldListHeader>
<dtml-let current_field="this()">
<dtml-in fields>
<dtml-let field=sequence-item field_id="field.id"
value="current_field.get_tales(field.id)">
<tr>
<td align="left" valign="top">
<div class="form-label">
<tr>
<td>
<dtml-var "field.title()">
</div>
</td>
<td align="left" valign="top">
<td>
<dtml-var "field.render(value)">
</td>
<td valign="top"><div class="form-element">
<td>
<dtml-var "current_field.form.get_field(field.id).meta_type">
</div></td>
</tr>
</td>
</tr>
</dtml-let>
</dtml-in>
</dtml-let>
</dtml-if>
</dtml-let>
</dtml-in>
</div>
</table>
<div class="form-element">
<input class="form-element" type="submit" name="submit"
value="Save Changes" />
</div>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Save Changes" />
</div>
</form>
</main>
<dtml-var manage_page_footer>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment