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;
@Controller
@RequestMapping(value = "VIEW")
@SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage",
"useGeoserverExposedMap" })
"useGeoserverExposedMap","editError" })
public class EditMetaController {
private static final String USE_GEOSERVER_EXPOSED_MAP = "useGeoserverExposedMap";
private static final String EDIT_ERROR = "editError";
private static final String RESOURCE = "resource";
......@@ -122,6 +124,10 @@ public class EditMetaController {
if (!model.containsAttribute(EditMetaController.USE_GEOSERVER_EXPOSED_MAP)) {
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.addAllObjects(model);
return mav;
......@@ -137,6 +143,11 @@ public class EditMetaController {
mav.addAllObjects(model);
return mav;
}
@ResourceMapping("clearErrorAttribute")
public void clearModelAttribute(final ModelMap model){
model.addAttribute(EditMetaController.EDIT_ERROR,false);
}
@ActionMapping(params = "action=save")
......@@ -152,12 +163,15 @@ public class EditMetaController {
final Map<String, String[]> parameterMap = request.getParameterMap();
final EditMetaServices editMetaServices = new EditMetaServices(editMeta);
editMetaServices.writeContent(resource, parameterMap);
boolean worked = false;
try {
final boolean worked = this.resourceSaverService.saveResource(resource);
worked = this.resourceSaverService.saveResource(resource);
if (!worked) {
this.logger.warn("The resource " + resource.getUri() + " may not be saved.");
}
model.addAttribute(EditMetaController.EDIT_ERROR, !worked);
} catch (final IOException | WebLabCheckedException e) {
model.addAttribute(EditMetaController.EDIT_ERROR, !worked);
this.logger.error("An error occured saving the resource " + resource.getUri() + ".", e);
}
model.addAttribute(EditMetaController.RESOURCE, resource);
......
......@@ -63,7 +63,7 @@ import org.springframework.web.portlet.bind.annotation.ResourceMapping;
@Controller
@RequestMapping(value = "VIEW")
@SessionAttributes({ "resource", "isEmptyModel", "isLoadedResource", "rdfProperties", "translations", "metaDisplay", "editMetaData", "timeConfig", "dataTaglib", "dataLanguage",
"useGeoserverExposedMap" })
"useGeoserverExposedMap","editError" })
public class MetaViewController {
......
......@@ -24,4 +24,5 @@ log4j.rootLogger = DEBUG, console, rollingfile
# You can decrease the level of a specific package by adding it here
log4j.logger.org.springframework = INFO
log4j.logger.com.hp.hpl.jena = INFO
\ No newline at end of file
log4j.logger.com.hp.hpl.jena = INFO
log4j.logger.org.apache.http = INFO
\ No newline at end of file
......@@ -48,18 +48,25 @@ meta.reliability = Reliability:
meta.credibility = Credibility:
meta.toKeep = ToKeep:
meta.location = Document Location:
meta.speaker = Speakers
meta.label.location = Document Location
meta.speaker = Speakers:
meta.edit.rate = rate
meta.edit.commented = comment
meta.edit.reliability = reliability
meta.edit.credibility = credibility
meta.edit.subject = subject
meta.edit.toKeep = toKeep
meta.edit.rate = Rate
meta.edit.commented = Comment
meta.edit.reliability = Reliability
meta.edit.credibility = Credibility
meta.edit.subject = Subject
meta.edit.toKeep = ToKeep
meta.label.toKeep = To Keep
meta.edit.lat = lat
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
meta.save_config = Save
......
......@@ -47,18 +47,28 @@ meta.commented = Comment:
meta.reliability = Reliability:
meta.credibility = Credibility:
meta.toKeep = ToKeep:
meta.lat= Lat:
meta.lon= Lon:
meta.location = Document Location:
meta.speaker = Speakers
meta.label.location = Document Location
meta.speaker = Speakers:
meta.edit.rate = rate
meta.edit.commented = comment
meta.edit.reliability = reliability
meta.edit.credibility = credibility
meta.edit.subject = subject
meta.edit.toKeep = toKeep
meta.edit.rate = Rate
meta.edit.commented = Comment
meta.edit.reliability = Reliability
meta.edit.credibility = Credibility
meta.edit.subject = Subject
meta.edit.toKeep = ToKeep
meta.label.toKeep = To Keep
meta.edit.lat = lat
meta.edit.lon = long
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
meta.save_config = Save
......
......@@ -44,23 +44,31 @@ meta.refersTo = Documents externes li
meta.seeAlso = Voir galement&nbsp;:
meta.availableTranslations = Traductions&nbsp;:
meta.originalLanguageVersion = Version d'origine
meta.rate = Note:
meta.commented = Commentaire:
meta.reliability = Fiabilit:
meta.credibility = Crdibilit:
meta.rate = Note :
meta.commented = Commentaire :
meta.reliability = Fiabilit :
meta.credibility = Crdibilit :
meta.toKeep = A garder:
meta.location = Emplacement du document:
meta.speaker = Locuteurs
meta.location = Emplacement du document :
meta.label.location = Emplacement du document
meta.speaker = Locuteurs :
meta.edit.rate = note
meta.edit.commented = commentaire
meta.edit.reliability = fiabilit
meta.edit.credibility = crdibilit
meta.edit.subject = sujet
meta.edit.toKeep = garder
meta.edit.rate = Note
meta.edit.commented = Commentaire
meta.edit.reliability = Fiabilit
meta.edit.credibility = Crdibilit
meta.edit.subject = Sujet
meta.edit.toKeep = garder
meta.label.toKeep = A garder
meta.edit.lat = lat
meta.edit.lon = long
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
meta.save_config = Enregister
......
......@@ -23,8 +23,10 @@
<fmt:message key="meta.edit.reliability" var="reliability" />
<fmt:message key="meta.edit.subject" var="subject" />
<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.lat" var="lat" />
<fmt:message key="meta.label.location" var="docLocation" />
<fmt:message key="meta.edit.error.credibreliable" var="errorEmpty" />
<!-- <h1>Edition of the Meta Data</h1> -->
......@@ -149,7 +151,7 @@
<c:otherwise>
<tr class="extraRow">
<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>
</tr>
</c:otherwise>
......@@ -181,7 +183,7 @@
<c:forEach begin="0" end="${starSelected-1}" varStatus="count">
<span id="star${starSelected-count.index}" class="colorStar">&#9733</span>
</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:otherwise>
<tr class="extraRow">
......@@ -189,7 +191,7 @@
<td class="${rate}">
<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>
</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>
</tr>
</c:otherwise>
......@@ -198,7 +200,7 @@
<c:when test="${metaDisplay['comment'] && weblab:hasValue(resource, rdfProperties['comment'])}">
<tr>
<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">
<img class="delete" alt="delete" src="${deleteURL}"></td>
</tr>
......@@ -206,7 +208,7 @@
<c:otherwise>
<tr class="extraRow">
<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>
</tr>
</c:otherwise>
......@@ -231,7 +233,7 @@
</c:otherwise>
</c:choose>
</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>
</c:when>
<c:otherwise>
......@@ -243,7 +245,7 @@
<c:forEach var="i" begin="0" end="${fn:length(alphabet)-1}" step="1">
<option value="${alphabet.charAt(i)}">${alphabet.charAt(i)}</option>
</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>
</c:otherwise>
</c:choose>
......@@ -266,7 +268,7 @@
</c:otherwise>
</c:choose>
</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>
</c:when>
<c:otherwise>
......@@ -278,7 +280,7 @@
<c:forEach var="i" begin="0" end="${fn:length(numbers)-1}" step="1">
<option value="${numbers.charAt(i)}">${numbers.charAt(i)}</option>
</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>
</c:otherwise>
</c:choose>
......@@ -323,7 +325,7 @@
<option value="false" selected>false</option>
</c:otherwise>
</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>
</c:when>
<c:otherwise>
......@@ -333,7 +335,7 @@
<option value="None" selected>None</option>
<option value="true">True</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>
</c:otherwise>
</c:choose>
......@@ -377,20 +379,20 @@
<div class="addMetaDiv">
<select id="addMeta">
<option value="None" selected="selected">None</option>
<option value="${rate}">Data Rating</option>
<option value="${commented}">Comment</option>
<option value="${credibility}">Credibility</option>
<option value="${reliability}">Reliability</option>
<option value="${subject}">Subject</option>
<option value="${toKeep}">ToKeep</option>
<option value="${lat}">Document Location</option>
<option value="None" selected="selected"></option>
<option value="${rate}">${rate}</option>
<option value="${commented}">${commented}</option>
<option value="${credibility}">${credibility}</option>
<option value="${reliability}">${reliability}</option>
<option value="${subject}">${subject}</option>
<option value="${toKeep}">${toKeepLabel}</option>
<option value="${lat}">${docLocation}</option>
</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 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>
</form>
......
......@@ -10,7 +10,7 @@
<fmt:setBundle basename="meta_portlet" />
<portlet:resourceURL var="resourceURL" escapeXml="false" id="showMetadata" />
<portlet:resourceURL var="clearErrorURL" escapeXml="false" id="clearErrorAttribute" />
<c:choose>
<c:when test="${isEmptyModel}">
......@@ -20,7 +20,13 @@
<!-- icons definition -->
<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 -->
<div id="meta_portlet_meta_view">
......@@ -31,6 +37,12 @@
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#meta_portlet_meta_view").load("${resourceURL}");
var saveError = jQuery('#saveError');
if (saveError.length){
saveError.delay(2000).hide("slow",function() {
jQuery.get('${clearErrorURL}');
});
}
});
</script>
</c:otherwise>
......
......@@ -22,7 +22,6 @@
}
return false;
});
jQuery(document).ready(function() {
openLayerMap(${useGeoserverExposedMap}, '${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}');
jQuery("#buttonAdd").click(function($) {
......@@ -500,7 +499,7 @@
</div>
<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>
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