<%-- 
/**
  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  * USA
  *
  * Component of: Red Hat Application Server
  * 
  * Initial Developers: Aizaz Ahmed
  *                     Vivek Lakshmanan
  *                     Andrew Overholt
  *                     Matthew Wringe
  *
  */
--%>

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


    <% request.setAttribute ( "page_title", "Create or Edit a Type" ); %>
    <jsp:include page="../nav/Header.jsp" />

    <!-- Content begins here -->
    <div id="form">

    <jsp:include page="../general/Messages.jsp" />


    <div class="formHeader">Create or Edit a Type</div>
    <!-- Include the form itself -->
    <html:form styleClass="createForm" action="/admin/createType.do" >
    <html:hidden property="submitType" />
    New Type: <html:text property="name" size="20" maxlength="20"/> <br>
    <br />
    <div class="formHeader">Associate Properties</div>

    <div class="typeProps">
        <table class="fields">
            <tr class="header">
                <td></td>
                <td class="bodyText" >Property Name</td>
            </tr>
                                                                                                             
            <logic:iterate name="CreateTypeForm" property="properties" id="prop" indexId="i" >
                <tr>
                    <td class="bodyText" ><%= i.intValue() +1+") " %></td>
                    <td><html:text indexed="true" name="prop" property="name" size="20" maxlength="20"/></td>
                </tr>
            </logic:iterate>
        </table>

        <div>
        <bean:size id="propsSize" property="properties" name="CreateTypeForm" />
        Total number of fields: <html:text property="numProps" size="2" value="<%= propsSize.toString() %>" maxlength="3"/>    </div>
                                                                                                             

<html:submit value="Update" onclick="this.form.submitType.value='updateProperties'" />
<html:submit value="Save"
             onclick="this.form.submitType.value='saveType';
                      if ( validateCreateTypeForm(this) ) {
                        return true;
                      } else {
                        return false;
                      }" />

        <div class="spacer"></div>
    </div>
                                                                                                         
    </html:form>


    <!-- This is necessary to force the parent to expand and include floating divs -->
    <br style="clear:both">
</div>
    <jsp:include page="../nav/Footer.jsp" />
