<%@ 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>Comic 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="tan" valign="top" with="100">
				<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
			</td>
			<td bgcolor="wheat">
 <%-- create a html form --%>
 <html:form action="comicEdit">
 <%-- print out the form data --%>
 <table border="1">
 <tbody>
 <tr><td>Title:</td><td><html:text property="title" /></td></tr>
 <tr><td>Publisher:</td><td></td></tr>
 <tr><td>Completed:</td><td><html:checkbox property="completed" /></td></tr>
 <tr><td>Current Order:</td><td><html:checkbox property="currentOrder" /></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="saveComic" /> 
 <table border="1">
 <tr><td>Issues</td><td>&nbsp;</td><td>&nbsp;</td></tr>
 <logic:empty name="comicEditForm" property="comicIssueViews">
 <tr><td>No issues available</td></tr>
 </logic:empty>
 <logic:notEmpty name="comicEditForm" property="comicIssueViews">
 <logic:iterate name="comicEditForm" property="comicIssueViews" id="issue">
 <tr>
 <td><bean:write name="issue" property="number" /></td>
 <td><html:link action="issueEdit.do?do=editIssue" paramName="issue"
 paramProperty="id" paramId="id">Edit</html:link></td>
 <td><html:link action="issueEdit.do?do=deleteIssue" paramName="issue"
 paramProperty="id" paramId="id">Delete</html:link></td>
 </tr>
 </logic:iterate> 
 </logic:notEmpty>
 
 <logic:notPresent name="issue">
 <tr><td>No issues available</td></tr>
 </logic:notPresent>
 <tr><td colspan="3"><html:link action="issueEdit.do?do=addIssue" paramName="comicEditForm" paramProperty="id" paramId="comicId">Add issue</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="tan" 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>
