Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: 039f95d209ff6dbf9ac6b1345b299fad009f8ef2 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11

                                                                               
                                              







                                                                       
                                        




                                                                                
                                  




























                                                                                                                                                                  


                                               


                                                                      













                                                           
                                                                                                                                     





















                                                                                                           


                                                                            
                                                                 






                                                                        
                                                                                                                    
























                                                                                                    
<!-- **************************************************************************
#
# Copyright  (c) 2004-2011 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, Nikita Levyankov
#        
#
#************************************************************************** --> 


<?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" xmlns:local="local">
  <st:documentation>
    Outer most tag for creating a heterogeneous list, where the user can choose arbitrary number of
    arbitrary items from the given list of descriptors, and configure them independently.

    The submission can be data-bound into List&lt;T> where T is the common base type for the describable instances.
    
    <st:attribute name="name" use="required">
      form name that receives an array for all the items in the heterogeneous list.
    </st:attribute>
    <st:attribute name="items" use="required" type="java.util.Collection">
      existing items to be displayed. Something iterable, such as array or collection.
    </st:attribute>
    <st:attribute name="descriptors" use="required">
      all types that the user can add.
    </st:attribute>
    <st:attribute name="addCaption">
      caption of the 'add' button.
    </st:attribute>
    <st:attribute name="deleteCaption">
      caption of the 'delete' button.
    </st:attribute>
    <st:attribute name="targetType">
      the type for which descriptors will be configured. Defaults to ${it.class} (optional)
    </st:attribute>
    <st:attribute name="hasHeader">
      For each item, add a caption from descriptor.getDisplayName().
      This also activates drag&amp;drop (where the header is a grip), and help text support.
    </st:attribute>
    <st:attribute name="isPropertyOverridden">
      if present and true - value is overridden
    </st:attribute>
    <st:attribute name="resetUrl">
      If present, Redo icon will rendered and Reset will be available.
    </st:attribute>
  </st:documentation>
  <d:taglib uri="local">
    <d:tag name="body">
      <table style="width:100%">
        <j:set var="help" value="${descriptor.helpFile}" />
        <j:if test="${hasHeader}">
          <tr>
            <td colspan="3">
              <div class="dd-handle">
                <b>${descriptor.displayName}</b>
              </div>
            </td>
            <j:if test="${help!=null}">
              <td>
                <a href="#" class="help-button" helpURL="${rootURL}${help}"><img src="${imagesURL}/16x16/help.png" alt="[help]"/></a>
              </td>
            </j:if>
          </tr>
          <!-- TODO: help support is unintuitive; people should be able to see help from drop-down menu -->
          <j:if test="${help!=null}">
            <f:helpArea />
          </j:if>
        </j:if>
        <!-- optional added to keep from breaking page rendering when
        a descriptor doesn't have a config.jelly. -->
        <st:include from="${descriptor}"
                    page="${descriptor.configPage}" optional="true" />
        <f:block>
          <div align="right">
            <input type="hidden" name="stapler-class" value="${descriptor.clazz.name}" />
            <f:repeatableDeleteButton value="${attrs.deleteCaption}" />
          </div>
        </f:block>
      </table>
      <input type="hidden" name="kind" value="${descriptor.class.name}" />
    </d:tag>
  </d:taglib>
   <j:if test="${attrs.isPropertyOverridden==null}">
    <j:set target="${attrs}" property="isPropertyOverridden" value="false"/>
  </j:if>
  <j:set var="targetType" value="${attrs.targetType?:it.class}"/>
  <j:if test="${attrs.isPropertyOverridden and !empty(attrs.resetUrl)}">
    <div class="hetero-list-reset">
      <a href="#" class="reset-button" resetURL="${resetUrl}">
        <img src="${imagesURL}/16x16/undo.png" alt="Reset ${title}"/>
      </a>
    </div>
  </j:if>
  <div class="hetero-list-container${hasHeader?' with-drag-drop':''}${attrs.isPropertyOverridden? ' modified' :''}">
    <!-- display existing items -->
    <j:forEach var="i" items="${attrs.items}">
      <j:set var="descriptor" value="${i.descriptor}" />
      <j:set var="instance" value="${i}" />
      <div name="${attrs.name}" class="repeated-chunk">
        <local:body deleteCaption="${attrs.deleteCaption}" />
      </div>
    </j:forEach>

    <div class="repeatable-insertion-point" />
    <div class="prototypes to-be-removed">
      <!-- render one prototype for each type -->
      <j:set var="instance" value="${null}" />
      <j:forEach var="descriptor" items="${attrs.descriptors}" varStatus="loop">
        <div name="${attrs.name}" title="${descriptor.displayName}" tooltip="${descriptor.tooltip}">
          <local:body deleteCaption="${attrs.deleteCaption}" />
        </div>
      </j:forEach>
    </div>

    <div>
      <input type="button" value="${attrs.addCaption?:'%Add'}" class="hetero-list-add" />
    </div>
  </div>
</j:jelly>

Back to the top