Browse files

Make tim happy

  • Loading branch information...
1 parent c81b09a commit 8db81072043b39cbee63e387f8647fcad7c4add1 @pudge pudge committed Sep 15, 2004
View
62 plugins/Admin/templates/topic_popup_js;admin;default
@@ -96,23 +96,69 @@ function hpts_release(evt) {
var [% name %]_selected_id = -1;
var [% name %]_selected_val;
var [% name %]_selected_elem;
+var [% name %]_max_id = [% loop.max %];
+
+/* collapse entire tree */
+function [% name %]_collapse_all() {
+ for (var i = 0; i <= [% name %]_max_id; i++) {
+ var obj = document.getElementById("[% name %]-desc-" + i);
+ if (obj) {
+ [% name %]_collapse(i);
+ }
+ }
+
+ var mybutton = document.[% form_field_form %].[% name %]_topic_toggle_all;
+ mybutton.value = "Expand All";
+ mybutton.onmouseup = [% name %]_expand_all;
+}
+
+/* expand entire tree */
+function st_expand_all() {
+ for (var i = 0; i <= [% name %]_max_id; i++) {
+ var obj = document.getElementById("[% name %]-desc-" + i);
+ if (obj) {
+ [% name %]_expand(i);
+ }
+ }
+
+ var mybutton = document.[% form_field_form %].[% name %]_topic_toggle_all;
+ mybutton.value = "Collapse All";
+ mybutton.onmouseup = [% name %]_collapse_all;
+}
/* expand or collapse a sub-tree */
function [% name %]_toggle_expand(id) {
var obj = document.getElementById("[% name %]-desc-" + id);
- var plus = document.getElementById("[% name %]-plus-" + id);
- var node = document.getElementById("[% name %]-node-" + id);
+
if (obj.style.display != 'block') {
- obj.style.display = 'block';
- plus.src = "[% image_path %]minus.png";
- node.src = "[% image_path %]open_node.png";
+ [% name %]_expand(id);
} else {
- obj.style.display = 'none';
- plus.src = "[% image_path %]plus.png";
- node.src = "[% image_path %]closed_node.png";
+ [% name %]_collapse(id);
}
}
+/* expand a sub-tree */
+function [% name %]_expand(id) {
+ var obj = document.getElementById("[% name %]-desc-" + id);
+ var plus = document.getElementById("[% name %]-plus-" + id);
+ var node = document.getElementById("[% name %]-node-" + id);
+
+ obj.style.display = 'block';
+ plus.src = "[% image_path %]minus.png";
+ node.src = "[% image_path %]open_node.png";
+}
+
+/* collapse a sub-tree */
+function [% name %]_collapse(id) {
+ var obj = document.getElementById("[% name %]-desc-" + id);
+ var plus = document.getElementById("[% name %]-plus-" + id);
+ var node = document.getElementById("[% name %]-node-" + id);
+
+ obj.style.display = 'none';
+ plus.src = "[% image_path %]plus.png";
+ node.src = "[% image_path %]closed_node.png";
+}
+
/* select or unselect a node */
function [% name %]_toggle_select(id, val) {
if ([% name %]_selected_id != -1) {
View
1 plugins/Admin/templates/topic_popup_ui;admin;default
@@ -46,6 +46,7 @@ __template__
<br>
<input type="button" value="Choose Topics" onmouseup="[% name %]_show()" name="[% name %]_topic_toggle">
<input type="button" value="Remove Topic" onmouseup="[% name %]_remove()">
+<input type="button" value="Collapse All" onmouseup="[% name %]_collapse_all()" name="[% name %]_topic_toggle_all">
<script language="javascript">[% name %]_load_names();</script>

0 comments on commit 8db8107

Please sign in to comment.