<commit_before><!--
The MIT License

Copyright (c) 2004-2009, Sun Microsystems, Inc., <NAME>, <NAME>

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.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout">
  <st:documentation>
    This tag inside &lt;l:tasks> tag renders the left navigation bar of Hudson.
    Each &lt;task> tag gets an icon and link.

    <st:attribute name="href" use="required">
      Link target. Relative to the current page.
    </st:attribute>
    <st:attribute name="icon" use="required">
      URL to an icon image, or the icon class specification.  If using an image URL,
      the image should be 24x24 in size and relative to the context path of Hudson.

      Common values include:

      # "icon-folder icon-md" is an example of using a class spec for a medium folder icon
      # "images/24x24/..." then points to the stock icon resources
      # "plugin/foobar/abc/def.png" that points to "src/main/webapp/abc/def.png" in your plugin resources
    </st:attribute>
    <st:attribute name="title" use="required">
      Human readable text that follows the icon.
    </st:attribute>
    <st:attribute name="enabled">
      If specified, then this controls whether the task is enabled or not.
    </st:attribute>
    <st:attribute name="contextMenu" type="boolean">
      If "false", remove this item from the context menu.
    </st:attribute>
    <st:attribute name="permission">
      If specified, the link will be only displayed when the current user
      has the specified permission against the "it" object.

      This is useful for showing links to restricted pages, as showing
      them to unprivileged users don't make sense.
    </st:attribute>
    <st:attribute name="post" type="boolean">
      If true, send a POST rather than a GET request.
      (onclick supersedes this except in the context menu.)
      (since 1.504)
    </st:attribute>
    <st:attribute name="requiresConfirmation" type="boolean">
      If true, require confirmation before clicking.
      Generally used with post="true".
      (onclick supersedes this except in the context menu.)
      (since 1.512)
    </st:attribute>
    <st:attribute name="confirmationMessage">
      Message to use for confirmation, if requested; defaults to title.
      (since 1.512)
    </st:attribute>
  </st:documentation>

  <!--
    Much of the following horrible code is to implement hierarchy support in <task> tag.
    The semantics is that when one of the nested <task> matches, the parent is also considered as a match
    and thus gets a highlight.
  -->
  <j:set var="match" value="${h.hyperlinkMatchesCurrentPage(href)}" />
  <j:scope>
    <j:set var="taskMatching" value="${context.parent}"/>
    <d:invokeBody />
  </j:scope>

  <j:if test="${attrs.permission==null or h.hasPermission(it,attrs.permission)}">
    <j:choose>
      <j:when test="${taskMatching!=null}">
        <j:if test="${match}">
          <j:set target="${taskMatching.variables}" property="match" value="true"/>
        </j:if>
      </j:when>

      <!--
      The icon attribute can be an icon class spec, or can be the url of an icon image.
      Within core Jenkins, we've updated all usages of the task element to use icon class specs,
      but we need to accommodate plugins etc that still use urls.  So, first we treat the icon
      attribute value as an icon spec and attempt to use that spec to lookup the icon's metadata.
      If that lookup fails, we try treat it as a URL and try looking up the icon metadata by URL.
      If either of these lookups are successful, we create an icon element instance using the
      icon class spec from the icon metadata, otherwise we create an icon element instance using
      icon attribute value as an icon "src" (Vs class spec).
      -->
      <j:set var="iconMetadata" value="${icons.getIconByClassSpec(attrs.icon)}"/>
      <j:if test="${iconMetadata == null}">
        <!-- Icon could be provided as a simple iconFileName e.g. "settings.png" -->
        <j:set var="iconMetadata" value="${icons.getIconByClassSpec(icons.toNormalizedIconNameClass(attrs.icon) + ' icon-md')}"/>
      </j:if>
      <j:if test="${iconMetadata == null}">
        <!-- Icon could be provided as an absolute iconFileName e.g. "/plugin/foo/abc.png" -->
        <j:set var="iconMetadata" value="${icons.getIconByUrl(attrs.icon)}"/>
      </j:if>

      <j:if test="${!icon.startsWith('/')}">
        <j:set var="icon" value="/${icon}"/>
      </j:if>
      <j:set var="icon" value="${rootURL}${icon.startsWith('images/') || icon.startsWith('plugin/') ? h.resourcePath : ''}${icon}"/>
      <j:when test="${enabled==false}">
        <div class="task disabled">
          <span>
            <j:choose>
              <j:when test="${iconMetadata != null}">
                <l:icon class="${iconMetadata.classSpec}" style="width: 24px; height: 24px; margin: 2px;" />
              </j:when>
              <j:otherwise>
                <l:icon alt="" src="${icon}" style="width: 24px; height: 24px; margin: 2px;" />
              </j:otherwise>
            </j:choose>
          </span>
          <st:nbsp />

          <span>
            <j:choose>
              <j:when test="${match}">
                <b>${title}</b><commit_msg>Readd static resource path for task icons [JENKINS-24316]<commit_after><!--
The MIT License

