Changeset 15795


Ignore:
Timestamp:
05/29/08 14:59:42 (13 years ago)
Author:
mdewsnip
Message:

(Adding dynamic classifiers) Changing "dcn" argument to "dcl", and added support for specifying format statements in the collect.cfg file for dynamic classifiers.

File:
1 edited

Legend:

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

    r15772 r15795  
    3333
    3434  cgiarginfo arg_ainfo;
    35   arg_ainfo.shortname = "dcn";
    36   arg_ainfo.longname = "dynamic classifier node";
     35  arg_ainfo.shortname = "dcl";
     36  arg_ainfo.longname = "dynamic classifier ID";
    3737  arg_ainfo.multiplechar = true;
    3838  arg_ainfo.defaultstatus = cgiarginfo::weak;
     
    8888                    ostream &logout)
    8989{
    90   // must have a valid collection server
     90  // A valid collection server is vital
    9191  recptproto *collectproto = protos->getrecptproto (args["c"], logout);
    9292  if (collectproto == NULL)
     
    9999  textout << outconvert << disp << "_document:content_\n";
    100100
    101   text_t arg_dcn = args["dcn"];
    102   if (arg_dcn.empty())
     101  // Check a dynamic classifier ID has been specified
     102  text_t arg_dcl = args["dcl"];
     103  if (arg_dcl.empty())
    103104  {
    104     textout << outconvert << disp << "Error: Missing \"dcn\" value.\n";
     105    textout << outconvert << disp << "Error: Missing \"dcl\" value.\n";
    105106    textout << outconvert << disp << "_document:footer_\n";
    106     return false;
     107    return true;
    107108  }
    108109
     110  // Check the dynamic classifier ID is valid (ie. there is an entry in the collect.cfg file for it)
    109111  ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, args["c"], logout);
    110   if (cinfo->dynamic_classifiers.find(arg_dcn) == cinfo->dynamic_classifiers.end())
     112  if (cinfo->dynamic_classifiers.find(arg_dcl) == cinfo->dynamic_classifiers.end())
    111113  {
    112     textout << outconvert << disp << "Error: Invalid \"dcn\" value " << arg_dcn << ".\n";
     114    textout << outconvert << disp << "Error: Invalid \"dcl\" value " << arg_dcl << ".\n";
    113115    textout << outconvert << disp << "_document:footer_\n";
    114     return false;
     116    return true;
    115117  }
    116118
    117   text_t metadata_element_name = cinfo->dynamic_classifiers[arg_dcn];
     119  text_t classifier_type = "VList";
     120  browserclass *bptr = browsers->getbrowser (classifier_type);
     121
     122  // Get the formatstring if there is one, or use the browser's default otherwise
     123  text_t formatstring;
     124  if (!get_formatstring (arg_dcl, classifier_type, cinfo->format, formatstring))
     125  {
     126    formatstring = bptr->get_default_formatstring();
     127  }
     128  format_t *formatlistptr = new format_t();
     129  text_tset metadata;
     130  bool getParents = false;
     131  parse_formatstring (formatstring, formatlistptr, metadata, getParents);
     132
     133  text_t metadata_element_name = cinfo->dynamic_classifiers[arg_dcl];
    118134  FilterResponse_t metadata_values_response;
    119135  get_metadata_values (metadata_element_name, args["c"], collectproto, metadata_values_response, logout);
     
    129145  }
    130146
    131   browserclass *bptr = browsers->getbrowser ("VList");
    132   text_t formatstring = bptr->get_default_formatstring();
    133   format_t *formatlistptr = new format_t();
    134   text_tset metadata;
    135   bool getParents = false;
    136   parse_formatstring (formatstring, formatlistptr, metadata, getParents);
     147  // Display the nodes
    137148  bool use_table = is_table_content (formatlistptr);
    138149  bptr->output_section_group (metadata_values_response, args, args["c"], 0, formatlistptr, use_table,
Note: See TracChangeset for help on using the changeset viewer.