<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("DevResources"); %>
   <%@ taglib uri="/WEB-INF/iman.tld" prefix="iman" %>
   <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
   <%@ taglib uri="/WEB-INF/x.tld" prefix="x" %>
<HTML>
<HEAD>
   <TITLE><%= c.string("ProductName") %></TITLE>

   <jsp:include page='<%= c.getPath("dev/XmlScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/OctetStringTextBoxScripts_inc.jsp") %>' flush="true" />
   <iman:uihandlerTools/>
   <iman:pageScripts/>
   <iman:eMFrameScripts/>
   <iman:validateNumberScripts/>
   <LINK rel='stylesheet' href='<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>'>
   <jsp:include page='<%= c.getPath("dev/PageScripts_inc.jsp") %>' flush="true" />
   <x:parse xml="${edas}" var="edasXml"/>
   <iman:mvedScripts mode="mvsel"/><%-- Always include for the description field --%>
   <c:if test="${DeviceType=='browser'}">
      <iman:mvedScripts mode="mvie"/>
   </c:if>   
   <SCRIPT language="JavaScript" src="<%= c.getModulesUrl() + "/dev/javascripts/" %>MVStringEditor.js"></script>
   <SCRIPT language="JavaScript" src="<%= c.getModulesUrl() + "/dev/javascripts/" %>MVStringEditorIE.js"></script>
   
   <SCRIPT language="JavaScript">
		function mvedChange(name){
        	 //alert("An MVStringEditor has changed: "+name);
         	if(name != null || name != ""){
    	    	var editorName=""+name;
        	 	var telephoneNumberVal = document.forms[0]._Telephone_Number.value;
				var faxNumberVal = document.forms[0]._Facsimile_Telephone_Number.value;
				var returnValTel = validationLogic(telephoneNumberVal);
				var returnValFax = validationLogic(faxNumberVal);
		         //alert("editorName"+editorName);
				if(editorName=="_Telephone_Number" && returnValTel== "success"){
					var mvse = eval("window.mv" + name);
					if(mvse.m_mode=="mvie"){
	               		mvse.m_tb.value="";
	               		if(mvse.m_tb.value=="" && mvse.m_list.length>0){
         					for(var i=mvse.m_selectedRow; i<mvse.m_list.length-1; i++)
         						mvse.m_list[i] = mvse.m_list[i+1];
         					mvse.m_list.length = mvse.m_list.length-1;
         					mvieShowListUnderneath(mvse);
         					mvieOnChange(mvse);
      					}
	            	}else{
						javascript:mvselRemove(mvse);
					}
					alert("<%= c.string("ModifyUser.PhoneNumber.FullWidth") %>");
					document.forms[0]._Telephone_Number.focus();
					return;
				}
            	if(editorName=="_Facsimile_Telephone_Number" && returnValFax== "success"){
					var mvse = eval("window.mv" + name);
					if(mvse.m_mode=="mvie"){
	               		mvse.m_tb.value="";
	               		if(mvse.m_tb.value=="" && mvse.m_list.length>0){
         					for(var i=mvse.m_selectedRow; i<mvse.m_list.length-1; i++)
         						mvse.m_list[i] = mvse.m_list[i+1];
         					mvse.m_list.length = mvse.m_list.length-1;
         					mvieShowListUnderneath(mvse);
         					mvieOnChange(mvse);
      					}
	            	}else{
						javascript:mvselRemove(mvse);
					}
					alert("<%= c.string("ModifyUser.FaxNumber.FullWidth") %>");
					document.forms[0]._Facsimile_Telephone_Number.focus();
					return;
				}
			}
		}

		function validationLogic(input){
			var FULLWIDTH_CHAR_MIN_RANGE = "FF01";
			var FULLWIDTH_CHAR_MAX_RANGE = "FF60";
			var FULLWIDTH_SIGN_MIN_RANGE = "FFE0";
			var FULLWIDTH_SIGN_MAX_RANGE = "FFE6";
			var result="fail";
			for (var counter = 0; counter <= input.length - 1; counter++) {
				var charAscii=input.charCodeAt(counter);
				if ((charAscii > h2d(FULLWIDTH_CHAR_MIN_RANGE) 
						&& charAscii < h2d (FULLWIDTH_CHAR_MAX_RANGE))
						||(charAscii > h2d(FULLWIDTH_SIGN_MIN_RANGE) 
						&& charAscii < h2d(FULLWIDTH_SIGN_MAX_RANGE))) {
					result="success";	
					if(result == "success"){
						return result;
					}
					}else{
						result="fail"
					}
			}
			return result;
  		}



  		function d2h(d) {
    		return d.toString(16);
     	}
		
  		function h2d(h) {
			return parseInt(h,16);
     	}
   	
      function onInit()
      {
      }

      function isPageValid() // called when user leaves this page or applys changes
      {
      	return notifyAllOfExit();
      }
   </SCRIPT>
