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

4
Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi,
5 6
Daniel Dyer, Seiji Sogabe, Tom Huybrechts, Manufacture Francaise des Pneumatiques
Michelin, Romain Seguy
K
kohsuke 已提交
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

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.
-->
26
<?jelly escape-by-default='true'?>
27
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:i="jelly:fmt" xmlns:x="jelly:xml">
K
kohsuke 已提交
28 29
  <st:documentation>
    Outer-most tag for a normal (non-AJAX) HTML rendering.
K
kohsuke 已提交
30
    This is used with nested &lt;header>, &lt;side-panel>, and &lt;main-panel>
31
    to form Jenkins's basic HTML layout.
K
kohsuke 已提交
32 33 34 35 36 37 38 39 40 41 42

    <st:attribute name="title" use="required">
      Title of the HTML page. Rendered into &lt;title> tag.
    </st:attribute>
    <st:attribute name="norefresh">
      If non-null, auto refresh is disabled on this page.
      This is necessary for pages that include forms.
    </st:attribute>
    <st:attribute name="css" deprecated="true">
      specify path that starts from "/" for loading additional CSS stylesheet.
      path is interprted as relative to the context root. e.g.,
43 44

      {noformat}&lt;l:layout css="/plugin/mysuperplugin/css/myneatstyle.css">{noformat}
K
kohsuke 已提交
45 46

      This was originally added to allow plugins to load their stylesheets, but
47
      *the use of thie attribute is discouraged now.*
K
kohsuke 已提交
48 49 50 51 52 53 54 55
      plugins should now do so by inserting &lt;style> elements and/or &lt;script> elements
      in &lt;l:header/> tag.
    </st:attribute>
    <st:attribute name="permission">
      If given, this page is only made available to users that has the specified permission.
      (The permission will be checked against the "it" object.)
    </st:attribute>
  </st:documentation>
56
<st:header name="Expires" value="0" />
57
<st:header name="X-Hudson-Theme" value="default" />
58
<st:contentType value="text/html;charset=UTF-8" />
59
<!-- The path starts with a "/" character but does not end with a "/" character. -->
K
kohsuke 已提交
60 61
<j:set var="rootURL" value="${request.contextPath}" />
<j:new var="h" className="hudson.Functions" /><!-- instead of JSP functions -->
62
<j:set var="_" value="${request.getSession()}"/><!-- depending on what tags are used, we can later end up discovering that we needed a session, but it's too late because the headers are already committed. so ensure we always have a session -->
K
kohsuke 已提交
63
<j:set var="_" value="${h.configureAutoRefresh(request, response, attrs.norefresh!=null)}"/>
64 65 66 67
<!--
  load static resources from the path dedicated to a specific version.
  This "/static/VERSION/abc/def.ghi" path is interpreted by stapler to be
  the same thing as "/abc/def.ghi", but this avoids the stale cache
68
  problem when the user upgrades to new Jenkins. Stapler also sets a long
69 70 71 72
  future expiration dates for such static resources.
-->
<j:set var="resURL"  value="${rootURL}${h.resourcePath}" />
<j:set var="imagesURL"  value="${rootURL}${h.resourcePath}/images" />
73 74 75 76 77 78 79
  <j:if test="${request.servletPath=='/' || request.servletPath==''}">
    <st:header name="X-Hudson" value="1.395"/>
    <st:header name="X-Jenkins" value="${servletContext.getAttribute('version')}"/>
    <j:if test="${app.tcpSlaveAgentListener!=null}">
      <!-- advertise the CLI TCP port -->
      <st:header name="X-Hudson-CLI-Port" value="${app.tcpSlaveAgentListener.port}"/>
      <st:header name="X-Jenkins-CLI-Port" value="${app.tcpSlaveAgentListener.port}"/>
80
      <st:header name="X-Jenkins-CLI-Host" value="${app.tcpSlaveAgentListener.CLI_HOST_NAME}"/>
