Changeset 866


Ignore:
Timestamp:
2000-01-25T11:59:57+13:00 (24 years ago)
Author:
sjboddie
Message:

changes to set macros differently for preferences page depending
on type of collection - pageaction is getting kind of hacky - should
tidy it up some day

File:
1 edited

Legend:

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

    r793 r866  
    2828/*
    2929   $Log$
     30   Revision 1.23  2000/01/24 22:59:57  sjboddie
     31   changes to set macros differently for preferences page depending
     32   on type of collection - pageaction is getting kind of hacky - should
     33   tidy it up some day
     34
    3035   Revision 1.22  1999/11/25 23:01:09  sjboddie
    3136   now need to be able to handle it if no collection is selected
     
    176181    text_tarray::iterator collist_end = collist.end();
    177182   
    178     int row1 = 6;
    179     int row2 = 4;
     183    int row1 = 7;
     184    int row2 = 5;
    180185    int count = 1;
    181186    while (collist_here != collist_end) {
     
    219224          if (*collist_here == "chinese")
    220225        link = "<a href=\"_gwcgi_?a=p&p=about&l=zh&nw=u&c=" + *collist_here + "\">";
     226          if (*collist_here == "arabic")
     227        link = "<a href=\"_gwcgi_?a=p&p=about&w=a&c=" + *collist_here + "\">";
    221228
    222229          if (!cinfo.receptionist.empty())
    223         link = "<a href=\"" + cinfo.receptionist + "?a=p&p=about&c="
    224           + *collist_here + "\">";
     230        link = "<a href=\"" + cinfo.receptionist + "\">";
    225231         
    226232          homeextra += link + collectionname + "</a>\n";
     
    248254  // define_internal_macros sets the following macros:
    249255
     256  // _numdocs_             the number of documents in the collection
     257
     258  // _builddate_           the date last built
     259
     260
    250261  // if page is "home"
    251262  // _homeextra_           this is the list of available collections and collection info
     
    253264
    254265
     266  // if page is "preferences"
     267  // _collectionoption_    collections to search/browse (if cross-collection-searching is on)
     268
     269  // _htmloptions_         set to _htmloptionson_ if DocumentUseHTML is set
     270
     271
    255272  // if page is "about"
    256   // _numdocs_             the number of documents in the collection
    257 
    258   // _builddate_           the date last built
     273  // _textsubcollections_  the text on which subcollections make up the collection (if
     274  //                       cross-collection searching is being used
    259275
    260276  // _textbrowseoptions_   the 'how to find information' text in the about and help pages
     
    270286 
    271287  text_t &arg_p = args["p"];
    272 
    273   recptproto* collectproto = protos->getrecptproto (args["c"], logout);
     288  text_t &arg_c = args["c"];
     289  ColInfoResponse_t cinfo;
     290  comerror_t err;
     291
     292  recptproto* collectproto = protos->getrecptproto (arg_c, logout);
    274293  if (collectproto != NULL) {
    275     comerror_t err;
    276     ColInfoResponse_t cinfo;
    277     collectproto->get_collectinfo (args["c"], cinfo, err, logout);
    278  
     294    collectproto->get_collectinfo (arg_c, cinfo, err, logout);
     295
    279296    disp.setmacro ("numdocs", "Global", cinfo.numDocs);
    280297    unsigned long current_time = time(NULL);
     
    285302  if (arg_p == "home") set_homeextra_macro (disp, protos, logout);
    286303
    287   else if (arg_p == "about" || arg_p == "help") {
     304  else if (arg_p == "preferences") {
     305   
     306    // _collectionoption_
     307
     308    if (args["ccs"] == "1" && collectproto != NULL && (cinfo.ccsCols.size() > 1)) {
     309      text_t collectionoption = "_textcollectionoption_";
     310      text_tarray::const_iterator col_here = cinfo.ccsCols.begin();
     311      text_tarray::const_iterator col_end = cinfo.ccsCols.end();
     312      while (col_here != col_end) {
     313    text_t colname;
     314    if (*col_here == arg_c) {
     315        colname = cinfo.collectionmeta["collectionname"];
     316    } else {
     317      ColInfoResponse_t this_cinfo;
     318      collectproto->get_collectinfo (*col_here, this_cinfo, err, logout);
     319      colname = this_cinfo.collectionmeta["collectionname"];
     320    }
     321
     322    collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
     323      *col_here + "\" onClick=\"updatecc(\'" + *col_here + "\');\"> " +
     324      colname + "<br>\n";
     325    col_here ++;
     326      }
     327
     328      disp.setmacro ("collectionoption", "preferences", collectionoption);
     329    }
     330
     331    // _htmloptions_
     332   
     333    text_tmap::const_iterator it = cinfo.format.find ("DocumentUseHTML");
     334    if ((it != cinfo.format.end()) && ((*it).second == "true"))
     335      disp.setmacro ("htmloptions", "preferences", "_htmloptionson_");
     336
     337   
     338  } else if (arg_p == "about" || arg_p == "help") {
    288339    if (collectproto == NULL) return;
    289340   
     
    322373    shorttext += "</ul>\n";
    323374    disp.setmacro ("textbrowseoptions", "help", shorttext + longtext);
     375
     376    if (arg_p == "about") {
     377
     378      // _textsubcollections_
     379      if (args["ccs"] == "1" && (cinfo.ccsCols.size() > 1)) {
     380    text_t textsubcollections = "_textsubcols1_(" + text_t(cinfo.ccsCols.size()) + ")";
     381    text_tarray::const_iterator here = cinfo.ccsCols.begin();
     382    text_tarray::const_iterator end = cinfo.ccsCols.end();
     383    while (here != end) {
     384      if (*here == arg_c) {
     385        textsubcollections += "\n<br>" + cinfo.collectionmeta["collectionname"] + "\n";
     386      } else {
     387        ColInfoResponse_t this_cinfo;
     388        collectproto->get_collectinfo (*here, this_cinfo, err, logout);
     389        if (err == noError) {
     390          textsubcollections += "\n<br>" + this_cinfo.collectionmeta["collectionname"] + "\n";
     391        }
     392      }
     393      here ++;
     394    }
     395    textsubcollections += "_textsubcols2_";
     396    disp.setmacro ("textsubcollections", "about", textsubcollections);
     397      }
     398    }
    324399  }
    325400}
Note: See TracChangeset for help on using the changeset viewer.