</HEAD>

<BODY onLoad="onInit();">
<FORM name="form" method=post action="webacc">
   <jsp:include page='<%= c.getPath("dev/Messagebar_inc.jsp") %>' flush="true" />
	<jsp:include page='<%= c.getPath("dev/BookVars_inc.jsp") %>' flush="true" />

   <!---- Shared Form Code ---->
   <jsp:include page='<%= c.getPath("dev/XmlScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/OctetStringTextBoxScripts_inc.jsp") %>' flush="true" />

   <!---- UI Created by UiHandlers ---->

      <TABLE class="mediumtext" border='0' bgcolor='#FFFFFF' cellpadding='0' cellspacing='0'>
         <!-- CN -->
         <TR>
            <TD align=left>
               <%= c.var("CNDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$CN' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$CN"))}) %>">
               <% c.set("MVStringEditor_name", "_CN");
                  c.set("MVStringEditor_xml", c.var("eDir$target$CN"));
                  c.set("MVStringEditor_minLength", "1");
                  c.set("MVStringEditor_maxLength", "64");
                  c.set("MVStringEditor_ignoreCase", "true");
                  c.set("MVStringEditor_enforceUnique", "true");
                  if (c.var("otherNameRights").equals("R") || c.var("otherNameRights").equals("NONE")) {    c.set("MVStringEditor_readonly", "true");    } %>
               <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_CN_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- Other GUID -->
         <TR>
            <TD align=left>
               <%= c.var("Other_GUIDDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$Other_GUID' type=hidden>
               <INPUT type=text name="_Other_GUID" size="<%= c.string("UI.textboxSize") %>" onKeyPress="return checkHexInput(event)" style="width:<%= c.string("UI.textboxPixel") %>" maxlength="16"  <% if (c.var("eDirRights$target$Other_GUID").equals("R") || c.var("eDirRights$target$Other_GUID").equals("NONE")) { %>DISABLED<% } %> >
               <% if (c.var("eDirRights$target$Other_GUID").equals("R") == false && c.var("eDirRights$target$Other_GUID").equals("NONE") == false) {
                     c.set("Textbox.name", "_Other_GUID"); %>
                  <jsp:include page='<%= c.getPath("dev/OctetStringEditorLink_inc.jsp") %>' flush="true" />
               <% } %>
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_Other_GUID_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- Title -->
         <TR>
            <TD align=left>
               <%= c.var("TitleDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$Title' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$Title"))}) %>">
               <% c.set("MVStringEditor_name", "_Title");
                  c.set("MVStringEditor_xml", c.var("eDir$target$Title"));
                  c.set("MVStringEditor_minLength", "1");
                  c.set("MVStringEditor_maxLength", "64");
                  c.set("MVStringEditor_ignoreCase", "true");
                  c.set("MVStringEditor_enforceUnique", "true");
                  if (c.var("eDirRights$target$Title").equals("R") || c.var("eDirRights$target$Title").equals("NONE")) {    c.set("MVStringEditor_readonly", "true");    } %>
               <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_Title_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- External Name -->
         <TR>
            <TD align=left>
               <%= c.var("External_NameDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$External_Name' type=hidden>
               <INPUT type=text name="_External_Name" size="<%= c.string("UI.textboxSize") %>" onKeyPress="return checkHexInput(event)" style="width:<%= c.string("UI.textboxPixel") %>" maxlength="256"  <% if (c.var("eDirRights$target$External_Name").equals("R") || c.var("eDirRights$target$External_Name").equals("NONE")) { %>DISABLED<% } %> >
               <% if (c.var("eDirRights$target$External_Name").equals("R") == false && c.var("eDirRights$target$External_Name").equals("NONE") == false) {
                     c.set("Textbox.name", "_External_Name"); %>
                  <jsp:include page='<%= c.getPath("dev/OctetStringEditorLink_inc.jsp") %>' flush="true" />
               <% } %>
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelector.name", "_External_Name_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelector_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- EMail Address -->
         <TR>
            <TD align=left>
               <%= c.var("EMail_AddressDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$EMail_Address' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$EMail_Address"))}) %>">
               <% c.set("MVStringEditor_name", "_EMail_Address");
                  c.set("MVStringEditor_xml", c.var("eDir$target$EMail_Address"));
                  c.set("MVStringEditor_enforceUnique", "true");
                  if (c.var("eDirRights$target$EMail_Address").equals("R") || c.var("eDirRights$target$EMail_Address").equals("NONE")) {    c.set("MVStringEditor_readonly", "true");    } %>
               <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_EMail_Address_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- Facsimile Telephone Number -->
         <TR>
            <TD align=left>
               <%= c.var("Facsimile_Telephone_NumberDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$Facsimile_Telephone_Number' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$Facsimile_Telephone_Number"))}) %>">
               <% c.set("MVStringEditor_name", "_Facsimile_Telephone_Number");
                  c.set("MVStringEditor_xml", c.var("eDir$target$Facsimile_Telephone_Number"));
                  c.set("MVStringEditor_enforceUnique", "true");
                  c.set("MVStringEditor_onChangeCallback", "mvedChange");
                  if (c.var("eDirRights$target$Facsimile_Telephone_Number").equals("R") || c.var("eDirRights$target$Facsimile_Telephone_Number").equals("NONE")) {    c.set("MVStringEditor_readonly", "true");    } %>
               <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_Facsimile_Telephone_Number_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- L -->
         <TR>
            <TD align=left>
               <%= c.var("LDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$L' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$L"))}) %>">
               <% c.set("MVStringEditor_name", "_L");
                  c.set("MVStringEditor_xml", c.var("eDir$target$L"));
                  c.set("MVStringEditor_minLength", "1");
                  c.set("MVStringEditor_maxLength", "128");
                  c.set("MVStringEditor_ignoreCase", "true");
                  c.set("MVStringEditor_enforceUnique", "true");
                  if (c.var("eDirRights$target$L").equals("R") || c.var("eDirRights$target$L").equals("NONE")) {    c.set("MVStringEditor_readonly", "true");    } %>
               <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_L_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
         <!-- OU -->
         <TR>
            <TD align=left>
               <%= c.var("OUDisplayName") %>:&nbsp;
            </TD>
            <% if (session.getAttribute("DeviceType").equals("pocket")) { %></TR><TR><% } %>
            <TD>
               <INPUT name='eDir$target$OU' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$OU"))}) %>">
               <% c.set("MVStringEditor_name", "_OU");
                  c.set("MVStringEditor_xml", c.var("eDir$target$OU"));
                  c.set("MVStringEditor_minLength", "1");
                  c.set("MVStringEditor_maxLength", "64");
                  c.set("MVStringEditor_ignoreCase", "true");
                  c.set("MVStringEditor_enforceUnique", "true");
                  if (c.var("eDirRights$target$OU").equals("R") || c.var("eDirRights$target$OU").equals("NONE")) {    c.set("MVStringEditor_readonly", "true");    } %>
               <jsp:include page='<%= c.getPath("dev/MVStringEditor_inc.jsp") %>' flush="true" />
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelectorMV.name", "_OU_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelectorMV_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=9></TD></TR>
      <%-- Description --%>
      <TR>
      <TD align=left>
         <c:out value="${DescriptionDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

      <TD>
         <c:if test="${edasRights.target.Description.writeable}">
            <INPUT type="hidden" name="eDir$target$Description" value="<c:out value="${eDir$target$Description}" escapeXml="false"/>" >
            <SCRIPT>addToNotificationList('Description', 'uih_mvStringEditor');</SCRIPT>
         </c:if>

         <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Description" scope="request"/>
         <c:set var="MVStringEditor_bigEditBox" value="true" scope="request"/>
         <iman:mved mode="mvsel" maxLength="1024" readonly="${!edasRights.target.Description.writeable}" enforceUnique="true" ignoreCase="true" minLength="1" name="_Description"/>
      </TD>
      <TD valign=top>
         <c:set var="mode"><x:out select="$edasXml/edas/Description/@mode"/></c:set>
         <iman:mooMode name="_Description_mode" value="${mode}" multi="true"/>
      </TD>
   </TR>
      <TR><TD height=9></TD></TR>
      </TABLE>


</FORM>
</BODY>
</HTML>
