layout.jelly 11.3 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

    <st:attribute name="title" use="required">
      Title of the HTML page. Rendered into &lt;title> tag.
    </st:attribute>
    <st:attribute name="norefresh">
37
      If non-null and not "false", auto refresh is disabled on this page.
K
kohsuke 已提交
38 39 40 41 42
      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.*
D
ddavison 已提交
48
      plugins should now do so by inserting &lt;style> elements and/or &lt;script> elements
K
kohsuke 已提交
49 50 51 52 53 54 55
      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>
K
Kohsuke Kawaguchi 已提交
56 57 58
<st:setHeader name="Expires" value="0" />
<st:setHeader name="Cache-Control" value="no-cache,must-revalidate" />
<st:setHeader name="X-Hudson-Theme" value="default" />
59
<st:setHeader name="X-Frame-Options" value="sameorigin" />
60
<st:contentType value="text/html;charset=UTF-8" />
K
Kohsuke Kawaguchi 已提交
61 62 63

  <j:new var="h" className="hudson.Functions" /><!-- instead of JSP functions -->
${h.initPageVariables(context)}
64 65 66 67 68 69 70
<!--
  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.
  this also allows us to configure HttpSessionContextIntegrationFilter not to create sessions,
  which I suspect can end up creating sessions for wrong resource types (such as static resources.)
-->
<j:set var="_" value="${request.getSession()}"/>
71
<j:set var="_" value="${h.configureAutoRefresh(request, response, attrs.norefresh!=null and !attrs.norefresh.equals(false))}"/>
72
  <j:if test="${request.servletPath=='/' || request.servletPath==''}">
K
Kohsuke Kawaguchi 已提交
73
    ${h.advertiseHeaders(response)}
74 75 76 77
    <j:forEach var="pd" items="${h.pageDecorators}">
      <st:include it="${pd}" page="httpHeaders.jelly" optional="true"/>
    </j:forEach>
  </j:if>
78 79
<x:doctype name="html" />
<html>
K
kohsuke 已提交
80
  <head>
81
    ${h.checkPermission(it,permission)}
82

83
    <title>${h.appendIfNotNull(title, ' [Jenkins]', 'Jenkins')}</title>
84 85
    <link rel="stylesheet" href="${resURL}/css/style.css" type="text/css" />
    <link rel="stylesheet" href="${resURL}/css/color.css" type="text/css" />
T
tfennelly 已提交
86
    <link rel="stylesheet" href="${resURL}/css/responsive-grid.css" type="text/css" />
K
kohsuke 已提交
87
    <j:if test="${attrs.css!=null}">
J
Jesse Glick 已提交
88
      <link rel="stylesheet" href="${resURL}${attrs.css}" type="text/css" />
89
    </j:if>
90
    <link rel="shortcut icon" href="${resURL}/favicon.ico" type="image/vnd.microsoft.icon" />
91 92

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

95 96 97 98 99 100
    <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"/>
101

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

122
    <script src="${resURL}/scripts/hudson-behavior.js" type="text/javascript"></script>
123
    <script src="${resURL}/scripts/sortable.js" type="text/javascript"/>
124 125 126 127

    <script>
        crumb.init("${h.getCrumbRequestField()}", "${h.getCrumb(request)}");
    </script>
128
    
K
typo.  
kohsuke 已提交
129
    <link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/container.css" type="text/css"/>
K
kohsuke 已提交
130
    <link rel="stylesheet" href="${resURL}/scripts/yui/assets/skins/sam/skin.css" type="text/css" />
131
    <link rel="stylesheet" href="${resURL}/scripts/yui/container/assets/skins/sam/container.css" type="text/css"/>
K
kohsuke 已提交
132
    <link rel="stylesheet" href="${resURL}/scripts/yui/button/assets/skins/sam/button.css" type="text/css" />
K
kohsuke 已提交
133
    <link rel="stylesheet" href="${resURL}/scripts/yui/menu/assets/skins/sam/menu.css" type="text/css" />
134
    <!--link rel="stylesheet" href="${resURL}/scripts/yui/editor/assets/skins/sam/editor.css" type="text/css" /-->
K
kohsuke 已提交
135

136 137 138
    <l:hasPermission permission="${app.READ}">
      <link rel="search" type="application/opensearchdescription+xml" href="${rootURL}/opensearch.xml" title="Jenkins" />
    </l:hasPermission>
K
kohsuke 已提交
139 140 141
    <meta name="ROBOTS" content="INDEX,NOFOLLOW" />
    <j:set var="mode" value="header" />
    <d:invokeBody />
