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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-10-05 11:42:36 +0400
committerBart Visscher <bartv@thisnet.nl>2012-10-05 11:42:36 +0400
commitf3a211c03c3dd017e263ac5226a52eb62562d198 (patch)
tree4161ed0ab3b5fe695d08dc0d51df0a0ea02fe313 /lib/router.php
parent167e9c1cc025ce920e48032ff5331fcb4f84de3d (diff)
Implement routing on javascript side
Diffstat (limited to 'lib/router.php')
-rw-r--r--lib/router.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/router.php b/lib/router.php
index da491e217fc..04a3d410060 100644
--- a/lib/router.php
+++ b/lib/router.php
@@ -94,4 +94,22 @@ class OC_Router {
{
return $this->getGenerator()->generate($name, $parameters, $absolute);
}
+
+ public static function JSRoutes()
+ {
+ // TODO: http caching
+ $routes = array();
+ $router = OC::getRouter();
+ $root = $router->getCollection('root');
+ foreach($root->all() as $name => $route) {
+ $compiled_route = $route->compile();
+ $defaults = $route->getDefaults();
+ unset($defaults['action']);
+ $routes[$name] = array(
+ 'tokens' => $compiled_route->getTokens(),
+ 'defaults' => $defaults,
+ );
+ }
+ OCP\JSON::success ( array( 'data' => $routes ) );
+ }
}