Index: trunk/core/admin_templates/js/tree.js
===================================================================
diff -u -N
--- trunk/core/admin_templates/js/tree.js (revision 8715)
+++ trunk/core/admin_templates/js/tree.js (revision 0)
@@ -1,605 +0,0 @@
-var last_hightlighted = null;
-var last_highlighted_key = null;
-
-function TreeItem(title, url, icon, onclick, priority)
-{
- this.Title = title;
- this.Url = url;
- this.Rendered = false;
- this.Displayed = false;
- this.Level = 0;
- this.Icon = icon;
- this.Onclick = onclick;
- this.Priority = isset(priority) ? priority : false;
- this.Children = false;
-}
-
-TreeItem.prototype.Render = function(before, force)
-{
- if (!this.Rendered || force) {
- if (!isset(before)) {before = null}
-
- tr = document.createElement('tr');
- this.ParentElement.insertBefore(tr, before);
- if (!this.Displayed) { tr.style.display = 'none' }
- td = document.createElement('td');
- td.TreeElement = this;
- tr.appendChild(td);
-
- this.appendLevel(td);
- if (this.ParentFolder != null) this.appendNodeImage(td);
- this.appendIcon(td);
- this.appendLink(td);
-
- this.Tr = tr;
- this.Rendered = true;
-// alert(this.Tr.innerHTML)
- }
-}
-
-TreeItem.prototype.remove = function()
-{
- var p = this.Tr.parentNode;
- p.removeChild(this.Tr);
-}
-
-TreeItem.prototype.appendLevel = function(td)
-{
- for (var i=0; i < this.Level; i++)
- {
- img = document.createElement('img');
- img.style.width = '16px';
- img.style.height = '22px';
- img.src = TREE_ICONS_PATH+'/ftv2blank.gif';
- img.style.verticalAlign = 'middle';
- td.appendChild(img);
- }
-}
-
-TreeItem.prototype.getNodeImage = function(is_last)
-{
- return is_last ? TREE_ICONS_PATH+'/ftv2lastnode.gif' : TREE_ICONS_PATH+'/ftv2node.gif';
-}
-
-TreeItem.prototype.appendNodeImage = function(td)
-{
- img = document.createElement('img');
- img.style.width = '16px';
- img.style.height = '22px';
- img.src = this.getNodeImage();
- img.style.verticalAlign = 'middle';
- td.appendChild(img);
-}
-
-TreeItem.prototype.appendIcon = function (td)
-{
- img = document.createElement('img');
- img.style.width = '24px';
- img.style.height = '22px';
- if (this.Icon.indexOf('http://') != -1) {
- img.src = this.Icon;
- }
- else {
- img.src = this.Icon;
- }
- img.style.verticalAlign = 'middle';
- td.appendChild(img);
-}
-
-TreeItem.prototype.appendLink = function (td)
-{
- var $node_text = document.createElement('span');
- $node_text.innerHTML = this.Title;
- if (TREE_SHOW_PRIORITY && this.Priority !== false) {
- $node_text.innerHTML += '' + this.Priority + '';
- }
-
- link = document.createElement('a');
- link.nodeValue = this.Title;
- link.href = this.Url;
- link.target = 'main';
- link.appendChild($node_text);
-
- link.treeItem = this;
- //addEvent(link, 'click',
-
- link.onclick =
- function(ev) {
- var e = is.ie ? window.event : ev;
-
- res = true;
- if (isset(this.treeItem.Onclick)) {
- res = eval(this.treeItem.Onclick);
- }
- if (!res) { // if we need to cancel onclick action
- if (is.ie) {
- window.event.cancelBubble = true;
- window.event.returnValue = false;
- } else {
- ev.preventDefault();
- ev.stopPropagation();
- }
- return res;
- }
- else {
- // ensures, that click is made before AJAX request will be sent
- if (res === true) {
- // only in case of "true" is returned, used in catalog
- getFrame(link.target).location.href = this.href;
- }
-
- if (!this.treeItem.Expanded && typeof(this.treeItem.folderClick) == 'function') {
- if (this.treeItem.folderClick());
- }
- this.treeItem.highLight();
- return false;
- }
- }
-
- td.appendChild(link);
-
- /*
- if (this.LateLoadURL) {
- var span = document.createElement('span');
- span.innerHTML = ' Reload';
- span.treeItem = this;
- span.onclick = function(ev) {
- this.treeItem.reload();
- }
- td.appendChild(span);
- }
- */
-}
-
-TreeItem.prototype.display = function()
-{
- this.Tr.style.display = is.ie ? 'block' : 'table-row';
- this.Displayed = true;
-
- var do_sub = TreeManager.isExpanded(this.Key);
- if (this.Children && do_sub && !this.Expanding) {
- this.expand();
- }
-}
-
-TreeItem.prototype.hide = function()
-{
- this.Tr.style.display = 'none';
- this.Displayed = false;
-}
-
-TreeItem.prototype.highLight = function()
-{
- if (last_hightlighted) last_hightlighted.Tr.className = '';
- if (this.Children && this.Children.length > 0 && this.Children[0].Url.replace('&', '&') == this.Url.replace('&', '&')) {
- if (!this.Expanded) {
- this.expand();
- }
- this.Children[0].highLight();
- return;
- }
-
- this.Tr.className = "highlighted";
- last_hightlighted = this;
- last_highlighted_key = this.Key;
- if (!this.Expanded) {
- this.expand();
- }
-}
-
-TreeItem.prototype.expand = function() { this.display() }
-
-TreeItem.prototype.collapse = function() { this.hide() }
-
-TreeItem.prototype.updateLastNodes = function(is_last, lines_pattern)
-{
- if (!isset(is_last)) is_last = true;
- if (!isset(this.Tr)) return;
- if (!isset(lines_pattern)) { var lines_pattern = new Array() }
-
- imgs = this.Tr.getElementsByTagName('img');
- found = false;
- for (var i=0; i