Changeset 902 for trunk/gsdl/src/w32server/fnord.cpp
- Timestamp:
- 2000-02-03T14:45:48+13:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/w32server/fnord.cpp
r611 r902 77 77 #define ENTERBUTTONY ((MAINWINDOWHEIGHT-RESTHEIGHT)+5) 78 78 79 #define VERSIONSTRING "version 1. 1"79 #define VERSIONSTRING "version 1.0" 80 80 const char versionstring[] = VERSIONSTRING; 81 81 … … 196 196 197 197 // decide what we want to draw 198 if (gs _show_console) {198 if (gsdl_show_console) { 199 199 // we want to draw a "console" window 200 200 if (window_state != console_window || … … 278 278 // returns 1 on success, 0 otherwise 279 279 int enter_library (HWND Window) { 280 char url[256], numbuf[20];281 280 int res; 282 281 283 282 // get the url and attempt to start a browser 283 char *localname = GetLocalName(NULL); 284 284 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 294 291 // 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 i toa ((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); 301 298 302 299 // remember the library access number for later proxy checking … … 305 302 // do a quick check to make sure we're using netscape when 306 303 // 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(); 309 307 if (strlen (startbrowserdir) <= 0) { 310 res = startbrowser ( url, gs_browser_exe, NULL);308 res = startbrowser (cstr_url, gsdl_browser_exe, NULL); 311 309 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 314 314 } else { 315 /* 315 316 char staticpath[256]; 316 317 317 318 // try to find the static pages 318 strcpy (url, gs _staticpages);319 strcpy (url, gsdl_staticpages); 319 320 320 321 // remove any slashes from the static pathname … … 341 342 strcat (url, "niupepa.htm"); 342 343 343 res = startbrowser (url, gs _browser_exe, NULL);344 res = startbrowser (url, gsdl_browser_exe, NULL); 344 345 startbrowserdir[0] = '\0'; // doesn't make sense for non-networked case 346 */ 345 347 } 346 348 … … 393 395 394 396 // 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; 396 400 397 401 // remove any slashes from the pathname … … 457 461 458 462 // 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; 460 466 strcpy (cmd, "notepad "); 461 467 … … 486 492 // repeat key press then attempt to start a browser 487 493 if ((WParam == '\r') && !(LParam & 0xe0000000)) { 488 if (enter_library (Window) && !gs _show_console)494 if (enter_library (Window) && !gsdl_show_console) 489 495 ShowWindow(Window,SW_MINIMIZE); 490 496 } … … 493 499 if ((HWND)LParam == GoButton) { 494 500 // attempt to start a browser 495 if (enter_library (Window) && !gs _show_console)501 if (enter_library (Window) && !gsdl_show_console) 496 502 ShowWindow(Window,SW_MINIMIZE); 497 503 … … 591 597 startbrowserdir[0] = '\0'; 592 598 netscapeneeded = 0; 593 //int err = tryinitnetwork (Instance, MsgWindow, NULL);594 int err = 1;599 int err = tryinitnetwork (Instance, MsgWindow, NULL); 600 //int err = 1; 595 601 596 602 // if an error occurred, try again with billsock … … 624 630 netscapeneeded = 1; 625 631 // make sure the browser state is in step with the network condition 626 gs _check_browser_settings (netscapeneeded);632 gsdl_check_browser_settings (netscapeneeded); 627 633 } 628 634 629 635 // check to see if a browser is running 630 if (browserrunning(gs _browser_exe) == NO_ERROR) {636 if (browserrunning(gsdl_browser_exe) == NO_ERROR) { 631 637 MessageBox (NULL, 632 638 "The Greenstone Digital Library software has detected a\n" … … 748 754 749 755 // get various information about this computer 750 if (gs _keep_log || gs_show_console) {756 if (gsdl_keep_log || gsdl_show_console) { 751 757 // get operating system information 752 758 OSVERSIONINFO osver; … … 856 862 // init various modules 857 863 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 863 865 // 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 864 872 have_networking = initnetwork (Instance, MainWindow); 865 873 if (!have_networking) { … … 869 877 exit (0); // there is no static library for this collection 870 878 } 879 880 if (!gsdl_init()) // quit if can't initialise the library correctly 881 exit (0); 882 initstartbrowser(); 883 log_computer_info (); 884 871 885 // show the initialising message for at least 1 second 872 886 while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) { … … 875 889 876 890 // if autoenter is enabled attempt to start a browser 877 if (have_networking && gs _auto_enter) {891 if (have_networking && gsdl_auto_enter) { 878 892 infostring = strsb; 879 893 paint_window (pdc, windowRect); 880 894 lastcheck = GetTickCount(); 881 if (enter_library (MainWindow) && !gs _show_console) {895 if (enter_library (MainWindow) && !gsdl_show_console) { 882 896 // stay maximised for at least 1 second 883 897 while (DiffTickCounts (lastcheck, GetTickCount()) < 1000) Sleep (1); … … 916 930 // we will ask if they want to close the 917 931 // the library down 918 char last_gs _browser_exe[MAX_FILENAME_SIZE]; // need to notice when the932 char last_gsdl_browser_exe[MAX_FILENAME_SIZE]; // need to notice when the 919 933 // browser setting changes 920 strcpy (last_gs _browser_exe, gs_browser_exe);934 strcpy (last_gsdl_browser_exe, gsdl_browser_exe); 921 935 922 936 for (;;) { … … 929 943 if (DiffTickCounts (lastcheck, GetTickCount()) > 500) { 930 944 // 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) { 932 946 seenbrowser = 0; 933 strcpy (last_gs _browser_exe, gs_browser_exe);947 strcpy (last_gsdl_browser_exe, gsdl_browser_exe); 934 948 } 935 949 936 950 // do check 937 951 lastcheck = GetTickCount(); 938 if (browserrunning(gs _browser_exe) == NO_ERROR) {952 if (browserrunning(gsdl_browser_exe) == NO_ERROR) { 939 953 // we were able to connect to a browser 940 954 seenbrowser = 1;
Note:
See TracChangeset
for help on using the changeset viewer.