Index: branches/RC/core/admin_templates/js/tree.js =================================================================== diff -u -r9243 -r9258 --- branches/RC/core/admin_templates/js/tree.js (.../tree.js) (revision 9243) +++ branches/RC/core/admin_templates/js/tree.js (.../tree.js) (revision 9258) @@ -19,6 +19,11 @@ return typeof(this.folderClick) == 'function'; } +TreeItem.prototype.isContainer = function() +{ + return this.isFolder() && this.Container; +} + TreeItem.prototype.Render = function(before, force) { if (!this.Rendered || force) { @@ -130,10 +135,8 @@ // 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 + if (this.treeItem.isContainer()) { + this.href = this.treeItem.locateFirstItem().Url; } getFrame(link.target).location.href = this.href; @@ -186,7 +189,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('&', '&') || TREE_SHOW_FIRST_ITEM)) { + if (this.Children && this.Children.length > 0 && this.isContainer()) { if (!this.Expanded) { this.expand(); } @@ -261,22 +264,13 @@ 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() { } /* FOLDER */ -function TreeFolder(parent_id, title, url, icon, late_load_url, onclick, priority) +function TreeFolder(parent_id, title, url, icon, late_load_url, onclick, priority, container) { var render = false; if (isset(parent_id)) { @@ -300,6 +294,7 @@ this.Loaded = false; this.Onclick = onclick; this.Priority = isset(priority) ? priority : false; + this.Container = isset(container) ? parseInt(container) : false; this.Children = new Array(); this.ChildIndex = 0; @@ -327,7 +322,7 @@ TreeFolder.prototype.locateFirstItem = function() { var $folder_node = this; - while ($folder_node.isFolder() && $folder_node.Children.length > 0) { + while ($folder_node.isContainer() && $folder_node.Children.length > 0) { $folder_node = $folder_node.Children[0]; } @@ -337,7 +332,7 @@ TreeFolder.prototype.locateItemByURL = function(url, with_late_load) { last_item = false; - + if (this.Url == url && ( (with_late_load && this.LateLoadURL) || !with_late_load) ) { return this; } @@ -421,7 +416,7 @@ child = node.childNodes.item(i); if (child.tagName == 'folder') { var backupLastFolder = this.LastFolder; - this.LastFolder = this.LastFolder.AddItem(new TreeFolder(null, child.getAttribute('name'), child.getAttribute('href'), child.getAttribute('icon'), child.getAttribute('load_url'), child.getAttribute('onclick'), child.getAttribute('priority')), render); + this.LastFolder = this.LastFolder.AddItem(new TreeFolder(null, child.getAttribute('name'), child.getAttribute('href'), child.getAttribute('icon'), child.getAttribute('load_url'), child.getAttribute('onclick'), child.getAttribute('priority'), child.getAttribute('container')), render); if (child.hasChildNodes) { this.ProcessXMLNode(child); } Index: branches/RC/core/units/general/helpers/sections_helper.php =================================================================== diff -u -r9046 -r9258 --- branches/RC/core/units/general/helpers/sections_helper.php (.../sections_helper.php) (revision 9046) +++ branches/RC/core/units/general/helpers/sections_helper.php (.../sections_helper.php) (revision 9258) @@ -89,6 +89,10 @@ $section_params['onclick'] = 'checkEditMode()'; } + if (!isset($section_params['container'])) { + $section_params['container'] = 0; // for js tree printing to xml + } + $current_data = isset($this->Tree[$section_name]) ? $this->Tree[$section_name] : Array(); $this->Tree[$section_name] = array_merge_recursive2($current_data, $section_params); } Index: branches/RC/core/admin_templates/tree.tpl =================================================================== diff -u -r9045 -r9258 --- branches/RC/core/admin_templates/tree.tpl (.../tree.tpl) (revision 9045) +++ branches/RC/core/admin_templates/tree.tpl (.../tree.tpl) (revision 9258) @@ -75,7 +75,7 @@ " priority="" onclick="" icon="img/icons/icon24_.gif"> - " priority="" onclick="" name="" icon="img/icons/icon24_.gif" load_url=""> + " priority="" container="" onclick="" name="" icon="img/icons/icon24_.gif" load_url=""> @@ -86,9 +86,8 @@