return path;
}
+function tree_selection_and_check(id) {
+ var tree = document.getElementById(id);
+ var name = tree.columns.getPrimaryColumn();
+ var check = tree.columns.getFirstColumn();
+ var i = tree.currentIndex;
+ var checked = tree.view.getCellValue(i, check);
+ var path = new Array();
+ while (i >= 0) {
+ path.splice(0, 0, tree.view.getCellText(i, name));
+ i = tree.view.getParentIndex(i);
+ }
+ return [path, checked];
+}
+
/* Functions driving the CherryPy backend */
function new_tag(path) {
}
function add_tag(path, tag) {
- alert('Add tag '+path.toString()+' to '+tag);
+ alert('Add tag '+tag+' to '+path.toString());
}
function remove_tag(path, tag) {
- alert('Remove tag '+path.toString()+' from '+tag);
+ alert('Remove tag '+tag+' from '+path.toString());
}
/* The bindings themselves */
function set_selected_element(path) {
element = document.getElementById('element');
element.file_path = path;
- alert(path.toString());
+ alert('Set selected element: '+path.toString());
}
function raw_tree_select() {
function tag_check(event) {
var path = document.getElementById('element').file_path;
- if (event.target.checked) {
- add_tag(path, event.target.id);
+ var a = tree_selection_and_check('checkbox-tree');
+ id = a[0];
+ checked = a[1];
+ alert('path: '+path.toString());
+ alert('id: '+id);
+ alert('check: '+checked);
+ if (checked) {
+ add_tag(path, id);
} else {
- remove_tag(path, event.target.id);
+ remove_tag(path, id);
}
}