Skip to content

Commit

Permalink
fix(knowbase): save tree browser
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B authored and cedric-anne committed Jun 30, 2023
1 parent ef6bcdb commit 0eefeff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ajax/knowbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
exit;
}

$_SESSION['kb_cat_id'] = $_REQUEST['cat_id'] ?? 0;

switch ($_REQUEST['action']) {
case "getItemslist":
header("Content-Type: application/json; charset=UTF-8");
Expand Down
4 changes: 3 additions & 1 deletion src/Knowbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public static function showBrowseView()
$ajax_url = $CFG_GLPI["root_doc"] . "/ajax/knowbase.php";
$loading_txt = __s('Loading...');
$start = (int)($_REQUEST['start'] ?? 0);
$cat_id = (int)($_SESSION['kb_cat_id'] ?? 0);

$category_list = json_encode(self::getTreeCategoryList());
$no_cat_found = __s("No category found");
Expand Down Expand Up @@ -201,7 +202,8 @@ public static function showBrowseView()
'start': $start
});
};
loadNode(0);
loadNode($cat_id);
$.ui.fancytree.getTree("#tree_category$rand").activateKey($cat_id);
$(document).on('keyup', '#browser_tree_search$rand', function() {
var search_text = $(this).val();
Expand Down

0 comments on commit 0eefeff

Please sign in to comment.