From 0fd09c22a236d8ecdab4631a35fcfe8572066726 Mon Sep 17 00:00:00 2001 From: ostertun Date: Thu, 29 Oct 2020 14:52:36 +0100 Subject: [PATCH 1/5] Link to entryList incl count --- client/scripts/regatten.js.php | 24 ++++++++++++++++++++++++ server/content/index.php | 3 ++- server/content/planning.php | 3 ++- server/content/planning_view.php | 3 ++- server/content/regattas.php | 3 ++- server/scripts/onRegattaClicked.js | 18 +++++++++++++++++- 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/client/scripts/regatten.js.php b/client/scripts/regatten.js.php index e16d4ce..6edb263 100644 --- a/client/scripts/regatten.js.php +++ b/client/scripts/regatten.js.php @@ -611,3 +611,27 @@ var addConsoleOpenerToPreloader = function() { $(button).hide(); } addConsoleOpenerToPreloader(); + +function m2s_getLink(type, eventId) { + switch (type) { + case 'entrylist': + return 'https://manage2sail.com/de-DE/event/' + eventId + '#!/entries'; + } + return ''; +} +function ro_getLink(type, eventId) { + switch (type) { + case 'entrylist': + return 'http://www.raceoffice.org/entrylist.php?eid=' + eventId; + } + return ''; +} +function extServiceGetLink(serviceName, type, eventId = '') { + switch (serviceName) { + case 'm2s': + return m2s_getLink(type, eventId); + case 'ro': + return ro_getLink(type, eventId); + } + return ''; +} diff --git a/server/content/index.php b/server/content/index.php index e1a0c6d..5f315b4 100644 --- a/server/content/index.php +++ b/server/content/index.php @@ -82,7 +82,8 @@ // Regattas Menu $items = ''; $items .= ''; - $items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']); + $items .= $tpl->load('menu/item-icon-badge', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt', 'badge-id' => 'badge-regatta-plannings']); + $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); diff --git a/server/content/planning.php b/server/content/planning.php index 01ac587..0e5703f 100644 --- a/server/content/planning.php +++ b/server/content/planning.php @@ -30,7 +30,8 @@ $items = ''; $items .= ''; $items .= $tpl->load('menu/item-icon', ['Status bearbeiten', '#', 'html-id' => 'menu-item-status', 'icon' => 'fa-edit']); - $items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']); + $items .= $tpl->load('menu/item-icon-badge', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt', 'badge-id' => 'badge-regatta-plannings']); + $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); diff --git a/server/content/planning_view.php b/server/content/planning_view.php index 1670a5e..8bb60d2 100644 --- a/server/content/planning_view.php +++ b/server/content/planning_view.php @@ -22,7 +22,8 @@ // Menu $items = ''; $items .= ''; - $items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']); + $items .= $tpl->load('menu/item-icon-badge', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt', 'badge-id' => 'badge-regatta-plannings']); + $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); diff --git a/server/content/regattas.php b/server/content/regattas.php index 36be855..6179f28 100644 --- a/server/content/regattas.php +++ b/server/content/regattas.php @@ -26,7 +26,8 @@ // Menu $items = ''; $items .= ''; - $items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']); + $items .= $tpl->load('menu/item-icon-badge', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt', 'badge-id' => 'badge-regatta-plannings']); + $items .= $tpl->load('menu/item-icon-badge', ['Meldeliste', '', 'html-id' => 'menu-item-entrylist', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-entrylist']); $items .= $tpl->load('menu/item-icon', ['Ergebnisse', '', 'html-id' => 'menu-item-results', 'icon' => 'fa-poll']); $items .= $tpl->load('menu/item-icon', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']); $items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']); diff --git a/server/scripts/onRegattaClicked.js b/server/scripts/onRegattaClicked.js index 60fa9ec..057c739 100644 --- a/server/scripts/onRegattaClicked.js +++ b/server/scripts/onRegattaClicked.js @@ -68,12 +68,28 @@ async function onRegattaClicked(id) { // Planning if ((plannings.length > 0) && (dateTo >= today)) { - $('#menu-item-plannings').show(); + $('#badge-regatta-plannings').text(plannings.length); $('#menu-item-plannings').attr('href', LINK_PRE + 'regatta_plan?regatta=' + regatta['id']); + $('#menu-item-plannings').show(); } else { $('#menu-item-plannings').hide(); } + // Entrylist + var extServiceData; + try { + extServiceData = JSON.parse(regatta.extServiceData); + } catch { + extServiceData = {}; + } + if ((regatta.extService !== null) && ('entryCount' in extServiceData)) { + $('#badge-regatta-entrylist').text(extServiceData.entryCount); + $('#menu-item-entrylist').attr('href', extServiceGetLink(regatta.extService, 'entrylist', extServiceData.eventId)); // TODO + $('#menu-item-entrylist').show(); + } else { + $('#menu-item-entrylist').hide(); + } + // Results if (regatta['results'] == '1') { $('#menu-item-results').show(); From 1fb619d4ecc5fc7976531deac367c6e0ccc2a5e8 Mon Sep 17 00:00:00 2001 From: ostertun Date: Sun, 1 Nov 2020 16:38:06 +0100 Subject: [PATCH 2/5] Planning: keep year --- server/content/planning.php | 4 ++-- server/content/planning_edit.php | 2 +- server/content/planning_list.php | 2 +- server/content/planning_view.php | 2 +- server/scripts/planning.js | 7 +++++-- server/scripts/planning_list.js | 2 +- server/scripts/planning_view.js | 6 ++++-- 7 files changed, 15 insertions(+), 10 deletions(-) diff --git a/server/content/planning.php b/server/content/planning.php index 0e5703f..8a62b93 100644 --- a/server/content/planning.php +++ b/server/content/planning.php @@ -6,9 +6,9 @@ // Title $content = '

Saison-Planung

'; - $content .= $tpl->load('button', [' Saison-Planungen anderer', LINK_PRE . 'planning_list', 'css-class' => 'mt-2 mb-2']); + $content .= $tpl->load('button', [' Saison-Planungen anderer', 'html-id' => 'a-list-plannings', 'css-class' => 'mt-2 mb-2']); $content .= '

Hinweis: Diese Seite kannst nur Du sehen.
Wenn Du Deine Saison-Planung teilen möchtest, klicke hier

'; - $content .= $tpl->load('button', [' bearbeiten', LINK_PRE . 'planning_edit']); + $content .= $tpl->load('button', [' bearbeiten', 'html-id' => 'a-edit-planning']); $content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']); $sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-loggedin']); diff --git a/server/content/planning_edit.php b/server/content/planning_edit.php index 4ef708c..d816ed4 100644 --- a/server/content/planning_edit.php +++ b/server/content/planning_edit.php @@ -1,7 +1,7 @@ Date: Sun, 1 Nov 2020 16:45:00 +0100 Subject: [PATCH 3/5] Menu close on back improved --- client/scripts/custom.js.php | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/client/scripts/custom.js.php b/client/scripts/custom.js.php index 4a5e49e..b64421d 100644 --- a/client/scripts/custom.js.php +++ b/client/scripts/custom.js.php @@ -124,29 +124,22 @@ $(document).ready(function(){ //Adding Background for Gradient if(!$('.menu-hider').length){$('#page').append('