[Rt-commit] r5754 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Sat Aug 12 01:18:44 EDT 2006


Author: ruz
Date: Sat Aug 12 01:18:43 2006
New Revision: 5754

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/html/NoAuth/js/util.js

Log:
 r3638 at cubic-pc:  cubic | 2006-08-10 14:00:24 +0400
 * add js utils required by shredder


Modified: rt/branches/3.7-EXPERIMENTAL/html/NoAuth/js/util.js
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/NoAuth/js/util.js	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/NoAuth/js/util.js	Sat Aug 12 01:18:43 2006
@@ -202,3 +202,60 @@
     }
 }
 
+/* apply callback to nodes or elements */
+
+function walkChildNodes(parent, callback)
+{
+	if( !parent || !parent.childNodes ) return;
+	var list = parent.childNodes;
+	for( var i = 0; i < list.length; i++ ) {
+		callback( list[i] );
+	}
+}
+
+function walkChildElements(parent, callback)
+{
+	walkChildNodes( parent, function(node) {
+		if( node.nodeType != 1 ) return;
+		return callback( node );
+	} );
+}
+
+/* shredder things */
+
+function showShredderPluginTab( plugin )
+{
+	var plugin_tab_id = 'shredder-plugin-'+ plugin +'-tab';
+	var root = $('shredder-plugin-tabs');
+	walkChildElements( root, function(node) {
+		if( node.id == plugin_tab_id ) {
+			show( node );
+		} else {
+			hide( node );
+		}
+	} );
+	if( plugin ) {
+		show('shredder-submit-button');
+	} else {
+		hide('shredder-submit-button');
+	}
+}
+
+function checkAllObjects()
+{
+	var check = $('shredder-select-all-objects-checkbox').checked;
+	var elements = $('shredder-search-form').elements;
+	for( var i = 0; i < elements.length; i++ ) {
+		if( elements[i].name != 'WipeoutObject' ) {
+			continue;
+		}
+		if( elements[i].type != 'checkbox' ) {
+			continue;
+		}
+		if( check ) {
+			elements[i].checked = true;
+		} else {
+			elements[i].checked = false;
+		}
+	}
+}


More information about the Rt-commit mailing list