Skip to content

Commit

Permalink
Fix manage all pages tree display crashing for non-admin users when p…
Browse files Browse the repository at this point in the history
…ages are hidden;we now style as 'hidden' instead of removing from array [#1260 state:resolved]
  • Loading branch information
dleffler committed Jan 22, 2015
1 parent 435be26 commit 9cd51b1
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -762,10 +762,7 @@ public static function returnChildrenAsJSON2() {
3 => 'addfreeform',
);

// $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$navs = $db->selectObjects('section', 'parent!=-1', 'rank');
// $navcount = count($jnav);
// for ($i = 0; $i < $navcount; $i++) {
foreach ($navs as $i=>$nav) {
$navs[$i]->parent = $nav->parent?$nav->parent:'#';
$navs[$i]->text = $nav->name;
Expand All @@ -779,7 +776,12 @@ public static function returnChildrenAsJSON2() {
$view = $navs[$i]->public ? true : expPermissions::check('view', expCore::makeLocation('navigation', '', $navs[$i]->id));
}
$navs[$i]->link = expCore::makeLink(array('section' => $navs[$i]->id), '', $navs[$i]->sef_name);
if (!$view) unset($navs[$i]);
if (!$view) {
// unset($navs[$i]); //FIXME this breaks jstree if we remove a parent and not the child
$attr = new stdClass();
$attr->class = 'hidden'; // bs3 class to hide elements
$navs[$i]->li_attr = $attr;
}
}
$navs= array_values($navs);
// header('Content-Type: application/json; charset=utf8');
Expand Down

0 comments on commit 9cd51b1

Please sign in to comment.