Show
Ignore:
Timestamp:
26.08.2011 18:49:30 (8 years ago)
Author:
ak19
Message:

Introduced the --mode=gli command line parameter, where the gli value is used as the property prefix when retrieving autoenter and start_browser properties from the config file. These changes go towards working with a single merged server config file (glisite.cfg and llssite.cfg)

Location:
main/trunk/greenstone2/runtime-src/src/w32server
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/w32server/fnord.cpp

    r22677 r24498  
    875875// --location=directory (the path to GSDLHOME which defaults to the 
    876876// directory where server.exe lives) 
     877// --mode=gli (when server.exe is run from GLI). If GLI, "gli." is  
     878// the prefix used to load autoenter and start_browser properties 
     879// (gli.autoenter, gli.start_browser) from the config file 
    877880// --config=file (the path to the configuration file to use which defaults 
    878881// to GSDLHOME\llssite.cfg) 
    879882// --cmd=init  Used to initialize the llssite.cfg file only - jmt12 18/11/2003 
    880 static void parse_args(const text_t cmdline, text_t &location, text_t &config_file, text_t &command) { 
     883static void parse_args(const text_t cmdline, text_t &location, text_t &mode, text_t &config_file, text_t &command) { 
    881884 
    882885  location.clear(); 
    883886  config_file.clear(); 
     887  mode.clear(); 
    884888  command.clear(); // jmt12 18/11/2003 
    885889 
    886   if (cmdline.size() < 3) return; 
     890  if (cmdline.size() < 4) return; 
    887891 
    888892  text_t name, val; 
     
    895899      if (name == "location") { 
    896900    location = val; 
     901      } else if(name == "mode") { 
     902    mode = val; 
    897903      } else if (name == "config") { 
    898904    config_file = val; 
     
    916922  if (name == "location") { 
    917923    location = val; 
     924  } else if (name == "mode") { 
     925    mode = val; 
    918926  } else if (name == "config") { 
    919927    config_file = val; 
     
    953961 
    954962  // parse arguments 
    955   text_t location, config_file, command; 
    956   parse_args(CmdLineStr, location, config_file, command); 
     963  text_t location, mode, config_file, command; 
     964  parse_args(CmdLineStr, location, mode, config_file, command); 
    957965  gsdl_conffile = config_file; 
     966  if (mode.empty()) { 
     967    // if the server is run on its own, mode_prefix is "" with no '.' suffix 
     968    gsdl_mode_property_prefix = ""; 
     969  } else { 
     970    // if the server is launched from GLI, the mode_prefix is "gli" and needs 
     971    // '.' suffixed when accessing certain properties from the config file.      
     972    gsdl_mode_property_prefix = mode + "."; 
     973  } 
    958974  
    959975  // Try to generate the llssite.cfg file if it's missing 
  • main/trunk/greenstone2/runtime-src/src/w32server/settings.cpp

    r22770 r24498  
    6969int gsdl_start_browser = 1; 
    7070int gsdl_address_resolution_method = 2;  // use localhost since users may switch between computers 
     71                // The resolution method was previously on 1: Get an IP, but don't resolve to a name 
    7172text_t gsdl_host_IP; 
    72 // The resolution method was previously on 1: Get an IP, but don't resolve to a name 
     73text_t gsdl_mode_property_prefix; 
    7374 
    7475// private data 
     
    313314    write_ini_line(fout, "portnumber", text_t(gsdl_port_num)); 
    314315    write_ini_line(fout, "externalaccess", text_t(gsdl_external_access)); 
    315     write_ini_line(fout, "autoenter", text_t(gsdl_auto_enter)); 
     316    write_ini_line(fout, gsdl_mode_property_prefix+"autoenter", text_t(gsdl_auto_enter)); 
    316317    write_ini_line(fout, "browser", text_t(gsdl_browser)); 
    317318    write_ini_line(fout, "browserexe", gsdl_browser_exe); 
    318319    write_ini_line(fout, "collections", gsdl_collections); 
    319     write_ini_line(fout, "start_browser", text_t(gsdl_start_browser)); 
     320    write_ini_line(fout, gsdl_mode_property_prefix+"start_browser", text_t(gsdl_start_browser)); 
    320321    write_ini_line(fout, "address_resolution_method", text_t(gsdl_address_resolution_method)); 
    321322    write_ini_line(fout, "hostIP", gsdl_host_IP); 
     
    407408  gsdl_port_num = 80; 
    408409  gsdl_external_access = 0; 
    409   gsdl_auto_enter = 0; 
    410   gsdl_start_browser = 1; 
     410  if(gsdl_mode_property_prefix == "") { 
     411    gsdl_auto_enter = 0; 
     412    gsdl_start_browser = 1; 
     413  } else { 
     414    gsdl_auto_enter = 1; 
     415    gsdl_start_browser = 0; 
     416  } 
    411417 
    412418  check_installed_browsers (netscapeneeded); 
     
    473479        gsdl_external_access = value.getint(); 
    474480         
    475       } else if (key == "autoenter") { 
     481      } else if (key == gsdl_mode_property_prefix+"autoenter") { 
    476482        gsdl_auto_enter = value.getint(); 
    477483         
    478       } else if (key == "start_browser") { 
     484      } else if (key == gsdl_mode_property_prefix+"start_browser") { 
    479485        gsdl_start_browser = value.getint(); 
    480486     
  • main/trunk/greenstone2/runtime-src/src/w32server/settings.h

    r20949 r24498  
    7171extern int gsdl_start_browser; 
    7272extern int gsdl_address_resolution_method; 
     73extern text_t gsdl_mode_property_prefix; 
    7374 
    7475void Settings_Dialog(HWND window, int netscapeneeded);