Author: sletellier Date: 2011-07-06 16:23:24 +0200 (Wed, 06 Jul 2011) New Revision: 115 Url: http://chorem.org/repositories/revision/vradi/115 Log: - Add wikitty-struts dependency - Remove getAction calls - Fix userInfo display - Fix UserPreference page Modified: trunk/pom.xml trunk/vradi-web/pom.xml trunk/vradi-web/src/main/java/org/chorem/vradi/actions/EditAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SearchAction.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/decorators/main.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/resultGrid.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/searchPanel.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/seekPartners.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/thesaurusFilter.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/pom.xml 2011-07-06 14:23:24 UTC (rev 115) @@ -114,7 +114,7 @@ <nuitonI18nVersion>2.4</nuitonI18nVersion> <nuitonWidgetVersion>1.1.1</nuitonWidgetVersion> <generatorPluginVersion>2.3.5</generatorPluginVersion> - <wikittyVersion>3.1.3-SNAPSHOT</wikittyVersion> + <wikittyVersion>3.2-SNAPSHOT</wikittyVersion> <jrstVersion>1.4-SNAPSHOT</jrstVersion> <oooVersion>3.2.1</oooVersion> <javamailVersion>1.4.3</javamailVersion> @@ -282,6 +282,12 @@ </dependency> <dependency> + <groupId>org.nuiton.wikitty</groupId> + <artifactId>wikitty-struts</artifactId> + <version>${wikittyVersion}</version> + </dependency> + + <dependency> <groupId>org.apache.tika</groupId> <artifactId>tika-core</artifactId> <version>0.9</version> @@ -403,7 +409,7 @@ <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-core</artifactId> - <version>3.1.0</version> + <version>3.3.0</version> </dependency> <!-- Vradi Web --> Modified: trunk/vradi-web/pom.xml =================================================================== --- trunk/vradi-web/pom.xml 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/pom.xml 2011-07-06 14:23:24 UTC (rev 115) @@ -75,6 +75,11 @@ </dependency> <dependency> + <groupId>org.nuiton.wikitty</groupId> + <artifactId>wikitty-struts</artifactId> + </dependency> + + <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> </dependency> Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/EditAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/EditAction.java 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/EditAction.java 2011-07-06 14:23:24 UTC (rev 115) @@ -2,13 +2,11 @@ import com.opensymphony.xwork2.ActionContext; import javax.servlet.http.HttpServletRequest; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.struts2.interceptor.ServletRequestAware; import org.nuiton.wikitty.WikittyProxy; import org.nuiton.wikitty.entities.Wikitty; -import org.nuiton.wikitty.entities.WikittyExtension; /** * @@ -56,6 +54,7 @@ @Override public String execute() throws Exception { + String result = SUCCESS; WikittyProxy proxy = getProxy(); Wikitty w = proxy.restore(getId()); @@ -81,5 +80,4 @@ } return result; } - } Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java 2011-07-06 14:23:24 UTC (rev 115) @@ -3,13 +3,22 @@ import static org.nuiton.i18n.I18n._; import com.opensymphony.xwork2.ActionContext; + +import java.util.Collection; import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.vradi.VradiWebHelper; +import org.chorem.vradi.entities.FormNote; import org.chorem.vradi.entities.VradiUser; import org.nuiton.jrst.JRST; import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.Search; /** * Permet de charger un user ({@link VradiUser}) grace a son identifiant @@ -72,5 +81,25 @@ return result; } - + public Set<VradiUser> getPartners() { + + // Get my response + String userId = getUser().getWikittyId(); + Criteria formNoteCriteria = Search.query().eq(FormNote.FQ_FIELD_FORMNOTE_PARTNERS, userId).criteria(); + List<FormNote> formNotes = getProxy().findAllByCriteria(FormNote.class, formNoteCriteria).getAll(); + + // Extract partners ids + Set<String> partnersIds = new HashSet<String>(); + for (FormNote formNote : formNotes) { + partnersIds.addAll(formNote.getPartners()); + } + + // Remove own user + partnersIds.remove(userId); + + // Restor partners + Set<VradiUser> partners = getProxy().restore(VradiUser.class, partnersIds); + + return partners; + } } Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SearchAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SearchAction.java 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/SearchAction.java 2011-07-06 14:23:24 UTC (rev 115) @@ -20,10 +20,6 @@ private static final int DEFAULT_NB_FORMS = 10; - static public SearchAction getAction() { - return (SearchAction) ActionContext.getContext().get(CONTEXT_ACTION_KEY); - } - protected int nbForms = DEFAULT_NB_FORMS; protected String query; protected String queryName; 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-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/resources/i18n/vradi-web_en_GB.properties 2011-07-06 14:23:24 UTC (rev 115) @@ -43,7 +43,7 @@ vradi.search.saveQuery=Save request vradi.formView.title=Form view vradi.search.thesaurusFilterButton=Filter -vradi.form.editAction=Edit +vradi.form.editAction=Responses vradi.form.action=Action vradi.action.submit=Submit to administrators vradi.options.comment=Comment @@ -90,4 +90,11 @@ vradi.showInvitation.reject=Reject vradi.showInvitation.noReceived=Do not receved other request from this person vradi.noEmail=No email -vradi.userPreference=User preference +vradi.userPreference=User preferences +vradi.userPreference.form=Form +vradi.userPreference.partners=partners +vradi.userPreference.noreceived=No received +vradi.userPreference.nosend=No send +vradi.userPreference.title=User preferences +vradi.userPreference.note.open=Opened notes +vradi.userPreference.note.close=Closed notes \ No newline at end of file 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-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/resources/i18n/vradi-web_fr_FR.properties 2011-07-06 14:23:24 UTC (rev 115) @@ -25,7 +25,7 @@ vradi.forgotpwd.title=Vous avez oublié votre mot de passe ? vradi.form.action=Action vradi.form.creationDate=Date de création -vradi.form.editAction=Editer +vradi.form.editAction=Reponses vradi.form.object=Objet vradi.formNote.close=Fermer la réponse vradi.formNote.seekPartners=Recherche de partenaires @@ -99,5 +99,12 @@ vradi.thesaurus.thesaurusRenamed=Nouveau nom du descripteur séléctionné vradi.title=Vradi Web vradi.user.noinfo=Pas d'info -vradi.userPreference=Préférence de l'utilisateur +vradi.userPreference=Préférences de l'utilisateur +vradi.userPreference.form=Formulaire vradi.userPreference.info=Text complémentaire à envoyer en plus de l'abstract lors de la demande +vradi.userPreference.noreceived=Ne pas recevoir +vradi.userPreference.nosend=Ne pas envoyer +vradi.userPreference.note.close=Notes fermées +vradi.userPreference.note.open=Notes ouvertes +vradi.userPreference.partners=Partenaires +vradi.userPreference.title=Préférences de l'utilisateur Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/decorators/main.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -19,7 +19,7 @@ <sj:head jquerytheme="sunny"/> --%> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <s:url var="globalCSS" value="/css/global.css" /> + <s:url var="globalCSS" value="/css/style.css" /> <link href="${globalCSS}" rel="stylesheet" type="text/css" media="all" /> </head> <body id="page-home"> Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -64,7 +64,7 @@ <s:text name="vradi.show"/> </s:set> <sj:submit id="partnersSubmit" - label="%{showText}" + value="%{showText}" targets="partnersInfo" indicator="indicator-partnersInfo" button="true" buttonIcon="ui-icon-gear"/> </form> Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/resultGrid.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/resultGrid.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/resultGrid.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -1,6 +1,4 @@ <%@ page import="org.chorem.vradi.entities.Infogene" %> -<%@ page import="org.chorem.vradi.actions.SearchAction" %> -<%@ page import="com.opensymphony.xwork2.ActionContext" %> <%@ page import="static org.nuiton.i18n.I18n._" %> <%@taglib prefix="s" uri="/struts-tags"%> @@ -15,12 +13,6 @@ } </script> -<% -SearchAction action = SearchAction.getAction(); -String query = action.getQuery(); -ActionContext.getContext().put("query", query); -%> - <s:set id="creationDateText"> <s:text name="vradi.form.creationDate"/> </s:set> Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/searchPanel.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/searchPanel.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/searchPanel.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -1,19 +1,7 @@ -<%@ page import="org.chorem.vradi.actions.SearchAction" %> -<%@ page import="com.opensymphony.xwork2.ActionContext" %> <%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> <%@taglib prefix="sj" uri="/struts-jquery-tags" %> -<% -SearchAction action = SearchAction.getAction(); -String query = action.getQuery(); -String queryName = action.getQueryName(); -boolean queryActive = action.isQueryActive(); -ActionContext.getContext().put("query", query); -ActionContext.getContext().put("queryName", queryName); -ActionContext.getContext().put("queryActive", queryActive); -%> - <s:form id="searchForm" action="search"> <div id="empty"> </div> Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/seekPartners.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/seekPartners.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/seekPartners.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -42,7 +42,7 @@ </s:set> <sj:submit id="partnersShowSubmit" - href="/fragment/partnerInfo.action" + href="/fragment/userInfo.action" targets="partnersShowResult" value="%{showText}" indicator="indicator-partnersShowResult" Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/thesaurusFilter.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/thesaurusFilter.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/thesaurusFilter.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -1,16 +1,8 @@ -<%@page import="com.opensymphony.xwork2.ActionContext"%> -<%@ page import="org.chorem.vradi.actions.ThesaurusAction" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> <%@ taglib prefix="sjt" uri="/struts-jquery-tree-tags" %> -<% -ThesaurusAction action = ThesaurusAction.getAction(); -String thesaurusNameRequest = action.getThesaurusNameRequest(); -ActionContext.getContext().put("thesaurusNameRequest", thesaurusNameRequest); -%> - <s:url id="thesaurusDataUrl" action="thesaurus"> <s:param name="thesaurusNameRequest"> <s:property value="thesaurusNameRequest"/> Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -14,7 +14,7 @@ <% RestoreUserAction action = RestoreUserAction.getAction(); VradiUser user = action.getUser(); -String email = _("vrado.noEmail"); +String email = _("vradi.noEmail"); String info = action.getInfoHtml(); if (user != null) { email = user.getLogin(); Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp 2011-07-04 14:39:32 UTC (rev 114) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp 2011-07-06 14:23:24 UTC (rev 115) @@ -7,15 +7,20 @@ <%@page import="org.chorem.vradi.actions.RestoreUserAction"%> <%@page import="com.opensymphony.xwork2.ActionContext"%> <%@page import="org.chorem.vradi.entities.VradiUser"%> +<%@ page import="org.nuiton.wikitty.WikittyUtil" %> +<%@ page import="org.nuiton.wikitty.search.Search" %> +<%@ page import="org.nuiton.wikitty.search.operators.Element" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> <%@taglib prefix="sj" uri="/struts-jquery-tags"%> +<%@ taglib prefix="ws" uri="/wikitty-struts" %> <% RestoreUserAction action = RestoreUserAction.getAction(); VradiUser user = action.getUser(); +//ActionContext.getContext().put("user", WikittyUtil.getWikitty(action.getProxy().getWikittyService(), null, action.getUser())); ActionContext.getContext().put("localUserId", user.getWikittyId()); ActionContext.getContext().put("localUserEmail", user.getLogin()); ActionContext.getContext().put("localUserInfo", user.getInfo()); @@ -31,7 +36,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><s:text name="vradi.userPreference.title" /></title> <s:head/> - <sj:head jquerytheme="sunny"/> + <%--<sj:head jquerytheme="sunny"/>--%> </head> <body> <h1><s:text name="vradi.userPreference.title" /></h1> @@ -44,29 +49,53 @@ <div> <s:form id="infoForm" action="/ajax/edit/%{localUserId}.action" method="POST"> <sj:textarea name="%{localVradiUserFieldInfo}" - value="%{localUserInfo}" key="vradi.userPreference.info"/> + value="%{localUserInfo}" + key="vradi.userPreference.info"/> + + <s:set id="saveText"> + <s:text name="vradi.save"/> + </s:set> <sj:submit id="infoFormSubmit" - targets="actionResult" indicator="indicator-infoFormSubmit" - value="Save" - button="true" buttonIcon="ui-icon-gear"/> + targets="actionResult" + indicator="indicator-infoFormSubmit" + value="%{saveText}" + button="true" + buttonIcon="ui-icon-gear"/> </s:form> - <img id="indicator-infoFormSubmit" src="/img/indicator.gif" alt="saving..." style="display:none"/> + <img id="indicator-infoFormSubmit" src="/img/indicator.gif" alt="saving..." style="display:none;"/> </div> + <s:set id="showText"> + <s:text name="vradi.show"/> + </s:set> + <s:set id="deleteText"> + <s:text name="vradi.delete"/> + </s:set> + <!-- | Personnes a qui on n'envoie plus les demandes +--> <div> <h2><s:text name="vradi.userPreference.nosend" /></h2> + <%--<ws:form wikitty="<%=WikittyUtil.getWikitty(action.getProxy().getWikittyService(), null, action.getUser())%>"--%> + <%--proxy="<%=action.getProxy()%>" action="/ajax/edit/%{localUserId}.action">--%> + <%--</ws:form>--%> <s:form id="noSendForm" action="/ajax/edit/%{localUserId}.action" method="POST"> - <s:select size="5" name="userId" list="%{localUserNoSend}" listKey="wikittyId" listValue="login"/> + + <ws:selectAssociation proxy="<%=action.getProxy()%>" + name="userId" + size="5" + businessEntity="<%=action.getUser()%>" + fqFieldName="<%=VradiUser.FQ_FIELD_VRADIUSER_NOSEND%>" + descField="<%=VradiUser.FQ_FIELD_WIKITTYUSER_LOGIN%>"/> + <sj:submit id="noSendFormShowSubmit" - href="/fragment/partnerInfo.action" + href="/fragment/userInfo.action" targets="noSendResult" - value="Show" + value="%{showText}" indicator="indicator-noSendFormSubmit" button="true" /> @@ -74,7 +103,7 @@ id="noSendFormDeleteSubmit" href="%{simpleecho}" targets="noSendResult" - value="Delete" + value="%{deleteText}" indicator="indicator-noSendFormSubmit" button="true" /> @@ -82,7 +111,7 @@ </s:form> <div id="noSendResult"> - <img id="indicator-noSendSubmit" src="/img/indicator.gif" alt="wait..." style="display:none"/> + <img id="indicator-noSendFormSubmit" src="/img/indicator.gif" alt="wait..." style="display:none"/> </div> </div> @@ -92,21 +121,28 @@ <div> <h2><s:text name="vradi.userPreference.noreceived" /></h2> <s:form id="noReceivedForm" action="/ajax/edit/%{localUserId}.action" method="POST"> - <s:select size="5" name="userId" list="%{localUserNoReceived}" listKey="wikittyId" listValue="login"/> + + <ws:selectAssociation proxy="<%=action.getProxy()%>" + name="userId" + size="5" + businessEntity="<%=action.getUser()%>" + fqFieldName="<%=VradiUser.FQ_FIELD_VRADIUSER_NORECEIVED%>" + descField="<%=VradiUser.FQ_FIELD_WIKITTYUSER_LOGIN%>"/> + <sj:submit id="noReceivedFormShowSubmit" - href="/fragment/partnerInfo.action" + href="/fragment/userInfo.action" targets="noReceivedResult" - value="Show" - indicator="indicator-noReceivedFormSubmit" + value="%{showText}" + indicator="indicator-noReceivedSubmit" button="true" /> <sj:submit id="noReceivedFormDeleteSubmit" href="%{simpleecho}" targets="noReceivedResult" - value="Delete" - indicator="indicator-noReceivedFormSubmit" + value="%{deleteText}" + indicator="indicator-noReceivedSubmit" button="true" /> @@ -123,19 +159,29 @@ <div> <h2><s:text name="vradi.userPreference.partners" /></h2> <s:form id="partnersForm" action="/fragment/partners/%{localUserId}.action" method="POST"> - <s:select size="5" name="userId" list="%{localPartners}" listKey="wikittyId" listValue="login"/> + + <ws:select name="userId" + size="5" + entityValues="<%=action.getPartners()%>" + descField="<%=VradiUser.FQ_FIELD_WIKITTYUSER_LOGIN%>"/> + + <%--<s:select size="5" name="userId" list="%{localPartners}" listKey="wikittyId" listValue="login"/>--%> <sj:submit id="partnersFormShowSubmit" - href="/fragment/partnerInfo.action" + href="/fragment/userInfo.action" targets="partnersFormResult" - value="Show" + value="%{showText}" indicator="indicator-partnersForm" button="true" /> + + <s:set id="formText"> + <s:text name="vradi.userPreference.form"/> + </s:set> <sj:submit id="partnersFormShowFormSubmit" targets="partnersFormResult" - value="Form" + value="%{formText}" indicator="indicator-partnersForm" button="true" />