/* Copyright (c) Oracle Corporation 1994.  All Rights Reserved */

/*****************************************************************************
  NAME
    rcgi60.ins - V3 installation script for Oracle Reports Web CGI and Cartridge script.

  DESCRIPTION
    This script installs Windows Oracle Reports Web CGI and Cartridge


  MODIFIED      MM/DD/YY        REASON
   tjose        17/06/99        created.
*****************************************************************************/

{
    if (doit)
    {
        /*****************************
        Set the VRF-INS script ratchet
        ******************************/
        ins_ratchet = "6.0.0.0.1";


        execute("%installer_home%%dir_separator%%operating_system%.ins");

        permit_retry_operations  = TRUE;
        permit_ignore_operations = TRUE;
        permit_process_operations= TRUE;
        /******************
        Install the product
        *******************/
        ui_product(instantiate(display_product_label));

        ui_action(instantiate(install_files));
        copy(user);

        ui_action(instantiate(install_exe));
        copy(exe);
        copy(deinst);
        /******************/

        /******************/
        permit_retry_operations = FALSE;

         /*************
         Install Parent
         **************/
         if(install_parent)    /* Install parent first, if necessary */
           install(product_parent(current_product));
         /*************/
         permit_retry_operations = TRUE;

        /***************************************************************
         Registering map variables except Installer_home and oracle_home
        ****************************************************************/
         win32_register_map_variable("RW60");
         win32_register_map_variable("DOC60");
         win32_register_map_variable("D2KOR60_GROUP");


        /*********************************
        Register and Reference the product
        and remove delold
        **********************************/
        EXECUTE_SCRIPT = "REGISTER_REFERENCE_PRODUCT";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");
        /*********************************/

if(win32_key_exists("HKEY_LOCAL_MACHINE", "System\CurrentControlSet\Services\Oracle WebDb Listener"))
 {
 {web_port = win32_get_value("HKEY_LOCAL_MACHINE", "System\CurrentControlSet\Services\Oracle WebDb Listener\Parameters", "PortNo");
 web_host = win32_get_value("HKEY_LOCAL_MACHINE", "System\CurrentControlSet\Services\Oracle WebDb Listener\Parameters", "HostName");}
['FILE_NOT_FOUND:
        {
          web_port = "<Enter Listener Port>";
          web_host = "<Enter Web Host Name>";
        }
]       
 }
else
{
 web_port = "<Enter Listener Port>";
 web_host = "<Enter Web Host Name>";
}
 if(exists("%INSTALLER_HOME%\repname.cfg"))
 {
  reports_server = translate("reports_server_name", "%INSTALLER_HOME%\repname.cfg");
 }
 else
 {
  reports_server = "<Enter Reports Server Name>";
 }
 instantiate_file("%ORACLE_HOME%\tools\web60\html\runrep.htm", "%ORACLE_HOME%\tools\web60\html\runrep_tem.htm");
 move_file("%ORACLE_HOME%\tools\web60\html\runrep_tem.htm", "%ORACLE_HOME%\tools\web60\html\runrep.htm");

       /*********************
        Reference Dependencies
        **********************/
        ui_action(instantiate(reference_dependencies));

        {reference(current_product,product_parent(current_product));}  /* reference parent */
        ['UNREGISTERED_PRODUCT: continue();]
        /*********************/

        permit_retry_operations = FALSE;

      physical_path2_3 = "%oracle_home%\tools\web60";
      physical_path2 = "%oracle_home%\tools\web60\html";
      physical_path3 = "%oracle_home%\tools\web60\cgi";
      virtual_path2 = "/dev60html";
      virtual_path3 = "/dev60cgi";

      make_directory(physical_path2_3);
      make_directory(physical_path2);
      make_directory(physical_path3);
      /*if(registered("w32www21")|| member(selected_products,w32www21))
         install_webdb_listner = TRUE;
	else
	   install_webdb_listner = FALSE;*/

      if(install_webdb_listner)
      {
        cfg_ori_name = "%oracle_home%\listener\cfg\wdbsvr.cfg";
	  cfg_file_location = "%oracle_home%\listener\cfg\wdbsvr.ini";
        move_file(cfg_ori_name,cfg_file_location);
	  if(exists(cfg_file_location))
        {
	    modify("%physical_path2%\ =","%virtual_path2%/",cfg_file_location,"DirMaps");
	    modify("%physical_path3%\ =","%virtual_path3%/",cfg_file_location,"CGIDirMaps");

          move_file(cfg_file_location,cfg_ori_name);

	    modify("%physical_path2%\","  %virtual_path2%/",cfg_ori_name," ");
	    modify("%physical_path3%\","  %virtual_path3%/",cfg_ori_name," ");
        }
      }

      path_message2 = nls("path_message2",
"[INFO] Virtual path %virtual_path2% has been created with your WebDb listener, mapping to
physical path %physical_path2%.
");
      path_message3 = nls("path_message3",
"[INFO] Virtual path %virtual_path3% has been created with your WebDb listener, mapping to
physical path %physical_path3%.
");
      no_webdb_path_message2 = nls("no_webdb_path_message2",
"[ACTION] Please configure the following virtual path with your web listener: %virtual_path2% for
physical directory %physical_path2%.
");
      no_webdb_path_message3 = nls("no_webdb_path_message3",
"[ACTION] Please configure the following virtual path with your web listener: %virtual_path3% for
physical directory %physical_path3%.
");
      if(install_webdb_listner)
      {
         modify("",path_message2,reports_config_instruction_file);
         modify("",path_message3,reports_config_instruction_file);
      }
      else
      {
         modify("",no_webdb_path_message2,reports_config_instruction_file);
         modify("",no_webdb_path_message3,reports_config_instruction_file);
      }

      reports_cgi_message = nls("reports_cgi_message",
"[ACTION] Oracle Reports Web CGI and cartridge: in order to run reports on other machines,
you must add entries to your Net8 'tnsnames.ora' file to identify the Reports Servers running
on those machines.
");
      modify("",reports_cgi_message, reports_config_instruction_file);

/*     if(primary_node_install)
     {
	primary_node_install_message = nls("primary_node_install_message",
"[ACTION] You have requested that this machine be the primary node in a multiple machine
configuration.  If you wish to distribute the execution of Oracle Reports reports across
the different machines using Reports Server clustering, you will need to add the CLUSTERCONFIG
parameter to the Reports Server configuration file.  Please refer to the Reports Server
documentation for details.
");

	modify("",primary_node_install_message,reports_config_instruction_file);
     }*/
      test_report_message = nls("test_report_message",
"[INFO] An internet shortcut to run a standard test report, or any report of your choice,
has been created for you in the Oracle Reports program group.
");
      modify("",test_report_message,reports_config_instruction_file);
     }
    [
         'UNREGISTERED_PRODUCT: continue();
         'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]
}
