Changeset 10148


Ignore:
Timestamp:
2005-06-17T16:42:25+12:00 (19 years ago)
Author:
mdewsnip
Message:

Split up doing a GTI request into doing the request, and parsing the XML output. This is necessary for the Excel stuff (soon).

Location:
trunk/gsdl/src/recpt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/gtiaction.cpp

    r10118 r10148  
    220220  // Send a request to gti.pl to get the valid translation files
    221221  text_t gti_arguments = "get-language-status " + target_language_code;
    222   GTI_Response gti_response = do_gti_request(gti_arguments, logout);
     222  GTI_Response gti_response = parse_gti_response(do_gti_request(gti_arguments, logout), logout);
    223223  if (gti_response.error_message != "") {
    224224    // An error has occurred
     
    288288  logout << "Query argument: " << query_string << endl;
    289289  text_t gti_arguments = "search-chunks " + target_language_code + " " + translation_file_key + " " + query_string;
    290   GTI_Response gti_response = do_gti_request(gti_arguments, logout);
     290  GTI_Response gti_response = parse_gti_response(do_gti_request(gti_arguments, logout), logout);
    291291  if (gti_response.error_message != "") {
    292292    // An error has occurred
     
    348348  // Send a request to gti.pl to get the first string to translate
    349349  text_t gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + num_chunks_per_page;
    350   GTI_Response gti_response = do_gti_request(gti_arguments, logout);
     350  GTI_Response gti_response = parse_gti_response(do_gti_request(gti_arguments, logout), logout);
    351351  if (gti_response.error_message != "") {
    352352    // An error has occurred
     
    577577
    578578
    579 GTI_Response gtiaction::do_gti_request(text_t gti_arguments, ostream& logout)
    580 {
    581   GTI_Response gti_response;
    582   gti_response.is_recording_text = false;
    583 
     579text_t gtiaction::do_gti_request(text_t gti_arguments, ostream& logout)
     580{
    584581  // Send the request to gti.pl and read the XML output
    585582  text_t gti_command = "perl -S " + filename_cat(gsdlhome, "bin", "script", "gti.pl") + " " + gti_arguments;
     
    589586  if (gti_pipe == NULL) {
    590587    logout << "Error: Could not open pipe for GTI command " << gti_command << endl;
    591     return gti_response;
     588    return "";
    592589  }
    593590
     
    599596  }
    600597  pclose(gti_pipe);
     598
     599  return gti_response_xml_text;
     600}
     601
     602
     603
     604GTI_Response gtiaction::parse_gti_response(text_t gti_response_xml_text, ostream& logout)
     605{
     606  GTI_Response gti_response;
     607  gti_response.is_recording_text = false;
    601608
    602609  // Parse the gti.pl response (XML)
  • trunk/gsdl/src/recpt/gtiaction.h

    r10097 r10148  
    107107  void process_gti_submissions(displayclass& disp, cgiargsclass& args, ostream& logout, bool force_submission);
    108108
    109   GTI_Response do_gti_request(text_t, ostream&);
     109  text_t do_gti_request(text_t gti_arguments, ostream& logout);
    110110
    111   void do_gti_submission(text_t, text_t, ostream&);
     111  GTI_Response parse_gti_response(text_t gti_response_xml_text, ostream& logout);
     112
     113  void do_gti_submission(text_t gti_arguments, text_t gti_submission, ostream& logout);
    112114};
    113115
Note: See TracChangeset for help on using the changeset viewer.