Author: ymartel Date: 2012-07-02 18:56:13 +0200 (Mon, 02 Jul 2012) New Revision: 202 Url: http://chorem.org/repositories/revision/chorem/202 Log: add some specific pages : one for employee view & contact edit Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/company/ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/company/edit.jsp trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp Modified: trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java trunk/chorem-webmotion/src/main/resources/mapping 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-07-02 10:03:29 UTC (rev 201) +++ trunk/chorem-webmotion/src/main/java/org/chorem/webmotion/actions/GenericAction.java 2012-07-02 16:56:13 UTC (rev 202) @@ -382,6 +382,21 @@ return renderView("view.jsp", "wikitty", w, "extensions", exts); } + 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) { log.debug("edit: " + id); Wikitty w = client.restore(id, ".*"); @@ -413,6 +428,29 @@ 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(); + } + + 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 addAttachment(ChoremClient client, String wikittyId) { log.debug("add attachment for : " + wikittyId); Wikitty w = client.restore(wikittyId, ".*"); Modified: trunk/chorem-webmotion/src/main/resources/mapping =================================================================== --- trunk/chorem-webmotion/src/main/resources/mapping 2012-07-02 10:03:29 UTC (rev 201) +++ trunk/chorem-webmotion/src/main/resources/mapping 2012-07-02 16:56:13 UTC (rev 202) @@ -14,7 +14,9 @@ [actions] * / view:index.jsp * /wikitty/{extension}/search action:GenericAction.search +* /wikitty/Employee/view/{id} action:GenericAction.extensionView extension=Employee * /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:GenericAction.addAttachment * /wikitty/{extension}/delete/{id} action:GenericAction.delete Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/company/edit.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/company/edit.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/company/edit.jsp 2012-07-02 16:56:13 UTC (rev 202) @@ -0,0 +1,44 @@ +<%-- + #%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 uri="/WEB-INF/wikitty.tld" prefix="w"%> + +<c:if test="${not empty wikitty}"> + <%//FIXME ymartel 2012/07/02 fix the need of iso accept charset ? %> + <form class="form-inline" method="post" accept-charset="ISO-8859-15" action="<c:url value="/wikitty/save"/>" enctype="multipart/form-data"> + <input type="hidden" name="id" value="${wikitty.id}"/> + <p> + <button class="btn btn-success" type="submit"><i class="icon-ok icon-white"></i> Save</button> + <a class="btn btn-info" href="/wikitty/view/${wikitty.id}"><i class="icon-remove icon-white"></i> Cancel</a> + </p> + + <p> + <input type="hidden" name="extension" value="Company"> + <dl><dt>Company</dt> + <dd>Nom : <w:input wikitty="${wikitty}" fqfield="Company.name"/> </dd> + <dd>Type : <w:input wikitty="${wikitty}" fqfield="Company.type"/> </dd> + </dl> + </p> + </form> +</c:if> Added: trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp =================================================================== --- trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp (rev 0) +++ trunk/chorem-webmotion/src/main/webapp/WEB-INF/jsp/employee/view.jsp 2012-07-02 16:56:13 UTC (rev 202) @@ -0,0 +1,62 @@ +<%-- + #%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 uri="/WEB-INF/wikitty.tld" prefix="w"%> + +<p> + <c:if test="${not empty wikitty}"> + <a class="btn btn-success" href="<c:url value="/wikitty/view/${wikitty.id}"/>"><i class="icon-list icon-white"></i> View all extension</a> + <a class="btn btn-success" href="<c:url value="/wikitty/edit/${wikitty.id}"/>"><i class="icon-pencil icon-white"></i> Edit object</a> + <a class="btn btn-danger" href="<c:url value="/wikitty/delete/${wikitty.id}?wmDecoratorNo=true"/>"><i class="icon-trash icon-white"></i> Delete object</a> + </c:if> +</p> + + <dl><dt><a href="<c:url value="/wikitty/Employee/search"/>">Employé</a> + <a class="btn btn-success btn-mini" href="<c:url value="/wikitty/Employee/edit/${wikitty.id}"/>"><i class="icon-pencil icon-white"></i> Edit</a> + <a class="btn btn-danger btn-mini" href="<c:url value="/wikitty/delete/${wikitty.id}?extension=Employee&wmDecoratorNo=true"/>"><i class="icon-trash icon-white"></i> Delete</a></dt> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.company"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.person"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.description"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.salary"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.paidLeave"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.rtt"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.type"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Employee.workingTime"/></dd> + </dl> + <dl> + <dt><a href="<c:url value="/wikitty/search?extension=${ext.name}"/>">${ext.name}</a> + <dd><w:display wikitty="${wikitty}" fqfield="Interval.beginDate"/></dd> + <dd><w:display wikitty="${wikitty}" fqfield="Interval.endDate"/></dd> + </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> + </p> + <p> + <a class="btn btn-success" href="<c:url value="/wikitty/ContactDetails/edit/new"/>"><i class="icon-plus icon-white"></i> Add Contact Details</a> + </p> + +<div class="container"> + <jsp:include page="/wikitty/searchRelated?id=${wikitty.id}"/> +</div>