]> source.dussan.org Git - archiva.git/blob
52acf5881ce24b8cae630b22ad1974d9b24c3450
[archiva.git] /
1 <%--
2   ~ Licensed to the Apache Software Foundation (ASF) under one
3   ~ or more contributor license agreements.  See the NOTICE file
4   ~ distributed with this work for additional information
5   ~ regarding copyright ownership.  The ASF licenses this file
6   ~ to you under the Apache License, Version 2.0 (the
7   ~ "License"); you may not use this file except in compliance
8   ~ with the License.  You may obtain a copy of the License at
9   ~
10   ~   http://www.apache.org/licenses/LICENSE-2.0
11   ~
12   ~ Unless required by applicable law or agreed to in writing,
13   ~ software distributed under the License is distributed on an
14   ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   ~ KIND, either express or implied.  See the License for the
16   ~ specific language governing permissions and limitations
17   ~ under the License.
18   --%>
19 <%@ taglib prefix="ww" uri="/webwork" %>
20 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
21
22 <c:url var="iconDeleteUrl" value="/images/icons/delete.gif"/>
23 <c:url var="iconCreateUrl" value="/images/icons/create.png"/>
24
25 <%-- This hidden 'pattern' field is used by remove (white|black)list scripts --%>
26 <ww:hidden name="pattern" />
27
28 <ww:hidden name="connector.order" />
29
30 <ww:select name="connector.proxyId" list="proxyIdOptions" label="Network Proxy" required="true"/>
31 <ww:select name="connector.sourceRepoId" list="managedRepoIdList"
32            label="Managed Repository" required="true"/>
33 <ww:select name="connector.targetRepoId" list="remoteRepoIdList"
34            label="Remote Repository" required="true"/>
35
36 <tr>
37   <td valign="top"><label>Policies:</label>
38   </td>
39   <td>
40     <table>
41       <c:forEach items="${policyMap}" var="policy" varStatus="i">
42         <tr>
43           <td>
44             <ww:label for="policy_${policy.key}" required="true"
45                       theme="simple">${policy.key}:
46             </ww:label>
47           </td>
48           <td>
49             <c:set var="value">
50               <ww:property id="value" value="connector.policies['${policy.key}']" default="${policy.value.defaultOption}" />
51             </c:set>
52             <ww:select name="connector.policies['${policy.key}']"
53                        list="policyMap['${policy.key}'].options"
54                        value="'${value}'"
55                        id="policy_${policy.key}"
56                        theme="simple"
57                        cssStyle="width: 10em"/>
58           </td>
59         </tr>
60       </c:forEach>
61     </table>
62   </td>
63 </tr>
64
65 <tr class="seperator">
66   <td valign="top">
67     <label for="propertiesEntry">Properties:</label>
68   </td>
69   <td>
70     <ww:textfield name="propertyKey" size="15" id="propertiesEntry" theme="simple"
71                   onkeypress="submitenter(event, 'addProperty')"/>
72     :
73     <ww:textfield name="propertyValue" size="15" id="propertiesValue" theme="simple"
74                   onkeypress="submitenter(event, 'addProperty')"/>
75     <input type="button" onclick="submitForm('addProperty')" value="Add Property" />
76   </td>
77 </tr>
78
79 <tr>
80   <td>
81   </td>
82   <td>
83     <c:choose>
84       <c:when test="${empty(connector.properties)}">
85         <i>No properties have been set.</i>
86       </c:when>
87       <c:otherwise>
88         <table>
89           <c:forEach items="${connector.properties}" var="property" varStatus="i">
90             <tr>
91               <td>
92                 <ww:label for="property_${property.key}"
93                           theme="simple">${property.key}</ww:label>
94               </td>
95               <td>
96                 <ww:textfield name="connector.properties['${property.key}']"
97                               size="15"
98                               id="property_${property.key}"
99                               theme="simple"/>
100               </td>
101               <td>
102                 <ww:a href="#" title="Remove [${property.key}] Property"
103                       onclick="setAndSubmit('propertyKey', '${property.key}', 'removeProperty')"
104                       theme="simple">
105                   <img src="${iconDeleteUrl}"/></ww:a>
106               </td>
107             </tr>
108           </c:forEach>
109         </table>
110       </c:otherwise>
111     </c:choose>
112   </td>
113 </tr>
114
115 <tr class="seperator">
116   <td valign="top">
117     <label for="blackListEntry">Black List:</label>
118   </td>
119   <td>
120     <ww:textfield name="blackListPattern" size="30" id="blackListEntry" theme="simple"
121                   onkeypress="submitenter(event, 'addBlackListPattern')"/>
122     <input type="button" onclick="submitForm('addBlackListPattern')" value="Add Pattern" />
123   </td>
124 </tr>
125
126 <tr>
127   <td>
128   </td>
129   <td>
130     <c:choose>
131       <c:when test="${empty(connector.blackListPatterns)}">
132         <i>No black list patterns have been set.</i>
133       </c:when>
134       <c:otherwise>
135         <table>
136           <c:forEach items="${connector.blackListPatterns}" var="pattern" varStatus="i">
137             <tr>
138               <td>
139                 <ww:hidden name="connector.blackListPatterns" value="${pattern}"/>
140                 <code>"${pattern}"</code>
141               </td>
142               <td>
143                 <a href="#" title="Remove [${pattern}] Pattern"
144                       onclick="setAndSubmit('pattern', '${pattern}', 'removeBlackListPattern')">
145                   <img src="${iconDeleteUrl}"/></a>
146               </td>
147             </tr>
148           </c:forEach>
149         </table>
150       </c:otherwise>
151     </c:choose>
152   </td>
153 </tr>
154
155 <tr class="seperator">
156   <td valign="top">
157     <label for="whiteListEntry">White List:</label>
158   </td>
159   <td>
160     <ww:textfield name="whiteListPattern" size="30" id="whiteListEntry" theme="simple"
161                   onkeypress="submitenter(event, 'addWhiteListPattern')"/>
162     <input type="button" onclick="submitForm('addWhiteListPattern')" value="Add Pattern" />
163   </td>
164 </tr>
165 <tr>
166   <td>
167   </td>
168   <td>
169     <c:choose>
170       <c:when test="${empty(connector.whiteListPatterns)}">
171         <i>No white list patterns have been set.</i>
172       </c:when>
173       <c:otherwise>
174         <table>
175           <c:forEach items="${connector.whiteListPatterns}" var="pattern" varStatus="i">
176             <tr>
177               <td>
178                 <ww:hidden name="connector.whiteListPatterns" value="${pattern}"/>
179                 <code>"${pattern}"</code>
180               </td>
181               <td>
182                 <ww:a href="#" title="Remove [${pattern}] Pattern"
183                       onclick="setAndSubmit('pattern', '${pattern}', 'removeWhiteListPattern')"
184                       theme="simple">
185                   <img src="${iconDeleteUrl}"/></ww:a>
186               </td>
187             </tr>
188           </c:forEach>
189         </table>
190       </c:otherwise>
191     </c:choose>
192   </td>
193 </tr>
194
195 <script type="text/javascript">
196   <!--
197   function adjustActionMethod( action, method )
198   {
199     var idx = action.indexOf( "!" );
200     if( idx == (-1) )
201     {
202       // no "name!method.action" defined, split by ".action" instead.
203       idx = action.indexOf( ".action" );
204     }
205     
206     return action.substring( 0, idx ) + "!" + method + ".action";
207   }
208   
209   function setAndSubmit( id, value, method )
210   {
211     var f = document.forms['saveProxyConnector'];
212
213     f.action = adjustActionMethod( f.action, method );
214     f.elements[id].value = value;
215     f.submit();
216   }
217
218   function submitForm( method )
219   {
220     var f = document.forms['saveProxyConnector'];
221
222     var before = f.action;
223     f.action = adjustActionMethod( f.action, method );
224     f.submit();
225   }
226
227   function submitenter( e, method )
228   {
229     var keycode;
230
231
232     if ( window.event )
233     {
234       keycode = window.event.keyCode;
235     }
236     else if ( e )
237     {
238       keycode = e.which;
239     }
240     else
241     {
242       return true;
243     }
244
245     if ( keycode == 13 )
246     {
247       submitForm( method );
248       return false;
249     }
250     else
251     {
252       return true;
253     }
254   }
255   
256   document.forms["saveProxyConnector"]["connector.proxyId"].focus();
257   //-->
258 </script>
259