81 82 83 84 85
    </j:if>
    <j:forEach var="pd" items="${h.pageDecorators}">
      <st:include it="${pd}" page="httpHeaders.jelly" optional="true"/>
    </j:forEach>
  </j:if>
86 87
<x:doctype name="html" />
<html>
K
kohsuke 已提交
88
  <head>
89
    ${h.checkPermission(it,permission)}
90

91
    <title>${h.appendIfNotNull(title, ' [Jenkins]', 'Jenkins')}</title>
92 93
    <link rel="stylesheet" href="${resURL}/css/style.css" type="text/css" />
    <link rel="stylesheet" href="${resURL}/css/color.css" type="text/css" />
K
kohsuke 已提交
94
    <j:if test="${attrs.css!=null}">
95 96
      <link rel="stylesheet" href="${rootURL}${attrs.css}" type="text/css" />
    </j:if>
97
    <link rel="shortcut icon" href="${resURL}/favicon.ico" type="image/vnd.microsoft.icon" />
98 99

    <!-- are we running as an unit test? -->
K
Kohsuke Kawaguchi 已提交
100
    <script>var isRunAsTest=${h.isUnitTest}; var rootURL="${rootURL}"; var resURL="${resURL}";</script>
101

102 103 104 105 106 107
    <script src="${resURL}/scripts/prototype.js" type="text/javascript"/>
    <script src="${resURL}/scripts/behavior.js" type="text/javascript"/>

    <!-- we include our own prototype.js, so don't let stapler pull in another. -->
    <st:adjunct assumes="org.kohsuke.stapler.framework.prototype.prototype"
                includes="org.kohsuke.stapler.bind"/>
108

K
kohsuke 已提交
109
    <!-- To use the debug version of YUI, set the system property 'debug.YUI' to true -->
110
    <j:set var="yuiSuffix" value="${h.yuiSuffix}" />
111 112 113
    <l:yui module="yahoo" />
    <l:yui module="dom" />
    <l:yui module="event" />
114 115 116
    <j:if test="${h.yuiSuffix=='debug'}">
      <l:yui module="logger" />
    </j:if>
117
    <l:yui module="animation" />
118
    <l:yui module="dragdrop" />
119 120
    <l:yui module="container" />
    <l:yui module="connection" />
O
OHTAKE Tomohiro 已提交
121
    <l:yui module="datasource" />
122
    <l:yui module="autocomplete" />
K
kohsuke 已提交
123
    <l:yui module="menu" />
O
OHTAKE Tomohiro 已提交
124
    <l:yui module="element" />
K
kohsuke 已提交
125
    <l:yui module="button" />
O
OHTAKE Tomohiro 已提交
126
    <l:yui module="storage" />
127
    <!--l:yui module="editor" suffix="-beta" /-->
K
kohsuke 已提交
128

129
    <script src="${resURL}/scripts/hudson-behavior.js" type="text/javascript"></script>
130
    <script src="${resURL}/scripts/sortable.js" type="text/javascript"/>
131 132 133 134

    <script>
        crumb.init("${h.getCrumbRequestField()}", "${h.getCrumb(request)}");
    </script>
135
    
K
typo.  
kohsuke 已提交
136
    <link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/container.css" type="text/css"/>
K
kohsuke 已提交
137
    <link rel="stylesheet" href="${resURL}/scripts/yui/assets/skins/sam/skin.css" type="text/css" />
138
    <link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/skins/sam/container.css" type="text/css"/>
K
kohsuke 已提交
139
    <link rel="stylesheet" href="${resURL}/scripts/yui/button/assets/skins/sam/button.css" type="text/css" />
K
kohsuke 已提交
140
    <link rel="stylesheet" href="${resURL}/scripts/yui/menu/assets/skins/sam/menu.css" type="text/css" />
