Changeset 867


Ignore:
Timestamp:
2000-01-26T11:31:09+13:00 (24 years ago)
Author:
sjboddie
Message:

more hacky changes to get preferences to be a bit smarter

File:
1 edited

Legend:

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

    r866 r867  
    2828/*
    2929   $Log$
     30   Revision 1.24  2000/01/25 22:31:09  sjboddie
     31   more hacky changes to get preferences to be a bit smarter
     32
    3033   Revision 1.23  2000/01/24 22:59:57  sjboddie
    3134   changes to set macros differently for preferences page depending
     
    269272  // _htmloptions_         set to _htmloptionson_ if DocumentUseHTML is set
    270273
     274  // _PreferencesDocsFromWeb_ set to 1 if corresponding format option is set
     275
     276  // _languageoption_      interface languages to select from (dependant on PreferenceLanguages)
     277
     278  // _encodingoption_      will be overridden to "" if chinese language interface isn't specified
    271279
    272280  // if page is "about"
     
    332340   
    333341    text_tmap::const_iterator it = cinfo.format.find ("DocumentUseHTML");
    334     if ((it != cinfo.format.end()) && ((*it).second == "true"))
     342    if ((it != cinfo.format.end()) && ((*it).second == "true")) {
    335343      disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
    336344
     345
     346      // _PreferenceDocsFromWeb_
     347
     348      it = cinfo.format.find ("PreferenceDocsFromWeb");
     349      if ((it == cinfo.format.end()) || ((*it).second == "true"))
     350    disp.setmacro ("PreferenceDocsFromWeb", "preferences", "1");
     351    }
     352
     353    // _languageoption_
     354    // this is kind of a hack (another one!!). note that there're potential
     355    // problems here as no checking is done anywhere to make sure language
     356    // is set to a valid value. this does allow us to set which languages
     357    // should go in the preference selection box (from collect.cfg) however
     358    // and that's sufficient for current requirements
     359   
     360    // currently supported languages (_languageoption_ will default to all
     361    // these languages unless PreferenceLanguages is set
     362    text_tarray languages;
     363    languages.push_back ("en");
     364    languages.push_back ("mi");
     365    languages.push_back ("zh");
     366    text_tarray::const_iterator this_lang = languages.begin();
     367    text_tarray::const_iterator end_lang = languages.end();
     368
     369    text_t languageoption = "_textlanguage_\n<select name=\"l\" onChange=\"updatel();\">\n";
     370    it = cinfo.format.find ("PreferenceLanguages");
     371    if ((it != cinfo.format.end()) && (!(*it).second.empty())) {
     372      text_tset pref_langs;
     373      splitchar ((*it).second.begin(), (*it).second.end(), '|', pref_langs);
     374      if (pref_langs.size() > 1) {
     375    while (this_lang != end_lang) {
     376      if (pref_langs.find(*this_lang) != pref_langs.end())
     377        languageoption += "_" + *this_lang + "languageoption_\n";
     378      this_lang ++;
     379    }
     380    languageoption += "</select>\n";
     381    disp.setmacro ("languageoption", "preferences", languageoption);
     382      }
     383   
     384      // _encodingoption_
     385
     386      if (pref_langs.find("zh") == pref_langs.end())
     387    disp.setmacro ("encodingoption", "preferences", "");
     388
     389    } else {
     390      while (this_lang != end_lang) {
     391    languageoption += "_" + *this_lang + "languageoption_\n";
     392    this_lang ++;
     393      }
     394      languageoption += "</select>\n";
     395      disp.setmacro ("languageoption", "preferences", languageoption);
     396    }
    337397   
    338398  } else if (arg_p == "about" || arg_p == "help") {
     
    372432    }
    373433    shorttext += "</ul>\n";
    374     disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
     434    if (response.docInfo.size() > 1) disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
     435    else disp.setmacro ("textbrowseoptions", "help", longtext);
    375436
    376437    if (arg_p == "about") {
     
    381442    text_tarray::const_iterator here = cinfo.ccsCols.begin();
    382443    text_tarray::const_iterator end = cinfo.ccsCols.end();
     444    bool first = true;
    383445    while (here != end) {
    384446      if (*here == arg_c) {
    385         textsubcollections += "\n<br>" + cinfo.collectionmeta["collectionname"] + "\n";
     447        if (!first) textsubcollections += "<br>";
     448        textsubcollections += "\n" + cinfo.collectionmeta["collectionname"] + "\n";
    386449      } else {
    387450        ColInfoResponse_t this_cinfo;
    388451        collectproto->get_collectinfo (*here, this_cinfo, err, logout);
    389452        if (err == noError) {
    390           textsubcollections += "\n<br>" + this_cinfo.collectionmeta["collectionname"] + "\n";
     453          if (!first) textsubcollections += "<br>";
     454          textsubcollections += "\n" + this_cinfo.collectionmeta["collectionname"] + "\n";
    391455        }
    392456      }
     457      first = false;
    393458      here ++;
    394459    }
Note: See TracChangeset for help on using the changeset viewer.