Ignore:
Timestamp:
2008-02-22T11:25:40+13:00 (15 years ago)
Author:
davidb
Message:

Collections can now be put in to "groups" i.e. can be located inside another collection, which is marked as "collectgroup" true. The top-level collection appears on the home page, and when clicked upon display a new "home page" with only the collections appearing within its folder displayed. To implement this, the main change is in collectset.cpp, which now runs "add_all_collection_groups" after it has added all the top-level collections. comtypes.h has been updated to include the new field, "isCollectGroup". Finally, pageaction.cpp has been updated so these changes are reflected in the home page generated.

File:
1 edited

Legend:

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

    r13982 r15002  
    180180    bool first = true;
    181181    while (collist_here != collist_end) {
     182
    182183      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
    183184     
     
    253254    int count = 0;
    254255    while (collist_here != collist_end) {
     256
    255257      ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr ((*rprotolist_here).p, *collist_here, logout);
     258
     259      text_t arg_g = args["g"];
     260      text_t colname_dir = *collist_here;
    256261     
     262      if (arg_g.empty()) {
     263        // normal top-level home page
     264        text_t::const_iterator begin = colname_dir.begin();
     265        text_t::const_iterator end = colname_dir.end();
     266
     267        if (findchar(begin,end,'/')!=end) {
     268          // no g argument, so generating top level home page
     269          // => if colname_dir has "/" in collection name, filter it out
     270
     271          ++collist_here;
     272          continue;
     273        }
     274      }
     275      else {
     276        // show only collections in the named group
     277
     278       
     279        if (colname_dir == arg_g) {
     280          // display about this collect text
     281
     282          text_t collectionextra = cinfo->get_collectionmeta("collectionextra", args["l"]);
     283          if (!collectionextra.empty()) {
     284        // prepend text on at start
     285        homeextra = "<p>" + collectionextra + "</p>" + homeextra;
     286          }
     287
     288          ++collist_here;
     289          continue;
     290        }
     291
     292
     293        // => filter out anything that does not start with the group prefix
     294       
     295        if (!starts_with(colname_dir,arg_g + "/")) {
     296          ++collist_here;
     297          continue;
     298        }
     299      }
     300
     301
    257302      if (cinfo != NULL) {
    258         if (cinfo->isPublic && (cinfo->buildDate > 0)) {
     303        if (cinfo->isPublic && ((cinfo->buildDate > 0)) || (cinfo->isCollectGroup)) {
    259304
    260305          found_valid_col = true;
     
    264309        alt = collectionname;
    265310          }
     311
     312
     313          comerror_t err;
     314          text_t optsite = g_EmptyText;
     315          text_t site_name = (*rprotolist_here).p->get_site_name (err);
     316          if (!site_name.empty()) { optsite = "site="+site_name+"&amp;"; }
     317
     318          text_t link;
     319
     320          if (cinfo->isCollectGroup) {
     321        link = "<a class=\"collectiontitle\" href=\"_gwcgi_?"+optsite+"a=p&amp;p=home&amp;g=" + *collist_here;
     322        link += "&amp;l=" + args["l"] + "&amp;w=" + args["w"] + "\">";
     323          }
     324          else {
     325        link = "<a class=\"collectiontitle\"href=\"_gwcgi_?"+optsite+"a=p&amp;p=about&amp;c=" + *collist_here;
     326        link += "&amp;l=" + args["l"] + "&amp;w=" + args["w"] + "\">";
     327          }
     328         
     329          if (!cinfo->receptionist.empty())
     330        link = "<a class=\"collectiontitle\"href=\"" + cinfo->receptionist + "\">";
     331         
    266332         
    267333          // url to image: try iconcollectionsmall, then iconcollection
     
    291357       
    292358        collectionname
    293           = "<img width=\"150\" src=\"" + iconurl + "\" alt=\"" + alt + "\">";
    294           } else {
    295         collectionname = alt;
     359          = link + "<img width=\"150\" src=\"" + iconurl + "\" alt=\"" + alt + "\">" + "</a>";
     360          } else {     
     361
     362        collectionname = "<div class=\"collecttitle\" style=\"width: 150px; border: 1px solid; \"><p class=\"collectiontitle\" style=\"font-size: 18px; width: 150px; white-space:normal; \">";
     363        collectionname += alt + "</p></div>";
     364
     365        collectionname = link + collectionname + "</a>";
     366
    296367          }
    297368         
    298369          if (count%configinfo.HomePageCols == 0)
    299         homeextra += "<tr valign=\"top\">\n";
    300          
    301           comerror_t err;
    302           text_t optsite = g_EmptyText;
    303           text_t site_name = (*rprotolist_here).p->get_site_name (err);
    304           if (!site_name.empty()) { optsite = "site="+site_name+"&amp;"; }
    305 
    306           text_t link = "<a href=\"_gwcgi_?"+optsite+"a=p&amp;p=about&amp;c=" + *collist_here;
    307           link += "&amp;l=" + args["l"] + "&amp;w=" + args["w"] + "\">";
    308          
    309           if (!cinfo->receptionist.empty())
    310         link = "<a href=\"" + cinfo->receptionist + "\">";
    311          
    312           homeextra += "<td>" + link + collectionname + "</a></td>\n";
     370        homeextra += "<tr valign=\"top\">\n";         
     371
     372          homeextra += "<td align=\"center\">" + collectionname + "</td>\n";
    313373         
    314374          ++count;
Note: See TracChangeset for help on using the changeset viewer.