Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
ed0eac1f
Commit
ed0eac1f
authored
10 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
topics: Arbitrary nesting for help topics
parent
4e2b8deb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/staff/helptopic.inc.php
+7
-11
7 additions, 11 deletions
include/staff/helptopic.inc.php
include/staff/helptopics.inc.php
+18
-8
18 additions, 8 deletions
include/staff/helptopics.inc.php
with
25 additions
and
19 deletions
include/staff/helptopic.inc.php
+
7
−
11
View file @
ed0eac1f
...
@@ -71,18 +71,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
...
@@ -71,18 +71,14 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
</td>
<td>
<td>
<select
name=
"pid"
>
<select
name=
"pid"
>
<option
value=
""
>
—
Select Parent Topic
—
</option>
<option
value=
""
>
—
Select Parent Topic
—
</option>
<?php
$topics
=
Topic
::
getHelpTopics
();
while
(
list
(
$id
,
$topic
)
=
each
(
$topics
))
{
if
(
$id
==
$info
[
'topic_id'
])
continue
;
?>
<option
value=
"
<?php
echo
$id
;
?>
"
<?php
echo
(
$info
[
'topic_pid'
]
==
$id
)
?
'selected'
:
''
;
?>
>
<?php
echo
$topic
;
?>
</option>
<?php
<?php
$sql
=
'SELECT topic_id, topic FROM '
.
TOPIC_TABLE
}
?>
.
' WHERE topic_pid=0 '
.
' ORDER by topic'
;
if
((
$res
=
db_query
(
$sql
))
&&
db_num_rows
(
$res
))
{
while
(
list
(
$id
,
$name
)
=
db_fetch_row
(
$res
))
{
echo
sprintf
(
'<option value="%d" %s>%s</option>'
,
$id
,
((
$info
[
'pid'
]
&&
$id
==
$info
[
'pid'
])
?
'selected="selected"'
:
''
)
,
$name
);
}
}
?>
</select>
<i
class=
"help-tip icon-question-sign"
href=
"#parent_topic"
></i>
</select>
<i
class=
"help-tip icon-question-sign"
href=
"#parent_topic"
></i>
<span
class=
"error"
>
<?php
echo
$errors
[
'pid'
];
?>
</span>
<span
class=
"error"
>
<?php
echo
$errors
[
'pid'
];
?>
</span>
</td>
</td>
...
...
This diff is collapsed.
Click to expand it.
include/staff/helptopics.inc.php
+
18
−
8
View file @
ed0eac1f
...
@@ -2,28 +2,38 @@
...
@@ -2,28 +2,38 @@
if
(
!
defined
(
'OSTADMININC'
)
||
!
$thisstaff
->
isAdmin
())
die
(
'Access Denied'
);
if
(
!
defined
(
'OSTADMININC'
)
||
!
$thisstaff
->
isAdmin
())
die
(
'Access Denied'
);
$sql
=
'SELECT topic.* '
$sql
=
'SELECT topic.* '
.
', IF(ptopic.topic_pid IS NULL, topic.topic, CONCAT_WS(" / ", ptopic.topic, topic.topic)) as name '
.
', dept.dept_name as department '
.
', dept.dept_name as department '
.
', priority_desc as priority '
.
', priority_desc as priority '
.
' FROM '
.
TOPIC_TABLE
.
' topic '
.
' FROM '
.
TOPIC_TABLE
.
' topic '
.
' LEFT JOIN '
.
TOPIC_TABLE
.
' ptopic ON (ptopic.topic_id=topic.topic_pid) '
.
' LEFT JOIN '
.
DEPT_TABLE
.
' dept ON (dept.dept_id=topic.dept_id) '
.
' LEFT JOIN '
.
DEPT_TABLE
.
' dept ON (dept.dept_id=topic.dept_id) '
.
' LEFT JOIN '
.
TICKET_PRIORITY_TABLE
.
' pri ON (pri.priority_id=topic.priority_id) '
;
.
' LEFT JOIN '
.
TICKET_PRIORITY_TABLE
.
' pri ON (pri.priority_id=topic.priority_id) '
;
$sql
.
=
' WHERE 1'
;
$sql
.
=
' WHERE 1'
;
$order_by
=
(
$cfg
->
getTopicSortMode
()
==
'm'
?
'`sort`'
:
'`
name
`'
);
$order_by
=
(
$cfg
->
getTopicSortMode
()
==
'm'
?
'`sort`'
:
'`
topic_id
`'
);
$total
=
db_count
(
'SELECT count(*) FROM '
.
TOPIC_TABLE
.
' topic '
);
$total
=
db_count
(
'SELECT count(*) FROM '
.
TOPIC_TABLE
.
' topic '
);
$page
=
(
$_GET
[
'p'
]
&&
is_numeric
(
$_GET
[
'p'
]))
?
$_GET
[
'p'
]
:
1
;
$page
=
(
$_GET
[
'p'
]
&&
is_numeric
(
$_GET
[
'p'
]))
?
$_GET
[
'p'
]
:
1
;
$pageNav
=
new
Pagenate
(
$total
,
$page
,
PAGE_LIMIT
);
$pageNav
=
new
Pagenate
(
$total
,
$page
,
PAGE_LIMIT
);
$pageNav
->
setURL
(
'helptopics.php'
);
$pageNav
->
setURL
(
'helptopics.php'
);
//Ok..lets roll...create the actual query
//Ok..lets roll...create the actual query
$query
=
"
$sql
GROUP BY topic.topic_id ORDER BY
$order_by
LIMIT "
.
$pageNav
->
getStart
()
.
","
.
$pageNav
->
getLimit
()
;
$query
=
"
$sql
ORDER BY
$order_by
"
;
$res
=
db_query
(
$query
);
$res
=
db_query
(
$query
);
if
(
$res
&&
(
$num
=
db_num_rows
(
$res
)))
if
(
$res
&&
(
$num
=
db_num_rows
(
$res
)))
$showing
=
$pageNav
->
showing
()
.
' help topics'
;
$showing
=
$pageNav
->
showing
()
.
' help topics'
;
else
else
$showing
=
'No help topic found!'
;
$showing
=
'No help topic found!'
;
// Get the full names and filter for this page
$topics
=
array
();
while
(
$row
=
db_fetch_array
(
$res
))
$topics
[]
=
$row
;
foreach
(
$topics
as
&
$t
)
$t
[
'name'
]
=
Topic
::
getTopicName
(
$t
[
'topic_id'
]);
if
(
$cfg
->
getTopicSortMode
()
==
'a'
)
usort
(
$topics
,
function
(
$a
,
$b
)
{
return
strcmp
(
$a
[
'name'
],
$b
[
'name'
]);
});
$topics
=
array_slice
(
$topics
,
$pageNav
->
getStart
(),
$pageNav
->
getLimit
()
+
2
);
?>
?>
<div
style=
"width:700px;padding-top:5px; float:left;"
>
<div
style=
"width:700px;padding-top:5px; float:left;"
>
<h2>
Help Topics
</h2>
<h2>
Help Topics
</h2>
...
@@ -49,11 +59,11 @@ else
...
@@ -49,11 +59,11 @@ else
<thead>
<thead>
<tr>
<tr>
<th
width=
"7"
style=
"height:20px;"
>
</th>
<th
width=
"7"
style=
"height:20px;"
>
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"3
2
0"
>
Help Topic
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"3
6
0"
>
Help Topic
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"80"
>
Status
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"80"
>
Status
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"100"
>
Type
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"100"
>
Type
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"100"
>
Priority
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"100"
>
Priority
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"
20
0"
>
Department
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"
16
0"
>
Department
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"150"
nowrap
>
Last Updated
</th>
<th
style=
"padding-left:4px;vertical-align:middle"
width=
"150"
nowrap
>
Last Updated
</th>
</tr>
</tr>
</thead>
</thead>
...
@@ -62,11 +72,11 @@ else
...
@@ -62,11 +72,11 @@ else
<?php
<?php
$total
=
0
;
$total
=
0
;
$ids
=
(
$errors
&&
is_array
(
$_POST
[
'ids'
]))
?
$_POST
[
'ids'
]
:
null
;
$ids
=
(
$errors
&&
is_array
(
$_POST
[
'ids'
]))
?
$_POST
[
'ids'
]
:
null
;
if
(
$res
&&
db_num_rows
(
$re
s
))
:
if
(
count
(
$topic
s
))
:
$defaultDept
=
$cfg
->
getDefaultDept
();
$defaultDept
=
$cfg
->
getDefaultDept
();
$defaultPriority
=
$cfg
->
getDefaultPriority
();
$defaultPriority
=
$cfg
->
getDefaultPriority
();
$sort
=
0
;
$sort
=
0
;
while
(
$row
=
db_fetch_array
(
$res
)
)
{
foreach
(
$topics
as
$row
)
{
$sort
++
;
// Track initial order for transition
$sort
++
;
// Track initial order for transition
$sel
=
false
;
$sel
=
false
;
if
(
$ids
&&
in_array
(
$row
[
'topic_id'
],
$ids
))
if
(
$ids
&&
in_array
(
$row
[
'topic_id'
],
$ids
))
...
...
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