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

/****************************************************************************
  NAME
    jinit.ins - installation script for Oracle JInitiator.

  DESCRIPTION
    This script installs Oracle JInitiator.

  OWNER
    Thomas C. Jose

  MODIFIED  MM/DD/YY   Reason
  anmanian  12/12/98   Created
   JMADHAVI	12/08/99   Modified for domestic & export versions

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

{
    if (doit)
    {

        /*****************************
        Set the VRF-INS script ratchet
        ******************************/
        ins_ratchet = "6.0.0.0.0";

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

        permit_retry_operations  = TRUE;
        permit_ignore_operations = TRUE;
        permit_process_operations= TRUE;

        win32_register_OCSM_product();
        /******************
        Install the product
        *******************/
        ui_product(instantiate(display_product_label));

        ui_action(instantiate(install_files));
        copy(deinst);

        ui_action(instantiate(install_exe));
        copy(exe);
	  copy(doc);
        copy(doc,nls_abbreviation);

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

        permit_retry_operations = TRUE;

        modify("ORACLE_JINIT", ORACLE_JINIT, ora_config, product_filename(current_product));
        win32_register_key("$ORACLE","","ORACLE_JINIT",'REPLICATE);
        /****************************
         Registering map file groups
        *****************************/
         win32_register_OCSM_group(exe,'MEDMODE);
         win32_register_OCSM_group(deinst,'MINMODE);
        /*********************************
        Register and Reference the product
        and remove delold
        **********************************/
        EXECUTE_SCRIPT = "REGISTER_REFERENCE_PRODUCT";
        execute("%installer_home%%dir_separator%d2kr2ins.usr");

        permit_retry_operations = FALSE;
	{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);		
	  }
	}
	else
	{
	    information_dialog("Jinitiator installation is having problems. Forms server is not configured correctly.");
	}
     if((configureProcesses)||member(selected_products,w32rmts60))
     {
      physical_path1 = "%ORACLE_JINIT%";
      virtual_path1 = "/jinitiator";

      make_directory(physical_path1);
      /*if(registered("w32www21")|| member(selected_products,w32www21))
         install_webdb_listner = TRUE;*/
      if(install_webdb_listner)
      {
        cfg_ori_name = "%oracle_home%\listener\cfg\wdbsvr.cfg";
	cfg_file_location = "%oracle_home%\listener\cfg\wdbsvr.ini";
	if(exists(cfg_ori_name))
        {
            move_file(cfg_ori_name,cfg_file_location);
	    modify("%physical_path1%\ =","%virtual_path1%/",cfg_file_location,"DirMaps");

            move_file(cfg_file_location,cfg_ori_name);

	    modify("%physical_path1%\","  %virtual_path1%/",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%.
");
      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%. 
");
      if(install_webdb_listner)
      {
         modify("",path_message1,forms_config_instruction_file);
      }
      else
      {
         modify("",no_webdb_path_message1,forms_config_instruction_file);
      }

     } 
    } /*END if doit*/

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


} /*END jinit.ins*/
