<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>

<%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>

<% JSPConduit c = JSPConduit.getJSPConduit(request); %>
<iman:stringtable bundle="DevResources"/>


<%-- -------------------------------------- --%>
<%-- Default Values                         --%>
<%-- -------------------------------------- --%>
<c:if test="${empty MVNetworkAddr_formName}"><c:set var="MVNetworkAddr_formName" value="forms[0]"/></c:if>
<c:if test="${empty MVNetworkAddr_bgColor}"><c:set var="MVNetworkAddr_bgColor" value="white"/></c:if>
<c:if test="${empty MVNetworkAddr_width}">
   <c:set var="MVNetworkAddr_width"><iman:string key="UI.textboxPixel"/></c:set>
</c:if>


<TABLE bgcolor="<c:out value="${MVNetworkAddr_bgColor}"/>">
   <TR>

      <%-- TEXTBOX or SELECT--%>
      <TD>
         <c:choose>
            <c:when test="${MVNetworkAddr_mode!='SINGLE'}">
               <c:choose>
                  <c:when test="${MVNetworkAddr_readonly=='true'}">
                     <SELECT name="<c:out value="${MVNetworkAddr_name}"/>" width="<c:out value="${MVNetworkAddr_width}"/>" height="200" style="background-color:silver;width:<c:out value="${MVNetworkAddr_width}"/>"<% if ( c.def("MVNetworkAddr_size")) { %> size=<c:out value="${MVNetworkAddr_size}"/><% } %>>
                  </c:when>
                  <c:otherwise>
                     <SELECT name="<c:out value="${MVNetworkAddr_name}"/>" width="<c:out value="${MVNetworkAddr_width}"/>" height="200" style="width:<c:out value="${MVNetworkAddr_width}"/>"<% if ( c.def("MVNetworkAddr_size")) { %> size=<c:out value="${MVNetworkAddr_size}"/><% } %>>
                  </c:otherwise>
               </c:choose>
                  <%-- Load values from XML --%>
                  <c:if test="${not empty MVNetworkAddr_xmlNodeSet}">
                     <x:forEach select="$MVNetworkAddr_xmlNodeSet/value">
                        <OPTION value="<x:out select="."/>"><x:out select="."/>
                     </x:forEach>
                  </c:if>
               </SELECT>
            </c:when>
            <c:otherwise>
               <c:choose>
                  <c:when test="${MVNetworkAddr_readonly=='true'}">
                     <%-- Note: not putting xml into control --%>
                     <INPUT type="text" name="<c:out value="${MVNetworkAddr_name}"/>" width="<c:out value="${MVNetworkAddr_width}"/>" height="200" style="width:<c:out value="${MVNetworkAddr_width}"/>" DISABLED>
                  </c:when>
                  <c:otherwise>
                     <INPUT type="text" name="<c:out value="${MVNetworkAddr_name}"/>" value="<x:out select="$MVNetworkAddr_xmlNodeSet/value"/>" width="<c:out value="${MVNetworkAddr_width}"/>" height="200" style="width:<c:out value="${MVNetworkAddr_width}"/>">
                  </c:otherwise>
               </c:choose>
            </c:otherwise>
         </c:choose>
      </TD>

      <%-- BUTTONS --%>
      <c:if test="${MVNetworkAddr_readonly!=true}">
         <TD <c:if test="${MVNetworkAddr_size!=''}">valign=top</c:if>>

            <c:choose>
               <c:when test="${MVNetworkAddr_mode!='SINGLE'}">
                  <a href="javascript:AddAddress('<c:out value="${User.context}"/>', 'document.<c:out value="${MVNetworkAddr_formName}"/>.<c:out value="${MVNetworkAddr_name}"/>');"><IMG alt="<iman:string key="Widgets.addItem"/>" src="<%= c.getModulesUrl() %>/dev/images/iconadd.gif" border="0"></a>

                  <c:if test="MVNetworkAddr_horizontalButtons==''">
                     </TD><TD<% if ( c.def("MVNetworkAddr_size")) { %> valign=top<% } %>>
                  </c:if>

                  <a href="javascript:MVNetRemove(document.<c:out value="${MVNetworkAddr_formName}"/>.<c:out value="${MVNetworkAddr_name}"/>);"><IMG alt="<iman:string key="Widgets.removeItem"/>" src="<%= c.getModulesUrl() %>/dev/images/iconremove.gif" border="0"></a>
               </c:when>
               <c:otherwise>
                  <a href="javascript:AddAddress('<c:out value="${User.context}"/>', 'document.<c:out value="${MVNetworkAddr_formName}"/>.<c:out value="${MVNetworkAddr_name}"/>');"><IMG alt="<iman:string key="Widgets.editItem"/>" src="<%= c.getModulesUrl() %>/dev/images/iconedit.gif" border="0"></a>
               </c:otherwise>
            </c:choose>

         </TD>
      </c:if>

   </TR>
</TABLE>


<%-- Clear variables --%>
<c:remove var="MVNetworkAddr_formName"/>
<c:remove var="MVNetworkAddr_width"/>
<c:remove var="MVNetworkAddr_bgColor"/>
<c:remove var="MVNetworkAddr_size"/>
<c:remove var="MVNetworkAddr_horizontalButtons"/>
<c:remove var="MVNetworkAddr_readonly"/>
<c:remove var="MVNetworkAddr_mode"/>
