Chorem-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
August 2012
- 4 participants
- 53 discussions
r232 - in trunk: chorem-entities/src/main/xmi chorem-webmotion/src/main/java/org/wikitty/web/jsptag chorem-webmotion/src/main/webapp/WEB-INF chorem-webmotion/src/main/webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 07 Aug '12
by bpoussin@users.chorem.org 07 Aug '12
07 Aug '12
Author: bpoussin
Date: 2012-08-07 20:30:03 +0200 (Tue, 07 Aug 2012)
New Revision: 232
Url: http://chorem.org/repositories/revision/chorem/232
Log:
gros travail sur les tag display et utilisation dans les dashboard
Modified:
trunk/chorem-entities/src/main/xmi/chorem-model.properties
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.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
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/wikitty.tld
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-07 18:30:03 UTC (rev 232)
@@ -99,18 +99,21 @@
org.chorem.entities.Note.class.tagvalue.toString=(%Note.date$tF) %Note.title|noname$s
org.chorem.entities.Note.class.tagvalue.sortOrder=Note.date
org.chorem.entities.Note.Attachment.content.tagvalue.subtype=text/rst
-org.chorem.entities.Quotation.class.tagvalue.version=13.0
+org.chorem.entities.Quotation.class.tagvalue.version=14.0
org.chorem.entities.Quotation.class.tagvalue.preload=Quotation.project;Quotation.customer;Quotation.supplier;Quotation.category
org.chorem.entities.Quotation.class.tagvalue.toString=%Interval.beginDate$tF-%Interval.endDate$tF %Quotation.reference|noref$s(%Quotation.category|noCategory$s) %Quotation.description|nodescription$s
org.chorem.entities.Quotation.class.tagvalue.sortOrder=Interval.beginDate desc,Interval.endDate,Quotation.reference,Quotation.type,Quotation.description
org.chorem.entities.Quotation.attribute.status.tagvalue.allowed=LEAD,DRAFT,SENT,REJECTED,ACCEPTED,STARTED,DELIVERED,RSV,WARRANTY,CLOSED
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.help=Pourcentage de r\u00e9ussite du projet
+org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.subtype=percent
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.min=0
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.max=100
-org.chorem.entities.Invoice.class.tagvalue.version=10.0
+org.chorem.entities.Invoice.class.tagvalue.version=11.0
org.chorem.entities.Invoice.class.tagvalue.preload=Invoice.customer;Invoice.supplier
org.chorem.entities.Invoice.class.tagvalue.toString=%Invoice.reference|noref$s %Invoice.amount|noamount$s %Invoice.postedDate$tF %Invoice.expectedDate$tF %Invoice.paymentDate$tF
org.chorem.entities.Invoice.class.tagvalue.sortOrder=Invoice.postedDate desc,Invoice.expectedDate,Invoice.paymentDate,Invoice.reference,Invoice.amount
+org.chorem.entities.Invoice.attribute.amount.tagvalue.subtype=currency
+org.chorem.entities.Invoice.attribute.description.tagvalue.subtype=text/rst
org.chorem.entities.Invoiceable.class.tagvalue.version=10.0
org.chorem.entities.Invoiceable.class.tagvalue.preload=Invoiceable.target;Invoiceable.category
org.chorem.entities.Invoiceable.class.tagvalue.toString=%Invoiceable.name|noname$s
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-07 18:30:03 UTC (rev 232)
@@ -43,14 +43,25 @@
/**
* Tag Support to display Wikitty fields.
*
+ * attribute:
+ * <li>wikitty: wikitty object
+ * <li>fqfield: fully qualified field to display
+ * <li>label: if not presente use field name, if empty or blank don't show label
+ * <li>toString: String used to transforme Wikitty to string representation (overwrite default toString)
+ * <li>pattern: pattern used to display field (Date, Number) (overwrite default format)
+ * <li>subtype: subtype used for display field (overwrite default subtype)
+ *
* @author ymartel <martel(a)codelutin.com>
* @since 04/26/2012
*/
public class WikittyDisplay extends SimpleTagSupport {
protected Wikitty wikitty;
- protected String fqfield="";
- protected String label="";
+ protected String fqfield = "";
+ protected String label = null;
+ protected String toString = null;
+ protected String pattern = null;
+ protected String subtype = null;
public void setWikitty(Wikitty wikitty) {
this.wikitty = wikitty;
@@ -64,54 +75,82 @@
this.label = label;
}
+ public void setToString(String toString) {
+ this.toString = toString;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public void setSubtype(String subtype) {
+ this.subtype = subtype;
+ }
+
@Override
public void doTag() throws JspException, IOException {
+ if (wikitty == null) {
+ // si pas de wikitty, on a rien a faire
+ return;
+ }
JspWriter output = getJspContext().getOut();
PageContext pageContext = (PageContext)getJspContext();
ServletContext servletContext = pageContext.getServletContext();
String contextPath = servletContext.getContextPath();
- String extName = WikittyUtil.getExtensionNameFromFQFieldName(fqfield);
- String fieldName = WikittyUtil.getFieldNameFromFQFieldName(fqfield);
- FieldType field = wikitty.getFieldType(fqfield);
+ if (StringUtils.isBlank(fqfield)) {
+ // pas de champs precisse, on doit afficher le wikitty lui meme
+ if (StringUtils.isNotBlank(label)) {
+ /*{<%=label%> : }*/
+ }
+ renderWikitty(output, contextPath, wikitty.getWikittyId(), wikitty, toString);
+ } else {
+ String extName = WikittyUtil.getExtensionNameFromFQFieldName(fqfield);
+ String fieldName = WikittyUtil.getFieldNameFromFQFieldName(fqfield);
+ FieldType field = wikitty.getFieldType(fqfield);
- // par defaut si pas de label on utilise le nom du field
- if (StringUtils.isBlank(label)) {
- label = fieldName;
- }
+ // par defaut si pas de label on utilise le nom du field
+ if (null == label) {
+ label = fieldName;
+ }
- if (field != null) {
- switch(field.getType()) {
- case BINARY:
- viewBinary(output, contextPath, label, wikitty, extName, fieldName);
- break;
- case BOOLEAN:
- viewBoolean(output, contextPath, label, wikitty, extName, fieldName);
- break;
- case DATE:
- viewDate(output, contextPath, label, wikitty, field, extName, fieldName);
- break;
- case NUMERIC:
- viewNumeric(output, contextPath, label, wikitty, field, extName, fieldName);
- break;
- case STRING:
- if (field.isCollection()) {
- viewCollectionString(output, contextPath, label, wikitty, extName, fieldName);
- } else {
- viewString(output, label, wikitty, extName, fieldName);
- }
- break;
- case WIKITTY:
- if (field.isCollection()) {
- viewCollectionWikitty(output, contextPath, label, wikitty, extName, fieldName);
- } else {
- viewWikitty(output, contextPath, label, wikitty, extName, fieldName);
- }
- break;
+ if (field != null) {
+ if (StringUtils.isNotBlank(label)) {
+ /*{<%=label%> : }*/
+ }
+
+ switch(field.getType()) {
+ case BINARY:
+ viewBinary(output, contextPath, label, wikitty, extName, fieldName);
+ break;
+ case BOOLEAN:
+ viewBoolean(output, contextPath, label, wikitty, extName, fieldName);
+ break;
+ case DATE:
+ viewDate(output, contextPath, label, wikitty, field, extName, fieldName);
+ break;
+ case NUMERIC:
+ viewNumeric(output, contextPath, label, wikitty, field, extName, fieldName);
+ break;
+ case STRING:
+ if (field.isCollection()) {
+ viewCollectionString(output, contextPath, label, wikitty, field, extName, fieldName);
+ } else {
+ viewString(output, label, wikitty, field, extName, fieldName);
+ }
+ break;
+ case WIKITTY:
+ if (field.isCollection()) {
+ viewCollectionWikitty(output, contextPath, label, wikitty, field, extName, fieldName);
+ } else {
+ viewWikitty(output, contextPath, label, wikitty, field, extName, fieldName);
+ }
+ break;
+ }
+ } else {
+ /*{<div class="alert alert-error"><%=wikitty.getWikittyId()%> doesn't have field '<%=fqfield%>'</div>}*/
}
- } else {
- /*{<div class="alert alert-error"><%=wikitty.getWikittyId()%> doesn't have field '<%=fqfield%>'</div>}*/
}
}
@@ -121,9 +160,9 @@
byte[] fieldAsBytes = wikitty.getFieldAsBytes(extName, fieldName);
if (fieldAsBytes != null) {
String url = contextPath + "/wikitty/view/" + wikitty.getWikittyId() + "/" + extName + "/" + fieldName;
- /*{<%=label%> : <a href="<%=url%>">Download</a>}*/
+ /*{<a href="<%=url%>">Download</a>}*/
} else {
- /*{<%=label%> : }*/
+ // nothing
}
}
@@ -131,7 +170,7 @@
Wikitty wikitty, String extName , String fieldName)
throws JspException, IOException {
boolean value = wikitty.getFieldAsBoolean(extName, fieldName);
- /*{<%=label%> : <%=value%>}*/
+ /*{<%=value%>}*/
}
protected void viewDate(JspWriter output, String contextPath, String label,
@@ -140,22 +179,25 @@
Date date = wikitty.getFieldAsDate(extName, fieldName);
String value = "";
+ if (date != null) {
- if (field.hasPattern() && date != null) {
- String pattern = field.getPattern();
+ pattern = StringUtils.defaultIfBlank(pattern, field.getPattern());
+
+ if (StringUtils.isBlank(pattern)) {
+ subtype = StringUtils.defaultIfBlank(subtype, field.getSubtype());
+ if ("month".equalsIgnoreCase(subtype)) {
+ pattern = "MM/yyyy";
+ } else if ("time".equalsIgnoreCase(subtype)) {
+ pattern = "hh:mm";
+ } else if ("datetime".equalsIgnoreCase(subtype)) {
+ pattern = "dd/MM/yyyy hh:mm";
+ } else {
+ pattern = "dd/MM/yyyy";
+ }
+ }
value = DateFormatUtils.format(date, pattern);
- } else if (date != null) {
- if ("month".equals(field.getTagValue("subtype"))) {
- value = DateFormatUtils.format(date, "MM/yyyy");
- } else if ("time".equals(field.getTagValue("subtype"))) {
- value = DateFormatUtils.format(date, "hh:mm");
- } else if ("datetime".equals(field.getTagValue("subtype"))) {
- value = DateFormatUtils.format(date, "dd/MM/yyyy hh:mm");
- } else {
- value = DateFormatUtils.format(date, "dd/MM/yyyy");
- }
}
- /*{<%=label%> : <%=value%> }*/
+ /*{<%=value%> }*/
}
protected void viewNumeric(JspWriter output, String contextPath, String label,
@@ -163,26 +205,43 @@
throws JspException, IOException {
BigDecimal value = wikitty.getFieldAsBigDecimal(extName, fieldName);
- NumberFormat formatter;
- if (field.hasPattern()) {
- String pattern = field.getPattern();
- //TODO ymartel 2012-05-02 : manage localization
- formatter = new DecimalFormat(pattern);
- } else {
- formatter = new DecimalFormat();
+ String formattedValue = "";
+ if (value != null) {
+
+ pattern = StringUtils.defaultIfBlank(pattern, field.getPattern());
+ NumberFormat formatter;
+
+ if (StringUtils.isNotBlank(pattern)) {
+ formatter = new DecimalFormat(pattern);
+ } else {
+ subtype = StringUtils.defaultIfBlank(subtype, field.getSubtype());
+
+ if ("currency".equalsIgnoreCase(subtype)) {
+ formatter = NumberFormat.getCurrencyInstance();
+ } else if ("percent".equalsIgnoreCase(subtype)) {
+ formatter = NumberFormat.getPercentInstance();
+ } else if ("integer".equalsIgnoreCase(subtype)) {
+ formatter = NumberFormat.getIntegerInstance();
+ } else {
+ formatter = NumberFormat.getNumberInstance();
+ }
+ }
+ formattedValue = formatter.format(value);
}
- String formattedValue = formatter.format(value);
- /*{<%=label%> : <%=formattedValue%> }*/
+ /*{<%=formattedValue%> }*/
}
protected void viewCollectionString(JspWriter output, String contextPath, String label,
- Wikitty wikitty, String extName , String fieldName)
+ Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
List<String> values = wikitty.getFieldAsList(extName, fieldName, String.class);
- /*{<%=label%> : <ul>}*/
+ subtype = StringUtils.defaultIfBlank(subtype, field.getSubtype());
+
+ /*{<ul>}*/
if (values != null) {
for (String value : values) {
if (value != null) {
+ value = transformString(subtype, value);
/*{<li><%=value%></li>}*/
}
}
@@ -190,23 +249,32 @@
/*{</ul>}*/
}
- protected void viewString(JspWriter output, String label, Wikitty wikitty, String extName , String fieldName)
+ protected void viewString(JspWriter output, String label, Wikitty wikitty,
+ FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String fieldAsString = wikitty.getFieldAsString(extName, fieldName);
- String value = fieldAsString != null ? fieldAsString : "";
- /*{<%=label%> : <%=value%>}*/
+ String value = wikitty.getFieldAsString(extName, fieldName);
+ subtype = StringUtils.defaultIfBlank(subtype, field.getSubtype());
+
+ if (StringUtils.isNotBlank(value)) {
+ value = transformString(subtype, value);
+ } else {
+ value = "";
+ }
+ /*{<%=value%>}*/
}
protected void viewCollectionWikitty(JspWriter output, String contextPath, String label,
- Wikitty wikitty, String extName , String fieldName)
+ Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
List<Wikitty> values = wikitty.getFieldAsWikittyList(extName, fieldName, false);
- /*{<%=label%> : <ul>}*/
+ toString = StringUtils.defaultIfBlank(toString, field.getToString());
+
+ /*{<ul>}*/
if (values != null) {
- for (Wikitty value : values) {
- if (value != null) {
- String url = contextPath + "/wikitty/view/" + value.getWikittyId();
- /*{<li><a href="<%=url%>"><%=value%></a></li>}*/
+ for (Wikitty wikittyValue : values) {
+ if (wikittyValue != null) {
+ String id = wikittyValue.getWikittyId();
+ renderWikitty(output, contextPath, id, wikittyValue, toString);
}
}
}
@@ -214,17 +282,63 @@
}
+ /**
+ * Si l'objet de ce champs est non preloaded alors utilise l'id comme representation texte.
+ * Si l'objet est preloaded alors on utilise le toString du tag s'il existe
+ * sinon le toString du champs et en dernier le toString du wikitty
+ *
+ * @param output
+ * @param contextPath
+ * @param label
+ * @param wikitty
+ * @param field
+ * @param extName
+ * @param fieldName
+ * @throws JspException
+ * @throws IOException
+ */
protected void viewWikitty(JspWriter output, String contextPath, String label,
- Wikitty wikitty, String extName , String fieldName)
+ Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String value = wikitty.getFieldAsWikitty(extName, fieldName);
+ String id = wikitty.getFieldAsWikitty(extName, fieldName);
Wikitty wikittyValue = wikitty.getFieldAsWikitty(extName, fieldName, false);
+ String value = id; // par defaut, si on a pas mieux on met l'id de l'objet
+ toString = StringUtils.defaultIfBlank(toString, field.getToString());
+
+ renderWikitty(output, contextPath, id, wikittyValue, toString);
+ }
+
+ protected void renderWikitty(JspWriter output, String contextPath,
+ String id, Wikitty wikittyValue, String toString)
+ throws JspException, IOException {
+ String url = contextPath + "/wikitty/view/" + id;
+ String value = id; // par defaut, si on a pas mieux on met l'id de l'objet
+
if (wikittyValue != null) {
- String url = contextPath + "/wikitty/view/" + value;
- if (wikittyValue != null) {
- /*{<%=label%>: <a href="<%=url%>"><%=wikittyValue%></a>}*/
+ if (StringUtils.isNotBlank(toString)) {
+ value = WikittyUtil.format(toString, wikittyValue);
+ } else {
+ value = wikittyValue.toString();
}
}
+ /*{<a href="<%=url%>"><%=value%></a>}*/
}
+ /**
+ * Transform String in specifique format to other format (ex: HTML).
+ *
+ * @param subtype mimetype or other used to choice output format
+ * @param value value to transform
+ * @return
+ */
+ protected String transformString(String subtype, String value) {
+ String result = value;
+ if ("text/rst".equalsIgnoreCase(subtype)) {
+ // TODO poussin 20120807 use jrst to transforme string to html
+ } else if ("text/dbkx".equalsIgnoreCase(subtype)) {
+ // TODO poussin 20120807 use docbook jrst xsl to transforme string to html
+ }
+ return result;
+ }
+
}//WikittyDisplay
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-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-07 18:30:03 UTC (rev 232)
@@ -44,15 +44,15 @@
<c:forEach var="q" items="${invoices}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/view/${q.target}"/>">${q.getTarget(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Invoice/view/${q.wikittyId}"/>">${q.reference}</a></td>
- <td>${q.description}</td>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>">${q.getCustomer(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.supplier}"/>">${q.getSupplier(false)}</a></td>
- <td>${q.amount}</td>
- <td>${q.postedDate}</td>
- <td>${q.expectedDate}</td>
- <td>${q.paymentDate}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoiceable.target" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" toString="%Invoice.reference$s" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.description" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.customer" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.supplier" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.amount" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.postedDate" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.expectedDate" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Invoice.paymentDate" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
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-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-07 18:30:03 UTC (rev 232)
@@ -45,17 +45,17 @@
<c:forEach var="q" items="${quotations}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/Project/view/${q.project}"/>">${q.getProject(false)}</a></td>
- <td>${q.getCategory(false)}</td>
- <td><a href="<c:url value="/wikitty/Quotation/view/${q.wikittyId}"/>">${q.description}</a></td>
- <td>${q.estimatedDays}</td>
- <td>${q.amount}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" toString="%Quotation.description$s" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
<td>${taskInfos.get(q.wikittyId).workingDays}</td>
<td>${taskInfos.get(q.wikittyId).hopedPriceDay}</td>
<td>${taskInfos.get(q.wikittyId).realPriceDay}</td>
<td>${taskInfos.get(q.wikittyId).hopedProfit}</td>
<td>${taskInfos.get(q.wikittyId).realProfit}</td>
- <td>${q.status}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
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-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProject.jsp 2012-08-07 18:30:03 UTC (rev 232)
@@ -22,6 +22,7 @@
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
<h1>${title}</h1>
@@ -45,17 +46,17 @@
<c:forEach var="q" items="${quotations}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/Project/view/${q.project}"/>">${q.getProject(false).getName()}</a></td>
- <td><a href="<c:url value="/wikitty/Category/view/${q.category}"/>">${q.getCategory(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Quotation/view/${q.wikittyId}"/>">${q.description}</a></td>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>">${q.getCustomer(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.supplier}"/>">${q.getSupplier(false)}</a></td>
- <td>${q.estimatedDays}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" toString="%Quotation.description$s" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.supplier" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
<td>${taskInfos.get(q.wikittyId).workingDays}</td>
<td>${taskInfos.get(q.wikittyId).opened}</td>
<td>${taskInfos.get(q.wikittyId).closed}</td>
- <td>${q.amount}</td>
- <td>${q.status}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
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-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardQuotation.jsp 2012-08-07 18:30:03 UTC (rev 232)
@@ -22,6 +22,7 @@
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="/WEB-INF/wikitty.tld" prefix="w"%>
<h1>${title}</h1>
@@ -44,16 +45,16 @@
<c:forEach var="q" items="${quotations}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/Project/view/${q.project}"/>">${q.getProject(false).getName()}</a></td>
- <td><a href="<c:url value="/wikitty/Category/view/${q.category}"/>">${q.getCategory(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Quotation/view/${q.wikittyId}"/>">${q.description}</a></td>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>">${q.getCustomer(false)}</a></td>
- <td><a href="<c:url value="/wikitty/Employee/view/${q.supplier}"/>">${q.getSupplier(false)}</a></td>
- <td>${q.estimatedDays}</td>
- <td>${q.conversionHope}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.project" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.category" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" toString="%Quotation.description$s" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.customer" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.supplier" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.estimatedDays" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.conversionHope" label=""/></td>
<td>${q.amount / q.estimatedDays}</td>
- <td>${q.amount}</td>
- <td>${q.status}</td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.amount" label=""/></td>
+ <td><w:display wikitty="${q.wikitty}" fqfield="Quotation.status" label=""/></td>
<td>${attachments.get(q.wikittyId)}</td>
</tr>
</tbody>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp 2012-08-07 15:55:35 UTC (rev 231)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/financial.jsp 2012-08-07 18:30:03 UTC (rev 232)
@@ -22,7 +22,7 @@
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<h1>HR</h1>
+<h1>Financial</h1>
<form>
<input type="text" name="query"/>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/wikitty.tld
===================================================================
(Binary files differ)
1
0
r231 - in trunk/chorem-webmotion/src/main/java/org: chorem/webmotion/actions wikitty/web/jsptag
by bpoussin@users.chorem.org 07 Aug '12
by bpoussin@users.chorem.org 07 Aug '12
07 Aug '12
Author: bpoussin
Date: 2012-08-07 17:55:35 +0200 (Tue, 07 Aug 2012)
New Revision: 231
Url: http://chorem.org/repositories/revision/chorem/231
Log:
prise en compte des nouvelles methodes wikitty 3.8 (getWikittyId au lieu de getId)
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-07 15:55:07 UTC (rev 230)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-07 15:55:35 UTC (rev 231)
@@ -110,7 +110,7 @@
Wikitty w = client.restore(id);
if (w != null) {
result.put("id", id);
- result.put("version", w.getVersion());
+ result.put("version", w.getWikittyVersion());
result.put("extensions", StringUtils.join(w.getExtensionNames(), ","));
for (WikittyExtension ext : w.getExtensions()) {
result.put(ext.getName() + ".version", ext.getVersion());
@@ -249,7 +249,7 @@
Wikitty value = e.getValue();
// Avoid potential null value
if (value != null) {
- String id = value.getId();
+ String id = value.getWikittyId();
String label = value.toString(extName);
Map<String, String> item = new LinkedHashMap<String, String>();
item.put("extension", extName);
@@ -478,7 +478,7 @@
getContext().addInfoMessage("message", "Object saved" + error);
- return renderURL("/wikitty/view/"+w.getId());
+ return renderURL("/wikitty/view/"+w.getWikittyId());
}
/**
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-07 15:55:07 UTC (rev 230)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyDisplay.java 2012-08-07 15:55:35 UTC (rev 231)
@@ -111,7 +111,7 @@
break;
}
} else {
- /*{<div class="alert alert-error"><%=wikitty.getId()%> doesn't have field '<%=fqfield%>'</div>}*/
+ /*{<div class="alert alert-error"><%=wikitty.getWikittyId()%> doesn't have field '<%=fqfield%>'</div>}*/
}
}
@@ -120,7 +120,7 @@
throws JspException, IOException {
byte[] fieldAsBytes = wikitty.getFieldAsBytes(extName, fieldName);
if (fieldAsBytes != null) {
- String url = contextPath + "/wikitty/view/" + wikitty.getId() + "/" + extName + "/" + fieldName;
+ String url = contextPath + "/wikitty/view/" + wikitty.getWikittyId() + "/" + extName + "/" + fieldName;
/*{<%=label%> : <a href="<%=url%>">Download</a>}*/
} else {
/*{<%=label%> : }*/
@@ -205,7 +205,7 @@
if (values != null) {
for (Wikitty value : values) {
if (value != null) {
- String url = contextPath + "/wikitty/view/" + value.getId();
+ String url = contextPath + "/wikitty/view/" + value.getWikittyId();
/*{<li><a href="<%=url%>"><%=value%></a></li>}*/
}
}
Modified: trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java 2012-08-07 15:55:07 UTC (rev 230)
+++ trunk/chorem-webmotion/src/main/java/org/wikitty/web/jsptag/WikittyInput.java 2012-08-07 15:55:35 UTC (rev 231)
@@ -138,7 +138,7 @@
/*{<i class="icon-question-sign" title="<%=help%>"></i>}*/
}
} else {
- /*{<div class="alert alert-error"><%=wikitty.getId()%> doesn't have field '<%=fqfield%>'</div>}*/
+ /*{<div class="alert alert-error"><%=wikitty.getWikittyId()%> doesn't have field '<%=fqfield%>'</div>}*/
}
}
@@ -207,7 +207,7 @@
protected void inputString(JspWriter output, String contextPath, String name,
Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String id = wikitty.getId() + "-" + extName + "-" + fieldName;
+ String id = wikitty.getWikittyId() + "-" + extName + "-" + fieldName;
String fieldValue = wikitty.getFieldAsString(extName, fieldName);
String value = fieldValue !=null ? fieldValue : "";
if ("monoline".equalsIgnoreCase(field.getSubtype())) {
@@ -233,7 +233,7 @@
protected void inputSelectString(JspWriter output, String contextPath, String name,
Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String id = wikitty.getId() + "-" + extName + "-" + fieldName;
+ String id = wikitty.getWikittyId() + "-" + extName + "-" + fieldName;
String value = wikitty.getFieldAsString(extName, fieldName);
/*{<select id="text-<%=id%>" name="<%=name%>" <%=getDynamicAttribute()%> }*/
if (field.isCollection()) {
@@ -254,7 +254,7 @@
protected void inputCollectionString(JspWriter output, String contextPath, String name,
Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String id = wikitty.getId() + "-" + extName + "-" + fieldName;
+ String id = wikitty.getWikittyId() + "-" + extName + "-" + fieldName;
List<String> value = wikitty.getFieldAsList(extName, fieldName, String.class);
if ("monoline".equalsIgnoreCase(field.getSubtype())) {
@@ -280,7 +280,7 @@
protected void inputWikitty(JspWriter output, String contextPath, String name,
Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String id = wikitty.getId() + "-" + extName + "-" + fieldName;
+ String id = wikitty.getWikittyId() + "-" + extName + "-" + fieldName;
String value = wikitty.getFieldAsWikitty(extName, fieldName);
Wikitty wikittyValue = wikitty.getFieldAsWikitty(extName, fieldName, false);
@@ -324,7 +324,7 @@
protected void inputCollectionWikitty(JspWriter output, String contextPath, String name,
Wikitty wikitty, FieldType field, String extName , String fieldName)
throws JspException, IOException {
- String id = wikitty.getId() + "-" + extName + "-" + fieldName;
+ String id = wikitty.getWikittyId() + "-" + extName + "-" + fieldName;
List<Wikitty> values = wikitty.getFieldAsWikittyList(extName, fieldName, false);
String url = contextPath + "/wikitty-json/search?extension=" + field.getAllowed();
@@ -335,7 +335,7 @@
for (Wikitty w :values) {
if (w != null) {
prePopulate += String.format("%s{id:'%s', label:'%s'}", sep,
- StringEscapeUtils.escapeEcmaScript(w.getId()),
+ StringEscapeUtils.escapeEcmaScript(w.getWikittyId()),
StringEscapeUtils.escapeEcmaScript(w.toString()));
sep = ",";
}
1
0
Author: bpoussin
Date: 2012-08-07 17:55:07 +0200 (Tue, 07 Aug 2012)
New Revision: 230
Url: http://chorem.org/repositories/revision/chorem/230
Log:
- preload de target sur Invoiceable
- tri des Invoices par ordre decroissant des dates
Modified:
trunk/chorem-entities/src/main/xmi/chorem-model.properties
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-07 14:05:56 UTC (rev 229)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-07 15:55:07 UTC (rev 230)
@@ -107,11 +107,11 @@
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.help=Pourcentage de r\u00e9ussite du projet
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.min=0
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.max=100
-org.chorem.entities.Invoice.class.tagvalue.version=9.0
-org.chorem.entities.Invoice.class.tagvalue.preload=Invoice.target;Invoice.customer;Invoice.supplier
+org.chorem.entities.Invoice.class.tagvalue.version=10.0
+org.chorem.entities.Invoice.class.tagvalue.preload=Invoice.customer;Invoice.supplier
org.chorem.entities.Invoice.class.tagvalue.toString=%Invoice.reference|noref$s %Invoice.amount|noamount$s %Invoice.postedDate$tF %Invoice.expectedDate$tF %Invoice.paymentDate$tF
-org.chorem.entities.Invoice.class.tagvalue.sortOrder=Invoice.postedDate,Invoice.expectedDate,Invoice.paymentDate,Invoice.reference,Invoice.amount
-org.chorem.entities.Invoiceable.class.tagvalue.version=9.0
-org.chorem.entities.Invoiceable.class.tagvalue.preload=Invoiceable.category
+org.chorem.entities.Invoice.class.tagvalue.sortOrder=Invoice.postedDate desc,Invoice.expectedDate,Invoice.paymentDate,Invoice.reference,Invoice.amount
+org.chorem.entities.Invoiceable.class.tagvalue.version=10.0
+org.chorem.entities.Invoiceable.class.tagvalue.preload=Invoiceable.target;Invoiceable.category
org.chorem.entities.Invoiceable.class.tagvalue.toString=%Invoiceable.name|noname$s
org.chorem.entities.Invoiceable.class.tagvalue.sortOrder=Invoiceable.name
1
0
07 Aug '12
Author: bpoussin
Date: 2012-08-07 16:05:56 +0200 (Tue, 07 Aug 2012)
New Revision: 229
Url: http://chorem.org/repositories/revision/chorem/229
Log:
delete old jsp view replaced now by taglib
Removed:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/wikittyFieldView.jsp
Deleted: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/wikittyFieldView.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/wikittyFieldView.jsp 2012-08-03 16:54:22 UTC (rev 228)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/wikittyFieldView.jsp 2012-08-07 14:05:56 UTC (rev 229)
@@ -1,64 +0,0 @@
-<%--
- #%L
- Chorem webmotion
- $Id:$
- $HeadURL:$
- %%
- Copyright (C) 2011 - 2012 CodeLutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- --%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-
-<c:choose>
- <c:when test="${ext.getFieldType(fieldName).type == 'BOOLEAN'}">
- ${fieldName}: ${wikitty.getFieldAsBoolean(ext.name, fieldName)}
- </c:when>
- <c:when test="${ext.getFieldType(fieldName).type == 'DATE'}">
- <c:choose>
- <c:when test="${ext.getFieldType(fieldName).hasPattern()}">
- ${fieldName}: <fmt:formatDate value="${wikitty.getFieldAsDate(ext.name, fieldName)}"
- pattern="${ext.getFieldType(fieldName).getPattern()}"/>
- </c:when>
- <c:otherwise>
- ${fieldName}: <fmt:formatDate value="${wikitty.getFieldAsDate(ext.name, fieldName)}"/>
- </c:otherwise>
- </c:choose>
- </c:when>
- <c:when test="${ext.getFieldType(fieldName).type == 'NUMERIC'}">
- <c:choose>
- <c:when test="${ext.getFieldType(fieldName).hasPattern()}">
- ${fieldName}: <fmt:formatNumber value="${wikitty.getFieldAsBigDecimal(ext.name, fieldName)}"
- pattern="${ext.getFieldType(fieldName).getPattern()}"/>
- </c:when>
- <c:otherwise>
- ${fieldName}: ${wikitty.getFieldAsBigDecimal(ext.name, fieldName)}
- </c:otherwise>
- </c:choose>
- </c:when>
- <c:when test="${ext.getFieldType(fieldName).type == 'STRING'}">
- ${fieldName}: <c:out value="${wikitty.getFieldAsString(ext.name, fieldName)}"/>
- </c:when>
- <c:when test="${ext.getFieldType(fieldName).type == 'WIKITTY'}">
- <c:if test="${wikitty.getFieldAsWikitty(ext.name, fieldName, false) != null}">
- ${fieldName}: <a href="<c:url value="/wikitty/view/${wikitty.getFieldAsWikitty(ext.name, fieldName, false).getId()}"/>"><c:out value="${wikitty.getFieldAsWikitty(ext.name, fieldName, false)}"/></a>
- </c:if>
- </c:when>
- <c:otherwise>
- ${fieldName}: ${wikitty.getFieldAsObject(ext.name, fieldName)} (${ext.getFieldType(fieldName).toDefinition("")})
- </c:otherwise>
-</c:choose>
\ No newline at end of file
1
0
Author: bpoussin
Date: 2012-08-03 18:54:22 +0200 (Fri, 03 Aug 2012)
New Revision: 228
Url: http://chorem.org/repositories/revision/chorem/228
Log:
Evolution #737: Change quotation default sorting
Modified:
trunk/chorem-entities/src/main/xmi/chorem-model.properties
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-03 16:31:36 UTC (rev 227)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-03 16:54:22 UTC (rev 228)
@@ -99,10 +99,10 @@
org.chorem.entities.Note.class.tagvalue.toString=(%Note.date$tF) %Note.title|noname$s
org.chorem.entities.Note.class.tagvalue.sortOrder=Note.date
org.chorem.entities.Note.Attachment.content.tagvalue.subtype=text/rst
-org.chorem.entities.Quotation.class.tagvalue.version=12.0
+org.chorem.entities.Quotation.class.tagvalue.version=13.0
org.chorem.entities.Quotation.class.tagvalue.preload=Quotation.project;Quotation.customer;Quotation.supplier;Quotation.category
org.chorem.entities.Quotation.class.tagvalue.toString=%Interval.beginDate$tF-%Interval.endDate$tF %Quotation.reference|noref$s(%Quotation.category|noCategory$s) %Quotation.description|nodescription$s
-org.chorem.entities.Quotation.class.tagvalue.sortOrder=Interval.beginDate,Interval.endDate,Quotation.reference,Quotation.type,Quotation.description
+org.chorem.entities.Quotation.class.tagvalue.sortOrder=Interval.beginDate desc,Interval.endDate,Quotation.reference,Quotation.type,Quotation.description
org.chorem.entities.Quotation.attribute.status.tagvalue.allowed=LEAD,DRAFT,SENT,REJECTED,ACCEPTED,STARTED,DELIVERED,RSV,WARRANTY,CLOSED
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.help=Pourcentage de r\u00e9ussite du projet
org.chorem.entities.Quotation.attribute.conversionHope.tagvalue.min=0
1
0
r227 - trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions
by bpoussin@users.chorem.org 03 Aug '12
by bpoussin@users.chorem.org 03 Aug '12
03 Aug '12
Author: bpoussin
Date: 2012-08-03 18:31:36 +0200 (Fri, 03 Aug 2012)
New Revision: 227
Url: http://chorem.org/repositories/revision/chorem/227
Log:
les attachments sont telechargement directement dans les tableaux
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
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-03 15:36:56 UTC (rev 226)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-03 16:31:36 UTC (rev 227)
@@ -62,6 +62,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.servlet.ServletContext;
+import org.apache.commons.lang3.StringUtils;
/**
*
@@ -217,8 +219,29 @@
// }
// };
+ public final class AttachmentLink {
+ protected String contextPath;
+ protected Attachment attachment;
- protected <E> Map<String, List<Attachment>> prepareAttachment(ChoremClient client, Collection<E> ids) {
+ 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) {
// recherche des attachments de chaque quotation trouvee
WikittyQuery attachmentQuery = new WikittyQueryMaker().and()
.exteq(Attachment.EXT_ATTACHMENT)
@@ -229,15 +252,17 @@
client.findAllByQuery(Attachment.class, attachmentQuery);
// preparation des attachements pour chaque quotation
- Map<String, List<Attachment>> attachments = new HashMap<String, List<Attachment>>();
+ ServletContext servletContext = getContext().getServletContext();
+ String contextPath = servletContext.getContextPath();
+ Map<String, List<AttachmentLink>> attachments = new HashMap<String, List<AttachmentLink>>();
for (Attachment a : attachmentResult) {
String id = a.getTarget();
- List<Attachment> l = attachments.get(id);
+ List<AttachmentLink> l = attachments.get(id);
if (l == null) {
- l = new LinkedList<Attachment>();
+ l = new LinkedList<AttachmentLink>();
attachments.put(id, l);
}
- l.add(a);
+ l.add(new AttachmentLink(contextPath, a));
}
return attachments;
@@ -311,7 +336,7 @@
client.findAllByQuery(Quotation.class, quotationQuery);
// recherche des attachments de chaque quotation trouvee
- Map<String, List<Attachment>> attachments =
+ Map<String, List<AttachmentLink>> attachments =
prepareAttachment(client, result.getAll());
// TODO poussin 20120523 ajouer la recherche des note sur la quotation
@@ -535,7 +560,7 @@
}
// recherche des attachments de chaque quotation trouvee
- Map<String, List<Attachment>> attachments =
+ Map<String, List<AttachmentLink>> attachments =
prepareAttachment(client, invoices.getAll());
return renderView("dashboardInvoice.jsp",
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-03 15:36:56 UTC (rev 226)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-03 16:31:36 UTC (rev 227)
@@ -380,8 +380,10 @@
return map;
}
- public Render view(ChoremClient client, String id, String[] extension,
- Config config, ServletContext servletContext) {
+ public Render view(ChoremClient client, String id, String[] extension) {
+ Config config = getContext().getServerContext().getMapping().getConfig();
+ ServletContext servletContext = getContext().getServletContext();
+
log.debug("view: " + id);
Wikitty w = client.restore(id, ".*");
@@ -422,21 +424,6 @@
return renderView("view.jsp", "wikitty", w, "extensions", exts, "viewActions", viewActions);
}
- public Render extensionView(ChoremClient client, String id, String extension) {
- log.debug("view: " + id);
- Wikitty w = client.restore(id, ".*");
-
- LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
- if (w != null) {
- // Display the extensions and required ones for them
- List<String> extensionNames = Arrays.asList(extension);
- List<WikittyExtension> wikittyExtensions = client.restoreExtensionAndDependenciesLastVesion(extensionNames);
- exts.addAll(wikittyExtensions);
- }
-
- return renderView(StringUtils.lowerCase(extension) +"/view.jsp", "wikitty", w, "extensions", exts);
- }
-
public Render edit(ChoremClient client, String id, String[] extension, Call call) {
log.debug("edit: " + id);
// on preload rien, le preload sera fait a la fin
@@ -476,47 +463,6 @@
return renderView("edit.jsp", "wikitty", w, "extensions", exts);
}
-
- // A SUPPRIMER, ne sert a rien, pas la bonne methode (pour reordonner les champs)
-// /**
-// * Edit une extension et les extensions requisent de l'objet
-// *
-// * @param client
-// * @param id
-// * @param extension
-// * @param call
-// * @return
-// */
-// public Render extensionEdit(ChoremClient client, String id, String extension, Call call) {
-// log.debug("edit: " + id);
-// Wikitty w = client.restore(id, ".*");
-//
-// if (w == null) {
-// w = new WikittyImpl();
-// }
-//
-// LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
-//
-// // If extension is not null, load all required extensions too
-// List<String> extensionNames = Arrays.asList(extension);
-// List<WikittyExtension> newExts =
-// client.restoreExtensionAndDependenciesLastVesion(extensionNames);
-// w.addExtension(newExts);
-//
-// // As we want to edit a wikitty by its extensions, we should edit the required extensions too
-// // Add the extension and required ones in the list of extensions to display
-// exts.addAll(newExts);
-//
-// // si des nouvelles valeurs sont en parametre, on change les valeurs
-// // actuel du wikitty
-// Map<String, Object> params = call.getExtractParameters();
-// String error = setWikittyField(w, params);
-//
-// getContext().addInfoMessage("message", "Warning: Can't put some value in object" + error);
-//
-// return renderView(StringUtils.lowerCase(extension) + "/edit.jsp", "wikitty", w);
-// }
-
public Render save(ChoremClient client, String id, String[] extension, Call call) {
log.debug("save: " + id);
Wikitty w = client.restore(id);
1
0
03 Aug '12
Author: bpoussin
Date: 2012-08-03 17:36:56 +0200 (Fri, 03 Aug 2012)
New Revision: 226
Url: http://chorem.org/repositories/revision/chorem/226
Log:
Utilisation des objets preloaded pour l'affichage
Modified:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.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-03 15:12:53 UTC (rev 225)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardInvoice.jsp 2012-08-03 15:36:56 UTC (rev 226)
@@ -44,7 +44,7 @@
<c:forEach var="q" items="${invoices}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/view/${q.target}"/>">${q.getTarget()}</a></td>
+ <td><a href="<c:url value="/wikitty/view/${q.target}"/>">${q.getTarget(false)}</a></td>
<td><a href="<c:url value="/wikitty/Invoice/view/${q.wikittyId}"/>">${q.reference}</a></td>
<td>${q.description}</td>
<td><a href="<c:url value="/wikitty/Employee/view/${q.customer}"/>">${q.getCustomer(false)}</a></td>
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-03 15:12:53 UTC (rev 225)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/dashboardProfitability.jsp 2012-08-03 15:36:56 UTC (rev 226)
@@ -45,8 +45,8 @@
<c:forEach var="q" items="${quotations}">
<tbody>
<tr>
- <td><a href="<c:url value="/wikitty/Project/view/${q.project}"/>">${q.getProject(false).getName()}</a></td>
- <td>${q.category}</td>
+ <td><a href="<c:url value="/wikitty/Project/view/${q.project}"/>">${q.getProject(false)}</a></td>
+ <td>${q.getCategory(false)}</td>
<td><a href="<c:url value="/wikitty/Quotation/view/${q.wikittyId}"/>">${q.description}</a></td>
<td>${q.estimatedDays}</td>
<td>${q.amount}</td>
1
0
r225 - in trunk/chorem-webmotion/src/main: java/org/chorem/webmotion/actions resources webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 03 Aug '12
by bpoussin@users.chorem.org 03 Aug '12
03 Aug '12
Author: bpoussin
Date: 2012-08-03 17:12:53 +0200 (Fri, 03 Aug 2012)
New Revision: 225
Url: http://chorem.org/repositories/revision/chorem/225
Log:
Evolution #723: Be able to create linked objects from an object page
remise a plat de la facon de faire d'ajout d'action specifique pour des extensions
suppression des mapping ne servant plus et des actions associees
Added:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionCompany.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionEmployee.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionPerson.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionProject.jsp
Removed:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/LinkAction.java
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/footerPerson.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/person/
Modified:
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-03 13:56:02 UTC (rev 224)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-03 15:12:53 UTC (rev 225)
@@ -46,15 +46,20 @@
import org.nuiton.wikitty.query.WikittyQueryResult;
import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.servlet.ServletContext;
import org.debux.webmotion.server.mapping.Config;
/**
@@ -375,7 +380,8 @@
return map;
}
- public Render view(ChoremClient client, String id, String[] extension, Config config) {
+ public Render view(ChoremClient client, String id, String[] extension,
+ Config config, ServletContext servletContext) {
log.debug("view: " + id);
Wikitty w = client.restore(id, ".*");
@@ -393,11 +399,27 @@
// recherche de footer specifique aux extensions
String pathView = config.getPackageViews();
+ if (pathView == null) {
+ pathView = "";
+ }
+ pathView = "/" + pathView + "/";
+ pathView = StringUtils.replace(pathView, "\\", "/");
+ pathView = StringUtils.replace(pathView, "//", "/");
+
+ // recherche des JSP d'action specifique pour les extensions
+ List<String> viewActions = new LinkedList<String>();
for (WikittyExtension e : exts) {
-
+ String viewAction = pathView + "footer" + e.getName() + ".jsp";
+ try {
+ if (servletContext.getResource(viewAction) != null) {
+ viewActions.add(viewAction);
+ }
+ } catch (MalformedURLException eee) {
+ log.warn(String.format("Bad url '%s'", viewAction), eee);
+ }
}
- return renderView("view.jsp", "wikitty", w, "extensions", exts);
+ return renderView("view.jsp", "wikitty", w, "extensions", exts, "viewActions", viewActions);
}
public Render extensionView(ChoremClient client, String id, String extension) {
Deleted: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/LinkAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/LinkAction.java 2012-08-03 13:56:02 UTC (rev 224)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/LinkAction.java 2012-08-03 15:12:53 UTC (rev 225)
@@ -1,81 +0,0 @@
-package org.chorem.webmotion.actions;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.ChoremClient;
-import org.chorem.entities.Attachment;
-import org.chorem.entities.ContactDetails;
-import org.debux.webmotion.server.WebMotionController;
-import org.debux.webmotion.server.render.Render;
-import org.nuiton.wikitty.entities.Wikitty;
-import org.nuiton.wikitty.entities.WikittyExtension;
-import org.nuiton.wikitty.entities.WikittyImpl;
-
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
-
-/**
- * Regroup the action that links an object with an other
- *
- * @author ymartel <martel(a)codelutin.com>
- */
-public class LinkAction extends WebMotionController {
-
- static private Log log = LogFactory.getLog(LinkAction.class);
-
- public Render addAttachment(ChoremClient client, String wikittyId) {
- if (log.isDebugEnabled()) {
- log.debug("add attachment for : " + wikittyId);
- }
-
- // Prepare attachment
- Wikitty attachment = new WikittyImpl();
-
- // Load Attachment extension, and potential dependencies
- List<String> extensionNames = Arrays.asList(Attachment.EXT_ATTACHMENT);
- List<WikittyExtension> newExts =
- client.restoreExtensionAndDependenciesLastVesion(extensionNames);
- attachment.addExtension(newExts);
-
- // As we want to edit a wikitty by its extensions, we should edit the required extensions too
- // Add the extension and required ones in the list of extensions to display
- LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
- exts.addAll(newExts);
- // Show all wikitty if no extension were mentioned
- exts.addAll(attachment.getExtensions());
-
- // Link target Wikitty
- Wikitty linkedWikitty = client.restore(wikittyId, ".*");
- attachment.setField(Attachment.EXT_ATTACHMENT, Attachment.FIELD_ATTACHMENT_TARGET, linkedWikitty);
-
- return renderView("edit.jsp", "wikitty", attachment, "extensions", exts);
- }
-
- public Render addContactDetails(ChoremClient client, String wikittyId) {
- if (log.isDebugEnabled()) {
- log.debug("add contact drtails for : " + wikittyId);
- }
- Wikitty w = client.restore(wikittyId, ".*");
-
- Wikitty attachment = new WikittyImpl();
-
- LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
-
- // Load Attachment extension, and potential dependencies
- List<String> extensionNames = Arrays.asList(ContactDetails.EXT_CONTACTDETAILS);
- List<WikittyExtension> newExts =
- client.restoreExtensionAndDependenciesLastVesion(extensionNames);
- attachment.addExtension(newExts);
-
- // As we want to edit a wikitty by its extensions, we should edit the required extensions too
- // Add the extension and required ones in the list of extensions to display
- exts.addAll(newExts);
- // Show all wikitty if no extension were mentioned
- exts.addAll(attachment.getExtensions());
-
- attachment.setField(ContactDetails.EXT_CONTACTDETAILS, ContactDetails.FIELD_CONTACTDETAILS_TARGET, w);
- return renderView("edit.jsp", "wikitty", attachment, "extensions", exts);
- }
-
-}
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2012-08-03 13:56:02 UTC (rev 224)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2012-08-03 15:12:53 UTC (rev 225)
@@ -14,8 +14,6 @@
[actions]
* / view:index.jsp
* /wikitty/{extension}/search action:GenericAction.search
-* /wikitty/Employee/view/{id} action:GenericAction.extensionView extension=Employee
-* /wikitty/Person/view/{id} action:GenericAction.extensionView extension=Person
* /wikitty/{extension}/view/{id} action:GenericAction.view
* /wikitty/{extension}/edit/{id} action:GenericAction.edit
* /wikitty/{extension}/delete/{id} action:GenericAction.delete
Deleted: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/footerPerson.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/footerPerson.jsp 2012-08-03 13:56:02 UTC (rev 224)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/footerPerson.jsp 2012-08-03 15:12:53 UTC (rev 225)
@@ -1,26 +0,0 @@
-<%--
- #%L
- Chorem webmotion
- $Id:$
- $HeadURL:$
- %%
- Copyright (C) 2011 - 2012 CodeLutin
- %%
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- #L%
- --%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-
-<jsp:include page="/wikitty/search?query=${wikitty.id} id!=${wikitty.id}"/>
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2012-08-03 13:56:02 UTC (rev 224)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2012-08-03 15:12:53 UTC (rev 225)
@@ -42,22 +42,17 @@
</dl>
</c:forEach>
-<p>
+<div class="container">
<c:if test="${not empty wikitty}">
- <p>
- <a class="btn btn-success" href="<c:url value="/wikitty/Attachment/edit/new?Attachment.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
- </p>
- <p>
- <a class="btn btn-success" href="<c:url value="/wikitty/Note/edit/new?Note.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Note</a>
- </p>
+ <a class="btn btn-success" href="<c:url value="/wikitty/Attachment/edit/new?Attachment.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/Note/edit/new?Note.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Note</a>
</c:if>
-</p>
+ <c:forEach var="viewAction" items="${viewActions}">
+ <jsp:include page="${viewAction}"/>
+ </c:forEach>
+</div>
+
<div class="container">
<jsp:include page="/wikitty/searchRelated?id=${wikitty.id}"/>
-<%--
- <c:forEach var="ext" items="${extensions}">
- <jsp:include page="footer${ext.name}.jsp"/>
- </c:forEach>
---%>
</div>
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionCompany.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionCompany.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionCompany.jsp 2012-08-03 15:12:53 UTC (rev 225)
@@ -0,0 +1,26 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<a class="btn btn-success" href="<c:url value="/wikitty/ContactDetails/edit/new?ContactDetails.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionEmployee.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionEmployee.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionEmployee.jsp 2012-08-03 15:12:53 UTC (rev 225)
@@ -0,0 +1,26 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<a class="btn btn-success" href="<c:url value="/wikitty/ContactDetails/edit/new?ContactDetails.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionPerson.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionPerson.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionPerson.jsp 2012-08-03 15:12:53 UTC (rev 225)
@@ -0,0 +1,26 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<a class="btn btn-success" href="<c:url value="/wikitty/ContactDetails/edit/new?ContactDetails.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionProject.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionProject.jsp (rev 0)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/viewActionProject.jsp 2012-08-03 15:12:53 UTC (rev 225)
@@ -0,0 +1,26 @@
+<%--
+ #%L
+ Chorem webmotion
+ $Id:$
+ $HeadURL:$
+ %%
+ Copyright (C) 2011 - 2012 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+
+<a class="btn btn-success" href="<c:url value="/wikitty/Quotation/edit/new?Quotation.project=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Quotation</a>
1
0
03 Aug '12
Author: bpoussin
Date: 2012-08-03 15:56:02 +0200 (Fri, 03 Aug 2012)
New Revision: 224
Url: http://chorem.org/repositories/revision/chorem/224
Log:
Evolution #734: Be able to add comment on objects
Suppression de l'ancienne facon de faire pour les Attachments et les ContactDetails (qui n'etait pas la bonne)
Utilisation de la nouvelle facon pour les Notes
Devrait etre facilement reutilisable pour precharge d'autre type d'objet:
exemple, un addEmployee a partir d'une societe; un addQuotation sur un Project, ...
suppression de la company/view.jsp qui ne servait qu'a ordonner les champs (mauvaise facon de faire)[A
Removed:
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/company/
Modified:
trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java
trunk/chorem-entities/src/main/xmi/chorem-model.properties
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java
trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
trunk/chorem-webmotion/src/main/resources/mapping
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/person/view.jsp
trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp
Modified: trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-entities/src/main/java/org/chorem/ChoremClient.java 2012-08-03 13:56:02 UTC (rev 224)
@@ -118,6 +118,7 @@
exts.addAll(org.chorem.entities.ConfigurationAbstract.extensions);
exts.addAll(org.chorem.entities.CategoryAbstract.extensions);
exts.addAll(org.chorem.entities.AttachmentAbstract.extensions);
+ exts.addAll(org.chorem.entities.NoteAbstract.extensions);
exts.addAll(org.chorem.entities.CompanyAbstract.extensions);
exts.addAll(org.chorem.entities.ContactDetailsAbstract.extensions);
exts.addAll(org.chorem.entities.EmployeeAbstract.extensions);
Modified: trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java
===================================================================
--- trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-entities/src/main/java/org/chorem/entities/QuotationStatus.java 2012-08-03 13:56:02 UTC (rev 224)
@@ -32,13 +32,14 @@
*/
public enum QuotationStatus {
+ LEAD, // piste possible
DRAFT, // en cours de redaction
- SEND, // envoye
+ SENT, // envoye
REJECTED, // refuse par le client
ACCEPTED, // accepte par le client (on peut envoyer la facture de debut)
STARTED, // developpement commence
- DELIVERED, // developpement fini et livre (on peut envoyer la facture de fin)
- VRS, // l'application est en verification en service regulier chez le client (~1 mois)
+ DELIVERED, // developpement fini et livre (on peut envoyer la facture de fin)
+ RSV, // l'application est en verification en service regulier chez le client (~1 mois)
WARRANTY, // fin de la vsr, on passe en garantie et on peut facture le reste (s'il reste encore des choses)
CLOSED // tout est fini et clos, plus rien a faire
Modified: trunk/chorem-entities/src/main/xmi/chorem-model.properties
===================================================================
--- trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-entities/src/main/xmi/chorem-model.properties 2012-08-03 13:56:02 UTC (rev 224)
@@ -95,6 +95,10 @@
org.chorem.entities.Attachment.class.tagvalue.version=7.0
org.chorem.entities.Attachment.class.tagvalue.toString=%Attachment.name|noname$s (%Attachment.mimetype|notype$s) %Attachment.date$tF
org.chorem.entities.Attachment.class.tagvalue.sortOrder=Attachment.name,Attachment.mimetype,Attachment.date
+org.chorem.entities.Note.class.tagvalue.version=2.0
+org.chorem.entities.Note.class.tagvalue.toString=(%Note.date$tF) %Note.title|noname$s
+org.chorem.entities.Note.class.tagvalue.sortOrder=Note.date
+org.chorem.entities.Note.Attachment.content.tagvalue.subtype=text/rst
org.chorem.entities.Quotation.class.tagvalue.version=12.0
org.chorem.entities.Quotation.class.tagvalue.preload=Quotation.project;Quotation.customer;Quotation.supplier;Quotation.category
org.chorem.entities.Quotation.class.tagvalue.toString=%Interval.beginDate$tF-%Interval.endDate$tF %Quotation.reference|noref$s(%Quotation.category|noCategory$s) %Quotation.description|nodescription$s
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-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/DashboardAction.java 2012-08-03 13:56:02 UTC (rev 224)
@@ -395,14 +395,14 @@
}
public Render quotation(ChoremClient client, String query) {
- EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.DRAFT, QuotationStatus.SEND);
+ EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.LEAD, QuotationStatus.SENT);
String jsp = "dashboardQuotation.jsp";
String title = "Les propositions en attente de réponse";
return quotationFilter(client, query, status, jsp, title, false);
}
public Render projectOpen(ChoremClient client, String query) {
- EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.ACCEPTED, QuotationStatus.VRS);
+ EnumSet<QuotationStatus> status = EnumSet.range(QuotationStatus.ACCEPTED, QuotationStatus.RSV);
String jsp = "dashboardProject.jsp";
String title = "Les projets en cours";
return quotationFilter(client, query, status, jsp, title, true);
Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java
===================================================================
--- trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-08-03 13:56:02 UTC (rev 224)
@@ -55,6 +55,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.debux.webmotion.server.mapping.Config;
/**
*
@@ -374,7 +375,7 @@
return map;
}
- public Render view(ChoremClient client, String id, String[] extension) {
+ public Render view(ChoremClient client, String id, String[] extension, Config config) {
log.debug("view: " + id);
Wikitty w = client.restore(id, ".*");
@@ -389,7 +390,13 @@
exts.addAll(wikittyExtensions);
}
}
+
+ // recherche de footer specifique aux extensions
+ String pathView = config.getPackageViews();
+ for (WikittyExtension e : exts) {
+ }
+
return renderView("view.jsp", "wikitty", w, "extensions", exts);
}
@@ -408,18 +415,22 @@
return renderView(StringUtils.lowerCase(extension) +"/view.jsp", "wikitty", w, "extensions", exts);
}
- public Render edit(ChoremClient client, String id, String[] extension) {
+ public Render edit(ChoremClient client, String id, String[] extension, Call call) {
log.debug("edit: " + id);
- Wikitty w = client.restore(id, ".*");
+ // on preload rien, le preload sera fait a la fin
+ Wikitty w = client.restore(id, "");
+ // si on ne retrouve pas l'objet demande, on en edit un nouveau
if (w == null) {
w = new WikittyImpl();
}
LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
- // If extension is not null, load all required extensions too
- if (extension != null) {
+ if (extension == null) {
+ // Show all wikitty if no extension were mentioned
+ exts.addAll(w.getExtensions());
+ } else {
// Be sure that the wikitty has good extension if wanted and their requirements
List<String> extensionNames = Arrays.asList(extension);
List<WikittyExtension> newExts =
@@ -431,37 +442,59 @@
exts.addAll(newExts);
}
- if (extension == null) {
- // Show all wikitty if no extension were mentioned
- exts.addAll(w.getExtensions());
- }
+ // si des nouvelles valeurs sont en parametre, on change les valeurs
+ // actuel du wikitty
+ Map<String, Object> params = call.getExtractParameters();
+ String error = setWikittyField(w, params);
+ // on recharge des entites qui ont pu apparaitre, pour pouvoir les afficher comme il faut
+ client.preload(Collections.singleton(w), ".*");
+ getContext().addInfoMessage("message", "Warning: Can't put some value in object" + error);
+
return renderView("edit.jsp", "wikitty", w, "extensions", exts);
}
- public Render extensionEdit(ChoremClient client, String id, String extension) {
- log.debug("edit: " + id);
- Wikitty w = client.restore(id, ".*");
- if (w == null) {
- w = new WikittyImpl();
- }
+ // A SUPPRIMER, ne sert a rien, pas la bonne methode (pour reordonner les champs)
+// /**
+// * Edit une extension et les extensions requisent de l'objet
+// *
+// * @param client
+// * @param id
+// * @param extension
+// * @param call
+// * @return
+// */
+// public Render extensionEdit(ChoremClient client, String id, String extension, Call call) {
+// log.debug("edit: " + id);
+// Wikitty w = client.restore(id, ".*");
+//
+// if (w == null) {
+// w = new WikittyImpl();
+// }
+//
+// LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
+//
+// // If extension is not null, load all required extensions too
+// List<String> extensionNames = Arrays.asList(extension);
+// List<WikittyExtension> newExts =
+// client.restoreExtensionAndDependenciesLastVesion(extensionNames);
+// w.addExtension(newExts);
+//
+// // As we want to edit a wikitty by its extensions, we should edit the required extensions too
+// // Add the extension and required ones in the list of extensions to display
+// exts.addAll(newExts);
+//
+// // si des nouvelles valeurs sont en parametre, on change les valeurs
+// // actuel du wikitty
+// Map<String, Object> params = call.getExtractParameters();
+// String error = setWikittyField(w, params);
+//
+// getContext().addInfoMessage("message", "Warning: Can't put some value in object" + error);
+//
+// return renderView(StringUtils.lowerCase(extension) + "/edit.jsp", "wikitty", w);
+// }
- LinkedHashSet<WikittyExtension> exts = new LinkedHashSet<WikittyExtension>();
-
- // If extension is not null, load all required extensions too
- List<String> extensionNames = Arrays.asList(extension);
- List<WikittyExtension> newExts =
- client.restoreExtensionAndDependenciesLastVesion(extensionNames);
- w.addExtension(newExts);
-
- // As we want to edit a wikitty by its extensions, we should edit the required extensions too
- // Add the extension and required ones in the list of extensions to display
- exts.addAll(newExts);
-
- return renderView(StringUtils.lowerCase(extension) + "/edit.jsp", "wikitty", w);
- }
-
public Render save(ChoremClient client, String id, String[] extension, Call call) {
log.debug("save: " + id);
Wikitty w = client.restore(id);
@@ -472,6 +505,23 @@
client.restoreExtensionAndDependenciesLastVesion(Arrays.asList(extension));
w.addExtension(exts);
Map<String, Object> params = call.getExtractParameters();
+ String error = setWikittyField(w, params);
+ client.store(w);
+
+ getContext().addInfoMessage("message", "Object saved" + error);
+
+ return renderURL("/wikitty/view/"+w.getId());
+ }
+
+ /**
+ * Modifie les valeurs de l'objet passe en parametre avec les valeurs de
+ * champs que l'on arrive a retrouver dans le params.
+ *
+ * @param w Le wikitty a mettre a jour
+ * @param params les parametres dans lequel on peut trouver des valeurs
+ * @return une chaine representant toutes les erreurs rencontrees
+ */
+ protected String setWikittyField(Wikitty w, Map<String, Object> params) {
String error = "";
for (String fqfield : params.keySet()) {
if (w.hasField(fqfield)) {
@@ -482,13 +532,17 @@
v = file.getFile();
} else {
String[] values = (String[]) params.get(fqfield);
- System.out.println("ZZZZ fqfield:"+fqfield+" values: " + Arrays.toString(values) + " size:" + values.length);
+ if (log.isDebugEnabled()) {
+ log.debug("ZZZZ fqfield:"+fqfield+" values: " + Arrays.toString(values) + " size:" + values.length);
+ }
if (w.getFieldType(fqfield).isCollection()) {
if (values.length == 1 && w.getFieldType(fqfield).getType() == WikittyTypes.WIKITTY) {
// petit hack si l'editeur utilise n'est pas un select,
// mais un input (et donc des valeurs separees par des ','
values = StringUtils.split(values[0], ",");
- System.out.println("YYYY " + Arrays.toString(values) + " size: " + values.length);
+ if (log.isDebugEnabled()) {
+ log.debug("YYYY " + Arrays.toString(values) + " size: " + values.length);
+ }
}
v = values;
} else {
@@ -497,7 +551,10 @@
}
try {
w.setFqField(fqfield, v);
- System.out.println("XXX after field: " + w.getFqField(fqfield) + "(" + ClassUtils.getSimpleName(w.getFqField(fqfield), "NULLclasse!!!") + ")");
+ if (log.isDebugEnabled()) {
+ log.debug("XXX after field: " + w.getFqField(fqfield) +
+ "(" + ClassUtils.getSimpleName(w.getFqField(fqfield), "NULLclasse!!!") + ")");
+ }
} catch (Exception eee) {
String msg = String.format("Can't put value '%s' in field '%s'", v, fqfield);
error += "\n<li>" + msg + "</li>";
@@ -505,11 +562,7 @@
}
}
}
- client.store(w);
-
- getContext().addInfoMessage("message", "Object saved" + error);
-
- return renderURL("/wikitty/view/"+w.getId());
+ return error;
}
public Render delete(ChoremClient client, String id, String[] extension) {
Modified: trunk/chorem-webmotion/src/main/resources/mapping
===================================================================
--- trunk/chorem-webmotion/src/main/resources/mapping 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-webmotion/src/main/resources/mapping 2012-08-03 13:56:02 UTC (rev 224)
@@ -15,12 +15,9 @@
* / view:index.jsp
* /wikitty/{extension}/search action:GenericAction.search
* /wikitty/Employee/view/{id} action:GenericAction.extensionView extension=Employee
-* /wikitty/Person/view/{id} action:GenericAction.extensionView extension=Person
+* /wikitty/Person/view/{id} action:GenericAction.extensionView extension=Person
* /wikitty/{extension}/view/{id} action:GenericAction.view
-* /wikitty/Company/edit/{id} action:GenericAction.extensionEdit extension=Company
* /wikitty/{extension}/edit/{id} action:GenericAction.edit
-* /wikitty/{wikittyId}/Attachment/edit/new action:LinkAction.addAttachment
-* /wikitty/{wikittyId}/ContactDetails/edit/new action:LinkAction.addContactDetails
* /wikitty/{extension}/delete/{id} action:GenericAction.delete
* /wikitty/search action:GenericAction.search
* /wikitty/searchRelated?id={query} action:GenericAction.search
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp 2012-08-03 13:56:02 UTC (rev 224)
@@ -51,10 +51,10 @@
</dl>
<p>
- <a class="btn btn-success" href="<c:url value="/wikitty/${wikitty.id}/Attachment/edit/new"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/Attachment/edit/new?Attachment.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
</p>
<p>
- <a class="btn btn-success" href="<c:url value="/wikitty/${wikitty.id}/ContactDetails/edit/new"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/ContactDetails/edit/new?ContactDetails.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
</p>
<div class="container">
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/person/view.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/person/view.jsp 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/person/view.jsp 2012-08-03 13:56:02 UTC (rev 224)
@@ -42,10 +42,10 @@
</dl>
<p>
- <a class="btn btn-success" href="<c:url value="/wikitty/${wikitty.id}/Attachment/edit/new"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/Attachment/edit/new?Attachment.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
</p>
<p>
- <a class="btn btn-success" href="<c:url value="/wikitty/${wikitty.id}/ContactDetails/edit/new"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/ContactDetails/edit/new?ContactDetails.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a>
</p>
<div class="container">
Modified: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp
===================================================================
--- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2012-08-03 13:49:37 UTC (rev 223)
+++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/view.jsp 2012-08-03 13:56:02 UTC (rev 224)
@@ -45,8 +45,11 @@
<p>
<c:if test="${not empty wikitty}">
<p>
- <a class="btn btn-success" href="<c:url value="/wikitty/${wikitty.id}/Attachment/edit/new"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
+ <a class="btn btn-success" href="<c:url value="/wikitty/Attachment/edit/new?Attachment.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Attachment</a>
</p>
+ <p>
+ <a class="btn btn-success" href="<c:url value="/wikitty/Note/edit/new?Note.target=${wikitty.id}"/>"><i class="icon-plus icon-white"></i> Add Note</a>
+ </p>
</c:if>
</p>
1
0
Author: bpoussin
Date: 2012-08-03 15:49:37 +0200 (Fri, 03 Aug 2012)
New Revision: 223
Url: http://chorem.org/repositories/revision/chorem/223
Log:
ajout d'un fichier de doc pour les developpeurs, le but
est d'y mettre comment faire les choses et comment sont faites
les choses.
Added:
trunk/src/site/rst/doc-devel.rst
Added: trunk/src/site/rst/doc-devel.rst
===================================================================
--- trunk/src/site/rst/doc-devel.rst (rev 0)
+++ trunk/src/site/rst/doc-devel.rst 2012-08-03 13:49:37 UTC (rev 223)
@@ -0,0 +1,16 @@
+=========================
+Documentation développeur
+=========================
+
+Ajout d'une entité
+==================
+
+* Modifier le fichier ArgoUML chorem-model.zargo
+* Modifier le fichier chorem-model.properties pour ajouter les informations de version et autre pour cette entité
+* Ajouter cette entité dans la liste des entités qui doivent exister dans le système dans le fichier ChoremClient.java
+
+Modification d'une list de choix possible pour un attribut
+==========================================================
+
+* Modifier le fichier chorem-model.properties pour ajouter l'enumeration sur le champs choisi
+* Modifier ou créer le l'enumeration Java correspondante pour la manipuler dans le code Java (chorem-entities - org.chorem.entities.XXXX)
1
0