@@ -27,57 +27,57 @@ |
||
| 27 | 27 | |
| 28 | 28 | class Application extends \OCP\AppFramework\App { |
| 29 | 29 | |
| 30 | - public function __construct() { |
|
| 31 | - parent::__construct('workflowengine'); |
|
| 30 | + public function __construct() { |
|
| 31 | + parent::__construct('workflowengine'); |
|
| 32 | 32 | |
| 33 | - $this->getContainer()->registerAlias('FlowOperationsController', FlowOperations::class); |
|
| 34 | - $this->getContainer()->registerAlias('RequestTimeController', RequestTime::class); |
|
| 35 | - } |
|
| 33 | + $this->getContainer()->registerAlias('FlowOperationsController', FlowOperations::class); |
|
| 34 | + $this->getContainer()->registerAlias('RequestTimeController', RequestTime::class); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * Register all hooks and listeners |
|
| 39 | - */ |
|
| 40 | - public function registerHooksAndListeners() { |
|
| 41 | - $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 42 | - $dispatcher->addListener( |
|
| 43 | - 'OCP\WorkflowEngine::loadAdditionalSettingScripts', |
|
| 44 | - function() { |
|
| 45 | - if (!function_exists('style')) { |
|
| 46 | - // This is hacky, but we need to load the template class |
|
| 47 | - class_exists(Template::class, true); |
|
| 48 | - } |
|
| 37 | + /** |
|
| 38 | + * Register all hooks and listeners |
|
| 39 | + */ |
|
| 40 | + public function registerHooksAndListeners() { |
|
| 41 | + $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); |
|
| 42 | + $dispatcher->addListener( |
|
| 43 | + 'OCP\WorkflowEngine::loadAdditionalSettingScripts', |
|
| 44 | + function() { |
|
| 45 | + if (!function_exists('style')) { |
|
| 46 | + // This is hacky, but we need to load the template class |
|
| 47 | + class_exists(Template::class, true); |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - style('workflowengine', [ |
|
| 51 | - 'admin', |
|
| 52 | - ]); |
|
| 50 | + style('workflowengine', [ |
|
| 51 | + 'admin', |
|
| 52 | + ]); |
|
| 53 | 53 | |
| 54 | - script('core', [ |
|
| 55 | - 'files/fileinfo', |
|
| 56 | - 'files/client', |
|
| 57 | - 'systemtags/systemtags', |
|
| 58 | - 'systemtags/systemtagmodel', |
|
| 59 | - 'systemtags/systemtagscollection', |
|
| 60 | - ]); |
|
| 54 | + script('core', [ |
|
| 55 | + 'files/fileinfo', |
|
| 56 | + 'files/client', |
|
| 57 | + 'systemtags/systemtags', |
|
| 58 | + 'systemtags/systemtagmodel', |
|
| 59 | + 'systemtags/systemtagscollection', |
|
| 60 | + ]); |
|
| 61 | 61 | |
| 62 | - vendor_script('jsTimezoneDetect/jstz'); |
|
| 62 | + vendor_script('jsTimezoneDetect/jstz'); |
|
| 63 | 63 | |
| 64 | - script('workflowengine', [ |
|
| 65 | - 'admin', |
|
| 66 | - 'templates', |
|
| 64 | + script('workflowengine', [ |
|
| 65 | + 'admin', |
|
| 66 | + 'templates', |
|
| 67 | 67 | |
| 68 | - // Check plugins |
|
| 69 | - 'filemimetypeplugin', |
|
| 70 | - 'filenameplugin', |
|
| 71 | - 'filesizeplugin', |
|
| 72 | - 'filesystemtagsplugin', |
|
| 73 | - 'requestremoteaddressplugin', |
|
| 74 | - 'requesttimeplugin', |
|
| 75 | - 'requesturlplugin', |
|
| 76 | - 'requestuseragentplugin', |
|
| 77 | - 'usergroupmembershipplugin', |
|
| 78 | - ]); |
|
| 79 | - }, |
|
| 80 | - -100 |
|
| 81 | - ); |
|
| 82 | - } |
|
| 68 | + // Check plugins |
|
| 69 | + 'filemimetypeplugin', |
|
| 70 | + 'filenameplugin', |
|
| 71 | + 'filesizeplugin', |
|
| 72 | + 'filesystemtagsplugin', |
|
| 73 | + 'requestremoteaddressplugin', |
|
| 74 | + 'requesttimeplugin', |
|
| 75 | + 'requesturlplugin', |
|
| 76 | + 'requestuseragentplugin', |
|
| 77 | + 'usergroupmembershipplugin', |
|
| 78 | + ]); |
|
| 79 | + }, |
|
| 80 | + -100 |
|
| 81 | + ); |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -35,63 +35,63 @@ |
||
| 35 | 35 | |
| 36 | 36 | class Application extends App { |
| 37 | 37 | |
| 38 | - public function __construct (array $urlParams = array()) { |
|
| 39 | - parent::__construct('comments', $urlParams); |
|
| 40 | - $container = $this->getContainer(); |
|
| 38 | + public function __construct (array $urlParams = array()) { |
|
| 39 | + parent::__construct('comments', $urlParams); |
|
| 40 | + $container = $this->getContainer(); |
|
| 41 | 41 | |
| 42 | - $container->registerAlias('NotificationsController', Notifications::class); |
|
| 42 | + $container->registerAlias('NotificationsController', Notifications::class); |
|
| 43 | 43 | |
| 44 | - $jsSettingsHelper = new JSSettingsHelper($container->getServer()); |
|
| 45 | - Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend'); |
|
| 46 | - } |
|
| 44 | + $jsSettingsHelper = new JSSettingsHelper($container->getServer()); |
|
| 45 | + Util::connectHook('\OCP\Config', 'js', $jsSettingsHelper, 'extend'); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - public function register() { |
|
| 49 | - $server = $this->getContainer()->getServer(); |
|
| 48 | + public function register() { |
|
| 49 | + $server = $this->getContainer()->getServer(); |
|
| 50 | 50 | |
| 51 | - $dispatcher = $server->getEventDispatcher(); |
|
| 52 | - $this->registerSidebarScripts($dispatcher); |
|
| 53 | - $this->registerDavEntity($dispatcher); |
|
| 54 | - $this->registerNotifier(); |
|
| 55 | - $this->registerCommentsEventHandler(); |
|
| 51 | + $dispatcher = $server->getEventDispatcher(); |
|
| 52 | + $this->registerSidebarScripts($dispatcher); |
|
| 53 | + $this->registerDavEntity($dispatcher); |
|
| 54 | + $this->registerNotifier(); |
|
| 55 | + $this->registerCommentsEventHandler(); |
|
| 56 | 56 | |
| 57 | - $server->getSearch()->registerProvider(Provider::class, ['apps' => ['files']]); |
|
| 58 | - } |
|
| 57 | + $server->getSearch()->registerProvider(Provider::class, ['apps' => ['files']]); |
|
| 58 | + } |
|
| 59 | 59 | |
| 60 | - protected function registerSidebarScripts(EventDispatcherInterface $dispatcher) { |
|
| 61 | - $dispatcher->addListener( |
|
| 62 | - 'OCA\Files::loadAdditionalScripts', |
|
| 63 | - function() { |
|
| 64 | - Util::addScript('comments', 'merged'); |
|
| 65 | - Util::addStyle('comments', 'autocomplete'); |
|
| 66 | - Util::addStyle('comments', 'comments'); |
|
| 67 | - } |
|
| 68 | - ); |
|
| 69 | - } |
|
| 60 | + protected function registerSidebarScripts(EventDispatcherInterface $dispatcher) { |
|
| 61 | + $dispatcher->addListener( |
|
| 62 | + 'OCA\Files::loadAdditionalScripts', |
|
| 63 | + function() { |
|
| 64 | + Util::addScript('comments', 'merged'); |
|
| 65 | + Util::addStyle('comments', 'autocomplete'); |
|
| 66 | + Util::addStyle('comments', 'comments'); |
|
| 67 | + } |
|
| 68 | + ); |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - protected function registerDavEntity(EventDispatcherInterface $dispatcher) { |
|
| 72 | - $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { |
|
| 73 | - $event->addEntityCollection('files', function($name) { |
|
| 74 | - $nodes = \OC::$server->getUserFolder()->getById((int)$name); |
|
| 75 | - return !empty($nodes); |
|
| 76 | - }); |
|
| 77 | - }); |
|
| 78 | - } |
|
| 71 | + protected function registerDavEntity(EventDispatcherInterface $dispatcher) { |
|
| 72 | + $dispatcher->addListener(CommentsEntityEvent::EVENT_ENTITY, function(CommentsEntityEvent $event) { |
|
| 73 | + $event->addEntityCollection('files', function($name) { |
|
| 74 | + $nodes = \OC::$server->getUserFolder()->getById((int)$name); |
|
| 75 | + return !empty($nodes); |
|
| 76 | + }); |
|
| 77 | + }); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - protected function registerNotifier() { |
|
| 81 | - $this->getContainer()->getServer()->getNotificationManager()->registerNotifier( |
|
| 82 | - function() { |
|
| 83 | - return $this->getContainer()->query(Notifier::class); |
|
| 84 | - }, |
|
| 85 | - function () { |
|
| 86 | - $l = $this->getContainer()->getServer()->getL10NFactory()->get('comments'); |
|
| 87 | - return ['id' => 'comments', 'name' => $l->t('Comments')]; |
|
| 88 | - } |
|
| 89 | - ); |
|
| 90 | - } |
|
| 80 | + protected function registerNotifier() { |
|
| 81 | + $this->getContainer()->getServer()->getNotificationManager()->registerNotifier( |
|
| 82 | + function() { |
|
| 83 | + return $this->getContainer()->query(Notifier::class); |
|
| 84 | + }, |
|
| 85 | + function () { |
|
| 86 | + $l = $this->getContainer()->getServer()->getL10NFactory()->get('comments'); |
|
| 87 | + return ['id' => 'comments', 'name' => $l->t('Comments')]; |
|
| 88 | + } |
|
| 89 | + ); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - protected function registerCommentsEventHandler() { |
|
| 93 | - $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () { |
|
| 94 | - return $this->getContainer()->query(EventHandler::class); |
|
| 95 | - }); |
|
| 96 | - } |
|
| 92 | + protected function registerCommentsEventHandler() { |
|
| 93 | + $this->getContainer()->getServer()->getCommentsManager()->registerEventHandler(function () { |
|
| 94 | + return $this->getContainer()->query(EventHandler::class); |
|
| 95 | + }); |
|
| 96 | + } |
|
| 97 | 97 | } |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | |
| 22 | 22 | script('core', [ |
| 23 | - 'systemtags/systemtags', |
|
| 24 | - 'systemtags/systemtagmodel', |
|
| 25 | - 'systemtags/systemtagscollection', |
|
| 23 | + 'systemtags/systemtags', |
|
| 24 | + 'systemtags/systemtagmodel', |
|
| 25 | + 'systemtags/systemtagscollection', |
|
| 26 | 26 | ]); |
| 27 | 27 | |
| 28 | 28 | script('systemtags', 'admin'); |
@@ -30,21 +30,21 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $eventDispatcher = \OC::$server->getEventDispatcher(); |
| 32 | 32 | $eventDispatcher->addListener( |
| 33 | - 'OCA\Files::loadAdditionalScripts', |
|
| 34 | - function() { |
|
| 35 | - // FIXME: no public API for these ? |
|
| 36 | - \OCP\Util::addScript('systemtags/merged'); |
|
| 37 | - \OCP\Util::addScript('systemtags', 'merged'); |
|
| 38 | - \OCP\Util::addStyle('systemtags'); |
|
| 39 | - \OCP\Util::addStyle('systemtags', 'systemtagsfilelist'); |
|
| 40 | - } |
|
| 33 | + 'OCA\Files::loadAdditionalScripts', |
|
| 34 | + function() { |
|
| 35 | + // FIXME: no public API for these ? |
|
| 36 | + \OCP\Util::addScript('systemtags/merged'); |
|
| 37 | + \OCP\Util::addScript('systemtags', 'merged'); |
|
| 38 | + \OCP\Util::addStyle('systemtags'); |
|
| 39 | + \OCP\Util::addStyle('systemtags', 'systemtagsfilelist'); |
|
| 40 | + } |
|
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | $managerListener = function(ManagerEvent $event) { |
| 44 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
| 45 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 46 | - $listener = $application->getContainer()->query(Listener::class); |
|
| 47 | - $listener->event($event); |
|
| 44 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
| 45 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 46 | + $listener = $application->getContainer()->query(Listener::class); |
|
| 47 | + $listener->event($event); |
|
| 48 | 48 | }; |
| 49 | 49 | |
| 50 | 50 | $eventDispatcher->addListener(ManagerEvent::EVENT_CREATE, $managerListener); |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | $eventDispatcher->addListener(ManagerEvent::EVENT_UPDATE, $managerListener); |
| 53 | 53 | |
| 54 | 54 | $mapperListener = function(MapperEvent $event) { |
| 55 | - $application = new \OCP\AppFramework\App('systemtags'); |
|
| 56 | - /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 57 | - $listener = $application->getContainer()->query(Listener::class); |
|
| 58 | - $listener->mapperEvent($event); |
|
| 55 | + $application = new \OCP\AppFramework\App('systemtags'); |
|
| 56 | + /** @var \OCA\SystemTags\Activity\Listener $listener */ |
|
| 57 | + $listener = $application->getContainer()->query(Listener::class); |
|
| 58 | + $listener->mapperEvent($event); |
|
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | $eventDispatcher->addListener(MapperEvent::EVENT_ASSIGN, $mapperListener); |
| 62 | 62 | $eventDispatcher->addListener(MapperEvent::EVENT_UNASSIGN, $mapperListener); |
| 63 | 63 | |
| 64 | 64 | \OCA\Files\App::getNavigationManager()->add(function () { |
| 65 | - $l = \OC::$server->getL10N('systemtags'); |
|
| 66 | - return [ |
|
| 67 | - 'id' => 'systemtagsfilter', |
|
| 68 | - 'appname' => 'systemtags', |
|
| 69 | - 'script' => 'list.php', |
|
| 70 | - 'order' => 25, |
|
| 71 | - 'name' => $l->t('Tags'), |
|
| 72 | - ]; |
|
| 65 | + $l = \OC::$server->getL10N('systemtags'); |
|
| 66 | + return [ |
|
| 67 | + 'id' => 'systemtagsfilter', |
|
| 68 | + 'appname' => 'systemtags', |
|
| 69 | + 'script' => 'list.php', |
|
| 70 | + 'order' => 25, |
|
| 71 | + 'name' => $l->t('Tags'), |
|
| 72 | + ]; |
|
| 73 | 73 | }); |
| 74 | 74 | |