artifactList.jelly 4.6 KB
Newer Older
K
kohsuke 已提交
1 2 3
<!--
The MIT License

R
rseguy 已提交
4
Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Romain Seguy
K
kohsuke 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->

K
kohsuke 已提交
25
<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">
K
kohsuke 已提交
26 27 28 29 30 31 32 33 34 35 36 37 38 39
  <st:documentation>
    Generates a listing of the build artifacts.
    Depending on the size of the artifact, this will either produce a list or a link to the directory view.

    <st:attribute name="build" type="hudson.model.Build" use="required">
      Build object for which the artifacts are displayed
    </st:attribute>
    <st:attribute name="caption" use="required">
      Human readable title text
    </st:attribute>
    <st:attribute name="baseURL">
      If the hyperlink to artifacts are at another URL, specify the prefix.
    </st:attribute>
  </st:documentation>
R
rseguy 已提交
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
  <j:if test="${!h.isArtifactsPermissionEnabled() or h.isArtifactsPermissionEnabled() and h.hasPermission(it,attrs.permission)}">
    <j:set var="artifacts" value="${build.getArtifactsUpTo(build.TREE_CUTOFF+1)}" />
    <j:if test="${!build.building and !empty(artifacts)}">
      <t:summary icon="package.gif">
        <a href="${baseURL}artifact/">${caption}</a>
        <j:choose>
          <j:when test="${size(artifacts) le build.LIST_CUTOFF}">
            <!-- if not too many, just list them -->
            <ul>
              <j:forEach var="f" items="${artifacts}">
                <li>
                  <a href="${baseURL}artifact/${f.href}">${h.xmlEscape(f.displayPath)}</a>
                  <st:nbsp/>
                  <a href="${baseURL}artifact/${f.href}/*fingerprint*/"><img src="${imagesURL}/16x16/fingerprint.gif" alt="[fingerprint]" /></a>
                </li>
55
              </j:forEach>
R
rseguy 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
            </ul>
          </j:when>
          <j:when test="${size(artifacts) le build.TREE_CUTOFF}">
              <!-- otherwise (unless way too many) use a tree view -->
              <l:yui module="treeview"/>
              <link rel="stylesheet" href="${resURL}/scripts/yui/treeview/assets/skins/sam/treeview.css" type="text/css"/>
              <link rel="stylesheet" href="${resURL}/scripts/yui/fonts/fonts-min.css" type="text/css"/>
              <style type="text/css">#artifact-tree td { vertical-align:middle; }</style>
              <div id="artifact-tree"></div>
              <script language="javascript">// &lt;![CDATA[
                YAHOO.util.Event.onContentReady('artifact-tree', function () {
                var artifactTree = new YAHOO.widget.TreeView('artifact-tree');
                var artifactRoot = new YAHOO.widget.TextNode('${h.jsStringEscape('%View')}',
                                                             artifactTree.getRoot(), false);
                <j:forEach var="e" items="${artifacts.getTree().entrySet()}">
                  <j:set var="f" value="${e.key}"/>
                  var ${f.treeNodeId} = new YAHOO.widget.TextNode(
                    '${h.jsStringEscape(f.fileName)}', ${e.value?:'artifactRoot'}, false);
                        <j:if test="${f.href!=null}">
                          <!-- Assign href property instead of passing to constructor above,
                               as constructor does urlencoding, but f.href is already encoded -->
                          ${f.treeNodeId}.href = '${baseURL}artifact/${h.jsStringEscape(f.href)}';
                        </j:if>
                </j:forEach>
                artifactTree.draw();
               });
             // ]]&gt;</script>
          </j:when>
          <!-- otherwise just show link to directory browser -->
        </j:choose>
      </t:summary>
    </j:if>
88
  </j:if>
89
</j:jelly>