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