src/main/webapp/WEB-INF/jsp/version-form.jsp

changeset 76
82f71fb1758a
parent 75
33b6843fdf8a
child 78
bb4c52bf3439
--- a/src/main/webapp/WEB-INF/jsp/version-form.jsp	Fri May 22 21:23:57 2020 +0200
+++ b/src/main/webapp/WEB-INF/jsp/version-form.jsp	Sat May 23 13:24:49 2020 +0200
@@ -30,8 +30,8 @@
 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
 
 <c:set scope="page" var="moduleInfo" value="${requestScope[Constants.REQ_ATTR_MODULE_INFO]}"/>
-<c:set scope="page" var="selectedProject" value="${sessionScope[ProjectsModule.SESSION_ATTR_SELECTED_PROJECT]}"/>
 
+<jsp:useBean id="projects" type="java.util.List<de.uapcore.lightpit.entities.Project>" scope="request" />
 <jsp:useBean id="version" type="de.uapcore.lightpit.entities.Version" scope="request"/>
 <jsp:useBean id="versionStatusEnum" type="de.uapcore.lightpit.entities.VersionStatus[]" scope="request"/>
 
@@ -43,6 +43,18 @@
         </colgroup>
         <tbody>
         <tr>
+            <th><fmt:message key="thead.version.project"/></th>
+            <td>
+                <select name="pid" required>
+                    <c:forEach var="project" items="${projects}">
+                        <option value="${project.id}" <c:if test="${project eq version.project}">selected</c:if> >
+                            <c:out value="${project.name}" />
+                        </option>
+                    </c:forEach>
+                </select>
+            </td>
+        </tr>
+        <tr>
             <th><fmt:message key="thead.version.name"/></th>
             <td><input name="name" type="text" maxlength="20" required value="<c:out value="${version.name}"/>" /></td>
         </tr>
@@ -69,7 +81,15 @@
         <tr>
             <td colspan="2">
                 <input type="hidden" name="id" value="${version.id}"/>
-                <a href="./${moduleInfo.modulePath}/view?pid=${version.project.id}" class="button">
+                <c:choose>
+                    <c:when test="${not empty version.project and version.project.id ge 0}">
+                        <c:set var="cancelUrl">./${moduleInfo.modulePath}/view?pid=${version.project.id}</c:set>
+                    </c:when>
+                    <c:otherwise>
+                        <c:set var="cancelUrl">./${moduleInfo.modulePath}/</c:set>
+                    </c:otherwise>
+                </c:choose>
+                <a href="${cancelUrl}" class="button">
                     <fmt:message bundle="${lightpit_bundle}" key="button.cancel"/>
                 </a>
                 <button type="submit"><fmt:message bundle="${lightpit_bundle}" key="button.okay"/></button>

mercurial