<%@  page pageEncoding="utf-8" contentType="text/html;charset=utf-8" import="com.novell.webaccess.common.JSPConduit2, com.novell.emframe.dev.eMFrameUtils" %>
<%   JSPConduit2 c = JSPConduit2.getJSPConduit(request);

     response.setHeader("Cache-Control", "no-cache");
     response.setHeader("Expires", "-1");

     c.stringTable("DevResources");
     c.stringTable("FwResources"); %>

<HEAD>
<TITLE><%= c.toDisplay(c.string("OS.Simple.Title")) %></TITLE>
<LINK href="<%= c.getModulesUrl() %>/fw/css/osStyles.css" rel="styleSheet" type="text/css">
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
</HEAD>

<script language="JavaScript">

   //--------------------- define GUI variables -----------------------
   var m_displayTypes =          new Array();   //vector of type filter elements (display names)
   var m_pseudoDisplayTypes =    new Array();   //vector of pseudo type filter elements [isEnabled, typeName, criterion]

   //array of the localized ds types in the type filter
<% int len = c.toInt("OS.TypeFilter.cnt");
   int i = 0;
   while (i<len)
   { %>
      m_displayTypes[<%= i %>]="<%= c.var("OS.TypeFilter."+i+".displayname") %>";
<%    i++;
   } %>

   //array of the localized pseudo types in the type filter
<% len = c.toInt("OS.PseudoTypeFilter.cnt");
   i = 0;
   while (i<len)
   { %>
      m_pseudoDisplayTypes[<%= i %>]="<%= c.var("OS.PseudoTypeFilter."+i+".displayname") %>";
<%    i++;
   } %>

   //static http parameters
   var m_multiSelect =              "<%= c.toScript((c.toLower(c.var("OS.MultiSelect")))) %>";
   var m_callback =                 "<%= c.toScript(c.var("OS.CallBack")) %>";
   var m_control =                  "<%= c.toScript(c.var("OS.Control")) %>";
   var m_initialContext =           "<%= c.toScript(c.var("OS.InitialContext")) %>";
   var m_initialTypeFilter =        "<%= c.toScript(c.var("OS.TypeFilter")) %>";
   var m_searchOnStartup =          "<%= c.toScript((c.toLower(c.var("OS.SearchOnStartup")))) %>";
   var m_userContext =              "<%= c.toScript(c.var("User.context")) %>"

   //dynamic http parameters
   var m_searchContextId =          "";
   var m_advSel =                   "<%= c.toScript((c.toLower(c.var("OS.AdvancedSelection")))) %>";
   var m_container =                "<%= c.toScript(c.var("OS.Container")) %>";
   var m_mode =                     "<%= c.toScript((c.toLower(c.var("OS.Mode")))) %>";
   var m_nameFilter =               "<%= c.toScript(c.var("OS.NameFilter")) %>";
   var m_authName = 				"<%= c.toScript(c.var("OS.AuthName")) %>";
   var m_searchSubContainers =      "<%= c.toScript((c.toLower(c.var("OS.SearchSubContainers")))) %>";
   var m_resultsPerPage =           "<%= c.toScript(c.var("OS.ResultsPerPage")) %>";

   //--------------- validate GUI variables -----------------------
   //make sure we have a place to put the results
   if (m_callback=="" && m_control=="")
   {
      alert("ObjectSelector: Task developer error!  Must specify either OS.Control or OS.CallBack parameter.");
   }

   //enforce default values for the following options
   if (m_mode!="search")               m_mode = "browse";
   if (m_multiSelect!="true")          m_multiSelect = "false";
   if (m_searchOnStartup!="true")      m_searchOnStartup = "false";
   if (m_searchSubContainers!="false") m_searchSubContainers = "true";
   if (m_advSel!="true")               m_advSel = "false";
   if (m_resultsPerPage=="")
   {
      m_resultsPerPage = "15";
   }

   //global variable definitions
   var m_bHdrEnabled =              true;
   var m_numTypes =                 m_displayTypes.length;
   var m_numViewableTypes =         m_numTypes+m_pseudoDisplayTypes.length;


   function buildUrlParms()
   {
      var parm = "";
      parm += "&OS.Mode=" + m_mode;
      parm += "&OS.Container=" + urlEncode(m_container);
      parm += "&OS.NameFilter=" + urlEncode(m_nameFilter);
      parm += "&OS.TypeFilter=" + urlEncode(m_initialTypeFilter);
      parm += "&OS.SearchSubContainers=" + ((m_mode=="search")?m_searchSubContainers:"false");
      parm += "&OS.ResultsPerPage=" + m_resultsPerPage;
      parm += "&OS.AuthName=" + m_authName;
      return parm;
   }


</script>

<% if (c.notdef("OS.TopMargin")) {c.set("OS.TopMargin","5");} %>
<% if (c.toLower(c.var("OS.Mode")).equals("browse")) { %>
   <FRAMESET ROWS=* border=0>
      <FRAME NAME="Body" MARGINWIDTH=10 MARGINHEIGHT=<%= c.var("OS.TopMargin") %> SCROLLING="auto" NORESIZE
             SRC="webacc?taskId=dev.Empty&merge=fw.OS.Browse&User.context=<%= c.var("User.context") %>"></FRAME>
   </FRAMESET>
<% } else { %>
   <FRAMESET ROWS=* border=0>
      <FRAME NAME="Body" MARGINWIDTH=10 MARGINHEIGHT=<%= c.var("OS.TopMargin") %> SCROLLING="auto" NORESIZE
             SRC="webacc?taskId=dev.Empty&merge=fw.OS.Search&User.context=<%= c.var("User.context") %>"></FRAME>
   </FRAMESET>
<% } %>

</HTML>
