This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Gallery Pastebin - Paste and link to it

Posted by talmdal Wed 2nd Jul 2008 19:53

  1.  
  2. var Dom = YAHOO.util.Dom,
  3.     Point = YAHOO.util.Point,
  4.     Cookie = YAHOO.util.Cookie,
  5.     Event = YAHOO.util.Event;
  6.  
  7. var adminTree = {
  8.     init: function() {
  9.         this.tree = new YAHOO.widget.TreeView("optionTree");
  10.         this.tree.subscribe('collapseComplete', function(node) {
  11.             Cookie.setSub('adminGroups', node.data, node.expanded);
  12.         });
  13.         this.tree.subscribe('expandComplete', function(node) {
  14.             Cookie.setSub('adminGroups', node.data, node.expanded);
  15.         });
  16.     },
  17.  
  18.     addNode: function(name, url, selected, iconStyle, parentNode) {
  19.         if (selected == true) {
  20.             parentNode.expand();
  21.             text = name;
  22.         } else {
  23.             text ="<a href='" + url + "'>" + name + "</a>";
  24.         }
  25.         var tmpNode = new YAHOO.widget.HTMLNode(text, parentNode, false, true);
  26.         tmpNode.contentStyle = iconStyle;
  27.     },
  28.  
  29.     addGroup: function(name) {
  30.         expanded = YAHOO.util.Cookie.getSub('adminGroups', name, function(value) {
  31.             return "true" == value;
  32.         });
  33.  
  34.         var tmpNode = new YAHOO.widget.TextNode(name, this.tree.getRoot(), expanded);
  35.         if (expanded == null) {
  36.             YAHOO.util.Cookie.setSub('adminGroups', name, false);
  37.         }
  38.         return tmpNode;
  39.     },
  40. };
  41.  
  42. usage:
  43. <script  type="text/javascript">
  44.   // <![CDATA[
  45.   //Add a window onload handler to build the tree when the load event fires.
  46.  
  47. YAHOO.util.Event.addListener(window, "load", function() {
  48.     adminTree.init();
  49. }
  50.  

PermaLink to this entry http://tools.gallery2.org/pastebin/2006 Download 2006.txt
Submit a correction or amendment below. (click here to make a fresh posting)

Your Name
Syntax:
For (optional)
Leave permalink as note for user. Remember my name in a cookie

Select channel for announcement:
#gallery#gallery-support

Code: To ensure legibility, keep your code lines under 80 characters long.

You can highlight lines: start with "@#" and end with "!#"

Description: You can leave a small description for your code. (Errors, etc)

Please note that your script will be available publicly.
Page generated in 0.132 seconds.