Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ajax
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-08-28 21:38:17 +0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-08-28 21:38:17 +0400
commite62bae00b44c87f75982a3ec4607b9464791a127 (patch)
tree1720950b752e4b86e04f9679fb27078a44628e18 /ajax
parentd62e723304bcdebaaff6986fba305702deb17ed1 (diff)
move documents.php functionality to controller, add route
Diffstat (limited to 'ajax')
-rw-r--r--ajax/controller.php26
-rw-r--r--ajax/documents.php28
2 files changed, 25 insertions, 29 deletions
diff --git a/ajax/controller.php b/ajax/controller.php
index fe62ab51..09a9f7ff 100644
--- a/ajax/controller.php
+++ b/ajax/controller.php
@@ -96,7 +96,7 @@ class Controller {
exit();
} catch (\Exception $e){
Helper::warnLog('Joining a session failed. Reason:' . $e->getMessage());
- \OCP\JSON::error();
+ \OCP\JSON::error(array('message'=>$e->getMessage()));
exit();
}
}
@@ -124,6 +124,30 @@ class Controller {
}
}
+ /**
+ * lists the documents the user has access to (including shared files, once the code in core has been fixed)
+ * also adds session and member info for these files
+ */
+ public static function listDocuments(){
+ self::preDispatch();
+
+ $documents = Storage::getDocuments();
+
+ $fileIds = array();
+ foreach ($documents as $document) {
+ $fileIds[] = $document['fileid'];
+ }
+
+ $sessions = Session::getSessionsByFileIds($fileIds);
+
+ $members = array();
+ foreach ($sessions as $session) {
+ $members[$session['es_id']] = Member::getMembersByEsId($session['es_id']);
+ }
+
+ \OCP\JSON::success(array('documents' => $documents,'sessions' => $sessions,'members' => $members));
+ }
+
public static function listSessions(){
self::preDispatch();
$sessions = Session::getAll();
diff --git a/ajax/documents.php b/ajax/documents.php
deleted file mode 100644
index 216f360c..00000000
--- a/ajax/documents.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * returns the list of documents the user has access to
- */
-
-// Init owncloud
-
-namespace OCA\Documents;
-
-\OCP\User::checkLoggedIn();
-\OCP\JSON::checkAppEnabled('documents');
-
-$documents = Storage::getDocuments();
-
-$fileIds = array();
-foreach ($documents as $document) {
- $fileIds[] = $document['fileid'];
-}
-
-$sessions = Session::getSessionsByFileIds($fileIds);
-
-$members = array();
-foreach ($sessions as $session) {
- $members[$session['es_id']] = Member::getMembersByEsId($session['es_id']);
-}
-
-\OCP\JSON::success(array('documents' => $documents,'sessions' => $sessions,'members' => $members));