142 143 144
    <j:forEach var="pd" items="${h.pageDecorators}">
      <st:include it="${pd}" page="header.jelly" optional="true" />
    </j:forEach>
K
kohsuke 已提交
145
  </head>
146
  <body id="jenkins" class="yui-skin-sam jenkins-${h.version}" data-version="jenkins-${h.version}">
147 148 149
    <!-- 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>

T
tfennelly 已提交
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
    <div id="header">
      <div class="logo">
        <a id="jenkins-home-link" href="${rootURL}/">
          <img id="jenkins-head-icon" src="${imagesURL}/jenkins-redbg.png" alt="title" />
          <img id="jenkins-name-icon" src="${imagesURL}/title.png" alt="title" width="139" height="34" />
        </a>
      </div>
      <div class="login">
        <!-- login field -->
        <j:if test="${app.useSecurity}">
          <st:nbsp/>
          <j:choose>
            <j:when test="${!h.isAnonymous()}">
              <j:invokeStatic var="user" className="hudson.model.User" method="current" />
              <j:choose>
                <j:when test="${user.fullName == null || user.fullName.trim().isEmpty()}">
                  <j:set var="userName" value="${user.id}"/>
                </j:when>
                <j:otherwise>
                  <j:set var="userName" value="${user.fullName}"/>
                </j:otherwise>
              </j:choose>
              <span style="white-space:nowrap">
                <a href="${rootURL}/user/${user.id}" class="model-link inside"><b>${userName}</b></a>
                <j:if test="${app.securityRealm.canLogOut()}">
                  |
                  <a href="${rootURL}/logout"><b>${%logout}</b></a>
                </j:if>
              </span>
            </j:when>
            <j:otherwise>
              <st:include it="${app.securityRealm}" page="loginLink.jelly" />
            </j:otherwise>
          </j:choose>
        </j:if>
      </div>
      <div class="searchbox hidden-xs">
        <!-- search box -->
        <j:set var="searchURL" value="${h.searchURL}"/>
        <form action="${searchURL}" method="get" style="position:relative;" class="no-json" name="search">
          <!-- 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">
            <input name="q" placeholder="${%search}" id="search-box" class="has-default-text" value="${request.getParameter('q')}" />
            <st:nbsp />
            <a href="${%searchBox.url}"><img src="${imagesURL}/16x16/help.png" alt="help for search" height="16" width="16" /></a>
            <div id="search-box-completion" />
            <script>createSearchBox("${searchURL}");</script>
          </div>
        </form>
      </div>
    </div>
    <div id="breadcrumbBar">
205 206 207 208
      <l:breadcrumbBar>
        <j:set var="mode" value="breadcrumbs" />
        <d:invokeBody />
      </l:breadcrumbBar>
T
tfennelly 已提交
209 210 211 212 213 214
    </div>

    <div id="page-body" class="container-fluid">
      <div class="row">
        <div id="side-panel" class="col-md-3">
          <div id="side-panel-content">
K
kohsuke 已提交
215 216
            <j:set var="mode" value="side-panel" />
            <d:invokeBody />
K
kohsuke 已提交
217 218 219 220 221 222 223 224 225 226 227

            <!-- 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 已提交
228
          </div>
T
tfennelly 已提交
229 230 231 232 233 234 235 236 237 238 239 240 241
        </div>

        <div id="main-panel" class="col-md-9">
          <div id="main-panel-content">
            <j:set var="mode" value="main-panel" />
            <d:invokeBody/>
          </div>
        </div>
      </div>
    </div>
    <div id="footer-container" class="hidden-xs">
      <div id="footer">
        <span class="page_generated">
K
kohsuke 已提交
242 243 244
          ${%Page generated}:
          <i:formatDate value="${h.getCurrentTime()}" type="both" dateStyle="medium" timeStyle="medium"/>
        </span>
T
tfennelly 已提交
245 246 247 248 249 250 251 252 253 254 255
        <span class="rest_api">
          <a href="api/">REST API</a>
        </span>
        <span class="jenkins_ver">
          <a href="${h.getFooterURL()}">Jenkins ver. ${h.version}</a>
        </span>
        <j:forEach var="pd" items="${h.pageDecorators}">
          <st:include it="${pd}" page="footer.jelly" optional="true" />
        </j:forEach>
      </div>
    </div>
K
kohsuke 已提交
256 257
  </body>
</html>
258
</j:jelly>