//Bool_t gApacheExec=1; gApacheNoCache=kTRUE;

// File: TestInfoDisplay.C
// This displays all the versions of the package GLEAM whose test results are
// available in the database. A drop down menu of the version is shown and the
// user can choose the version whose system tests he wants to see
 
#include <TApache.h>
#include <TSQLServer.h>
#include <TSQLRow.h>
#include <TSQLResult.h>
#include <TCanvas.h>
#include <TFrame.h>
#include <TH1.h>
    
void TestInfoDisplay(){

  TApache ap;
  ap.Puts("<body bgcolor=\"darkolivegreen\" topmargin=\"0\" leftmargin=\"0\" marginwidth=\"5\" marginheight=\"5\">");


  // First we select the version of the package GLEAM to display
  char *sql="select version from glast_data.release_tests where pkg_name = \'Gleam\'";
  char *connection="oracle://sage/SLAC_TCP";
  char *user="LAT ";
  char *pass="LATREAD";
  
  // connect to oracle server
  TSQLServer *db=TSQLServer::Connect(connection, user, pass);
  
  // Submit the query to the database
  TSQLResult *res=db->Query(sql);   
  TSQLRow *row1=res->Next();
  
   // The HTML form
  ap.Puts("<HTML><BODY><CENTER>");
  ap.Puts("<h1>System Tests for GLAST Gleam</h1>");
  ap.Puts("<h2><BR>Select a Version to view test results</h2>");
  ap.Puts("<FORM METHOD = \"GET\" ACTION = \"TestInfoVersion.C\">");
  ap.Puts("<BR><P><SELECT NAME=\"version\">");
  
  
  do{ 
    
    // Drop down menu for versions for package GLEAM
    ap.Puts("<OPTION>");
    package_name = row1->GetField(0);
    ap.Printf(row1->GetField(0));
    
   }// end while
  while(res->Next());
  
  ap.Puts("</SELECT></P>");
  ap.Puts("<BR><BR><input type=\"submit\" value=\"Submit\">");
  ap.Puts("<BR></form>");
  ap.Puts("<a href=""http://www-glast.slac.stanford.edu/software/Doc-J/web_docs.htm>""<img src=""http://www-glast.slac.stanford.edu/software/images/helpbook.gif""  border=""0""></a>");
  ap.Puts("</center></body></html>");
  
}// end of TestInfoDisplay
