r111 - in trunk/vradi-web/src: main/java/org/chorem/vradi main/java/org/chorem/vradi/actions main/resources/i18n main/webapp/WEB-INF/jsp test/java/org/chorem/vradi
Author: sletellier Date: 2011-06-30 15:14:25 +0200 (Thu, 30 Jun 2011) New Revision: 111 Url: http://chorem.org/repositories/revision/vradi/111 Log: - Fix show invitation traduction - Debug decode method : url was alrady decode by navigator - Fix npe in escapeSciptBalises method Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebHelper.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SendInvitationAction.java trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties trunk/vradi-web/src/main/webapp/WEB-INF/jsp/showInvitation.jsp trunk/vradi-web/src/test/java/org/chorem/vradi/VradiWebHelperTest.java Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebHelper.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebHelper.java 2011-06-30 10:27:24 UTC (rev 110) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/VradiWebHelper.java 2011-06-30 13:14:25 UTC (rev 111) @@ -2,15 +2,15 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.net.URLEncoder; import java.util.Set; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.jrst.JRST; import org.nuiton.util.GZUtil; -import sun.misc.BASE64Decoder; -import sun.misc.BASE64Encoder; /** * Utilities class @@ -25,6 +25,9 @@ public static String escapeSciptBalises(String txt) { // (?s) activ dotall (http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#DO...) + if (StringUtils.isEmpty(txt)){ + return StringUtils.EMPTY; + } return txt.replaceAll("(?s)<script.*?>.*</script>", ""); } @@ -34,10 +37,11 @@ */ public static String encode(String s) throws IOException { String encType = "UTF-8"; - BASE64Encoder b64enc = new BASE64Encoder(); +// BASE64Encoder b64enc = new BASE64Encoder(); byte[] gz = GZUtil.stringToBytes(s); - String gzs = b64enc.encode(gz); + byte[] encoded = Base64.encodeBase64(gz); + String gzs = new String(encoded, encType); String result = URLEncoder.encode(gzs, encType); return result; @@ -53,10 +57,12 @@ */ public static String decode(String enc) throws UnsupportedEncodingException, IOException { String encType = "UTF-8"; - BASE64Decoder b64dec = new BASE64Decoder(); +// BASE64Decoder b64dec = new BASE64Decoder(); - String gzs2 = URLDecoder.decode(enc, encType); - byte[] gz2 = b64dec.decodeBuffer(gzs2); + // Le navigateur decode deja l'url +// String gzs2 = URLDecoder.decode(enc, encType); + byte[] bytes = enc.getBytes(encType); + byte[] gz2 = Base64.decodeBase64(bytes); String result = GZUtil.bytesToString(gz2); return result; Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SendInvitationAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SendInvitationAction.java 2011-06-30 10:27:24 UTC (rev 110) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SendInvitationAction.java 2011-06-30 13:14:25 UTC (rev 111) @@ -175,7 +175,7 @@ info.append(message); String param = VradiWebHelper.encode(info.toString()); - String url = String.format("http://%s/showInvitation.action?p=%s", + String url = String.format("%s/showInvitation.action?p=%s", VradiWebConfig.getVradiWebServerUrl(), param); if (url.length() > 2000) { log.error(String.format("Url forged for invitation is to long for some navigator '%s'", url)); Modified: trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties =================================================================== --- trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-06-30 10:27:24 UTC (rev 110) +++ trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-06-30 13:14:25 UTC (rev 111) @@ -82,3 +82,10 @@ vradi.userPreference.info=Additional text to be sent in addition to the summary when applying vradi.sendInvitation.title=Send request vradi.sendInvitation.count=Number of sended requests +vradi.showInvitation.title=View request +vradi.showInvitation.from=Request from \: +vradi.showInvitation.otherPartners=Other partners are \: +vradi.showInvitation.requestMsg=Request message \: +vradi.showInvitation.accept=Accept +vradi.showInvitation.reject=Reject +vradi.showInvitation.noReceived=Do not receved other request from this person Modified: trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties =================================================================== --- trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-06-30 10:27:24 UTC (rev 110) +++ trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-06-30 13:14:25 UTC (rev 111) @@ -72,7 +72,16 @@ vradi.seekingPartners.seeker=Ceux qui recherche des partenaires pour cette appel d'offre vradi.seekingPartners.title=Recherche de partenaires vradi.send=Envoyer +vradi.sendInvitation.count=Nombre d'invitations envoyés +vradi.sendInvitation.title=Envoie d'invitation vradi.show=Afficher +vradi.showInvitation.accept=Accepter +vradi.showInvitation.from=L'invitation provient de \: +vradi.showInvitation.noReceived=Ne plus recevoir d'invitation de cette personne +vradi.showInvitation.otherPartners=Les autres partenaires sur le projet sont \: +vradi.showInvitation.reject=Rejeter +vradi.showInvitation.requestMsg=Le message de l'invitation est \: +vradi.showInvitation.title=Visualisation de l'invitation vradi.summary=Résumé vradi.template.rss=L'utilisateur %1$s à fait la demande d'ajout du flux RSS '%3$s' avec le commentaire suivant \: %2$s vradi.template.rss.title=[Vradi web] Demande d'ajout d'un flux RSS @@ -88,5 +97,3 @@ vradi.title=Vradi Web vradi.user.noinfo= vradi.userPreference.info=Text complémentaire à envoyer en plus de l'abstract lors de la demande -vradi.sendInvitation.title=Envoie d'invitation -vradi.sendInvitation.count=Nombre d'invitations envoyés Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/showInvitation.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/showInvitation.jsp 2011-06-30 10:27:24 UTC (rev 110) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/showInvitation.jsp 2011-06-30 13:14:25 UTC (rev 111) @@ -28,15 +28,16 @@ <body> <h1><s:text name="vradi.showInvitation.title" /></h1> - <div>L'invitation provient de: <%=action.getSender()%> + <div> + <s:text name="vradi.showInvitation.from"/><%=action.getSender().getLogin()%> <p> <%=action.getSenderInfo()%> </p> </div> <div> - Les autres partenaires sur le projet sont: - + <s:text name="vradi.showInvitation.otherPartners"/> + <form id="partnersForm" action="/fragment/userInfo.action"> <s:select size="5" name="userId" list="partners" listKey="wikittyId" listValue="login"/> <sj:submit id="partnersSubmit" @@ -50,7 +51,9 @@ </div> - <div>Le message de l'invitation est: + <div> + <s:text name="vradi.showInvitation.requestMsg"/> + <p><%=action.getMessage()%></p> </div> @@ -62,12 +65,12 @@ <sj:a id="rejectButton" href="/rejectInvitation/%{localNoteId}.action" button="true" buttonIcon="ui-icon-gear"> - <s:text name="vradi.showInvitation.accept"/> + <s:text name="vradi.showInvitation.reject"/> </sj:a> <sj:a id="noReceivedButton" href="/noReceivedInvitation/%{localSenderId}.action" button="true" buttonIcon="ui-icon-gear"> - <s:text name="vradi.showInvitation.accept"/> + <s:text name="vradi.showInvitation.noReceived"/> </sj:a> </div> Modified: trunk/vradi-web/src/test/java/org/chorem/vradi/VradiWebHelperTest.java =================================================================== --- trunk/vradi-web/src/test/java/org/chorem/vradi/VradiWebHelperTest.java 2011-06-30 10:27:24 UTC (rev 110) +++ trunk/vradi-web/src/test/java/org/chorem/vradi/VradiWebHelperTest.java 2011-06-30 13:14:25 UTC (rev 111) @@ -3,6 +3,8 @@ import junit.framework.Assert; import org.junit.Test; +import java.io.IOException; + /** * @author sletellier */
participants (1)
-
sletellier@users.chorem.org