Changeset 2407
- Timestamp:
- 2001-05-14T12:34:09+12:00 (23 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/macros/collect.dm
r2401 r2407 33 33 ####################################################################### 34 34 # icons 35 36 _iconcross_ {<img src="_httpimg_/cross.gif">} 37 _iconcross_ [v=1] {<b>no</b>} 38 _icontick_ {<img src="_httpimg_/tick.gif">} 39 _icontick_ [v=1] {<b>yes</b>} 40 _iconblank_ {<img src="_httpimg_/blank.gif>">} 41 _iconblank_ [v=1] {} 42 43 _imagemore_ {<a href="javascript:more()" onMouseover="roll('more',1);" onMouseOut="roll('more',0);"><img 44 name="more" src="_httpimg_/moreof.gif" onLoad="gbutton(this,'_httpimg_/moreon.gif');" border=0 alt="more"></a>} 45 _imagemore_ [v=1] {more} 35 46 36 47 _iconhcolect_ {<img src="_httpimg_/h_colect.gif" alt="the collector" border=0>} … … 389 400 onChange="document.collectorform.bc1infochanged.value=1;") size=72> 390 401 <br> 391 <font color="#909090">392 402 The collection title is a short phrase used throughout the digital library to 393 403 identify the content of the collection. Example titles 394 404 include "Computer Science Technical Reports" and "Humanity 395 405 Development Library." 396 </font>397 406 398 407 <h4>Contact email address:</h4> … … 400 409 onChange="document.collectorform.bc1infochanged.value=1;" size=72> 401 410 <br> 402 <font color="#909090">403 411 This email address specifies the first point of contact for the collection. 404 412 If the Greenstone software detects a problem, a diagnostic report is 405 413 sent to this address. Enter an email address in its full form: 406 414 <tt>name@domain</tt>. 407 </font>408 415 409 416 <h4>About this collection:</h4> … … 413 420 </textarea> 414 421 <br> 415 <font color="#909090">416 422 This is statement describing the principles governing what is included in the 417 423 collection. It appears on the first page when the collection is presented. 418 </font>419 424 420 425 <p>_iconblankbar_ … … 477 482 \} 478 483 479 function more ( type) \{484 function more () \{ 480 485 var form = document.collectorform; 481 if (type == "file") \{ 482 form.bc1filenum.value = form.bc1filenum.value * 2; 483 \} else if (type == "http") \{ 484 form.bc1httpnum.value = form.bc1httpnum.value * 2; 485 \} else if (type == "ftp") \{ 486 form.bc1ftpnum.value = form.bc1ftpnum.value * 2; 487 \} 486 form.bc1inputnum.value = form.bc1inputnum.value * 2; 488 487 form.p.value = "srce"; 489 488 form.submit(); … … 500 499 501 500 _srcebadsources_ { 502 <p>One or more of the input sources you specified is unavailable. 501 <p>One or more of the input sources you specified is unavailable (marked 502 "X" below). 503 504 <p>This might be because 505 <ul> 506 <li>The file, FTP site or URL does not exist. 507 <li>You need to dial up your ISP first. 508 <li>You are trying to access a URL from behind a firewall (this is the case 509 if you normally have to present a username and password to access the 510 internet). 511 </ul> 512 513 <p>If this is a URL that you can see in your browser, it may be coming from 514 a locally cached copy. Unfortunately, locally cached copies are invisible 515 to our mirroring process. In this case we recommend that you download the 516 pages using your browser first. 503 517 } 504 518 … … 539 553 <input type=hidden name="bc1clonechanged" value="0"> 540 554 <input type=hidden name="bc1clone" value="_cgiargbc1clone_"> 541 <input type=hidden name="bc1filenum" value="_cgiargbc1filenum_"> 542 <input type=hidden name="bc1httpnum" value="_cgiargbc1httpnum_"> 543 <input type=hidden name="bc1ftpnum" value="_cgiargbc1ftpnum_"> 555 <input type=hidden name="bc1inputnum" value="_cgiargbc1inputnum_"> 544 556 545 557 <center> … … 550 562 551 563 <h4>Input source:</h4> 552 553 <table border=0> 554 <tr valign=top><td><b>file://</b></td> 555 <td>_filelist_</td> 556 </tr> 557 <tr valign=top><td><b>http://</b></td> 558 <td>_httplist_</td> 559 </tr> 560 <tr valign=top><td><b>ftp://</b></td> 561 <td>_ftplist_</td> 562 </tr></table> 564 _sourcelist_ 563 565 564 566 <p>If you use file:// or ftp:// to specify a file, that file will be -
trunk/gsdl/src/recpt/collectoraction.cpp
r2401 r2407 198 198 argsinfo.addarginfo (NULL, arg_ainfo); 199 199 200 arg_ainfo.shortname = "bc1 filenum";200 arg_ainfo.shortname = "bc1inputnum"; 201 201 arg_ainfo.longname = "collector specific"; 202 202 arg_ainfo.multiplechar = true; 203 203 arg_ainfo.defaultstatus = cgiarginfo::weak; 204 arg_ainfo.argdefault = " 1";204 arg_ainfo.argdefault = "3"; 205 205 arg_ainfo.savedarginfo = cgiarginfo::mustnot; // saved on disk 206 206 argsinfo.addarginfo (NULL, arg_ainfo); 207 207 208 arg_ainfo.shortname = "bc1httpnum"; 209 arg_ainfo.longname = "collector specific"; 210 arg_ainfo.multiplechar = true; 211 arg_ainfo.defaultstatus = cgiarginfo::weak; 212 arg_ainfo.argdefault = "1"; 213 arg_ainfo.savedarginfo = cgiarginfo::mustnot; // saved on disk 214 argsinfo.addarginfo (NULL, arg_ainfo); 215 216 arg_ainfo.shortname = "bc1ftpnum"; 217 arg_ainfo.longname = "collector specific"; 218 arg_ainfo.multiplechar = true; 219 arg_ainfo.defaultstatus = cgiarginfo::weak; 220 arg_ainfo.argdefault = "1"; 221 arg_ainfo.savedarginfo = cgiarginfo::mustnot; // saved on disk 222 argsinfo.addarginfo (NULL, arg_ainfo); 223 224 arg_ainfo.shortname = "bc1fileinput"; 208 arg_ainfo.shortname = "bc1input"; 225 209 arg_ainfo.longname = "collector specific"; 226 210 arg_ainfo.multiplechar = true; … … 231 215 argsinfo.addarginfo (NULL, arg_ainfo); 232 216 233 arg_ainfo.shortname = "bc1httpinput"; 234 arg_ainfo.longname = "collector specific"; 235 arg_ainfo.multiplechar = true; 236 arg_ainfo.multiplevalue = true; 237 arg_ainfo.defaultstatus = cgiarginfo::weak; 238 arg_ainfo.argdefault = ""; 239 arg_ainfo.savedarginfo = cgiarginfo::mustnot; // saved on disk 240 argsinfo.addarginfo (NULL, arg_ainfo); 241 242 arg_ainfo.shortname = "bc1ftpinput"; 217 arg_ainfo.shortname = "bc1inputtype"; 243 218 arg_ainfo.longname = "collector specific"; 244 219 arg_ainfo.multiplechar = true; … … 358 333 saved_args["bc1clone"] = ""; 359 334 saved_args["bc1clonecol"] = ""; 360 saved_args["bc1filenum"] = ""; 361 saved_args["bc1httpnum"] = ""; 362 saved_args["bc1ftpnum"] = ""; 363 saved_args["bc1fileinput"] = ""; 364 saved_args["bc1httpinput"] = ""; 365 saved_args["bc1ftpinput"] = ""; 335 saved_args["bc1inputnum"] = ""; 336 saved_args["bc1input"] = ""; 337 saved_args["bc1inputtype"] = ""; 366 338 367 339 // update the argdb database with any arguments that were set … … 864 836 } 865 837 866 // set _ filelist_, _httplist_, _ftplist_ and _badsources_ macros838 // set _sourcelist_ and _badsources_ macros 867 839 void collectoraction::set_inputsourceboxes (displayclass &disp, cgiargsclass &args, 868 840 ostream &logout) { … … 870 842 if (badsources) disp.setmacro ("badsources", "collector", "1"); 871 843 872 int numfileboxes = args["bc1filenum"].getint(); 873 int numhttpboxes = args["bc1httpnum"].getint(); 874 int numftpboxes = args["bc1ftpnum"].getint(); 875 876 text_t filelist = get_source_box(args["bc1fileinput"], numfileboxes, "file"); 877 text_t httplist = get_source_box(args["bc1httpinput"], numhttpboxes, "http"); 878 text_t ftplist = get_source_box(args["bc1ftpinput"], numftpboxes, "ftp"); 879 880 disp.setmacro("filelist", "collector", dm_safe(filelist)); 881 disp.setmacro("httplist", "collector", dm_safe(httplist)); 882 disp.setmacro("ftplist", "collector", dm_safe(ftplist)); 844 text_t sourcelist = get_source_box(args["bc1input"], args["bc1inputnum"].getint(), 845 args["bc1inputtype"]); 846 847 disp.setmacro("sourcelist", "collector", sourcelist); 883 848 884 849 // reset badsources and failedsources variables … … 887 852 } 888 853 889 text_t collectoraction::get_source_box (text_t inputarg, int numboxes, text_t boxtype) { 890 891 text_tarray files; 892 // this relies on filenames/URLs/ftp addresses not being able to contain 854 text_t collectoraction::get_source_box (text_t inputarglist, int numboxes, 855 text_t inputtypelist) { 856 857 text_tarray inputvalues; 858 // this relies on filenames/URLs not being able to contain 893 859 // commas 894 splitchar (inputarg.begin(), inputarg.end(), ',', files); 895 896 text_t rv = "<table border=0>\n"; 860 splitchar (inputarglist.begin(), inputarglist.end(), ',', inputvalues); 861 // remove any empty values from the end of the array 862 if (inputvalues.size()) { 863 text_tarray::iterator l = inputvalues.end() - 1; 864 text_tarray::iterator b = inputvalues.begin(); 865 while ((*l).empty() && l >= b) { 866 l--; 867 } 868 inputvalues.erase(l+1, inputvalues.end()); 869 } 870 871 text_tarray inputtypes; 872 splitchar (inputtypelist.begin(), inputtypelist.end(), ',', inputtypes); 873 874 int numvalues = inputvalues.size(); 875 int numtypes = inputtypes.size(); 876 877 text_t last = "file://"; 878 text_t rv; 897 879 for (int i = 0; i < numboxes; i++) { 898 rv += "<tr><td><input type=text name=\"bc1" + boxtype + "input\" value=\""; 899 if (i < files.size()) { 900 rv += files[i]; 901 } 902 rv += "\" size=50></td>"; 880 rv += "<nobr><select name=\"bc1inputtype\">\n"; 881 rv += "<option value=\"file://\""; 882 if ((i < numtypes && inputtypes[i] == "file://") || 883 (numboxes == 3 && i == 0 && numvalues == 0) || 884 (i >= 3 && i >= numvalues && last == "file://")) { 885 rv += " selected"; 886 last = "file://"; 887 } 888 rv += ">file://\n"; 889 rv += "<option value=\"http://\""; 890 if ((i < numtypes && inputtypes[i] == "http://") || 891 (numboxes == 3 && i == 1 && numvalues == 0) || 892 (i >= 3 && i >= numvalues && last == "http://")) { 893 rv += " selected"; 894 last = "http://"; 895 } 896 rv += ">http://\n"; 897 rv += "<option value=\"ftp://\""; 898 if ((i < numtypes && inputtypes[i] == "ftp://") || 899 (numboxes == 3 && i == 2 && numvalues == 0) || 900 (i >= 3 && i >= numvalues && last == "ftp://")) { 901 rv += " selected"; 902 last = "ftp://"; 903 } 904 rv += ">ftp://\n"; 905 rv += "</select>\n"; 906 rv += "<input type=text name=\"bc1input\" value=\""; 907 if (i < numvalues) { 908 rv += dm_safe(inputvalues[i]); 909 } 910 rv += "\" size=50>"; 903 911 if (badsources) { 904 if ((i < files.size()) && (!files[i].empty())) {905 if (failedsources[ files[i]] == "1") {906 rv += " <td width=40>no</td>";912 if ((i < numvalues) && (!inputvalues[i].empty())) { 913 if (failedsources[inputvalues[i]] == "1") { 914 rv += "_iconcross_"; 907 915 } else { 908 rv += " <td width=40>yes</td>";916 rv += "_icontick_"; 909 917 } 910 918 } else { 911 rv += " <td width=40></td>";919 rv += "_iconblank_"; 912 920 } 913 921 } 914 922 if (i+1 == numboxes) { 915 rv += " <td><a href=\"javascript:more('" + boxtype + "')\">more</a></td></tr>\n";923 rv += "_imagemore_</nobr>"; 916 924 } else { 917 rv += "<td></td></tr>\n"; 918 } 919 } 920 rv += "</table>\n"; 925 rv += "</nobr>\n"; 926 } 927 } 921 928 922 929 return rv; … … 1005 1012 // _gsdlhome_ - the gsdlhome path (dm_safe) 1006 1013 1007 // _filelist_ -- these three display "input source" text boxes 1008 // _httplist_ -- for the "source data" page 1009 // _ftplist_ -- 1010 1014 // _sourcelist_ -- "input source" text boxes 1011 1015 // _badsources_ -- will be set to "1" if we've come from the 1012 1016 // "source data" page and there's a problem … … 1636 1640 } 1637 1641 1638 text_tarray files; 1639 text_t filevals = args["bc1fileinput"]; 1640 // this relies on filenames not being able to contain commas 1641 splitchar (filevals.begin(), filevals.end(), ',', files); 1642 text_tarray::const_iterator here = files.begin(); 1643 text_tarray::const_iterator end = files.end(); 1644 while (here != end) { 1645 options += " -download \"" + *here + "\""; 1646 here ++; 1647 } 1648 text_tarray https; 1649 text_t httpvals = args["bc1httpinput"]; 1650 // this relies on URLs not being able to contain commas 1651 splitchar (httpvals.begin(), httpvals.end(), ',', https); 1652 here = https.begin(); 1653 end = https.end(); 1654 while (here != end) { 1655 options += " -download \"" + *here + "\""; 1656 here ++; 1657 } 1658 text_tarray ftps; 1659 text_t ftpvals = args["bc1ftpinput"]; 1660 // this relies on ftp addresses not being able to contain commas 1661 splitchar (ftpvals.begin(), ftpvals.end(), ',', ftps); 1662 here = ftps.begin(); 1663 end = ftps.end(); 1664 while (here != end) { 1665 options += " -download \"" + *here + "\""; 1666 here ++; 1642 text_tarray inputvalues, inputtypes; 1643 // this relies on filenames/URLs not being able to contain commas 1644 splitchar (args["bc1input"].begin(), args["bc1input"].end(), ',', inputvalues); 1645 splitchar (args["bc1inputtype"].begin(), args["bc1inputtype"].end(), ',', inputtypes); 1646 int numvalues = inputvalues.size(); 1647 int numtypes = inputtypes.size(); 1648 for (int i = 0; i < numvalues; i++) { 1649 if (!inputvalues[i].empty()) { 1650 text_t type = "file://"; // default 1651 if (i < numtypes) type = inputtypes[i]; 1652 options += " -download \"" + type + format_url(inputvalues[i]) + "\""; 1653 } 1667 1654 } 1668 1655 … … 1863 1850 bool found = false; 1864 1851 1865 // check local filesystem for file:// sources 1866 text_tarray files; 1867 text_t filevals = args["bc1fileinput"]; 1868 // this relies on filenames not being able to contain commas 1869 splitchar (filevals.begin(), filevals.end(), ',', files); 1870 text_tarray::const_iterator here = files.begin(); 1871 text_tarray::const_iterator end = files.end(); 1872 while (here != end) { 1873 text_t file = format_url(*here); 1874 if (!file_exists(file) && !directory_exists(file)) { 1875 failedsources[*here] = "1"; 1876 badsources = true; 1877 } 1878 found = true; 1879 here ++; 1880 } 1881 1882 // ping http:// sources 1883 files.erase(files.begin(), files.end()); 1884 text_t httpvals = args["bc1httpinput"]; 1885 // this relies on URLs not being able to contain commas 1886 splitchar (httpvals.begin(), httpvals.end(), ',', files); 1887 here = files.begin(); 1888 end = files.end(); 1889 while (here != end) { 1890 if (gsdl_system ("perl -S ping.pl -quiet http://" + format_url(*here), true, logout)) { 1891 failedsources[*here] = "1"; 1892 badsources = true; 1893 } 1894 found = true; 1895 here++; 1896 } 1897 1898 // ping ftp:// sources 1899 files.erase(files.begin(), files.end()); 1900 text_t ftpvals = args["bc1ftpinput"]; 1901 // this relies on FTP addresses not being able to contain commas 1902 splitchar (ftpvals.begin(), ftpvals.end(), ',', files); 1903 here = files.begin(); 1904 end = files.end(); 1905 while (here != end) { 1906 if (gsdl_system ("perl -S ping.pl -quiet ftp://" + format_url(*here), true, logout)) { 1907 failedsources[*here] = "1"; 1908 badsources = true; 1909 } 1910 found = true; 1911 here++; 1852 text_tarray inputvalues; 1853 // this relies on filenames/URLs not being able to contain 1854 // commas 1855 splitchar (args["bc1input"].begin(), args["bc1input"].end(), ',', inputvalues); 1856 1857 text_tarray inputtypes; 1858 splitchar (args["bc1inputtype"].begin(), args["bc1inputtype"].end(), ',', inputtypes); 1859 1860 int numvalues = inputvalues.size(); 1861 int numtypes = inputtypes.size(); 1862 1863 for (int i = 0; i < numvalues; i++) { 1864 text_t value = format_url(inputvalues[i]); 1865 text_t type = "file://"; // default 1866 if (!value.empty()) { 1867 found = true; 1868 if (i >= numtypes || inputtypes[i].empty()) { 1869 logout << "collectoraction::check_sources: WARNING type not set\n"; 1870 } else { 1871 type = inputtypes[i]; 1872 } 1873 if (type == "file://") { 1874 if (!file_exists(value) && !directory_exists(value)) { 1875 failedsources[inputvalues[i]] = "1"; 1876 badsources = true; 1877 } 1878 } else if (type == "http://") { 1879 if (gsdl_system ("perl -S ping.pl -quiet http://" + value, true, logout)) { 1880 failedsources[inputvalues[i]] = "1"; 1881 badsources = true; 1882 } 1883 } else if (type == "ftp://") { 1884 if (gsdl_system ("perl -S ping.pl -quiet ftp://" + value, true, logout)) { 1885 failedsources[inputvalues[i]] = "1"; 1886 badsources = true; 1887 } 1888 } 1889 } 1912 1890 } 1913 1891 -
trunk/gsdl/src/recpt/collectoraction.h
r2401 r2407 57 57 ostream &logout); 58 58 59 text_t get_source_box (text_t inputarg, int numboxes, text_t boxtype); 59 text_t get_source_box (text_t inputarglist, int numboxes, 60 text_t inputtypelist); 60 61 61 62 void set_cfgfile (displayclass &disp, cgiargsclass &args, ostream &logout);
Note:
See TracChangeset
for help on using the changeset viewer.