diff --git a/w2g2/appinfo/app.php b/w2g2/appinfo/app.php
index bd69454..9725378 100644
--- a/w2g2/appinfo/app.php
+++ b/w2g2/appinfo/app.php
@@ -2,39 +2,7 @@
namespace OCA\w2g2;
-use OCA\w2g2\Notification\Notifier;
+use \OCA\w2g2\AppInfo\Application;
-
-class App {
- const name = 'w2g2';
- const table = 'locks_w2g2';
-
- public static function launch()
- {
- if ( ! \OC::$server->getUserSession()->getUser()) {
- return;
- }
-
- \OCP\Util::addScript(self::name, 'w2g2');
-
- \OCP\Util::addStyle(self::name, 'styles');
- }
-}
-
-if (\OC::$server->getAppManager()->isEnabledForUser(App::name)) {
- App::launch();
-
- $notificationManager = \OC::$server->getNotificationManager();
- $notificationManager->registerNotifier(
- function() {
- $Application = new \OCP\AppFramework\App('w2g2');
-
- return $Application->getContainer()->query(Notifier::class);
- },
- function () {
- $l = \OC::$server->getL10N('w2g2');
-
- return ['id' => 'w2g2', 'name' => $l->t('w2g2')];
- }
- );
-}
+$app = new Application();
+$app->boot();
diff --git a/w2g2/appinfo/database.xml b/w2g2/appinfo/database.xml
index ef2eeca..d6ba427 100644
--- a/w2g2/appinfo/database.xml
+++ b/w2g2/appinfo/database.xml
@@ -31,8 +31,7 @@
created
timestamp
- CURRENT_TIMESTAMP
-
\ No newline at end of file
+
diff --git a/w2g2/appinfo/info.xml b/w2g2/appinfo/info.xml
index aabe1e7..747767e 100644
--- a/w2g2/appinfo/info.xml
+++ b/w2g2/appinfo/info.xml
@@ -14,7 +14,7 @@
AGPL
Ionut Orzu
- 2.2.6
+ 2.2.7
social
files
diff --git a/w2g2/js/w2g2.js b/w2g2/js/w2g2.js
index e7145e1..f0ce62a 100644
--- a/w2g2/js/w2g2.js
+++ b/w2g2/js/w2g2.js
@@ -8,7 +8,6 @@
var checkStateUrl = OC.generateUrl('/apps/w2g2/lock');
var directoryLockUrl = OC.generateUrl('/apps/w2g2/directory-lock');
var colorUrl = OC.generateUrl('/apps/w2g2/color');
- var lockstate = t('w2g2', 'Locked');
$(document).ready(function () {
getBackgroundColor();
diff --git a/w2g2/lib/AppInfo/Application.php b/w2g2/lib/AppInfo/Application.php
new file mode 100644
index 0000000..1abaaad
--- /dev/null
+++ b/w2g2/lib/AppInfo/Application.php
@@ -0,0 +1,52 @@
+getAppManager()->isEnabledForUser(self::name)) {
+ return;
+ }
+
+ $this->registerHooks();
+ $this->registerScripts();
+ }
+
+ public function registerHooks()
+ {
+ $notificationManager = \OC::$server->getNotificationManager();
+ $notificationManager->registerNotifier(
+ function() {
+ $Application = new \OCP\AppFramework\App('w2g2');
+
+ return $Application->getContainer()->query(Notifier::class);
+ },
+ function () {
+ $l = \OC::$server->getL10N('w2g2');
+
+ return ['id' => 'w2g2', 'name' => $l->t('w2g2')];
+ }
+ );
+ }
+
+ public function registerScripts()
+ {
+ $eventDispatcher = \OC::$server->getEventDispatcher();
+ $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', function() {
+ script(self::name, 'w2g2');
+ style(self::name, 'styles');
+ });
+ }
+}
diff --git a/w2g2/lib/Db/AdminMapper.php b/w2g2/lib/Db/AdminMapper.php
index 5362f4a..0de1a01 100644
--- a/w2g2/lib/Db/AdminMapper.php
+++ b/w2g2/lib/Db/AdminMapper.php
@@ -40,7 +40,14 @@ public function getLocks()
}
} else if ($fileIndex === 0) {
$filePath = substr($lockedFiles[$i]['path'], strlen('files/'));
- $lockedFiles[$i]['path'] = $lockedFiles[$i]['locked_by'] . '/' . $filePath;
+
+ $path = $lockedFiles[$i]['locked_by'] . '/' . $filePath;
+
+ if ($lockedFiles[$i]['created']) {
+ $path .= ' --- Created: ' . $lockedFiles[$i]['created'];
+ }
+
+ $lockedFiles[$i]['path'] = $path;
}
}
diff --git a/w2g2/lib/Db/LockMapper.php b/w2g2/lib/Db/LockMapper.php
index 14031f7..b6a2778 100644
--- a/w2g2/lib/Db/LockMapper.php
+++ b/w2g2/lib/Db/LockMapper.php
@@ -13,7 +13,7 @@ public function __construct(IDbConnection $db)
public function all()
{
- $query = "SELECT f.path, f.fileid, l.locked_by FROM " . $this->tableName . " AS l JOIN *PREFIX*" . 'filecache' . " as f ON l.file_id = f.fileid";
+ $query = "SELECT f.path, f.fileid, l.locked_by, l.created FROM " . $this->tableName . " AS l JOIN *PREFIX*" . 'filecache' . " as f ON l.file_id = f.fileid";
return $this->db->executeQuery($query)
->fetchAll();
@@ -35,9 +35,13 @@ public function findAll()
public function store(Lock $lock)
{
- $sql = 'INSERT INTO ' . $this->tableName . ' (file_id, locked_by) VALUES (?, ?)';
+ $sql = 'INSERT INTO ' . $this->tableName . ' (file_id, locked_by, created) VALUES (?, ?, ?)';
- $this->db->executeQuery($sql, [$lock->getFileId(), $lock->getLockedBy()]);
+ $this->db->executeQuery($sql, [
+ $lock->getFileId(),
+ $lock->getLockedBy(),
+ date('Y-m-s H:i:s')
+ ]);
}
public function deleteOne(Lock $lock)
diff --git a/w2g2/lib/File.php b/w2g2/lib/File.php
index b5874d4..36a6642 100644
--- a/w2g2/lib/File.php
+++ b/w2g2/lib/File.php
@@ -70,7 +70,13 @@ public function isGroupFolder()
public function getParentId()
{
- return ($this->getCompleteData())['parent'];
+ $data = $this->getCompleteData();
+
+ if ( ! $data) {
+ return null;
+ }
+
+ return $data['parent'];
}
public function getCompleteData()
diff --git a/w2g2/templates/admin.php b/w2g2/templates/admin.php
index f6bbd42..65529e2 100644
--- a/w2g2/templates/admin.php
+++ b/w2g2/templates/admin.php
@@ -64,42 +64,42 @@ class="color"
0) {
- ?>
+ if (count($_['lockedFiles']) > 0) {
+ ?>
-
- t("There are no locked files at the moment"));
- }
+ t("There are no locked files at the moment"));
+ }
?>
@@ -121,11 +121,11 @@ class="color"
+
>