* @param string $name The name of this tree instance.
* @param mixed $renderer The type of tree renderer.
* @param array $params Any additional parameters the constructor
- * needs.
+ * needs. Defined by this class:
+ * <pre>
+ * 'nosession' - (boolean) Don't store tree state in the session.
+ * DEFAULT: false
+ * </pre>
*
* @return Horde_Tree_Base The singleton instance.
* @throws Horde_Tree_Exception
break;
}
- $params['session'] = 'horde_tree';
+ if (empty($params['nosession'])) {
+ $params['session'] = 'horde_tree';
+ }
$this->_instances[$id] = Horde_Tree::factory($name, $renderer, $params);
}
'extraColsLeft' => $this->_colsLeft,
'extraColsRight' => $this->_colsRight,
'header' => $this->_header,
+ 'nocookie' => !$this->getOption('session'),
'options' => $this->_options,
'target' => $this->_instance,
saveState: function(nodeId, expanded)
{
+ if (this.opts.nocookie) {
+ return;
+ }
+
var newCookie = '',
newNodes = [],
oldCookie = this._getCookie(this.opts.target + '_expanded');
newCookie = newNodes.join(',');
}
- this._setCookie(this.opts.target + '_expanded', newCookie);
+ document.cookie = this.opts.target + '_expanded=exp' + escape(newCookie) + ';DOMAIN=' + this.opts.cookieDomain + ';PATH=' + this.opts.cookiePath + ';';
},
_getCookie: function(name)
return unescape(dc.substring(begin + prefix.length, end));
},
- _setCookie: function(name, value)
- {
- document.cookie = name + '=exp' + escape(value) + ';DOMAIN=' + this.opts.cookieDomain + ';PATH=' + this.opts.cookiePath + ';';
- },
_onClick: function(e)
{
var elt = e.element(),