r3518 - in trunk/pollen-ui-struts2/src/main: java/org/chorem/pollen/ui/actions/poll resources/i18n
Author: ymartel Date: 2012-06-18 19:25:39 +0200 (Mon, 18 Jun 2012) New Revision: 3518 Url: http://chorem.org/repositories/revision/pollen/3518 Log: refs #596 : dont allow non image file Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties Modified: trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java =================================================================== --- trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 16:59:38 UTC (rev 3517) +++ trunk/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/poll/AbstractPollForm.java 2012-06-18 17:25:39 UTC (rev 3518) @@ -531,6 +531,8 @@ @Override public void addFileContentType(int index, String contentType) { + parameters.put("imageChoice_" + index + ".newContentType", + new String[]{contentType}); // not used here } @@ -873,6 +875,16 @@ continue; } choiceNames.add(choiceName); + String contentTypeField = choicePrefix + choiceIndex + ".newContentType"; + String contentTypes = getNonEmptyParameterValue(contentTypeField); + if (contentTypes != null && !contentTypes.startsWith("image/")) { + // Bad content Type + addInformationsError( + choiceErrorField, + _("pollen.error.poll.imageChoice.upload.badContentType")); + //TODO ymartel 2012/06/18 + continue; + } } } Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 16:59:38 UTC (rev 3517) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_en_GB.properties 2012-06-18 17:25:39 UTC (rev 3518) @@ -185,6 +185,7 @@ pollen.error.poll.endDate.before.beginDate=The poll end date must be later than the begin date. pollen.error.poll.endDate.before.now=The poll end date must be later than current date. pollen.error.poll.imageChoice.already.used=Image choice name already used. +pollen.error.poll.imageChoice.upload.badContentType=Only images are allowed. pollen.error.poll.imageChoice.upload.required=Upload an image is mandatory. pollen.error.poll.maxChoice.greater.than.0=Number of choices must be strictly greater than 0 pollen.error.poll.maxChoice.required=Number of choices mandatory Modified: trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties =================================================================== --- trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 16:59:38 UTC (rev 3517) +++ trunk/pollen-ui-struts2/src/main/resources/i18n/pollen-ui-struts2_fr_FR.properties 2012-06-18 17:25:39 UTC (rev 3518) @@ -185,6 +185,7 @@ pollen.error.poll.endDate.before.beginDate=La date de fin du sondage doit-être postérieure à la date de début. pollen.error.poll.endDate.before.now=La date de fin du sondage doit-être postérieure à la date actuelle. pollen.error.poll.imageChoice.already.used=Choix d'image déjà utilisé (les noms doivent être tous différents). +pollen.error.poll.imageChoice.upload.badContentType=Seules les images sont autorisées. pollen.error.poll.imageChoice.upload.required=Le choix d'une image est obligatoire. pollen.error.poll.maxChoice.greater.than.0=Nombre de choix maximum doit être strictement supérieur à 0 pollen.error.poll.maxChoice.required=Nombre de choix maximum obligatoire
participants (1)
-
ymartel@users.chorem.org