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

4
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
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.
-->

25 26 27
<!--
  Shared between index.jelly and available.jelly

28 29 30
  Attributes:
     list: variable to contain List<Plugin>
     page: page name to be passed to local:tabBar
31
-->
32
<?jelly escape-by-default='true'?>
33
<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">
S
Seiji Sogabe 已提交
34
  <l:layout title="${%Update Center}" permission="${app.ADMINISTER}" norefresh="true">
35 36
    <st:include page="sidepanel.jelly"/>
    <l:main-panel>
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
      <script type="text/javascript">// &lt;![CDATA[
        function showhideCategories(hdr,on) {
          var table = hdr.parentNode.parentNode.parentNode,
              newDisplay = on ? '' : 'none',
              nameList = new Array(), name;
          for (var i = 1; i &lt; table.rows.length; i++) {
            if (on || table.rows[i].cells.length == 1)
              table.rows[i].style.display = newDisplay;
             else {
              // Hide duplicate rows for a plugin when not viewing by-category
              name = table.rows[i].cells[1].getAttribute('data');
              if (nameList[name] == 1) table.rows[i].style.display = 'none';
              nameList[name] = 1;
            }
          }
        }
M
mindless 已提交
53 54 55 56 57 58
        function showhideCategory(col) {
          var row = col.parentNode.nextSibling;
          var newDisplay = row &amp;&amp; row.style.display == 'none' ? '' : 'none';
          for (; row &amp;&amp; row.cells.length &gt; 1; row = row.nextSibling)
            row.style.display = newDisplay;
        }
59 60
      // ]]&gt;
      </script>
K
kohsuke 已提交
61
      <form method="post" action="install">
62
        <j:set var="isUpdates" value="${attrs.page=='updates'}" />
63 64
        <local:tabBar page="${attrs.page}" xmlns:local="/hudson/PluginManager" />
        <table id="plugins" class="sortable pane bigtable">
K
kohsuke 已提交
65
            <tr style="border-top: 0px;">
M
mindless 已提交
66 67
              <th initialSortDir="${isUpdates?null:'down'}"
                  tooltip="${%Check to install the plugin}${isUpdates?'':'&lt;br/&gt;'+'%Click this heading to sort by category'}"
68 69 70 71 72
                  width="32" onclick="showhideCategories(this,1)">${%Install}</th>
              <th initialSortDir="${isUpdates?'down':null}"
                  onclick="showhideCategories(this,0)">${%Name}</th>
              <th onclick="showhideCategories(this,0)">${%Version}</th>
              <j:if test="${isUpdates}"><th>${%Installed}</th></j:if>
K
kohsuke 已提交
73 74 75
            </tr>
            <j:choose>
              <j:when test="${!empty(list)}">
76
                <j:set var="lastCat" value="" />
K
kohsuke 已提交
77
                <j:forEach var="p" items="${list}">
78 79 80 81 82
                  <j:if test="${!isUpdates}">
                    <j:set var="thisCat" value="${p.category}" />
                    <j:set var="p" value="${p.plugin}" />
                    <j:if test="${thisCat != lastCat}">
                      <tr>
83
                        <td class="pane" colspan="4" onclick="showhideCategory(this)">${thisCat}</td>
84 85 86 87
                      </tr>
                    </j:if>
                    <j:set var="lastCat" value="${thisCat}" />
                  </j:if>
88
                  <j:set var="installJob" value="${isUpdates ? app.updateCenter.getJob(p) : null}" />
89 90
                  <j:set var="installedOk"
                     value="${installJob.status.success and installJob.plugin.version==p.version}" />
91
                  <tr class="${installJob!=null ? 'already-upgraded' : null}">
92
                    <td class="pane" align="center" data="${thisCat}_">
93 94 95
                      <input type="checkbox" name="plugin.${p.name}.${p.sourceId}"
                             checked="${installedOk ? 'checked' : null}"
                             disabled="${installedOk ? 'disabled' : null}" />
96 97
                    </td>
                    <td class="pane" data="${h.xmlEscape(p.displayName)}">
98 99 100 101
                      <div>
                        <a href="${p.wiki}"><st:out value="${p.displayName}"/></a>
                      </div>
                      <j:if test="${p.excerpt!=null}">
102
                        <div class="excerpt"><j:out value="${p.excerpt}" /></div>
103
                      </j:if>
104
                      <j:if test="${!p.isCompatibleWithInstalledVersion()}">
105 106
                        <div class="compatWarning">${%compatWarning}</div>
                      </j:if>
107
                      <j:if test="${p.isForNewerHudson()}">
108
                        <div class="compatWarning">${%coreWarning(p.requiredCore)}</div>
109
                      </j:if>
110
                    </td>
K
kohsuke 已提交
111
                    <td class="pane"><st:out value="${p.version}" /></td>
112
                    <j:if test="${isUpdates}">
113
                      <td class="pane">
114 115 116 117 118 119 120 121 122
                        <j:choose><j:when test="${p.installed.active}">
                          <st:out value="${p.installed.version}" />
                        </j:when><j:otherwise>
                          <span title="${%Inactive}">
                            (<st:out value="${p.installed.version}" />)
                          </span>
                        </j:otherwise></j:choose>
                      </td>
                    </j:if>
K
kohsuke 已提交
123 124 125 126
                  </tr>
                </j:forEach>
              </j:when>
              <j:otherwise>
127
                <tr>
128
                  <td colspan="4" align="center">
K
kohsuke 已提交
129
                    <div style="padding:1em">
130
                      ${%No updates}
K
kohsuke 已提交
131
                    </div>
132 133
                  </td>
                </tr>
K
kohsuke 已提交
134 135
              </j:otherwise>
            </j:choose>
136
        </table>
137 138

        <j:if test="${!empty(list)}">
139
          <div style="margin-top:1em">
140
            <f:submit value="${%Install without restart}" name="dynamicLoad" />
141 142
            <span style="margin-left:2em;"></span>
            <f:submit value="${%Download now and install after restart}" />
143 144 145
          </div>
        </j:if>
        <d:invokeBody />
K
kohsuke 已提交
146
      </form>
147 148
    </l:main-panel>
  </l:layout>
149
</j:jelly>