r246 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions webapp/WEB-INF/jsp
Author: bpoussin Date: 2012-08-22 08:57:42 +0200 (Wed, 22 Aug 2012) New Revision: 246 Url: http://chorem.org/repositories/revision/chorem/246 Log: utilisation du tag jsp wikitty pour l'affichage des listes d'Attachment Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java =================================================================== --- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-21 16:42:04 UTC (rev 245) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-22 06:57:42 UTC (rev 246) @@ -217,44 +217,7 @@ } } - -// static public class TaskInfoMap extends HashMap<String, TaskInfo> { -// // on surcharge le get pour creer automatiquement les objets -// @Override -// public TaskInfo get(Object key) { -// TaskInfo result = super.get(key); -// if (result == null) { -// result = new TaskInfo(); -// result.id = (String)key; -// put(result.id, result); -// } -// return result; -// } -// }; - - public final class AttachmentLink { - protected String contextPath; - protected Attachment attachment; - - public AttachmentLink(String contextPath, Attachment attachment) { - this.contextPath = contextPath; - this.attachment = attachment; - } - - @Override - public String toString() { - String id = attachment.getWikittyId(); - String name = attachment.getName(); - String url = attachment.getContentUrl(); - if (StringUtils.isBlank(url)) { - url = contextPath + "/wikitty/view/" + id + "/Attachment/content"; - } - return String.format("<a href='%s'>%s</a>", url, name); - } - - } - - protected <E> Map<String, List<AttachmentLink>> prepareAttachment(ChoremClient client, Collection<E> ids) { + protected <E> Map<String, List<Attachment>> prepareAttachment(ChoremClient client, Collection<E> ids) { // recherche des attachments de chaque quotation trouvee WikittyQuery attachmentQuery = new WikittyQueryMaker().and() .exteq(Attachment.EXT_ATTACHMENT) @@ -265,19 +228,14 @@ client.findAllByQuery(Attachment.class, attachmentQuery); // preparation des attachements pour chaque quotation - ServletContext servletContext = getContext().getServletContext(); - String contextPath = servletContext.getContextPath(); - Map<String, List<AttachmentLink>> attachments = new HashMap<String, List<AttachmentLink>>(); + Map<String, List<Attachment>> attachments = + new MapWithDefault<String, List<Attachment>>( + new HashMap<String, List<Attachment>>(), new LinkedList<Attachment>()); for (Attachment a : attachmentResult) { String id = a.getTarget(); - List<AttachmentLink> l = attachments.get(id); - if (l == null) { - l = new LinkedList<AttachmentLink>(); - attachments.put(id, l); - } - l.add(new AttachmentLink(contextPath, a)); + attachments.get(id).add(a); } - + return attachments; } @@ -488,15 +446,20 @@ .parse(query) .containsOne(Quotation.FQ_FIELD_QUOTATION_STATUS, status) .or() + .bw(Interval.FQ_FIELD_INTERVAL_BEGINDATE, start, end) + .bw(Interval.FQ_FIELD_INTERVAL_ENDDATE, start, end) .bw(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE, start, end) - .isNull(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE) + .and() + .isNull(Interval.FQ_FIELD_INTERVAL_BEGINDATE) + .isNull(Interval.FQ_FIELD_INTERVAL_ENDDATE) + .isNull(Quotation.FQ_FIELD_QUOTATION_POSTEDDATE) .end(); WikittyQueryResult<Quotation> result = client.findAllByQuery(Quotation.class, quotationQuery); // recherche des attachments de chaque quotation trouvee - Map<String, List<AttachmentLink>> attachments = + Map<String, List<Attachment>> attachments = prepareAttachment(client, result.getAll()); // TODO poussin 20120523 ajouer la recherche des note sur la quotation @@ -739,7 +702,7 @@ } // recherche des attachments de chaque quotation trouvee - Map<String, List<AttachmentLink>> attachments = + Map<String, List<Attachment>> attachments = prepareAttachment(client, invoices.getAll()); return renderView("dashboardInvoice.jsp", Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-21 16:42:04 UTC (rev 245) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-22 06:57:42 UTC (rev 246) @@ -54,7 +54,7 @@ <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.postedDate" label=""/></td> <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.expectedDate" label=""/></td> <td class="date"><w:display wikitty="${q.wikitty}" fqfield="Invoice.paymentDate" label=""/></td> - <td>${attachments.get(q.wikittyId)}</td> + <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td> </tr> </tbody> </c:forEach> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-21 16:42:04 UTC (rev 245) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-22 06:57:42 UTC (rev 246) @@ -58,7 +58,7 @@ <td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).hopedProfit}"/></td> <td class="currency"><f:formatNumber type="currency" value="${taskInfos.get(q.wikittyId).realProfit}"/></td> <td class="nowrap"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td> - <td>${attachments.get(q.wikittyId)}</td> + <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td> </tr> </tbody> </c:forEach> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-21 16:42:04 UTC (rev 245) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-22 06:57:42 UTC (rev 246) @@ -58,7 +58,7 @@ <td class="number"><f:formatNumber type="number" value="${taskInfos.get(q.wikittyId).closed}"/></td> <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td> <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td> - <td>${attachments.get(q.wikittyId)}</td> + <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td> </tr> </tbody> </c:forEach> Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-21 16:42:04 UTC (rev 245) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-22 06:57:42 UTC (rev 246) @@ -56,7 +56,7 @@ <td class="currency"><f:formatNumber type="currency" value="${q.amount / q.estimatedDays}"/></td> <td class="currency"><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td> <td class="nowrap"><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td> - <td>${attachments.get(q.wikittyId)}</td> + <td><w:display wikitties="${attachments.get(q.wikittyId)}" toString="%Attachment.name|noname$s"/></td> </tr> </tbody> </c:forEach>
participants (1)
-
bpoussin@users.chorem.org