Skip to content

Commit 0eefeff

Browse files
Rom1-Bcedric-anne
authored andcommitted
fix(knowbase): save tree browser
1 parent ef6bcdb commit 0eefeff

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ajax/knowbase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
exit;
4646
}
4747

48+
$_SESSION['kb_cat_id'] = $_REQUEST['cat_id'] ?? 0;
49+
4850
switch ($_REQUEST['action']) {
4951
case "getItemslist":
5052
header("Content-Type: application/json; charset=UTF-8");

src/Knowbase.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public static function showBrowseView()
152152
$ajax_url = $CFG_GLPI["root_doc"] . "/ajax/knowbase.php";
153153
$loading_txt = __s('Loading...');
154154
$start = (int)($_REQUEST['start'] ?? 0);
155+
$cat_id = (int)($_SESSION['kb_cat_id'] ?? 0);
155156

156157
$category_list = json_encode(self::getTreeCategoryList());
157158
$no_cat_found = __s("No category found");
@@ -201,7 +202,8 @@ public static function showBrowseView()
201202
'start': $start
202203
});
203204
};
204-
loadNode(0);
205+
loadNode($cat_id);
206+
$.ui.fancytree.getTree("#tree_category$rand").activateKey($cat_id);
205207
206208
$(document).on('keyup', '#browser_tree_search$rand', function() {
207209
var search_text = $(this).val();

0 commit comments

Comments
 (0)