blob: d32ec99792142ca081b5244365f568f06c6da90b (
plain) (
tree)
|
|
<!-- **************************************************************************
#
# Copyright (c) 2004-2009 Oracle Corporation.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#
# Kohsuke Kawaguchi
#
#
#************************************************************************** -->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<st:documentation>
Generate config pages from a list of Descriptors into a section.
<st:attribute name="title">
Human readable title of the section to be rendered in HTML.
</st:attribute>
<st:attribute name="descriptors" use="required">
hudson.model.Descriptor collection whose configuration page is rendered.
</st:attribute>
<st:attribute name="instances">
Map<Descriptor,Describable> that defines current instances of those descriptors.
These are used to fill initial values. Other classes that define the get(Descriptor)
method works fine, too, such as DescribableList.
</st:attribute>
<st:attribute name="field">
Either @field or @instances are required (or @field needs to be inherited from the ancestor <entry> elemetn.
If field is specified, instances are assumed to be instance[field].
When this attribute is specified, JSON structure is properly set up so that the databinding
can set the field (or pass this collection as a constructor parameter of the same name.
This is more modern way of doing databinding, and thus preferred approach.
</st:attribute>
<st:attribute name="targetType">
the type for which descriptors will be configured.
default to ${it.class}
</st:attribute>
</st:documentation>
<j:if test="${attrs.field==null}">
<!-- inherit @field if we should do so -->
<j:set target="${attrs}" property="field" value="${entry.field}" />
</j:if>
<j:set var="targetType" value="${attrs.targetType ?: it.class}"/>
<j:set var="instances" value="${attrs.instances ?: instance[field] ?: descriptor['default'+h.capitalize(field)]}"/>
<j:if test="${!empty(descriptors) or context['org.apache.commons.jelly.body']!=null}">
<f:section title="${attrs.title}" name="${attrs.field?:attrs.name}">
<j:if test="${attrs.field!=null}">
<tr>
<td>
<input type="hidden" name="stapler-class-bag" value="true" />
</td>
</tr>
</j:if>
<d:invokeBody />
<j:forEach var="d" items="${descriptors}">
<f:optionalBlock name="${d.jsonSafeClassName}" help="${d.helpFile}"
title="${d.displayName}" checked="${instances.get(d)!=null}">
<j:set var="descriptor" value="${d}" />
<j:set var="instance" value="${instances.get(d)}" />
<st:include from="${d}" page="${d.configPage}" optional="true" />
</f:optionalBlock>
</j:forEach>
</f:section>
</j:if>
</j:jelly>
|