diff --git a/public/admin.php b/public/admin.php index 7ec8fd4..54d1735 100644 --- a/public/admin.php +++ b/public/admin.php @@ -522,657 +522,27 @@ $counts['total'] = count($all_contributions); - + + + + + + + diff --git a/public/index.php b/public/index.php index 90b61a4..1fdb22a 100644 --- a/public/index.php +++ b/public/index.php @@ -357,7 +357,7 @@ $news_items = $stmt->fetchAll(); - + diff --git a/public/js/admin.js b/public/js/admin.js index 0cdf875..6c745b4 100644 --- a/public/js/admin.js +++ b/public/js/admin.js @@ -7,6 +7,12 @@ // Depends on: ADMIN_CONFIG Object set in Moderation Page // ===================================================================== +// ===================================================================== +// Block 0: Configuration and Application State +// ===================================================================== + +// API Endpoint as relative Path +const API_URL = 'api/contributions.php'; // ===================================================================== // Block 1: Page Tab Navigation @@ -112,10 +118,10 @@ function loadMapPreview(mapDiv) { // Fetches all Contributions to find the Geometry const formData = new FormData(); formData.append('action', 'read'); - formData.append('municipality_id', ADMIN_CONFIG.municipalityId); + formData.append('municipality_id', ADMIN_CONFIG.id); formData.append('status', 'all'); - fetch(ADMIN_CONFIG.apiUrl, { method: 'POST', body: formData }) + fetch(API_URL, { method: 'POST', body: formData }) .then(function (r) { return r.json(); }) .then(function (data) { if (!data.features) return; @@ -165,7 +171,7 @@ function loadMapPreview(mapDiv) { if (bounds.isValid()) { miniMap.fitBounds(bounds, { padding: [25, 25], maxZoom: 17 }); } else { - miniMap.setView(ADMIN_CONFIG.municipalityCenter, 15); + miniMap.setView(ADMIN_CONFIG.center, 15); } mapDiv.dataset.loaded = 'true'; @@ -280,7 +286,7 @@ function apiCall(data) { formData.append(key, data[key]); } - return fetch(ADMIN_CONFIG.apiUrl, { method: 'POST', body: formData }) + return fetch(API_URL, { method: 'POST', body: formData }) .then(function (r) { return r.json(); }); } @@ -536,7 +542,7 @@ function createNews() { apiCall({ action: 'create_news', - municipality_id: ADMIN_CONFIG.municipalityId, + municipality_id: ADMIN_CONFIG.id, title: result.value.title, content: result.value.content, author_name: result.value.author_name