Changeset 10027


Ignore:
Timestamp:
2005-06-08T14:03:53+12:00 (19 years ago)
Author:
mdewsnip
Message:

Completed GTI searching and correcting functionality.

Location:
trunk/gsdl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/gti.pl

    r10020 r10027  
    386386    # The key of the file to translate (ensure it is lowercase)
    387387    my $translation_file_key = lc(shift(@_));
     388    # Whether to submit a target chunk even if it hasn't changed
     389    my $force_submission_flag = shift(@_);
    388390
    389391    # Check that the necessary arguments were supplied
     
    489491        next;
    490492    }
    491 
    492     # Apply the submitted translations
    493     if (defined($target_file_key_to_submission_mapping{$chunk_key})) {
    494         $target_file_key_to_text_mapping{$chunk_key} = $target_file_key_to_submission_mapping{$chunk_key};
     493    }
     494
     495    # Apply the submitted translations
     496    foreach my $chunk_key (keys(%target_file_key_to_submission_mapping)) {
     497    if ($force_submission_flag || $target_file_key_to_submission_mapping{$chunk_key} ne $target_file_key_to_text_mapping{$chunk_key}) {
     498        $target_file_key_to_text_mapping{$chunk_key} = $target_file_key_to_submission_mapping{$chunk_key};
    495499        $target_file_key_to_comment_date_mapping{$chunk_key} = $submission_date;
    496     }
     500    }
    497501    }
    498502
     
    845849        $i++;
    846850        $line = $file_lines[$i];
    847         $line =~ s/(\s*)$//;  # Remove any nasty whitespace, carriage returns etc.
     851        $line =~ s/\s*([^\\]\#.+)?$//;  # Remove any comments and nasty whitespace
    848852        }
    849853
  • trunk/gsdl/src/recpt/gtiaction.cpp

    r10026 r10027  
    181181  }
    182182
    183   // Process a user submission
     183  // Process user translations
    184184  if (args["p"] == "submit") {
    185     process_gti_submission(disp, args, logout);
     185    process_gti_submissions(disp, args, logout, true);
    186186  }
    187187
     
    270270  text_t translation_file_key = args["tfk"];
    271271  text_t query_string = to_utf8(args["q"]);
     272
     273  // Process user corrections
     274  if (args["sp"] != "") {
     275    process_gti_submissions(disp, args, logout, false);
     276  }
    272277
    273278  disp.setmacro("gtiformcontent", "gti", "_gti:gtifind_");
     
    318323    chunk_key_iterator++;
    319324  }
     325  gti_find_form_content += "_gtifindformfooter_\n";
    320326
    321327  disp.setmacro("gtifindformcontent", "gti", gti_find_form_content);
     
    402408
    403409
    404 void gtiaction::process_gti_submission(displayclass& disp, cgiargsclass &args, ostream& logout)
     410void gtiaction::process_gti_submissions(displayclass& disp, cgiargsclass &args, ostream& logout, bool force_submission)
    405411{
    406412  // Get the target language code and file to translate from the CGI arguments
     
    442448  // Send the submission to gti.pl
    443449  text_t gti_arguments = "submit-translation " + target_language_code + " " + translation_file_key;
     450  if (force_submission) {
     451    gti_arguments += " -force_submission";
     452  }
    444453  do_gti_submission(gti_arguments, submission_text, logout);
    445454  logout << "Done." << endl;
  • trunk/gsdl/src/recpt/gtiaction.h

    r10018 r10027  
    107107  text_t escape_all(text_t source_string, char character_to_escape);
    108108
    109   void process_gti_submission(displayclass& disp, cgiargsclass& args, ostream& logout);
     109  void process_gti_submissions(displayclass& disp, cgiargsclass& args, ostream& logout, bool force_submission);
    110110
    111111  GTI_Response do_gti_request(text_t, ostream&);
Note: See TracChangeset for help on using the changeset viewer.