/* Copyright (c) Oracle Corporation 1992.  All Rights Reserved */
/*****************************************************************************
  NAME
    chlp60.ins - V3.1.2 installation script for
                   Oracle Designer/2000 Help Files 6.0.10.0.0

  DESCRIPTION
    This script installs Oracle Designer/2000 Help Files 6.0.10.0.0

  OWNER
    Jeremy Williams

  MODIFIED    DD-MMM-YY  Reason
    jewillia  07-NOV-94  Created

*****************************************************************************/
{
  {
  start_ins_list = list(current_script, 'DEBUG_CMNHLP72, "cmnhlp72.bmp");
  EXECUTE_SCRIPT = "START.INS";
  execute("%product_home%\des2k_72.ins");

  if (doit)
    {
      ui_product(product_label);
      ui_action(instantiate(installing_product));

      ins_ratchet = "7.2.96.5.6";

      EXECUTE_SCRIPT = "INSTALL_DEPENDENCIES.INS";
      execute("%product_home%\des2k_72.ins");

      case_graphics_file = "cmnhlp72.bmp";
      EXECUTE_SCRIPT = "DES2_BB.DIS";
      execute("%product_home%\des2k_72.ins");

      EXECUTE_SCRIPT = "DES2_START_COPY.INS";
      execute("%product_home%\des2k_72.ins");

      ui_action(instantiate(removing_old));
      EXECUTE_SCRIPT = "DES2_OLD.INS";
      execute("%product_home%\des2k_72.ins");

      if (case_install_files)
        {
          ui_action(instantiate(installing_deinstl));
          copy(deinstl,nls_abbreviation);
          copy(product);

          if (patch_installation)
            {
              ui_action(instantiate(installing_patchset));
              copy(patchset);
            }
          else if (not(case_registry_only_install))
            {
              ui_action(instantiate(installing_help));
              if (language_subgroup == "JA")
                {
                  /* test language subgroup to see if CD supports language
                     as files may not be on CD.
                     copy all of group as subgroup field not use for language
                  */
                  copy(help_ja);
                }
              else
                {
                  copy(help);
                }

              ui_action(instantiate(installing_cnt));
              if (language_subgroup == "JA")
                {
                  /* test language subgroup to see if CD supports language
                     as files may not be on CD.
                     copy all of group as subgroup field not use for language
                  */
                  copy(cnt_ja);
                }
              else
                {
                  copy(cnt);
                }

              ui_action(instantiate(installing_cuecards));
              copy(cuecards);

              ui_action(instantiate(installing_main));
              copy(main);
              copy(msgs,"%language_subgroup%");
              copy(msgs_ja,"%language_subgroup%");

              ui_action(instantiate(installing_ref));
              copy(ref);

              ui_action(instantiate(installing_repinsgd));
              copy(repinsgd,language_subgroup);
              copy(repinsgd_ja,language_subgroup);

              ui_action(instantiate(installing_relnotes));
              copy(relnotes,language_subgroup);
              copy(relnotes_ja,language_subgroup);
            }
        }

      if (case_install_patch_files)
        {
          EXECUTE_SCRIPT = "INSPATCH.INS";
          execute("%product_home%\des2k_72.ins");
        }

      EXECUTE_SCRIPT = "DES2_END_COPY.INS";
      execute("%product_home%\des2k_72.ins");

      EXECUTE_SCRIPT = "INSTALL_CHILDREN.INS";
      execute("%product_home%\des2k_72.ins");

      ui_action(instantiate(modify_environment));
      ini_section = product_filename(current_product);

      {
        /* simple variable modification */
        case_modify_list = list();

        /* remove old variables */

        /* new variables */

        add(case_modify_list,list("CMNHLP72",                               "%CMNHLP72%",              ora_config, ini_section, 'INI_SECTION, 'TOP_LEVEL));

        /* These are set in the user.avf */
        add(case_modify_list,list("REPOS_R10_GROUP",                           "%REPOS_R10_GROUP%",          ora_config, ini_section, 'INI_SECTION, 'TOP_LEVEL));
        add(case_modify_list,list("REPOS_R10_BULLETINS",                       "%REPOS_R10_BULLETINS%",      ora_config, ini_section, 'INI_SECTION, 'TOP_LEVEL));

        if (DESIGNER_HELP_RELEASE)
          {
            add(case_modify_list,list("DESIGNER_HELP_RELEASE",             ins_ratchet,              ora_config, ini_section));
          }

        EXECUTE_SCRIPT = "MODIFY_VARIABLES.CMN";
        execute("%product_home%\des2k_72.ins");
      }

      {
        /* execute_variables */
        case_execute_list = list();

        /* Error message Help file */
        /* add(case_execute_list,list("HELP72_DES_ERROR",                                     "des2err",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION)); */

        /* Repository Administration Utilities */
        add(case_execute_list,list("HELP72_RAU",                                              "ckrau",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        /* Repository Object Definitions */
        /* add(case_execute_list,list("HELP72_PROPERTIES_PALETTE",                            "des2rod",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION)); */

        /* Repository Object Navigator */
        add(case_execute_list,list("HELP72_RON",                                              "ckron",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));
        add(case_execute_list,list("HELP72_RON_PROPERTIES_PALETTE",                           "otspec",     help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        /* Matrix Diagrammer */
        add(case_execute_list,list("HELP72_MATRIX_DIAGRAMMER",                                "awm",      help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));
        add(case_execute_list,list("HELP72_MATRIX_DIAGRAMMER_PROPERTIES_PALETTE",             "otspec",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        /* API */
        /* add(case_execute_list,list("HELP72_DES_API",                                       "des2api",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION)); */

        /* Show Keys Help file */
        add(case_execute_list,list("HELP72_MATRIX_DIAGRAMMER_SHOW_KEYS",                      "awm",      help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));
        add(case_execute_list,list("HELP72_RON_SHOW_KEYS",                                    "ckron",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        add(case_execute_list,list("HELP72_REPOSITORY_REPORTS",               "ckrpt20",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        /* Dependency Analyzer */
        add(case_execute_list,list("HELP72_DEPENDENCY_MANAGER",               "ia",         help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        /* Show Keys Help file */
        add(case_execute_list,list("HELP72_REPOSITORY_REPORTS_SHOW_KEYS",     "ckrpt20",    help,     ora_config, ini_section, 'INI_SECTION, 'CHELP72_SECTION));

        EXECUTE_SCRIPT = "MODIFY_EXECUTE.INS";
        execute("%product_home%\des2k_72.ins");
      }

      {
        help_engine_list = group_files(help);
        while(not(empty(help_engine_list)))
          {
            next_help_file = first(help_engine_list);
            help_engine_list = rest(help_engine_list);

            modify_key = "HKEY_LOCAL_MACHINE";
            modify_subkey = "SOFTWARE\Microsoft\Windows\Help";
            modify_variable = file_name(next_help_file);
            modify_value = directory_name(next_help_file);

            {
              /* make sure key exists */
              win32_create_key(modify_key, modify_subkey);
              /* set the value */
              win32_set_value(modify_key, modify_subkey, modify_variable, modify_value);
            }
            ['FILE_NOT_FOUND(A,B,C,D):
              {
                if (not(modify_value == ""))
                  {
                  skip = yesno_dialog("%B%%carriage_return%%carriage_return%Skip error and continue?");
                  if (not(skip)) signal(A,B);
                  }
              }
            ]

            /* a fix for a reports builder help file which we reference */
            {
            translate_key = "HKEY_LOCAL_MACHINE";
            translate_subkey = "SOFTWARE\Microsoft\Windows\Help";
            translate_variable = "r30dus32.hlp";
            translate_value = win32_get_value(translate_key, translate_subkey, translate_variable);
            }
            ['FILE_NOT_FOUND(A,B,C,D):
                {translate_value = "%oracle_home%\tools\doc20"; }
            ]
            {
            modify_key = "HKEY_LOCAL_MACHINE";
            modify_subkey = "SOFTWARE\Microsoft\Windows\Help";
            modify_variable = "r30dus.hlp";
            modify_value = translate_value;
            win32_set_value(modify_key, modify_subkey, modify_variable, modify_value);
            win32_register_key(modify_key,modify_subkey,modify_variable);
            }
            ['FILE_NOT_FOUND(A,B,C,D):
              { continue(); }
            ]
          }
      }

      ui_action(instantiate(registering_product));
      EXECUTE_SCRIPT = "DES2_REF.INS";
      execute("%product_home%\des2k_72.ins");

      case_graphics_file = "cmnhlp72.bmp";
      EXECUTE_SCRIPT = "DES2_BB.REM";
      execute("%product_home%\des2k_72.ins");

    }

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

  EXECUTE_SCRIPT = "END.INS";
  execute("%product_home%\des2k_72.ins");

}
