<%@  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("CreateClass.Title")) %></TITLE>
<LINK rel="stylesheet" href="<%= c.getModulesUrl() + "/dev/css/hf_style.css" %>" type="text/css">
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
</HEAD>
<!------------------------------- JAVA SCRIPT STARTS HERE ----------------------------------->
<SCRIPT language="JavaScript">

function previousSelected()
{
   document.EnterClassFlagsForm.elements["merge"].value="base.CreateClsName";
   document.EnterClassFlagsForm.elements["nextState"].value="getClassFlags";
   document.EnterClassFlagsForm.elements["Task.SelectedButton"].value="previousSelected";
   document.EnterClassFlagsForm.submit();
}

function nextSelected()
{
   if(!isChecked())
   {
      alert("STRING toScript(CreateClass.SelectAFlag)}");
   }
   else
   {
      if(isContainer())
      {
         document.EnterClassFlagsForm.elements["merge"].value="base.CreateClsParent";
         document.EnterClassFlagsForm.elements["nextState"].value="getClassFlags";
         document.EnterClassFlagsForm.elements["Task.SelectedButton"].value="nextSelected";
         document.EnterClassFlagsForm.submit();
       }
   }
}

function isChecked()
{
   var r = document.EnterClassFlagsForm.classflags;
   for (i=0; i<document.EnterClassFlagsForm.classflags.length; i++)
   {
      if (r[i].checked)
      {
         document.EnterClassFlagsForm.elements["whichButton"].value=r[i].value;
         return true;
      }
   }
   return false // submit canceled
}

function isContainer()
{
   var r = document.EnterClassFlagsForm.containerFlag;
   if (r.checked)
   {
      document.EnterClassFlagsForm.elements["ContainerFlag"].value=r.value;
   }
   else
   {
      document.EnterClassFlagsForm.elements["ContainerFlag"].value="no";
   }
   return true // submit canceled
}

// Doing this function for Netscape. Need to block the user from checking the check box if auxiliary class is chosen
function disableCheckBox()
{
   if ((navigator.appName=="Netscape")&&(parseInt(navigator.appVersion)>=4))
   {
      var r = document.EnterClassFlagsForm.classflags;
      for (i=0; i<document.EnterClassFlagsForm.classflags.length; i++)
      {
         if (r[i].checked)
         {
            if (r[i].value == "auxiliary")
            {
               return false;
            }
         }
      }
   }
   return true;
}

function disableContainer()
{
   // Need to work on this for Netscape.
   document.EnterClassFlagsForm.containerFlag.checked = false;
   document.EnterClassFlagsForm.containerFlag.disabled = true;
   document.EnterClassFlagsForm.containerFlag.blur();
   return true;
}

function enableContainer()
{
   document.EnterClassFlagsForm.containerFlag.disabled = false;
   return true;
}

function restore()
{
   var flag = document.EnterClassFlagsForm.classflags;
   var cont = document.EnterClassFlagsForm.containerFlag;
   for (i=0; i<document.EnterClassFlagsForm.classflags.length; i++)
   {
      if (flag[i].value == document.EnterClassFlagsForm.elements["SelectedFlag"].value)
      {
         flag[i].checked = true;
         if(document.EnterClassFlagsForm.elements["SelectedFlag"].value=="auxiliary")
         {
            document.EnterClassFlagsForm.containerFlag.disabled = true;
         }
      }
   }
   if(document.EnterClassFlagsForm.elements["ContainerFlag"].value == "yes")
   {
      cont.checked=true;
   }
   return true;
}

function setFormFocus()
{
   document.EnterClassFlagsForm.classflags[0].focus();
}
</SCRIPT>

<BODY text="#000000" link="#000000" vlink="#000000" alink="#000000" bgcolor="#FFFFFF" onload="restore();setFormFocus();">
<FORM name="EnterClassFlagsForm" 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="EnteredClassName" value="<%= c.var("EnteredClassName") %>">
<INPUT type="hidden" name="EnteredClassID" value="<%= c.var("EnteredClassID") %>">
<INPUT type="hidden" name="whichButton" value="">
<INPUT type="hidden" name="ContainerFlag" value="<%= c.var("ContainerFlag") %>">
<INPUT type="hidden" name="SelectedFlag" value="<%= c.var("SelectedFlag") %>">

<% c.set("WizardHeader.title", c.toDisplay(c.string("CreateClass.Title"))); 
   c.set("WizardHeader.subtitle", c.toDisplay(c.string("Schema.Step2"))); 
   c.set("WizardHeader.instruction", c.toDisplay(c.string("CreateClass.Instr2"))); 
   c.set("WizardHeader.helpFile", "base/schemacreate_class_wizard_flags.html"); %>
<jsp:include page='<%= c.getPath("dev/WizardHeader_inc.jsp") %>' flush="true" />

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

<TABLE border="0" cellspacing="0" cellpadding="3">
   <TR valign="baseline">
      <TD class="mediumtext">
         <INPUT type="radio" name="classflags" value="effective" checked onClick="return enableContainer()"><%= c.toDisplay(c.string("CreateClass.Flags.Effective")) %><BR>
         <INPUT type="radio" name="classflags" value="non"onClick="return enableContainer()"><%= c.toDisplay(c.string("CreateClass.Flags.Non")) %><BR>
         <INPUT type="radio" name="classflags" value="auxiliary"onClick="return disableContainer()"><%= c.toDisplay(c.string("CreateClass.Flags.Aux")) %><BR>
      </TD>
   </TR>
   <TR valign="baseline">
      <TD class="mediumtext">
         <INPUT type="checkbox" name="containerFlag" value="yes" onClick="return disableCheckBox()"><%= c.toDisplay(c.string("CreateClass.Flags.Cont")) %>
         <BR><BR>
      </TD>
   </TR>
</TABLE>

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