From 7d50998f0c823d6f706ef4f8fd2a92364b4cc069 Mon Sep 17 00:00:00 2001 From: HB9HIL Date: Fri, 6 Dec 2024 16:08:02 +0100 Subject: [PATCH] feat[maptile_options]: Add a button "reset defaults" --- application/controllers/Options.php | 15 +++++-- application/views/options/maptiles.php | 62 +++++++++++++------------- 2 files changed, 43 insertions(+), 34 deletions(-) diff --git a/application/controllers/Options.php b/application/controllers/Options.php index 29d9f6619..f47a46384 100644 --- a/application/controllers/Options.php +++ b/application/controllers/Options.php @@ -438,10 +438,17 @@ class Options extends CI_Controller { $this->load->view('interface_assets/footer'); } else { $saved = false; - $map_tile_server_copyright = 'Map data © ' . $this->input->post('copyright_text', true) . ''; - $saved = $this->optionslib->update('map_tile_server', $this->input->post('maptile_server_url', true), 'yes'); - $saved = $this->optionslib->update('map_tile_server_dark', $this->input->post('maptile_server_url_dark', true), 'yes'); - $saved = $this->optionslib->update('map_tile_subdomains', $this->input->post('subdomain_system', true), 'yes'); + if ($this->input->post('reset_defaults') == '1') { + $map_tile_server_copyright = 'Map data © OpenStreetMap'; + $saved = $this->optionslib->update('map_tile_server', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'yes'); + $saved = $this->optionslib->update('map_tile_server_dark', 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png', 'yes'); + $saved = $this->optionslib->update('map_tile_subdomains', 'abc', 'yes'); + } else { + $map_tile_server_copyright = 'Map data © ' . $this->input->post('copyright_text', true) . ''; + $saved = $this->optionslib->update('map_tile_server', $this->input->post('maptile_server_url', true), 'yes'); + $saved = $this->optionslib->update('map_tile_server_dark', $this->input->post('maptile_server_url_dark', true), 'yes'); + $saved = $this->optionslib->update('map_tile_subdomains', $this->input->post('subdomain_system', true), 'yes'); + } $saved = $this->optionslib->update('map_tile_server_copyright', $map_tile_server_copyright, 'yes'); // Also clean up static map images diff --git a/application/views/options/maptiles.php b/application/views/options/maptiles.php index 092517f8a..33b09645d 100644 --- a/application/views/options/maptiles.php +++ b/application/views/options/maptiles.php @@ -43,37 +43,39 @@ -

- -

-
- - - ', '', "'light'", "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"); ?> -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+

+ +

+
+ + + ', '', "'light'", "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"); ?> +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
- - " /> +
+ " /> + +