<%@  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"); %>

<HTML>
<HEAD>
   <TITLE><%= c.string("ProductName") %></TITLE>

   <jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/XmlScripts_inc.jsp") %>' flush="true" />
   <jsp:include page='<%= c.getPath("dev/ValidateIntegerScripts_inc.jsp") %>' flush="true" />

   <LINK rel='stylesheet' href='<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>'>
   <jsp:include page='<%= c.getPath("dev/PageScripts_inc.jsp") %>' flush="true" />
   <SCRIPT>
      function onInit()
      {
         var form=document.forms[0];
         var xStr="<%= c.toScript(c.var("eDir$target$Login_Script")) %>";
         form._eDir$target$Login_Script.value=getValueFromXml(xStr)
         initMooMode("_Login_Script", xStr);
      }

      function isPageValid()
      {
         var form=document.forms[0];
         // this is a workaround since profile's loginscript is mandatory attribute and we cannot switch pages
         // when there is not a value for login script
         if (form._eDir$target$Login_Script.value == '')
         {
            form._eDir$target$Login_Script.value = "  ";
         }
         form.eDir$target$Login_Script.value = toXmlString(form._eDir$target$Login_Script.value <% if (c.var("Task.moo").equals("true")) { %>, form._Login_Script_mode.value<% } %>);
         return true;
      }
      
      /*
      Bug 413126 - Login script view window is too small under modifying profile object.
      */
      function resizeTextArea(t) {

		a = t.value.split('\n');
		b=1;
		for (x=0;x < a.length; x++) {
			 if (a[x].length >= t.cols)
			 	b+= Math.floor((a[x].length-20)/t.cols);
		}
		b+= a.length;
		if (b > t.rows) 
			t.rows = b;
	  }
   </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" />

   <!-- UI Created by UiHandlers -->
      <TABLE class="mediumtext" border='0' bgcolor='#FFFFFF' cellpadding='0' cellspacing='0'>
         <!-- Login Script -->
         <TR>
            <TD valign=top align=left colspan=2>
               <%= c.var("Login_ScriptDisplayName") %>:
            </TD>
         </tr>
         <tr>
            <TD colspan=2>
               <INPUT name='eDir$target$Login_Script' type=hidden value="<%= c.formatMessage(c.var("toHtml"), new String[]{(c.var("eDir$target$Login_Script"))}) %>">
               <TEXTAREA name=_eDir$target$Login_Script wrap size="<%= c.string("UI.loginscripttextboxSize") %>" onkeyup="resizeTextArea(this);" style="padding-left:3;padding-right:3;width:<%= c.string("UI.loginscripttextboxPixel") %>" rows=<%= c.string("UI.textareaRows") %> cols=<%= c.string("UI.textareaCols") %>  <% if (c.var("eDirRights$target$Login_Script").equals("R") || c.var("eDirRights$target$Login_Script").equals("NONE")) { %>DISABLED<% } %> ></TEXTAREA>
            </TD>
            <TD valign=top>
               <% if (c.var("Task.moo").equals("true")) {    c.set("ModeSelector.name", "_Login_Script_mode"); %>&nbsp;&nbsp;<jsp:include page='<%= c.getPath("dev/ModeSelector_inc.jsp") %>' flush="true" /><% } %>
            </TD>
         </TR>
      <TR><TD height=10></TD></TR>
      </TABLE>


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