<commit_before><%--
  ~ Copyright 2005-2006 The Apache Software Foundation.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  --%>

<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %>

<html>
<head>
  <title>Administration</title>
  <ww:head/>
</head>

<body>

<h1>Administration</h1>

<div id="contentArea">
<div>
  <div style="float: right">
    <%-- TODO replace with icons --%>
    <a href="<ww:url action="configure" />">Edit Configuration</a>
  </div>
  <h2>Configuration</h2>
</div>

<table class="infoTable">
  <tr>
    <th>Index Directory</th>
    <td>
      <ww:property value="indexPath"/>
    </td>
    <td></td>
  </tr>
  <tr>
    <th>Indexing Schedule</th>
    <td>
      <ww:property value="indexerCronExpression"/>
    </td>
    <%-- TODO: a "delete index and run now" operation should be here too (really clean, remove deletions that didn't get picked up) --%>
    <td>
      <pss:ifAuthorized permission="archiva-run-indexer">
        <a href="<ww:url action="runIndexer" />">Run Now</a>
      </pss:ifAuthorized>
    </td>
  </tr>
</table>

<ww:set name="proxy" value="proxy"/>
<c:if test="${!empty(proxy.host)}">
  <h3>HTTP Proxy</h3>

  <table class="infoTable">
    <tr>
      <th>Host</th>
      <td>${proxy.host}</td>
    </tr>
    <tr>
      <th>Port</th>
      <td>${proxy.port}</td>
    </tr>
    <tr>
      <th>Username</th>
      <td>${proxy.username}</td>
    </tr>
  </table>
</c:if>

<c:set var="urlbase">${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}/repository/</c:set>

<div>
  <div style="float: right">
    <%-- TODO replace with icons --%>
    <pss:ifAuthorized permission="archiva-add-repository">
      <ww:url id="addRepositoryUrl" action="addRepository" method="input"/>
      <ww:a href="%{addRepositoryUrl}">Add Repository</ww:a>
    </pss:ifAuthorized>
  </div>
  <h2>Managed Repositories</h2>
</div>

<ww:set name="repositories" value="repositories"/>
<c:if test="${empty(repositories)}">
  <strong>There are no managed repositories configured yet.</strong>
</c:if>
<c:forEach items="${repositories}" var="repository" varStatus="i">
  <div>
    <div style="float: right">
      <ww:url id="editRepositoryUrl" action="editRepository" method="input">
        <ww:param name="repoId" value="%{'${repository.id}'}" />
      </ww:url>
      <ww:url id="deleteRepositoryUrl" action="deleteRepository" method="input">
        <ww:param name="repoId" value="%{'${repository.id}'}" />
      </ww:url>
      <%-- TODO replace with icons --%>
      <pss:ifAuthorized permission="archiva-edit-repository" resource="${repository.id}"><ww:a href="%{editRepositoryUrl}">Edit Repository</ww:a></pss:ifAuthorized>
      <pss:ifAuthorized permission="archiva-delete-repository" resource="${repository.id}"><ww:a href="%{deleteRepositoryUrl}">Delete Repository</ww:a></pss:ifAuthorized>
    </div>
    <h3>${repository.name}</h3>
    <table class="infoTable">
      <tr>
        <th>Identifier</th>
        <td>
          <code>${repository.id}</code>
        </td>
      </tr>
      <tr>
        <th>Directory</th>
        <td>${repository.directory}</td>
      </tr>
      <tr>
        <th>WebDAV URL</th>
        <td><a href="${urlbase}${repository.urlName}">${urlbase}${repository.urlName}</a></td>
      </tr>
      <tr>
        <th>Type</th>
          <%-- TODO: can probably just use layout appended to a key prefix in i18n to simplify this --%>
        <td>
          <c:choose>
            <c:when test="${repository.layout == 'default'}">
              Maven 2.x Repository
            </c:when>
            <c:otherwise>
              Maven 1.x Repository
            </c:otherwise>
          </c:choose>
        </td>
      </tr>
      <tr>
        <th>Snapshots Included</th>
        <td class="${repository.includeSnapshots ? 'doneMark' : 'errorMark'} booleanIcon"> ${repository.includeSnapshots}</td>
      </tr>
      <tr>
        <th>Indexed</th>
        <td class="${repository.indexed ? 'doneMark' : 'errorMark'} booleanIcon"> ${repository.indexed}</td>
      </tr>
      <tr>
        <th>POM Snippet</th>
        <td><a href="#" onclick="Effect.SlideDown('repoPom${repository.id}'); return false;">Show POM Snippet</a><br />
<pre class="pom" style="display: none;" id="repoPom${repository.id}"><code>&lt;project><commit_msg>Fix the SlideDown so that it slides up again when you click on it rather than re-sliding down. I'm a bit unsure by the toggle method as it seems to be implied that it is deprecated in the scriptaculous source, but I can't see any kind of replacement<commit_after><%--
  ~ Copyright 2005-2006 The Apache Software Foundation.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  --%>

<%@ taglib prefix="ww" uri="/webwork" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %>

<html>
<head>
  <title>Administration</title>
  <ww:head/>
</head>

<body>

<h1>Administration</h1>

<div id="contentArea">
<div>
  <div style="float: right">
    <%-- TODO replace with icons --%>
    <a href="<ww:url action="configure" />">Edit Configuration</a>
  </div>
  <h2>Configuration</h2>
</div>

<table class="infoTable">
  <tr>
    <th>Index Directory</th>
    <td>
      <ww:property value="indexPath"/>
    </td>
    <td></td>
  </tr>
  <tr>
    <th>Indexing Schedule</th>
    <td>
      <ww:property value="indexerCronExpression"/>
    </td>
    <%-- TODO: a "delete index and run now" operation should be here too (really clean, remove deletions that didn't get picked up) --%>
    <td>
      <pss:ifAuthorized permission="archiva-run-indexer">
        <a href="<ww:url action="runIndexer" />">Run Now</a>
      </pss:ifAuthorized>
    </td>
  </tr>
</table>

<ww:set name="proxy" value="proxy"/>
<c:if test="${!empty(proxy.host)}">
  <h3>HTTP Proxy</h3>

  <table class="infoTable">
    <tr>
      <th>Host</th>
      <td>${proxy.host}</td>
    </tr>
    <tr>
      <th>Port</th>
      <td>${proxy.port}</td>
    </tr>
    <tr>
      <th>Username</th>
      <td>${proxy.username}</td>
    </tr>
  </table>
</c:if>

<c:set var="urlbase">${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}/repository/</c:set>

<div>
  <div style="float: right">
    <%-- TODO replace with icons --%>
    <pss:ifAuthorized permission="archiva-add-repository">
      <ww:url id="addRepositoryUrl" action="addRepository" method="input"/>
      <ww:a href="%{addRepositoryUrl}">Add Repository</ww:a>
    </pss:ifAuthorized>
  </div>
  <h2>Managed Repositories</h2>
</div>

<ww:set name="repositories" value="repositories"/>
<c:if test="${empty(repositories)}">
  <strong>There are no managed repositories configured yet.</strong>
</c:if>
<c:forEach items="${repositories}" var="repository" varStatus="i">
  <div>
    <div style="float: right">
      <ww:url id="editRepositoryUrl" action="editRepository" method="input">
        <ww:param name="repoId" value="%{'${repository.id}'}" />
      </ww:url>
      <ww:url id="deleteRepositoryUrl" action="deleteRepository" method="input">
        <ww:param name="repoId" value="%{'${repository.id}'}" />
      </ww:url>
      <%-- TODO replace with icons --%>
      <pss:ifAuthorized permission="archiva-edit-repository" resource="${repository.id}"><ww:a href="%{editRepositoryUrl}">Edit Repository</ww:a></pss:ifAuthorized>
      <pss:ifAuthorized permission="archiva-delete-repository" resource="${repository.id}"><ww:a href="%{deleteRepositoryUrl}">Delete Repository</ww:a></pss:ifAuthorized>
    </div>
    <h3>${repository.name}</h3>
    <table class="infoTable">
      <tr>
        <th>Identifier</th>
        <td>
          <code>${repository.id}</code>
        </td>
      </tr>
      <tr>
        <th>Directory</th>
        <td>${repository.directory}</td>
      </tr>
      <tr>
        <th>WebDAV URL</th>
        <td><a href="${urlbase}${repository.urlName}">${urlbase}${repository.urlName}</a></td>
      </tr>
      <tr>
        <th>Type</th>
          <%-- TODO: can probably just use layout appended to a key prefix in i18n to simplify this --%>
        <td>
          <c:choose>
            <c:when test="${repository.layout == 'default'}">
              Maven 2.x Repository
            </c:when>
            <c:otherwise>
              Maven 1.x Repository
            </c:otherwise>
          </c:choose>
        </td>
      </tr>
      <tr>
        <th>Snapshots Included</th>
        <td class="${repository.includeSnapshots ? 'doneMark' : 'errorMark'} booleanIcon"> ${repository.includeSnapshots}</td>
      </tr>
      <tr>
        <th>Indexed</th>
        <td class="${repository.indexed ? 'doneMark' : 'errorMark'} booleanIcon"> ${repository.indexed}</td>
      </tr>
      <tr>
        <th>POM Snippet</th>
        <td><a href="#" onclick="Effect.toggle('repoPom${repository.id}','slide'); return false;">Show POM Snippet</a><br />
<pre class="pom" style="display: none;" id="repoPom${repository.id}"><code>&lt;project>
{'fraction_non_alphanumeric': 0.18437900128040974, 'fraction_numerical': 0.005121638924455826, 'mean_word_length': 3.1343648208469057, 'pattern_counts': {'":': 0, '<': 347, '<?xml version=': 0, '>': 349, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '5104808', 'n_tokens_mistral': 3454, 'n_tokens_neox': 3357, 'n_words': 760}