<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>

<%
     java.util.List places = (java.util.List)request.getSession().getAttribute("places");
%>

<html>
  <head>
   <title>Club Administration V0.1 -- Places Administration</title>
   <script type="text/javascript">
      function enterValue(PlaceId)
      {
        document.forms[0].elements[0].value = PlaceId;
      }
    </script>
  </head>
<body>
 <center>
 <h1>Places Administration</h1><br><br>
 <html:errors/></p>

 <table border="1">
   <tr><th>SELECT</th><th>NAME</th><th>LONGITUDE</th><th>LATITUDE</th><th>VALID RANGE</th></tr>
   <%
      if (places != null)
      {
         java.util.Iterator itor = places.iterator();
         while (itor.hasNext())
         {
            com.ferienclub.custadmin.beans.Place p = (com.ferienclub.custadmin.beans.Place)itor.next();
            %>
            <tr><td><input type="radio" name="PlaceChoice" value="<%= p.getPlaceId() %>" onClick="enterValue('<%= p.getPlaceId() %>')"></td><td><%= p.getName() %></td><td><%= p.getLongitude() %></td><td><%= p.getLatitude() %></td><td><%= p.getValidRange() %></td></tr>
            <%
         }
      }
   %>
 </table>

 <html:form action="DeletePlace.do">
   <html:hidden property="placeId" name="placeForm"/>
 </html:form>

 <html:form action="CreatePlace.do?mode=init">
   <html:hidden property="placeId" name="placeForm"/>   
 </html:form>

 <input type="button" value="Delete" onClick="document.forms[0].submit()"/> 

 <input type="button" value="Create" onClick="document.forms[1].submit()"/> 

 <html:link href="/ClubAdministration">Back to Start</html:link>

 </center>
</body>
</html>
