source: gsdl/trunk/src/recpt/dynamicclassifieraction.cpp@ 16118

Last change on this file since 16118 was 16118, checked in by mdewsnip, 16 years ago

Minor improvements to code.

  • Property svn:executable set to *
File size: 24.7 KB
Line 
1/**********************************************************************
2 *
3 * dynamicclassifieraction.cpp --
4 * Copyright (C) 2008 DL Consulting Ltd
5 *
6 * A component of the Greenstone digital library software
7 * from the New Zealand Digital Library Project at the
8 * University of Waikato, New Zealand.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *
24 *********************************************************************/
25
26#include "dynamicclassifieraction.h"
27#include "recptprototools.h"
28
29
30dynamicclassifieraction::dynamicclassifieraction ()
31{
32 recpt = NULL;
33
34 cgiarginfo arg_ainfo;
35 arg_ainfo.shortname = "dcl";
36 arg_ainfo.longname = "dynamic classifier ID";
37 arg_ainfo.multiplechar = true;
38 arg_ainfo.defaultstatus = cgiarginfo::weak;
39 arg_ainfo.argdefault = "";
40 arg_ainfo.savedarginfo = cgiarginfo::must;
41 argsinfo.addarginfo (NULL, arg_ainfo);
42
43 arg_ainfo.shortname = "dcn";
44 arg_ainfo.longname = "dynamic classifier node";
45 arg_ainfo.multiplechar = true;
46 arg_ainfo.defaultstatus = cgiarginfo::weak;
47 arg_ainfo.argdefault = "";
48 arg_ainfo.savedarginfo = cgiarginfo::must;
49 argsinfo.addarginfo (NULL, arg_ainfo);
50}
51
52
53dynamicclassifieraction::~dynamicclassifieraction()
54{
55}
56
57
58bool dynamicclassifieraction::check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
59 recptprotolistclass *protos, ostream &logout)
60{
61 return true;
62}
63
64
65void dynamicclassifieraction::get_cgihead_info (cgiargsclass &args, recptprotolistclass *protos,
66 response_t &response,text_t &response_data,
67 ostream &logout)
68{
69 response = content;
70 response_data = "text/html";
71}
72
73
74// define all the macros which might be used by other actions to produce pages.
75void dynamicclassifieraction::define_external_macros (displayclass &disp, cgiargsclass &args,
76 recptprotolistclass *protos, ostream &logout)
77{
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);
104}
105
106
107// define all the macros which are related to pages generated
108// by this action. we also load up the formatinfo structure
109// here (it's used in do_action as well as here)
110void dynamicclassifieraction::define_internal_macros (displayclass &disp, cgiargsclass &args,
111 recptprotolistclass *protos, ostream &logout)
112{
113 // define_internal_macros sets the following macros:
114}
115
116
117bool dynamicclassifieraction::do_action(cgiargsclass &args, recptprotolistclass *protos,
118 browsermapclass *browsers, displayclass &disp,
119 outconvertclass &outconvert, ostream &textout,
120 ostream &logout)
121{
122 // A valid collection server is vital
123 recptproto *collectproto = protos->getrecptproto (args["c"], logout);
124 if (collectproto == NULL)
125 {
126 logout << "dynamicclassifieraction::do_action called with NULL collectproto\n";
127 return false;
128 }
129
130 textout << outconvert << disp << "_dynamicclassifier:header_\n";
131 textout << outconvert << disp << "_dynamicclassifier:content_\n";
132
133 // Check a dynamic classifier ID has been specified
134 text_t arg_dcl = args["dcl"];
135 if (arg_dcl.empty())
136 {
137 textout << outconvert << disp << "Error: Missing dcl argument.\n";
138 textout << outconvert << disp << "_dynamicclassifier:footer_\n";
139 return true;
140 }
141
142 // Check the dynamic classifier ID is valid (ie. there is an entry in the collect.cfg file for it)
143 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, args["c"], logout);
144 if (cinfo->dynamic_classifiers.find(arg_dcl) == cinfo->dynamic_classifiers.end())
145 {
146 textout << outconvert << disp << "Error: Invalid dcl value \"" << arg_dcl << "\".\n";
147 textout << outconvert << disp << "_dynamicclassifier:footer_\n";
148 return true;
149 }
150
151 // Parse the classifier options from the specification
152 text_t classifier_specification = cinfo->dynamic_classifiers[arg_dcl];
153 text_tmap classifier_options = parse_classifier_options (classifier_specification, args);
154
155 // Output the "<ID>Header" format statement if there is one
156 text_t classifier_header_format_statement = "";
157 get_formatstring (arg_dcl + "Header", cinfo->format, classifier_header_format_statement);
158 textout << outconvert << disp << classifier_header_format_statement << "\n";
159
160 // Resolve any ".pr" bits at the end of the "dcn" argument
161 if (ends_with (args["dcn"], ".pr"))
162 {
163 // Change the "dcn" argument to be the OID of the parent of the specified classifier node
164 text_t::iterator parent_classifier_node_OID_end = findlastchar (args["dcn"].begin(), args["dcn"].end(), '|');
165 if (parent_classifier_node_OID_end != args["dcn"].end())
166 {
167 args["dcn"] = substr (args["dcn"].begin(), parent_classifier_node_OID_end);
168 }
169 else
170 {
171 args["dcn"] = "";
172 }
173 }
174
175 // Prepare to output the dynamic classifier
176 text_t current_classifier_node_OID = "";
177 text_t current_metadata_value_filter = "";
178 int classifier_node_indent = 0;
179
180 // Begin with the (optional) grouping nodes
181 text_t selected_grouping_node_OID = "";
182 if (!classifier_options["-group_using"].empty())
183 {
184 selected_grouping_node_OID = output_hlist_classifier_nodes (current_classifier_node_OID, current_metadata_value_filter, classifier_options["-group_using"], classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
185
186 current_classifier_node_OID = selected_grouping_node_OID;
187 current_metadata_value_filter = selected_grouping_node_OID + "*";
188 }
189
190 // Next, optionally display an hlist level
191 text_t selected_hlist_node_OID = "";
192 if (classifier_options["-use_hlist_at_top"] == "1")
193 {
194 selected_hlist_node_OID = output_hlist_classifier_nodes (current_classifier_node_OID, current_metadata_value_filter, "", classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
195
196 current_classifier_node_OID = selected_hlist_node_OID;
197 current_metadata_value_filter = selected_hlist_node_OID + "*"; // !! WRONG
198 }
199
200 // args["dcn"] may have been modified by output_hlist_classifier_nodes() above
201 text_t classifier_node_OID = args["dcn"];
202
203 // Simple case at the top level: just output the child classifier nodes
204 if (classifier_node_OID == selected_grouping_node_OID)
205 {
206 text_t metadata_value_filter = selected_grouping_node_OID + "*";
207 output_child_classifier_nodes (classifier_node_OID, "", metadata_value_filter, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
208 }
209
210 // More complex case below the top level
211 else
212 {
213 // This is the classifier node OID without any grouping information
214 text_t classifier_node_OID_sans_grouping = classifier_node_OID;
215 if (starts_with (classifier_node_OID, selected_grouping_node_OID + "|"))
216 {
217 classifier_node_OID_sans_grouping = substr (classifier_node_OID.begin() + (selected_grouping_node_OID + "|").size(), classifier_node_OID.end());
218 }
219
220 // This is the classifier node OID without any hlist nodes
221 text_t classifier_node_OID_sans_hlists = classifier_node_OID;
222 if (classifier_node_OID == selected_hlist_node_OID)
223 {
224 classifier_node_OID_sans_hlists = "";
225 }
226 else if (starts_with (classifier_node_OID, selected_hlist_node_OID + "|"))
227 {
228 classifier_node_OID_sans_hlists = substr (classifier_node_OID.begin() + (selected_hlist_node_OID + "|").size(), classifier_node_OID.end());
229 }
230
231 // Determine the parent classifier node labels
232 text_tlist parent_classifier_node_labels;
233 splitchar(classifier_node_OID_sans_hlists.begin(), classifier_node_OID_sans_hlists.end(), '|', parent_classifier_node_labels);
234
235 // Output the parent classifier nodes and the current classifier node
236 output_upper_classifier_nodes (selected_hlist_node_OID, parent_classifier_node_labels, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
237
238 // Output the child classifier nodes
239 text_t classifier_node_metadata_value = classifier_node_OID_sans_grouping;
240 text_t metadata_value_filter = classifier_node_OID_sans_grouping + "|*";
241 output_child_classifier_nodes (classifier_node_OID, classifier_node_metadata_value, metadata_value_filter, classifier_node_indent, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout);
242
243 // Get the document nodes at this level
244 text_t metadata_element_name = classifier_options["metadata_element_name"];
245 text_t sort_documents_by = classifier_options["-sort_documents_by"];
246 FilterResponse_t documents_response;
247 get_documents_with_metadata_value (metadata_element_name, classifier_node_metadata_value, sort_documents_by, args["c"], collectproto, documents_response, logout);
248
249 // Display the document nodes
250 display_document_nodes (documents_response, classifier_node_indent, args, collectproto, browsers, disp, outconvert, textout, logout);
251 }
252
253 // Output the "<ID>Footer" format statement if there is one
254 text_t classifier_footer_format_statement = "";
255 get_formatstring (arg_dcl + "Footer", cinfo->format, classifier_footer_format_statement);
256 textout << outconvert << disp << classifier_footer_format_statement << "\n";
257
258 textout << outconvert << disp << "_dynamicclassifier:footer_\n";
259 return true;
260}
261
262
263text_tmap dynamicclassifieraction::parse_classifier_options (text_t classifier_specification, cgiargsclass &args)
264{
265 text_tmap classifier_options;
266
267 // Split the classifier specification string by spaces
268 text_tlist classifier_specification_parts;
269 splitchar (classifier_specification.begin(), classifier_specification.end(), ' ', classifier_specification_parts);
270
271 // The metadata element to classify by should be the first value
272 classifier_options["metadata_element_name"] = classifier_specification_parts.front();
273 classifier_specification_parts.pop_front();
274
275 // Parse options from the remainder of the classifier specification
276 while (!classifier_specification_parts.empty())
277 {
278 // Parse the option name
279 text_t classifier_option_name = classifier_specification_parts.front();
280 classifier_specification_parts.pop_front();
281
282 // Check if the option has a value (it may just be a flag, in which case we use "1" as the value)
283 text_t classifier_option_value = "1";
284 if (!classifier_specification_parts.empty() && !starts_with(classifier_specification_parts.front(), "-"))
285 {
286 classifier_option_value = classifier_specification_parts.front();
287 classifier_specification_parts.pop_front();
288 }
289
290 // Record the option
291 classifier_options[classifier_option_name] = classifier_option_value;
292 }
293
294 return classifier_options;
295}
296
297
298text_t dynamicclassifieraction::output_hlist_classifier_nodes (text_t parent_classifier_node_OID,
299 text_t metadata_value_filter,
300 text_t metadata_value_grouping_expression,
301 text_tmap classifier_options, cgiargsclass &args,
302 recptproto *collectproto, browsermapclass *browsers,
303 displayclass &disp, outconvertclass &outconvert,
304 ostream &textout, ostream &logout)
305{
306 // Get all the metadata values for the specified element that match the filter
307 text_t metadata_element_name = classifier_options["metadata_element_name"];
308 FilterResponse_t metadata_values_response;
309 bool request_success = get_metadata_values (metadata_element_name, metadata_value_filter, metadata_value_grouping_expression, args["c"], collectproto, metadata_values_response, logout);
310
311 // If the request failed then it's probably because the collection isn't using an SQL infodbtype
312 if (request_success == false)
313 {
314 textout << outconvert << disp << "Error: Dynamic classifier functionality is not available. Please check you are using an SQL infodbtype and the collection has been rebuilt.\n";
315 return "";
316 }
317
318 // Check some metadata values were returned
319 if (metadata_values_response.docInfo.empty())
320 {
321 return "";
322 }
323
324 // After processing any hierarchical metadata values we're left with the hlist classifer nodes
325 map<text_t, int, lttext_t> hlist_classifier_nodes;
326 ResultDocInfo_tarray::iterator metadata_value_iterator = metadata_values_response.docInfo.begin();
327 while (metadata_value_iterator != metadata_values_response.docInfo.end())
328 {
329 text_t metadata_value = (*metadata_value_iterator).OID;
330
331 // Is this metadata value hierarchical?
332 text_t::iterator hierarchy_split_position = findchar(metadata_value.begin(), metadata_value.end(), '|');
333 if (hierarchy_split_position != metadata_value.end())
334 {
335 // Yes, so use the first part of the hierarchy only
336 metadata_value = substr(metadata_value.begin(), hierarchy_split_position);
337 }
338
339 // Create a node for this metadata value if we haven't seen it before
340 if (hlist_classifier_nodes.find(metadata_value) == hlist_classifier_nodes.end())
341 {
342 hlist_classifier_nodes[metadata_value] = 0;
343 }
344
345 // Increment the occurrence count
346 hlist_classifier_nodes[metadata_value] += (*metadata_value_iterator).result_num;
347
348 metadata_value_iterator++;
349 }
350
351 // If no classifier node has been specified automatically go to the first hlist node
352 if (args["dcn"] == parent_classifier_node_OID)
353 {
354 args["dcn"] = (*hlist_classifier_nodes.begin()).first;
355 }
356
357 // Add the necessary metadata to the hlist classifier nodes
358 text_t selected_hlist_node_OID = "";
359 FilterResponse_t hlist_classifier_nodes_response;
360 map<text_t, int, lttext_t>::iterator hlist_classifier_nodes_iterator = hlist_classifier_nodes.begin();
361 while (hlist_classifier_nodes_iterator != hlist_classifier_nodes.end())
362 {
363 text_t hlist_classifier_node_OID = (*hlist_classifier_nodes_iterator).first;
364
365 // Is this the hlist node that is currently selected?
366 if (starts_with (args["dcn"], hlist_classifier_node_OID))
367 {
368 selected_hlist_node_OID = hlist_classifier_node_OID;
369 }
370
371 // Add the necessary metadata required to display the hlist nodes correctly
372 ResultDocInfo_t hlist_classifier_node;
373 hlist_classifier_node.OID = hlist_classifier_node_OID;
374 hlist_classifier_node.metadata["doctype"].values.push_back ("classify");
375 hlist_classifier_node.metadata["haschildren"].values.push_back ("1");
376 hlist_classifier_node.metadata["numleafdocs"].values.push_back ("?"); // We can't determine this without more database requests
377 hlist_classifier_node.metadata["Title"].values.push_back (hlist_classifier_node_OID);
378 hlist_classifier_nodes_response.docInfo.push_back (hlist_classifier_node);
379
380 hlist_classifier_nodes_iterator++;
381 }
382
383 // Display the hlist nodes
384 display_classifier_nodes (hlist_classifier_nodes_response, "HList", 0, args, collectproto, browsers, disp, outconvert, textout, logout);
385
386 return selected_hlist_node_OID;
387}
388
389
390void dynamicclassifieraction::output_upper_classifier_nodes (text_t root_classifier_node_OID,
391 text_tlist upper_classifier_node_labels,
392 int& classifier_node_indent,
393 text_tmap classifier_options, cgiargsclass &args,
394 recptproto *collectproto, browsermapclass *browsers,
395 displayclass &disp, outconvertclass &outconvert,
396 ostream &textout, ostream &logout)
397{
398 // Display the upper classifier nodes
399 text_t upper_classifier_node_OID = root_classifier_node_OID;
400 text_tlist::iterator upper_classifier_node_labels_iterator = upper_classifier_node_labels.begin();
401 while (upper_classifier_node_labels_iterator != upper_classifier_node_labels.end())
402 {
403 upper_classifier_node_OID += (upper_classifier_node_OID != "" ? "|" : "");
404 upper_classifier_node_OID += *upper_classifier_node_labels_iterator;
405
406 ResultDocInfo_t upper_classifier_node;
407 upper_classifier_node.OID = upper_classifier_node_OID;
408 upper_classifier_node.metadata["doctype"].values.push_back ("classify");
409 upper_classifier_node.metadata["haschildren"].values.push_back ("1");
410 upper_classifier_node.metadata["numleafdocs"].values.push_back ("?"); // We can't determine this without more database requests
411 upper_classifier_node.metadata["Title"].values.push_back (*upper_classifier_node_labels_iterator);
412
413 FilterResponse_t upper_classifier_node_response;
414 upper_classifier_node_response.docInfo.push_back(upper_classifier_node);
415 display_classifier_nodes (upper_classifier_node_response, "VList", classifier_node_indent, args, collectproto, browsers, disp, outconvert, textout, logout);
416 classifier_node_indent++;
417
418 upper_classifier_node_labels_iterator++;
419 }
420}
421
422
423void dynamicclassifieraction::output_child_classifier_nodes (text_t classifier_node_OID,
424 text_t classifier_node_metadata_value,
425 text_t metadata_value_filter,
426 int& classifier_node_indent,
427 text_tmap classifier_options, cgiargsclass &args,
428 recptproto *collectproto, browsermapclass *browsers,
429 displayclass &disp, outconvertclass &outconvert,
430 ostream &textout, ostream &logout)
431{
432 // Get all the metadata values for the specified element that match the filter
433 text_t metadata_element_name = classifier_options["metadata_element_name"];
434 FilterResponse_t metadata_values_response;
435 bool request_success = get_metadata_values (metadata_element_name, metadata_value_filter, "", args["c"], collectproto, metadata_values_response, logout);
436
437 // If the request failed then it's probably because the collection isn't using an SQL infodbtype
438 if (request_success == false)
439 {
440 textout << outconvert << disp << "Error: Dynamic classifier functionality is not available. Please check you are using an SQL infodbtype and the collection has been rebuilt.\n";
441 return;
442 }
443
444 // After processing any hierarchical metadata values we're left with the child classifer nodes
445 map<text_t, int, lttext_t> child_classifier_nodes;
446 ResultDocInfo_tarray::iterator metadata_value_iterator = metadata_values_response.docInfo.begin();
447 while (metadata_value_iterator != metadata_values_response.docInfo.end())
448 {
449 text_t metadata_value = (*metadata_value_iterator).OID;
450
451 // If we're not at the top-level we need to remove the current position from the metadata values
452 if (starts_with(metadata_value, classifier_node_metadata_value + "|"))
453 {
454 metadata_value = substr(metadata_value.begin() + (classifier_node_metadata_value + "|").size(), metadata_value.end());
455 }
456
457 // Is this metadata value hierarchical?
458 text_t::iterator hierarchy_split_position = findchar(metadata_value.begin(), metadata_value.end(), '|');
459 if (hierarchy_split_position != metadata_value.end())
460 {
461 // Yes, so use the first part of the hierarchy only
462 metadata_value = substr(metadata_value.begin(), hierarchy_split_position);
463 }
464
465 // Create a node for this metadata value if we haven't seen it before
466 if (child_classifier_nodes.find(metadata_value) == child_classifier_nodes.end())
467 {
468 child_classifier_nodes[metadata_value] = 0;
469 }
470
471 // Increment the occurrence count
472 child_classifier_nodes[metadata_value] += (*metadata_value_iterator).result_num;
473
474 metadata_value_iterator++;
475 }
476
477 // Add the necessary metadata to the child classifier nodes
478 FilterResponse_t child_classifier_nodes_response;
479 map<text_t, int, lttext_t>::iterator child_classifier_nodes_iterator = child_classifier_nodes.begin();
480 while (child_classifier_nodes_iterator != child_classifier_nodes.end())
481 {
482 text_t child_classifier_node_OID = (*child_classifier_nodes_iterator).first;
483 if (classifier_node_OID != "")
484 {
485 child_classifier_node_OID = classifier_node_OID + "|" + child_classifier_node_OID;
486 }
487
488 ResultDocInfo_t child_classifier_node;
489 child_classifier_node.OID = child_classifier_node_OID;
490 child_classifier_node.metadata["doctype"].values.push_back ("classify");
491 child_classifier_node.metadata["haschildren"].values.push_back ("1");
492 child_classifier_node.metadata["numleafdocs"].values.push_back ((*child_classifier_nodes_iterator).second);
493 child_classifier_node.metadata["Title"].values.push_back ((*child_classifier_nodes_iterator).first);
494 child_classifier_nodes_response.docInfo.push_back (child_classifier_node);
495
496 child_classifier_nodes_iterator++;
497 }
498
499 // Display the child classifier nodes
500 display_classifier_nodes (child_classifier_nodes_response, "VList", classifier_node_indent, args, collectproto, browsers, disp, outconvert, textout, logout);
501}
502
503
504void dynamicclassifieraction::display_classifier_nodes (FilterResponse_t classifier_nodes_response,
505 text_t classifier_nodes_type,
506 int classifier_nodes_indent,
507 cgiargsclass &args, recptproto *collectproto,
508 browsermapclass *browsers, displayclass &disp,
509 outconvertclass &outconvert, ostream &textout,
510 ostream &logout)
511{
512 // Check there are some classifier nodes to display
513 if (classifier_nodes_response.docInfo.empty()) return;
514
515 // Get the format statement for this classifier if there is one, or use the browser's default otherwise
516 text_t formatstring;
517 browserclass *bptr = browsers->getbrowser (classifier_nodes_type);
518 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, args["c"], logout);
519 if (!get_formatstring (args["dcl"], classifier_nodes_type, cinfo->format, formatstring))
520 {
521 formatstring = bptr->get_default_formatstring();
522 }
523 format_t *formatlistptr = new format_t();
524 text_tset metadata;
525 bool getParents = false;
526 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
527 bool use_table = is_table_content (formatlistptr);
528
529 // Display the classifier nodes
530 bptr->output_section_group (classifier_nodes_response, args, args["c"], classifier_nodes_indent, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout);
531}
532
533
534void dynamicclassifieraction::display_document_nodes (FilterResponse_t documents_response,
535 int document_nodes_indent,
536 cgiargsclass &args, recptproto *collectproto,
537 browsermapclass *browsers, displayclass &disp,
538 outconvertclass &outconvert, ostream &textout,
539 ostream &logout)
540{
541 // Check there are some documents to display
542 if (documents_response.docInfo.empty()) return;
543
544 // Get the format statement for the document nodes if there is one, or use the browser's default otherwise
545 text_t formatstring;
546 browserclass *bptr = browsers->getbrowser ("VList");
547 ColInfoResponse_t *cinfo = recpt->get_collectinfo_ptr (collectproto, args["c"], logout);
548 if (!get_formatstring (args["dcl"], "DocumentNodes", cinfo->format, formatstring))
549 {
550 formatstring = bptr->get_default_formatstring();
551 }
552 format_t *formatlistptr = new format_t();
553 text_tset metadata;
554 bool getParents = false;
555 parse_formatstring (formatstring, formatlistptr, metadata, getParents);
556 bool use_table = is_table_content (formatlistptr);
557
558 // Request the necessary metadata for displaying the documents
559 text_tarray document_OIDs;
560 ResultDocInfo_tarray::iterator document_iterator = documents_response.docInfo.begin();
561 while (document_iterator != documents_response.docInfo.end())
562 {
563 document_OIDs.push_back ((*document_iterator).OID);
564 document_iterator++;
565 }
566 FilterResponse_t document_nodes_response;
567 get_info (document_OIDs, args["c"], args["l"], metadata, getParents, collectproto, document_nodes_response, logout);
568
569 // Display the document nodes
570 bptr->output_section_group (document_nodes_response, args, args["c"], document_nodes_indent, formatlistptr, use_table, metadata, getParents, collectproto, disp, outconvert, textout, logout);
571}
Note: See TracBrowser for help on using the repository browser.