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
5a4192f2
Commit
5a4192f2
authored
7 years ago
by
aydreeihn
Browse files
Options
Downloads
Patches
Plain Diff
add filter table flag for disabled topic/dept. add alert icon if disabled
parent
4797bd6d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.filter.php
+11
-0
11 additions, 0 deletions
include/class.filter.php
include/staff/filters.inc.php
+34
-2
34 additions, 2 deletions
include/staff/filters.inc.php
with
45 additions
and
2 deletions
include/class.filter.php
+
11
−
0
View file @
5a4192f2
...
...
@@ -21,6 +21,9 @@ class Filter {
var
$id
;
var
$ht
;
const
FLAG_INACTIVE_HT
=
0x0001
;
const
FLAG_INACTIVE_DEPT
=
0x0002
;
static
$match_types
=
array
(
/* @trans */
'User Information'
=>
array
(
array
(
'name'
=>
/* @trans */
'Name'
,
...
...
@@ -138,6 +141,13 @@ class Filter {
return
$this
->
ht
[
'topic_id'
];
}
public
function
setFlag
(
$flag
,
$val
)
{
if
(
$val
)
$this
->
ht
[
'flags'
]
|=
$flag
;
else
$this
->
ht
[
'flags'
]
&=
~
$flag
;
}
function
stopOnMatch
()
{
return
(
$this
->
ht
[
'stop_onmatch'
]);
}
...
...
@@ -502,6 +512,7 @@ class Filter {
$sql
=
' updated=NOW() '
.
',isactive='
.
db_input
(
$vars
[
'isactive'
])
.
',flags='
.
db_input
(
$vars
[
'flags'
])
.
',target='
.
db_input
(
$vars
[
'target'
])
.
',name='
.
db_input
(
$vars
[
'name'
])
.
',execorder='
.
db_input
(
$vars
[
'execorder'
])
...
...
This diff is collapsed.
Click to expand it.
include/staff/filters.inc.php
+
34
−
2
View file @
5a4192f2
...
...
@@ -2,9 +2,11 @@
if
(
!
defined
(
'OSTADMININC'
)
||
!
$thisstaff
->
isAdmin
())
die
(
'Access Denied'
);
$targets
=
Filter
::
getTargets
();
$qs
=
array
();
$sql
=
'SELECT filter.*,count(rule.id) as rules '
.
$sql
=
'SELECT filter.*,count(rule.id) as rules
, topic.configuration AS topic, dept.configuration AS dept
'
.
'FROM '
.
FILTER_TABLE
.
' filter '
.
'LEFT JOIN '
.
FILTER_RULE_TABLE
.
' rule ON(rule.filter_id=filter.id) '
.
'LEFT JOIN '
.
FILTER_ACTION_TABLE
.
' topic ON (topic.filter_id = filter.id AND topic.type = \'topic\') '
.
'LEFT JOIN '
.
FILTER_ACTION_TABLE
.
' dept ON (dept.filter_id = filter.id AND dept.type = \'dept\') '
.
"WHERE filter.`name` <> 'SYSTEM BAN LIST' "
.
'GROUP BY filter.id'
;
$sortOptions
=
array
(
'name'
=>
'filter.name'
,
'status'
=>
'filter.isactive'
,
'order'
=>
'filter.execorder'
,
'rules'
=>
'rules'
,
...
...
@@ -104,6 +106,26 @@ else
$ids
=
(
$errors
&&
is_array
(
$_POST
[
'ids'
]))
?
$_POST
[
'ids'
]
:
null
;
if
(
$res
&&
db_num_rows
(
$res
))
:
while
(
$row
=
db_fetch_array
(
$res
))
{
if
(
$row
[
'topic'
])
{
$filter
=
Filter
::
lookup
(
$row
[
'id'
]);
if
(
$filter
->
ht
[
'flags'
]
&
!
Filter
::
FLAG_INACTIVE_HT
)
{
$filter
->
setFlag
(
Filter
::
FLAG_INACTIVE_HT
,
true
);
$vars
=
$filter
->
ht
;
$vars
[
'rules'
]
=
$filter
->
getRules
();
$filter
->
update
(
$filter
->
ht
,
$errors
);
}
}
if
(
$row
[
'dept'
])
{
$filter
=
Filter
::
lookup
(
$row
[
'id'
]);
if
(
$filter
->
ht
[
'flags'
]
&
!
Filter
::
FLAG_INACTIVE_DEPT
)
{
$filter
->
setFlag
(
Filter
::
FLAG_INACTIVE_DEPT
,
true
);
$vars
=
$filter
->
ht
;
$vars
[
'rules'
]
=
$filter
->
getRules
();
$filter
->
update
(
$filter
->
ht
,
$errors
);
}
}
$sel
=
false
;
if
(
$ids
&&
in_array
(
$row
[
'id'
],
$ids
))
$sel
=
true
;
...
...
@@ -113,7 +135,17 @@ else
<input
type=
"checkbox"
class=
"ckb"
name=
"ids[]"
value=
"
<?php
echo
$row
[
'id'
];
?>
"
<?php
echo
$sel
?
'checked="checked"'
:
''
;
?>
>
</td>
<td>
<a
href=
"filters.php?id=
<?php
echo
$row
[
'id'
];
?>
"
>
<?php
echo
Format
::
htmlchars
(
$row
[
'name'
]);
?>
</a></td>
<td>
<a
href=
"filters.php?id=
<?php
echo
$row
[
'id'
];
?>
"
>
<?php
echo
Format
::
htmlchars
(
$row
[
'name'
]);
?>
</a>
<?php
if
(
$row
[
'flags'
]
&
Filter
::
FLAG_INACTIVE_DEPT
)
echo
'<a data-placement="bottom" data-toggle="tooltip" title="Inactive Department Selected"
<i class="pull-right icon-warning-sign"></a>'
;
if
(
$row
[
'flags'
]
&
Filter
::
FLAG_INACTIVE_HT
)
echo
'<a data-placement="bottom" data-toggle="tooltip" title="Inactive Help Topic Selected"
<i class="pull-right icon-warning-sign"></a>'
;
?>
</td>
<td>
<?php
echo
$row
[
'isactive'
]
?
__
(
'Active'
)
:
'<b>'
.
__
(
'Disabled'
)
.
'</b>'
;
?>
</td>
<td
style=
"text-align:right;padding-right:25px;"
>
<?php
echo
$row
[
'execorder'
];
?>
</td>
<td
style=
"text-align:right;padding-right:25px;"
>
<?php
echo
$row
[
'rules'
];
?>
</td>
...
...
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