Copyright (c) 2004-2009, Sun Microsystems, Inc., <NAME>, <NAME>

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.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout">
  <st:documentation>
    This tag inside &lt;l:tasks> tag renders the left navigation bar of Hudson.
    Each &lt;task> tag gets an icon and link.

    <st:attribute name="href" use="required">
      Link target. Relative to the current page.
    </st:attribute>
    <st:attribute name="icon" use="required">
      URL to an icon image, or the icon class specification.  If using an image URL,
      the image should be 24x24 in size and relative to the context path of Hudson.

      Common values include:

      # "icon-folder icon-md" is an example of using a class spec for a medium folder icon
      # "images/24x24/..." then points to the stock icon resources
      # "plugin/foobar/abc/def.png" that points to "src/main/webapp/abc/def.png" in your plugin resources
    </st:attribute>
    <st:attribute name="title" use="required">
      Human readable text that follows the icon.
    </st:attribute>
    <st:attribute name="enabled">
      If specified, then this controls whether the task is enabled or not.
    </st:attribute>
    <st:attribute name="contextMenu" type="boolean">
      If "false", remove this item from the context menu.
    </st:attribute>
    <st:attribute name="permission">
      If specified, the link will be only displayed when the current user
      has the specified permission against the "it" object.

      This is useful for showing links to restricted pages, as showing
      them to unprivileged users don't make sense.
    </st:attribute>
    <st:attribute name="post" type="boolean">
      If true, send a POST rather than a GET request.
      (onclick supersedes this except in the context menu.)
      (since 1.504)
    </st:attribute>
    <st:attribute name="requiresConfirmation" type="boolean">
      If true, require confirmation before clicking.
      Generally used with post="true".
      (onclick supersedes this except in the context menu.)
      (since 1.512)
    </st:attribute>
    <st:attribute name="confirmationMessage">
      Message to use for confirmation, if requested; defaults to title.
      (since 1.512)
    </st:attribute>
  </st:documentation>

  <!--
    Much of the following horrible code is to implement hierarchy support in <task> tag.
    The semantics is that when one of the nested <task> matches, the parent is also considered as a match
    and thus gets a highlight.
  -->
  <j:set var="match" value="${h.hyperlinkMatchesCurrentPage(href)}" />
  <j:scope>
    <j:set var="taskMatching" value="${context.parent}"/>
    <d:invokeBody />
  </j:scope>

  <j:if test="${attrs.permission==null or h.hasPermission(it,attrs.permission)}">
    <j:choose>
      <j:when test="${taskMatching!=null}">
        <j:if test="${match}">
          <j:set target="${taskMatching.variables}" property="match" value="true"/>
        </j:if>
      </j:when>

      <!--
      The icon attribute can be an icon class spec, or can be the url of an icon image.
      Within core Jenkins, we've updated all usages of the task element to use icon class specs,
      but we need to accommodate plugins etc that still use urls.  So, first we treat the icon
      attribute value as an icon spec and attempt to use that spec to lookup the icon's metadata.
      If that lookup fails, we try treat it as a URL and try looking up the icon metadata by URL.
      If either of these lookups are successful, we create an icon element instance using the
      icon class spec from the icon metadata, otherwise we create an icon element instance using
      icon attribute value as an icon "src" (Vs class spec).
      -->
      <j:set var="iconMetadata" value="${icons.getIconByClassSpec(attrs.icon)}"/>
      <j:if test="${iconMetadata == null}">
        <!-- Icon could be provided as a simple iconFileName e.g. "settings.png" -->
        <j:set var="iconMetadata" value="${icons.getIconByClassSpec(icons.toNormalizedIconNameClass(attrs.icon) + ' icon-md')}"/>
      </j:if>
      <j:if test="${iconMetadata == null}">
        <!-- Icon could be provided as an absolute iconFileName e.g. "/plugin/foo/abc.png" -->
        <j:set var="iconMetadata" value="${icons.getIconByUrl(attrs.icon)}"/>
      </j:if>

      <j:if test="${!icon.startsWith('/')}">
        <j:set var="icon" value="/${icon}"/>
      </j:if>
      <j:set var="icon" value="${rootURL}${icon.startsWith('/images/') || icon.startsWith('/plugin/') ? h.resourcePath : ''}${icon}"/>
      <j:when test="${enabled==false}">
        <div class="task disabled">
          <span>
            <j:choose>
              <j:when test="${iconMetadata != null}">
                <l:icon class="${iconMetadata.classSpec}" style="width: 24px; height: 24px; margin: 2px;" />
              </j:when>
              <j:otherwise>
                <l:icon alt="" src="${icon}" style="width: 24px; height: 24px; margin: 2px;" />
              </j:otherwise>
            </j:choose>
          </span>
          <st:nbsp />

          <span>
            <j:choose>
              <j:when test="${match}">
                <b>${title}</b>
{'fraction_non_alphanumeric': 0.11672198514303778, 'fraction_numerical': 0.006401137980085348, 'mean_word_length': 3.110100682039623, 'pattern_counts': {'":': 0, '<': 147, '<?xml version=': 0, '>': 151, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5441867', 'n_tokens_mistral': 3641, 'n_tokens_neox': 3466, 'n_words': 1414}