2015-11-30 17:40:17 +03:00
|
|
|
<?php
|
|
|
|
/**
|
2016-07-21 17:49:16 +03:00
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc.
|
|
|
|
*
|
2020-04-29 12:57:22 +03:00
|
|
|
* @author Christoph Wurst <christoph@winzerhof-wurst.at>
|
2016-07-21 17:49:16 +03:00
|
|
|
* @author Joas Schilling <coding@schilljs.com>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Jörn Friedrich Dreyer <jfd@butonic.de>
|
2019-12-03 21:57:53 +03:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
2017-11-06 17:56:42 +03:00
|
|
|
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
2015-11-30 17:40:17 +03:00
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
2019-12-03 21:57:53 +03:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
2015-11-30 17:40:17 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-02-01 17:16:05 +03:00
|
|
|
use OCP\SystemTag\ManagerEvent;
|
2016-02-01 18:57:51 +03:00
|
|
|
use OCP\SystemTag\MapperEvent;
|
2018-01-26 01:16:13 +03:00
|
|
|
use OCA\SystemTags\Activity\Listener;
|
2016-02-01 17:16:05 +03:00
|
|
|
|
2015-11-30 17:40:17 +03:00
|
|
|
$eventDispatcher = \OC::$server->getEventDispatcher();
|
|
|
|
$eventDispatcher->addListener(
|
|
|
|
'OCA\Files::loadAdditionalScripts',
|
2020-04-09 14:53:40 +03:00
|
|
|
function () {
|
2015-11-30 17:40:17 +03:00
|
|
|
// FIXME: no public API for these ?
|
2019-02-04 18:53:54 +03:00
|
|
|
\OCP\Util::addScript('dist/systemtags');
|
2019-02-14 00:54:48 +03:00
|
|
|
\OCP\Util::addScript('systemtags', 'systemtags');
|
2015-11-30 17:40:17 +03:00
|
|
|
}
|
|
|
|
);
|
2016-02-01 17:16:05 +03:00
|
|
|
|
2020-04-09 14:53:40 +03:00
|
|
|
$managerListener = function (ManagerEvent $event) {
|
2016-02-02 13:12:16 +03:00
|
|
|
/** @var \OCA\SystemTags\Activity\Listener $listener */
|
2019-11-04 21:25:00 +03:00
|
|
|
$listener = \OC::$server->query(Listener::class);
|
2016-02-01 17:16:05 +03:00
|
|
|
$listener->event($event);
|
|
|
|
};
|
|
|
|
|
|
|
|
$eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener);
|
|
|
|
$eventDispatcher->addListener(ManagerEvent::EVENT_DELETE, $managerListener);
|
|
|
|
$eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener);
|
2016-02-01 18:57:51 +03:00
|
|
|
|
2020-04-09 14:53:40 +03:00
|
|
|
$mapperListener = function (MapperEvent $event) {
|
2016-02-01 18:57:51 +03:00
|
|
|
$application = new \OCP\AppFramework\App('systemtags');
|
2016-02-02 13:12:16 +03:00
|
|
|
/** @var \OCA\SystemTags\Activity\Listener $listener */
|
2019-11-04 21:25:00 +03:00
|
|
|
$listener = \OC::$server->query(Listener::class);
|
2016-02-01 18:57:51 +03:00
|
|
|
$listener->mapperEvent($event);
|
|
|
|
};
|
|
|
|
|
|
|
|
$eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener);
|
|
|
|
$eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener);
|
2016-02-08 13:43:42 +03:00
|
|
|
|
2017-03-08 02:19:24 +03:00
|
|
|
\OCA\Files\App::getNavigationManager()->add(function () {
|
|
|
|
$l = \OC::$server->getL10N('systemtags');
|
|
|
|
return [
|
2016-02-08 13:43:42 +03:00
|
|
|
'id' => 'systemtagsfilter',
|
|
|
|
'appname' => 'systemtags',
|
|
|
|
'script' => 'list.php',
|
2016-02-26 11:52:29 +03:00
|
|
|
'order' => 25,
|
2017-03-08 02:19:24 +03:00
|
|
|
'name' => $l->t('Tags'),
|
|
|
|
];
|
|
|
|
});
|