Changeset 11998
- Timestamp:
- 2006-07-04T15:23:58+12:00 (18 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/Makefile.in
r11441 r11998 55 55 -I../../packages/mg/lib -I../../packages/mg/src/text \ 56 56 -I../../packages/expat/include \ 57 -I../../packages/cgicc/include \ 57 58 -I../mgpp/lib -I../mgpp/text -I../.. 58 59 else … … 61 62 -I../../packages/mg/lib -I../../packages/mg/src/text \ 62 63 -I../../packages/expat/include \ 64 -I../../packages/cgicc/include \ 63 65 -I../../packages/fcgi/include -I../mgpp/lib \ 64 66 -I../mgpp/text -I../.. … … 93 95 LDFLAGS = @LDFLAGS@ 94 96 GDBM_LIBS=@GDBM_LIBPATH@ -lgdbm 95 LIBS = $(GDBM_LIBS) $(LC_LIBS) @LIBS@97 LIBS = $(GDBM_LIBS) $(LC_LIBS) -L../../packages/cgicc/lib -lcgicc @LIBS@ 96 98 GSDLOS = @gsdlos@ 97 99 INSTALL = @INSTALL@ … … 109 111 110 112 # in case gdbm.h/libgdbm.a are in a non-standard place... 111 GDBM_OBJS=argdb.o authenaction.o collectoraction.o infodbclass.o userdb.o usersaction.o historydb.o librarymain.o nullproto.o queryaction.o z3950proto.o113 GDBM_OBJS=argdb.o authenaction.o collectoraction.o depositoraction.o wizardaction.o infodbclass.o userdb.o usersaction.o historydb.o librarymain.o nullproto.o queryaction.o z3950proto.o 112 114 113 115 ifeq ($(USE_CORBA), 1) … … 154 156 userdb.h usersaction.h vlistbrowserclass.h hlistbrowserclass.h \ 155 157 datelistbrowserclass.h invbrowserclass.h pagedbrowserclass.h \ 156 htmlbrowserclass.h phindbrowserclass.h historydb.h collectoraction.h \158 htmlbrowserclass.h phindbrowserclass.h historydb.h collectoraction.h depositoraction.h wizardaction.h \ 157 159 phindaction.h summarise.h highlighttext.h gtiaction.h 158 160 … … 176 178 vlistbrowserclass.cpp hlistbrowserclass.cpp datelistbrowserclass.cpp \ 177 179 invbrowserclass.cpp pagedbrowserclass.cpp htmlbrowserclass.cpp \ 178 phindbrowserclass.cpp historydb.cpp collectoraction.cpp argdb.cpp \180 phindbrowserclass.cpp historydb.cpp collectoraction.cpp depositoraction.cpp wizardaction.cpp argdb.cpp \ 179 181 browseactiontools.h formattools.cpp phindaction.cpp summarise.cpp \ 180 182 highlighttext.cpp gtiaction.cpp … … 210 212 hlistbrowserclass.o datelistbrowserclass.o invbrowserclass.o \ 211 213 pagedbrowserclass.o htmlbrowserclass.o phindbrowserclass.o \ 212 historydb.o $(Z_COMOBJS) collectoraction.o phindaction.o \214 historydb.o $(Z_COMOBJS) collectoraction.o depositoraction.o wizardaction.o phindaction.o \ 213 215 summarise.o highlighttext.o gtiaction.o 214 216 -
trunk/gsdl/src/recpt/cgiutils.cpp
r11259 r11998 26 26 #include "cgiutils.h" 27 27 #include "gsdlunicode.h" 28 #include "fileutil.h" 28 29 #include "unitool.h" // in mg, for output_utf8_char 30 29 31 30 32 static unsigned short hexdigit (unsigned short c) { … … 120 122 text_t::const_iterator end = argstr.end(); 121 123 text_t key, value; 122 124 125 text_tset multivalue; 126 127 123 128 // extract out the key=value pairs 124 129 while (here != end) { … … 140 145 // again before use) - it should use an array instead 141 146 const cgiarginfo *info = argsinfo.getarginfo (key); 142 if (info != NULL && info->multiplevalue) { 143 text_t newvalue = args[key]; 144 if (args.lookupcgiarg(key).source == cgiarg_t::cgi_arg) newvalue += ","; 145 newvalue += encode_commas(value); 146 args.setarg (key, newvalue, cgiarg_t::cgi_arg); 147 148 } else { 149 args.setarg (key, value, cgiarg_t::cgi_arg); 147 148 if (info==NULL) { 149 if (args.getarg(key)==NULL) { 150 args.setarg (key, encode_commas(value), cgiarg_t::cgi_arg); 151 } 152 else { 153 text_t newvalue = args[key]; 154 155 newvalue += "," + encode_commas(value); 156 args.setarg (key, newvalue, cgiarg_t::cgi_arg); 157 } 158 } 159 else { 160 if (info->multiplevalue) { 161 162 text_t newvalue = args[key]; 163 if (args.lookupcgiarg(key).source == cgiarg_t::cgi_arg) newvalue += ","; 164 newvalue += encode_commas(value); 165 args.setarg (key, newvalue, cgiarg_t::cgi_arg); 166 167 } else { 168 args.setarg (key, value, cgiarg_t::cgi_arg); 169 } 150 170 } 151 171 } -
trunk/gsdl/src/recpt/cgiwrapper.cpp
r9620 r11998 42 42 #endif 43 43 44 #include "cgicc/Cgicc.h" 45 46 using namespace cgicc; 47 extern Cgicc* formData; 48 49 44 50 #ifdef USE_FASTCGI 45 51 #include "fcgiapp.h" … … 467 473 char *aURIStr; 468 474 if (!isfastcgi) { 469 char *request_method_str = getenv("REQUEST_METHOD"); 470 char *content_length_str = getenv("CONTENT_LENGTH"); 471 if (request_method_str != NULL && strcmp(request_method_str, "POST") == 0 && 472 content_length_str != NULL) { 473 // POST form data 474 int content_length = text_t(content_length_str).getint(); 475 if (content_length > 0) { 476 char c; 477 do { 478 cin.get(c); 479 if (cin.eof()) break; 480 argstr.push_back (c); 481 --content_length; 482 } while (content_length > 0); 475 476 477 // Iterate through the vector, and synthesis argstr 478 bool first = true; 479 480 for(const_form_iterator iter = formData->getElements().begin(); 481 iter != formData->getElements().end(); 482 ++iter) { 483 484 const char* name_cstr = iter->getName().c_str(); 485 const char* value_cstr = iter->getValue().c_str(); 486 if (first) { 487 488 argstr = name_cstr; 489 argstr.append("="); 490 argstr.append(value_cstr); 491 first = false; 483 492 } 484 485 } else { 486 aURIStr = getenv("QUERY_STRING"); 487 if ((request_method_str != NULL && strcmp(request_method_str, "GET") == 0) 488 || aURIStr != NULL) { 489 // GET form data 490 if (aURIStr != NULL) argstr = aURIStr; 491 } else { 492 // debugging from command line 493 debug = true; 493 else { 494 argstr.append("&"); 495 argstr.append(name_cstr); 496 argstr.append("="); 497 argstr.append(value_cstr); 494 498 } 495 } 499 } 496 500 } 497 501 -
trunk/gsdl/src/recpt/collectoraction.cpp
r11166 r11998 56 56 #endif 57 57 58 collectoraction::collectoraction () { 59 60 recpt = NULL; 61 disabled = true; 58 collectoraction::collectoraction () 59 : wizardaction() 60 { 61 macro_prefix = "bc1"; 62 62 63 do_mkcol = false; 63 64 badsources = false; 64 65 failedsources.erase(failedsources.begin(), failedsources.end()); 65 gsdlosc = NULL;66 gsdlhomec = NULL;67 pathc = NULL;68 66 69 67 cgiarginfo arg_ainfo; … … 245 243 246 244 collectoraction::~collectoraction () { 247 if (gsdlosc != NULL) delete []gsdlosc;248 if (gsdlhomec != NULL) delete []gsdlhomec;249 if (pathc != NULL) delete []pathc;250 245 } 251 246 252 247 253 void collectoraction::configure (const text_t &key, const text_tarray &cfgline) {254 if ((key == "collector") && (cfgline.size() == 1) &&255 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) {256 disabled = false;257 } else {258 // call the parent class to deal with the things which259 // are not dealt with here260 action::configure (key, cfgline);261 }262 }263 264 265 bool collectoraction::init (ostream & /*logout*/) {266 267 // set up GSDLOS, GSDLHOME and PATH environment variables268 text_t gsdlos, path;269 unsigned int path_separator = ':';270 #if defined (__WIN32__)271 gsdlos = "windows";272 path_separator = ';';273 274 path = filename_cat (gsdlhome, "bin", "windows", "perl", "bin;");275 276 #else277 struct utsname *buf = new struct utsname();278 int i = uname (buf);279 if (i == -1) gsdlos = "linux"; // uname failed280 else gsdlos.setcstr (buf->sysname);281 delete buf;282 lc (gsdlos);283 #endif284 285 pathc = getenv ("PATH");286 path += filename_cat (gsdlhome, "bin", gsdlos);287 path.push_back (path_separator);288 path += filename_cat (gsdlhome, "bin", "script");289 if (pathc != NULL) {290 path.push_back (path_separator);291 path += pathc;292 }293 path = "PATH=" + path;294 295 gsdlos = "GSDLOS=" + gsdlos;296 text_t setgsdlhome = "GSDLHOME=" + gsdlhome;297 298 // these will be cleaned up in the destructor299 gsdlosc = gsdlos.getcstr();300 gsdlhomec = setgsdlhome.getcstr();301 pathc = path.getcstr();302 303 putenv (gsdlosc);304 putenv (gsdlhomec);305 putenv (pathc);306 307 return true;308 }309 248 310 249 bool collectoraction::check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args, … … 335 274 // clean up any old builds left laying about in the tmp directory 336 275 // (note that it's possible this could take some time if there's a huge 337 // partially built collect ion laying about so we'll make it an asynchronous276 // partially built collecton laying about so we'll make it an asynchronous 338 277 // system call) 339 278 gsdl_system ("perl -S cleantmp.pl", false, logout); … … 710 649 } 711 650 712 void collectoraction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,713 response_t &response,text_t &response_data,714 ostream &/*logout*/) {715 response = content;716 response_data = "text/html";717 }718 651 719 652 // return html for buttons used in collector bar … … 728 661 // will be hyperlinked 729 662 730 text_t collectoraction::get_button(const text_t &thispage, const text_t &color, 731 const text_t &type, bool enabled) { 732 733 if ((color != "green" && color != "grey" && color != "yellow") || 734 (type != "info" && type != "srce" && type != "conf" && type != "bild" && type != "view")) 735 return g_EmptyText; 736 737 text_t href = "_http"+type+"_"; 738 text_t target = ""; 739 if (thispage == "info" || thispage == "srce" || thispage == "conf" || 740 thispage == "bildcancel" || thispage == "bildfail") { 741 // call the check submit macro instead of linking directly to the page 742 href="\"javascript:check_submit('"+type+"');\""; 743 } else if (type == "view") { 744 // view button is special case as it needs a target=_top 745 target = " target=_top"; 746 } 747 748 text_t tdclass = "collectorbar"+color; 749 if (enabled) { 750 // link to the appropriate page 751 return "<td class="+tdclass+"><a href="+href+target+">_text"+type+"_</a></td>"; 752 } 753 else { 754 // just display the text 755 return "<td class="+tdclass+">_text"+type+"_</td>"; 756 } 757 } 758 663 // Wendy left a comment suggesting this be move, but where to 664 // was not specified. Into wizardaction.cpp? 759 665 760 666 // set the _fullnamemenu_ macro (and _warnindex_ and _selectedindex_ if … … 771 677 772 678 text_t ¤t_page = args["p"]; 773 text_t currentname = args[ "bc1dirname"];774 if (current_page == "srce") currentname = args[ "bc1clonecol"];679 text_t currentname = args[macro_prefix+"dirname"]; 680 if (current_page == "srce") currentname = args[macro_prefix + "clonecol"]; 775 681 776 682 text_tarray dirnames; … … 825 731 826 732 bool first = true; 733 827 734 text_t warnindex; 828 text_t fullnamemenu = "<select name=\"bc1dirname\">\n"; 735 text_t fullnamemenu = "<select name=\""+macro_prefix+"dirname\" onChange=\"menuchange();\">\n"; 736 829 737 if (current_page == "srce") { 830 fullnamemenu = "<select name=\" bc1clonecol\" onChange=\"menuchange();\">\n";738 fullnamemenu = "<select name=\""+macro_prefix+"clonecol\" onChange=\"menuchange();\">\n"; 831 739 fullnamemenu += "<option value=defaultstructure"; 832 740 if (!is_selected) fullnamemenu += " selected>"; … … 834 742 fullnamemenu += "_collector:textdefaultstructure_\n"; 835 743 } 744 745 fullnamemenu += "<option value=\"\"></option>\n"; 746 836 747 for (int i = 0; i < index; ++i) { 837 748 // don't want write protected collections in list on "change existing … … 863 774 } 864 775 fullnamemenu += "</select>\n"; 865 866 disp.setmacro ("fullnamemenu", "collector", fullnamemenu);776 text_t action_name = get_action_name(); 777 disp.setmacro ("fullnamemenu", action_name, fullnamemenu); 867 778 if (current_page == "srce") { 868 disp.setmacro ("warnindex", "collector", warnindex);869 disp.setmacro ("selectedindex", "collector", text_t(selected_index));779 disp.setmacro ("warnindex",action_name , warnindex); 780 disp.setmacro ("selectedindex", action_name, text_t(selected_index)); 870 781 } 871 782 } 783 872 784 873 785 // set _sourcelist_ and _badsources_ macros … … 1005 917 } 1006 918 1007 // set the _statusline_ macro1008 void collectoraction::set_statusline (displayclass &disp, cgiargsclass &args, ostream & /*logout*/) {1009 1010 // the build command creates .bld.download, .bld.import, and .bld.build files (in that1011 // order) and deletes them (also in that order) when each stage is complete. the .bld1012 // file is the concatenation of all these files.1013 text_t bld_file = filename_cat (gsdlhome, "tmp", args["bc1tmp"], args["bc1dirname"] + ".bld");1014 text_t statusline;1015 1016 if (file_exists (bld_file + ".download")) {1017 statusline = "_collector:textdownloadingfiles_<br>\n";1018 statusline += dm_safe(file_tail(bld_file + ".download", 1, 0));1019 } else if (file_exists (bld_file + ".import")) {1020 statusline = "_collector:textimportingcollection_<br>\n";1021 statusline += dm_safe(file_tail(bld_file + ".import", 1, 0));1022 } else if (file_exists (bld_file + ".build")) {1023 statusline = "_collector:textbuildingcollection_<br>\n";1024 statusline += dm_safe(file_tail(bld_file + ".build", 1, 0));1025 } else {1026 statusline += "_collector:textcreatingcollection_<br>\n";1027 statusline += dm_safe(file_tail(bld_file, 1, 0));1028 }1029 1030 disp.setmacro ("statusline", "collector", statusline);1031 1032 }1033 919 1034 920 void collectoraction::define_internal_macros (displayclass &disp, cgiargsclass &args, … … 1065 951 1066 952 // set the collectorbar macro 1067 text_t collectorbar = "<table class= collectorbar border=0 cellspacing=4 cellpadding=0><tr>\n";953 text_t collectorbar = "<table class=wizardbar border=0 cellspacing=4 cellpadding=0><tr>\n"; 1068 954 1069 955 if (collector_page == "new") { 1070 956 collectorbar += "<td>_icongreyarrow_</td>\n"; 1071 collectorbar += get_button ( collector_page, "green", "info", true);1072 collectorbar += "<td>_icongreyarrow_</td>\n"; 1073 collectorbar += get_button ( collector_page, "grey", "srce", false);1074 collectorbar += "<td>_icongreyarrow_</td>\n"; 1075 collectorbar += get_button ( collector_page, "grey", "conf", false);1076 collectorbar += "<td>_icongreyarrow_</td>\n"; 1077 collectorbar += get_button ( collector_page, "grey", "bild", false);1078 collectorbar += "<td>_icongreyarrow_</td>\n"; 1079 collectorbar += get_button ( collector_page, "grey", "view", false);957 collectorbar += get_button (args,collector_page, "green", "info", true); 958 collectorbar += "<td>_icongreyarrow_</td>\n"; 959 collectorbar += get_button (args,collector_page, "grey", "srce", false); 960 collectorbar += "<td>_icongreyarrow_</td>\n"; 961 collectorbar += get_button (args,collector_page, "grey", "conf", false); 962 collectorbar += "<td>_icongreyarrow_</td>\n"; 963 collectorbar += get_button (args,collector_page, "grey", "bild", false); 964 collectorbar += "<td>_icongreyarrow_</td>\n"; 965 collectorbar += get_button (args,collector_page, "grey", "view", false); 1080 966 1081 967 } else if (collector_page == "info") { 1082 968 collectorbar += "<td>_icongreyarrow_</td>\n"; 1083 collectorbar += get_button ( collector_page, "yellow", "info", false);1084 collectorbar += "<td>_icongreyarrow_</td>\n"; 1085 collectorbar += get_button ( collector_page, "green", "srce", true);1086 collectorbar += "<td>_icongreyarrow_</td>\n"; 1087 collectorbar += get_button ( collector_page, "grey", "conf", false);1088 collectorbar += "<td>_icongreyarrow_</td>\n"; 1089 collectorbar += get_button ( collector_page, "grey", "bild", false);1090 collectorbar += "<td>_icongreyarrow_</td>\n"; 1091 collectorbar += get_button ( collector_page, "grey", "view", false);969 collectorbar += get_button (args,collector_page, "yellow", "info", false); 970 collectorbar += "<td>_icongreyarrow_</td>\n"; 971 collectorbar += get_button (args,collector_page, "green", "srce", true); 972 collectorbar += "<td>_icongreyarrow_</td>\n"; 973 collectorbar += get_button (args,collector_page, "grey", "conf", false); 974 collectorbar += "<td>_icongreyarrow_</td>\n"; 975 collectorbar += get_button (args,collector_page, "grey", "bild", false); 976 collectorbar += "<td>_icongreyarrow_</td>\n"; 977 collectorbar += get_button (args,collector_page, "grey", "view", false); 1092 978 collectorbar += "</tr><tr><td></td><td align=center>_icongreyuparrow_</td><td colspan=8></td>\n"; 1093 979 … … 1097 983 // if we came from the "change an existing collection" page previous button(s) 1098 984 // are disabled 1099 collectorbar += get_button ( collector_page, "grey", "info", false);985 collectorbar += get_button (args,collector_page, "grey", "info", false); 1100 986 } else { 1101 collectorbar += get_button ( collector_page, "yellow", "info", true);1102 } 1103 collectorbar += "<td>_icongreyarrow_</td>\n"; 1104 collectorbar += get_button ( collector_page, "yellow", "srce", false);1105 collectorbar += "<td>_icongreyarrow_</td>\n"; 1106 collectorbar += get_button ( collector_page, "green", "conf", true);1107 collectorbar += "<td>_icongreyarrow_</td>\n"; 1108 collectorbar += get_button ( collector_page, "green", "bild", true);1109 collectorbar += "<td>_icongreyarrow_</td>\n"; 1110 collectorbar += get_button ( collector_page, "grey", "view", false);987 collectorbar += get_button (args,collector_page, "yellow", "info", true); 988 } 989 collectorbar += "<td>_icongreyarrow_</td>\n"; 990 collectorbar += get_button (args,collector_page, "yellow", "srce", false); 991 collectorbar += "<td>_icongreyarrow_</td>\n"; 992 collectorbar += get_button (args,collector_page, "green", "conf", true); 993 collectorbar += "<td>_icongreyarrow_</td>\n"; 994 collectorbar += get_button (args,collector_page, "green", "bild", true); 995 collectorbar += "<td>_icongreyarrow_</td>\n"; 996 collectorbar += get_button (args,collector_page, "grey", "view", false); 1111 997 collectorbar += "</tr><tr><td colspan=3></td><td align=center>_icongreyuparrow_</td><td colspan=6></td>\n"; 1112 998 … … 1116 1002 // page 1117 1003 if (esrce == 1 || econf == 1) { 1118 collectorbar += get_button ( collector_page, "grey", "info", false);1004 collectorbar += get_button (args,collector_page, "grey", "info", false); 1119 1005 } else { 1120 collectorbar += get_button ( collector_page, "yellow", "info", true);1006 collectorbar += get_button (args,collector_page, "yellow", "info", true); 1121 1007 } 1122 1008 collectorbar += "<td>_icongreyarrow_</td>\n"; 1123 1009 if (econf == 1) { 1124 collectorbar += get_button ( collector_page, "grey", "srce", false);1010 collectorbar += get_button (args,collector_page, "grey", "srce", false); 1125 1011 } else { 1126 collectorbar += get_button ( collector_page, "yellow", "srce", true);1127 } 1128 collectorbar += "<td>_icongreyarrow_</td>\n"; 1129 collectorbar += get_button ( collector_page, "yellow", "conf", false);1130 collectorbar += "<td>_icongreyarrow_</td>\n"; 1131 collectorbar += get_button ( collector_page, "green", "bild", true);1132 collectorbar += "<td>_icongreyarrow_</td>\n"; 1133 collectorbar += get_button ( collector_page, "grey", "view", false);1012 collectorbar += get_button (args,collector_page, "yellow", "srce", true); 1013 } 1014 collectorbar += "<td>_icongreyarrow_</td>\n"; 1015 collectorbar += get_button (args,collector_page, "yellow", "conf", false); 1016 collectorbar += "<td>_icongreyarrow_</td>\n"; 1017 collectorbar += get_button (args,collector_page, "green", "bild", true); 1018 collectorbar += "<td>_icongreyarrow_</td>\n"; 1019 collectorbar += get_button (args,collector_page, "grey", "view", false); 1134 1020 collectorbar += "</tr><tr><td colspan=5></td><td align=center>_icongreyuparrow_</td><td colspan=4></td>\n"; 1135 1021 … … 1137 1023 collectorbar += "<td>_icongreyarrow_</td>\n"; 1138 1024 // all previous buttons grey after build was completed 1139 collectorbar += get_button ( collector_page, "grey", "info", false);1140 collectorbar += "<td>_icongreyarrow_</td>\n"; 1141 collectorbar += get_button ( collector_page, "grey", "srce", false);1142 collectorbar += "<td>_icongreyarrow_</td>\n"; 1143 collectorbar += get_button ( collector_page, "grey", "conf", false);1144 collectorbar += "<td>_icongreyarrow_</td>\n"; 1145 collectorbar += get_button ( collector_page, "yellow", "bild", false);1146 collectorbar += "<td>_icongreyarrow_</td>\n"; 1147 collectorbar += get_button ( collector_page, "green", "view", true);1025 collectorbar += get_button (args,collector_page, "grey", "info", false); 1026 collectorbar += "<td>_icongreyarrow_</td>\n"; 1027 collectorbar += get_button (args,collector_page, "grey", "srce", false); 1028 collectorbar += "<td>_icongreyarrow_</td>\n"; 1029 collectorbar += get_button (args,collector_page, "grey", "conf", false); 1030 collectorbar += "<td>_icongreyarrow_</td>\n"; 1031 collectorbar += get_button (args,collector_page, "yellow", "bild", false); 1032 collectorbar += "<td>_icongreyarrow_</td>\n"; 1033 collectorbar += get_button (args,collector_page, "green", "view", true); 1148 1034 collectorbar += "</tr><tr><td colspan=7></td><td align=center>_icongreyuparrow_</td><td colspan=2></td>\n"; 1149 1035 … … 1153 1039 // page 1154 1040 if (esrce == 1 || econf == 1) { 1155 collectorbar += get_button ( collector_page, "grey", "info", false);1041 collectorbar += get_button (args,collector_page, "grey", "info", false); 1156 1042 } else { 1157 collectorbar += get_button ( collector_page, "yellow", "info", true);1043 collectorbar += get_button (args,collector_page, "yellow", "info", true); 1158 1044 } 1159 1045 collectorbar += "<td>_icongreyarrow_</td>\n"; 1160 1046 if (econf == 1) { 1161 collectorbar += get_button ( collector_page, "grey", "srce", false);1047 collectorbar += get_button (args,collector_page, "grey", "srce", false); 1162 1048 } else { 1163 collectorbar += get_button ( collector_page, "yellow", "srce", true);1164 } 1165 collectorbar += "<td>_icongreyarrow_</td>\n"; 1166 collectorbar += get_button ( collector_page, "yellow", "conf", true);1167 collectorbar += "<td>_icongreyarrow_</td>\n"; 1168 collectorbar += get_button ( collector_page, "yellow", "bild", true);1169 collectorbar += "<td>_icongreyarrow_</td>\n"; 1170 collectorbar += get_button ( collector_page, "grey", "view", false);1049 collectorbar += get_button (args,collector_page, "yellow", "srce", true); 1050 } 1051 collectorbar += "<td>_icongreyarrow_</td>\n"; 1052 collectorbar += get_button (args,collector_page, "yellow", "conf", true); 1053 collectorbar += "<td>_icongreyarrow_</td>\n"; 1054 collectorbar += get_button (args,collector_page, "yellow", "bild", true); 1055 collectorbar += "<td>_icongreyarrow_</td>\n"; 1056 collectorbar += get_button (args,collector_page, "grey", "view", false); 1171 1057 } 1172 1058 … … 1207 1093 disp.setmacro ("gsdlhome", "collector", dm_safe(gsdlhome)); 1208 1094 } 1095 1209 1096 1210 1097 bool collectoraction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/, … … 1439 1326 } 1440 1327 1441 // if sw = 0 replace all carriage returns in intext with the string "\n"1442 // else replace all occurances of "\n" with a carriage return1443 text_t collectoraction::carriage_replace (const text_t &intext, int sw) {1444 1445 text_t outtext;1446 text_t::const_iterator here = intext.begin();1447 text_t::const_iterator end = intext.end();1448 while (here != end) {1449 if (sw == 0) {1450 if (*here == '\n') {1451 if ((here+1) != end && *(here+1) == '\r') ++here;1452 outtext += "\\n";1453 } else if (*here == '\r') {1454 if ((here+1) != end && *(here+1) == '\n') ++here;1455 outtext += "\\n";1456 } else {1457 outtext.push_back (*here);1458 }1459 } else if (*here == '\\' && (here+1) != end && *(here+1) == 'n') {1460 outtext.push_back ('\n');1461 ++here;1462 } else {1463 outtext.push_back (*here);1464 }1465 ++here;1466 }1467 return outtext;1468 }1469 1470 // create a short directory name from fullname1471 text_t collectoraction::get_directory_name (const text_t &fullname) {1472 1473 text_t shortname;1474 if (fullname.empty()) {1475 shortname = "coll";1476 1477 } else {1478 1479 // first make all lowercase and remove any dodgy characters1480 // (i.e. anything not [a-z]1481 text_t::const_iterator here = fullname.begin();1482 text_t::const_iterator end = fullname.end();1483 while (here != end) {1484 if ((*here >= 'A' && *here <= 'Z') || (*here >= 'a' && *here <= 'z') ||1485 (*here == ' ')) {1486 if (*here >= 'A' && *here <= 'Z') shortname.push_back (*here+32);1487 else if (*here == ' ') {1488 while ((*(here+1)) == ' ') ++here;1489 shortname.push_back (*here);1490 } else shortname.push_back (*here);1491 }1492 ++here;1493 }1494 1495 text_tarray words;1496 splitchar (shortname.begin(), shortname.end(), ' ', words);1497 int num_words = words.size();1498 1499 if (num_words == 0) {1500 shortname = "coll";1501 1502 } else {1503 1504 shortname.clear();1505 int use_words = (num_words <= 6) ? num_words : 6;1506 unsigned int substr_len = 6 / use_words;1507 1508 for (int i = 0; i < use_words; ++i) {1509 if (words[i].size() < substr_len) shortname += words[i];1510 else shortname += substr (words[i].begin(), words[i].begin()+substr_len);1511 }1512 }1513 }1514 1515 // check to see if shortname is unique1516 text_t fulldirname = filename_cat (gsdlhome, "collect", shortname);1517 if (directory_exists (fulldirname)) {1518 int version = 0;1519 text_t newname;1520 do {1521 ++version;1522 newname = shortname;1523 newname.push_back ('v');1524 newname.appendint (version);1525 fulldirname = filename_cat (gsdlhome, "collect", newname);1526 } while (directory_exists (fulldirname));1527 1528 shortname = newname;1529 }1530 1531 return shortname;1532 }1533 1534 // tests if collection is write protected (currently just checks if1535 // collect.cfg file is writable1536 bool collectoraction::collection_protected (const text_t &collection) {1537 text_t cfgfile = filename_cat(gsdlhome, "collect", collection, "etc", "collect.cfg");1538 if (file_writable(cfgfile)) return false;1539 return true;1540 }1541 1542 // assigns a temporary directory name for this collector session1543 // and creates temporary directory1544 // returns false if it couldn't create the directory1545 bool collectoraction::assign_tmpname (cgiargsclass &args, ostream &logout) {1546 1547 int i = 0;1548 text_t tmpname = "tbuild";1549 while (directory_exists (filename_cat (gsdlhome, "tmp", tmpname + text_t(i)))) {1550 ++i;1551 }1552 tmpname.appendint (i);1553 1554 text_t fulltmpdir = filename_cat (gsdlhome, "tmp", tmpname);1555 if (!mk_dir (fulltmpdir)) {1556 outconvertclass text_t2ascii;1557 logout << text_t2ascii << "collectoraction::assign_tmpname unable to create directory ("1558 << fulltmpdir << ")\n";1559 return false;1560 }1561 1562 args["bc1tmp"] = tmpname;1563 return true;1564 }1565 1566 1328 void collectoraction::gsdl_mkcol (cgiargsclass &args, ostream &logout) { 1567 1329 … … 1569 1331 if (!directory_exists (tmpdir)) { 1570 1332 message = "tmpfail"; 1333 cerr << "WE CANNOT CREATE THE DIRECTORY!!! " << endl; 1571 1334 return; 1572 1335 } … … 1605 1368 text_t mkcol_cmd = "perl -S mkcol.pl -optionfile \"" + optionfile; 1606 1369 mkcol_cmd += "\" " + collection; 1370 1371 1607 1372 gsdl_system (mkcol_cmd, true, logout); 1608 1373 … … 1627 1392 } 1628 1393 1629 void collectoraction::gsdl_build (cgiargsclass &args, ostream &logout) {1630 1631 outconvertclass text_t2ascii;1632 1633 text_t tmpdir = filename_cat (gsdlhome, "tmp", args["bc1tmp"]);1634 if (!directory_exists (tmpdir)) {1635 message = "tmpfail";1636 return;1637 }1638 1639 text_t &collection = args["bc1dirname"];1640 if (collection.empty()) {1641 message = "nocollection";1642 return;1643 }1644 1645 // check for a .build file - if it exists then we've already built1646 // the collection (or are in the process of building it)1647 text_t buildfile = filename_cat (tmpdir, ".build");1648 if (file_exists (buildfile)) {1649 return;1650 } else {1651 // create the .build file (this file is just a place holder to let any future1652 // pages know that we've already been here)1653 char *buildfilec = buildfile.getcstr();1654 ofstream bfile_out (buildfilec);1655 delete []buildfilec;1656 if (bfile_out) {1657 bfile_out << "collection building\n";1658 bfile_out.close();1659 } else {1660 message = "tmpfail";1661 return;1662 }1663 }1664 1665 const recptconf &rcinfo = recpt->get_configinfo ();1666 1667 // create the event header file if LogEvents, EmailEvents or1668 // EmailUserEvents options are turned on.1669 bool logevents =1670 (rcinfo.LogEvents == CollectorEvents || rcinfo.LogEvents == AllEvents ||1671 rcinfo.EmailEvents == CollectorEvents || rcinfo.EmailEvents == AllEvents ||1672 rcinfo.EmailUserEvents);1673 text_t ehead_file = filename_cat (tmpdir, "ehead.txt");1674 if (logevents) {1675 if (!create_event_header_file (ehead_file, args, logout)) {1676 logevents = false;1677 }1678 }1679 1680 text_t collectdir = get_collectdir (args);1681 1682 // set up build options1683 text_t options = "-make_writable -remove_import -out \"";1684 options += filename_cat (tmpdir, collection + ".bld");1685 options += "\" -collectdir \"" + collectdir + "\" -statsfile \"";1686 options += filename_cat(collectdir, collection, "etc", "import.log") + "\"";1687 1688 if (args["bc1esrce"] == 1) {1689 // we're adding data to an existing collection1690 options += " -save_archives -append";1691 }1692 1693 text_tarray inputvalues, inputtypes;1694 splitchar (args["bc1input"].begin(), args["bc1input"].end(), ',', inputvalues);1695 splitchar (args["bc1inputtype"].begin(), args["bc1inputtype"].end(), ',', inputtypes);1696 int numvalues = inputvalues.size();1697 int numtypes = inputtypes.size();1698 for (int i = 0; i < numvalues; ++i) {1699 if (!inputvalues[i].empty()) {1700 text_t type = "file://"; // default1701 if (i < numtypes) type = inputtypes[i];1702 options += " -download \"" +1703 remove_trailing_slashes(type + format_url(decode_commas(inputvalues[i]))) + "\"";1704 }1705 }1706 1707 if (logevents) {1708 if (rcinfo.LogEvents == CollectorEvents || rcinfo.LogEvents == AllEvents)1709 options += " -log_events";1710 if (rcinfo.EmailEvents == CollectorEvents || rcinfo.EmailEvents == AllEvents) {1711 options += " -mail_server " + rcinfo.MailServer;1712 options += " -email_events " + rcinfo.maintainer;1713 if (rcinfo.EmailUserEvents) options += "," + args["bc1contactemail"];1714 } else if (rcinfo.EmailUserEvents) {1715 options += " -mail_server " + rcinfo.MailServer;1716 options += " -email_events " + args["bc1contactemail"];1717 }1718 options += " -event_header " + ehead_file;1719 }1720 1721 text_t optionfile = filename_cat (tmpdir, "build.opt");1722 char *optionfilec = optionfile.getcstr();1723 ofstream ofile_out (optionfilec);1724 delete []optionfilec;1725 if (!ofile_out) {1726 message = "tmpfail";1727 return;1728 }1729 ofile_out << text_t2ascii << options << "\n";1730 ofile_out.close();1731 1732 // if we're altering an existing collection we need to kill off1733 // the existing collection server - we do this for the local library1734 // (and any other persistent version of the library) as the existing1735 // gdbm file can't be deleted while the collection server holds it open1736 if ((args["bc1econf"] == 1) || (args["bc1esrce"] == 1)) {1737 remove_colservr (collection, logout);1738 }1739 1740 // set up the build command - build.bat has some issues with quoting1741 // on win2k when gsdlhome contains spaces so we'll avoid using1742 // "perl -S" here in favor of calling the "build" perl script explicitly1743 text_t build_cmd = "perl \"" + filename_cat (gsdlhome, "bin", "script", "build");1744 build_cmd += "\" -optionfile \"" + optionfile + "\" " + collection;1745 // run build command in background (i.e. asynchronously)1746 gsdl_system (build_cmd, false, logout);1747 }1748 1749 void collectoraction::gsdl_cancel_build (cgiargsclass &args, ostream &logout) {1750 // I really wanted to do what this perl script does from within the library1751 // c++ code. I ran into some problems though (like how do you write a portable1752 // "rm -r" in c++?). One day I'll spend some time sorting it out ... maybe.1753 text_t cancel_cmd = "perl -S cancel_build.pl -collectdir \"";1754 cancel_cmd += filename_cat (gsdlhome, "tmp", args["bc1tmp"]) + "\" ";1755 cancel_cmd += args["bc1dirname"];1756 // To be on the safe side we'll make this a synchronous call1757 // so that all tidying up is done before the user has a chance1758 // to do anything else (like start rebuilding their collection).1759 // This means that for a big collection where there's lots of1760 // stuff to delete etc. it might take a while before the "build1761 // cancelled" page appears.1762 gsdl_system (cancel_cmd, true, logout);1763 }1764 1765 text_t collectoraction::get_collectdir (cgiargsclass &args)1766 {1767 if ((args["bc1econf"] == 1) || (args["bc1esrce"] == 1)) {1768 // we're adding to a collection in place1769 return filename_cat(gsdlhome, "collect");1770 }1771 else {1772 return filename_cat (gsdlhome, "tmp", args["bc1tmp"]);1773 }1774 }1775 1776 // checks to see if any of the plugins in pluginset occur in1777 // collections configuration file1778 bool collectoraction::uses_weird_plugin (const text_t &collection) {1779 1780 text_tset pluginset;1781 pluginset.insert ("HBPlug");1782 1783 text_t cfgfile_content;1784 text_t cfgfile_name = filename_cat (gsdlhome, "collect", collection, "etc", "collect.cfg");1785 text_t pluginstr, pluginname;1786 1787 if (read_file (cfgfile_name, cfgfile_content)) {1788 text_t::const_iterator here = cfgfile_content.begin();1789 text_t::const_iterator end = cfgfile_content.end();1790 while (here != end) {1791 here = findchar (here, end, 'p');1792 if (here == end) break;1793 if ((here+6 < end) && (substr (here, here+6) == "plugin")) {1794 getdelimitstr (here+6, end, '\n', pluginstr);1795 text_t::const_iterator hp = pluginstr.begin();1796 text_t::const_iterator ep = pluginstr.end();1797 bool found = false;1798 // remove any leading whitespace, trailing options etc.1799 while (hp != ep) {1800 if (*hp == '\t' || *hp == ' ' || *hp == '\n') {1801 if (found) break;1802 } else {1803 pluginname.push_back (*hp);1804 found = true;1805 }1806 ++hp;1807 }1808 text_tset::const_iterator it = pluginset.find (pluginname);1809 if (it != pluginset.end()) return true; // found matching plugin1810 pluginname.clear();1811 }1812 ++here;1813 }1814 }1815 return false;1816 }1817 1818 // create and initialize a new collection server and1819 // add it to the null protocol.1820 void collectoraction::create_colserver (const text_t &collection, ostream &logout) {1821 1822 recptprotolistclass *protos = recpt->get_recptprotolist_ptr();1823 recptprotolistclass::iterator rprotolist_here = protos->begin();1824 recptprotolistclass::iterator rprotolist_end = protos->end();1825 while (rprotolist_here != rprotolist_end) {1826 comerror_t err = noError;1827 if ((*rprotolist_here).p != NULL) {1828 if ((*rprotolist_here).p->get_protocol_name (err) == "nullproto") {1829 // create collection server and add it to nullproto1830 (*rprotolist_here).p->add_collection (collection, recpt, gsdlhome, gsdlhome);1831 // make sure gsdlhome is configured1832 text_tarray tmp;1833 tmp.push_back (gsdlhome);1834 (*rprotolist_here).p->configure ("gsdlhome", tmp, err);1835 // re-initialize the null protocol1836 if (!(*rprotolist_here).p->init (err, logout)) {1837 logout << "collectoraction::create_colserver: nullproto init failed\n";1838 }1839 return;1840 }1841 }1842 ++rprotolist_here;1843 }1844 1845 logout << "collectoraction::create_colserver: no valid nullproto found\n";1846 }1847 1848 // delete a collection server from the null protocol1849 void collectoraction::remove_colservr (const text_t &collection, ostream &logout) {1850 1851 recpt->uncache_collection (collection);1852 1853 recptprotolistclass *protos = recpt->get_recptprotolist_ptr();1854 recptprotolistclass::iterator rprotolist_here = protos->begin();1855 recptprotolistclass::iterator rprotolist_end = protos->end();1856 while (rprotolist_here != rprotolist_end) {1857 comerror_t err = noError;1858 if ((*rprotolist_here).p != NULL) {1859 if ((*rprotolist_here).p->get_protocol_name (err) == "nullproto") {1860 (*rprotolist_here).p->remove_collection (collection, logout);1861 return;1862 }1863 }1864 ++rprotolist_here;1865 }1866 1867 logout << "collectoraction::create_colserver: no valid nullproto found\n";1868 }1869 1870 bool collectoraction::create_event_header_file (const text_t &filename, cgiargsclass &args,1871 ostream &logout) {1872 1873 outconvertclass text_t2ascii;1874 char *filenamec = filename.getcstr();1875 ofstream eheadfile (filenamec);1876 delete []filenamec;1877 1878 if (eheadfile) {1879 eheadfile << text_t2ascii << get_event_header (args);1880 eheadfile.close();1881 return true;1882 }1883 1884 logout << text_t2ascii << "collectoraction::create_event_header ERROR: Couldn't create "1885 << "Event Header file " << filename << ". Event logging disabled\n";1886 return false;1887 }1888 1889 text_t collectoraction::get_event_header (cgiargsclass &args) {1890 text_t header = "Greenstone Username: " + args["un"] + "\n";1891 header += "Collection: " + args["bc1dirname"] + "\n";1892 header += "Collection Creator: " + args["bc1contactemail"] + "\n";1893 header += "GSDLHOME: " + gsdlhome + "\n";1894 header += "Build Location: " + get_collectdir(args) + "\n";1895 1896 return header;1897 }1898 1394 1899 1395 bool collectoraction::check_sources (cgiargsclass &args, ostream &logout) { … … 1946 1442 } 1947 1443 1948 // format_url simply strips "http://", "ftp://", or "file://" off the 1949 // beginning of url if they're there 1950 text_t collectoraction::format_url (const text_t &url) { 1951 text_t::const_iterator begin = url.begin(); 1952 text_t::const_iterator end = url.end(); 1953 1954 if (url.size() >= 7) { 1955 text_t prefix = substr(begin, begin+7); 1956 if (prefix == "http://" || prefix == "file://") { 1957 return substr(begin+7, end); 1958 } 1959 } 1960 if (url.size() >= 6) { 1961 if (substr(begin, begin+6) == "ftp://") { 1962 return substr(begin+6, end); 1963 } 1964 } 1965 return url; 1444 text_t collectoraction::get_button(cgiargsclass &args, const text_t &thispage, 1445 const text_t &color, 1446 const text_t &type, bool enabled) 1447 { 1448 1449 if ((color != "green" && color != "grey" && color != "yellow") || 1450 (type != "info" && type != "srce" && type != "conf" && type != "bild" && type != "view")) 1451 return g_EmptyText; 1452 1453 text_t href = "_http"+type+"_"; 1454 text_t target = ""; 1455 1456 if (thispage == "info" || thispage == "srce" || thispage == "conf" || 1457 thispage == "bildcancel" || thispage == "bildfail") { 1458 // call the check submit macro instead of linking directly to the page 1459 href="\"javascript:check_submit('"+type+"');\""; 1460 } else if (type == "view") { 1461 // view button is special case as it needs a target=_top 1462 target = " target=_top"; 1463 } 1464 1465 text_t tdclass = "wizardbar"+color; 1466 if (enabled) { 1467 // link to the appropriate page 1468 return "<td class="+tdclass+"><a href="+href+target+">_text"+type+"_</a></td>"; 1469 } 1470 else { 1471 // just display the text 1472 return "<td class="+tdclass+">_text"+type+"_</td>"; 1473 } 1966 1474 } 1967 1475 1968 text_t collectoraction::remove_trailing_slashes (text_t str) {1969 1970 while (*(str.end()-1) == '\\') {1971 str.pop_back();1972 }1973 return str;1974 }1975 1976 1476 #endif //GSDL_USE_COLLECTOR_ACTION -
trunk/gsdl/src/recpt/collectoraction.h
r7371 r11998 30 30 #define COLLECTORACTION_H 31 31 32 #include " action.h"32 #include "wizardaction.h" 33 33 #include "receptionist.h" 34 34 35 class collectoraction : public action {35 class collectoraction : public wizardaction { 36 36 37 37 protected: 38 39 bool disabled;40 receptionist *recpt;41 char *gsdlosc;42 char *gsdlhomec;43 char *pathc;44 45 text_t message;46 char failcode;47 38 48 39 bool do_mkcol; … … 51 42 text_tmap failedsources; 52 43 53 text_t get_button (const text_t &thispage, const text_t &color,54 const text_t &type, bool enabled);44 void set_fullnamemenu (displayclass &disp, cgiargsclass &args, 45 recptprotolistclass *protos, ostream &logout); 55 46 56 void set_fullnamemenu (displayclass &disp, cgiargsclass &args,57 recptprotolistclass *protos, ostream &logout);58 47 59 48 void set_inputsourceboxes (displayclass &disp, cgiargsclass &args, … … 65 54 void set_cfgfile (displayclass &disp, cgiargsclass &args, ostream &logout); 66 55 67 void set_statusline (displayclass &disp, cgiargsclass &args, ostream &logout);68 56 69 57 void update_cfgfile_clone (cgiargsclass &args, ostream &logout); … … 73 61 void update_cfgfile_complete (cgiargsclass &args, ostream &logout); 74 62 75 text_t carriage_replace (const text_t &intext, int sw);76 77 text_t get_directory_name (const text_t &fullname);78 79 bool collection_protected (const text_t &collection);80 81 bool assign_tmpname (cgiargsclass &args, ostream &logout);82 63 83 64 void gsdl_mkcol (cgiargsclass &args, ostream &logout); 84 65 85 void gsdl_build (cgiargsclass &args, ostream &logout);86 66 87 void gsdl_cancel_build (cgiargsclass &args, ostream &logout);88 89 text_t get_collectdir (cgiargsclass &args);90 91 bool uses_weird_plugin (const text_t &collection);92 93 void create_colserver (const text_t &collection, ostream &logout);94 95 void remove_colservr (const text_t &collection, ostream &logout);96 97 bool create_event_header_file (const text_t &filename, cgiargsclass &args,98 ostream &logout);99 100 text_t get_event_header (cgiargsclass &args);101 67 102 68 bool check_sources (cgiargsclass &args, ostream &logout); 103 69 104 text_t format_url (const text_t &url); 70 text_t get_button (cgiargsclass &args, const text_t &thispage, 71 const text_t &color, 72 const text_t &type, bool enabled); 105 73 106 text_t remove_trailing_slashes (text_t str);107 74 108 75 public: … … 110 77 virtual ~collectoraction (); 111 78 112 void configure (const text_t &key, const text_tarray &cfgline);113 114 bool init (ostream &logout);115 116 void set_receptionist (receptionist *therecpt) {recpt=therecpt;}117 118 79 text_t get_action_name () {return "collector";} 119 80 120 81 bool check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args, 121 82 recptprotolistclass *protos, ostream &logout); 122 123 void get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,124 response_t &response,text_t &response_data,125 ostream &logout);126 83 127 84 void define_internal_macros (displayclass &disp, cgiargsclass &args, … … 132 89 outconvertclass &outconvert, ostream &textout, 133 90 ostream &logout); 91 134 92 }; 135 93 -
trunk/gsdl/src/recpt/documentaction.cpp
r11771 r11998 619 619 if (get_info (inlink, args["c"], args["l"], metadata, false, collectproto, response, logout)) { 620 620 if (!response.docInfo[0].metadata["section"].values[0].empty()) { 621 #ifndef DOCHANDLE 621 622 outlink = "_httpdocument_&d=" + response.docInfo[0].metadata["section"].values[0]; 623 #else 624 outlink = "_httpdocumenthandle_("+args["c"]+","+response.docInfo[0].metadata["section"].values[0]+")"; 625 #endif 626 622 627 return true; 623 628 } … … 642 647 if (get_info (inlink, *col_here, args["l"], metadata, false, collectproto, response, logout)) { 643 648 if (!response.docInfo[0].metadata["section"].values[0].empty()) { 649 #ifndef DOCHANDLE 644 650 outlink = "_httpdocument_&c=" + *col_here + "&d=" + 645 651 response.docInfo[0].metadata["section"].values[0]; 652 #else 653 outlink = "_httpdocumenthandle_("+*col_here+","+response.docInfo[0].metadata["section"].values[0]+")"; 654 #endif 655 646 656 return true; 647 657 } … … 1003 1013 << "<frameset rows=\"68,*\" noresize border=0>\n" 1004 1014 << "<frame scrolling=no frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=p&p=nav\">\n" 1015 #ifndef DOCHANDLE 1005 1016 << "<frame name=\"documenttop\" frameborder=0 src=\"_gwcgi_?_optsite_e=_compressedoptions_&a=d&d=" 1006 1017 << args["d"] << "\">" 1018 #else 1019 << "<frame name=\"documenttop\" frameborder=0 src=\"_httpdocumenthandle_(" 1020 << args["c"] << "," << args["d"] << ")\">" 1021 #endif 1007 1022 << "<noframes>\n" 1008 1023 << "<p>You must have a frame enabled browser to view this.</p>\n" … … 1297 1312 // work out values for next link 1298 1313 if (haschildren) { 1314 #ifndef DOCHANLE 1299 1315 disp.setmacro ("httpnextarrow", "document", "_httpdocument_&cl=" + args["cl"] + 1300 1316 "&d=" + arg_d + ".fc"); 1317 #else 1318 disp.setmacro ("httpnextarrow", "document", "_httpdocumenthandle_("+args["c"]+","+arg_d + ".fc)"; 1319 1320 #endif 1321 1301 1322 } else { 1302 1323 text_tarray::const_iterator h = next_siblings.begin(); … … 1304 1325 while (h != e) { 1305 1326 if (!(*h).empty()) { 1327 #ifndef DOCHANLE 1306 1328 disp.setmacro ("httpnextarrow", "document", "_httpdocument_&cl=" + args["cl"] + 1307 1329 "&d=" + *h); 1330 #else 1331 disp.setmacro ("httpnextarrow", "document", "_httpdocumenthandle_("+args["c"]+","+*h+")"; 1332 1333 #endif 1334 1308 1335 break; 1309 1336 } … … 1314 1341 // work out value for previous link 1315 1342 if (!previous_sibling.empty()) { 1343 #ifndef DOCHANDLE 1316 1344 disp.setmacro ("httpprevarrow", "document", "_httpdocument_&cl=" + args["cl"] + 1317 1345 "&d=" + previous_sibling); 1346 #else 1347 disp.setmacro ("httpprevarrow", "document", "_httpdocumenthandle_("+args["c"]+","+ previous_sibling+")"); 1348 1349 #endif 1350 1318 1351 } else { 1319 1352 if (countchar(arg_d.begin(), arg_d.end(), '.')) { 1353 #ifndef DOCHANDLE 1320 1354 disp.setmacro ("httpprevarrow", "document", "_httpdocument_&cl=" + args["cl"] + 1321 1355 "&d=" + get_parent(arg_d)); 1356 #else 1357 disp.setmacro ("httpprevarrow", "document", "_httpdocumenthandle_("+args["c"]+","+get_parent(arg_d)+")"); 1358 1359 #endif 1360 1322 1361 } 1323 1362 } -
trunk/gsdl/src/recpt/gsdl_modules_cfg.h
r11252 r11998 53 53 #define GSDL_USE_BROWSE_ACTION 54 54 #define GSDL_USE_COLLECTOR_ACTION 55 #define GSDL_USE_DEPOSITOR_ACTION 55 56 #define GSDL_USE_EXTLINK_ACTION 56 57 #undef GSDL_USE_GTI_ACTION -
trunk/gsdl/src/recpt/librarymain.cpp
r10018 r11998 85 85 #include "tipaction.h" 86 86 #include "collectoraction.h" 87 #include "depositoraction.h" 87 88 #include "browseaction.h" 88 89 #include "phindaction.h" … … 107 108 #endif //GSDL_USE_CLASSIFIER_BROWSER 108 109 110 #include "cgicc/Cgicc.h" 111 using namespace cgicc; 112 113 Cgicc* formData; 114 109 115 int main () { 110 116 receptionist recpt; … … 115 121 #endif 116 122 text_t gsdlhome; 123 124 formData = new Cgicc(); 117 125 118 126 cservers = new collectset(gsdlhome); … … 200 208 #endif 201 209 210 #ifdef GSDL_USE_DEPOSITOR_ACTION 211 depositoraction *adepositoraction = new depositoraction(); 212 adepositoraction->set_receptionist (&recpt); 213 recpt.add_action(adepositoraction); 214 #endif 215 202 216 #ifdef GSDL_USE_BROWSE_ACTION 203 217 browseaction *abrowseaction = new browseaction(); … … 276 290 thisAction = recpt.get_actionmap_ptr()->begin(); 277 291 recpt.get_actionmap_ptr()->erase(thisAction, endAction); 292 293 delete formData; 278 294 return 0; 279 295 } -
trunk/gsdl/src/recpt/pageaction.cpp
r11986 r11998 45 45 status_disabled = true; 46 46 collector_disabled = true; 47 depositor_disabled = true; 47 48 translator_disabled = true; 48 49 gliapplet_disabled = true; … … 586 587 // if page is "home" or "homehelp" 587 588 // _textgocollector_ set to "" if collector is disabled in main.cfg 589 // _textgodepositor_ set to "" if depositor is disabled in main.cfg 588 590 // _textgoadmin_ set to "" if status is disabled in main.cfg 589 591 // _textgotranslator_ set to "" if translator is disabled in main.cfg … … 669 671 if (status_disabled) disp.setmacro ("textgoadmin", "home", ""); 670 672 if (collector_disabled) disp.setmacro ("textgocollector", "home", ""); 673 if (depositor_disabled) disp.setmacro ("textgodepositor", "home", ""); 671 674 if (translator_disabled) disp.setmacro ("textgotranslator", "home", ""); 672 675 … … 912 915 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) { 913 916 collector_disabled = false; 914 } else if ((key == "translator") && (cfgline.size() == 1) && 917 } 918 else if ((key == "depositor") && (cfgline.size() == 1) && 919 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) { 920 depositor_disabled = false; 921 } 922 else if ((key == "translator") && (cfgline.size() == 1) && 915 923 (cfgline[0] == "true" || cfgline[0] == "on" || cfgline[0] == "enabled")) { 916 924 translator_disabled = false; -
trunk/gsdl/src/recpt/pageaction.h
r9931 r11998 95 95 bool status_disabled; 96 96 bool collector_disabled; 97 bool depositor_disabled; 97 98 bool translator_disabled; 98 99 bool gliapplet_disabled;
Note:
See TracChangeset
for help on using the changeset viewer.