Author: bpoussin Date: 2011-05-30 12:28:44 +0200 (Mon, 30 May 2011) New Revision: 67 Url: http://chorem.org/repositories/revision/vradi/67 Log: - add delete generic action - add support to attachment in FormNote - begin userPreference page - use sj:submit tag in replacement of sj:a for submit form Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentAddAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentListAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/DeleteAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java trunk/vradi-web/src/main/webapp/WEB-INF/jsp/attachmentList.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp trunk/vradi-web/src/main/webapp/img/indicator.gif Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/EditAction.java trunk/vradi-web/src/main/java/org/chorem/vradi/actions/FormNoteAction.java trunk/vradi-web/src/main/resources/struts.xml trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentAddAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentAddAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentAddAction.java 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,95 @@ +package org.chorem.vradi.actions; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Date; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.vradi.entities.Attachment; +import org.chorem.vradi.entities.AttachmentImpl; +import org.nuiton.util.FileUtil; +import org.nuiton.wikitty.WikittyProxy; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class AttachmentAddAction extends AttachmentListAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(AttachmentAddAction.class); + + protected String attachmentId; + protected String name; + protected String description; + protected File file; + protected String contentType; + protected String filename; + + public void setAttachmentId(String attachmentId) { + this.attachmentId = attachmentId; + } + + public String getTargetId() { + return targetId; + } + + public void setName(String name) { + this.name = name; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setFile(File file) { + this.file = file; + } + + public void setFilename(String filename) { + this.filename = filename; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + @Override + public String execute() throws Exception { + String result = SUCCESS; + WikittyProxy proxy = getProxy(); + Attachment attachment; + if (attachmentId == null) { + attachment = new AttachmentImpl(); + attachment.setDate(new Date()); + attachment.setFormNote(targetId); + } else { + attachment = proxy.restore(Attachment.class, attachmentId); + } + if (attachment != null) { + if (file != null) { + attachment.setContent(FileUtil.fileToByte(file)); + attachment.setMimetype(contentType); + attachment.setName(filename); + } + if (!StringUtils.isEmpty(name)) { + attachment.setName(name); + } + if (!StringUtils.isEmpty(description)) { + attachment.setName(description); + } + proxy.store(attachment); + } + + // force la creation de la liste des attachments + super.execute(); + + return result; + } + +} Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentListAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentListAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/AttachmentListAction.java 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,63 @@ +package org.chorem.vradi.actions; + +import com.opensymphony.xwork2.ActionContext; +import freemarker.template.utility.Collections12; +import java.util.Collections; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.vradi.entities.Attachment; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.PagedResult; +import org.nuiton.wikitty.search.Search; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class AttachmentListAction extends VradiBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(AttachmentListAction.class); + + static public AttachmentListAction getAction() { + return (AttachmentListAction)ActionContext.getContext().get(CONTEXT_ACTION_KEY); + } + + protected String targetId; + /** les fichiers attache a ce target */ + protected PagedResult<Attachment> attachments; + + + public void setTargetId(String targetId) { + this.targetId = targetId; + } + + public PagedResult<Attachment> getAttachments() { + return attachments; + } + + @Override + public String execute() throws Exception { + String result = SUCCESS; + if (targetId == null) { + attachments = new PagedResult<Attachment>( + 0, 0, "", null, Collections.EMPTY_LIST); + } else { + WikittyProxy proxy = getProxy(); + + Criteria criteria = Search.query() + .eq(Attachment.FQ_FIELD_ATTACHMENT_FORMNOTE, targetId) + .criteria().addSortDescending(Attachment.FQ_FIELD_ATTACHMENT_DATE); + attachments = proxy.findAllByCriteria(Attachment.class, criteria); + } + return result; + } + + +} Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/DeleteAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/DeleteAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/DeleteAction.java 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,62 @@ +package org.chorem.vradi.actions; + +import com.opensymphony.xwork2.ActionContext; +import java.util.Collection; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.entities.Wikitty; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class DeleteAction extends AbstractEditAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(DeleteAction.class); + + static public DeleteAction getAction() { + return (DeleteAction)ActionContext.getContext().get(CONTEXT_ACTION_KEY); + } + + protected String id; + + public void setId(String id) { + this.id = id; + } + + @Override + public String execute() throws Exception { + String result = SUCCESS; + WikittyProxy proxy = getProxy(); + Wikitty w = proxy.restore(id); + if (w != null) { + boolean canDelete = true; + Collection<String> extensions = w.getExtensionNames(); + for (String ext : extensions) { + if (!isAcceptable(ext)) { + canDelete = false; + break; + } + } + if (canDelete) { + proxy.delete(id); + addActionMessage("Delete successful"); + } else { + addActionMessage("Delete failed"); + result = ERROR; + log.error(String.format( + "You try to delete object but this object type can't be" + + " deleted (see configuration exclude: %s include: %s)", + w, String.valueOf(excludes), String.valueOf(includes))); + } + } + return result; + } + +} 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-05-27 13:22:52 UTC (rev 66) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/EditAction.java 2011-05-30 10:28:44 UTC (rev 67) @@ -31,6 +31,7 @@ protected HttpServletRequest request; protected String id; protected Wikitty wikitty; + protected boolean sendResult = false; @Override public void setServletRequest(HttpServletRequest request) { @@ -45,6 +46,10 @@ this.id = id; } + public void setSendResult(boolean sendResult) { + this.sendResult = sendResult; + } + public Wikitty getWikitty() { return wikitty; } @@ -53,24 +58,27 @@ public String execute() throws Exception { String result = SUCCESS; WikittyProxy proxy = getProxy(); - wikitty = proxy.restore(getId()); - if (wikitty != null) { + Wikitty w = proxy.restore(getId()); + if (w != null) { try { for (Object key : request.getParameterMap().keySet()) { String k = String.valueOf(key); log.debug(String.format("Look for field(%s)", k)); - if (wikitty.hasField(k) && isAcceptable(k)) { + if (w.hasField(k) && isAcceptable(k)) { Object v = request.getParameter(k); log.debug(String.format("Put value(%s) in field(%s)", v, k)); - wikitty.setFqField(k, v); + w.setFqField(k, v); } } - wikitty = proxy.store(wikitty); + w = proxy.store(w); } catch(Exception eee) { log.error("Can't edit wikitty", eee); result = ERROR; } } + if (sendResult) { + wikitty = w; + } return result; } Modified: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/FormNoteAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/FormNoteAction.java 2011-05-27 13:22:52 UTC (rev 66) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/FormNoteAction.java 2011-05-30 10:28:44 UTC (rev 67) @@ -45,8 +45,6 @@ protected String summary; /** content of this formNote in HTML format */ protected String content; - /** les fichiers attache a cette note */ - protected PagedResult<Attachment> attachments; public String getFormId() { return formId; @@ -88,10 +86,6 @@ this.content = content; } - public PagedResult<Attachment> getAttachments() { - return attachments; - } - @Override public String execute() throws Exception { WikittyProxy proxy = getProxy(); @@ -126,11 +120,6 @@ content = formNote.getContent(); } - Criteria criteria = Search.query() - .eq(Attachment.FQ_FIELD_ATTACHMENT_FORMNOTE, getFormNoteId()) - .criteria().addSortDescending(Attachment.FQ_FIELD_ATTACHMENT_DATE); - attachments = proxy.findAllByCriteria(Attachment.class, criteria); - return SUCCESS; } } Added: trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java =================================================================== --- trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java (rev 0) +++ trunk/vradi-web/src/main/java/org/chorem/vradi/actions/RestoreUserAction.java 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,65 @@ +package org.chorem.vradi.actions; + +import com.opensymphony.xwork2.ActionContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.vradi.entities.VradiUser; +import org.nuiton.jrst.JRST; +import org.nuiton.wikitty.WikittyProxy; + +/** + * Permet de charger un user ({@link VradiUser}) grace a son identifiant + * (parametre: userId) + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class RestoreUserAction extends VradiBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(RestoreUserAction.class); + + static public RestoreUserAction getAction() { + return (RestoreUserAction)ActionContext.getContext().get(CONTEXT_ACTION_KEY); + } + + protected String userId; + protected VradiUser user; + protected String infoHtml; + + public void setUserId(String userId) { + this.userId = userId; + } + + public VradiUser getUser() { + return user; + } + + public String getInfoHtml() { + return infoHtml; + } + + @Override + public String execute() throws Exception { + String result = SUCCESS; + WikittyProxy proxy = getProxy(); + user = proxy.restore(VradiUser.class, userId); + log.debug(String.format("User '%s' is %s: ", userId, user)); + + if (user != null) { + try { + infoHtml = JRST.generate(JRST.TYPE_HTML_INNER_BODY, user.getInfo()); + } catch(Exception eee) { + log.info("Can't generate HTML from RST", eee); + infoHtml = user.getInfo(); + } + } + + return result; + } + + +} Modified: trunk/vradi-web/src/main/resources/struts.xml =================================================================== --- trunk/vradi-web/src/main/resources/struts.xml 2011-05-27 13:22:52 UTC (rev 66) +++ trunk/vradi-web/src/main/resources/struts.xml 2011-05-30 10:28:44 UTC (rev 67) @@ -13,7 +13,6 @@ +--> <constant name="struts.devMode" value="true"/> <constant name="struts.ognl.logMissingProperties" value="true" /> - <constant name="struts.el.throwExceptionOnFailure" value="true" /> <!-- | Definition d'un package pour l'espace public @@ -89,7 +88,10 @@ </action> </package> - <package name="misc" extends="restrictedArea"> + <!-- + | Package pour les pages principales (bookmarkable) + +--> + <package name="main" extends="restrictedArea"> <!-- | Change local @@ -121,16 +123,40 @@ <result>/WEB-INF/jsp/formNote.jsp</result> </action> <!-- - | Edit n'importe qu'elle objet en modifiant les valeurs des champs retrouve - | en parametre + | Affiche la page de preference de l'utilisateur +--> - <action name="edit/*" class="org.chorem.vradi.actions.EditAction"> - <param name="id">{1}</param> - <param name="restrictedExtension">FormNote</param> - <result type="wikitty-json"/> + <action name="userPreference/*" class="org.chorem.vradi.actions.RestoreUserAction"> + <param name="userId">{1}</param> + <result>/WEB-INF/jsp/userPreference.jsp</result> </action> </package> + <!-- + | Package pour les bout de pages que l'on inclu dans d'autre via ajax + +--> + <package name="fragment" namespace="/fragment" extends="restrictedArea"> + <!-- + | Ajoute un nouvel attachment et + | genere la liste de attachment associe a l'id passer par le parametre targetId + +--> + <action name="attachmentAdd" class="org.chorem.vradi.actions.AttachmentAddAction"> + <result>/WEB-INF/jsp/attachmentList.jsp</result> + </action> + <!-- + | genere la liste de attachment associe a l'id passer par le parametre targetId + +--> + <action name="attachmentList/*" class="org.chorem.vradi.actions.AttachmentListAction"> + <param name="targetId">{1}</param> + <result>/WEB-INF/jsp/attachmentList.jsp</result> + </action> + <!-- + | genere la liste de attachment associe a l'id passer par le parametre targetId + +--> + <action name="userInfo" class="org.chorem.vradi.actions.RestoreUserAction"> + <result>/WEB-INF/jsp/userInfo.jsp</result> + </action> + </package> + <package name="ajax" namespace="/ajax" extends="restrictedArea"> <!-- | Essai de generer du HTML a partir d'un champs d'un objet ou du @@ -152,6 +178,14 @@ <param name="includes">FormNote\..*</param> <result type="wikitty-json"/> </action> + <!-- + | Supprime n'importe qu'elle objet ou champs d'un objet (remise a null) + +--> + <action name="delete/*" class="org.chorem.vradi.actions.DeleteAction"> + <param name="id">{1}</param> + <param name="includes">FormNote</param> + <result>/WEB-INF/jsp/delete.jsp</result> + </action> </package> </struts> Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/attachmentList.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/attachmentList.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/attachmentList.jsp 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,26 @@ +<%-- + Document : formNoteAttachments + Created on : 26 mai 2011, 16:46:42 + Author : poussin +--%> + +<%@page import="org.chorem.vradi.entities.Attachment"%> +<%@page import="org.chorem.vradi.actions.AttachmentListAction"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%@taglib prefix="s" uri="/struts-tags"%> +<%@taglib prefix="sj" uri="/struts-jquery-tags"%> + +<% +AttachmentListAction action = AttachmentListAction.getAction(); +%> + +<ul> + <% for (Attachment a : action.getAttachments()) { %> + <li><%=a.getDate()%> <%=a.getName()%> + <s:a action="" label="vradi.attachment.update"></s:a> + <s:a action="" label="vradi.attachment.history"></s:a> + <s:a action="" label="vradi.attachment.delete"></s:a> + </li> + <% } %> +</ul> Modified: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp 2011-05-27 13:22:52 UTC (rev 66) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/formNote.jsp 2011-05-30 10:28:44 UTC (rev 67) @@ -38,8 +38,16 @@ </head> <body> <h1><s:text name="vradi.formNote.title" /></h1> + <div id="result"> + <img id="indicator-result" src="/img/indicator.gif" alt="Loading..." style="display:none"/> + </div> + <div> + <sj:a id="closeButton" href="/ajax/edit/%{localNoteId}.action?state=close" + targets="" indicator="indicator-result" + button="true" buttonIcon="ui-icon-gear"> + <s:text name="vradi.formNote.close"/> + </sj:a> - <div> <s:a action="formNoteEdit/%{localNoteId}?state=close"><s:text name="vradi.formNote.close" /></s:a> <s:a action="delete/%{localNoteId}"><s:text name="vradi.delete" /></s:a> </div> @@ -51,7 +59,17 @@ </div> <div> - <s:select size="5" list="partners" listKey="wikittyId" listValue="login"/> + <form id="partnersForm" action="/fragment/userInfo.action"> + <s:select size="5" name="userId" list="partners" listKey="wikittyId" listValue="login"/> + <sj:submit id="partnersSubmit" + value="Show" + targets="partnersInfo" indicator="indicator-partnersInfo" + button="true" buttonIcon="ui-icon-gear"/> + </form> + <div id="partnersInfo"> + <img id="indicator-partnersInfo" src="/img/indicator.gif" alt="Loading..." style="display:none"/> + </div> + <s:a action="seekPartners/%{localNoteId}"><s:text name="vradi.formNote.seekPartners" /></s:a> <s:checkbox label="seeking partners" name="formNote.seekingPartners" value="%{localSeekingPartner}" onchange="var url='/ajax/edit/%{localNoteId}.action?%{localFieldSeekingPartner}='+this.checked; var xhr=new XMLHttpRequest(); xhr.open('GET', url, true);xhr.send(null); alert(url);"/> @@ -63,20 +81,19 @@ <sj:tab id="tabHtmlSummary" target="htmlSummary" label="Summary"/> <sj:tab id="tabHtmlSummaryEdit" target="htmlSummaryEdit" label="Edit"/> <div id="htmlSummary"> + <img id="indicator-htmlSummary" src="/img/indicator.gif" alt="Loading..." style="display:none"/> <%=action.getSummary()%> </div> <div id="htmlSummaryEdit"> - <s:form id="htmlSummaryEditForm" action="/ajax/rst.action"> + <form id="htmlSummaryEditForm" action="/ajax/rst.action"> <s:hidden name="id" value="%{localNoteId}"/> <s:hidden name="field" value="%{localFieldSummary}"/> <s:textarea name="rst" value="%{localSummary}"/> - </s:form> - <sj:a id="htmlSummaryEditSubmit" formIds="htmlSummaryEditForm" - targets="htmlSummary" indicator="indicator" - button="true" buttonIcon="ui-icon-gear"> - <s:text name="vradi.edit.save"/> - </sj:a> - <img id="indicator" src="images/indicator.gif" alt="Loading..." style="display:none"/> + <sj:submit id="htmlSummaryEditSubmit" + value="Save" + targets="htmlSummary" indicator="indicator-htmlSummary" + button="true" buttonIcon="ui-icon-gear"/> + </form> </div> </sj:tabbedpanel> </div> @@ -87,32 +104,50 @@ <sj:tab id="tabHtmlContent" target="htmlContent" label="Summary"/> <sj:tab id="tabHtmlContentEdit" target="htmlContentEdit" label="Edit"/> <div id="htmlContent" > + <img id="indicator-htmlContent" src="/img/indicator.gif" alt="Loading..." style="display:none"/> <%=action.getContent()%> </div> <div id="htmlContentEdit" > - <s:form id="htmlContentEditForm" action="/ajax/edit.action"> + <form id="htmlContentEditForm" action="/ajax/edit.action"> <s:hidden name="id" value="%{localNoteId}"/> <s:hidden name="field" value="%{localFieldSummary}"/> <s:textarea name="content" value="%{localContent}"/> - </s:form> - <sj:a id="htmlContentEditSubmit" formIds="htmlContentEditForm" - targets="htmlContent" indicator="indicator" - button="true" buttonIcon="ui-icon-gear"> - <s:text name="vradi.edit.save"/> - </sj:a> + <sj:submit id="htmlContentEditSubmit" formIds="htmlContentEditForm" + value="Save" + targets="htmlContent" indicator="indicator-htmlContent" + button="true" buttonIcon="ui-icon-gear"/> + </form> </div> </sj:tabbedpanel> </div> <div> - <ul> - <% for (Attachment a : action.getAttachments()) { %> - <li><%=a.getDate()%> <%=a.getName()%> - <s:a action="" label="vradi.attachment.update"></s:a> - <s:a action="" label="vradi.attachment.history"></s:a> - <s:a action="" label="vradi.attachment.delete"></s:a></li> - <% } %> - </ul> + <sj:tabbedpanel id="tabContainerFiles" animate="true" + collapsible="true" useSelectedTabCookie="true"> + <sj:tab id="tabFiles" target="files" label="Files"/> + <sj:tab id="tabAddFiles" target="addFiles" label="Add"/> + <div id="files"> + <sj:div href="/fragment/attachmentList/%{localNoteId}.action" + indicator="indicator-files"> + <img id="indicator-files" src="/img/indicator.gif" alt="Loading..." style="display:none"/> + </sj:div> + </div> + <div id="addFiles"> + <s:form id="addFilesForm" action="/fragment/attachmentAdd.action" enctype="multipart/form-data"> + <s:hidden name="targetId" value="%{localNoteId}"/> + <s:textfield name="name" key="vradi.addfiles.name"/> + <s:textarea name="description" key="vradi.addfiles.description"/> + <s:file name="content" key="vradi.addfiles.content" required="true"/> + <sj:submit id="addFilesSubmit" formIds="addFilesForm" + value="Save" + targets="files" onCompleteTopics="" + indicator="indicator-addFiles" + button="true" buttonIcon="ui-icon-gear"/> + </s:form> + <img id="indicator-addFiles" src="/img/indicator.gif" alt="Loading..." style="display:none"/> + </div> + </sj:tabbedpanel> </div> + </body> </html> Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userInfo.jsp 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,29 @@ +<%-- + Document : partnerInfo + Created on : 26 mai 2011, 19:59:47 + Author : poussin +--%> + +<%@page import="org.chorem.vradi.actions.RestoreUserAction"%> +<%@page import="com.opensymphony.xwork2.ActionContext"%> +<%@page import="org.chorem.vradi.entities.VradiUser"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%@taglib prefix="s" uri="/struts-tags"%> + +<% +RestoreUserAction action = RestoreUserAction.getAction(); +VradiUser user = action.getUser(); +if (user != null) { + ActionContext.getContext().put("localUserEmail", user.getLogin()); + ActionContext.getContext().put("localUserInfo", action.getInfoHtml()); +} +%> +<%-- + % on utilise s:property pour supprimer automatiquement les scripts et les tags html + % ce qui pourrait etre dangereux si on a un utilisateur mal vayant + %--%> +<s:property value="localUserEmail" default="no email" escape="true"/> +<pre> + <s:property value="localUserInfo" default="no information" escape="true"/> +</pre> \ No newline at end of file Added: trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp =================================================================== --- trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp (rev 0) +++ trunk/vradi-web/src/main/webapp/WEB-INF/jsp/userPreference.jsp 2011-05-30 10:28:44 UTC (rev 67) @@ -0,0 +1,117 @@ +<%-- + Document : partnerInfo + Created on : 26 mai 2011, 19:59:47 + Author : poussin +--%> + +<%@page import="org.chorem.vradi.actions.RestoreUserAction"%> +<%@page import="com.opensymphony.xwork2.ActionContext"%> +<%@page import="org.chorem.vradi.entities.VradiUser"%> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + +<%@taglib prefix="s" uri="/struts-tags"%> +<%@taglib prefix="sj" uri="/struts-jquery-tags"%> + + +<% +RestoreUserAction action = RestoreUserAction.getAction(); +VradiUser user = action.getUser(); +ActionContext.getContext().put("localUserId", user.getWikittyId()); +ActionContext.getContext().put("localUserEmail", user.getLogin()); +ActionContext.getContext().put("localUserInfo", user.getInfo()); + +ActionContext.getContext().put("localVradiUserFieldInfo", VradiUser.FQ_FIELD_VRADIUSER_INFO); +%> + +<!DOCTYPE html> +<html> + <head> + <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"/> + </head> + <body> + <h1><s:text name="vradi.userPreference.title" /></h1> + + <div id="actionResult" style="display: none;"></div> + + <!-- + | Information + +--> + <div> + <s:form id="infoForm" action="edit/%{localUserId}.action" method="POST"> + <sj:textarea name="%{localVradiUserFieldInfo}" + value="%{localUserInfo}" key="vradi.userPreference.info"/> + <sj:submit id="infoFormSubmit" + targets="actionResult" indicator="indicator-infoFormSubmit" + value="Save" + button="true" buttonIcon="ui-icon-gear"/> + + </s:form> + <img id="indicator-infoFormSubmit" src="/img/indicator.gif" alt="saving..." style="display:none"/> + </div> + + + <!-- + | Personnes a qui on n'envoie plus les demandes + +--> + <div> + <s:form id="noSendForm" action="edit/%{localUserId}.action" method="POST"> + <s:select size="5" name="userId" list="noSendList" listKey="wikittyId" listValue="login"/> + <sj:submit + id="noSendFormShowSubmit" + href="/fragment/partnerInfo.action" + targets="noSendResult" + value="Show" + indicator="indicator-noSendFormSubmit" + button="true" + /> + <sj:submit + id="noSendFormDeleteSubmit" + href="%{simpleecho}" + targets="noSendResult" + value="Delete" + indicator="indicator-noSendFormSubmit" + button="true" + /> + + </s:form> + + <div id="noSendResult"> + <img id="indicator-noSendSubmit" src="/img/indicator.gif" alt="wait..." style="display:none"/> + </div> + </div> + + <!-- + | Personnes dont on ne recoit plus de demande + +--> + <div> + <s:form id="noReceivedForm" action="edit/%{localUserId}.action" method="POST"> + <s:select size="5" name="userId" list="noReceivedList" listKey="wikittyId" listValue="login"/> + <sj:submit + id="noReceivedFormShowSubmit" + href="/fragment/partnerInfo.action" + targets="noReceivedResult" + value="Show" + indicator="indicator-noReceivedFormSubmit" + button="true" + /> + <sj:submit + id="noReceivedFormDeleteSubmit" + href="%{simpleecho}" + targets="noReceivedResult" + value="Delete" + indicator="indicator-noReceivedFormSubmit" + button="true" + /> + + </s:form> + + <div id="noReceivedResult"> + <img id="indicator-noReceivedSubmit" src="/img/indicator.gif" alt="wait..." style="display:none"/> + </div> + </div> + + </body> +</html> Added: trunk/vradi-web/src/main/webapp/img/indicator.gif =================================================================== (Binary files differ) Property changes on: trunk/vradi-web/src/main/webapp/img/indicator.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream