-
Notifications
You must be signed in to change notification settings - Fork 20
/
config.php
70 lines (63 loc) · 2.37 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
require_once INCLUDE_DIR . 'class.plugin.php';
class TeamsPluginConfig extends PluginConfig {
// Provide compatibility function for versions of osTicket prior to
// translation support (v1.9.4)
function translate() {
if (!method_exists('Plugin', 'translate')) {
return array(
function ($x) {
return $x;
},
function ($x, $y, $n) {
return $n != 1 ? $y : $x;
}
);
}
return Plugin::translate('teams');
}
function pre_save(&$config, &$errors) {
if ($config['slack-regex-subject-ignore'] && false === @preg_match("/{$config['slack-regex-subject-ignore']}/i", null)) {
$errors['err'] = 'Your regex was invalid, try something like "spam", it will become: "/spam/i" when we use it.';
return FALSE;
}
return TRUE;
}
function getOptions() {
list ($__, $_N) = self::translate();
return array(
'teams' => new SectionBreakField(array(
'label' => $__('Teams notifier'),
'hint' => $__('Readme first: https://github.com/ipavlovi/osTicket-Microsoft-Teams-plugin')
)),
'teams-webhook-url' => new TextboxField(array(
'label' => $__('Webhook URL'),
'configuration' => array(
'size' => 100,
'length' => 700
),
)),
'teams-regex-subject-ignore' => new TextboxField([
'label' => $__('Ignore when subject equals regex'),
'hint' => $__('Auto delimited, always case-insensitive'),
'configuration' => [
'size' => 30,
'length' => 200
],
]),
'teams-csv-departmentid' => new TextboxField([
'label' => $__('Ignore department ids'),
'hint' => $__('Comma delimited, ints'),
'configuration' => [
'size' => 30,
'length' => 200
],
]),
'teams-message-display' => new BooleanField([
'label' => $__('Display ticket message body in notification.'),
'hint' => $__('Uncheck to hide messages.'),
'default' => TRUE
])
);
}
}