var base_treeNG_url = 'https://almaview.unibo.it//kform/avng/utils/treeNG'; function unset_max_height(el) { //Pop tree class which sets overflow and maxHeight var tree_ul = el.firstChild; var old_class = tree_ul.getAttribute("class"); var i = old_class.indexOf("tree"); var new_class = old_class.substr(0, i) + old_class.substr(i+4); tree_ul.setAttribute("class", new_class); } function expand_tree(treename, id, url, query_string, sync) { //sync di default e' 0, per l'inizializzazione e' 1 el = GetElementById(treename+id) if (sync == 0) SetInnerHTMLbyUrl(el, url, query_string, "POST", unset_max_height) else { SetSyncInnerHTMLbyUrl(el, url, query_string); unset_max_height(el) } GetElementById('exp'+id).style.display = 'none'; GetElementById('red'+id).style.display = 'inline'; } function reduce_tree(treename, id) { el = GetElementById(treename+id) DelInnerHTML(el) GetElementById('exp'+id).style.display = 'inline' GetElementById('red'+id).style.display = 'none' } function expand_org_tree(parent, gid, choice, treeid, choice_name, unique_prefix) { //base for new tree id, ancient, url, query_string, sync var query = 'parent='+parent+'&gid='+gid+'&choice='+choice+'&treeid='+treeid if ((choice_name)&&(choice_name != 'tree_gid')) { query += '&choice_name='+choice_name } if (unique_prefix) { query += '&unique_prefix='+unique_prefix } else unique_prefix = '' return expand_tree('orgsubtree', unique_prefix+treeid, base_treeNG_url+'/get_html_gid_subtree', query, 0) } function expand_net_tree(parent, nid, choice, treeid, choice_name, unique_prefix) { //base for new tree id, ancient, url, query_string, sync var query = 'parent='+parent+'&nid='+nid+'&choice='+choice+'&treeid='+treeid; if ((choice_name)&&(choice_name != 'tree_nid')) { query += '&choice_name='+choice_name } if (unique_prefix) { query += '&unique_prefix='+unique_prefix } else unique_prefix = '' return expand_tree('netsubtree', unique_prefix+treeid, base_treeNG_url+'/get_html_nid_subtree', query, 0) } function expand_colour_tree(parent, tcid, choice, treeid, choice_name) { //base for new tree id, ancient, url, query_string, sync var query = 'parent='+parent+'&tcid='+tcid+'&choice='+choice+'&treeid='+treeid if ((choice_name)&&(choice_name != 'tree_tcid')) { query += '&choice_name='+choice_name } return expand_tree('coloursubtree', treeid, base_treeNG_url+'/get_html_tcid_subtree', query, 0) } function reduce_org_tree(treeid, unique_prefix) { if (!unique_prefix) unique_prefix=''; return reduce_tree('orgsubtree', unique_prefix+treeid) } function reduce_net_tree(treeid, unique_prefix) { if (!unique_prefix) unique_prefix=''; return reduce_tree('netsubtree', unique_prefix+treeid) } function reduce_colour_tree(treeid) { return reduce_tree('coloursubtree', treeid) } function set_subtree(treename, parent_id, html_subtree) { el = GetElementById(treename+parent_id) SetInnerHTML(el, html_subtree) GetElementById('exp'+parent_id).style.display = 'none' GetElementById('red'+parent_id).style.display = 'inline' unset_max_height(el) } function set_org_subtree(parent_id, html_subtree) { return set_subtree('orgsubtree', parent_id, html_subtree) } function set_net_subtree(parent_id, html_subtree) { return set_subtree('netsubtree', parent_id, html_subtree) } function set_colour_subtree(parent_id, html_subtree) { return set_subtree('coloursubtree', parent_id, html_subtree) }