<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit, com.novell.emframe.dev.eMFrameUtils,
                                                                             com.novell.nps.gadgetManager.BaseGadgetInstance,
                                                                             com.novell.nps.utils.Utils" %>
<%   JSPConduit c = JSPConduit.getJSPConduit(request);
   c.stringTable("DevResources");
   c.stringTable("BaseResources"); %>
<HTML>
<HEAD>
<TITLE><%= c.toDisplay(c.string("AttrInfo.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" />
<style>
.gray
{
background-color: #bfbfbf;
}
</style>
<jsp:include page='<%= c.getPath("dev/OSScripts_inc.jsp") %>' flush="true" />
<!-------------------------JAVA SCRIPT STARTS HERE--------------------------------------->
<SCRIPT language="JavaScript">

function nextSelected()
{
   var tempChooseAnAttribute="========= <%= c.toDisplay(c.string("ShowAttr.ChooseAttr")) %> =========";
   if(getSelectedAttr() && document.ShowAttrInfoForm.elements["SelectedAttribute"].value!=tempChooseAnAttribute)
   {
      document.ShowAttrInfoForm.elements["nextState"].value="getSelectedAttribute";
      document.ShowAttrInfoForm.elements["merge"].value="base.ShowAttributeInfo";
      document.ShowAttrInfoForm.elements["Task.SelectedButton"].value="nextSelected";
      document.ShowAttrInfoForm.submit();
   }
}// end of nextSelected

function getSelectedAttr()
{
   var optOpt = document.ShowAttrInfoForm.AvailableAttr.options;
   var selectedItem  = document.ShowAttrInfoForm.AvailableAttr.selectedIndex;
   if (selectedItem >= 0)// if nothing is selected, selectedItem = -1
   {
   		document.ShowAttrInfoForm.elements["SelectedAttribute"].value=optOpt[selectedItem].value;
   		return true;
   }
   return false;
}

function restore()
{
   var SelectedAttr  = document.ShowAttrInfoForm.elements["SelectedAttribute"].value;
   var optOpt        = document.ShowAttrInfoForm.AvailableAttr.options;
   var OptLength     = document.ShowAttrInfoForm.AvailableAttr.length;
   if(SelectedAttr != " ")
   {
      for (var i = 0; i < OptLength; i++)
      {
         if (SelectedAttr == optOpt[i].value)
         {
           optOpt[i].selected=true;
         }
      }
   }
   else
   {
      document.ShowAttrInfoForm.AvailableAttr[0].selected=true;
   }
   document.ShowAttrInfoForm.AvailableAttr.focus();
}



</SCRIPT>

<BODY text="#000000" LINK="#000000" VLINK="#000000" ALINK="#000000" bgcolor="#FFFFFF"onload="restore();" >
<FORM name="ShowAttrInfoForm" 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="taskId" value="<%= c.var("taskId") %>">
<INPUT type="hidden" name="nextState" value="">
<INPUT type="hidden" name="Task.SelectedButton" value="">
<INPUT type="hidden" name="strClassAttrs" value="<%= c.var("strClassAttrs") %>">
<INPUT type="hidden" name="SelectedAttribute" value="<%= c.var("SelectedAttribute") %>">
<INPUT type="hidden" name="SelectedClass" value="">


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

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

<TABLE name="AttributeTable" border="0" cellspacing="0" cellpadding="2">
   <TR valign-"baseline">
      <TD align="left" colspan="2"> &nbsp; </TD>
   </TR>
   <TR valign-"baseline">
      <TD align="left" class="instructions" colspan="2"><%= c.toDisplay(c.string("ShowAttrSelecltAttr")) %></TD>
   </TR>
   <TR valign-"baseline">
      <TD align="left" class="mediumtext" colspan="2">&nbsp;</TD>
   </TR>
   <TR valign="baseline">
      <TD align="left" class="mediumtext"><%= c.toDisplay(c.string("SchemaAvailAttr")) %></TD>
   </TR>
   <TR valign="baseline">
      <TD class="mediumtext">
         <SELECT name="AvailableAttr" size="6" style="WIDTH: 250px">
         <% c.set("i", "0");
            while (c.lt(c.var("i"), c.var("AvailableAttrList.Count"))) { %>
            <OPTION value="<%= c.toDisplay(c.var("AvailableAttrList.Element."+c.var("i"))) %>"><%= c.toDisplay(c.var("AvailableAttrList.Element."+c.var("i"))) %>
         <% c.inc("i");
            } %>
         </SELECT>
         <br>
         <br>
         <a href="#" onClick="nextSelected()" onKeyDown="if(event.keyCode==13){nextSelected();}"><img src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.View.image") %>" alt="<%= c.toDisplay(c.string("Button.View.alt")) %>" title="<%= c.toDisplay(c.string("Button.View.alt")) %>" border=0/></a>
      </TD>
   </TR>
</TABLE>
<% if (c.var("SelectedAttribute").equals("") == false) { %>
<!--******** Information Area *******-->

<jsp:include page='<%= c.getPath("dev/Bar_inc.jsp") %>' flush="true" />
<TABLE border="0" cellspacing="0" cellpadding="2" width="60%">
   <TR valign="baseline">
      <TD class="mediumtext"><BR><%= c.toDisplay(c.string("SchemaID")) %></TD>
      <TD class="mediumtext"><BR><%= c.toDisplay(c.string("ShowAttr.Syntax")) %></TD>
   </TR>
   <TR valign="baseline">
      <TD class="mediumtext"><INPUT class="gray"type="text" name="ASNID" value="<%= c.toDisplay((c.var("AttrID"))) %>"  size="25" readonly></TD>
      <TD class="mediumtext"><INPUT class="gray" type="text" name="Syntax" value="<%= c.toDisplay(c.var("AttrSyntax")) %>" size="25" readonly></TD>
   </TR>
   <TR valign="baseline">
      <TD align="left" class="mediumtext"><BR><%= c.toDisplay(c.string("ShowAttr.Flags")) %></TD>
   </TR>
   <TR valign="baseline">
   <TD rowspan=2 class="mediumtext"><TEXTAREA class="gray" name="AttrFlags" rows="4" cols="30" readonly><% c.set("i", "0");    while (c.lt(c.var("i"), c.var("AttrFlags.Count"))) { %><%= c.toDisplay(c.var("AttrFlags.Element."+c.var("i"))) %><% out.print("\n");%><% c.inc("i");
   } %></TEXTAREA></TD>
   </TR>
</TABLE>
<TABLE>
   <TR>
      <TD align="left" colspan=3 class="mediumtext"><BR><%= c.toDisplay(c.string("ShowAttr.ClsUsingAttr")) %></TD>
   </TR>
</TABLE>
<% if (c.gt(c.var("ClsUsingAttr.Count"), "0")) { %>
<TABLE width=222 height=88 border="2" rules="none" bgcolor="#bfbfbf" cellpadding="0" cellspacing="0">
   <TR>
      <TD>
         <DIV id="scroll1" style="width:230;height:85;background-color:#bfbfbf;overflow:auto;">
            <TABLE bgcolor="#bfbfbf">
            <% c.set("i", "0");
               while (c.lt(c.var("i"), c.var("ClsUsingAttr.Count"))) { %>
               <TR valign="baseline">
                  <TD valign="baseline" align="left" class="mediumtext"><img src="<%= c.getModulesUrl() %>/dev/images/dir/<%= c.var("ClsUsingAttr.Element."+c.var("i")+ ".image") %>" alt="<%= c.toDisplay(c.var("ClsUsingAttr.Element."+c.var("i"))) %>" title="<%= c.toDisplay(c.var("ClsUsingAttr.Element."+c.var("i"))) %>"></TD>
                  <% BaseGadgetInstance bgi = (BaseGadgetInstance) request.getAttribute("BGI"); %>
                  <TD valign="baseline" align="left" class="mediumtext"><a href="webacc?NPService=fw.LaunchService&NPAction=Delegate&delegate=base.ClassInformation&launcher=<%= bgi.getPrimary().getGadgetInstanceID()%>&lifecycle=Recreate&nextState=getSelectedClass&Task.SelectedButton=nextSelected&merge=base.ShowClassInfo&SelectedClass=<%= c.toDisplay(c.var("ClsUsingAttr.Element."+c.var("i"))) %>"><%= c.toDisplay(c.var("ClsUsingAttr.Element."+c.var("i"))) %></a></TD>
               </TR>
            <% c.inc("i");
               } %>
            </TR>
            </TABLE>
         </DIV>
      </TD>
   </TR>
</TABLE>
<% } else { %>
<TD valign=top rowspan=2 class="mediumtext"><TEXTAREA class="gray" name="ClsUsingAttr" rows="4" cols="25" readonly><% c.set("i", "0");    while (c.lt(c.var("i"), c.var("ClsUsingAttr.Count"))) { %><%= c.toDisplay(c.var("ClsUsingAttr.Element."+c.var("i"))) %><% c.inc("i");
   } %></TEXTAREA></TD>
<% }
   } %>
<!------------------------- 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="webacc?taskId=<%= c.var("taskId") %>&taskComplete=true&User.context=<%= c.var("User.context") %>"><IMG name="Close" src="<%= c.getModulesUrl() + "/dev/images/" + c.string("Button.Close.image") %>" alt="<%= c.toDisplay(c.string("Button.Close.alt")) %>" title="<%= c.toDisplay(c.string("Button.Close.alt")) %>" border=0></A>             
      </TD>
  </TR>
</TABLE>
</FORM>
<jsp:include page='<%= c.getPath("dev/OSFooter_inc.jsp") %>' flush="true" />
</BODY></HTML>