141
    <!--link rel="stylesheet" href="${resURL}/scripts/yui/editor/assets/skins/sam/editor.css" type="text/css" /-->
K
kohsuke 已提交
142

143
    <link rel="search" type="application/opensearchdescription+xml" href="${rootURL}/opensearch.xml" title="Jenkins" />
K
kohsuke 已提交
144 145 146
    <meta name="ROBOTS" content="INDEX,NOFOLLOW" />
    <j:set var="mode" value="header" />
    <d:invokeBody />
147 148 149
    <j:forEach var="pd" items="${h.pageDecorators}">
      <st:include it="${pd}" page="header.jelly" optional="true" />
    </j:forEach>
K
kohsuke 已提交
150
  </head>
K
kohsuke 已提交
151
  <body class="yui-skin-sam">
152 153 154
    <!-- for accessibility, skip the entire navigation bar and etc and go straight to the head of the content -->
    <a href="#skip2content" class="skiplink">Skip to content</a>

K
kohsuke 已提交
155 156 157 158 159
    <table id="header" cellpadding="0" cellspacing="0" width="100%" border="0">
      <tr>
        <td id="top-panel" colspan="2">
          <table cellpadding="0" cellspacing="0" width="100%" border="0">
            <tr><td style="font-weight:bold; font-size: 2em;">
160
              <a href="${rootURL}/"><img src="${imagesURL}/title.png" alt="title" /></a>
K
kohsuke 已提交
161
            </td><td style="vertical-align: middle; text-align: right; padding-right: 1em;">
K
kohsuke 已提交
162 163 164

              <!-- search box -->
              <j:set var="searchURL" value="${h.searchURL}"/>
165
              <form action="${searchURL}" method="get" style="position:relative;" class="no-json" name="search">
K
kohsuke 已提交
166 167 168 169 170
                <!-- this div determines the minimum width -->
                <div id="search-box-minWidth"/>
                <!-- this div is used to calculate the width of the text box -->
                <div id="search-box-sizer"/>
                <div id="searchform">
171
                  <input name="q" value="${%search}" id="search-box" class="has-default-text defaulted" />
K
kohsuke 已提交
172
                  <st:nbsp />
173
                  <a href="${%searchBox.url}"><img src="${imagesURL}/16x16/help.png" alt="help for search" height="16" width="16" /></a>
K
kohsuke 已提交
174 175 176 177
                  <div id="search-box-completion" />
                  <script>createSearchBox("${searchURL}");</script>
                </div>
              </form>
178
            </td><td id="login-field"><span>
K
kohsuke 已提交
179
              <!-- login field -->
K
kohsuke 已提交
180
              <j:if test="${app.useSecurity}">
K
kohsuke 已提交
181
                <st:nbsp/>
K
kohsuke 已提交
182
                <j:choose>
183
                  <j:when test="${!h.isAnonymous()}">
184 185
                    <span style="white-space:nowrap">
                      <a href="${rootURL}/user/${app.authentication.name}"><b>${app.authentication.name}</b></a>
K
kohsuke 已提交
186 187 188 189
                      <j:if test="${app.securityRealm.canLogOut()}">
                        |
                        <a href="${rootURL}/logout"><b>${%logout}</b></a>
                      </j:if>
K
kohsuke 已提交
190
                    </span>
K
kohsuke 已提交
191 192
                  </j:when>
                  <j:otherwise>
193
                    <st:include it="${app.securityRealm}" page="loginLink.jelly" />
K
kohsuke 已提交
194 195 196
                  </j:otherwise>
                </j:choose>
              </j:if>
197
            </span></td></tr>
