Changeset 4123


Ignore:
Timestamp:
2003-04-11T09:39:17+12:00 (21 years ago)
Author:
mdewsnip
Message:

Added e-mail notification when translator is entered.

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

Legend:

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

    r4116 r4123  
    2424 *********************************************************************/
    2525
     26
    2627#include <ctype.h>
    2728#include <stdio.h>
    2829#include <fstream.h>
     30#include <unistd.h>
    2931#include "langaction.h"
    3032#include "fileutil.h"
     33#include "gsdltimes.h"
    3134#include "gsdltools.h"
    3235#include "gsdlunicode.h"
     
    3538#include "errno.h"
    3639#include <sys/utsname.h>
     40
    3741 
    3842/*====================*
     
    4145
    4246// text file reading buffer
    43 const int BUFFSIZE = 1024;
    44 char temp[BUFFSIZE];
    45 
     47const int LINESIZE = 1024;
    4648
    4749
     
    4951 * LOCAL UTILITY ROUTINES *
    5052 *========================*/
    51 
    52 // gets the list of packages/files that contain the content of the web-forms
    53 text_tarray get_pagenos(text_t dir, text_t lang, ostream &logout)
    54 {
    55   text_tarray pagenos;
    56 
    57   // file 'logfile' contains all the page numbers, one number per line
    58   // text_t logfile = filename_cat(dir, "package_forms", lang, "pageno.log");
    59   text_t logfile = filename_cat(dir, "pageno.log");
    60 
    61   //open the file as a read only file
    62   ifstream readfile(logfile.getcstr(), ios::in);
    63  
    64   // if file isn't opened, print error and return
    65   if (!readfile) {
    66     logout << "File " << logfile << " could not be found.\n";
    67     return pagenos;
    68   }
    69  
    70   // go through file, pushing each page number on to the end of a text_tarray
    71   while (readfile.getline(temp, BUFFSIZE-1)) {
    72     text_t t_temp = temp;
    73     pagenos.push_back(temp);
    74   }
    75   readfile.close();
    76    
    77   //returns the array of page numbers
    78   return pagenos;
    79 }
    8053
    8154bool text_t_substring (text_t &text, text_t &substr)
     
    10174
    10275
     76/*====================*
     77 * CLASS DEFINITIONS  *
     78 *====================*/
     79
     80langaction::langaction () {
     81
     82  package = "";
     83
     84  cgiarginfo arg_ainfo;
     85
     86  arg_ainfo.shortname = "l";
     87  arg_ainfo.longname = "interface language";
     88  arg_ainfo.multiplechar = true;
     89  arg_ainfo.defaultstatus = cgiarginfo::weak;
     90  arg_ainfo.argdefault = "en";
     91  arg_ainfo.savedarginfo = cgiarginfo::must;
     92  argsinfo.addarginfo (&cerr, arg_ainfo);
     93
     94  arg_ainfo.shortname = "bl";
     95  arg_ainfo.longname = "base language";
     96  arg_ainfo.multiplechar = true;
     97  arg_ainfo.defaultstatus = cgiarginfo::weak;
     98  arg_ainfo.argdefault = "english";
     99  arg_ainfo.savedarginfo = cgiarginfo::must;
     100  argsinfo.addarginfo (&cerr, arg_ainfo);
     101
     102  arg_ainfo.shortname = "tlng";
     103  arg_ainfo.longname = "translation language";
     104  arg_ainfo.multiplechar = true;
     105  arg_ainfo.defaultstatus = cgiarginfo::weak;
     106  arg_ainfo.argdefault = "french";
     107  arg_ainfo.savedarginfo = cgiarginfo::must;
     108  argsinfo.addarginfo (&cerr, arg_ainfo);
     109}
     110
     111
     112langaction::~langaction () {
     113  // Nothing to do in destructor
     114}
     115
     116
    103117// set_navbarmacros sets _navigationbar_ and _httpbrowseXXX_ macros
    104118// reponse contains 1 metadata field (Title)
    105 
    106 bool langaction::init (ostream & /*logout*/) {
    107 
     119bool langaction::init (ostream & /*logout*/)
     120{
    108121  // set up GSDLOS, GSDLHOME and PATH environment variables
    109122  text_t gsdlos, path;
     
    148161  return true;
    149162}
    150 /*====================*
    151  * CLASS DEFINITIONS  *
    152  *====================*/
    153 
    154 langaction::langaction () {
    155 
    156   package = "";
    157 
    158   cgiarginfo arg_ainfo;
    159 
    160   arg_ainfo.shortname = "l";
    161   arg_ainfo.longname = "interface language";
    162   arg_ainfo.multiplechar = true;
    163   arg_ainfo.defaultstatus = cgiarginfo::weak;
    164   arg_ainfo.argdefault = "en";
    165   arg_ainfo.savedarginfo = cgiarginfo::must;
    166   argsinfo.addarginfo (&cerr, arg_ainfo);
    167 
    168   arg_ainfo.shortname = "bl";
    169   arg_ainfo.longname = "base language";
    170   arg_ainfo.multiplechar = true;
    171   arg_ainfo.defaultstatus = cgiarginfo::weak;
    172   arg_ainfo.argdefault = "english";
    173   arg_ainfo.savedarginfo = cgiarginfo::must;
    174   argsinfo.addarginfo (&cerr, arg_ainfo);
    175 
    176   arg_ainfo.shortname = "tlng";
    177   arg_ainfo.longname = "translation language";
    178   arg_ainfo.multiplechar = true;
    179   arg_ainfo.defaultstatus = cgiarginfo::weak;
    180   arg_ainfo.argdefault = "french";
    181   arg_ainfo.savedarginfo = cgiarginfo::must;
    182   argsinfo.addarginfo (&cerr, arg_ainfo);
    183 }
    184 
    185 langaction::~langaction () {
    186 }
    187 
    188 bool langaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args,
    189                 recptprotolistclass *protos, ostream &logout) {
    190   // authenticate the user before allowing modifications (if authentication is available)
     163
     164
     165bool langaction::check_cgiargs (cgiargsinfoclass &/*argsinfo*/, cgiargsclass &args,
     166                recptprotolistclass* /*protos*/, ostream &logout)
     167{
     168  // Authenticate the user before allowing modifications
    191169  args["uan"] = 1;
    192170  args["ug"] = "langadmin";
     
    194172}
    195173
    196 void langaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass * /*protos*/,
    197                    response_t &response,text_t &response_data,
    198                    ostream & logout) {
     174
     175void langaction::get_cgihead_info (cgiargsclass &/*args*/, recptprotolistclass* /*protos*/,
     176                   response_t &response, text_t &response_data,
     177                   ostream &logout)
     178{
    199179  response = content;
    200180  response_data = "text/html";
    201181}
    202182
     183
    203184void langaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
    204                      recptprotolistclass *protos, ostream &logout) {
    205  
     185                     recptprotolistclass *protos, ostream &logout)
     186{
    206187  text_t text = "";
    207188  text_t cmd = "";
    208   text_t &arg_p = args["p"];
    209   text_tarray pagenos;
    210189  text_t dir = filename_cat(gsdlhome, "tmp", "lang");
    211   text_t pageno ="";
    212   text_t lang = "";
    213   text_t baselanguage = "";
    214 
    215   //sets the current foreign language
     190  text_t page = "";
     191  text_t sourcelang = "";
     192  text_t targetlang = "";
     193
     194  // Get the source language from the CGI arguments
     195  if (args["bl"] != "") {
     196    sourcelang = args["bl"];
     197  }
     198
     199  // Get the target language from the CGI arguments
    216200  if (args["ownchoice"] != "") {
    217     lang = args["ownchoice"];
     201    targetlang = args["ownchoice"];
    218202  }
    219203  else if (args["language"] != "") {
    220     lang = args["language"];
     204    targetlang = args["language"];
    221205  }
    222206  else if (args["tlng"] != "") {
    223     lang = args["tlng"];
    224   }
    225 
    226   if (args["bl"] != "") {
    227     baselanguage = args["bl"];
    228   }
    229 
    230   // Case fold the target language
    231   for (int i = 0; i < strlen(lang.getcstr()); i++) {
    232     lang[i] = tolower(lang[i]);
     207    targetlang = args["tlng"];
     208  }
     209
     210  // Case fold both languages
     211  for (int i = 0; i < strlen(sourcelang.getcstr()); i++) {
     212    sourcelang[i] = tolower(sourcelang[i]);
     213  }
     214  for (int i = 0; i < strlen(targetlang.getcstr()); i++) {
     215    targetlang[i] = tolower(targetlang[i]);
    233216  }
    234217
    235218  // Make sure the source and target languages are different!
    236   if (strcmp(baselanguage.getcstr(), lang.getcstr()) == 0) {
     219  if (sourcelang == targetlang) {
    237220    logout << "Same language!" << endl;
    238221    args["p"] = "translang";
    239     pageno = "picklanguage";
    240     define_webpage(disp, protos, logout, pageno, lang, dir, pagenos, text, baselanguage, true);
     222    page = "picklanguage";
     223    define_webpage(disp, sourcelang, targetlang, dir, page, -1, true, logout);
    241224    return;
    242225  }
    243226
    244   // logout << "Lang: " << lang << " Baselanguage: " << baselanguage << endl;
    245   text_t translation = baselanguage + "-" + lang;
     227  // logout << "Source lang: " << sourcelang << " Target lang: " << targetlang << endl;
     228  text_t translation = sourcelang + "-" + targetlang;
    246229  logout << "Translation: " << translation << endl;
    247230  text_t trans_dir = filename_cat(dir, translation);
     
    249232  // argument for page is of the form 'macrofile_pageno' so
    250233  // we need to split the argument to get the proper page content
     234  text_t &arg_p = args["p"];
    251235  text_tarray splitarray;
    252236  splitchar(arg_p.begin(), arg_p.end(), '_', splitarray);
    253  
     237
    254238  arg_p = splitarray[0];
    255239  if (splitarray.size() > 1)
    256     pageno = splitarray[splitarray.size()-1];
     240    page = splitarray[splitarray.size()-1];
    257241
    258242  //if are entering page from macro search
    259243  if (args["macroname"] != "") {
    260244    text_t macroname = args["macroname"];
    261    
    262     //calls the translator file to create HTML files
    263     cmd = "perl " + filename_cat(gsdlhome, "bin", "script", "fromsearch.pl") + " " + macroname + " " + lang + " " + baselanguage;
     245
     246    // !! TO DO !!
     247    cmd = "perl " + filename_cat(gsdlhome, "bin", "script", "fromsearch.pl") + " " + sourcelang + " " + targetlang + " " + macroname;
    264248    logout << "COMMAND: " << cmd <<endl;
    265    
     249
    266250    if ((gsdl_system(cmd, true, logout)) != 0) {
    267251      logout << "Process " << cmd << " did not execute.../;-D\n";
    268252      return;
    269253    }
    270    
    271     define_webpage(disp, protos, logout, pageno, lang, trans_dir, pagenos, text, baselanguage, false);
     254
     255    define_webpage(disp, sourcelang, targetlang, trans_dir, page, -1, false, logout);
    272256    return;
    273257  }
    274258
    275   if (pageno == "fromsearch")
    276     pageno = "thankyou";
    277 
    278   if (pageno == "picklanguage") {
    279     pageno = "1";
    280    
     259  if (page == "fromsearch")
     260    page = "thankyou";
     261
     262  if (page == "picklanguage") {
     263    page = "1";
     264
    281265    //calls the translator file to create HTML files
    282     cmd = "perl " + filename_cat(gsdlhome, "bin", "script", "translator.pl") + " " + baselanguage + " " + lang;
     266    cmd = "perl " + filename_cat(gsdlhome, "bin", "script", "translator.pl") + " " + sourcelang + " " + targetlang;
    283267    if ((gsdl_system(cmd, true, logout)) != 0) {
    284268      logout << "Process " << cmd << " did not execute.../;-D\n";
    285269      return;
    286270    }
     271
     272    const recptconf &rcinfo = recpt->get_configinfo();
     273
     274    // Use sendmail.pl perl script to send email events
     275    text_t tmpmailfile = filename_cat (gsdlhome, "tmp", "lang", "email.txt");
     276    char *tmpmailfilec = tmpmailfile.getcstr();
     277    ofstream tmpfile (tmpmailfilec);
     278    if (tmpfile) {
     279      tmpfile << "[Translator Event]\n"
     280          << "Date: " << get_date (true) << "\n"
     281          << "Greenstone Username: " << args["un"] << "\n";
     282      tmpfile << "The " << targetlang << " language translation was entered.\n";
     283      tmpfile.close();
     284
     285      text_t sendmail_cmd = "perl -S sendmail.pl";
     286      sendmail_cmd += " -to \"" + rcinfo.maintainer + "\"";
     287      sendmail_cmd += " -from \"[email protected]\"";
     288      sendmail_cmd += " -smtp \"" + rcinfo.MailServer + "\"";
     289      sendmail_cmd += " -subject \"Greenstone Translator Event\"";
     290      sendmail_cmd += " -msgfile \"" + tmpmailfile + "\"";
     291      // logout << "Sendmail command: " << sendmail_cmd << endl;
     292      gsdl_system (sendmail_cmd, true, logout);
     293      unlink(tmpmailfilec);
     294    }
     295    else {
     296      logout << "translatoraction:: ERROR: Couldn't open "
     297         << "temporary event log file " << tmpmailfile << " for email event.\n";
     298    }
     299    delete tmpmailfilec;
    287300  }
    288301
    289302  //generates the picklanguage page
    290   if (pageno.empty()) {
    291     pageno = "picklanguage";
    292     logout << "@ the 1st pg\n";
     303  if (page.empty()) {
     304    page = "picklanguage";
    293305    cmd = "perl " + filename_cat(gsdlhome, "bin", "script", "picklanguage.pl");
    294306    logout << cmd << endl;
    295307    if(gsdl_system(cmd,true,logout) != 0)
    296308      return;
    297     define_webpage(disp, protos, logout, pageno, lang, dir, pagenos, text, baselanguage, false);
    298    
     309    define_webpage(disp, sourcelang, targetlang, dir, page, -1, false, logout);
    299310    return;
    300311  }
    301312
    302   //if no more pages will set pageno to thankyou script
    303   pagenos = get_pagenos(trans_dir, lang, logout);
    304  
    305   if (pagenos.empty() && pageno == "")
    306     pageno = "thankyou";
    307  
    308   text_t &submitargs = args[pageno];
     313  // Read the number of translation pages from numpages.log
     314  text_t numpagesfilepath = filename_cat(trans_dir, "numpages.log");
     315  ifstream numpagesfile(numpagesfilepath.getcstr(), ios::in);
     316
     317  // Check file opened OK
     318  if (!numpagesfile) {
     319    logout << "Error: File " << numpagesfilepath << " could not be opened." << endl;
     320    return;
     321  }
     322
     323  // Read the number of pages from the file
     324  int numpages;
     325  char line[LINESIZE];
     326  if (numpagesfile.getline(line, LINESIZE-1)) {
     327    numpages = atoi(line);
     328  }
     329  numpagesfile.close();
     330
     331  // if (pagenos.empty() && pageno == "")
     332  if (numpages == 0)
     333    page = "thankyou";
     334
     335  text_t &submitargs = args[page];
    309336  text_t submit = "SUBMIT TRANSLATION";
    310  
     337
    311338  //if the SUBMIT TRANSLATION >> button has been pushed
    312339  if (text_t_substring(submitargs,submit)) {
     
    318345    //create the command line for submitting the translation
    319346    cmd = "perl " + filename_cat(gsdlhome, "bin", "script", "submit_translation.pl") + " ";
    320     cmd += (baselanguage + " " + lang + " " + "arguments.arg");
     347    cmd += (sourcelang + " " + targetlang + " " + "arguments.arg");
    321348
    322349    //give command to system to execute submission of translation
     
    325352
    326353    //increments which page is displayed when translation is submitted
    327     for (text_tarray::iterator page_itr = pagenos.begin();
    328      page_itr != pagenos.end();
    329      page_itr++) {
    330       if (*page_itr == pageno) {
    331     page_itr++;
    332     if (page_itr != pagenos.end())
    333       pageno = *page_itr;
    334     else
    335       pageno = "thankyou";
    336 
    337     break; 
    338       }
    339     }
    340   }
    341 
    342   pagenos = get_pagenos(trans_dir, lang, logout);
    343   define_webpage(disp, protos, logout, pageno, lang, trans_dir, pagenos, text, baselanguage, false);
     354    int pageno = atoi(page.getcstr());
     355    if (pageno >= numpages)
     356      page = "thankyou";
     357    else
     358      page = (pageno + 1);
     359  }
     360
     361  define_webpage(disp, sourcelang, targetlang, trans_dir, page, numpages, false, logout);
    344362}
    345363
     
    349367  ofstream argsout(argsfile.getcstr(), ios::out);
    350368
    351   //informs user and returns if output stream not opened
    352   if(!argsout) {
    353     logout << "File " << argsfile << " could not be opened\n";
     369  // Informs user and returns if output stream not opened
     370  if (!argsout) {
     371    logout << "Error: File " << argsfile << " could not be opened." << endl;
    354372    return;
    355373  }
    356374
    357   //ensures access permissions make the file world writable
    358   text_t changemode = "chmod a+w ";
    359   changemode += argsfile;
     375  // Make the file world writable
     376  text_t changemode = "chmod a+w " + argsfile;
    360377  gsdl_system(changemode, false, logout);
    361378
    362   //write out the cgiargsclass passes as a parameter to the subroutine to the argsout file
     379  // Write out the cgiargsclass variable to the argsout file
    363380  argsout << args;
    364   //close the argsout output stream
    365381  argsout.close();
    366382}
    367383
    368384
    369 void langaction::define_webpage (displayclass &disp,
    370                  recptprotolistclass *protos, ostream &logout,
    371                  text_t pageno, text_t &lang, text_t dir,
    372                  text_tarray &pagenos, text_t &text, text_t &baselanguage,
    373                  bool error) {
    374  
     385void langaction::define_webpage (displayclass &disp, text_t sourcelang, text_t targetlang,
     386                 text_t dir, text_t page, int numpages, bool error,
     387                 ostream &logout)
     388{
    375389  // produces HTML page with the current pages contents
    376390  // formfile is the file that contains web-form for the
    377391  // current package whose name is stored in 'package'
    378392
    379   text_t formfile = filename_cat(dir, pageno + ".lang");
     393  text_t formfile = filename_cat(dir, page + ".lang");
    380394  ifstream readfile(formfile.getcstr(), ios::in);
    381395  if (!readfile) {
     
    386400
    387401  /* ============================ START WEB-FORM HTML CODE ============================ */
    388   text += "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>";
    389 
    390   text += "\n<input type=hidden name=\"a\" value=\"lang\">";
    391   text += "\n<input type=hidden name=\"p\" value=\"translang_";
    392   text += pageno;
    393   text += "\">";
    394   text += "\n<input type=hidden name=\"e\" value=\"_decodedcompressedoptions_\">";
    395  
    396   text += "_texttranshead_";       
    397 
    398   //if not a special case page display translation info
    399   if ((pageno != "thankyou") && (pageno !="picklanguage") && (pageno != "fromsearch")) {
    400  
    401     text += "<center><strong> _textcurrpage_ ";
    402     text += pageno;
    403     text += " _textof_ ";
    404     text += pagenos.size();
    405     text += "</strong></center>\n";
    406 
    407     for (text_tarray::iterator page_itr = pagenos.begin();
    408      page_itr != pagenos.end();
    409      page_itr++) {
    410    
    411       if (*page_itr == pageno) {
    412     page_itr++;
    413     text_t temp2;
    414     if (page_itr != pagenos.end())
    415       temp2 = *page_itr;
    416     else
    417       temp2 = "thankyou";
    418        
    419     text += "<a href=\"_gwcgi_?e=_compressedoptions_&a=lang&p=translang_";
    420     text += temp2;
    421     text += "&baselanguage=";
    422     text += baselanguage;
    423     text += "&language=";
    424     text += lang;
    425     text += "\"><strong>";
    426     text += "NEXT>>";
    427     text += "</strong></a>\n";
    428 
    429     break;
    430       }
    431       else {
    432     text += "<a href=\"_gwcgi_?e=_compressedoptions_&a=lang&p=translang_";
    433     text += *page_itr;
    434     text += "&baselanguage=";
    435     text += baselanguage;
    436     text += "&language=";
    437     text += lang;
    438     text += "\"><strong>";
    439     text += *page_itr;
    440     text += "</strong></a>\n";
    441       }
    442     }
    443   }
    444  
    445   //read in HTML from file
    446   while(readfile.getline(temp, BUFFSIZE-1)) {
    447     text_t t_temp = temp;
    448     text += t_temp;
    449     text += "\n";
     402  text_t text = "";
     403  text += "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></head><body>\n";
     404
     405  text += "<input type=hidden name=\"a\" value=\"lang\">\n";
     406  text += "<input type=hidden name=\"p\" value=\"translang_" + page + "\">\n";
     407  text += "<input type=hidden name=\"e\" value=\"_decodedcompressedoptions_\">\n";
     408
     409  text += "_texttranshead_";
     410
     411  // If not a special case page display "Page x of y" and Next button
     412  if ((page != "thankyou") && (page != "picklanguage") && (page != "fromsearch")) {
     413    text += "<center><strong>";
     414    text += " _textcurrpage_ " + page + " _textof_ " + numpages;
     415    text += "</strong>";
     416
     417    int pageno = atoi(page.getcstr());
     418    text += " <a href=\"_gwcgi_?e=_compressedoptions_&a=lang&p=translang_";
     419    if (pageno >= numpages)
     420      text += "thankyou";
     421    else
     422      text += (pageno + 1);
     423    text += "&baselanguage=" + sourcelang;
     424    text += "&language=" + targetlang;
     425    text += "\">";
     426    text += "<strong>NEXT>></strong></a></center>\n";
     427  }
     428
     429  // Read in HTML from file
     430  char line[LINESIZE];
     431  while (readfile.getline(line, LINESIZE-1)) {
     432    text_t temp = line;
     433    text += temp + "\n";
    450434  }
    451435  readfile.close();
    452   if (pageno == "picklanguage" && error) {
    453     text += "<center><strong>Please choose different source and target languages!</strong></center>";
    454   }
    455 
    456   //if not a special case page display translation info
    457   if ((pageno != "thankyou") && (pageno != "picklanguage") && (pageno != "fromsearch")) {
    458     text += "<center><strong> _textcurrpage_ ";
    459     text += pageno;
    460     text += " _textof_ ";
    461     text += pagenos.size();
    462     text += "</strong><br>\n";
    463 
    464     for (text_tarray::iterator page_itr = pagenos.begin();
    465      page_itr != pagenos.end();
    466      page_itr++) {
    467    
    468       if (*page_itr == pageno) {
    469     page_itr++;
    470     text_t temp2;
    471     if (page_itr != pagenos.end())
    472       temp2 = *page_itr;
    473     else
    474       temp2 = "thankyou";
    475        
    476     text += "<a href=\"_gwcgi_?e=_compressedoptions_&a=lang&p=translang_";
    477     text += temp2;
    478     text += "&baselanguage=";
    479     text += baselanguage;
    480     text += "&language=";
    481     text += lang;
    482     text += "\"><strong>";
    483     text += "NEXT>>";
    484     text += "</strong></a>\n";
    485 
    486     break;
    487       }
    488       else {
    489     text += "<a href=\"_gwcgi_?e=_compressedoptions_&a=lang&p=translang_";
    490     text += *page_itr;
    491     text += "&baselanguage=";
    492     text += baselanguage;
    493     text += "&language=";
    494     text += lang;
    495     text += "\"><strong>";
    496     text += *page_itr;
    497     text += "</strong></a>\n";
    498       }
    499     }
    500   }
    501 
    502   if (pageno == "fromsearch")
     436
     437  if (page == "picklanguage" && error) {
     438    text += "<center><strong>_textchoosedifferent_</strong></center>";
     439  }
     440
     441  // If not a special case page display "Page x of y" and Next button
     442  if ((page != "thankyou") && (page != "picklanguage") && (page != "fromsearch")) {
     443    text += "<center><strong>";
     444    text += " _textcurrpage_ " + page + " _textof_ " + numpages;
     445    text += "</strong>";
     446
     447    int pageno = atoi(page.getcstr());
     448    text += " <a href=\"_gwcgi_?e=_compressedoptions_&a=lang&p=translang_";
     449    if (pageno >= numpages)
     450      text += "thankyou";
     451    else
     452      text += (pageno + 1);
     453    text += "&baselanguage=" + sourcelang;
     454    text += "&language=" + targetlang;
     455    text += "\">";
     456    text += "<strong>NEXT>></strong></a></center>\n";
     457  }
     458
     459  if (page == "fromsearch")
    503460    text += "<center><strong> _textcurrpage_ 1 _textof_ 1</strong><br>\n";
    504461
     
    511468  // THE FOLLOWING MACROS ARE DEFINED IN translang.dm MACRO FILE
    512469  // set the formcontent  as the content of the form-page
    513  
    514   // logout << "Text: " << text;
    515470
    516471  disp.setmacro("formcontent", "translang", text);
     
    524479  navigationbar += "<td align=right>_javalinks_</td><td>";
    525480
    526   if (pageno != "picklanguage") {
     481  if (page != "picklanguage") {
    527482    navigationbar += "_imageserch_";
    528483  }
     
    530485  navigationbar += "<!-- End of Navigation Bar -->\n";
    531486  disp.setmacro ("navigationbar", "translang", navigationbar);
    532 
    533 }
     487}
     488
    534489
    535490bool langaction::do_action (cgiargsclass &args, recptprotolistclass * /*protos*/,
     
    548503  return true;
    549504}
    550 
    551 
  • trunk/gsdl/src/recpt/langaction.h

    r4115 r4123  
    3030
    3131#include "action.h"
     32#include "receptionist.h"
     33
    3234
    3335class langaction : public action {
    3436
    3537protected:
     38  receptionist *recpt;
     39
    3640  // package whose contents will be displayed in the form space
    3741  text_t package;
     
    4347  langaction ();
    4448  virtual ~langaction ();
     49
     50  void set_receptionist (receptionist *therecpt) {recpt=therecpt;}
    4551
    4652  text_t get_action_name () {return "lang";}
     
    6571  bool init (ostream & /*logout*/);
    6672
    67   void define_webpage (displayclass &disp,
    68                recptprotolistclass *protos, ostream &logout,
    69                text_t pageno, text_t &lang, text_t dir,
    70                text_tarray &pagenos, text_t &text, text_t &baselanguage, bool error);
     73  void define_webpage (displayclass &disp, text_t sourcelang, text_t targetlang,
     74               text_t dir, text_t pageno, int numpages, bool error,
     75               ostream &logout);
    7176};
    7277
Note: See TracChangeset for help on using the changeset viewer.