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
|
<?php
/**
* ownCloud - gallery application
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Olivier Paroz <owncloud@interfasys.ch>
* @author Robin Appelman <icewind@owncloud.com>
*
* @copyright Olivier Paroz 2014-2015
* @copyright Robin Appelman 2014-2015
*/
namespace OCA\Gallery\AppInfo;
use OCP\Util;
$app = new Application();
$c = $app->getContainer();
$appName = $c->query('AppName');
/**
* Menu entry in ownCloud
*/
$c->query('OCP\INavigationManager')
->add(
function () use ($c, $appName) {
$urlGenerator = $c->query('OCP\IURLGenerator');
$l10n = $c->query('OCP\IL10N');
return [
'id' => $appName,
// Sorting weight for the navigation. The higher the number, the higher
// will it be listed in the navigation
'order' => 3,
// The route that will be shown on startup when called from within ownCloud
// Public links are using another route, see appinfo/routes.php
'href' => $urlGenerator->linkToRoute($appName . '.page.index'),
// The icon that will be shown in the navigation
// This file needs to exist in img/
'icon' => $urlGenerator->imagePath($appName, 'app.svg'),
// The title of the application. This will be used in the
// navigation or on the settings page
'name' => $l10n->t('Gallery')
];
}
);
/**
* Loading translations
*
* The string has to match the app's folder name
*/
Util::addTranslations('gallery');
// Hack which only loads the scripts in the Files app
$request = $c->query('Request');
if (isset($request->server['REQUEST_URI'])) {
$url = $request->server['REQUEST_URI'];
if (preg_match('%index\.php/apps/files(/.*)?%', $url)
|| preg_match('%index\.php/s/\b(.*)\b(?<!/authenticate)$%', $url)
) {
// @codeCoverageIgnoreStart
/**
* Scripts for the Files app
*/
Util::addScript($appName, 'vendor/bigshot/bigshot-compressed');
Util::addScript($appName, 'vendor/image-scale/image-scale.min');
Util::addScript($appName, 'galleryfileaction');
Util::addScript($appName, 'slideshow');
Util::addScript($appName, 'slideshowcontrols');
Util::addScript($appName, 'slideshowzoomablepreview');
Util::addScript($appName, 'gallerybutton');
/**
* Styles for the Files app
*/
Util::addStyle($appName, 'slideshow');
Util::addStyle($appName, 'gallerybutton');
}
}// @codeCoverageIgnoreEnd
|