<%@  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("BaseResources"); %>
<HTML>
<HEAD>
<TITLE><%= c.toDisplay(c.string("AddAttribute.Title")) %></TITLE>
<LINK rel="stylesheet" href="<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>" type="text/css">
<jsp:include page='<%= c.getPath("dev/OSScripts_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
</HEAD>

<!------------------------------ JAVA SCRIPT STARTS HERE ------------------------------------->
<SCRIPT language="JavaScript">

function nextSelected()
{
   if (getSelectedClass())
   {
      document.ChooseClassForm.elements["merge"].value="base.AddAttributeOpt";
      document.ChooseClassForm.elements["nextState"].value="getSelectedClass";
      document.ChooseClassForm.elements["Task.SelectedButton"].value="nextSelected";
      document.ChooseClassForm.submit();
   }
}
function getSelectedClass()
{
   if(checkSelection())
   {
      var availOpt = document.ChooseClassForm.AvailableClasses.options;
      var selectedItem  = document.ChooseClassForm.AvailableClasses.selectedIndex;
      var selectedText  = availOpt[selectedItem].text;
      for(var i = 0; i < availOpt.length; i++)
      {
         if(availOpt[i].selected)
         {
            selectedClass = selectedText;
         }
      }
      document.ChooseClassForm.elements["SelectedClass"].value = selectedClass;
      return true;
   }
   else
   {
      return false;
   }
}

function checkSelection()
{
   var availAttrOpt = document.ChooseClassForm.AvailableClasses.options;
   var itemSelected = document.ChooseClassForm.AvailableClasses.selectedIndex;
   if(itemSelected == -1)
   {
      alert("<%= c.toScript(c.string("AddAttribute.MustMakeSelection")) %>");
      return false;
   }
   return true;
}

function restore()
{

   var Opt = document.ChooseClassForm.AvailableClasses.options;
   var selectedClass = document.ChooseClassForm.elements["SelectedClass"].value;
   if (selectedClass != null || selectedClass != "")
   {
      for (var i =0; i < Opt.length; i++)
      {
         if(Opt[i].text == selectedClass)
         {
            Opt[i].selected = true;
         }
      }
   }
   return true;
}
function setFocus()
{

   document.ChooseClassForm.AvailableClasses.focus();
   document.ChooseClassForm.AvailableClasses[0].selected = true;
}

</SCRIPT>

<BODY text="#000000" link="#000000" vlink="#000000" alink="#000000" bgcolor="#FFFFFF" onload="restore();setFocus();">
<FORM name="ChooseClassForm" method=post action="webacc">

<!------------------------ BEGIN WEBACCESS VARIABLES ---------------------------->

<INPUT type="hidden" name="merge" value="">
<INPUT type="hidden" name="error" value="dev.GenErr">
<INPUT type="hidden" name="User.context" value="<%= c.var("User.context") %>">
<INPUT type="hidden" name="nextState" value="">
<INPUT type="hidden" name="taskId" value="<%= c.var("taskId") %>">
<INPUT type="hidden" name="Task.SelectedButton" value="">
<INPUT type="hidden" name="SelectedClass" value="<%= c.var("SelectedClass") %>">

<% c.set("TaskHeader.title", c.string("AddAttribute.Title"));
   c.set("TaskHeader.iconUrl", "dir/schema.gif");
   c.set("TaskHeader.iconAlt", c.string("SchemaManagementDisplayName"));
   c.set("TaskHeader.helpFile", "base/addattribute.html"); %>
<jsp:include page='<%= c.getPath("dev/TaskHeader_inc.jsp") %>' flush="true" />

<!----------------------------- STEPS & INSTRUCTION TABLE --------------------------------------->
<TABLE border="0" cellspacing="0" cellpadding="2" width="90%">
   <TR valign="baseline"><TD>&nbsp;</TD>
   </TR>
   <TR valign="baseline">
      <TD height="22" valign="middle" class="instructions"><%= c.toDisplay(c.string("AddAttribute.Instr1")) %><BR><BR></TD>
   </TR>
</TABLE>

<!------------------------ CONTENT TABLE ------------------------------------------------->

<TABLE name="ClassSelectionTable" border="0" cellspacing="0" cellpadding="2" width="90%">
   <TR>
      <TD align="left" class="mediumtext"><%= c.toDisplay(c.string("SchemaAvailCls")) %></TD>
   <TR valign="baseline">
      <TD class="mediumtext">
         <SELECT name="AvailableClasses" size=10 style="WIDTH: 250px">
         <% c.set("i", "0");
            while (c.lt(c.var("i"), c.var("AvailableClassList.Count"))) { %>
            <OPTION value="<%= c.toDisplay(c.var("AvailableClassList.Element."+c.var("i"))) %>"><%= c.toDisplay(c.var("AvailableClassList.Element."+c.var("i"))) %>
         <% c.inc("i");
            } %>
         </SELECT>
      </TD>
   </TR>
</TABLE>

<!------------------------- BUTTON TABLE --------------------------->

<TABLE width="100%" border="0" cellspacing="0" cellpadding="2" height="25">
   <TR><TD>&nbsp;</TD>
   </TR>
   <TR>
      <TD><jsp:include page='<%= c.getPath("dev/Bar_inc.jsp") %>' flush="true" /></TD>
   </TR>
   <TR>
      <TD>
         <A HREF="#" onClick="javascript:nextSelected();return false"><IMG src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.OK.image") %>" alt="<%= c.toDisplay(c.string("Button.OK.alt")) %>" title="<%= c.toDisplay(c.string("Button.OK.alt")) %>" border=0></A>
         <jsp:include page='<%= c.getPath("dev/Cancel_inc.jsp") %>' flush="true" />
      </TD>
   </TR>
</TABLE>
</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
