|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2018 Julius Härtl <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @author Julius Härtl <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @license GNU AGPL version 3 or any later version |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
12
|
|
|
* License, or (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU Affero General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21
|
|
|
* |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
namespace OCP\AppFramework\Http\Template; |
|
25
|
|
|
|
|
26
|
|
|
use OCP\AppFramework\Http\Template\SimpleMenuAction; |
|
27
|
|
|
use OCP\Util; |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Class LinkMenuAction |
|
31
|
|
|
* |
|
32
|
|
|
* @package OCP\AppFramework\Http\Template |
|
33
|
|
|
* @since 14.0.0 |
|
34
|
|
|
*/ |
|
35
|
|
|
class LinkMenuAction extends SimpleMenuAction { |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* LinkMenuAction constructor. |
|
39
|
|
|
* |
|
40
|
|
|
* @param string $label |
|
41
|
|
|
* @param string $icon |
|
42
|
|
|
* @param string $link |
|
43
|
|
|
* @since 14.0.0 |
|
44
|
|
|
*/ |
|
45
|
|
|
public function __construct(string $label, string $icon, string $link) { |
|
46
|
|
|
parent::__construct('directLink-container', $label, $icon, $link); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @return string |
|
51
|
|
|
* @since 14.0.0 |
|
52
|
|
|
*/ |
|
53
|
|
|
public function render(): string { |
|
54
|
|
|
return '<li>' . |
|
55
|
|
|
'<a id="directLink-container">' . |
|
56
|
|
|
'<span class="icon ' . Util::sanitizeHTML($this->getIcon()) . '"></span>' . |
|
57
|
|
|
'<label for="directLink">' . Util::sanitizeHTML($this->getLabel()) . '</label>' . |
|
58
|
|
|
'</a>' . |
|
59
|
|
|
'</li>' . |
|
60
|
|
|
'<li>' . |
|
61
|
|
|
'<span class="menuitem">' . |
|
62
|
|
|
'<input id="directLink" type="text" readonly="" value="' . Util::sanitizeHTML($this->getLink()) . '">' . |
|
63
|
|
|
'</span>' . |
|
64
|
|
|
'</li>'; |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|