| 183 | | selected_grouping_node_OID = output_grouping_nodes (classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); |
|---|
| | 183 | selected_grouping_node_OID = output_hlist_classifier_nodes ("", "", classifier_options["-group_using"], classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); |
|---|
| | 184 | |
|---|
| 194 | | selected_hlist_node_OID = output_hlist_classifier_nodes (parent_classifier_node_OID, classifier_node_metadata_value, metadata_value_filter, classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); |
|---|
| | 195 | selected_hlist_node_OID = output_hlist_classifier_nodes (parent_classifier_node_OID, metadata_value_filter, "", classifier_options, args, collectproto, browsers, disp, outconvert, textout, logout); |
|---|
| 293 | | text_t dynamicclassifieraction::output_grouping_nodes (text_tmap classifier_options, cgiargsclass &args, |
|---|
| 294 | | recptproto *collectproto, browsermapclass *browsers, |
|---|
| 295 | | displayclass &disp, outconvertclass &outconvert, |
|---|
| 296 | | ostream &textout, ostream &logout) |
|---|
| 297 | | { |
|---|
| 298 | | // Get all the metadata values for the specified element, and group them according to the "-group_using" value |
|---|
| 299 | | text_t metadata_element_name = classifier_options["metadata_element_name"]; |
|---|
| 300 | | text_t metadata_value_grouping_expression = classifier_options["-group_using"]; |
|---|
| 301 | | FilterResponse_t grouping_nodes_response; |
|---|
| 302 | | bool request_success = get_metadata_values (metadata_element_name, "", metadata_value_grouping_expression, args["c"], collectproto, grouping_nodes_response, logout); |
|---|
| 303 | | |
|---|
| 304 | | // If the request failed then it's probably because the collection isn't using an SQL infodbtype |
|---|
| 305 | | if (request_success == false) |
|---|
| 306 | | { |
|---|
| 307 | | 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"; |
|---|
| 308 | | return ""; |
|---|
| 309 | | } |
|---|
| 310 | | |
|---|
| 311 | | // Check some grouping nodes were returned |
|---|
| 312 | | if (grouping_nodes_response.docInfo.empty()) |
|---|
| 313 | | { |
|---|
| 314 | | return ""; |
|---|
| 315 | | } |
|---|
| 316 | | |
|---|
| 317 | | // If no classifier node has been specified automatically go to the first grouping node |
|---|
| 318 | | if (args["dcn"] == "") |
|---|
| 319 | | { |
|---|
| 320 | | args["dcn"] = grouping_nodes_response.docInfo.front().OID; |
|---|
| 321 | | } |
|---|
| 322 | | |
|---|
| 323 | | // Add the necessary metadata to the grouping nodes |
|---|
| 324 | | text_t selected_grouping_node_OID = ""; |
|---|
| 325 | | ResultDocInfo_tarray::iterator grouping_node_iterator = grouping_nodes_response.docInfo.begin(); |
|---|
| 326 | | while (grouping_node_iterator != grouping_nodes_response.docInfo.end()) |
|---|
| 327 | | { |
|---|
| 328 | | // Is this the grouping node that is currently selected? |
|---|
| 329 | | if (starts_with (args["dcn"], (*grouping_node_iterator).OID)) |
|---|
| 330 | | { |
|---|
| 331 | | selected_grouping_node_OID = (*grouping_node_iterator).OID; |
|---|
| 332 | | } |
|---|
| 333 | | |
|---|
| 334 | | // Add the necessary metadata required to display the grouping nodes correctly |
|---|
| 335 | | (*grouping_node_iterator).metadata["doctype"].values.push_back ("classify"); |
|---|
| 336 | | (*grouping_node_iterator).metadata["haschildren"].values.push_back ("1"); |
|---|
| 337 | | (*grouping_node_iterator).metadata["numleafdocs"].values.push_back ("?"); // We can't determine this without more database requests |
|---|
| 338 | | (*grouping_node_iterator).metadata["Title"].values.push_back ((*grouping_node_iterator).OID); |
|---|
| 339 | | grouping_node_iterator++; |
|---|
| 340 | | } |
|---|
| 341 | | |
|---|
| 342 | | // Display the grouping nodes |
|---|
| 343 | | display_classifier_nodes (grouping_nodes_response, "HList", 0, args, collectproto, browsers, disp, outconvert, textout, logout); |
|---|
| 344 | | |
|---|
| 345 | | return selected_grouping_node_OID; |
|---|
| 346 | | } |
|---|
| 347 | | |
|---|
| 348 | | |
|---|