Repository navigation
Expand file tree
/
Copy pathconfig.php
More file actions
132 lines (128 loc) · 4.38 KB
/
Copy pathconfig.php
File metadata and controls
132 lines (128 loc) · 4.38 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
require_once INCLUDE_DIR . 'class.plugin.php';
class AttachmentPreviewPluginConfig extends PluginConfig {
// Provide compatibility function for versions of osTicket prior to
// translation support (v1.9.4)
static 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('attachment_preview');
}
/**
* Build an Admin settings page.
*
* {@inheritdoc}
*
* @see PluginConfig::getOptions()
*/
function getOptions() {
list ($__, $_N) = self::translate();
return array(
'attachment-enabled' => new BooleanField(
array(
'label' => $__('Permission'),
'default' => TRUE,
'hint' => 'Check to enable attachments inline, uncheck only allows the API to function.'
)),
'hide-seen' => new BooleanField(
array(
'label' => $__('Hide Seen'),
'default' => FALSE,
'hint' => 'When auto-showing an attachment, store the ID in the users browser, so they can choose to see it again if they want, but are not forced to.'
)),
'hide-age' => new TextboxField(
array(
'label' => $__('Number of days to remember attachments for'),
'default' => '14',
'hint' => $__('Browser storage is not infinite, so we only store seen attachment ids for a short time before they have to auto-see them again.')
)),
'attachment-size' => new TextboxField(
array(
'label' => $__('Max Size'),
'default' => 1024,
'hint' => 'Enter maximum Kilobytes of an attachment to inline. Larger attachments are ignored, use zero (0) to remove limit.'
)),
'attach-pdf' => new BooleanField(
array(
'label' => $__('Inline PDF files as <object>s'),
'default' => TRUE
)),
'attach-image' => new BooleanField(
array(
'label' => $__('Inline image files as <img>s'),
'default' => TRUE
)),
'attach-text' => new BooleanField(
array(
'label' => $__('Inline textfiles (txt,csv) as <pre>'),
'default' => TRUE
)),
'attach-html' => new BooleanField(
array(
'label' => $__('Inline HTML files into a <div>'),
'hint' => $__(
'Dangerous: While we filter/sanitize the HTML, make sure it is something you really need before turning on.'),
'default' => FALSE
)),
'attach-audio' => new BooleanField(
array(
'label' => $__('Inline audio attachments as Players'),
'default' => FALSE
)),
'attach-video' => new BooleanField(
array(
'label' => $__('Inline video attachments as Players'),
'hint' => $__("Embeds video attachments "),
'default' => FALSE
)),
'attach-youtube' => new BooleanField(
array(
'label' => $__('Inline Youtube links to Players'),
'default' => FALSE
)),
'show-ms-upgrade-help' => new BooleanField(
array(
'label' => $__('Show IE upgrade link'),
'hint' => $__(
'Enable help link to abetterbrowser.org for PDFs when on Internet Explorer'),
'default' => TRUE
)),
'show-initially' => new ChoiceField(
array(
'label' => $__('Number of attachments to show initially'),
'default' => "ALL",
'hint' => $__(
'If you find too many attachments displaying at once is slowing you down, change this to only show some of them at first.'),
'choices' => array(
"NONE" => '0',
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10',
"ALL" => $__('All') // Woo.
)
)),
'newtab-links' => new BooleanField(
array(
'label' => $__('Open attachment links in new tab'),
'default' => FALSE,
'hint' => $__(
'Rewrites links to files instructing the browser to open them in a new window/tab based on browser settings, instead of opening in the same window.')
))
);
}
}