Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
abdc3df0
Commit
abdc3df0
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Cascade disabled help topic flag to children
parent
e383487b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.topic.php
+31
-4
31 additions, 4 deletions
include/class.topic.php
with
31 additions
and
4 deletions
include/class.topic.php
+
31
−
4
View file @
abdc3df0
...
@@ -137,11 +137,33 @@ class Topic {
...
@@ -137,11 +137,33 @@ class Topic {
}
}
function
isEnabled
()
{
function
isEnabled
()
{
return
(
$this
->
ht
[
'isactive'
]);
return
$this
->
isActive
();
}
}
/**
* Determine if the help topic is currently enabled. The ancestry of
* this topic will be considered to see if any of the parents are
* disabled. If any are disabled, then this topic will be considered
* disabled.
*
* Parameters:
* $chain - array<id:bool> recusion chain used to detect loops. The
* chain should be maintained and passed to a parent's ::isActive()
* method. When consulting a parent, if the local topic ID is a key
* in the chain, then this topic has already been considered, and
* there is a loop in the ancestry
*/
function
isActive
(
array
$chain
=
array
())
{
if
(
!
$this
->
ht
[
'isactive'
])
return
false
;
function
isActive
()
{
if
(
!
isset
(
$chain
[
$this
->
getId
()])
&&
(
$p
=
$this
->
getParent
()))
{
return
$this
->
isEnabled
();
$chain
[
$this
->
getId
()]
=
true
;
return
$p
->
isActive
(
$chain
);
}
else
{
return
$this
->
ht
[
'isactive'
];
}
}
}
function
isPublic
()
{
function
isPublic
()
{
...
@@ -210,11 +232,16 @@ class Topic {
...
@@ -210,11 +232,16 @@ class Topic {
foreach
(
$topics
as
$id
=>
$info
)
{
foreach
(
$topics
as
$id
=>
$info
)
{
$name
=
$info
[
'topic'
];
$name
=
$info
[
'topic'
];
$loop
=
array
(
$id
=>
true
);
$loop
=
array
(
$id
=>
true
);
$parent
=
false
;
while
(
$info
[
'pid'
]
&&
(
$info
=
$topics
[
$info
[
'pid'
]]))
{
while
(
$info
[
'pid'
]
&&
(
$info
=
$topics
[
$info
[
'pid'
]]))
{
$name
=
sprintf
(
'%s / %s'
,
$info
[
'topic'
],
$name
);
$name
=
sprintf
(
'%s / %s'
,
$info
[
'topic'
],
$name
);
if
(
$parent
&&
$parent
[
'disabled'
])
// Cascade disabled flag
$topics
[
$id
][
'disabled'
]
=
true
;
if
(
isset
(
$loop
[
$info
[
'pid'
]]))
if
(
isset
(
$loop
[
$info
[
'pid'
]]))
break
;
break
;
$loop
[
$info
[
'pid'
]]
=
true
;
$loop
[
$info
[
'pid'
]]
=
true
;
$parent
=
$info
;
}
}
$names
[
$id
]
=
$name
;
$names
[
$id
]
=
$name
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment