Ignore:
Timestamp:
2000-02-03T14:45:48+13:00 (24 years ago)
Author:
sjboddie
Message:

lots of stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/w32server/fnord.cpp

    r611 r902  
    7777#define ENTERBUTTONY ((MAINWINDOWHEIGHT-RESTHEIGHT)+5)
    7878
    79 #define VERSIONSTRING "version 1.1"
     79#define VERSIONSTRING "version 1.0"
    8080const char versionstring[] = VERSIONSTRING;
    8181
     
    196196 
    197197  // decide what we want to draw
    198   if (gs_show_console) {
     198  if (gsdl_show_console) {
    199199    // we want to draw a "console" window
    200200    if (window_state != console_window ||
     
    278278// returns 1 on success, 0 otherwise
    279279int enter_library (HWND Window) {
    280   char url[256], numbuf[20];
    281280  int res;
    282281 
    283282  // get the url and attempt to start a browser
     283  char *localname = GetLocalName(NULL);
    284284  if (have_networking) {
    285     strcpy(url, "http://");
    286     strcat(url, GetLocalName(NULL));
    287     if (gs_port_num != 80) {
    288       itoa(gs_port_num,numbuf,10);
    289       strcat(url,":");
    290       strcat(url,numbuf);
    291     }
    292     strcat(url, gs_enterlib);
    293    
     285    text_t url = "http://" + text_t(localname);
     286    if (gsdl_port_num != 80)
     287      url += ":" + text_t(gsdl_port_num);
     288   
     289    url += gsdl_enterlib;
     290
    294291    // add a unique ending so it will always result in a request
    295     if (strstr (gs_enterlib, "?") == NULL) strcat (url, "?");
    296     else strcat (url, "&");
    297    
    298     strcat (url, "uq=");
    299     itoa ((int)GetTickCount(), numbuf, 10);
    300     strcat (url, numbuf);
     292    text_t::const_iterator it =
     293      findchar (gsdl_enterlib.begin(), gsdl_enterlib.end(), '?');
     294    if (it == gsdl_enterlib.end()) url.push_back ('?');
     295    else url.push_back ('&');
     296    int tcount = GetTickCount();
     297    url += "uq=" + text_t(tcount);
    301298   
    302299    // remember the library access number for later proxy checking
     
    305302    // do a quick check to make sure we're using netscape when
    306303    // we should be (it might have been just installed)
    307     if (netscapeneeded) gs_check_browser_settings (netscapeneeded);
    308    
     304    if (netscapeneeded) gsdl_check_browser_settings (netscapeneeded);
     305   
     306    char *cstr_url = url.getcstr();
    309307    if (strlen (startbrowserdir) <= 0) {
    310       res = startbrowser (url, gs_browser_exe, NULL);
     308      res = startbrowser (cstr_url, gsdl_browser_exe, NULL);
    311309     
    312     } else res = startbrowser (url, gs_browser_exe, startbrowserdir);
    313    
     310    } else res = startbrowser (cstr_url, gsdl_browser_exe, startbrowserdir);
     311   
     312    delete cstr_url;
     313
    314314  } else {
     315    /*
    315316    char staticpath[256];
    316317   
    317318    // try to find the static pages
    318     strcpy (url, gs_staticpages);
     319    strcpy (url, gsdl_staticpages);
    319320   
    320321    // remove any slashes from the static pathname
     
    341342    strcat (url, "niupepa.htm");
    342343   
    343     res = startbrowser (url, gs_browser_exe, NULL);
     344    res = startbrowser (url, gsdl_browser_exe, NULL);
    344345    startbrowserdir[0] = '\0'; // doesn't make sense for non-networked case
     346    */
    345347  }
    346348 
     
    393395 
    394396  // try to find the browser directory
    395   strcpy (installpath, gs_gsdlhome); // use gsdlhome to find the CD-ROM drive...
     397  char *gsdlhome = gsdl_gsdlhome.getcstr();
     398  strcpy (installpath, gsdlhome); // use gsdlhome to find the CD-ROM drive...
     399  delete gsdlhome;
    396400 
    397401  // remove any slashes from the pathname
     
    457461 
    458462  // try to find the browser directory
    459   strcpy (topdir, gs_gsdlhome); // use gsdlhome to find the CD-ROM drive...
     463  char *gsdlhome = gsdl_gsdlhome.getcstr();
     464  strcpy (topdir, gsdlhome); // use gsdlhome to find the CD-ROM drive...
     465  delete gsdlhome;
    460466  strcpy (cmd, "notepad ");
    461467 
     
    486492    // repeat key press then attempt to start a browser
    487493    if ((WParam == '\r') && !(LParam & 0xe0000000)) {
    488       if (enter_library (Window) && !gs_show_console)
     494      if (enter_library (Window) && !gsdl_show_console)
    489495    ShowWindow(Window,SW_MINIMIZE);
    490496    }
     
    493499    if ((HWND)LParam == GoButton) {
    494500      // attempt to start a browser
    495       if (enter_library (Window) && !gs_show_console)
     501      if (enter_library (Window) && !gsdl_show_console)
    496502    ShowWindow(Window,SW_MINIMIZE);
    497503
     
    591597  startbrowserdir[0] = '\0';
    592598  netscapeneeded = 0;
    593   //    int err = tryinitnetwork (Instance, MsgWindow, NULL);
    594   int err = 1;
     599  int err = tryinitnetwork (Instance, MsgWindow, NULL);
     600  //int err = 1;
    595601 
    596602  // if an error occurred, try again with billsock
     
    624630    netscapeneeded = 1;
    625631    // make sure the browser state is in step with the network condition
    626     gs_check_browser_settings (netscapeneeded);
     632    gsdl_check_browser_settings (netscapeneeded);
    627633      }
    628634     
    629635      // check to see if a browser is running
    630       if (browserrunning(gs_browser_exe) == NO_ERROR) {
     636      if (browserrunning(gsdl_browser_exe) == NO_ERROR) {
    631637    MessageBox (NULL,
    632638            "The Greenstone Digital Library software has detected a\n"
     
    748754 
    749755  // get various information about this computer
    750   if (gs_keep_log || gs_show_console) {
     756  if (gsdl_keep_log || gsdl_show_console) {
    751757    // get operating system information
    752758    OSVERSIONINFO osver;
     
    856862  // init various modules
    857863  read_settings (0); // don't know if netscape is needed at this point
    858   if (!gsdl_init()) // quit if can't initialise the library correctly
    859     exit (0);
    860   initstartbrowser();
    861   log_computer_info ();
    862  
     864
    863865  // attempt to initialise the network
     866  // we do this first now as gsdl_init
     867  // needs networking initialized to
     868  // set httpprefix - Stefan.
     869  // -- gsdl_init doesn't currently set httpprefix,
     870  // it did for a brief time when I was using some
     871  // scary html that didn't like relative links
    864872  have_networking = initnetwork (Instance, MainWindow);
    865873  if (!have_networking) {
     
    869877    exit (0); // there is no static library for this collection
    870878  }
     879
     880  if (!gsdl_init()) // quit if can't initialise the library correctly
     881    exit (0);
     882  initstartbrowser();
     883  log_computer_info ();
     884
    871885  // show the initialising message for at least 1 second
    872886  while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) {
     
    875889 
    876890  // if autoenter is enabled attempt to start a browser
    877   if (have_networking && gs_auto_enter) {
     891  if (have_networking && gsdl_auto_enter) {
    878892    infostring = strsb;
    879893    paint_window (pdc, windowRect);
    880894    lastcheck = GetTickCount();
    881     if (enter_library (MainWindow) && !gs_show_console) {
     895    if (enter_library (MainWindow) && !gsdl_show_console) {
    882896      // stay maximised for at least 1 second
    883897      while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) Sleep (1);
     
    916930  // we will ask if they want to close the
    917931  // the library down
    918   char last_gs_browser_exe[MAX_FILENAME_SIZE]; // need to notice when the
     932  char last_gsdl_browser_exe[MAX_FILENAME_SIZE]; // need to notice when the
    919933  // browser setting changes
    920   strcpy (last_gs_browser_exe, gs_browser_exe);
     934  strcpy (last_gsdl_browser_exe, gsdl_browser_exe);
    921935 
    922936  for (;;) {
     
    929943      if (DiffTickCounts (lastcheck, GetTickCount()) > 500) {
    930944    // make sure the browser hasn't changed
    931     if (strcmp (last_gs_browser_exe, gs_browser_exe) != 0) {
     945    if (strcmp (last_gsdl_browser_exe, gsdl_browser_exe) != 0) {
    932946      seenbrowser = 0;
    933       strcpy (last_gs_browser_exe, gs_browser_exe);
     947      strcpy (last_gsdl_browser_exe, gsdl_browser_exe);
    934948    }
    935949   
    936950    // do check
    937951    lastcheck = GetTickCount();
    938     if (browserrunning(gs_browser_exe) == NO_ERROR) {
     952    if (browserrunning(gsdl_browser_exe) == NO_ERROR) {
    939953      // we were able to connect to a browser
    940954      seenbrowser = 1;
Note: See TracChangeset for help on using the changeset viewer.