Show
Ignore:
Timestamp:
16.05.2013 18:37:30 (6 years ago)
Author:
ak19
Message:

If you add in the line 'format AllowUserComments? true' into a collection's collect.cfg, you can now control whether the User Comments section appears on a document page or not. The runtime-src/src/recpt/documentaction.cpp defines an internal macro for the document package called allowusercomments and this is then checked for in macros/document.dm.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/documentaction.cpp

    r22984 r27363  
    728728  // must have a valid collection server to continue 
    729729 
    730    text_t &collection = args["c"]; 
     730  // _allowusercomments_      Whether the User Comments area is to be shown for this doc or not 
     731 
     732  text_t &collection = args["c"]; 
    731733  if (collection.empty()) return; 
    732734  recptproto *collectproto = protos->getrecptproto (collection, logout); 
     
    783785    //do not display relation metadata 
    784786    disp.setmacro ("relateddoc", "document", "");   
    785         
     787 
     788    // Whether the UserComments section is supposed to be displayed when a document is loaded or not 
     789    if (collectproto != NULL) { 
     790      ColInfoResponse_t *cinfo = NULL; 
     791 
     792      cinfo = recpt->get_collectinfo_ptr (collectproto, collection, logout); 
     793       
     794      text_tmap::const_iterator user_comments_it = cinfo->format.find ("AllowUserComments"); 
     795      if ((user_comments_it != cinfo->format.end()) && ((*user_comments_it).second == "true")) { 
     796    disp.setmacro ("allowusercomments", "document", "1"); // document package 
     797    //disp.setmacro ("allowusercomments", displayclass::defaultpackage, "1"); // Global 
     798      } 
     799    } 
     800    
    786801    //if preferences indicate relevant docs should be collected 
    787802    //and there is no particular format specified then display