Changeset 15847

Show
Ignore:
Timestamp:
04.06.2008 14:02:00 (11 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Now defines _dynamicclassifiernavbarentries_ to add buttons to the navigation bar for the dynamic classifiers.

Files:
1 modified

Legend:

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

    r15836 r15847  
    7272 
    7373 
    74 // define all the macros which might be used by other actions 
    75 // to produce pages.  
     74// define all the macros which might be used by other actions to produce pages.  
    7675void dynamicclassifieraction::define_external_macros (displayclass &disp, cgiargsclass &args,  
    7776                              recptprotolistclass *protos, ostream &logout) 
    7877{ 
    79   // define_external_macros sets the following macros: 
     78  // A valid collection server is vital 
     79  recptproto *collectproto = protos->getrecptproto (args["c"], logout); 
     80  if (collectproto == NULL) 
     81  { 
     82    logout << "dynamicclassifieraction::define_external_macros called with NULL collectproto\n"; 
     83    return; 
     84  } 
     85 
     86  // Define _dynamicclassifiernavbarentries_ to add buttons to the navigation bar for the dynamic classifiers 
     87  text_t navigation_bar_entries = ""; 
     88  ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, args["c"], logout); 
     89  text_tmap::iterator dynamic_classifier_iterator = cinfo->dynamic_classifiers.begin(); 
     90  while (dynamic_classifier_iterator != cinfo->dynamic_classifiers.end()) 
     91  { 
     92    text_t dynamic_classifier_id = (*dynamic_classifier_iterator).first; 
     93    navigation_bar_entries += "_navbarspacer_"; 
     94    navigation_bar_entries += "_navtab_(_gwcgi_?c=" + args["c"] + "&amp;a=dc&amp;dcl=" + dynamic_classifier_id + "," + dynamic_classifier_id; 
     95    if (args["a"] == "dc" && args["dcl"] == dynamic_classifier_id) 
     96    { 
     97      navigation_bar_entries += ",selected"; 
     98    } 
     99    navigation_bar_entries += ")"; 
     100    dynamic_classifier_iterator++; 
     101  } 
     102 
     103  disp.setmacro("dynamicclassifiernavbarentries", displayclass::defaultpackage, navigation_bar_entries); 
    80104} 
    81105