Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgallardo committed Dec 17, 2014
1 parent d0f2269 commit a9b0961
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
19 changes: 11 additions & 8 deletions pandora_console/include/javascript/tree/TreeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TreeController = {
errorMessage: "Error",
baseURL: "",
ajaxURL: "ajax.php",
ajaxPage: "include/ajax/tree.ajax.php",
ajaxPage: "include/ajax/tree.ajax",
detailRecipient: '',
reload: function () {
// Bad recipient
Expand Down Expand Up @@ -60,7 +60,7 @@ TreeController = {
elements.forEach(function(element, index) {
lastNode = index == elements.length - 1 ? true : false;
firstNode = rootGroup && index == 0 ? true : false;
element.jqObject = _processNode($group, detailRecipient, element, lastNode, firstNode);
element.jqObject = _processNode($group, detailContainer, element, lastNode, firstNode);
}, $group);

return $group;
Expand Down Expand Up @@ -119,7 +119,7 @@ TreeController = {
$node.addClass("leaf-closed");

// Add children
var $children = _processGroup($node, this.detailContainer, element.children, this.baseURL);
var $children = _processGroup($node, detailContainer, element.children, this.baseURL);
$node.data('children', $children);

$leafIcon.click(function () {
Expand All @@ -142,31 +142,34 @@ TreeController = {
else if (typeof element.searchChildren != 'undefined' && element.searchChildren) {
$node.addClass("leaf-closed");

$leafIcon.click(function () {
$leafIcon.click(function (e) {
e.preventDefault();

if (! $node.hasClass("children-loaded")) {
$node
.removeClass("leaf-closed")
.removeClass("leaf-error")
.addClass("leaf-loading");

$.ajax({
url: this.ajaxURL,
url: controller.ajaxURL,
type: 'POST',
dataType: 'json',
data: {
page: this.ajaxPage,
page: controller.ajaxPage,
getChildren: 1,
id: element.id,
type: element.type
},
complete: function(xhr, textStatus) {
$node.removeClass("leaf-loading");
$node.addClass("children-loaded")
},
success: function(data, textStatus, xhr) {
if (data.success) {
$node.addClass("leaf-open");

var $children = _processGroup($node, this.detailContainer, data.elements, this.baseURL);
var $children = _processGroup($node, detailContainer, data.tree, controller.baseURL);
$children.slideDown();

$node.data('children', $children);
Expand Down Expand Up @@ -298,7 +301,7 @@ TreeNodeDetailController = {
errorMessage: "Error",
baseURL: "",
ajaxURL: "ajax.php",
ajaxPage: "include/ajax/tree.ajax.php",
ajaxPage: "include/ajax/tree.ajax",
container: '',
reload: function () {
// Label
Expand Down
4 changes: 4 additions & 0 deletions pandora_console/include/styles/pandora.css
Original file line number Diff line number Diff line change
Expand Up @@ -2895,6 +2895,10 @@ table#policy_modules td * {
background-image: url(../../images/tree/first_leaf.png);
}

.tree-node.leaf-error>.leaf-icon {
background-image: url(../../images/tree/last_leaf.png);
}

.tree-node>.leaf-icon {
background-position: 0px 0px;
background-repeat: no-repeat;
Expand Down
5 changes: 2 additions & 3 deletions pandora_console/operation/tree.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,8 +1056,7 @@ classes = classes.split(' ');
recipient: $("div#tree-controller-recipient"),
detailRecipient: $("div#tree-controller-detail-recipient"),
tree: tree,
baseURL: "<?php echo $config['homeurl'].'/'; ?>",
ajaxURL: "<?php echo $config['homeurl']; ?>/ajax.php",
ajaxPage: "<?php echo $config['homeurl']; ?>/include/ajax/tree.ajax.php"
baseURL: "<?php echo $config['homeurl']; ?>/",
ajaxURL: "<?php echo $config['homeurl']; ?>/ajax.php"
});
</script>
6 changes: 4 additions & 2 deletions pandora_console/operation/tree2.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@

$.ajax({
type: "POST",
url: "<?php echo ui_get_full_url("ajax.php", false, false, false); ?>",
url: "<?php echo $config['homeurl']; ?>/ajax.php",
data: parameters,
success: function(data) {
if (data.success) {
Expand All @@ -148,7 +148,9 @@
treeController.init({
recipient: $("div#tree-controller-recipient"),
page: page,
tree: data.tree
tree: data.tree,
baseURL: "<?php echo $config['homeurl']; ?>/",
ajaxURL: "<?php echo $config['homeurl']; ?>/ajax.php"
});
}
},
Expand Down

0 comments on commit a9b0961

Please sign in to comment.