Index: branches/RC/core/admin_templates/js/tree.js =================================================================== diff -u -r8929 -r9045 --- branches/RC/core/admin_templates/js/tree.js (.../tree.js) (revision 8929) +++ branches/RC/core/admin_templates/js/tree.js (.../tree.js) (revision 9045) @@ -14,6 +14,11 @@ this.Children = false; } +TreeItem.prototype.isFolder = function() +{ + return typeof(this.folderClick) == 'function'; +} + TreeItem.prototype.Render = function(before, force) { if (!this.Rendered || force) { @@ -125,10 +130,16 @@ // ensures, that click is made before AJAX request will be sent if (res === true) { // only in case of "true" is returned, used in catalog + + if (this.treeItem.isFolder() && TREE_SHOW_FIRST_ITEM) { + this.treeItem.locateFirstItem().propagateUrl(); + this.href = this.treeItem.Url; // update href's url affected by propagateUrl method + } + getFrame(link.target).location.href = this.href; } - - if (!this.treeItem.Expanded && typeof(this.treeItem.folderClick) == 'function') { + + if (!this.treeItem.Expanded && this.treeItem.isFolder()) { if (this.treeItem.folderClick()); } this.treeItem.highLight(); @@ -171,7 +182,7 @@ 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.Children && this.Children.length > 0 && (this.Children[0].Url.replace('&', '&') == this.Url.replace('&', '&') || TREE_SHOW_FIRST_ITEM)) { if (!this.Expanded) { this.expand(); } @@ -244,6 +255,15 @@ return false; } +TreeItem.prototype.propagateUrl = function() +{ + var $tree_node = this; + while (this.ParentFolder != null && $tree_node.Id == 1) { + $tree_node = $tree_node.ParentFolder; + $tree_node.Url = this.Url; + } +} + TreeItem.prototype.reload = function() { } @@ -299,6 +319,16 @@ return last_item; } +TreeFolder.prototype.locateFirstItem = function() +{ + var $folder_node = this; + while ($folder_node.isFolder() && $folder_node.Children.length > 0) { + $folder_node = $folder_node.Children[0]; + } + + return $folder_node; +} + TreeFolder.prototype.locateItemByURL = function(url, with_late_load) { last_item = false; Index: branches/RC/core/admin_templates/tree.tpl =================================================================== diff -u -r8929 -r9045 --- branches/RC/core/admin_templates/tree.tpl (.../tree.tpl) (revision 8929) +++ branches/RC/core/admin_templates/tree.tpl (.../tree.tpl) (revision 9045) @@ -86,6 +86,7 @@