From c656d7eb5037005c7428799f6197fd0bd1c1c194 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Wed, 8 Jul 2015 21:40:17 +0000 Subject: [PATCH] Add more files to have a basic and empty working app --- appinfo/app.php | 2 +- appinfo/application.php | 2 +- appinfo/routes.php | 4 ++-- controller/citycontroller.php | 41 +++++++++++++++++++++++++++++++++++ db/citymapper.php | 23 ++++++++++++++++++++ js/public/app.js | 3 ++- 6 files changed, 70 insertions(+), 5 deletions(-) create mode 100644 controller/citycontroller.php create mode 100644 db/citymapper.php diff --git a/appinfo/app.php b/appinfo/app.php index 4983b87..66ae098 100644 --- a/appinfo/app.php +++ b/appinfo/app.php @@ -21,7 +21,7 @@ if (class_exists('\OCP\AppFramework\App')) { 'order' => 10, // the route that will be shown on startup - 'href' => \OCP\Util::linkToRoute('weather.board.index'), + 'href' => \OCP\Util::linkToRoute('weather.city.index'), // the icon that will be shown in the navigation // this file needs to exist in img/ diff --git a/appinfo/application.php b/appinfo/application.php index f86e859..4384aae 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -37,7 +37,7 @@ class Application extends App { * Database Layer */ $container->registerService('CityMapper', function(IContainer $c) { - return new BoardMapper($c->query('ServerContainer')->getDb()); + return new CityMapper($c->query('ServerContainer')->getDb()); }); /** diff --git a/appinfo/routes.php b/appinfo/routes.php index 4ff8849..514e850 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -1,6 +1,6 @@ + * @copyright Loic Blot 2015 + */ + +namespace OCA\Weather\Controller; + +use \OCP\IRequest; +use \OCP\AppFramework\Http\TemplateResponse; +use \OCP\AppFramework\Controller; +use \OCP\AppFramework\Http\JSONResponse; +use \OCP\AppFramework\Http; + +use \OCA\Weather\Db\CityMapper; + +class CityController extends Controller { + + private $userId; + private $mapper; + + public function __construct ($appName, IRequest $request, $userId, CityMapper $mapper) { + parent::__construct($appName, $request); + $this->userId = $userId; + $this->mapper = $mapper; + } + + /** + * @NoAdminRequired + * @NoCSRFRequired + */ + public function index () { + return new TemplateResponse($this->appName, 'main'); + } +}; +?> diff --git a/db/citymapper.php b/db/citymapper.php new file mode 100644 index 0000000..f75eb61 --- /dev/null +++ b/db/citymapper.php @@ -0,0 +1,23 @@ + + * @copyright Loic Blot 2015 + */ + +namespace OCA\Weather\Db; + +use \OCP\IDb; + +use \OCP\AppFramework\Db\Mapper; + +class CityMapper extends Mapper { + public function __construct (IDb $db) { + parent::__construct($db, 'weather_city'); + } +}; +?> diff --git a/js/public/app.js b/js/public/app.js index 7c9accc..7eacdf6 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -1,5 +1,5 @@ /** - * ownCloud - ownBoard + * ownCloud - Weather * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. @@ -47,4 +47,5 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil $scope.fatalError(); }); }; + } ]);