<%@ page language="java"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%> 
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<html:html locale="true">
  <head>
    <html:base />
	
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

	<title>Library Application</title>
	</head>
	<body>
	<table border="0" width="100%" height="100%">
		<colgroup>
    		<col width="10%">
			<col width="80%">
			<col width="10%">
		</colgroup>
  		<!-- Kopfbereich -->
		<tr bgcolor="lightgrey" height="10%">
			<td align="center" colspan="3"><b>Library Manager</b></td>
		</tr>
		<!-- Hauptbereich -->
		<tr>
			<!-- Linker Navigationsbereich -->
			<td bgcolor="peachpuff" valign="top" with="100">
				<% out.println(com.peetz.library.navigation.MenuLinks.getInstance().toString()); %>
			</td>
			<td bgcolor="papayawhip" valign="top">
 <%-- create a html form --%>
 <html:form action="shelfEdit">
 <%-- print out the form data --%>
 <table border="1">
 <tbody>
 <tr>
 <td>Title:</td>
 <td><html:text property="title" /></td>
 </tr>
 </tbody>
 </table>
	<%-- hidden fields for id and userId --%>
	<html:hidden property="id" />
 <%-- set the parameter for the dispatch action --%>
 <html:hidden property="do" value="saveShelf" /> 

 <br>
 <table border="1">
 <tr><td>Shelfboard</td><td>&nbsp;</td><td>&nbsp;</td></tr>
 <logic:empty name="shelfEditForm" property="shelfBoardViews">
 <tr><td>No boards available</td></tr>
 </logic:empty>
 <logic:notEmpty name="shelfEditForm" property="shelfBoardViews">
 <logic:iterate name="shelfEditForm" property="shelfBoardViews" id="board">
 <tr>
 <td><bean:write name="board" property="title" /></td>
 <td><html:link action="boardEdit.do?do=editBoard" paramName="board"
 paramProperty="id" paramId="id">Edit</html:link></td>
 <td><html:link action="boardEdit.do?do=deleteBoard" paramName="board"
 paramProperty="id" paramId="id">Delete</html:link></td>
 </tr>
 </logic:iterate> 
 </logic:notEmpty>
 
 <logic:notPresent name="board">
 <tr><td>No boards available</td></tr>
 </logic:notPresent>
 <tr><td colspan="3"><html:link action="boardEdit.do?do=addBoard" paramName="shelfEditForm" paramProperty="id" paramId="id">Add board</html:link></td></tr>
 </table>
 <br>
 <%-- submit and back button --%>
 <html:button property="back" 
 onclick="history.back();">
					 Back
 </html:button>
 &nbsp;
 <html:submit>Save</html:submit>
 </html:form>
			</td>
			<!-- Rechter Navigationsbereich -->
			<td bgcolor="peachpuff" with="15%">&nbsp;</td>
		</tr>
		<!-- Fussbereich -->
		<tr bgcolor="lightgrey" height="10%">
			<td align="right" colspan="3">
				<p>Ingenieurb&uuml;ro Thomas Peetz</p>
			</td>
		</tr>
	</table>
	</body>
</html:html>
