lists-form.jsp 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  5. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
  6. <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
  7. <html>
  8. <head profile="<c:url value="/profile.txt"/>">
  9. <title><fmt:message key="lists.title"/></title>
  10. <link media="screen" href="<c:url value="/css/global.css"/>" type="text/css" rel="stylesheet" />
  11. <script type="text/javascript">
  12. <!--
  13. function changeList(select) {
  14. select.form.submit();
  15. }
  16. // -->
  17. </script>
  18. </head>
  19. <body>
  20. <jsp:include page="nav-header.jsp"/>
  21. <h1><fmt:message key="lists.title"/></h1>
  22. <spring:hasBindErrors name="command">
  23. <div class="error-intro">
  24. <spring:bind path="command">
  25. <c:choose>
  26. <c:when test="${status.errors.errorCount > 1}">
  27. <ul>
  28. <c:forEach items="${status.errors.allErrors}" var="error">
  29. <li>
  30. <spring:message code="${error.code}" arguments="${error.arguments}"/><br />
  31. </li>
  32. </c:forEach>
  33. </ul>
  34. </c:when>
  35. <c:when test="${status.errors.errorCount == 1}">
  36. <c:set var="error" value="${status.errors.allErrors[0]}"/>
  37. <spring:message code="${error.code}" arguments="${error.arguments}"/><br />
  38. </c:when>
  39. </c:choose>
  40. </spring:bind>
  41. </div>
  42. </spring:hasBindErrors>
  43. <c:choose>
  44. <c:when test="${updateCount > 0}">
  45. <div class="error-intro">
  46. <fmt:message key="lists.updated">
  47. <fmt:param value="${updateCount}"/>
  48. </fmt:message>
  49. </div>
  50. </c:when>
  51. <c:otherwise>
  52. <p><fmt:message key="lists.intro"/></p>
  53. </c:otherwise>
  54. </c:choose>
  55. <%-- Domain object drop-down menu --%>
  56. <form method="get" action="<c:url value="/setup/lists.do"/>">
  57. <table class="form">
  58. <tr>
  59. <th><fmt:message key="lists.list.displayName"/></th>
  60. <td>
  61. <spring:bind path="command.beanClass">
  62. <select name="<c:out value="${status.expression}"/>"
  63. onchange="changeList(this)">
  64. <option value=""/>
  65. <option value="magoffin.matt.ieat.domain.impl.BaseImpl" <c:if
  66. test="${status.value.name ==
  67. 'magoffin.matt.ieat.domain.impl.BaseImpl'}">selected="selected"</c:if>
  68. ><fmt:message key="recipe.base.displayName"/></option>
  69. <option value="magoffin.matt.ieat.domain.impl.CourseImpl" <c:if
  70. test="${status.value.name ==
  71. 'magoffin.matt.ieat.domain.impl.CourseImpl'}">selected="selected"</c:if>
  72. ><fmt:message key="recipe.course.displayName"/></option>
  73. <option value="magoffin.matt.ieat.domain.impl.DifficultyImpl" <c:if
  74. test="${status.value.name ==
  75. 'magoffin.matt.ieat.domain.impl.DifficultyImpl'}">selected="selected"</c:if>
  76. ><fmt:message key="recipe.difficulty.displayName"/></option>
  77. <option value="magoffin.matt.ieat.domain.impl.EthnicityImpl" <c:if
  78. test="${status.value.name ==
  79. 'magoffin.matt.ieat.domain.impl.EthnicityImpl'}">selected="selected"</c:if>
  80. ><fmt:message key="recipe.ethnicity.displayName"/></option>
  81. <option value="magoffin.matt.ieat.domain.impl.IngredientImpl" <c:if
  82. test="${status.value.name ==
  83. 'magoffin.matt.ieat.domain.impl.IngredientImpl'}">selected="selected"</c:if>
  84. ><fmt:message key="recipe.ingredient.ingredient.displayName"/></option>
  85. <option value="magoffin.matt.ieat.domain.impl.PrepTimeImpl" <c:if
  86. test="${status.value.name ==
  87. 'magoffin.matt.ieat.domain.impl.PrepTimeImpl'}">selected="selected"</c:if>
  88. ><fmt:message key="recipe.prepTime.displayName"/></option>
  89. </select> <br />
  90. </spring:bind>
  91. </td>
  92. </tr>
  93. <tr>
  94. <th><fmt:message key="language.displayName"/></th>
  95. <td class="readonly">${pageContext.request.locale.language}</td>
  96. </tr>
  97. </table>
  98. </form>
  99. <c:if test="${fn:length(command.beans) > 0}">
  100. <hr />
  101. <form method="post" action="<c:url value="/setup/lists.do"/>">
  102. <table class="form">
  103. <tr>
  104. <c:forEach var="prop" items="${meta[command.beanClass.name].properties}" varStatus="status">
  105. <th>${prop.displayName}</th>
  106. </c:forEach>
  107. <th><fmt:message key="lists.remove.displayName"/></th>
  108. <th><fmt:message key="lists.reassign.displayName"/></th>
  109. </tr>
  110. <c:forEach var="item" items="${command.beans}" varStatus="idxStatus">
  111. <tr<c:if test="${(idxStatus.index % 2) == 1}"> class="even"</c:if>>
  112. <spring:bind path="command.beans[${idxStatus.index}]">
  113. <c:forEach var="prop" items="${meta[command.beanClass.name].properties}">
  114. <td>
  115. <c:choose>
  116. <c:when test="${prop.primaryKey}">
  117. ${item[prop.name]}
  118. <input type="hidden" name="${status.expression}['${prop.name}']"
  119. value="${item[prop.name]}"/>
  120. <c:set var="primaryKeyPropName" value="${prop.name}" scope="page"/>
  121. </c:when>
  122. <c:when test="${prop.type == 3}">
  123. </c:when>
  124. <c:otherwise>
  125. <input type="text" name="${status.expression}['${prop.name}']" value="${item[prop.name]}"
  126. <c:if test="${prop.length > 0}">
  127. maxlength="${prop.length}"
  128. </c:if>
  129. />
  130. <c:set var="origName">_orig_${prop.name}</c:set>
  131. <input type="hidden" name="${status.expression}['_orig_${prop.name}']"
  132. value="${item[origName]}"/>
  133. </c:otherwise>
  134. </c:choose>
  135. </td>
  136. </c:forEach>
  137. <td>
  138. <input type="checkbox" name="${status.expression}['_delete_']"
  139. value="true"/>
  140. </td>
  141. <td>
  142. <input type="radio" name="reassignPrimaryKey"
  143. value="${command.beans[idxStatus.index][primaryKeyPropName]}"/>
  144. </td>
  145. </spring:bind>
  146. </tr>
  147. </c:forEach>
  148. <tr>
  149. <spring:bind path="command.newBean">
  150. <c:forEach var="prop" items="${meta[command.beanClass.name].properties}">
  151. <td>
  152. <c:choose>
  153. <c:when test="${prop.primaryKey}">
  154. <fmt:message key="lists.new.displayName"/>
  155. </c:when>
  156. <c:when test="${prop.type == 3}">
  157. </c:when>
  158. <c:otherwise>
  159. <input type="text" name="${status.expression}['${prop.name}']" value="${item[prop.name]}"
  160. <c:if test="${prop.length > 0}">
  161. maxlength="${prop.length}"
  162. </c:if>
  163. />
  164. </c:otherwise>
  165. </c:choose>
  166. </td>
  167. </c:forEach>
  168. <td></td>
  169. <td></td>
  170. </spring:bind>
  171. </tr>
  172. </table>
  173. <div>
  174. <input type="hidden" name="beanClass" value="${command.beanClass.name}"/>
  175. <input type="submit" name="_finish" value="<fmt:message key="save.displayName"/>"/>
  176. </div>
  177. </form>
  178. </c:if>
  179. </body>
  180. </html>