diff --git a/.gitignore b/.gitignore index 485dee6..8614ddf 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ .idea +vendor/ +css/Leaflet.LinearMeasurement.css \ No newline at end of file diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 0000000..b7529f1 --- /dev/null +++ b/BUILD.md @@ -0,0 +1,11 @@ +## Installation + +```sh +sudo npm install -g node-sass +``` + +## Build + +```sh +node-sass css/ -o css/ +``` \ No newline at end of file diff --git a/appinfo/app.php b/appinfo/app.php deleted file mode 100644 index 7950768..0000000 --- a/appinfo/app.php +++ /dev/null @@ -1,45 +0,0 @@ - - * @copyright Julien Veyssier 2015 - */ - -namespace OCA\GpxEdit\AppInfo; - -use OCP\AppFramework\App; - -use OCP\Util; -Util::addScript('gpxedit', 'filetypes'); -Util::addStyle('gpxedit', 'style'); - -$app = new Application(); -$container = $app->getContainer(); - -$container->query('OCP\INavigationManager')->add(function () use ($container) { - $urlGenerator = $container->query('OCP\IURLGenerator'); - $l10n = $container->query('OCP\IL10N'); - return [ - // the string under which your app will be referenced in owncloud - 'id' => 'gpxedit', - - // sorting weight for the navigation. The higher the number, the higher - // will it be listed in the navigation - 'order' => 10, - - // the route that will be shown on startup - 'href' => $urlGenerator->linkToRoute('gpxedit.page.index'), - - // the icon that will be shown in the navigation - // this file needs to exist in img/ - 'icon' => $urlGenerator->imagePath('gpxedit', 'app.svg'), - - // the title of your application. This will be used in the - // navigation or on the settings page of your app - 'name' => $l10n->t('GpxEdit'), - ]; -}); diff --git a/appinfo/application.php b/appinfo/application.php deleted file mode 100644 index 0eca37a..0000000 --- a/appinfo/application.php +++ /dev/null @@ -1,76 +0,0 @@ -getContainer(); - - /** - * Controllers - */ - $container->registerService( - 'PageController', function (IAppContainer $c) { - return new PageController( - $c->query('AppName'), - $c->query('Request'), - $c->query('UserId'), - $c->query('ServerContainer')->getUserFolder($c->query('UserId')), - $c->query('ServerContainer')->getConfig(), - $c->getServer()->getShareManager(), - $c->getServer()->getAppManager() - ); - } - ); - - $container->registerService( - 'UtilsController', function (IAppContainer $c) { - return new UtilsController( - $c->query('AppName'), - $c->query('Request'), - $c->query('UserId'), - //$c->getServer()->getUserFolder($c->query('UserId')), - //$c->query('OCP\IConfig'), - $c->query('ServerContainer')->getUserFolder($c->query('UserId')), - $c->query('ServerContainer')->getConfig(), - $c->getServer()->getAppManager() - ); - } - ); - - } - -} - diff --git a/appinfo/info.xml b/appinfo/info.xml index 6718219..578ae84 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -23,9 +23,18 @@ pgsql sqlite mysql - + OCA\GpxEdit\Settings\Admin + + + + gpxedit + GpxEdit + gpxedit.page.index + app.svg + + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..18e83db --- /dev/null +++ b/composer.json @@ -0,0 +1,21 @@ +{ + "name": "nextcloud/gpx-editor", + "description": "GPX Editor for Nextcloud", + "type": "project", + "authors": [ + { + "name": "RPJosh", + "email": "RPJosh@rpjosh.de" + } + ], + "require": {}, + "require-dev": { + "nextcloud/ocp": "dev-master" + }, + + "autoload-dev": { + "psr-4": { + "OCP\\": "vendor/nextcloud/ocp/OCP" + } + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..c938853 --- /dev/null +++ b/composer.lock @@ -0,0 +1,267 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "ef6d791d402845825c4df258aad67a9e", + "packages": [], + "packages-dev": [ + { + "name": "nextcloud/ocp", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nextcloud-deps/ocp.git", + "reference": "e1882fc96e3676e7628eaa82f1f8294c0d778db2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/e1882fc96e3676e7628eaa82f1f8294c0d778db2", + "reference": "e1882fc96e3676e7628eaa82f1f8294c0d778db2", + "shasum": "" + }, + "require": { + "php": "~8.0 || ~8.1 || ~8.2", + "psr/clock": "^1.0", + "psr/container": "^2.0.2", + "psr/event-dispatcher": "^1.0", + "psr/log": "^1.1.4" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "28.0.0-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "AGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Christoph Wurst", + "email": "christoph@winzerhof-wurst.at" + } + ], + "description": "Composer package containing Nextcloud's public API (classes, interfaces)", + "support": { + "issues": "https://github.com/nextcloud-deps/ocp/issues", + "source": "https://github.com/nextcloud-deps/ocp/tree/master" + }, + "time": "2023-07-22T00:39:08+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/1.1.4" + }, + "time": "2021-05-03T11:20:27+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "nextcloud/ocp": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [], + "plugin-api-version": "2.2.0" +} diff --git a/css/leaflet-sidebar.css b/css/leaflet-sidebar.css index d7d2b90..675636d 100644 --- a/css/leaflet-sidebar.css +++ b/css/leaflet-sidebar.css @@ -61,7 +61,8 @@ right: 0; top: 0; bottom: 0; - background-color: rgba(255, 255, 255, 0.95); + background-color: var(--color-main-background); + color: var(--color-primary-element-text); overflow-x: hidden; overflow-y: auto; } diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php new file mode 100644 index 0000000..c837c7d --- /dev/null +++ b/lib/AppInfo/Application.php @@ -0,0 +1,78 @@ +registerService( + 'PageController', function (ContainerInterface $c) { + return new PageController( + $c->get('AppName'), + $c->get('Request'), + $c->get('UserId'), + $c->get('ServerContainer')->getUserFolder($c->get('UserId')), + $c->get('ServerContainer')->getConfig(), + $c->get(AppManager::class) + ); + } + ); + + $context->registerService( + 'UtilsController', function (ContainerInterface $c) { + return new UtilsController( + $c->get('AppName'), + $c->get('Request'), + $c->get('UserId'), + //$c->getServer()->getUserFolder($c->query('UserId')), + //$c->query('OCP\IConfig'), + $c->get('ServerContainer')->getUserFolder($c->get('UserId')), + $c->get('ServerContainer')->getConfig(), + $c->get(AppManager::class) + ); + } + ); + } + + public function boot(IBootContext $context): void { + } + +} + diff --git a/controller/conversion.php b/lib/Controller/Conversion.php similarity index 100% rename from controller/conversion.php rename to lib/Controller/Conversion.php diff --git a/controller/pagecontroller.php b/lib/Controller/PageController.php similarity index 97% rename from controller/pagecontroller.php rename to lib/Controller/PageController.php index 5ff0047..2758e8b 100644 --- a/controller/pagecontroller.php +++ b/lib/Controller/PageController.php @@ -27,7 +27,7 @@ use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Controller; -require_once('conversion.php'); +require_once('Conversion.php'); function delTree($dir) { $files = array_diff(scandir($dir), array('.','..')); @@ -91,13 +91,12 @@ class PageController extends Controller { private $config; private $appVersion; private $userAbsoluteDataPath; - private $shareManager; private $dbconnection; private $dbtype; private $dbdblquotes; public function __construct($AppName, IRequest $request, $UserId, - $userfolder, $config, $shareManager, IAppManager $appManager){ + $userfolder, $config, IAppManager $appManager){ parent::__construct($AppName, $request); $this->appVersion = $config->getAppValue('gpxedit', 'installed_version'); $this->userId = $UserId; @@ -127,8 +126,6 @@ class PageController extends Controller { $this->dbconnection = \OC::$server->getDatabaseConnection(); } - //$this->shareManager = \OC::$server->getShareManager(); - $this->shareManager = $shareManager; } /** @@ -157,7 +154,7 @@ class PageController extends Controller { // PARAMS to view - require_once('tileservers.php'); + require_once('TileServers.php'); $params = [ 'username'=>$this->userId, 'basetileservers'=>$baseTileServers, diff --git a/controller/tileservers.php b/lib/Controller/TileServers.php similarity index 99% rename from controller/tileservers.php rename to lib/Controller/TileServers.php index 41e548e..6615ef4 100644 --- a/controller/tileservers.php +++ b/lib/Controller/TileServers.php @@ -28,7 +28,7 @@ $baseTileServers = [ 'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'attribution' => 'Map data © 2013 OpenStreetMap contributors', 'minzoom' => '1', - 'maxzoom' => '18' + 'maxzoom' => '19' ), Array( 'name' => 'OpenCycleMap', diff --git a/controller/utilscontroller.php b/lib/Controller/UtilsController.php similarity index 99% rename from controller/utilscontroller.php rename to lib/Controller/UtilsController.php index f00102c..2e8fa27 100644 --- a/controller/utilscontroller.php +++ b/lib/Controller/UtilsController.php @@ -27,6 +27,8 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Controller; +use function OCP\Log\logger; + /** * Recursive find files from name pattern */ @@ -288,6 +290,7 @@ class UtilsController extends Controller { * @NoAdminRequired */ public function saveOptionsValues($optionsValues) { + logger('gpxedit')->error("Received options"); // first we check if user already has options values in DB $sqlts = 'SELECT jsonvalues FROM *PREFIX*gpxedit_options '; $sqlts .= 'WHERE '.$this->dbdblquotes.'user'.$this->dbdblquotes.'=\''.$this->userId.'\' '; diff --git a/tests/php/controller/pageControllerTest.php b/tests/php/controller/pageControllerTest.php index 5a210ff..04e8bc7 100644 --- a/tests/php/controller/pageControllerTest.php +++ b/tests/php/controller/pageControllerTest.php @@ -54,7 +54,6 @@ class PageControllerTest extends \PHPUnit\Framework\TestCase { 'testUser', $c->query('ServerContainer')->getUserFolder('testUser'), $c->query('ServerContainer')->getConfig(), - //$c->getServer()->getShareManager(), $c->getServer()->getAppManager() ); }