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

<iman:stringtable bundle="DevResources"/>
<iman:stringtable bundle="FwResources"/>
<iman:stringtable bundle="BaseResources"/>

<x:parse xml="${edas}" var="edasXml"/>

<HTML>
<HEAD>
   <TITLE><iman:string key="ProductName"/></TITLE>
   <LINK rel="stylesheet" href="<c:out value="${ContextPath}" />/portal/modules/dev/css/hf_style.css">

   <iman:uihandlerTools/>
   <iman:pageScripts/>
   <iman:eMFrameScripts/>
   <iman:validateNumberScripts/>
   <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>
   var isRefreshClicked = false;
   		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" && !isRefreshClicked){
					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" && !isRefreshClicked){
					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()
      {
         <c:if test="${taskIsMoo!='true'}">
            mvLoadFromPack("_OtherName", "<iman:toScript><c:out value="${otherName}"/></iman:toScript>");
         </c:if>

         mvFocus("_Given_Name");
      }

      function isPageValid()
      {
         var form=document.forms[0];
   			
         <c:if test="${otherNameRights=='RW' && taskIsMoo!='true'}">
            form.otherName.value = mvGetValuesAsPack("_OtherName" );
         </c:if>
         
         //alert('<c:out value="${dsfwIdentification}"/>');
         
         <c:if test="${dsfwIdentification=='true'}">

         	var surnameValue = document.forms[0]._Surname.value;
         	//alert("surname  ="+surnameValue);
         	if(surnameValue.length == 0)
         	{
         		var name="_Surname";
				var mvse = eval("window.mv" + name);
				if(mvse.m_mode=="mvie"){
					mvse.m_tb.value=" ";
					mvieSetValue(mvse);
				}else{
					mvselSetValue(mvse, " ");
				}
         	
         	}
         </c:if>

         <c:if test="${taskIsMoo!='true'}">
           
            if(!isRefreshClicked && mvGetValueCount("_Surname")==0)
            {
               alert("<iman:string key="Identification.lastNameRequired"/>");
               return false;
            }
         </c:if>

         return notifyAllOfExit();
      }
   </SCRIPT>
</HEAD>

<BODY onLoad="onInit();">

<FORM name="form" method=post action="webacc">
   <iman:messagebar/>
   <iman:bookvars/>


