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

/****************************************************************************
  NAME
    fjava60.ins - V3 installation script for Windows Java Class Web Support Files.

  DESCRIPTION
    This script installs Windows Java Class Web Support Files 6.0.

  OWNER

  MODIFIED  MM/DD/YY    Reason
*****************************************************************************/

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

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

    /****************************************
    Setup the nls() stuff for install scripts
    *****************************************/

    /****************************************/

    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(deinst);

    ui_action(instantiate(install_exe));
    copy(dll);

    overwrite_mode = 'NEVER;
    copy(cfg);
    overwrite_mode = 'ALWAYS;

    /******************/
    permit_retry_operations = FALSE;
    /*******************
    Install dependencies
    ********************/
    EXECUTE_SCRIPT = "INSTALL_DEPENDENCIES";
    execute("%installer_home%%dir_separator%d2kr2ins.usr");

    /******************************************/

	{FORMS60 = translate("FORMS60","$ORACLE");}
	['FILE_NOT_FOUND: FORMS60 = "%ORACLE_HOME%\FORMS60"; ]
	jinit_version_file = "%ORACLE_HOME%\jinit\us\jinit-version.txt";
	formsweb_cfg_file = "%FORMS60%\server\formsweb.cfg";
	if(exists(jinit_version_file))
	{
	  if(exists(formsweb_cfg_file))
	  {
		jinit_classid = translate("object_classid",jinit_version_file);
		modify("jinit_classid",jinit_classid,formsweb_cfg_file);
		jinit_exename = translate("object_executable",jinit_version_file);
		modify("jinit_exename",jinit_exename,formsweb_cfg_file);
		jinit_mimetype = translate("mimetype",jinit_version_file);
		modify("jinit_mimetype",jinit_mimetype,formsweb_cfg_file);		
	  }
	}

/*instantiate variables & pass to runform.htm*/

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("..\admin\server\runform.htm"))*/
/* information_dialog("Inside the runform check code");*/
 instantiate_file("%ORACLE_HOME%\tools\web60\html\runform.htm", "%ORACLE_HOME%\tools\web60\html\runform_tem.htm");
 move_file("%ORACLE_HOME%\tools\web60\html\runform_tem.htm", "%ORACLE_HOME%\tools\web60\html\runform.htm");

   /*************
    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("FORMS60");
   win32_register_map_variable("DOC60");
 win32_register_map_variable("D2KIF60_GROUP");

    /*********************************

    /*********************************
    Register and Reference the product
    **********************************/
    ui_product(instantiate(display_product_label));

    register(current_product);
    reference(current_product);
    /*********************************/
    remove(delold);      /* remove any outdated files if install was successful */

    /*********************************/
    permit_retry_operations = FALSE;
      physical_path1 = "%FORMS60%\java";
      physical_path2_3 = "%oracle_home%\tools\web60";
      physical_path2 = "%oracle_home%\tools\web60\html";
      physical_path3 = "%oracle_home%\tools\web60\cgi";
      virtual_path1 = "/forms60java";
      virtual_path2 = "/dev60html";
      virtual_path3 = "/dev60cgi";

      make_directory(physical_path1);
      make_directory(physical_path2_3);
      make_directory(physical_path2);
      make_directory(physical_path3);
      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_path1%\ =","%virtual_path1%/",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_path1%\","  %virtual_path1%/",cfg_ori_name," ");
	    modify("%physical_path3%\","  %virtual_path3%/",cfg_ori_name," ");
        }
      }
      path_message1 = nls("path_message1",
"[INFO] Virtual path %virtual_path1% has been created with your WebDb listener, mapping to
physical path %physical_path1%.
");
      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_message1 = nls("no_webdb_path_message1",
"[ACTION] Please configure the following virtual path with your web listener: %virtual_path1% for
physical directory %physical_path1%.
");
      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_message1,forms_config_instruction_file);
         modify("",path_message2,forms_config_instruction_file);
         modify("",path_message3,forms_config_instruction_file);
      }
      else
      {
         modify("",no_webdb_path_message1,forms_config_instruction_file);
         modify("",no_webdb_path_message2,forms_config_instruction_file);
         modify("",no_webdb_path_message3,forms_config_instruction_file);
      }

      test_form_message = nls("test_form_message",
"[INFO] An internet shortcut to run a standard test form, or any form of your choice, has been
created for you in the Oracle Forms program group.
");
      modify("",test_form_message,forms_config_instruction_file);

  } /*END if doit*/

    [
      'UNREGISTERED_PRODUCT: continue();
      'CANCEL: signal('FAILURE, instantiate(halt_installation));
    ]


} /*END fjava60.ins*/
