Add compatibility to nc 27

master
Jonas Letzbor 2023-07-24 22:54:58 +02:00
parent c1ea50037d
commit f40ea8dc8f
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
14 changed files with 398 additions and 131 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
.idea .idea
vendor/
css/Leaflet.LinearMeasurement.css

11
BUILD.md 100644
View File

@ -0,0 +1,11 @@
## Installation
```sh
sudo npm install -g node-sass
```
## Build
```sh
node-sass css/ -o css/
```

View File

@ -1,45 +0,0 @@
<?php
/**
* ownCloud - gpxEdit
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Julien Veyssier <eneiluj@gmx.fr>
* @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'),
];
});

View File

@ -1,76 +0,0 @@
<?php
/**
* ownCloud - gpxedit
*
*
* @author
*
* @copyright
*/
namespace OCA\GpxEdit\AppInfo;
use OCP\IContainer;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use OCA\GpxEdit\Controller\PageController;
use OCA\GpxEdit\Controller\ComparisonController;
use OCA\GpxEdit\Controller\UtilsController;
/**
* Class Application
*
* @package OCA\GpxEdit\AppInfo
*/
class Application extends App {
/**
* Constructor
*
* @param array $urlParams
*/
public function __construct(array $urlParams = []) {
parent::__construct('gpxedit', $urlParams);
$container = $this->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()
);
}
);
}
}

View File

@ -23,9 +23,18 @@
<database min-version="9.4">pgsql</database> <database min-version="9.4">pgsql</database>
<database>sqlite</database> <database>sqlite</database>
<database min-version="5.5">mysql</database> <database min-version="5.5">mysql</database>
<nextcloud min-version="14" max-version="23"/> <nextcloud min-version="14" max-version="27"/>
</dependencies> </dependencies>
<settings> <settings>
<admin>OCA\GpxEdit\Settings\Admin</admin> <admin>OCA\GpxEdit\Settings\Admin</admin>
</settings> </settings>
<navigations>
<navigation>
<id>gpxedit</id>
<name>GpxEdit</name>
<route>gpxedit.page.index</route>
<icon>app.svg</icon>
</navigation>
</navigations>
</info> </info>

21
composer.json 100644
View File

@ -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"
}
}
}

267
composer.lock generated 100644
View File

@ -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"
}

View File

@ -61,7 +61,8 @@
right: 0; right: 0;
top: 0; top: 0;
bottom: 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-x: hidden;
overflow-y: auto; } overflow-y: auto; }

View File

@ -0,0 +1,78 @@
<?php
/**
* ownCloud - gpxedit
*
*
* @author
*
* @copyright
*/
namespace OCA\GpxEdit\AppInfo;
use OC\App\AppManager;
use OCP\IContainer;
use Psr\Container\ContainerInterface;
use OCP\AppFramework\App;
use OCP\AppFramework\IAppContainer;
use OCA\GpxEdit\Controller\PageController;
use OCA\GpxEdit\Controller\ComparisonController;
use OCA\GpxEdit\Controller\UtilsController;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
/**
* Class Application
*
* @package OCA\GpxEdit\AppInfo
*/
class Application extends App implements IBootstrap {
/**
* Constructor
*
* @param array $urlParams
*/
public function __construct(array $urlParams = []) {
parent::__construct('gpxedit', $urlParams);
}
public function register(IRegistrationContext $context): void {
$context->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 {
}
}

View File

@ -27,7 +27,7 @@ use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
require_once('conversion.php'); require_once('Conversion.php');
function delTree($dir) { function delTree($dir) {
$files = array_diff(scandir($dir), array('.','..')); $files = array_diff(scandir($dir), array('.','..'));
@ -91,13 +91,12 @@ class PageController extends Controller {
private $config; private $config;
private $appVersion; private $appVersion;
private $userAbsoluteDataPath; private $userAbsoluteDataPath;
private $shareManager;
private $dbconnection; private $dbconnection;
private $dbtype; private $dbtype;
private $dbdblquotes; private $dbdblquotes;
public function __construct($AppName, IRequest $request, $UserId, public function __construct($AppName, IRequest $request, $UserId,
$userfolder, $config, $shareManager, IAppManager $appManager){ $userfolder, $config, IAppManager $appManager){
parent::__construct($AppName, $request); parent::__construct($AppName, $request);
$this->appVersion = $config->getAppValue('gpxedit', 'installed_version'); $this->appVersion = $config->getAppValue('gpxedit', 'installed_version');
$this->userId = $UserId; $this->userId = $UserId;
@ -127,8 +126,6 @@ class PageController extends Controller {
$this->dbconnection = \OC::$server->getDatabaseConnection(); $this->dbconnection = \OC::$server->getDatabaseConnection();
} }
//$this->shareManager = \OC::$server->getShareManager();
$this->shareManager = $shareManager;
} }
/** /**
@ -157,7 +154,7 @@ class PageController extends Controller {
// PARAMS to view // PARAMS to view
require_once('tileservers.php'); require_once('TileServers.php');
$params = [ $params = [
'username'=>$this->userId, 'username'=>$this->userId,
'basetileservers'=>$baseTileServers, 'basetileservers'=>$baseTileServers,

View File

@ -28,7 +28,7 @@ $baseTileServers = [
'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'url' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
'attribution' => 'Map data &copy; 2013 <a href="http://openstreetmap.org">OpenStreetMap</a> contributors', 'attribution' => 'Map data &copy; 2013 <a href="http://openstreetmap.org">OpenStreetMap</a> contributors',
'minzoom' => '1', 'minzoom' => '1',
'maxzoom' => '18' 'maxzoom' => '19'
), ),
Array( Array(
'name' => 'OpenCycleMap', 'name' => 'OpenCycleMap',

View File

@ -27,6 +27,8 @@ use OCP\AppFramework\Http\DataDisplayResponse;
use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Controller; use OCP\AppFramework\Controller;
use function OCP\Log\logger;
/** /**
* Recursive find files from name pattern * Recursive find files from name pattern
*/ */
@ -288,6 +290,7 @@ class UtilsController extends Controller {
* @NoAdminRequired * @NoAdminRequired
*/ */
public function saveOptionsValues($optionsValues) { public function saveOptionsValues($optionsValues) {
logger('gpxedit')->error("Received options");
// first we check if user already has options values in DB // first we check if user already has options values in DB
$sqlts = 'SELECT jsonvalues FROM *PREFIX*gpxedit_options '; $sqlts = 'SELECT jsonvalues FROM *PREFIX*gpxedit_options ';
$sqlts .= 'WHERE '.$this->dbdblquotes.'user'.$this->dbdblquotes.'=\''.$this->userId.'\' '; $sqlts .= 'WHERE '.$this->dbdblquotes.'user'.$this->dbdblquotes.'=\''.$this->userId.'\' ';

View File

@ -54,7 +54,6 @@ class PageControllerTest extends \PHPUnit\Framework\TestCase {
'testUser', 'testUser',
$c->query('ServerContainer')->getUserFolder('testUser'), $c->query('ServerContainer')->getUserFolder('testUser'),
$c->query('ServerContainer')->getConfig(), $c->query('ServerContainer')->getConfig(),
//$c->getServer()->getShareManager(),
$c->getServer()->getAppManager() $c->getServer()->getAppManager()
); );
} }