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

<HTML>
<HEAD>
<TITLE>ObjectViewPanel</TITLE>
<jsp:include page='<%= c.getPath("dev/eMFrameScripts_inc.jsp") %>' flush="true" />
<jsp:include page='<%= c.getPath("dev/ASScripts_inc.jsp") %>' flush="true" />

<SCRIPT language="JavaScript" src="<%= c.getModulesUrl() %>/fw/javascripts/ObjectView.js"></script>
<SCRIPT language="JavaScript" src="<%= c.getModulesUrl() %>/fw/javascripts/AnchorPosition.js"></script>
<SCRIPT language="JavaScript" src="<%= c.getModulesUrl() %>/dev/javascripts/exchanger.js"></SCRIPT>
<jsp:include page='<%= c.getPath("dev/XmlScripts_inc.jsp") %>' flush="true" />
<SCRIPT language="JavaScript" src="<%= c.getModulesUrl() %>/dev/javascripts/QueryScripts.js"></script>

<script>

   //-------------------------- OS top flag-----------------------------
   var m_atTop                   = true;

   //--------------- define syncronization variables -------------------
   
   var resultsLoaded             = false;
   var resultButtonsLoaded       = false;
   var queryLoaded               = false;
   var titleLoaded               = false;
   var ovTitleLoaded             = false;
   var resultsFrame;
   
  //--------------------- define GUI constants ------------------------
   var HDR_TAG                   = "Hdr";
   var ADV_ROW                   = "aRow";
   var SIMPLE_ROW                = "sRow";
   
   var SELECTED_BGCOLOR          = "#EFEEE9";
   var UNSELECTED_BGCOLOR        = "#DFDDD5";
   var OV_BGCOLOR                = "#EDEEEC";   //2.0.2 DFDDD5 //2.5 E0E1DF
   var OV_TITLECOLOR             = "#458AB9";   //2.0.2 6C8899 //2.5 458AB9
   
   var SELECTED_TEXT_COLOR       = "green";
   var ACTIVE_TEXT_COLOR         = "black"
   var UNSELECTED_TEXT_COLOR     = "gray";

   var ADD_EDIT_CRITERION        = "<%= c.toScript(c.string("OV.Browser.AddEditCriterion")) %>";
   var ALL_TYPES                 = "<%= c.toScript(c.string("OV.Browser.AllTypes")) %>";
   var CLEAR_ALL_CRITERION       = "<%= c.toScript(c.string("OV.Browser.ClearAllCriterion")) %>";
   var CLEAR_CRITERION           = "<%= c.toScript(c.string("OV.Browser.ClearCriterion")) %>";
   var NPS_MODULES_URL           = "<%= c.getModulesUrl() %>";
   var MINUS_BUTTON              = "<%= c.string("Button.Minus.image") %>";
   var PLUS_BUTTON               = "<%= c.string("Button.Plus.image") %>";
   var TYPE_HINT                 = "<%= c.toScript(c.string("OV.Browser.TypeHint")) %>";
   

   //--------------------- define GUI variables -----------------------
   var m_types =                 new Array();   //vector of type filter elements [isEnabled, typeName, criterion]
   var m_displayTypes =          new Array();   //vector of type filter elements (display names)
   var m_pseudoTypes =           new Array();   //vector of pseudo type filter elements [isEnabled, typeName, criterion]
   var m_pseudoDisplayTypes =    new Array();   //vector of pseudo type filter elements [isEnabled, typeName, criterion]
   
   //array of ds types in the type filter [isEnabled, typeName, criterion]
   <% int i=0;
      int cnt=c.toInt("OV.TypeFilter.cnt");
      while (i<cnt)
      { %>
         m_types[<%= i %>]=new Array(true, "<%= c.toScript(c.var("OV.TypeFilter."+i+".name")) %>", "<%= c.toScript(c.var("OV.TypeFilter."+i+".crit")) %>");
   <%    i++;
      } %>

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

   //array of pseudo types in the type filter [isEnabled, pseudoTypeName]
   <% i=0;
      cnt=c.toInt("OV.PseudoTypeFilter.cnt");
      while (i<cnt)
      { %>
         m_pseudoTypes[<%= i %>]=new Array(true, "<%= c.toScript(c.var("OV.PseudoTypeFilter."+i+".name")) %>");
   <%    i++;
      } %>

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

   //static http parameters
   var m_multiSelect =              "<%= c.toScript((c.toLower(c.var("OV.MultiSelect")))) %>";
   var m_initialContext =           "<%= c.toScript(c.var("OV.InitialContext")) %>";
   var m_initialTypeFilter =        "<%= c.toScript(c.var("OV.TypeFilter")) %>";
   var m_searchOnStartup =          "<%= c.toScript((c.toLower(c.var("OV.SearchOnStartup")))) %>";
   var m_userContext =              "<%= c.toScript(c.var("User.context")) %>";
   var m_showSubClasses =				"<%= c.toScript(c.toLower(c.var("OV.ShowSubClasses"))) %>";
   
   //dynamic http parameters
   var m_searchContextId =          "";
   var m_advSel =                   "<%= c.toScript((c.toLower(c.var("OV.AdvancedSelection")))) %>";
   var m_container =                "<%= c.toScript(c.var("OV.Container")) %>";
   var m_mode =                     "<%= c.toScript((c.toLower(c.var("OV.Mode")))) %>";
   var m_nameFilter =               "<%= c.toScript(c.var("OV.NameFilter")) %>";
   var m_searchSubContainers =      "<%= c.toScript((c.toLower(c.var("OV.SearchSubContainers")))) %>";
   var m_resultsPerPage =           "<%= c.toScript(c.var("OV.ResultsPerPage")) %>";
   var m_selectedType =             "<%= c.toScript(c.var("OV.SelectedType")) %>";

   
   //--------------- validate GUI variables -----------------------
   //enforce default values for the following options
   if (null == m_mode || m_mode=="")               m_mode = "tree"; 
   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 = "100";
      
   //global variable definitions
   var m_bHdrEnabled =                 true;
   var m_numTypes =                    m_types.length;
   var m_numViewableTypes =            m_numTypes+m_pseudoTypes.length;
   
   //enable the selected type, if there is one
   if (m_selectedType==null || m_selectedType.length==0)
   {
      m_selectedType="<%= c.toScript(c.string("OV.Browser.AllTypes")) %>";
   }
   if (m_selectedType!="<%= c.toScript(c.string("OV.Browser.AllTypes")) %>")
   {
      enableJustOneType(m_selectedType);
   }
   iman.debugOV("ObjectViewPanel.jsp window.name=" + window.name);
   iman.debugOV("m_mode="+ m_mode);
   //alert("m_mode = "+m_mode+"\nm_multiSelect = "+m_multiSelect+"\nm_selectedType = "+m_selectedType);
</script>
</HEAD>
<% if (c.toLower(c.var("OV.Mode")).equals("browse")) { %>
      <jsp:include page="Browse_inc.jsp" flush="true" />
<% } else if(c.toLower(c.var("OV.Mode")).equalsIgnoreCase("tree")){ %>
      <jsp:include page="Tree_inc.jsp" flush="true" />
<% } else { %>
      <jsp:include page="Search_inc.jsp" flush="true" />
<% } %>
</HTML>