<input type="hidden" name="dsfwIdentification" value="" />

   <TABLE class="mediumtext" border="0" cellpadding="0" cellspacing="0">
   <%-- ---------- --%>
   <%-- Given Name --%>
   <%-- ---------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${Given_NameDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

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


   <%-- ------- --%>
   <%-- Surname --%>
   <%-- ------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${SurnameDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

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


   <%-- --------- --%>
   <%-- Full Name --%>
   <%-- --------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${Full_NameDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

         <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Full_Name" scope="request"/>
         <iman:mved maxLength="127" readonly="${!edasRights.target.Full_Name.writeable}" enforceUnique="true" ignoreCase="true" minLength="0" name="_Full_Name"  />
      </TD>
      <TD valign=top>
         <c:set var="mode"><x:out select="$edasXml/edas/Full_Name/@mode"/></c:set>
         <iman:mooMode name="_Full_Name_mode" value="${mode}" multi="true" />
      </TD>
   </TR>
   <TR><TD height=9></TD></TR>


   <%-- ---------------------- --%>
   <%-- Generational Qualifier --%>
   <%-- ---------------------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${Generational_QualifierDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

         <INPUT type="text" name="_Generational_Qualifier"  value="<x:out select="$edasXml/edas/Generational_Qualifier/value"/>"  size=<iman:string key="UI.textboxSize"/> style="width:<iman:string key="UI.textboxPixel"/>"   maxlength=8 onChange='validateLengthField(this, 1, 8)' <c:if test="${!edasRights.target.Generational_Qualifier.writeable}">DISABLED</c:if> >
      </TD>
      <TD valign=top>
         <c:set var="mode"><x:out select="$edasXml/edas/Generational_Qualifier/@mode"/></c:set>
         <iman:mooMode name="_Generational_Qualifier_mode" value="${mode}" multi="false" />
      </TD>
   </TR>
   <TR><TD height=9></TD></TR>


   <%-- -------- --%>
   <%-- Initials --%>
   <%-- -------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${InitialsDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

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


   <%-- ---------- --%>
   <%-- Other name --%>
   <%-- ---------- --%>
   <c:if test="${taskIsMoo!='true'}">
      <TR>
         <TD align=left colspan=2>
            <iman:string key="OtherName"/>:&nbsp;&nbsp;
         </TD>
         <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>
         <TD>
            <INPUT name="otherName" type="hidden" value="<c:out value="${otherName}"/>">
            <iman:mved name="_OtherName" maxLength="64" readonly="${otherNameRights=='R' || otherNameRights=='NONE'}" enforceUnique="true" ignoreCase="true" minLength="1"/>
         </TD>
      </TR>
   <TR><TD height=9></TD></TR>
   </c:if>

   <%-- ----- --%>
   <%-- Title --%>
   <%-- ----- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${TitleDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

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


   <%-- - --%>
   <%-- L --%>
   <%-- - --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${LDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

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


   <%-- -- --%>
   <%-- OU --%>
   <%-- -- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${OUDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

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


   <%-- ---------------- --%>
   <%-- Telephone Number --%>
   <%-- ---------------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${Telephone_NumberDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

         <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Telephone_Number" scope="request"/>
         <iman:mved maxLength="64" readonly="${!edasRights.target.Telephone_Number.writeable}" enforceUnique="true" 
         			name="_Telephone_Number" onChangeCallback="mvedChange" />
      </TD>
      <TD valign=top>
         <c:set var="mode"><x:out select="$edasXml/edas/Telephone_Number/@mode"/></c:set>
         <iman:mooMode name="_Telephone_Number_mode" value="${mode}" multi="true" />
      </TD>
   </TR>
   <TR><TD height=9></TD></TR>


   <%-- -------------------------- --%>
   <%-- Facsimile Telephone Number --%>
   <%-- -------------------------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${Facsimile_Telephone_NumberDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

         <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Facsimile_Telephone_Number" scope="request"/>
         <iman:mved maxLength="64" readonly="${!edasRights.target.Facsimile_Telephone_Number.writeable}" enforceUnique="true" 
         			name="_Facsimile_Telephone_Number" onChangeCallback="mvedChange" />
      </TD>
      <TD valign=top>
         <c:set var="mode"><x:out select="$edasXml/edas/Facsimile_Telephone_Number/@mode"/></c:set>
         <iman:mooMode name="_Facsimile_Telephone_Number_mode" value="${mode}" multi="true" />
      </TD>
   </TR>
   <TR><TD height=9></TD></TR>


   <%-- ---------------------- --%>
   <%-- Internet EMail Address --%>
   <%-- ---------------------- --%>
   <TR>
      <TD align=left colspan=2>
         <c:out value="${Internet_EMail_AddressDisplayName}"/>:&nbsp;&nbsp;
      </TD>
      <c:if test="${DEVICE_TYPE=='pocket'}"></TR><TR></c:if>

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

         <x:set var="MVStringEditor_xmlNodeSet" select="$edasXml/edas/Internet_EMail_Address" scope="request"/>
         <iman:mved maxLength="64" readonly="${!edasRights.target.Internet_EMail_Address.writeable}" enforceUnique="true" ignoreCase="true" name="_Internet_EMail_Address" />
      </TD>
      <TD valign=top>
         <c:set var="mode"><x:out select="$edasXml/edas/Internet_EMail_Address/@mode"/></c:set>
         <iman:mooMode name="_Internet_EMail_Address_mode" value="${mode}" multi="true" />
      </TD>
   </TR>
   <TR><TD height=9></TD></TR>


   <%-- ----------- --%>
   <%-- Description --%>
   <%-- ----------- --%>
   <TR>
      <TD align=left colspan=2>
         <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"  biggerBox="true" size="4"/>
      </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 align="left" colspan="2">
            <c:out value="${DescriptionDisplayName}"/>:&nbsp;&nbsp;
         </TD>
         <TD>
            <c:if test="${edasRights.target.Description.writeable}">
               <INPUT type="hidden" name="eDir$target$Description" value="<c:out value="${eDir$target$Description}" escapeXml="false"/>">
            </c:if>
            <textarea name="_Description" style="width:320px; height:75px" onChange='validateTextfield("Description")' maxlength="1024" onChange='validateLengthField(this, 1, 1024); postUiHandlerEvent("Description", "change")'<c:if test="${!edasRights.target.Description.writeable}">DISABLED</c:if> ><x:out select="$edasXml/edas/Description/value"/></textarea>
         </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>-->

  <!--    <SCRIPT>
         window.uiObject_Description = new UiObject();

         <c:if test="${edasRights.target.Description.writeable}">
            addToNotificationList('Description', 'uih_textfield');
            addActionHandler('Description', 'uiah_textfield');
         </c:if>

         window.uiObject_Description.m_lowerBound = 1;
         window.uiObject_Description.m_upperBound = 1024;
         window.uiObject_Description.m_type = "string";
      </SCRIPT>  -->


   <TR><TD height=9></TD></TR>
   </TABLE>

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