K
kohsuke 已提交
198 199 200
          </table>
        </td>
      </tr>
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
      <tr id="top-nav">
        <td id="left-top-nav" colspan="2">
          <div class="top-sticker noedge">
            <div class="top-sticker-inner">
              <div id="right-top-nav">
                <j:if test="${attrs.norefresh==null}">
                  <div id="right-top-nav">
                    <div class="smallfont">
                      <j:choose>
                        <j:when test="${h.isAutoRefresh(request)}">
                          <a href="?auto_refresh=false">${%DISABLE AUTO REFRESH}</a>
                        </j:when>
                        <j:otherwise>
                          <a href="?auto_refresh=true">${%ENABLE AUTO REFRESH}</a>
                        </j:otherwise>
                      </j:choose>
                    </div>
                  </div>
                </j:if>
              </div>
              <ul id="breadcrumbs">
                <j:forEach var="anc" items="${request.ancestors}">
                  <j:if test="${h.isModel(anc.object) and anc.prev.url!=anc.url}">
                    <li onmouseover="return foo(this)">
                      <a href="${anc.url}/" tooltip="${anc.object.name}">
                        ${anc.object.displayName}
                      </a>
                    </li>
                  </j:if>
                </j:forEach>
              </ul>
              <script>
                var oMenu;
                function foo(e) {
                  oMenu.cfg.setProperty("context",[e,"tl","bl"]);
                  oMenu.show();
                  return false;
                }
                window.addEventListener("load",function(){
                  oMenu = new YAHOO.widget.Menu("basicmenu", {position:"dynamic", hidedelay:750});

                  oMenu.addItems([
                          { text: "Yahoo! Mail", url: "http://mail.yahoo.com" },
                          { text: "Yahoo! Address Book", url: "http://addressbook.yahoo.com" },
                          { text: "Yahoo! Calendar", url: "http://calendar.yahoo.com" },
                          { text: "Yahoo! Notepad",  url: "http://notepad.yahoo.com" }
                      ]);

                  oMenu.render("rendertarget");
                })
              </script>
              <div id="rendertarget"/>
            </div>
          </div>
        </td>
      </tr>
K
kohsuke 已提交
257 258
    </table>
    <table id="main-table" width="100%" height="70%" border="0"
K
Kohsuke Kawaguchi 已提交
259
        style="background-image: url(${imagesURL}/jenkins.png);
K
kohsuke 已提交
260 261 262
               background-repeat: no-repeat; background-position: bottom left;">
      <tr>
        <td id="side-panel" width="20%">
263
          <div id="navigation" style="min-height: 323px; height: auto !important; height: 323px;">
K
kohsuke 已提交
264 265
            <j:set var="mode" value="side-panel" />
            <d:invokeBody />
K
kohsuke 已提交
266 267 268 269 270 271 272 273 274 275 276

            <!-- add YUI logger if debugging YUI -->
            <j:if test="${h.yuiSuffix=='debug'}">
              <div id="yui-logreader" style="margin-top:1em"/>
              <script>
                Behaviour.addLoadEvent(function(){
                  var logReader = new YAHOO.widget.LogReader("yui-logreader");
                  logReader.collapse();
                });
              </script>
            </j:if>
K
kohsuke 已提交
277 278 279 280 281 282 283 284 285 286
          </div>
        </td>
        <td id="main-panel" width="80%" height="100%">
          <j:set var="mode" value="main-panel" />
          <d:invokeBody/>
        </td>
      </tr>
    </table>
    <table width="100%">
      <tr><td id="footer">
K
kohsuke 已提交
287 288 289 290
        <span style="padding-right:2em; color:gray">
          ${%Page generated}:
          <i:formatDate value="${h.getCurrentTime()}" type="both" dateStyle="medium" timeStyle="medium"/>
        </span>
291
        <a href="${h.getFooterURL()}">Jenkins ver. ${h.version}</a>
K
kohsuke 已提交
292 293
      </td></tr>
    </table>
294 295 296
    <j:forEach var="pd" items="${h.pageDecorators}">
      <st:include it="${pd}" page="footer.jelly" optional="true" />
    </j:forEach>
K
kohsuke 已提交
297 298
  </body>
</html>
299
</j:jelly>