|
110 | 110 | <fmt:message var="GML_ThisFormContains" key="GML.ThisFormContains"/>
|
111 | 111 | <fmt:message var="GML_error" key="GML.error"/>
|
112 | 112 | <fmt:message var="GML_errors" key="GML.errors"/>
|
| 113 | +<fmt:message var="mandatoryField" key="GML.requiredField"/> |
| 114 | +<fmt:message var="deletionOp" key="GML.delete"/> |
113 | 115 |
|
114 | 116 | <script type="text/javascript">
|
115 | 117 |
|
|
140 | 142 |
|
141 | 143 | function ifCorrectLocalFormExecute(callback)
|
142 | 144 | {
|
143 |
| - let verif; |
144 | 145 | let errorMsg = "";
|
145 | 146 | let errorNb = 0;
|
146 | 147 | const title = stripInitialWhitespace(document.classifiedForm.Title.value);
|
|
168 | 169 | </c:if>
|
169 | 170 |
|
170 | 171 | <c:if test="${instanceSettings.photosAllowed}">
|
171 |
| - if (!isWhitespace(document.classifiedForm.Image1.value)) { |
172 |
| - verif = /[.][jpg,gif,bmp,tiff,tif,jpeg,png,JPG,GIF,BMP,TIFF,TIF,JPEG,PNG]{3,4}$/; |
173 |
| - if (verif.exec(document.classifiedForm.Image1.value) == null) { |
174 |
| - errorMsg+=" - '${classifieds_image}1' : ${classifieds_imageFormat}\n"; |
| 172 | + let imgExtPattern = /\.(jpg|gif|bmp|tiff|tif|jpeg|png|webp)$/i; |
| 173 | + if (!isWhitespace(document.classifiedForm.Image1.value) && |
| 174 | + imgExtPattern.exec(document.classifiedForm.Image1.value) == null) { |
| 175 | + errorMsg+=" - '${classifieds_image}1': ${classifieds_imageFormat}\n"; |
175 | 176 | errorNb++;
|
176 |
| - } |
177 | 177 | }
|
178 | 178 |
|
179 |
| - if (!isWhitespace(document.classifiedForm.Image2.value)) { |
180 |
| - verif = /[.][jpg,gif,bmp,tiff,tif,jpeg,png,JPG,GIF,BMP,TIFF,TIF,JPEG,PNG]{3,4}$/; |
181 |
| - if (verif.exec(document.classifiedForm.Image2.value) == null) { |
182 |
| - errorMsg+=" - '${classifieds_image}2' : ${classifieds_imageFormat}\n"; |
| 179 | + if (!isWhitespace(document.classifiedForm.Image2.value) && |
| 180 | + imgExtPattern.exec(document.classifiedForm.Image2.value) == null) { |
| 181 | + errorMsg+=" - '${classifieds_image}2': ${classifieds_imageFormat}\n"; |
183 | 182 | errorNb++;
|
184 |
| - } |
185 | 183 | }
|
186 | 184 |
|
187 |
| - if (!isWhitespace(document.classifiedForm.Image3.value)) { |
188 |
| - verif = /[.][jpg,gif,bmp,tiff,tif,jpeg,png,JPG,GIF,BMP,TIFF,TIF,JPEG,PNG]{3,4}$/; |
189 |
| - if (verif.exec(document.classifiedForm.Image3.value) == null) { |
190 |
| - errorMsg+=" - '${classifieds_image}3' : ${classifieds_imageFormat}\n"; |
| 185 | + if (!isWhitespace(document.classifiedForm.Image3.value) && |
| 186 | + imgExtPattern.exec(document.classifiedForm.Image3.value) == null) { |
| 187 | + errorMsg+=" - '${classifieds_image}3': ${classifieds_imageFormat}\n"; |
191 | 188 | errorNb++;
|
192 |
| - } |
193 | 189 | }
|
194 |
| - if (!isWhitespace(document.classifiedForm.Image4.value)) { |
195 |
| - verif = /[.][jpg,gif,bmp,tiff,tif,jpeg,png,JPG,GIF,BMP,TIFF,TIF,JPEG,PNG]{3,4}$/; |
196 |
| - if (verif.exec(document.classifiedForm.Image4.value) == null) { |
197 |
| - errorMsg+=" - '${classifieds_image}4' : ${classifieds_imageFormat}\n"; |
198 |
| - errorNb++; |
199 |
| - } |
| 190 | + if (!isWhitespace(document.classifiedForm.Image4.value) && |
| 191 | + imgExtPattern.exec(document.classifiedForm.Image4.value) == null) { |
| 192 | + errorMsg+=" - '${classifieds_image}4': ${classifieds_imageFormat}\n"; |
| 193 | + errorNb++; |
200 | 194 | }
|
201 | 195 | </c:if>
|
202 | 196 |
|
|
205 | 199 | callback.call(this);
|
206 | 200 | break;
|
207 | 201 | case 1 :
|
208 |
| - errorMsg = "${GML_ThisFormContains} 1 ${GML_error} : \n" + errorMsg; |
| 202 | + errorMsg = "${GML_ThisFormContains} 1 ${GML_error}: \n" + errorMsg; |
209 | 203 | jQuery.popup.error(errorMsg);
|
210 | 204 | break;
|
211 | 205 | default :
|
|
217 | 211 | function hideImageFile(idElement) {
|
218 | 212 | document.getElementById("imageFile"+idElement).style.visibility = "hidden";
|
219 | 213 | document.classifiedForm["RemoveImageFile"+idElement].value = "yes";
|
| 214 | + return true; |
220 | 215 | }
|
221 | 216 |
|
222 | 217 | </script>
|
|
240 | 235 | </c:if>
|
241 | 236 | </c:set>
|
242 | 237 | <c:set var="displayedId"><view:encodeHtml string="${classifiedId}" /></c:set>
|
243 |
| - |
| 238 | +<c:set var="mandatoryIcon">${pageContext.request.contextPath}<fmt:message key="classifieds.mandatory" bundle="${icons}"/></c:set> |
| 239 | +<c:set var="deletionIcon">${pageContext.request.contextPath}<fmt:message key="classifieds.crossDelete" bundle="${icons}"/></c:set> |
244 | 240 | <form name="classifiedForm" class="classifiedForm" action="${action}" method="post" enctype="multipart/form-data" onsubmit="sendData();return false;">
|
245 | 241 | <fieldset id="classifiedInfo" class="skinFieldset">
|
246 | 242 | <legend><fmt:message key="classifieds.mainInfos"/></legend>
|
|
259 | 255 | <label for="classifiedName" class="txtlibform"><fmt:message key="GML.title"/></label>
|
260 | 256 | <div class="champs">
|
261 | 257 | <input type="text" name="Title" id="classifiedName" size="60" maxlength="100" value="${displayedTitle}"/>
|
262 |
| - <img src="${pageContext.request.contextPath}<fmt:message key="classifieds.mandatory" bundle="${icons}"/>" width="5" height="5" /> |
| 258 | + <img alt="${mandatoryField}" src="${mandatoryIcon}" width="5" height="5" /> |
263 | 259 | <input type="hidden" name="ClassifiedId" value="${displayedId}"/>
|
264 | 260 | <input type="hidden" id="publishInput" name="Publish" value=""/>
|
265 | 261 | </div>
|
|
269 | 265 | <label for="classifiedDesc" class="txtlibform"><fmt:message key="GML.description"/></label>
|
270 | 266 | <div class="champs">
|
271 | 267 | <textarea cols="100" rows="8" name="Description" id="classifiedDesc">${displayedDescription}</textarea>
|
272 |
| - <img src="${pageContext.request.contextPath}<fmt:message key="classifieds.mandatory" bundle="${icons}"/>" width="5" height="5" /> |
| 268 | + <img alt="${mandatoryField}" src="${mandatoryIcon}" width="5" height="5" /> |
273 | 269 | </div>
|
274 | 270 | </div>
|
275 | 271 |
|
|
284 | 280 |
|
285 | 281 | <c:if test="${action eq 'UpdateClassified'}">
|
286 | 282 | <div class="field" id="creationDateArea">
|
287 |
| - <label class="txtlibform"><fmt:message key="classifieds.creationDate"/></label> |
| 283 | + <span class="label txtlibform"><fmt:message key="classifieds.creationDate"/></span> |
288 | 284 | <div class="champs">
|
289 | 285 | <view:formatDateTime value="${creationDate}"/> <fmt:message key="classifieds.by"/>
|
290 | 286 | <view:username userId="${creatorId}" />
|
|
293 | 289 | </c:if>
|
294 | 290 | <c:if test="${not empty updateDate}">
|
295 | 291 | <div class="field" id="updateDateArea">
|
296 |
| - <label class="txtlibform"><fmt:message key="classifieds.updateDate"/></label> |
| 292 | + <span class="label txtlibform"><fmt:message key="classifieds.updateDate"/></span> |
297 | 293 | <div class="champs">
|
298 | 294 | <view:formatDateTime value="${updateDate}"/>
|
299 | 295 | </div>
|
300 | 296 | </div>
|
301 | 297 | </c:if>
|
302 | 298 | <c:if test="${(not empty validateDate) && (not empty validatorName)}">
|
303 | 299 | <div class="field" id="validationDateArea">
|
304 |
| - <label class="txtlibform"><fmt:message key="classifieds.validateDate"/></label> |
| 300 | + <span class="label txtlibform"><fmt:message key="classifieds.validateDate"/></span> |
305 | 301 | <div class="champs">
|
306 | 302 | <view:formatDateTime value="${validateDate}" /> <fmt:message key="classifieds.by"/> ${validatorName}
|
307 | 303 | </div>
|
308 | 304 | </div>
|
309 | 305 | </c:if>
|
310 | 306 |
|
311 | 307 | <div class="field" id="mandatoryArea">
|
312 |
| - <label class="txtlibform"><img src="${pageContext.request.contextPath}<fmt:message key="classifieds.mandatory" bundle="${icons}" />" width="5" height="5"/> : <fmt:message key="GML.requiredField"/></label> |
| 308 | + <span class="txtlibform"> |
| 309 | + <img alt="${mandatoryField}" src="${mandatoryIcon}" width="5" height="5"/> ${mandatoryField} |
| 310 | + </span> |
313 | 311 | </div>
|
314 | 312 |
|
315 | 313 | </div>
|
|
329 | 327 | <view:image src="${image.attachmentURL}" size="250x" css="thumbnail" id="actualImage1"/>
|
330 | 328 | </div>
|
331 | 329 | <div id="thumbnailActions">
|
332 |
| - <a href="javascript:onClick=hideImageFile('1');"><img src="${pageContext.request.contextPath}<fmt:message key="classifieds.crossDelete" bundle="${icons}"/>" /></a> |
| 330 | + <a href="javascript:onClick=hideImageFile('1');"><img alt="${deletionOp}" src="${deletionIcon}" /></a> |
333 | 331 | <input type="hidden" name="IdImage1" value="${image.id}"/>
|
334 | 332 | </div>
|
335 | 333 | </div>
|
|
348 | 346 | <view:image src="${image.attachmentURL}" size="250x" css="thumbnail" id="actualImage2"/>
|
349 | 347 | </div>
|
350 | 348 | <div id="thumbnailActions">
|
351 |
| - <a href="javascript:onClick=hideImageFile('2');"><img src="${pageContext.request.contextPath}<fmt:message key="classifieds.crossDelete" bundle="${icons}"/>" /></a> |
| 349 | + <a href="javascript:onClick=hideImageFile('2');"> |
| 350 | + <img alt="${deletionOp}" src="${deletionIcon}" /> |
| 351 | + </a> |
352 | 352 | <input type="hidden" name="IdImage2" value="${image.id}"/>
|
353 | 353 | </div>
|
354 | 354 | </div>
|
|
367 | 367 | <view:image src="${image.attachmentURL}" size="250x" css="thumbnail" id="actualImage3"/>
|
368 | 368 | </div>
|
369 | 369 | <div id="thumbnailActions">
|
370 |
| - <a href="javascript:onClick=hideImageFile('3');"><img src="${pageContext.request.contextPath}<fmt:message key="classifieds.crossDelete" bundle="${icons}"/>"/></a> |
| 370 | + <a href="javascript:onClick=hideImageFile('3');"> |
| 371 | + <img alt="${deletionOp}" src="${deletionIcon}"/></a> |
371 | 372 | <input type="hidden" name="IdImage3" value="${image.id}"/>
|
372 | 373 | </div>
|
373 | 374 | </div>
|
|
386 | 387 | <view:image src="${image.attachmentURL}" size="250x" css="thumbnail" id="actualImage4"/>
|
387 | 388 | </div>
|
388 | 389 | <div id="thumbnailActions">
|
389 |
| - <a href="javascript:onClick=hideImageFile('4');"><img src="${pageContext.request.contextPath}<fmt:message key="classifieds.crossDelete" bundle="${icons}"/>"/></a> |
| 390 | + <a href="javascript:onClick=hideImageFile('4');"> |
| 391 | + <img alt="${deletionOp}" src="${deletionIcon}"/></a> |
390 | 392 | <input type="hidden" name="IdImage4" value="${image.id}"/>
|
391 | 393 | </div>
|
392 | 394 | </div>
|
|
0 commit comments