]> source.dussan.org Git - archiva.git/blob
9355963e380d489cb6d5985c1ddff7153489c541
[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             <ww:select name="connector.policies['${policy.key}']"
50                        list="policyMap['${policy.key}'].options"
51                        value="connector.policies['${policy.key}']"
52                        id="policy_${policy.key}"
53                        theme="simple"
54                        cssStyle="width: 10em"/>
55           </td>
56         </tr>
57       </c:forEach>
58     </table>
59   </td>
60 </tr>
61
62 <tr class="seperator">
63   <td valign="top">
64     <label for="propertiesEntry">Properties:</label>
65   </td>
66   <td>
67     <ww:textfield name="propertyKey" size="15" id="propertiesEntry" theme="simple"
68                   onkeypress="submitenter(event, 'addProperty')"/>
69     :
70     <ww:textfield name="propertyValue" size="15" id="propertiesValue" theme="simple"
71                   onkeypress="submitenter(event, 'addProperty')"/>
72     <input type="button" onclick="submitForm('addProperty')" value="Add Property" />
73   </td>
74 </tr>
75
76 <tr>
77   <td>
78   </td>
79   <td>
80     <c:choose>
81       <c:when test="${empty(connector.properties)}">
82         <i>No properties have been set.</i>
83       </c:when>
84       <c:otherwise>
85         <table>
86           <c:forEach items="${connector.properties}" var="property" varStatus="i">
87             <tr>
88               <td>
89                 <ww:label for="property_${property.key}"
90                           theme="simple">${property.key}</ww:label>
91               </td>
92               <td>
93                 <ww:textfield name="connector.properties['${property.key}']"
94                               size="15"
95                               id="property_${property.key}"
96                               theme="simple"/>
97               </td>
98               <td>
99                 <ww:a href="#" title="Remove [${property.key}] Property"
100                       onclick="setAndSubmit('propertyKey', '${property.key}', 'removeProperty')"
101                       theme="simple">
102                   <img src="${iconDeleteUrl}"/></ww:a>
103               </td>
104             </tr>
105           </c:forEach>
106         </table>
107       </c:otherwise>
108     </c:choose>
109   </td>
110 </tr>
111
112 <tr class="seperator">
113   <td valign="top">
114     <label for="blackListEntry">Black List:</label>
115   </td>
116   <td>
117     <ww:textfield name="blackListPattern" size="30" id="blackListEntry" theme="simple"
118                   onkeypress="submitenter(event, 'addBlackListPattern')"/>
119     <input type="button" onclick="submitForm('addBlackListPattern')" value="Add Pattern" />
120   </td>
121 </tr>
122
123 <tr>
124   <td>
125   </td>
126   <td>
127     <c:choose>
128       <c:when test="${empty(connector.blackListPatterns)}">
129         <i>No black list patterns have been set.</i>
130       </c:when>
131       <c:otherwise>
132         <table>
133           <c:forEach items="${connector.blackListPatterns}" var="pattern" varStatus="i">
134             <tr>
135               <td>
136                 <ww:hidden name="connector.blackListPatterns" value="${pattern}"/>
137                 <code>"${pattern}"</code>
138               </td>
139               <td>
140                 <a href="#" title="Remove [${pattern}] Pattern"
141                       onclick="setAndSubmit('pattern', '${pattern}', 'removeBlackListPattern')">
142                   <img src="${iconDeleteUrl}"/></a>
143               </td>
144             </tr>
145           </c:forEach>
146         </table>
147       </c:otherwise>
148     </c:choose>
149   </td>
150 </tr>
151
152 <tr class="seperator">
153   <td valign="top">
154     <label for="whiteListEntry">White List:</label>
155   </td>
156   <td>
157     <ww:textfield name="whiteListPattern" size="30" id="whiteListEntry" theme="simple"
158                   onkeypress="submitenter(event, 'addWhiteListPattern')"/>
159     <input type="button" onclick="submitForm('addWhiteListPattern')" value="Add Pattern" />
160   </td>
161 </tr>
162 <tr>
163   <td>
164   </td>
165   <td>
166     <c:choose>
167       <c:when test="${empty(connector.whiteListPatterns)}">
168         <i>No white list patterns have been set.</i>
169       </c:when>
170       <c:otherwise>
171         <table>
172           <c:forEach items="${connector.whiteListPatterns}" var="pattern" varStatus="i">
173             <tr>
174               <td>
175                 <ww:hidden name="connector.whiteListPatterns" value="${pattern}"/>
176                 <code>"${pattern}"</code>
177               </td>
178               <td>
179                 <ww:a href="#" title="Remove [${pattern}] Pattern"
180                       onclick="setAndSubmit('pattern', '${pattern}', 'removeWhiteListPattern')"
181                       theme="simple">
182                   <img src="${iconDeleteUrl}"/></ww:a>
183               </td>
184             </tr>
185           </c:forEach>
186         </table>
187       </c:otherwise>
188     </c:choose>
189   </td>
190 </tr>
191
192 <script type="text/javascript">
193   <!--
194   function adjustActionMethod( action, method )
195   {
196     var idx = action.indexOf( "!" );
197     if( idx == (-1) )
198     {
199       // no "name!method.action" defined, split by ".action" instead.
200       idx = action.indexOf( ".action" );
201     }
202     
203     return action.substring( 0, idx ) + "!" + method + ".action";
204   }
205   
206   function setAndSubmit( id, value, method )
207   {
208     var f = document.forms['saveProxyConnector'];
209
210     f.action = adjustActionMethod( f.action, method );
211     f.elements[id].value = value;
212     f.submit();
213   }
214
215   function submitForm( method )
216   {
217     var f = document.forms['saveProxyConnector'];
218
219     var before = f.action;
220     f.action = adjustActionMethod( f.action, method );
221     f.submit();
222   }
223
224   function submitenter( e, method )
225   {
226     var keycode;
227
228
229     if ( window.event )
230     {
231       keycode = window.event.keyCode;
232     }
233     else if ( e )
234     {
235       keycode = e.which;
236     }
237     else
238     {
239       return true;
240     }
241
242     if ( keycode == 13 )
243     {
244       submitForm( method );
245       return false;
246     }
247     else
248     {
249       return true;
250     }
251   }
252   
253   document.forms["saveProxyConnector"]["connector.proxyId"].focus();
254   //-->
255 </script>
256