Changeset 13672
- Timestamp:
- 2007-01-18T10:36:46+13:00 (17 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/gtiaction.cpp
r13132 r13672 113 113 { 114 114 // Authenticate the user, except for the "home" and "lang" pages 115 if (args["p"] != "home" && args["p"] != "lang" ) {115 if (args["p"] != "home" && args["p"] != "lang" && args["p"] != "status") { 116 116 args["uan"] = 1; 117 117 args["ug"] = "langadmin_" + args["tlc"]; … … 177 177 return; 178 178 } 179 180 // Define the page content for the GTI view status page 181 if (args["p"] == "status") { 182 define_gti_status_page(disp, args, logout); 183 return; 184 } 179 185 180 186 // Process user translations … … 182 188 process_gti_submissions(disp, args, logout, true); 183 189 } 184 190 185 191 // Define the page content for the GTI core pages (containing the translation input forms) 186 192 define_gti_core_page(disp, args, logout); … … 257 263 gti_tfk_selection += "</table>"; 258 264 disp.setmacro("gtitfkselection", "gti", gti_tfk_selection); 265 } 266 267 268 269 void gtiaction::define_gti_status_page(displayclass& disp, cgiargsclass& args, ostream& logout) 270 { 271 disp.setmacro("gtiformcontent", "gti", "_gti:gtistatus_"); 272 273 languageinfo_tmap loaded_languages = recpt->get_configinfo().languages; 274 275 // Get the languages specified in the main.cfg file, and put them into a map to sort by name 276 text_tmap gti_languages_name_code_mapping; 277 languageinfo_tmap::const_iterator loaded_language = loaded_languages.begin(); 278 while (loaded_language != loaded_languages.end()) { 279 // English is not a valid GTI target language, since it is the source language 280 if (loaded_language->first != "en") { 281 gti_languages_name_code_mapping[loaded_language->second.longname] = loaded_language->first; 282 } 283 ++loaded_language; 284 } 285 286 // Get the languages, for each language, send a request to gti.pl to get the valid translation files and the current status for each file 287 text_t gti_status_table = "<table class=\"status\">\n"; 288 text_tmap::iterator gti_language = gti_languages_name_code_mapping.begin(); 289 bool first_lang = true; 290 while (gti_language != gti_languages_name_code_mapping.end()) { 291 // Send a request to gti.pl to get the valid translation files 292 text_t gti_arguments = "get-language-status " + gti_language->second; 293 GTI_Response gti_response = parse_gti_response(do_gti_request(gti_arguments, logout), logout); 294 if (gti_response.error_message != "") { 295 // An error has occurred 296 disp.setmacro("gtiformcontent", "gti", "_gti:gtierror_"); 297 disp.setmacro("gtierrormessage", "gti", gti_response.error_message); 298 return; 299 } 300 301 text_tmap::iterator translation_file = gti_response.translation_files_index_to_key_mapping.begin(); 302 303 text_t lang_status_temp = "<tr><td class=\"first\">" + gti_language->first + "</td>\n"; 304 text_t files_temp = "<tr><th class=\"status\">_textgtilanguage_</th>\n"; 305 text_t number_of_strings_temp = "<tr><td class=\"first\"><b>_textgtitotalnumberoftranslations_</b></td>\n"; 306 307 while (translation_file != gti_response.translation_files_index_to_key_mapping.end()) { 308 text_t translation_file_key = translation_file->second; 309 310 text_t num_chunks_translated = gti_response.translation_files_key_to_num_chunks_translated_mapping[translation_file_key]; 311 text_t num_chunks_requiring_translation = gti_response.translation_files_key_to_num_chunks_requiring_translation_mapping[translation_file_key]; 312 text_t num_chunks_requiring_updating = gti_response.translation_files_key_to_num_chunks_requiring_updating_mapping[translation_file_key]; 313 314 lang_status_temp += "<td class=\"status\">"; 315 if(num_chunks_translated.getint() > 0){ 316 lang_status_temp += "<div class=\"nowrap\"><div class=\"done\">"; 317 lang_status_temp += num_chunks_translated+"</div><div class=\"plus\">+</div><div class=\"update\">"; 318 lang_status_temp += num_chunks_requiring_updating+"</div><div class=\"plus\">+</div><div class=\"todo\">"; 319 lang_status_temp += num_chunks_requiring_translation+"</div></div>"; 320 } 321 lang_status_temp += "</td>\n"; 322 323 324 //lang_status_temp += "<td valign=\"top\" nowrap>_gtitranslationfilestatus2_(" + num_chunks_translated + "," + num_chunks_requiring_translation + "," + num_chunks_requiring_updating + ")</td>"; 325 326 // List the file names as the first row of the status table 327 // Add up number of strings need to be translate in each file, as the second line of the status table 328 if (first_lang) { 329 files_temp += "<th class=\"status\">_textgti" + translation_file_key + "_</th>\n"; 330 int int_number_of_strings = num_chunks_translated.getint() + num_chunks_requiring_translation.getint(); 331 number_of_strings_temp += "<td class=\"status\"><b>"; 332 number_of_strings_temp.appendint(int_number_of_strings); 333 number_of_strings_temp += "</b></td>\n"; 334 } 335 ++translation_file; 336 } 337 338 if(first_lang) { 339 gti_status_table += files_temp + "</tr>" + number_of_strings_temp + "</tr>"; 340 first_lang = false; 341 } 342 343 gti_status_table += lang_status_temp + "</tr>"; 344 ++gti_language; 345 } 346 gti_status_table += "\n</table>"; 347 disp.setmacro("gtistatustable", "gti", gti_status_table); 259 348 } 260 349 -
trunk/gsdl/src/recpt/gtiaction.h
r13131 r13672 116 116 117 117 void do_gti_submission(text_t gti_arguments, text_t gti_submission, ostream& logout); 118 119 void define_gti_status_page(displayclass& disp, cgiargsclass& args, ostream& logout); 118 120 }; 119 121
Note:
See TracChangeset
for help on using the changeset viewer.