@@ -1,39 +0,0 @@
|
|||||||
<?php
|
|
||||||
/**
|
|
||||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
|
||||||
*
|
|
||||||
* @author Julius Härtl <jus@bitgrid.net>
|
|
||||||
*
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use OCA\Deck\AppInfo\Application;
|
|
||||||
use OCP\AppFramework\QueryException;
|
|
||||||
|
|
||||||
if ((@include_once __DIR__ . '/../vendor/autoload.php')=== false) {
|
|
||||||
throw new Exception('Cannot include autoload. Did you run install dependencies using composer?');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
/** @var Application $app */
|
|
||||||
$app = \OC::$server->query(Application::class);
|
|
||||||
$app->register();
|
|
||||||
} catch (QueryException $e) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Load activity style global so it is availabile in the activity app as well */
|
|
||||||
\OC_Util::addStyle('deck', 'activity');
|
|
||||||
@@ -69,4 +69,13 @@
|
|||||||
<provider min-version="16">OCA\Deck\Provider\DeckProvider</provider>
|
<provider min-version="16">OCA\Deck\Provider\DeckProvider</provider>
|
||||||
</fulltextsearch>
|
</fulltextsearch>
|
||||||
|
|
||||||
|
<navigations>
|
||||||
|
<navigation>
|
||||||
|
<name>Deck</name>
|
||||||
|
<route>deck.page.index</route>
|
||||||
|
<icon>deck.svg</icon>
|
||||||
|
<order>10</order>
|
||||||
|
</navigation>
|
||||||
|
</navigations>
|
||||||
|
|
||||||
</info>
|
</info>
|
||||||
|
|||||||
@@ -38,9 +38,13 @@ use OCA\Deck\Db\CardMapper;
|
|||||||
use OCA\Deck\Middleware\DefaultBoardMiddleware;
|
use OCA\Deck\Middleware\DefaultBoardMiddleware;
|
||||||
use OCA\Deck\Middleware\ExceptionMiddleware;
|
use OCA\Deck\Middleware\ExceptionMiddleware;
|
||||||
use OCA\Deck\Notification\Notifier;
|
use OCA\Deck\Notification\Notifier;
|
||||||
|
use OCA\Deck\Search\DeckProvider;
|
||||||
use OCA\Deck\Service\FullTextSearchService;
|
use OCA\Deck\Service\FullTextSearchService;
|
||||||
use OCA\Deck\Service\PermissionService;
|
use OCA\Deck\Service\PermissionService;
|
||||||
use OCP\AppFramework\App;
|
use OCP\AppFramework\App;
|
||||||
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||||
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
use OCP\Collaboration\Resources\IManager;
|
use OCP\Collaboration\Resources\IManager;
|
||||||
use OCP\Collaboration\Resources\IProviderManager;
|
use OCP\Collaboration\Resources\IProviderManager;
|
||||||
use OCP\Comments\CommentsEntityEvent;
|
use OCP\Comments\CommentsEntityEvent;
|
||||||
@@ -48,6 +52,9 @@ use OCP\Dashboard\RegisterWidgetEvent;
|
|||||||
use OCP\EventDispatcher\Event;
|
use OCP\EventDispatcher\Event;
|
||||||
use OCP\EventDispatcher\IEventDispatcher;
|
use OCP\EventDispatcher\IEventDispatcher;
|
||||||
use OCP\FullTextSearch\IFullTextSearchManager;
|
use OCP\FullTextSearch\IFullTextSearchManager;
|
||||||
|
use OCP\IConfig;
|
||||||
|
use OCP\IContainer;
|
||||||
|
use OCP\IDBConnection;
|
||||||
use OCP\IGroup;
|
use OCP\IGroup;
|
||||||
use OCP\IServerContainer;
|
use OCP\IServerContainer;
|
||||||
use OCP\IUser;
|
use OCP\IUser;
|
||||||
@@ -55,7 +62,7 @@ use OCP\IUserManager;
|
|||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
|
||||||
class Application extends App {
|
class Application extends App implements IBootstrap {
|
||||||
public const APP_ID = 'deck';
|
public const APP_ID = 'deck';
|
||||||
|
|
||||||
public const COMMENT_ENTITY_TYPE = 'deckCard';
|
public const COMMENT_ENTITY_TYPE = 'deckCard';
|
||||||
@@ -70,22 +77,28 @@ class Application extends App {
|
|||||||
private $fullTextSearchManager;
|
private $fullTextSearchManager;
|
||||||
|
|
||||||
public function __construct(array $urlParams = []) {
|
public function __construct(array $urlParams = []) {
|
||||||
parent::__construct('deck', $urlParams);
|
parent::__construct(self::APP_ID, $urlParams);
|
||||||
|
|
||||||
$container = $this->getContainer();
|
$this->server = \OC::$server;
|
||||||
$server = $this->getContainer()->getServer();
|
}
|
||||||
|
|
||||||
$this->server = $server;
|
public function boot(IBootContext $context): void {
|
||||||
|
$notificationManager = $context->getServerContainer()->get(\OCP\Notification\IManager::class);
|
||||||
|
$notificationManager->registerNotifierService(Notifier::class);
|
||||||
|
\OCP\Util::addStyle('deck', 'deck');
|
||||||
|
}
|
||||||
|
|
||||||
$container->registerCapability(Capabilities::class);
|
public function register(IRegistrationContext $context): void {
|
||||||
$container->registerMiddleWare(ExceptionMiddleware::class);
|
|
||||||
$container->registerMiddleWare(DefaultBoardMiddleware::class);
|
|
||||||
|
|
||||||
$container->registerService('databaseType', static function () use ($server) {
|
$context->registerCapability(Capabilities::class);
|
||||||
return $server->getConfig()->getSystemValue('dbtype', 'sqlite');
|
$context->registerMiddleWare(ExceptionMiddleware::class);
|
||||||
|
$context->registerMiddleWare(DefaultBoardMiddleware::class);
|
||||||
|
|
||||||
|
$context->registerService('databaseType', static function (IContainer $c) {
|
||||||
|
return $c->get(IConfig::class)->getSystemValue('dbtype', 'sqlite');
|
||||||
});
|
});
|
||||||
$container->registerService('database4ByteSupport', static function () use ($server) {
|
$context->registerService('database4ByteSupport', static function (IContainer $c) {
|
||||||
return $server->getDatabaseConnection()->supports4ByteText();
|
return $c->get(IDBConnection::class)->supports4ByteText();
|
||||||
});
|
});
|
||||||
|
|
||||||
$version = OC_Util::getVersion()[0];
|
$version = OC_Util::getVersion()[0];
|
||||||
@@ -96,31 +109,16 @@ class Application extends App {
|
|||||||
$event->registerWidget(DeckWidget::class);
|
$event->registerWidget(DeckWidget::class);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public function register(): void {
|
$context->registerSearchProvider(DeckProvider::class);
|
||||||
$this->registerNavigationEntry();
|
|
||||||
$this->registerUserGroupHooks();
|
$this->registerUserGroupHooks();
|
||||||
$this->registerNotifications();
|
|
||||||
$this->registerCommentsEntity();
|
$this->registerCommentsEntity();
|
||||||
$this->registerFullTextSearch();
|
$this->registerFullTextSearch();
|
||||||
$this->registerCollaborationResources();
|
$this->registerCollaborationResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerNavigationEntry(): void {
|
|
||||||
$container = $this->getContainer();
|
|
||||||
$this->server->getNavigationManager()->add(static function () use ($container) {
|
|
||||||
$urlGenerator = $container->query(IURLGenerator::class);
|
|
||||||
return [
|
|
||||||
'id' => 'deck',
|
|
||||||
'order' => 10,
|
|
||||||
'href' => $urlGenerator->linkToRoute('deck.page.index'),
|
|
||||||
'icon' => $urlGenerator->imagePath('deck', 'deck.svg'),
|
|
||||||
'name' => 'Deck',
|
|
||||||
];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private function registerUserGroupHooks(): void {
|
private function registerUserGroupHooks(): void {
|
||||||
$container = $this->getContainer();
|
$container = $this->getContainer();
|
||||||
// Delete user/group acl entries when they get deleted
|
// Delete user/group acl entries when they get deleted
|
||||||
@@ -162,11 +160,6 @@ class Application extends App {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function registerNotifications(): void {
|
|
||||||
$notificationManager = $this->server->getNotificationManager();
|
|
||||||
$notificationManager->registerNotifierService(Notifier::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function registerCommentsEntity(): void {
|
public function registerCommentsEntity(): void {
|
||||||
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
|
$this->server->getEventDispatcher()->addListener(CommentsEntityEvent::EVENT_ENTITY, function (CommentsEntityEvent $event) {
|
||||||
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function ($name) {
|
$event->addEntityCollection(self::COMMENT_ENTITY_TYPE, function ($name) {
|
||||||
@@ -184,8 +177,6 @@ class Application extends App {
|
|||||||
$this->registerCommentsEventHandler();
|
$this->registerCommentsEventHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
protected function registerCommentsEventHandler(): void {
|
protected function registerCommentsEventHandler(): void {
|
||||||
$this->server->getCommentsManager()->registerEventHandler(function () {
|
$this->server->getCommentsManager()->registerEventHandler(function () {
|
||||||
return $this->getContainer()->query(CommentEventHandler::class);
|
return $this->getContainer()->query(CommentEventHandler::class);
|
||||||
@@ -194,10 +185,6 @@ class Application extends App {
|
|||||||
|
|
||||||
protected function registerCollaborationResources(): void {
|
protected function registerCollaborationResources(): void {
|
||||||
$version = OC_Util::getVersion()[0];
|
$version = OC_Util::getVersion()[0];
|
||||||
if ($version < 16) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register Collaboration ResourceProvider
|
* Register Collaboration ResourceProvider
|
||||||
*
|
*
|
||||||
|
|||||||
38
lib/Search/CardSearchResultEntry.php
Normal file
38
lib/Search/CardSearchResultEntry.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2020 Julius Härtl <jus@bitgrid.net>
|
||||||
|
*
|
||||||
|
* @author Julius Härtl <jus@bitgrid.net>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
|
||||||
|
namespace OCA\Deck\Search;
|
||||||
|
|
||||||
|
|
||||||
|
use OCA\Deck\Db\Board;
|
||||||
|
use OCP\Search\SearchResultEntry;
|
||||||
|
|
||||||
|
class BoardSearchResultEntry extends SearchResultEntry {
|
||||||
|
|
||||||
|
public function __construct(Board $board, $urlGenerator) {
|
||||||
|
parent::__construct('', $board->getTitle(), '', $urlGenerator->linkToRoute('deck.page.index') . '#/board/' . $board->getId(), 'icon-deck');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user