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
988caf80
Commit
988caf80
authored
10 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Tasks: Add queue sorting options
parent
2db1582f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/staff/tasks.inc.php
+62
-25
62 additions, 25 deletions
include/staff/tasks.inc.php
include/staff/tickets.inc.php
+2
-2
2 additions, 2 deletions
include/staff/tickets.inc.php
with
64 additions
and
27 deletions
include/staff/tasks.inc.php
+
62
−
25
View file @
988caf80
...
...
@@ -14,26 +14,41 @@ unset($args['a']);
$refresh_url
=
$path
.
'?'
.
http_build_query
(
$args
);
$sort_options
=
array
(
'updated'
=>
__
(
'Most Recently Updated'
),
'created'
=>
__
(
'Most Recently Created'
),
'due'
=>
__
(
'Due Soon'
),
'number'
=>
__
(
'Task Number'
),
'closed'
=>
__
(
'Most Recently Closed'
),
'hot'
=>
__
(
'Longest Thread'
),
'relevance'
=>
__
(
'Relevance'
),
);
$queue_name
=
strtolower
(
$_GET
[
'status'
]
?:
$_GET
[
'a'
]);
//Status is overloaded
switch
(
$queue_name
)
{
case
'closed'
:
$status
=
'closed'
;
$results_type
=
__
(
'Closed Tasks'
);
$showassigned
=
true
;
//closed by.
$queue_sort_options
=
array
(
'closed'
,
'updated'
,
'created'
,
'number'
,
'hot'
);
break
;
case
'overdue'
:
$status
=
'open'
;
$results_type
=
__
(
'Overdue Tasks'
);
$tasks
->
filter
(
array
(
'isoverdue'
=>
1
));
$queue_sort_options
=
array
(
'updated'
,
'created'
,
'number'
,
'hot'
);
break
;
case
'assigned'
:
$status
=
'open'
;
$staffId
=
$thisstaff
->
getId
();
$results_type
=
__
(
'My Tasks'
);
$tasks
->
filter
(
array
(
'staff_id'
=>
$thisstaff
->
getId
()));
$queue_sort_options
=
array
(
'updated'
,
'created'
,
'hot'
,
'number'
);
break
;
default
:
case
'search'
:
$queue_sort_options
=
array
(
'closed'
,
'updated'
,
'created'
,
'number'
,
'hot'
);
// Consider basic search
if
(
$_REQUEST
[
'query'
])
{
$results_type
=
__
(
'Search Results'
);
...
...
@@ -55,6 +70,7 @@ case 'search':
case
'open'
:
$status
=
'open'
;
$results_type
=
__
(
'Open Tasks'
);
$queue_sort_options
=
array
(
'created'
,
'updated'
,
'due'
,
'number'
,
'hot'
);
break
;
}
...
...
@@ -106,29 +122,39 @@ $tasks->values('id', 'number', 'created', 'staff_id', 'team_id',
'dept__name'
,
'cdata__title'
,
'flags'
);
// Apply requested quick filter
// Apply requested sorting
$queue_sort_key
=
sprintf
(
':Q:%s:sort'
,
$queue_name
);
if
(
isset
(
$_GET
[
'sort'
]))
$_SESSION
[
$queue_sort_key
]
=
$_GET
[
'sort'
];
if
(
isset
(
$_GET
[
'sort'
]))
{
$_SESSION
[
$queue_sort_key
]
=
$_GET
[
'sort'
];
}
elseif
(
!
isset
(
$_SESSION
[
$queue_sort_key
]))
{
$_SESSION
[
$queue_sort_key
]
=
$queue_sort_options
[
0
];
}
switch
(
$_SESSION
[
$queue_sort_key
])
{
case
'number'
:
$tasks
->
extra
(
array
(
'order_by'
=>
array
(
SqlExpression
::
times
(
new
SqlField
(
'number'
),
1
))
));
break
;
case
'priority,due'
:
$tasks
->
order_by
(
'cdata__:priority__priority_urgency'
);
// Fall through to add in due date filter
case
'due'
:
$date_header
=
__
(
'Due Date'
);
$date_col
=
'
est_
duedate'
;
$tasks
->
values
(
'
est_
duedate'
);
$tasks
->
filter
(
array
(
'
est_
duedate__isnull'
=>
false
));
$tasks
->
order_by
(
'
est_
duedate'
);
$date_col
=
'duedate'
;
$tasks
->
values
(
'duedate'
);
$tasks
->
filter
(
array
(
'duedate__isnull'
=>
false
));
$tasks
->
order_by
(
'duedate'
);
break
;
case
'updated'
:
$tasks
->
order_by
(
'cdata__:priority__priority_urgency'
,
'-lastupdate'
);
$date_header
=
__
(
'Last Updated'
);
$date_col
=
'updated'
;
$tasks
->
values
(
'updated'
);
$tasks
->
order_by
(
'-updated'
);
break
;
case
'hot'
:
$tasks
->
order_by
(
'-thread_count'
);
$tasks
->
annotate
(
array
(
'thread_count'
=>
SqlAggregate
::
COUNT
(
'thread__entries'
),
));
break
;
case
'created'
:
default
:
...
...
@@ -178,6 +204,31 @@ if ($thisstaff->hasPerm(Task::PERM_DELETE, false)) {
?>
<!-- SEARCH FORM START -->
<div
id=
'basic_search'
>
<div
class=
"pull-right"
style=
"height:25px"
>
<span
class=
"valign-helper"
></span>
<span
class=
"action-button muted"
data-dropdown=
"#sort-dropdown"
>
<i
class=
"icon-caret-down pull-right"
></i>
<span><i
class=
"icon-sort-by-attributes-alt"
></i>
<?php
echo
__
(
'Sort'
);
?>
</span>
</span>
<div
id=
"sort-dropdown"
class=
"action-dropdown anchor-right"
onclick=
"javascript: $.pjax({
url:'?' + addSearchParam('sort', $(event.target).data('mode')),
timeout: 2000,
container: '#pjax-container'});"
>
<ul
class=
"bleed-left"
>
<?php
foreach
(
$queue_sort_options
as
$mode
)
{
$desc
=
$sort_options
[
$mode
];
$selected
=
$mode
==
$_SESSION
[
$queue_sort_key
];
?>
<li
<?php
if
(
$selected
)
echo
'class="active"'
;
?>
>
<a
href=
"#"
data-mode=
"
<?php
echo
$mode
;
?>
"
><i
class=
"icon-fixed-width
<?php
if
(
$selected
)
echo
'icon-hand-right'
;
?>
"
></i>
<?php
echo
Format
::
htmlchars
(
$desc
);
?>
</a>
</li>
<?php
}
?>
</ul>
</div>
</div>
<form
action=
"tasks.php"
method=
"get"
>
<input
type=
"hidden"
name=
"a"
value=
"search"
>
<table>
...
...
@@ -204,20 +255,6 @@ if ($thisstaff->hasPerm(Task::PERM_DELETE, false)) {
$results_type
.
$showing
;
?>
</a></h2>
</div>
<div
class=
"pull-right flush-right"
>
<span
style=
"display:inline-block"
>
<span
style=
"vertical-align: baseline"
>
Sort:
</span>
<select
name=
"sort"
onchange=
"javascript:addSearchParam('sort', $(this).val());"
>
<?php
foreach
(
array
(
'created'
=>
__
(
'Most Recently Created'
),
'updated'
=>
__
(
'Most Recently Updated'
),
'due'
=>
__
(
'Due Soon'
),
'priority,due'
=>
__
(
'Priority + Due Soon'
),
'number'
=>
__
(
'Task Number'
),
)
as
$mode
=>
$desc
)
{
?>
<option
value=
"
<?php
echo
$mode
;
?>
"
<?php
if
(
$mode
==
$_SESSION
[
$queue_sort_key
])
echo
'selected="selected"'
;
?>
>
<?php
echo
$desc
;
?>
</option>
<?php
}
?>
</select>
</span>
<?php
Task
::
getAgentActions
(
$thisstaff
,
array
(
'status'
=>
$status
));
?>
...
...
This diff is collapsed.
Click to expand it.
include/staff/tickets.inc.php
+
2
−
2
View file @
988caf80
...
...
@@ -316,7 +316,7 @@ $_SESSION[':Q:tickets'] = $orig_tickets;
<span><i
class=
"icon-sort-by-attributes-alt"
></i>
<?php
echo
__
(
'Sort'
);
?>
</span>
</span>
<div
id=
"sort-dropdown"
class=
"action-dropdown anchor-right"
onclick=
"javascript:
console.log(event);
$.pjax({
onclick=
"javascript: $.pjax({
url:'?' + addSearchParam('sort', $(event.target).data('mode')),
timeout: 2000,
container: '#pjax-container'});"
>
...
...
@@ -325,7 +325,7 @@ $_SESSION[':Q:tickets'] = $orig_tickets;
$desc
=
$sort_options
[
$mode
];
$selected
=
$mode
==
$_SESSION
[
$queue_sort_key
];
?>
<li
<?php
if
(
$selected
)
echo
'class="active"'
;
?>
>
<a
data-mode=
"
<?php
echo
$mode
;
?>
"
><i
class=
"icon-fixed-width
<?php
<a
href=
"#"
data-mode=
"
<?php
echo
$mode
;
?>
"
><i
class=
"icon-fixed-width
<?php
if
(
$selected
)
echo
'icon-hand-right'
;
?>
"
></i>
<?php
echo
Format
::
htmlchars
(
$desc
);
?>
</a>
</li>
...
...
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