diff --git a/w2g2/appinfo/info.xml b/w2g2/appinfo/info.xml
index 2b8a766..2b89357 100644
--- a/w2g2/appinfo/info.xml
+++ b/w2g2/appinfo/info.xml
@@ -14,7 +14,7 @@
AGPL
Ionut Orzu
- 3.0.5
+ 3.2.6
social
files
@@ -42,7 +42,7 @@
- OCA\w2g2\Controller\AdminController
+ OCA\w2g2\Settings\AdminSettings
diff --git a/w2g2/js/w2g2.js b/w2g2/js/w2g2.js
index 4ba3031..a79b826 100644
--- a/w2g2/js/w2g2.js
+++ b/w2g2/js/w2g2.js
@@ -42,11 +42,14 @@
//Walk through all files in the active Filelist
$('#content').delegate('#fileList', 'fileActionsReady', function (event) {
+ window.x = event.$files;
+
for (var i = 0; i < event.$files.length; i++) {
var file = event.$files[i][0];
var $file = $(file);
- if ($file && $file.hasOwnProperty('context')) {
+ // if ($file && $file.hasOwnProperty('context')) {
+ if ($file) {
files.push([
$file.attr('data-id'),
$file.attr('data-file'),
diff --git a/w2g2/lib/Activity/EventHandler.php b/w2g2/lib/Activity/EventHandler.php
index 089a12c..bc1bb11 100644
--- a/w2g2/lib/Activity/EventHandler.php
+++ b/w2g2/lib/Activity/EventHandler.php
@@ -9,7 +9,8 @@ class EventHandler {
private $activityListener;
private $notificationListener;
- public function __construct(ActivityListener $activityListener, NotificationListener $notificationListener) {
+ public function __construct(ActivityListener $activityListener, NotificationListener $notificationListener)
+ {
$this->activityListener = $activityListener;
$this->notificationListener = $notificationListener;
}
diff --git a/w2g2/lib/AppInfo/Application.php b/w2g2/lib/AppInfo/Application.php
index 2f2ab5c..861c8d6 100644
--- a/w2g2/lib/AppInfo/Application.php
+++ b/w2g2/lib/AppInfo/Application.php
@@ -2,19 +2,19 @@
namespace OCA\w2g2\AppInfo;
-use OCA\w2g2\Activity\ActivityListener;
-use OCA\w2g2\Activity\EventHandler;
-use OCA\w2g2\File;
-use OCA\w2g2\Notification\NotificationListener;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Notification\IManager;
+use OCP\IUserManager;
+use OCP\App\IAppManager;
+use OCP\IUserSession;
+use OCP\Files\Config\IUserMountCache;
use Psr\Container\ContainerInterface;
use OCA\w2g2\Notification\Notifier;
-use OCA\w2g2\Controller\AdminController;
+use OCA\w2g2\Controller\AdminSettings;
use OCA\w2g2\Controller\ConfigController;
use OCA\w2g2\Controller\LockController;
use OCA\w2g2\Service\AdminService;
@@ -27,6 +27,9 @@
use OCA\w2g2\Db\FileMapper;
use OCA\w2g2\Db\GroupFolderMapper;
use OCA\w2g2\Db\LockMapper;
+use OCA\w2g2\Activity\ActivityListener;
+use OCA\w2g2\File;
+use OCA\w2g2\Notification\NotificationListener;
class Application extends App implements IBootstrap
{
@@ -41,7 +44,7 @@ public function __construct()
$this->registerMappers($container);
$this->registerServices($container);
$this->registerControllers($container);
- $this->registerVarious($container);
+// $this->registerVarious($container);
}
public function boot(IBootContext $context): void
@@ -76,15 +79,6 @@ public function registerScripts()
protected function registerControllers($container)
{
- $container->registerService('AdminController', function(ContainerInterface $c){
- return new AdminController(
- $c->get('AppName'),
- $c->get('Request'),
- $c->get('ConfigService'),
- $c->get('AdminService')
- );
- });
-
$container->registerService('ConfigController', function(ContainerInterface $c){
return new ConfigController(
$c->get('AppName'),
@@ -184,26 +178,18 @@ protected function registerVarious($container)
{
$container->registerService('ActivityListener', function(ContainerInterface $c){
return new ActivityListener(
- $c->get('IManager'),
- $c->get('IUserSession'),
- $c->get('IAppManager'),
- $c->get('IUserMountCache')
+ $c->query(IManager::class),
+ $c->query(IUserSession::class),
+ $c->query(IAppManager::class),
+ $c->query(IUserMountCache::class)
);
});
$container->registerService('NotificationListener', function(ContainerInterface $c){
return new NotificationListener(
- $c->get('IManager'),
- $c->get('IUserManager'),
+ $c->query(IManager::class),
$c->get('FavoriteMapper')
);
});
-
- $container->registerService('EventHandler', function(ContainerInterface $c){
- return new EventHandler(
- $c->get('ActivityListener'),
- $c->get('NotificationListener')
- );
- });
}
}
diff --git a/w2g2/lib/Event.php b/w2g2/lib/Event.php
index 94067a8..158663e 100644
--- a/w2g2/lib/Event.php
+++ b/w2g2/lib/Event.php
@@ -3,9 +3,9 @@
namespace OCA\w2g2;
use OCA\w2g2\Activity\FileLockEvent;
-use OCA\w2g2\Activity\EventHandler;
-class Event {
+class Event
+{
public static function emit($type, $fileId, $lockerUser)
{
$eventType = $type === 'lock' ? FileLockEvent::EVENT_LOCK : FileLockEvent::EVENT_UNLOCK;
@@ -14,7 +14,7 @@ public static function emit($type, $fileId, $lockerUser)
$app = new \OCP\AppFramework\App('w2g2');
- $eventHandler = $app->getContainer()->query(EventHandler::class);
+ $eventHandler = $app->getContainer()->query('OCA\w2g2\Activity\EventHandler');
$eventHandler->handle($fileLockEvent);
}
}
diff --git a/w2g2/lib/Notification/NotificationListener.php b/w2g2/lib/Notification/NotificationListener.php
index 7ba145b..1b4b72a 100644
--- a/w2g2/lib/Notification/NotificationListener.php
+++ b/w2g2/lib/Notification/NotificationListener.php
@@ -2,30 +2,18 @@
namespace OCA\w2g2\Notification;
-use OCP\IUserManager;
-use OCP\Notification\IManager;
use OCA\w2g2\Activity\FileLockEvent;
use OCA\w2g2\Db\FavoriteMapper;
-class NotificationListener {
- /** @var IManager */
+class NotificationListener
+{
protected $notificationManager;
- /** @var IUserManager */
- protected $userManager;
-
protected $favoriteMapper;
- /**
- * Listener constructor.
- *
- * @param IManager $notificationManager
- * @param IUserManager $userManager
- */
- public function __construct(IManager $notificationManager, IUserManager $userManager, FavoriteMapper $favoriteMapper)
+ public function __construct(FavoriteMapper $favoriteMapper)
{
- $this->notificationManager = $notificationManager;
- $this->userManager = $userManager;
+ $this->notificationManager = \OC::$server->get(\OCP\Notification\IManager::class);
$this->favoriteMapper = $favoriteMapper;
}
diff --git a/w2g2/lib/Controller/AdminController.php b/w2g2/lib/Settings/AdminSettings.php
similarity index 75%
rename from w2g2/lib/Controller/AdminController.php
rename to w2g2/lib/Settings/AdminSettings.php
index 72982cd..dedd839 100644
--- a/w2g2/lib/Controller/AdminController.php
+++ b/w2g2/lib/Settings/AdminSettings.php
@@ -1,27 +1,24 @@
appName = 'w2g2';
+
+ $app = new \OCP\AppFramework\App('w2g2');
- $this->appName = $AppName;
- $this->configService = $configService;
- $this->adminService = $adminService;
+ $this->configService = $app->getContainer()->get('ConfigService');
+ $this->adminService = $app->getContainer()->get('AdminService');
}
public function getForm()
@@ -38,7 +35,7 @@ public function getForm()
'lockingByUsername' => $lockingByNameRule === "rule_username" ? 'checked' : '',
'lockingByDisplayName' => $lockingByNameRule === "rule_displayname" ? 'checked' : '',
-
+
'directoryLockingAll' => $directoryLock === "directory_locking_all",
'directoryLockingFiles' => $directoryLock === "directory_locking_files",
'directoryLockingNone' => $directoryLock === "directory_locking_none",