Ignore:
Timestamp:
2005-05-23T16:36:40+12:00 (19 years ago)
Author:
kjdon
Message:

getting collectionmeta from teh colinforesponse now, not using a get_info via the protocol. this means that collmeta will be read from the config file not from the database - it will not require rebuilding for changes to take effect.

File:
1 edited

Legend:

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

    r9676 r9931  
    219219        coll_type += "0";
    220220          }
    221 
    222           FilterResponse_t response;
    223           text_tset metadata;
    224           metadata.insert ("collectionname");
    225           text_t lang = args["l"];
    226           if (!lang.empty()) {
    227         metadata.insert ("collectionname:"+lang);
    228           }
    229           text_t collectionname = *collist_here;
    230          
    231           if (get_info ("collection", *collist_here, "", metadata, false,
    232                 (*rprotolist_here).p, response, logout)) {
    233         if (!lang.empty() && !response.docInfo[0].metadata["collectionname:"+lang].values[0].empty()) {
    234           collectionname = response.docInfo[0].metadata["collectionname:"+lang].values[0];
    235         } else if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) {
    236           collectionname = response.docInfo[0].metadata["collectionname"].values[0];
    237         }
     221          text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]);
     222          if (collectionname.empty()) {
     223        collectionname = *collist_here;
    238224          }
    239225         
     
    351337
    352338          found_valid_col = true;
    353           FilterResponse_t response;
    354           text_tset metadata;
    355           metadata.insert ("collectionname");
    356           metadata.insert ("iconcollection");
    357           metadata.insert ("iconcollectionsmall");
    358           // also look for lang specific values
    359           text_t lang = args["l"];
    360           if (!lang.empty()) {
    361         metadata.insert ("collectionname:"+lang);
    362         metadata.insert ("iconcollection:"+lang);
    363         metadata.insert ("iconcollectionsmall:"+lang);
     339          text_t collectionname = *collist_here;
     340          text_t alt = cinfo->get_collectionmeta("collectionname", args["l"]);
     341          if (alt.empty()) {
     342        alt = collectionname;
    364343          }
    365           text_t collectionname = *collist_here;
    366           text_t alt = collectionname;
    367 
    368           if (get_info ("collection", *collist_here, "", metadata, false,
    369                 (*rprotolist_here).p, response, logout)) {
    370         // get the "collectionname"
    371         if (!lang.empty() && !response.docInfo[0].metadata["collectionname:"+lang].values[0].empty()) {
    372           alt = response.docInfo[0].metadata["collectionname:"+lang].values[0];
    373         } else if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) {
    374           alt = response.docInfo[0].metadata["collectionname"].values[0];
     344         
     345          // url to image: try iconcollectionsmall, then iconcollection
     346          text_t iconurl = cinfo->get_collectionmeta("iconcollectionsmall", args["l"]);
     347          if (iconurl.empty()) {
     348        iconurl = cinfo->get_collectionmeta("iconcollection", args["l"]);
     349          }
     350         
     351          if (!iconurl.empty()) {
     352       
     353        // check to see URL is local to colserver
     354        text_t::iterator iconurl_head = iconurl.begin();
     355        text_t iconhead = substr(iconurl_head,iconurl_head+16);
     356        if (iconhead=="_httpcollection_") {
     357         
     358          // local and using _httpcollection_
     359          text_t icontail = substr(iconurl_head+16,iconurl.end());
     360          iconurl = "http://" + cinfo->httpdomain
     361            + cinfo->httpprefix + "/collect/"
     362            + *collist_here + "/" + icontail;
     363        }
     364        else if (iconurl[0]=='/') {
     365         
     366          // local but with full path
     367          iconurl = "http://" + cinfo->httpdomain + iconurl;
    375368        }
    376369       
    377         text_t iconurl;
    378         iconurl.clear();
    379 
    380         if (!lang.empty() &&!response.docInfo[0].metadata["iconcollectionsmall:"+lang].values[0].empty()) {
    381          iconurl = response.docInfo[0].metadata["iconcollectionsmall:"+lang].values[0];
    382         } else if (!response.docInfo[0].metadata["iconcollectionsmall"].values[0].empty()) {
    383           iconurl = response.docInfo[0].metadata["iconcollectionsmall"].values[0];
    384         } else if (!lang.empty() && !response.docInfo[0].metadata["iconcollection:"+lang].values[0].empty()) {
    385           iconurl = response.docInfo[0].metadata["iconcollection:"+lang].values[0];
    386         } else if (!response.docInfo[0].metadata["iconcollection"].values[0].empty()) {
    387           iconurl = response.docInfo[0].metadata["iconcollection"].values[0];
    388         }
    389        
    390         if (!iconurl.empty())
    391           {
    392             // check to see URL is local to colserver
    393             text_t::iterator iconurl_head = iconurl.begin();
    394             text_t iconhead = substr(iconurl_head,iconurl_head+16);
    395             if (iconhead=="_httpcollection_")
    396               {
    397             // local and using _httpcollection_
    398             text_t icontail = substr(iconurl_head+16,iconurl.end());
    399             iconurl = "http://" + cinfo->httpdomain
    400               + cinfo->httpprefix + "/collect/"
    401               + *collist_here + "/" + icontail;
    402               }
    403             else if (iconurl[0]=='/')
    404               {
    405             // local but with full path
    406             iconurl = "http://" + cinfo->httpdomain + iconurl;
    407               }
    408 
    409             collectionname
    410               = "<img width=150 border=1 src=\"" + iconurl + "\" alt=\"" + alt + "\">";
    411           }
    412         else
    413           {
    414             collectionname = alt;
    415           }
    416 
     370        collectionname
     371          = "<img width=150 border=1 src=\"" + iconurl + "\" alt=\"" + alt + "\">";
     372          } else {
     373        collectionname = alt;
    417374          }
     375         
    418376          if ((count%configinfo.HomePageCols == 0) && (!first))
    419377        homeextra += "</tr><tr valign=top>\n";
     
    426384          text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&p=about&c=" + *collist_here + coll_type;
    427385          link += "&l=" + args["l"] + "&w=" + args["w"] + "\">";
    428 
     386         
    429387          if (!cinfo->receptionist.empty())
    430388        link = "<a href=\"" + cinfo->receptionist + "\">";
     
    453411}
    454412
    455 void pageaction::set_collectionlist_macro (displayclass &disp, recptprotolistclass *protos,
     413void pageaction::set_collectionlist_macro (displayclass &disp,
     414                       recptprotolistclass *protos,
     415                       cgiargsclass &args,
    456416                       ostream &logout) {
    457417
     
    522482        coll_type += "0";
    523483          }
    524           FilterResponse_t response;
    525           text_tset metadata;
    526           metadata.insert ("collectionname");
    527           text_t collectionname = *collist_here;
    528 
    529           if (get_info ("collection", *collist_here, "", metadata, false,
    530                 (*rprotolist_here).p, response, logout)) {
    531         if (!response.docInfo[0].metadata["collectionname"].values[0].empty()) {
    532           collectionname = response.docInfo[0].metadata["collectionname"].values[0];
    533         }
     484          text_t collectionname = cinfo->get_collectionmeta("collectionname", args["l"]);
     485          if (collectionname.empty()) {
     486        collectionname = *collist_here;
    534487          }
    535488         
     
    836789    }
    837790  }
    838 
     791 
     792 
    839793  if (arg_p == "home" || arg_p == "homehelp") {
    840794    if (status_disabled) disp.setmacro ("textgoadmin", "home", "");
     
    845799      homepagestyle (disp, protos, args, logout);
    846800    } else if (arg_p == "homehelp") {
    847       set_collectionlist_macro (disp, protos, logout);
     801      set_collectionlist_macro (disp, protos, args, logout);
    848802    }
    849803
     
    878832    text_t colname;
    879833    if (*col_here == arg_c) {
    880         colname = cinfo->collectionmeta["collectionname"];
     834        colname = cinfo->get_collectionmeta("collectionname", args["l"]);
    881835    } else {
    882836      ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *col_here, logout);
    883837      if (this_cinfo == NULL) {++col_here; continue;}
    884       colname = this_cinfo->collectionmeta["collectionname"];
     838      colname = this_cinfo->get_collectionmeta("collectionname", args["l"]);
    885839    }
    886 
     840    if (colname.empty()) {
     841      colname = *col_here;
     842    }
    887843    ++count;
    888844    collectionoption += "<input type=checkbox name=\"cc\" value=\"" +
     
    1003959      if (*here == arg_c) {
    1004960        if (!first) textsubcollections += "<br>";
    1005         textsubcollections += "\n" + cinfo->collectionmeta["collectionname"] + "\n";
     961        textsubcollections += "\n" + cinfo->get_collectionmeta("collectionname", args["l"]) + "\n";
    1006962      } else {
    1007963        ColInfoResponse_t *this_cinfo = recpt->get_collectinfo_ptr (collectproto, *here, logout);
    1008964        if (this_cinfo == NULL) {++here; continue;}
    1009965        if (!first) textsubcollections += "<br>";
    1010         textsubcollections += "\n" + this_cinfo->collectionmeta["collectionname"] + "\n";
     966        textsubcollections += "\n" + this_cinfo->get_collectionmeta("collectionname", args["l"]) + "\n";
    1011967      }
    1012968      ++count;
Note: See TracChangeset for help on using the changeset viewer.