summaryrefslogtreecommitdiffstats
path: root/apps/files/appinfo
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-12-15 19:55:18 +0100
committerLukas Reschke <lukas@owncloud.com>2014-12-15 19:55:18 +0100
commitbe3d4fd303569a99554dbc6c62ce8992a45c51ad (patch)
tree6ef59f62bee77bf49bdd313810e43eaaa67cc21e /apps/files/appinfo
parent76357af2d50b7f040109311286cc57ee53c44cf1 (diff)
parent207d77e5cdf6386dd22d87a5851adae38ad9f77f (diff)
downloadnextcloud-server-be3d4fd303569a99554dbc6c62ce8992a45c51ad.tar.gz
nextcloud-server-be3d4fd303569a99554dbc6c62ce8992a45c51ad.zip
Merge pull request #12360 from owncloud/files-tags
Add favorites to files app
Diffstat (limited to 'apps/files/appinfo')
-rw-r--r--apps/files/appinfo/application.php40
-rw-r--r--apps/files/appinfo/routes.php29
2 files changed, 63 insertions, 6 deletions
diff --git a/apps/files/appinfo/application.php b/apps/files/appinfo/application.php
index 7ca48bab474..13ff60daf89 100644
--- a/apps/files/appinfo/application.php
+++ b/apps/files/appinfo/application.php
@@ -11,6 +11,8 @@ namespace OCA\Files\Appinfo;
use OC\AppFramework\Utility\SimpleContainer;
use OCA\Files\Controller\ApiController;
use OCP\AppFramework\App;
+use \OCA\Files\Service\TagService;
+use \OCP\IContainer;
class Application extends App {
public function __construct(array $urlParams=array()) {
@@ -21,10 +23,44 @@ class Application extends App {
/**
* Controllers
*/
- $container->registerService('APIController', function (SimpleContainer $c) {
+ $container->registerService('APIController', function (IContainer $c) {
return new ApiController(
$c->query('AppName'),
- $c->query('Request')
+ $c->query('Request'),
+ $c->query('TagService')
+ );
+ });
+
+ /**
+ * Core
+ */
+ $container->registerService('L10N', function(IContainer $c) {
+ return $c->query('ServerContainer')->getL10N($c->query('AppName'));
+ });
+
+ /**
+ * Services
+ */
+ $container->registerService('Tagger', function(IContainer $c) {
+ return $c->query('ServerContainer')->getTagManager()->load('files');
+ });
+ $container->registerService('TagService', function(IContainer $c) {
+ $homeFolder = $c->query('ServerContainer')->getUserFolder();
+ return new TagService(
+ $c->query('ServerContainer')->getUserSession(),
+ $c->query('Tagger'),
+ $homeFolder
+ );
+ });
+
+ /**
+ * Controllers
+ */
+ $container->registerService('APIController', function (IContainer $c) {
+ return new ApiController(
+ $c->query('AppName'),
+ $c->query('Request'),
+ $c->query('TagService')
);
});
}
diff --git a/apps/files/appinfo/routes.php b/apps/files/appinfo/routes.php
index 96790a04855..349284ec52d 100644
--- a/apps/files/appinfo/routes.php
+++ b/apps/files/appinfo/routes.php
@@ -9,10 +9,31 @@
namespace OCA\Files\Appinfo;
$application = new Application();
-$application->registerRoutes($this, array('routes' => array(
- array('name' => 'API#getThumbnail', 'url' => '/api/v1/thumbnail/{x}/{y}/{file}', 'verb' => 'GET', 'requirements' => array('file' => '.+')),
-)));
-
+$application->registerRoutes(
+ $this,
+ array(
+ 'routes' => array(
+ array(
+ 'name' => 'API#getThumbnail',
+ 'url' => '/api/v1/thumbnail/{x}/{y}/{file}',
+ 'verb' => 'GET',
+ 'requirements' => array('file' => '.+')
+ ),
+ array(
+ 'name' => 'API#updateFileTags',
+ 'url' => '/api/v1/files/{path}',
+ 'verb' => 'POST',
+ 'requirements' => array('path' => '.+'),
+ ),
+ array(
+ 'name' => 'API#getFilesByTag',
+ 'url' => '/api/v1/tags/{tagName}/files',
+ 'verb' => 'GET',
+ 'requirements' => array('tagName' => '.+'),
+ ),
+ )
+ )
+);
/** @var $this \OC\Route\Router */