Changeset 26508 for main


Ignore:
Timestamp:
2012-11-23T00:40:57+13:00 (11 years ago)
Author:
davidb
Message:

The browse action now support 'descendants' as a CGI-argument, which if set to '1' will produce the whole hierarchy for a given classifier point. Useful in AJAX requests (such as producing a tag-cloud of an entire classifier).

One unknown undesirable side-effect of this at the moment is that once the value has been given, it is then remembered in the users jsession/cookie and consequently causes all subsequent requests to be fully expanded. The tag-cloud example -- as a work around for now -- makes a second call over AJAX with descendants=0 to effectively clear the value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/GS2BrowseAction.java

    r26177 r26508  
    2222    public static final String CLASSIFIER_ARG = "cl";
    2323
     24    public static final String DESCENDANTS_ARG = "descendants";
     25
    2426    static Logger logger = Logger.getLogger(org.greenstone.gsdl3.action.GS2BrowseAction.class.getName());
    2527
     
    5456            logger.error("classifierBrowse, need to specify a collection!");
    5557            return page_response;
     58        }
     59
     60        boolean get_descendants = false;
     61        String descendants_str = (String) params.get(DESCENDANTS_ARG);
     62        if (descendants_str != null && descendants_str.equals("1"))
     63        {
     64            get_descendants = true;
    5665        }
    5766
     
    172181        param.setAttribute(GSXML.VALUE_ATT, "children");
    173182
     183        if (get_descendants)
     184        {
     185            param = this.doc.createElement(GSXML.PARAM_ELEM);
     186            param_list.appendChild(param);
     187            param.setAttribute(GSXML.NAME_ATT, "structure");
     188            param.setAttribute(GSXML.VALUE_ATT, "descendants");
     189        }
     190
     191
    174192        // put the classifier node into a classifier node list
    175193        Element classifier_list = this.doc.createElement(GSXML.CLASS_NODE_ELEM + GSXML.LIST_MODIFIER);
Note: See TracChangeset for help on using the changeset viewer.