WEBLAB-1542, WEBLAB-1543, WEBLAB-1520 : fixed problem on label with different...

WEBLAB-1542, WEBLAB-1543, WEBLAB-1520 : fixed problem on label with different language and feedback error.

git-svn-id: svn://svn.forge.objectweb.org/svnroot/weblab/trunk/WebLabServices/Portlets/metadata-portlet@4455 a803c184-d8de-4a0e-a52b-d3eef88212b6
parent 7f4820b1
...@@ -52,11 +52,13 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping; ...@@ -52,11 +52,13 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping;
@Controller @Controller
@RequestMapping(value = "VIEW") @RequestMapping(value = "VIEW")
@SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage", @SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage",
"useGeoserverExposedMap" }) "useGeoserverExposedMap","editError" })
public class EditMetaController { public class EditMetaController {
private static final String USE_GEOSERVER_EXPOSED_MAP = "useGeoserverExposedMap"; private static final String USE_GEOSERVER_EXPOSED_MAP = "useGeoserverExposedMap";
private static final String EDIT_ERROR = "editError";
private static final String RESOURCE = "resource"; private static final String RESOURCE = "resource";
...@@ -122,6 +124,10 @@ public class EditMetaController { ...@@ -122,6 +124,10 @@ public class EditMetaController {
if (!model.containsAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP)) { if (!model.containsAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP)) {
model.addAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP, Boolean.valueOf(this.editMetaData.isUseGeoserverExposedMap())); model.addAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP, Boolean.valueOf(this.editMetaData.isUseGeoserverExposedMap()));
} }
if (!model.containsAttribute(EditMetaController.EDIT_ERROR)){
model.addAttribute(EditMetaController.EDIT_ERROR, false);
}
mav.setView("editview"); mav.setView("editview");
mav.addAllObjects(model); mav.addAllObjects(model);
return mav; return mav;
...@@ -137,6 +143,11 @@ public class EditMetaController { ...@@ -137,6 +143,11 @@ public class EditMetaController {
mav.addAllObjects(model); mav.addAllObjects(model);
return mav; return mav;
} }
@ResourceMapping("clearErrorAttribute")
public void clearModelAttribute(final ModelMap model){
model.addAttribute(EditMetaController.EDIT_ERROR,false);
}
@ActionMapping(params = "action=save") @ActionMapping(params = "action=save")
...@@ -152,12 +163,15 @@ public class EditMetaController { ...@@ -152,12 +163,15 @@ public class EditMetaController {
final Map<String, String[]> parameterMap = request.getParameterMap(); final Map<String, String[]> parameterMap = request.getParameterMap();
final EditMetaServices editMetaServices = new EditMetaServices(editMeta); final EditMetaServices editMetaServices = new EditMetaServices(editMeta);
editMetaServices.writeContent(resource, parameterMap); editMetaServices.writeContent(resource, parameterMap);
boolean worked = false;
try { try {
final boolean worked = this.resourceSaverService.saveResource(resource); worked = this.resourceSaverService.saveResource(resource);
if (!worked) { if (!worked) {
this.logger.warn("The resource " + resource.getUri() + " may not be saved."); this.logger.warn("The resource " + resource.getUri() + " may not be saved.");
} }
model.addAttribute(EditMetaController.EDIT_ERROR, !worked);
} catch (final IOException | WebLabCheckedException e) { } catch (final IOException | WebLabCheckedException e) {
model.addAttribute(EditMetaController.EDIT_ERROR, !worked);
this.logger.error("An error occured saving the resource " + resource.getUri() + ".", e); this.logger.error("An error occured saving the resource " + resource.getUri() + ".", e);
} }
model.addAttribute(EditMetaController.RESOURCE, resource); model.addAttribute(EditMetaController.RESOURCE, resource);
......
...@@ -63,7 +63,7 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping; ...@@ -63,7 +63,7 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping;
@Controller @Controller
@RequestMapping(value = "VIEW") @RequestMapping(value = "VIEW")
@SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage", @SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage",
"useGeoserverExposedMap" }) "useGeoserverExposedMap","editError" })
public class MetaViewController { public class MetaViewController {
......
...@@ -24,4 +24,5 @@ log4j.rootLogger = DEBUG, console, rollingfile ...@@ -24,4 +24,5 @@ log4j.rootLogger = DEBUG, console, rollingfile
# You can decrease the level of a specific package by adding it here # You can decrease the level of a specific package by adding it here
log4j.logger.org.springframework = INFO log4j.logger.org.springframework = INFO
log4j.logger.com.hp.hpl.jena = INFO log4j.logger.com.hp.hpl.jena = INFO
\ No newline at end of file log4j.logger.org.apache.http = INFO
\ No newline at end of file
...@@ -48,18 +48,25 @@ meta.reliability = Reliability: ...@@ -48,18 +48,25 @@ meta.reliability = Reliability:
meta.credibility = Credibility: meta.credibility = Credibility:
meta.toKeep = ToKeep: meta.toKeep = ToKeep:
meta.location = Document Location: meta.location = Document Location:
meta.speaker = Speakers meta.label.location = Document Location
meta.speaker = Speakers:
meta.edit.rate = rate meta.edit.rate = Rate
meta.edit.commented = comment meta.edit.commented = Comment
meta.edit.reliability = reliability meta.edit.reliability = Reliability
meta.edit.credibility = credibility meta.edit.credibility = Credibility
meta.edit.subject = subject meta.edit.subject = Subject
meta.edit.toKeep = toKeep meta.edit.toKeep = ToKeep
meta.label.toKeep = To Keep
meta.edit.lat = lat meta.edit.lat = lat
meta.edit.lon = long meta.edit.lon = long
meta.edit.error.credibreliable=This field cannot be empty.
meta.edit.error.credibreliable=This field cannot be empty.
meta.errorSave= An error occured, new metadatas will not be saved.
meta.addMetaButton=Add Metadata
meta.cancelButton=Cancel
meta.saveButton=Save
meta.editButton=Edit
portlet.meta.configuration = Displayed meta-data portlet.meta.configuration = Displayed meta-data
meta.save_config = Save meta.save_config = Save
......
...@@ -47,18 +47,28 @@ meta.commented = Comment: ...@@ -47,18 +47,28 @@ meta.commented = Comment:
meta.reliability = Reliability: meta.reliability = Reliability:
meta.credibility = Credibility: meta.credibility = Credibility:
meta.toKeep = ToKeep: meta.toKeep = ToKeep:
meta.lat= Lat:
meta.lon= Lon:
meta.location = Document Location: meta.location = Document Location:
meta.speaker = Speakers meta.label.location = Document Location
meta.speaker = Speakers:
meta.edit.rate = rate meta.edit.rate = Rate
meta.edit.commented = comment meta.edit.commented = Comment
meta.edit.reliability = reliability meta.edit.reliability = Reliability
meta.edit.credibility = credibility meta.edit.credibility = Credibility
meta.edit.subject = subject meta.edit.subject = Subject
meta.edit.toKeep = toKeep meta.edit.toKeep = ToKeep
meta.label.toKeep = To Keep
meta.edit.lat = lat meta.edit.lat = lat
meta.edit.lon = long meta.edit.lon = long
meta.edit.error.credibreliable=This field cannot be empty. meta.edit.error.credibreliable=This field cannot be empty.
meta.errorSave= An error occured, new metadatas will not be saved.
meta.addMetaButton=Add Metadata
meta.cancelButton=Cancel
meta.saveButton=Save
meta.editButton=Edit
portlet.meta.configuration = Displayed meta-data portlet.meta.configuration = Displayed meta-data
meta.save_config = Save meta.save_config = Save
......
...@@ -44,23 +44,31 @@ meta.refersTo = Documents externes li ...@@ -44,23 +44,31 @@ meta.refersTo = Documents externes li
meta.seeAlso = Voir galement&nbsp;: meta.seeAlso = Voir galement&nbsp;:
meta.availableTranslations = Traductions&nbsp;: meta.availableTranslations = Traductions&nbsp;:
meta.originalLanguageVersion = Version d'origine meta.originalLanguageVersion = Version d'origine
meta.rate = Note: meta.rate = Note :
meta.commented = Commentaire: meta.commented = Commentaire :
meta.reliability = Fiabilit: meta.reliability = Fiabilit :
meta.credibility = Crdibilit: meta.credibility = Crdibilit :
meta.toKeep = A garder: meta.toKeep = A garder:
meta.location = Emplacement du document: meta.location = Emplacement du document :
meta.speaker = Locuteurs meta.label.location = Emplacement du document
meta.speaker = Locuteurs :
meta.edit.rate = note meta.edit.rate = Note
meta.edit.commented = commentaire meta.edit.commented = Commentaire
meta.edit.reliability = fiabilit meta.edit.reliability = Fiabilit
meta.edit.credibility = crdibilit meta.edit.credibility = Crdibilit
meta.edit.subject = sujet meta.edit.subject = Sujet
meta.edit.toKeep = garder meta.edit.toKeep = garder
meta.label.toKeep = A garder
meta.edit.lat = lat meta.edit.lat = lat
meta.edit.lon = long meta.edit.lon = long
meta.edit.error.credibreliable=Ce champ ne peut tre vide. meta.edit.error.credibreliable=Ce champ ne peut tre vide.
meta.errorSave= Une erreur s'est produite, les nouvelles mta-donnes ne seront pas sauvegardes.
meta.addMetaButton=Ajouter des mta-donnes
meta.cancelButton=Annuler
meta.saveButton=Sauvegarder
meta.editButton=Editer
portlet.meta.configuration = Affichage des mta-donnes portlet.meta.configuration = Affichage des mta-donnes
meta.save_config = Enregister meta.save_config = Enregister
......
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
<fmt:message key="meta.edit.reliability" var="reliability" /> <fmt:message key="meta.edit.reliability" var="reliability" />
<fmt:message key="meta.edit.subject" var="subject" /> <fmt:message key="meta.edit.subject" var="subject" />
<fmt:message key="meta.edit.toKeep" var="toKeep" /> <fmt:message key="meta.edit.toKeep" var="toKeep" />
<fmt:message key="meta.label.toKeep" var="toKeepLabel" />
<fmt:message key="meta.edit.lon" var="lon" /> <fmt:message key="meta.edit.lon" var="lon" />
<fmt:message key="meta.edit.lat" var="lat" /> <fmt:message key="meta.edit.lat" var="lat" />
<fmt:message key="meta.label.location" var="docLocation" />
<fmt:message key="meta.edit.error.credibreliable" var="errorEmpty" /> <fmt:message key="meta.edit.error.credibreliable" var="errorEmpty" />
<!-- <h1>Edition of the Meta Data</h1> --> <!-- <h1>Edition of the Meta Data</h1> -->
...@@ -149,7 +151,7 @@ ...@@ -149,7 +151,7 @@
<c:otherwise> <c:otherwise>
<tr class="extraRow"> <tr class="extraRow">
<th class="${subject}"><fmt:message key="meta.subject" /></th> <th class="${subject}"><fmt:message key="meta.subject" /></th>
<td class="${subject}"><input type="text" name="${subject}" class="textInput" placeholder="subjects value separated by commas"> <img class="delete" alt="delete" <td class="${subject}"><input type="text" name="subject" class="textInput" placeholder="subjects value separated by commas"> <img class="delete" alt="delete"
src="${deleteURL}"></td> src="${deleteURL}"></td>
</tr> </tr>
</c:otherwise> </c:otherwise>
...@@ -181,7 +183,7 @@ ...@@ -181,7 +183,7 @@
<c:forEach begin="0" end="${starSelected-1}" varStatus="count"> <c:forEach begin="0" end="${starSelected-1}" varStatus="count">
<span id="star${starSelected-count.index}" class="colorStar">&#9733</span> <span id="star${starSelected-count.index}" class="colorStar">&#9733</span>
</c:forEach> </c:forEach>
</div> <input type="hidden" name="${rate}" value="${starSelected}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </div> <input type="hidden" name="rate" value="${starSelected}"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
<tr class="extraRow"> <tr class="extraRow">
...@@ -189,7 +191,7 @@ ...@@ -189,7 +191,7 @@
<td class="${rate}"> <td class="${rate}">
<div id="rating" class="rating"> <div id="rating" class="rating">
<span id="star5">&#9734</span> <span id="star4">&#9734</span> <span id="star3">&#9734</span> <span id="star2">&#9734</span> <span id="star1">&#9734</span> <span id="star5">&#9734</span> <span id="star4">&#9734</span> <span id="star3">&#9734</span> <span id="star2">&#9734</span> <span id="star1">&#9734</span>
</div> <input type="hidden" name="${rate}"> <img class="delete" alt="delete" src="${deleteURL}"> </div> <input type="hidden" name="rate"> <img class="delete" alt="delete" src="${deleteURL}">
</td> </td>
</tr> </tr>
</c:otherwise> </c:otherwise>
...@@ -198,7 +200,7 @@ ...@@ -198,7 +200,7 @@
<c:when test="${metaDisplay['comment'] && weblab:hasValue(resource, rdfProperties['comment'])}"> <c:when test="${metaDisplay['comment'] && weblab:hasValue(resource, rdfProperties['comment'])}">
<tr> <tr>
<th class="${commented}"><fmt:message key="meta.commented" /></th> <th class="${commented}"><fmt:message key="meta.commented" /></th>
<td class="${commented}"><input type="text" name="${commented}" value="<weblab:getPropertyValues <td class="${commented}"><input type="text" name="comment" value="<weblab:getPropertyValues
uri="${rdfProperties['comment']}" />" class="textInput"> uri="${rdfProperties['comment']}" />" class="textInput">
<img class="delete" alt="delete" src="${deleteURL}"></td> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
...@@ -206,7 +208,7 @@ ...@@ -206,7 +208,7 @@
<c:otherwise> <c:otherwise>
<tr class="extraRow"> <tr class="extraRow">
<th class="${commented}"><fmt:message key="meta.commented" /></th> <th class="${commented}"><fmt:message key="meta.commented" /></th>
<td class="${commented}"><input type="text" name="${commented}" class="textInput" placeholder="Insert your comment"> <img class="delete" alt="delete" <td class="${commented}"><input type="text" name="comment" class="textInput" placeholder="Insert your comment"> <img class="delete" alt="delete"
src="${deleteURL}"></td> src="${deleteURL}"></td>
</tr> </tr>
</c:otherwise> </c:otherwise>
...@@ -231,7 +233,7 @@ ...@@ -231,7 +233,7 @@
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</c:forEach> </c:forEach>
</select> <input type="hidden" name="${credibility}" value="${credibSelected}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </select> <input type="hidden" name="credibility" value="${credibSelected}"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
...@@ -243,7 +245,7 @@ ...@@ -243,7 +245,7 @@
<c:forEach var="i" begin="0" end="${fn:length(alphabet)-1}" step="1"> <c:forEach var="i" begin="0" end="${fn:length(alphabet)-1}" step="1">
<option value="${alphabet.charAt(i)}">${alphabet.charAt(i)}</option> <option value="${alphabet.charAt(i)}">${alphabet.charAt(i)}</option>
</c:forEach> </c:forEach>
</select> <input type="hidden" name="${credibility}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </select> <input type="hidden" name="credibility"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
...@@ -266,7 +268,7 @@ ...@@ -266,7 +268,7 @@
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</c:forEach> </c:forEach>
</select> <input type="hidden" name="${reliability}" value="${reliabSelected}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </select> <input type="hidden" name="reliability" value="${reliabSelected}"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
...@@ -278,7 +280,7 @@ ...@@ -278,7 +280,7 @@
<c:forEach var="i" begin="0" end="${fn:length(numbers)-1}" step="1"> <c:forEach var="i" begin="0" end="${fn:length(numbers)-1}" step="1">
<option value="${numbers.charAt(i)}">${numbers.charAt(i)}</option> <option value="${numbers.charAt(i)}">${numbers.charAt(i)}</option>
</c:forEach> </c:forEach>
</select> <input type="hidden" name="${reliability}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </select> <input type="hidden" name="reliability"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
...@@ -323,7 +325,7 @@ ...@@ -323,7 +325,7 @@
<option value="false" selected>false</option> <option value="false" selected>false</option>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
</select> <input type="hidden" name="${toKeep}" value="${optionSelect}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </select> <input type="hidden" name="toKeep" value="${optionSelect}"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
</c:when> </c:when>
<c:otherwise> <c:otherwise>
...@@ -333,7 +335,7 @@ ...@@ -333,7 +335,7 @@
<option value="None" selected>None</option> <option value="None" selected>None</option>
<option value="true">True</option> <option value="true">True</option>
<option value="false">False</option> <option value="false">False</option>
</select> <input type="hidden" name="${toKeep}"> <img class="delete" alt="delete" src="${deleteURL}"></td> </select> <input type="hidden" name="toKeep"> <img class="delete" alt="delete" src="${deleteURL}"></td>
</tr> </tr>
</c:otherwise> </c:otherwise>
</c:choose> </c:choose>
...@@ -377,20 +379,20 @@ ...@@ -377,20 +379,20 @@
<div class="addMetaDiv"> <div class="addMetaDiv">
<select id="addMeta"> <select id="addMeta">
<option value="None" selected="selected">None</option> <option value="None" selected="selected"></option>
<option value="${rate}">Data Rating</option> <option value="${rate}">${rate}</option>
<option value="${commented}">Comment</option> <option value="${commented}">${commented}</option>
<option value="${credibility}">Credibility</option> <option value="${credibility}">${credibility}</option>
<option value="${reliability}">Reliability</option> <option value="${reliability}">${reliability}</option>
<option value="${subject}">Subject</option> <option value="${subject}">${subject}</option>
<option value="${toKeep}">ToKeep</option> <option value="${toKeep}">${toKeepLabel}</option>
<option value="${lat}">Document Location</option> <option value="${lat}">${docLocation}</option>
</select> </select>
<input id="addMetaButton" class="addButton" type="button" value="Add MetaData"> <input id="addMetaButton" class="addButton" type="button" value="<fmt:message key="meta.addMetaButton" />">
</div> </div>
<div class="actionButton"> <div class="actionButton">
<input id="saveButton" type="submit" value="Save"> <input id="cancelButton" type="reset" value="Cancel"> <input id="saveButton" type="submit" value="<fmt:message key="meta.saveButton" />"> <input id="cancelButton" type="reset" value="<fmt:message key="meta.cancelButton" />">
</div> </div>
</form> </form>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<fmt:setBundle basename="meta_portlet" /> <fmt:setBundle basename="meta_portlet" />
<portlet:resourceURL var="resourceURL" escapeXml="false" id="showMetadata" /> <portlet:resourceURL var="resourceURL" escapeXml="false" id="showMetadata" />
<portlet:resourceURL var="clearErrorURL" escapeXml="false" id="clearErrorAttribute" />
<c:choose> <c:choose>
<c:when test="${isEmptyModel}"> <c:when test="${isEmptyModel}">
...@@ -20,7 +20,13 @@ ...@@ -20,7 +20,13 @@
<!-- icons definition --> <!-- icons definition -->
<c:url value="/images/" var="baseURL"></c:url> <c:url value="/images/" var="baseURL"></c:url>
<c:choose>
<c:when test="${editError == true}">
<div id="saveError" class="portlet-msg-error"><fmt:message key="meta.errorSave" /></div>
</c:when>
</c:choose>
<!-- AJAX resource collection --> <!-- AJAX resource collection -->
<div id="meta_portlet_meta_view"> <div id="meta_portlet_meta_view">
...@@ -31,6 +37,12 @@ ...@@ -31,6 +37,12 @@
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#meta_portlet_meta_view").load("${resourceURL}"); jQuery("#meta_portlet_meta_view").load("${resourceURL}");
var saveError = jQuery('#saveError');
if (saveError.length){
saveError.delay(2000).hide("slow",function() {
jQuery.get('${clearErrorURL}');
});
}
}); });
</script> </script>
</c:otherwise> </c:otherwise>
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
} }
return false; return false;
}); });
jQuery(document).ready(function() { jQuery(document).ready(function() {
openLayerMap(${useGeoserverExposedMap}, '${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}'); openLayerMap(${useGeoserverExposedMap}, '${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}');
jQuery("#buttonAdd").click(function($) { jQuery("#buttonAdd").click(function($) {
...@@ -500,7 +499,7 @@ ...@@ -500,7 +499,7 @@
</div> </div>
<div id="editView"> <div id="editView">
<input id="buttonAdd" class="right-button addButton" type="button" value="Edit"> <input id="buttonAdd" class="right-button addButton" type="button" value="<fmt:message key="meta.editButton"/>">
</div> </div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment