Changeset 13692
- Timestamp:
- 2007-01-19T13:54:20+13:00 (17 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/gtiaction.cpp
r13672 r13692 128 128 ostream& logout) 129 129 { 130 // Special case for producing Excel spreadsheets, as these are downloaded 131 if (args["p"] == "excel") { 132 return produce_excel_spreadsheet(args, logout); 133 } 134 130 135 textout << outconvert << disp << ("_gti:header_\n") << ("_gti:content_\n") << ("_gti:footer_\n"); 131 136 return true; … … 134 139 135 140 136 void gtiaction::get_cgihead_info(cgiargsclass& /*args*/, recptprotolistclass* /*protos*/,141 void gtiaction::get_cgihead_info(cgiargsclass& args, recptprotolistclass* /*protos*/, 137 142 response_t& response, text_t& response_data, 138 143 ostream& logout) 139 144 { 145 // Special case for producing Excel spreadsheets, as these are downloaded 146 if (args["p"] == "excel") { 147 printf("Content-Disposition: attachment; filename=\"Greenstone-%s-%s.xml\"\n", args["tlc"].getcstr(), args["tfk"].getcstr()); 148 response = content; 149 response_data = "text/xml"; 150 return; 151 } 152 140 153 response = content; 141 154 response_data = "text/html"; … … 172 185 } 173 186 174 // Define the page content for the GTI excelpage175 if (args["p"] == " excel") {176 define_gti_ excel_page(disp, args, logout);187 // Define the page content for the GTI offline page 188 if (args["p"] == "offline") { 189 define_gti_offline_page(disp, args, logout); 177 190 return; 178 191 } … … 426 439 427 440 428 void gtiaction::define_gti_ excel_page(displayclass& disp, cgiargsclass& args, ostream& logout)441 void gtiaction::define_gti_offline_page(displayclass& disp, cgiargsclass& args, ostream& logout) 429 442 { 430 443 // Get the target language code and file to translate from the CGI arguments … … 432 445 text_t translation_file_key = args["tfk"]; 433 446 434 disp.setmacro("gtiformcontent", "gti", "_gti:gti excel_");447 disp.setmacro("gtiformcontent", "gti", "_gti:gtioffline_"); 435 448 436 449 languageinfo_tmap loaded_languages = recpt->get_configinfo().languages; 437 450 disp.setmacro("gtitargetlanguagename", "gti", loaded_languages[target_language_code].longname); 438 451 disp.setmacro("gtitranslationfiledesc", "gti", "_gti:textgti" + translation_file_key + "_"); 439 440 // Send a request to gti.pl to get the valid translation files441 text_t gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + "10000" + " | java -classpath $GSDLHOME/bin/java ApplyXSLT $GSDLHOME/etc/gti-generate-excel-xml.xsl -";442 text_t gti_response_xml_text = do_gti_request(gti_arguments, logout);443 444 // !! UNFINISHED !!445 452 } 446 453 … … 600 607 601 608 609 bool gtiaction::produce_excel_spreadsheet(cgiargsclass& args, ostream& logout) 610 { 611 // Get the target language code and file to translate from the CGI arguments 612 text_t target_language_code = args["tlc"]; 613 text_t translation_file_key = args["tfk"]; 614 615 // Send a request to gti.pl to get the Excel spreadsheet data 616 text_t gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + "10000" + " | java -cp /home/nzdl/gti ApplyXSLT /home/nzdl/gti/gti-generate-excel-xml.xsl -"; 617 text_t gti_response_xml_text = do_gti_request(gti_arguments, logout); 618 if (gti_response_xml_text == "") { 619 // An error has occurred 620 return false; 621 } 622 623 // Write the Excel spreadsheet data to the browser 624 char* gti_response_xml_text_cstr = gti_response_xml_text.getcstr(); 625 printf(gti_response_xml_text_cstr); 626 delete[] gti_response_xml_text_cstr; 627 628 return true; 629 } 630 631 632 602 633 text_t gtiaction::escape_all(text_t text_string, char character_to_escape) 603 634 { -
trunk/gsdl/src/recpt/gtiaction.h
r13672 r13692 101 101 void define_gti_find_page(displayclass& disp, cgiargsclass& args, ostream& logout); 102 102 103 void define_gti_ excel_page(displayclass& disp, cgiargsclass& args, ostream& logout);103 void define_gti_offline_page(displayclass& disp, cgiargsclass& args, ostream& logout); 104 104 105 105 void define_gti_core_page(displayclass& disp, cgiargsclass& args, ostream& logout); … … 118 118 119 119 void define_gti_status_page(displayclass& disp, cgiargsclass& args, ostream& logout); 120 121 bool produce_excel_spreadsheet(cgiargsclass& args, ostream& logout); 120 122 }; 121 123
Note:
See TracChangeset
for help on using the changeset viewer.