Compare commits
185 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f01262eba | ||
|
|
a9464c382b | ||
|
|
d204acd365 | ||
|
|
00dc405158 | ||
|
|
b87f557a62 | ||
|
|
689845d02a | ||
|
|
ae8aed446b | ||
|
|
343d898afd | ||
|
|
c88a512ff8 | ||
|
|
1fc7b8fe6d | ||
|
|
2014303fae | ||
|
|
7b6ad832a9 | ||
|
|
eaf0fd5a95 | ||
|
|
6c547d43c5 | ||
|
|
e9e56b66ab | ||
|
|
143755a50f | ||
|
|
8ba463c8fe | ||
|
|
13927fb769 | ||
|
|
90075ceb4f | ||
|
|
526b338e41 | ||
|
|
aa60df83db | ||
|
|
58505a0f53 | ||
|
|
37c584e525 | ||
|
|
1010e4ffdd | ||
|
|
c17c2b64cf | ||
|
|
0658a44516 | ||
|
|
2f2d94bab4 | ||
|
|
dd854b7df5 | ||
|
|
c91dc57736 | ||
|
|
c8cef6ee95 | ||
|
|
3f7d7a40ec | ||
|
|
19f561ffde | ||
|
|
84677ef4dd | ||
|
|
4dfa2d7bd5 | ||
|
|
1e0052f629 | ||
|
|
c983a1702f | ||
|
|
a1facbca85 | ||
|
|
fba8c8e958 | ||
|
|
8aa3e3ccb6 | ||
|
|
c319e568b6 | ||
|
|
748176159d | ||
|
|
053981175b | ||
|
|
7083b46831 | ||
|
|
2c8c99b8f0 | ||
|
|
07d01ae700 | ||
|
|
7da31729e9 | ||
|
|
08ab714a54 | ||
|
|
44c962b7b3 | ||
|
|
004280f3ea | ||
|
|
63a8d174d7 | ||
|
|
13f496f0a6 | ||
|
|
da553a8f8d | ||
|
|
69ef983c07 | ||
|
|
32473901d6 | ||
|
|
84320f3a67 | ||
|
|
cd30ba1ce6 | ||
|
|
1fb619d4ec | ||
|
|
0fd09c22a2 | ||
|
|
12ed412226 | ||
|
|
7fd1c1c6e7 | ||
|
|
4e85d3a993 | ||
|
|
5c22604896 | ||
|
|
a2fe4c2637 | ||
|
|
4a65b48520 | ||
|
|
4eb2970671 | ||
|
|
0298cefc8b | ||
|
|
e17f99d005 | ||
|
|
15d7060354 | ||
|
|
d38de287dd | ||
|
|
1cb6de2402 | ||
|
|
da2beac8d3 | ||
|
|
92a11bcfa5 | ||
|
|
2ddeac4ba4 | ||
|
|
fa4770e12a | ||
|
|
a845137873 | ||
|
|
a6f2568753 | ||
|
|
6d0fdea0e8 | ||
|
|
8bc0d9b15e | ||
|
|
1252c02d7c | ||
|
|
f617fa7923 | ||
|
|
3ff17a63e0 | ||
|
|
c66dc96598 | ||
|
|
f5d059202e | ||
|
|
5962e1cc90 | ||
|
|
9f3019b4c5 | ||
|
|
326ba4a6bd | ||
|
|
4228ec739d | ||
|
|
a38c48dab4 | ||
|
|
da48e79a36 | ||
|
|
de5abcdfaf | ||
|
|
6b1e35cc14 | ||
|
|
89e24f69b7 | ||
|
|
554b810e85 | ||
|
|
fbd1eaaae8 | ||
|
|
ce42f87227 | ||
|
|
e66f95ff50 | ||
|
|
fcd791ed65 | ||
|
|
439679bbbe | ||
|
|
9a8d6892f2 | ||
|
|
3b71f3d707 | ||
|
|
94c6a42106 | ||
|
|
0c9eb9c013 | ||
|
|
2034e8b659 | ||
|
|
e57bf4a426 | ||
|
|
3c8289d11c | ||
|
|
63de725ebd | ||
|
|
69efb93646 | ||
|
|
6f302d6527 | ||
|
|
bfc2f84f0f | ||
|
|
0660b2b6b3 | ||
|
|
3ee722f6c2 | ||
|
|
0ce58aeacc | ||
|
|
28ba380cca | ||
|
|
357449c1c6 | ||
|
|
e84eaa2562 | ||
|
|
de70522850 | ||
|
|
cf5f71d14e | ||
|
|
775a7bd27a | ||
|
|
34b47e40ab | ||
|
|
32ea581437 | ||
|
|
4106a177f8 | ||
|
|
16ccbca2af | ||
|
|
3fd9beae1e | ||
|
|
01d0ae96f9 | ||
|
|
c211817f78 | ||
|
|
9ff0b96837 | ||
|
|
7a3413b339 | ||
|
|
72ff731694 | ||
|
|
3959b208b5 | ||
|
|
7b500bf67d | ||
|
|
5c8c9db1de | ||
|
|
fa526b11a8 | ||
|
|
2dc2225263 | ||
|
|
fcf9dc9a20 | ||
|
|
203c2534eb | ||
|
|
730dd9112f | ||
|
|
13ceef37d9 | ||
|
|
54852f4383 | ||
|
|
8808d12bf1 | ||
|
|
c6d5450b0e | ||
|
|
15cbe15651 | ||
|
|
cb8a1817ae | ||
|
|
acf51ea71c | ||
|
|
be98511957 | ||
|
|
65608cdd5a | ||
|
|
d0996fa0c3 | ||
|
|
c9a90eb77c | ||
|
|
754cb6f77d | ||
|
|
5e926f3e75 | ||
|
|
138071769c | ||
|
|
26d9d83ba2 | ||
|
|
eaa08ba301 | ||
|
|
760c05286e | ||
|
|
3f676141d7 | ||
|
|
ae9bf02c49 | ||
|
|
c2a482bba1 | ||
|
|
06266b788d | ||
|
|
3db5ae1723 | ||
|
|
a45af73c25 | ||
|
|
b784733b69 | ||
|
|
f30eac8aa5 | ||
|
|
99b624ff92 | ||
|
|
e74ffa9a70 | ||
|
|
cbb398988d | ||
|
|
856f6c1d66 | ||
|
|
2ea26408be | ||
|
|
fb1ca6d28e | ||
|
|
6a5d06325d | ||
|
|
72ac8df460 | ||
|
|
246231fd0e | ||
|
|
3e533f65fc | ||
|
|
2533c3d66a | ||
|
|
cacee5a54a | ||
|
|
274aa85cf7 | ||
|
|
4317e4fe87 | ||
|
|
b7dec825ca | ||
|
|
6ca6a79dc3 | ||
|
|
d1e5d753b4 | ||
|
|
7afacc3fff | ||
|
|
77ea57d643 | ||
|
|
a72c462483 | ||
|
|
b739e6cc4e | ||
|
|
eb47cdf016 | ||
|
|
12c1a614bb | ||
|
|
0fb1bb0462 |
20
.github/ISSUE_TEMPLATE/-de--feature-anfrage.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/-de--feature-anfrage.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "[DE] Feature-Anfrage"
|
||||||
|
about: Schlage eine Idee für dieses Projekt vor
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Bezieht sich Deine Feature-Anfrage auf ein Problem? Bitte beschreiben.**
|
||||||
|
Eine klare und präzise Beschreibung des Problems. Z.B. Ich bin immer frustriert, wenn [...]
|
||||||
|
|
||||||
|
**Beschreibe die gewünschte Lösung**
|
||||||
|
Eine klare und präzise Beschreibung dessen, was passieren soll.
|
||||||
|
|
||||||
|
**Beschreibe Alternativen, die Du in Betracht gezogen hast**
|
||||||
|
Eine klare und präzise Beschreibung aller alternativen Lösungen oder Funktionen, die Du in Betracht gezogen hast.
|
||||||
|
|
||||||
|
**Zusätzlicher Kontext**
|
||||||
|
Füge hier weitere Kontexte oder Screenshots zur Feature-Anfrage hinzu.
|
||||||
38
.github/ISSUE_TEMPLATE/-de--fehlerbericht.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/-de--fehlerbericht.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: "[DE] Fehlerbericht"
|
||||||
|
about: Erstelle einen Bericht, um uns zu helfen, die App zu verbessern
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Beschreibe den Fehler**
|
||||||
|
Eine klare und präzise Beschreibung des Fehlers.
|
||||||
|
|
||||||
|
**Reproduzierung**
|
||||||
|
Schritte zum Reproduzieren des Fehlers:
|
||||||
|
1. Gehe zu '...'
|
||||||
|
2. Klicke auf '....'
|
||||||
|
3. Scrolle nach unten zu '....'
|
||||||
|
4. Sieh den Fehler
|
||||||
|
|
||||||
|
**Erwartetes Verhalten**
|
||||||
|
Eine klare und präzise Beschreibung dessen, was Du erwartet hattest.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
Füge gegebenenfalls Screenshots hinzu, um Dein Problem zu erklären.
|
||||||
|
|
||||||
|
**Desktop (bitte verfolständige die folgenden Informationen):**
|
||||||
|
- Betriebssystem: [z.B. Windows 10]
|
||||||
|
- Browser [z.B. chrome, safari]
|
||||||
|
- Version [z.B. 2.14]
|
||||||
|
|
||||||
|
**Smartphone (bitte verfolständige die folgenden Informationen):**
|
||||||
|
- Gerät: [z.B. iPhone 6]
|
||||||
|
- Betriebssystem: [z.B. iOS 8.1]
|
||||||
|
- Browser [z.B. stock browser, safari]
|
||||||
|
- Version [z.B. 2.14]
|
||||||
|
|
||||||
|
**Zusätzlicher Kontext**
|
||||||
|
Füge hier einen anderen Kontext zum Problem hinzu.
|
||||||
38
.github/ISSUE_TEMPLATE/-en--bug-report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/-en--bug-report.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: "[EN] Bug report"
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: bug
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. Windows 10]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 2.14]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone 6]
|
||||||
|
- OS: [e.g. iOS 8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 2.14]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/-en--feature-request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/-en--feature-request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "[EN] Feature request"
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: enhancement
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
11
README.md
Normal file
11
README.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Regatten.net App
|
||||||
|
|
||||||
|
Willkommen im GitHub-Repository unserer neuen Regatten.net App.
|
||||||
|
|
||||||
|
Falls sich jemand dafür interessiert, ist hier der gesamte Quellcode unserer neuen App zu finden.
|
||||||
|
Bitte beachtet, dass diese App einschließlich dem gesamten Quellcode exklusivem Urheberrecht unterliegt. Sie darf also nicht kopiert, verteilt oder verändert werden.
|
||||||
|
Sollte Interesse an einer Anbindung an unser System bestehen, kontaktiere uns bitte einfach (https://regatten.net/contact)
|
||||||
|
|
||||||
|
Der Hauptzweck dieses Repository besteht jedoch darin, Feedback von Euch zu unserer neuen App zu bekommen.
|
||||||
|
Selbstverständlich könnt Ihr uns auch weiterhin auf anderen Kanälen erreichen, doch für Problem-Meldungen und Verbesserungsvorschläge ist GitHub am besten geeignet.
|
||||||
|
Wie Du Teil unseres BETA-Programmes wirst, die App installierst und Feedback gibst, erfährst Du in unserem [Wiki](https://github.com/ostertun/RegattenApp/wiki).
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -27,17 +27,27 @@ function parseDate(string) {
|
|||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNaN(year) || isNaN(month) || isNaN(day)) return null;
|
if (isNaN(year) || isNaN(month) || isNaN(day)) return null;
|
||||||
if (year.toString().length == 2) year = (year < 70 ? 2000 : 1900) + year;
|
if (year.toString().length == 2) year = (year < 70 ? 2000 : 1900) + year;
|
||||||
if ((year < 1970) || (year > 3000)) return null;
|
if ((year < 1970) || (year > 3000)) return null;
|
||||||
if ((month < 1) || (month > 12)) return null;
|
if ((month < 1) || (month > 12)) return null;
|
||||||
if ((day < 1) || (day > 31)) return null;
|
if ((day < 1) || (day > 31)) return null;
|
||||||
|
|
||||||
var date = new Date(Date.UTC(year, month - 1, day));
|
var date = new Date(Date.UTC(year, month - 1, day));
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseDbTimestamp(string) {
|
||||||
|
var year = string.substr(0, 4);
|
||||||
|
var month = string.substr(5, 2);
|
||||||
|
var day = string.substr(8, 2);
|
||||||
|
var hour = string.substr(11, 2);
|
||||||
|
var minute = string.substr(14, 2);
|
||||||
|
var second = string.substr(17, 2);
|
||||||
|
return new Date(year, month - 1, day, hour, minute, second);
|
||||||
|
}
|
||||||
|
|
||||||
function getToday() {
|
function getToday() {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
date = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
|
||||||
@@ -51,37 +61,37 @@ function formatDate(format, date = null) {
|
|||||||
date = new Date(date.valueOf());
|
date = new Date(date.valueOf());
|
||||||
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
|
date.setMinutes(date.getMinutes() + date.getTimezoneOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
format = format.replace("M", "%1%");
|
format = format.replace("M", "%1%");
|
||||||
format = format.replace("F", "%2%");
|
format = format.replace("F", "%2%");
|
||||||
format = format.replace("D", "%3%");
|
format = format.replace("D", "%3%");
|
||||||
format = format.replace("l", "%4%");
|
format = format.replace("l", "%4%");
|
||||||
|
|
||||||
var tmp = date.getFullYear().toString();
|
var tmp = date.getFullYear().toString();
|
||||||
var tmp2 = tmp.substr(2);
|
var tmp2 = tmp.substr(2);
|
||||||
format = format.replace("Y", tmp);
|
format = format.replace("Y", tmp);
|
||||||
format = format.replace('y', tmp2);
|
format = format.replace('y', tmp2);
|
||||||
|
|
||||||
tmp = (date.getMonth() + 1).toString();
|
tmp = (date.getMonth() + 1).toString();
|
||||||
tmp2 = (tmp.length > 1 ? tmp : ('0' + tmp));
|
tmp2 = (tmp.length > 1 ? tmp : ('0' + tmp));
|
||||||
format = format.replace('n', tmp);
|
format = format.replace('n', tmp);
|
||||||
format = format.replace('m', tmp2);
|
format = format.replace('m', tmp2);
|
||||||
|
|
||||||
tmp = date.getDate().toString();
|
tmp = date.getDate().toString();
|
||||||
tmp2 = (tmp.length > 1 ? tmp : ('0' + tmp));
|
tmp2 = (tmp.length > 1 ? tmp : ('0' + tmp));
|
||||||
format = format.replace('j', tmp);
|
format = format.replace('j', tmp);
|
||||||
format = format.replace('d', tmp2);
|
format = format.replace('d', tmp2);
|
||||||
|
|
||||||
tmp = date.getDay();
|
tmp = date.getDay();
|
||||||
tmp2 = (tmp == 0 ? 7 : tmp);
|
tmp2 = (tmp == 0 ? 7 : tmp);
|
||||||
format = format.replace('w', tmp);
|
format = format.replace('w', tmp);
|
||||||
format = format.replace('N', tmp2);
|
format = format.replace('N', tmp2);
|
||||||
|
|
||||||
format = format.replace('%1%', strings.months_short[date.getMonth()]);
|
format = format.replace('%1%', strings.months_short[date.getMonth()]);
|
||||||
format = format.replace('%2%', strings.months_long[date.getMonth()]);
|
format = format.replace('%2%', strings.months_long[date.getMonth()]);
|
||||||
|
|
||||||
format = format.replace('%3%', strings.weekdays_short[date.getDay()]);
|
format = format.replace('%3%', strings.weekdays_short[date.getDay()]);
|
||||||
format = format.replace('%4%', strings.weekdays_long[date.getDay()]);
|
format = format.replace('%4%', strings.weekdays_long[date.getDay()]);
|
||||||
|
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|||||||
1530
client/scripts/mobileconsole.js
Normal file
1530
client/scripts/mobileconsole.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../server/version.php');
|
require_once(__DIR__ . '/../../server/version.php');
|
||||||
require_once(__DIR__ . '/../../server/config.php');
|
require_once(__DIR__ . '/../../server/config.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
//Loading the Service Worker
|
//Loading the Service Worker
|
||||||
var swRegistration = null;
|
var swRegistration = null;
|
||||||
@@ -16,31 +16,29 @@ if ('serviceWorker' in navigator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
var pwaVersion = '<?php echo PWA_VERSION; ?>'; //must be identical to _manifest.json version. If not it will create update window loop
|
var pwaVersion = '<?php echo PWA_VERSION; ?>'; //must be identical to _manifest.json version. If not it will create update window loop
|
||||||
var pwaCookie = true; // if set to false, the PWA prompt will appear even if the user selects "maybe later"
|
|
||||||
var pwaNoCache = false; // always keep the cache clear to serve the freshest possible content
|
|
||||||
|
|
||||||
|
|
||||||
$('[data-pwa-version]').data('pwa-version', pwaVersion);
|
$('[data-pwa-version]').data('pwa-version', pwaVersion);
|
||||||
|
|
||||||
|
|
||||||
//Creating Cookie System for PWA Hide
|
//Creating Cookie System for PWA Hide
|
||||||
function createCookie(e, t, n) {if (n) {var o = new Date;o.setTime(o.getTime() + n * 365 * 24 * 3600 * 1e3);var r = "; expires=" + o.toGMTString()} else var r = "";document.cookie = e + "=" + t + r + "; path=/"}
|
function createCookie(e, t, n) {if (n) {var o = new Date;o.setTime(o.getTime() + n * 365 * 24 * 3600 * 1e3);var r = "; expires=" + o.toGMTString()} else var r = "";document.cookie = e + "=" + t + r + "; path=/"}
|
||||||
function readCookie(e) {for (var t = e + "=", n = document.cookie.split(";"), o = 0; o < n.length; o++) {for (var r = n[o];" " == r.charAt(0);) r = r.substring(1, r.length);if (0 == r.indexOf(t)) return r.substring(t.length, r.length)}return null}
|
function readCookie(e) {for (var t = e + "=", n = document.cookie.split(";"), o = 0; o < n.length; o++) {for (var r = n[o];" " == r.charAt(0);) r = r.substring(1, r.length);if (0 == r.indexOf(t)) return r.substring(t.length, r.length)}return null}
|
||||||
function eraseCookie(e) {createCookie(e, "", -1)}
|
function eraseCookie(e) {createCookie(e, "", -1)}
|
||||||
|
|
||||||
//Enabling dismiss button
|
//Enabling dismiss button
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('.pwa-dismiss').on('click',function(){
|
$('.pwa-dismiss').on('click',function(){
|
||||||
console.log('User Closed Add to Home / PWA Prompt')
|
log('[pwa] User Closed Add to Home / PWA Prompt')
|
||||||
createCookie('Sticky_pwa_rejected_install', true, 1);
|
createCookie('Sticky_pwa_rejected_install', true, 1);
|
||||||
$('body').find('#menu-install-pwa-android, #menu-install-pwa-ios, .menu-hider').removeClass('menu-active');
|
$('body').find('#menu-install-pwa-android, #menu-install-pwa-ios, .menu-hider').removeClass('menu-active');
|
||||||
});
|
});
|
||||||
},1500);
|
},1500);
|
||||||
|
|
||||||
//Detecting Mobile Operating Systems
|
//Detecting Mobile Operating Systems
|
||||||
var isMobile = {
|
var isMobile = {
|
||||||
Android: function() {return navigator.userAgent.match(/Android/i);},
|
Android: function() {return navigator.userAgent.match(/Android/i);},
|
||||||
@@ -49,37 +47,40 @@ $(document).ready(function(){
|
|||||||
};
|
};
|
||||||
var isInWebAppiOS = (window.navigator.standalone == true);
|
var isInWebAppiOS = (window.navigator.standalone == true);
|
||||||
var isInWebAppChrome = (window.matchMedia('(display-mode: standalone)').matches);
|
var isInWebAppChrome = (window.matchMedia('(display-mode: standalone)').matches);
|
||||||
|
|
||||||
//Firing PWA prompts for specific versions and when not on home screen.
|
//Firing PWA prompts for specific versions and when not on home screen.
|
||||||
if (isMobile.Android()) {
|
if (isMobile.Android()) {
|
||||||
console.log('Android Detected');
|
log('[pwa] Android Detected');
|
||||||
function showInstallPromotion(){
|
function showInstallPromotion(){
|
||||||
if($('#menu-install-pwa-android, .add-to-home').length){
|
if($('#menu-install-pwa-android, .add-to-home').length){
|
||||||
console.log('Triggering PWA Menu for Android');
|
log('[pwa] Triggering PWA Menu for Android');
|
||||||
if (!readCookie('Sticky_pwa_rejected_install')) {
|
if (!readCookie('Sticky_pwa_rejected_install')) {
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
$('.add-to-home').addClass('add-to-home-visible add-to-home-android');
|
$('.add-to-home').addClass('add-to-home-visible add-to-home-android');
|
||||||
$('#menu-install-pwa-android, .menu-hider').addClass('menu-active')
|
$('#menu-install-pwa-android, .menu-hider').addClass('menu-active')
|
||||||
},4500);
|
},3000);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
console.log('The div #menu-install-pwa-android was not found. Please add this div to show the install window')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let deferredPrompt;
|
let deferredPrompt;
|
||||||
window.addEventListener('beforeinstallprompt', (e) => {
|
window.addEventListener('beforeinstallprompt', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
deferredPrompt = e;
|
deferredPrompt = e;
|
||||||
showInstallPromotion();
|
var welcomActive = $('#menu-welcome').hasClass('menu-active');
|
||||||
|
if (welcomActive) {
|
||||||
|
$('#menu-welcome-a-okay').click(showInstallPromotion);
|
||||||
|
} else {
|
||||||
|
showInstallPromotion();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
$('.pwa-install').on('click',function(e){
|
$('.pwa-install').on('click',function(e){
|
||||||
deferredPrompt.prompt();
|
deferredPrompt.prompt();
|
||||||
deferredPrompt.userChoice
|
deferredPrompt.userChoice
|
||||||
.then((choiceResult) => {
|
.then((choiceResult) => {
|
||||||
if (choiceResult.outcome === 'accepted') {
|
if (choiceResult.outcome === 'accepted') {
|
||||||
console.log('User accepted the A2HS prompt');
|
log('[pwa] User accepted the A2HS prompt');
|
||||||
} else {
|
} else {
|
||||||
console.log('User dismissed the A2HS prompt');
|
log('[pwa] User dismissed the A2HS prompt');
|
||||||
}
|
}
|
||||||
deferredPrompt = null;
|
deferredPrompt = null;
|
||||||
});
|
});
|
||||||
@@ -87,112 +88,36 @@ $(document).ready(function(){
|
|||||||
window.addEventListener('appinstalled', (evt) => {
|
window.addEventListener('appinstalled', (evt) => {
|
||||||
$('#menu-install-pwa-android, .menu-hider').removeClass('menu-active')
|
$('#menu-install-pwa-android, .menu-hider').removeClass('menu-active')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMobile.iOS()) {
|
if (isMobile.iOS()) {
|
||||||
if(!isInWebAppiOS){
|
if(!isInWebAppiOS){
|
||||||
console.log('iOS Detected');
|
log('[pwa] iOS Detected');
|
||||||
if($('#menu-install-pwa-ios, .add-to-home').length){
|
if($('#menu-install-pwa-ios, .add-to-home').length){
|
||||||
if (!readCookie('Sticky_pwa_rejected_install')) {
|
if (!readCookie('Sticky_pwa_rejected_install')) {
|
||||||
console.log('Triggering PWA / Add to Home Screen Menu for iOS');
|
setTimeout(function(){
|
||||||
setTimeout(function(){
|
function triggerPwaInstallIos() {
|
||||||
$('.add-to-home').addClass('add-to-home-visible add-to-home-ios');
|
log('[pwa] Triggering PWA / Add to Home Screen Menu for iOS');
|
||||||
$('#menu-install-pwa-ios, .menu-hider').addClass('menu-active');
|
$('.add-to-home').addClass('add-to-home-visible add-to-home-ios');
|
||||||
},4500);
|
$('#menu-install-pwa-ios, .menu-hider').addClass('menu-active');
|
||||||
|
}
|
||||||
|
var welcomActive = $('#menu-welcome').hasClass('menu-active');
|
||||||
|
if (welcomActive) {
|
||||||
|
$('#menu-welcome-a-okay').click(triggerPwaInstallIos);
|
||||||
|
} else {
|
||||||
|
triggerPwaInstallIos();
|
||||||
|
}
|
||||||
|
},3000);
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
console.log('The div #menu-install-pwa-ios was not found. Please add this div to show the install window')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Creating Update Modal
|
|
||||||
function updateModal(){
|
|
||||||
var body = $('body');
|
|
||||||
var updateModal = $('#menu-update');
|
|
||||||
var mt = new Date();
|
|
||||||
var menuUpdate = mt.getHours() + ":" + mt.getMinutes() + ":" + mt.getSeconds();
|
|
||||||
if(!updateModal.length){
|
|
||||||
body.append('<div id="menu-update"></div>');
|
|
||||||
setTimeout(function(){
|
|
||||||
body.find('#menu-update').load('menu-update.html?ver='+menuUpdate);
|
|
||||||
},250);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
//Update Version in 5 Seconds After New Version Detected
|
|
||||||
function updateButton(){
|
|
||||||
var counter = 3;
|
|
||||||
var interval = setInterval(function() {
|
|
||||||
counter--;
|
|
||||||
console.log(counter);
|
|
||||||
$('.page-update').html('Aktuallisierung in ... '+ counter + ' Sekunden');
|
|
||||||
if (counter == 0) {
|
|
||||||
clearInterval(interval);
|
|
||||||
window.location.reload(true)
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
caches.delete('workbox-runtime').then(function() {
|
|
||||||
console.log('Content Updated - Cache Removed!');
|
|
||||||
});
|
|
||||||
//localStorage.clear();
|
|
||||||
sessionStorage.clear()
|
|
||||||
caches.keys().then(cacheNames => {
|
|
||||||
cacheNames.forEach(cacheName => {
|
|
||||||
caches.delete(cacheName);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//Check Version
|
|
||||||
function check_version(){
|
|
||||||
if($('link[data-pwa-version]').length){
|
|
||||||
function versionCheck(){
|
|
||||||
var dt = new Date();
|
|
||||||
var maniTimeVersion = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
|
|
||||||
var localVersionNumber = $('link[rel="manifest"]').data('pwa-version');
|
|
||||||
var onlineVersionJSON = "<?php echo SERVER_ADDR; ?>/manifest.json.php?ver=" + maniTimeVersion;
|
|
||||||
var onlineVersionNumber = "Connection Offline. Waiting to Reconect";
|
|
||||||
$.getJSON(onlineVersionJSON, function(onlineData) {onlineVersionNumber = onlineData.version;});
|
|
||||||
setTimeout(function(){
|
|
||||||
//console.log(' Checking PWA Content for updates...\n PWA Server Version: ' + onlineVersionNumber + '\n' + ' PWA Cached Version: ' + localVersionNumber);
|
|
||||||
if(onlineVersionNumber != localVersionNumber && onlineVersionNumber != "Connection Offline. Waiting to Reconect"){
|
|
||||||
updateModal();
|
|
||||||
console.log('New Version of Content Available. Refreshing. On Desktop Browsers a manual refresh maybe required.')
|
|
||||||
setTimeout(function(){
|
|
||||||
$('body').find('#menu-update').addClass('menu-active');
|
|
||||||
$('.menu-hider').addClass('menu-active-no-click');
|
|
||||||
updateButton();
|
|
||||||
},500);
|
|
||||||
}
|
|
||||||
if(onlineVersionNumber == localVersionNumber){/*No update required. Versions Identical*/}
|
|
||||||
if(onlineVersionNumber === "undefined"){/*Error Checking for Updates*/}
|
|
||||||
if(onlineVersionNumber === "Finding Online Version..."){
|
|
||||||
$('.reloadme').addClass('disabled');
|
|
||||||
$('body').find('#menu-update').removeClass('menu-active');
|
|
||||||
$('.menu-hider').removeClass('menu-active-no-click');
|
|
||||||
}
|
|
||||||
},3000);
|
|
||||||
}
|
|
||||||
//Checking for new version every 60 seconds
|
|
||||||
setInterval(function(){versionCheck()}, 50000);
|
|
||||||
//Initial Load Version Check in 10 Second After Load
|
|
||||||
setTimeout(function(){versionCheck();}, 10000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pwaCookie == false){
|
//Reload To Clear Button
|
||||||
eraseCookie('Sticky_pwa_rejected_install');
|
|
||||||
}
|
|
||||||
|
|
||||||
//Reload To Clear Button
|
|
||||||
$('body').on('click', '.page-update, .reloadme', function() {
|
$('body').on('click', '.page-update, .reloadme', function() {
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Check for Version Change if Online If not Kill the Function
|
|
||||||
if (navigator.onLine) {check_version();} else {function check_version(){}}
|
|
||||||
|
|
||||||
//Adding Offline Alerts
|
//Adding Offline Alerts
|
||||||
var offlineAlerts = $('.offline-message');
|
var offlineAlerts = $('.offline-message');
|
||||||
|
|
||||||
@@ -200,62 +125,34 @@ $(document).ready(function(){
|
|||||||
$('body').append('<p class="offline-message bg-red2-dark color-white center-text uppercase ultrabold">' + strings['inetMsgOffline'] + '</p>');
|
$('body').append('<p class="offline-message bg-red2-dark color-white center-text uppercase ultrabold">' + strings['inetMsgOffline'] + '</p>');
|
||||||
$('body').append('<p class="online-message bg-green1-dark color-white center-text uppercase ultrabold">' + strings['inetMsgOnline'] + '</p>');
|
$('body').append('<p class="online-message bg-green1-dark color-white center-text uppercase ultrabold">' + strings['inetMsgOnline'] + '</p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Offline Function Show
|
//Offline Function Show
|
||||||
function isOffline(){
|
function isOffline(){
|
||||||
$('.offline-message').addClass('offline-message-active');
|
$('.offline-message').addClass('offline-message-active');
|
||||||
$('.online-message').removeClass('online-message-active');
|
$('.online-message').removeClass('online-message-active');
|
||||||
setTimeout(function(){$('.offline-message').removeClass('offline-message-active');},2000);
|
setTimeout(function(){$('.offline-message').removeClass('offline-message-active');},2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Online Function Show
|
//Online Function Show
|
||||||
function isOnline(){
|
function isOnline(){
|
||||||
$('.online-message').addClass('online-message-active');
|
$('.online-message').addClass('online-message-active');
|
||||||
$('.offline-message').removeClass('offline-message-active');
|
$('.offline-message').removeClass('offline-message-active');
|
||||||
setTimeout(function(){$('.online-message').removeClass('online-message-active');},2000);
|
setTimeout(function(){$('.online-message').removeClass('online-message-active');},2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.simulate-offline').on('click',function(){isOffline();})
|
|
||||||
$('.simulate-online').on('click',function(){isOnline();})
|
|
||||||
|
|
||||||
//Disable links to other pages if offline.
|
|
||||||
//Warning! Enabling offline for iOS can cause issues
|
|
||||||
//To allow offline functionality delete the next 7 lines
|
|
||||||
function returnFalse(){
|
|
||||||
var detectHREF = $(this).attr('href');
|
|
||||||
if(detectHREF.match(/.html/)){
|
|
||||||
isOffline();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check if Online / Offline
|
//Check if Online / Offline
|
||||||
function updateOnlineStatus(event) {
|
function updateOnlineStatus(event) {
|
||||||
var condition = navigator.onLine ? "online" : "offline";
|
var condition = navigator.onLine ? "online" : "offline";
|
||||||
isOnline();
|
isOnline();
|
||||||
console.log( 'Connection: Online');
|
log('[pwa] Connection: Online');
|
||||||
$("a").off( "click", returnFalse );
|
|
||||||
}
|
}
|
||||||
function updateOfflineStatus(event) {
|
function updateOfflineStatus(event) {
|
||||||
isOffline();
|
isOffline();
|
||||||
$("a").on( "click", returnFalse );
|
log('[pwa] Connection: Offline');
|
||||||
console.log( 'Connection: Offline');
|
|
||||||
}
|
}
|
||||||
window.addEventListener('online', updateOnlineStatus);
|
window.addEventListener('online', updateOnlineStatus);
|
||||||
window.addEventListener('offline', updateOfflineStatus);
|
window.addEventListener('offline', updateOfflineStatus);
|
||||||
|
|
||||||
|
|
||||||
if(pwaNoCache == true){
|
|
||||||
caches.delete('workbox-runtime').then(function() {
|
});
|
||||||
});
|
|
||||||
localStorage.clear();
|
|
||||||
sessionStorage.clear()
|
|
||||||
caches.keys().then(cacheNames => {
|
|
||||||
cacheNames.forEach(cacheName => {
|
|
||||||
caches.delete(cacheName);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,18 +1,55 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
|
|
||||||
require_once(__DIR__ . '/../../server/config.php');
|
require_once(__DIR__ . '/../../server/config.php');
|
||||||
|
require_once(__DIR__ . '/../../server/version.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
const QUERY_URL = '<?php echo QUERY_URL; ?>';
|
||||||
const BOATCLASS = '<?php echo BOATCLASS; ?>';
|
const BOATCLASS = '<?php echo BOATCLASS; ?>';
|
||||||
const LINK_PRE = '<?php echo SERVER_ADDR; ?>/';
|
const LINK_PRE = '<?php echo SERVER_ADDR; ?>/';
|
||||||
const YOUTH_AGE = '<?php echo $_CLASS['youth-age']; ?>';
|
|
||||||
const YOUTH_GERMAN_NAME = '<?php echo $_CLASS['youth-german-name']; ?>';
|
|
||||||
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
const PUSH_SERVER_KEY = '<?php echo PUSH_SERVER_KEY; ?>';
|
||||||
|
|
||||||
|
var consoleOutput = [];
|
||||||
|
|
||||||
|
function onConsoleOutput(entry) {
|
||||||
|
consoleOutput.push(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onerror = function(message, source, lineno, colno, errorError) {
|
||||||
|
if (source.startsWith(LINK_PRE)) {
|
||||||
|
source = source.substr(LINK_PRE.length);
|
||||||
|
}
|
||||||
|
var pos = source.indexOf('?');
|
||||||
|
if (pos >= 0) {
|
||||||
|
source = source.substr(0, pos);
|
||||||
|
}
|
||||||
|
consoleOutput.push({
|
||||||
|
message: message,
|
||||||
|
stack: {
|
||||||
|
caller: '',
|
||||||
|
file: source,
|
||||||
|
line: lineno,
|
||||||
|
col: colno
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function log() {
|
||||||
|
var now = new Date();
|
||||||
|
var hour = now.getHours().toString();
|
||||||
|
var min = now.getMinutes().toString();
|
||||||
|
var sec = now.getSeconds().toString();
|
||||||
|
var millis = now.getMilliseconds().toString();
|
||||||
|
hour = (hour.length < 2 ? '0' + hour : hour);
|
||||||
|
min = (min.length < 2 ? '0' + min : min);
|
||||||
|
sec = (sec.length < 2 ? '0' + sec : sec);
|
||||||
|
while (millis.length < 3) millis = '0' + millis;
|
||||||
|
console.log('[' + hour + ':' + min + ':' + sec + '.' + millis + ']', ...arguments);
|
||||||
|
}
|
||||||
|
|
||||||
var randomId = function() { return '_' + Math.random().toString(36).substr(2, 9); }
|
var randomId = function() { return '_' + Math.random().toString(36).substr(2, 9); }
|
||||||
|
|
||||||
var badges = {
|
var badges = {
|
||||||
@@ -118,12 +155,58 @@ function findGetParameter(parameterName) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var signup = function() {
|
||||||
|
log('[app] Signup');
|
||||||
|
var username = $('#input-signup-username').val();
|
||||||
|
var email = $('#input-signup-email').val();
|
||||||
|
var password = $('#input-signup-password').val();
|
||||||
|
if (username == '') { $('#input-signup-username').focus(); return; }
|
||||||
|
if (email == '') { $('#input-signup-email').focus(); return; }
|
||||||
|
if (password == '') { $('#input-signup-password').focus(); return; }
|
||||||
|
log('[app] Signup: All fields okay');
|
||||||
|
showLoader();
|
||||||
|
$('#input-signup-username').val('').trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-signup-email').val('').trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-signup-password').val('').trigger('focusin').trigger('focusout');
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'signup',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
username: username,
|
||||||
|
email: email,
|
||||||
|
password: password
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
log('[app] Signup: error:', xhr.status, status);
|
||||||
|
if (xhr.status == 409) {
|
||||||
|
toastError('Benutzername bereits vergeben');
|
||||||
|
$('#input-signup-email').val(email).trigger('focusin').trigger('focusout');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
||||||
|
$('#menu-signup').hideMenu();
|
||||||
|
} else {
|
||||||
|
log('[app] Signup: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
log('[app] Signup successful, logging in');
|
||||||
|
$('#input-login-username').val(username);
|
||||||
|
$('#input-login-password').val(password);
|
||||||
|
login();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var login = function() {
|
var login = function() {
|
||||||
|
log('[app] Login');
|
||||||
showLoader();
|
showLoader();
|
||||||
var username = $('#input-login-username').val();
|
var username = $('#input-login-username').val();
|
||||||
var password = $('#input-login-password').val();
|
var password = $('#input-login-password').val();
|
||||||
$('#input-login-username').val('');
|
$('#input-login-username').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-login-password').val('');
|
$('#input-login-password').val('').trigger('focusin').trigger('focusout');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: QUERY_URL + 'login',
|
url: QUERY_URL + 'login',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -133,20 +216,22 @@ var login = function() {
|
|||||||
device: navigator.userAgent
|
device: navigator.userAgent
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
|
log('[app] Login: error:', xhr.status, status);
|
||||||
if (xhr.status == 401) {
|
if (xhr.status == 401) {
|
||||||
toastError('Benutzername oder Passwort falsch');
|
toastError('Benutzername oder Passwort falsch');
|
||||||
$('#input-login-username').val(username);
|
$('#input-login-username').val(username).trigger('focusin').trigger('focusout');
|
||||||
} else if (xhr.status == 0) {
|
} else if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Dich anzumelden');
|
||||||
$('#menu-login').hideMenu();
|
$('#menu-login').hideMenu();
|
||||||
} else {
|
} else {
|
||||||
console.log('Login: unbekannter Fehler', status, error);
|
log('[app] Login: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
},
|
},
|
||||||
success: function (data, status, xhr) {
|
success: function (data, status, xhr) {
|
||||||
|
log('[app] Login successful');
|
||||||
localStorage.setItem('auth_id', data.id);
|
localStorage.setItem('auth_id', data.id);
|
||||||
localStorage.setItem('auth_hash', data.auth);
|
localStorage.setItem('auth_hash', data.auth);
|
||||||
localStorage.setItem('auth_user', data.user);
|
localStorage.setItem('auth_user', data.user);
|
||||||
@@ -167,13 +252,14 @@ var logoutClearStorage = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var logout = function() {
|
var logout = function() {
|
||||||
|
log('[app] Logout');
|
||||||
showLoader();
|
showLoader();
|
||||||
var auth = {
|
var auth = {
|
||||||
id: localStorage.getItem('auth_id'),
|
id: localStorage.getItem('auth_id'),
|
||||||
hash: localStorage.getItem('auth_hash')
|
hash: localStorage.getItem('auth_hash')
|
||||||
}
|
}
|
||||||
if ((auth.id === null) || (auth.hash === null)) {
|
if ((auth.id === null) || (auth.hash === null)) {
|
||||||
console.log('Not logged in');
|
log('[app] Not logged in');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -184,40 +270,67 @@ var logout = function() {
|
|||||||
auth: auth
|
auth: auth
|
||||||
},
|
},
|
||||||
error: function (xhr, status, error) {
|
error: function (xhr, status, error) {
|
||||||
|
log('[app] Logout: error:', xhr.status, status);
|
||||||
if (xhr.status == 401) {
|
if (xhr.status == 401) {
|
||||||
console.log('Not logged in');
|
log('[app] Not logged in');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
} else if (xhr.status == 0) {
|
} else if (xhr.status == 0) {
|
||||||
console.log('Could not delete auth from server');
|
log('[app] Could not delete auth from server');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
} else {
|
} else {
|
||||||
console.log('Logout: unbekannter Fehler', status, error);
|
log('[app] Logout: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
success: function (data, status, xhr) {
|
success: function (data, status, xhr) {
|
||||||
|
log('[app] Logout successful');
|
||||||
logoutClearStorage();
|
logoutClearStorage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCache() {
|
function deleteDb() {
|
||||||
|
log('[app] Deleting DB');
|
||||||
|
$('#menu-developer').hideMenu();
|
||||||
|
if (canUseLocalDB) {
|
||||||
|
showLoader();
|
||||||
|
var request = window.indexedDB.deleteDatabase('regatten_app_db_' + BOATCLASS);
|
||||||
|
request.onerror = function (event) {
|
||||||
|
log('[app] Cannot delete DB: ', event.target.errorCode);
|
||||||
|
toastError('Beim Löschen der Datenbank ist ein Fehler aufgetreten.<br>Bitte melde diesen Fehler. (Dev-Menu => Problem melden)', 5000);
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
log('[app] DB deleted');
|
||||||
|
toastInfo('Die Datenbank wurde gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit eine neue Datenbank.', 10000);
|
||||||
|
hideLoader();
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log('[app] DB not supported');
|
||||||
|
toastWarn('Dein Gerät unterstützt kein lokales Speichern der Daten. Alle Daten werden direkt vom Server gezogen.<br>Entsprechend kannst Du die Datenbank auch nicht zurücksetzen.', 10000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteCache() {
|
||||||
|
log('[app] Deleting cache');
|
||||||
$('#menu-developer').hideMenu();
|
$('#menu-developer').hideMenu();
|
||||||
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
navigator.serviceWorker.getRegistrations().then(function (registrations) {
|
||||||
for (let registration of registrations) {
|
for (let registration of registrations) {
|
||||||
console.log('Unregister sW:', registration);
|
log('[app] Unregister sW:', registration);
|
||||||
registration.unregister();
|
registration.unregister();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
caches.keys().then((keyList) => {
|
caches.keys().then((keyList) => {
|
||||||
return Promise.all(keyList.map((key) => {
|
return Promise.all(keyList.map((key) => {
|
||||||
console.log('Cache deleted:', key);
|
log('[app] Cache deleted:', key);
|
||||||
return caches.delete(key);
|
return caches.delete(key);
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
toastInfo('The serviceWorker and the cache were deleted. A new serviceWorker will be generated on the next refresh.');
|
toastInfo('Der serviceWorker und alle Caches wurden gelöscht. Die Seite lädt in wenigen Sekunden neu und erstellt damit neue Caches.', 10000);
|
||||||
|
setTimeout(function(){ location.reload(); }, 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pushesPossible = false;
|
var pushesPossible = false;
|
||||||
@@ -227,10 +340,10 @@ function urlB64ToUint8Array(base64String) {
|
|||||||
const base64 = (base64String + padding)
|
const base64 = (base64String + padding)
|
||||||
.replace(/\-/g, '+')
|
.replace(/\-/g, '+')
|
||||||
.replace(/_/g, '/');
|
.replace(/_/g, '/');
|
||||||
|
|
||||||
const rawData = window.atob(base64);
|
const rawData = window.atob(base64);
|
||||||
const outputArray = new Uint8Array(rawData.length);
|
const outputArray = new Uint8Array(rawData.length);
|
||||||
|
|
||||||
for (let i = 0; i < rawData.length; ++i) {
|
for (let i = 0; i < rawData.length; ++i) {
|
||||||
outputArray[i] = rawData.charCodeAt(i);
|
outputArray[i] = rawData.charCodeAt(i);
|
||||||
}
|
}
|
||||||
@@ -238,38 +351,59 @@ function urlB64ToUint8Array(base64String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pushesSubscribe() {
|
function pushesSubscribe() {
|
||||||
console.log('Subscribing');
|
log('[app] Subscribing');
|
||||||
const applicationServerKey = urlB64ToUint8Array(PUSH_SERVER_KEY);
|
const applicationServerKey = urlB64ToUint8Array(PUSH_SERVER_KEY);
|
||||||
|
log('[app] Subscription app server key:', applicationServerKey);
|
||||||
swRegistration.pushManager.subscribe({
|
swRegistration.pushManager.subscribe({
|
||||||
userVisibleOnly: true,
|
userVisibleOnly: true,
|
||||||
applicationServerKey: applicationServerKey
|
applicationServerKey: applicationServerKey
|
||||||
})
|
})
|
||||||
.then(function(subscription) {
|
.then(async function(subscription) {
|
||||||
pushesUpdateServerSubscription(subscription, true);
|
log('[app] Subscription:', subscription);
|
||||||
updatePushSwitches();
|
if (await pushesUpdateServerSubscription(subscription, true)) {
|
||||||
updatePushBadge();
|
log('[app] Subscription: Sent to server, updating UI');
|
||||||
|
dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
|
||||||
|
updatePushSwitches();
|
||||||
|
updatePushBadge();
|
||||||
|
} else {
|
||||||
|
$('#menu-pushes').hideMenu();
|
||||||
|
log('[app] Failed to subscribe the user due to connection error');
|
||||||
|
toastError('Da ist leider etwas schief gelaufen. Bitte stelle sicher, dass Du mit dem Internet verbunden bist und versuche es erneut.', 5000);
|
||||||
|
pushesUnSubscribe(true);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
})
|
})
|
||||||
.catch(function(err) {
|
.catch(function(err) {
|
||||||
console.log('Failed to subscribe the user: ', err);
|
$('#menu-pushes').hideMenu();
|
||||||
|
log('[app] Failed to subscribe the user: ', err);
|
||||||
toastError('Da ist leider etwas schief gelaufen. Bitte stelle sicher, dass Du mit dem Internet verbunden bist und versuche es erneut.', 5000);
|
toastError('Da ist leider etwas schief gelaufen. Bitte stelle sicher, dass Du mit dem Internet verbunden bist und versuche es erneut.', 5000);
|
||||||
pushesUnSubscribe(true);
|
pushesUnSubscribe(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function pushesUnSubscribe(silent = false) {
|
function pushesUnSubscribe(silent = false) {
|
||||||
console.log('Unsubscribing');
|
log('[app] Unsubscribing');
|
||||||
swRegistration.pushManager.getSubscription()
|
swRegistration.pushManager.getSubscription()
|
||||||
.then(function(subscription) {
|
.then(async function(subscription) {
|
||||||
|
log('[app] Subscription:', subscription);
|
||||||
if (subscription) {
|
if (subscription) {
|
||||||
pushesUpdateServerSubscription(subscription, false);
|
if (await pushesUpdateServerSubscription(subscription, false)) {
|
||||||
|
log('[app] Subscription: Removed from server');
|
||||||
|
} else {
|
||||||
|
log('[app] Failed to unsubscribe the user due to connection error');
|
||||||
|
}
|
||||||
|
log('[app] Removing subscription');
|
||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
|
log('[app] Subscription: Updating UI');
|
||||||
$('#menu-pushes').hideMenu();
|
$('#menu-pushes').hideMenu();
|
||||||
|
dbSettingsSet('notify_endpoint_' + BOATCLASS, false);
|
||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
|
if (!silent) toastOk('Du erhältst ab sofort keine Benachrichtigungen mehr von uns.');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function(error) {
|
.catch(function(error) {
|
||||||
console.log('Error unsubscribing', error);
|
log('[app] Error unsubscribing', error);
|
||||||
$('#menu-pushes').hideMenu();
|
$('#menu-pushes').hideMenu();
|
||||||
if (!silent) toastError('Da ist leider etwas schief gelaufen. Bitte versuche es erneut oder wende Dich an unseren Support.', 5000);
|
if (!silent) toastError('Da ist leider etwas schief gelaufen. Bitte versuche es erneut oder wende Dich an unseren Support.', 5000);
|
||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
@@ -278,20 +412,21 @@ function pushesUnSubscribe(silent = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pushesUpdateServerSubscription(subscription, enabled) {
|
function pushesUpdateServerSubscription(subscription, enabled) {
|
||||||
console.log('updateServer', enabled, subscription);
|
return new Promise(function(resolve){
|
||||||
$.ajax({
|
log('[app] updateServer', enabled, subscription);
|
||||||
url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription',
|
$.ajax({
|
||||||
type: 'POST',
|
url: QUERY_URL + (enabled ? 'add' : 'remove') + '_subscription',
|
||||||
data: { subscription: JSON.stringify(subscription) },
|
type: 'POST',
|
||||||
success: function (data, textStatus, jqXHR) {
|
data: { subscription: JSON.stringify(subscription) },
|
||||||
if (!enabled) {
|
success: function (data, textStatus, jqXHR) {
|
||||||
toastOk('Du erhältst ab sofort keine Benachrichtigungen mehr von uns.');
|
log('[app] Subscription sent to server');
|
||||||
|
resolve(true);
|
||||||
|
},
|
||||||
|
error: function (jqXHR, textStatus, errorThrown) {
|
||||||
|
log('[app] Error sending subscription to server');
|
||||||
|
resolve(false);
|
||||||
}
|
}
|
||||||
hideLoader();
|
});
|
||||||
},
|
|
||||||
error: function (jqXHR, textStatus, errorThrown) {
|
|
||||||
throw 'Cannot update server subscription';
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,13 +452,19 @@ async function updatePushSwitches() {
|
|||||||
$('#switch-pushes-result-ready-my').prop('checked', await dbSettingsGet('notify_channel_' + BOATCLASS + '_result_ready_my'));
|
$('#switch-pushes-result-ready-my').prop('checked', await dbSettingsGet('notify_channel_' + BOATCLASS + '_result_ready_my'));
|
||||||
$('#switch-pushes-result-ready-all').prop('checked', await dbSettingsGet('notify_channel_' + BOATCLASS + '_result_ready_all'));
|
$('#switch-pushes-result-ready-all').prop('checked', await dbSettingsGet('notify_channel_' + BOATCLASS + '_result_ready_all'));
|
||||||
$('#switch-pushes-meldeschluss').prop('checked', await dbSettingsGet('notify_channel_' + BOATCLASS + '_meldeschluss'));
|
$('#switch-pushes-meldeschluss').prop('checked', await dbSettingsGet('notify_channel_' + BOATCLASS + '_meldeschluss'));
|
||||||
|
|
||||||
if ($('#switch-pushes').prop('checked')) {
|
if ($('#switch-pushes').prop('checked')) {
|
||||||
$('#p-pushes-info').show();
|
$('#p-pushes-info').show();
|
||||||
$('.a-switch-pushes-channel').show();
|
$('.a-switch-pushes-channel-all').show();
|
||||||
|
$('.a-switch-pushes-channel-my').show();
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
$('.a-switch-pushes-channel-my').find('div').remove();
|
||||||
|
$('.a-switch-pushes-channel-my').find('.badge').text('nicht angemeldet');
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#p-pushes-info').hide();
|
$('#p-pushes-info').hide();
|
||||||
$('.a-switch-pushes-channel').hide();
|
$('.a-switch-pushes-channel-all').hide();
|
||||||
|
$('.a-switch-pushes-channel-my').hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +496,7 @@ function pushesOpenMenu() {
|
|||||||
toastWarn('Benachrichtigungen werden von Deinem Browser blockiert.', 5000);
|
toastWarn('Benachrichtigungen werden von Deinem Browser blockiert.', 5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
swRegistration.pushManager.getSubscription().then(function(subscription) {
|
swRegistration.pushManager.getSubscription().then(function(subscription) {
|
||||||
var isSub = (subscription !== null);
|
var isSub = (subscription !== null);
|
||||||
$('#switch-pushes').prop('checked', isSub);
|
$('#switch-pushes').prop('checked', isSub);
|
||||||
@@ -365,26 +506,64 @@ function pushesOpenMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updatePushBadge() {
|
function updatePushBadge() {
|
||||||
|
if (typeof onUpdatePushBadge === 'function') onUpdatePushBadge();
|
||||||
if (!pushesPossible) return;
|
if (!pushesPossible) return;
|
||||||
if (Notification.permission == 'denied') {
|
if (Notification.permission == 'denied') {
|
||||||
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('BLOCKED');
|
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('BLOCKED');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
swRegistration.pushManager.getSubscription().then(function(subscription) {
|
swRegistration.pushManager.getSubscription().then(async function(subscription) {
|
||||||
|
var dbSub = await dbSettingsGet('notify_endpoint_' + BOATCLASS);
|
||||||
var isSub = (subscription !== null);
|
var isSub = (subscription !== null);
|
||||||
|
log('[app] DB Subscription:', dbSub);
|
||||||
|
log('[app] Real Subscription:', subscription);
|
||||||
if (isSub) {
|
if (isSub) {
|
||||||
$('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN');
|
$('#badge-pushes').removeClass('bg-red2-dark').addClass('bg-green2-dark').text('AN');
|
||||||
|
if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, subscription.endpoint);
|
||||||
|
else if (dbSub !== subscription.endpoint) {
|
||||||
|
if (navigator.onLine) {
|
||||||
|
log('[app] Updating subscription');
|
||||||
|
pushesSubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('AUS');
|
$('#badge-pushes').removeClass('bg-green2-dark').addClass('bg-red2-dark').text('AUS');
|
||||||
|
if (dbSub === null) dbSettingsSet('notify_endpoint_' + BOATCLASS, false);
|
||||||
|
else if (dbSub !== false) {
|
||||||
|
if (navigator.onLine) {
|
||||||
|
log('[app] Re subscribe');
|
||||||
|
pushesSubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function updateNewsBadge() {
|
||||||
|
var newsRead = await dbSettingsGet('news_read_' + BOATCLASS);
|
||||||
|
if (newsRead === null) dbSettingsSet('news_read_' + BOATCLASS, newsRead = new Date());
|
||||||
|
var news = await dbGetData('news');
|
||||||
|
var now = new Date();
|
||||||
|
var sum = 0;
|
||||||
|
for (var n in news) {
|
||||||
|
var newsEntry = news[n];
|
||||||
|
newsEntry.date = parseDbTimestamp(newsEntry.date);
|
||||||
|
if (newsEntry.date > now) continue;
|
||||||
|
if (newsEntry.date < newsRead) continue;
|
||||||
|
sum ++;
|
||||||
|
}
|
||||||
|
updateBadge('more/news', sum);
|
||||||
|
}
|
||||||
|
|
||||||
var initRegatten = function() {
|
var initRegatten = function() {
|
||||||
showLoader();
|
showLoader();
|
||||||
|
|
||||||
|
log('[app] Initializing DB...');
|
||||||
|
|
||||||
initDatabase();
|
initDatabase();
|
||||||
|
|
||||||
|
log('[app] Loading app specific code...');
|
||||||
|
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
$('.show-loggedin').show();
|
$('.show-loggedin').show();
|
||||||
$('.show-notloggedin').hide();
|
$('.show-notloggedin').hide();
|
||||||
@@ -396,14 +575,16 @@ var initRegatten = function() {
|
|||||||
$('.show-loggedin').hide();
|
$('.show-loggedin').hide();
|
||||||
$('.show-notloggedin').show();
|
$('.show-notloggedin').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pushes
|
// Pushes
|
||||||
$('#a-switch-pushes').click(pushesSubscribeClicked);
|
$('#a-switch-pushes').click(pushesSubscribeClicked);
|
||||||
$('.a-switch-pushes-channel').click(pushesChannelClicked);
|
$('.a-switch-pushes-channel-all').click(pushesChannelClicked);
|
||||||
|
$('.a-switch-pushes-channel-my').click(pushesChannelClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
var onServiceWorkerLoaded = function() {
|
var onServiceWorkerLoaded = function() {
|
||||||
if ((swRegistration !== null) && canUseLocalDB) {
|
log('[app] sW loaded');
|
||||||
|
if ((swRegistration !== null) && (swRegistration.pushManager) && canUseLocalDB) {
|
||||||
pushesPossible = true;
|
pushesPossible = true;
|
||||||
updatePushBadge();
|
updatePushBadge();
|
||||||
} else {
|
} else {
|
||||||
@@ -412,6 +593,97 @@ var onServiceWorkerLoaded = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var onDatabaseLoaded = function() {
|
var onDatabaseLoaded = function() {
|
||||||
|
log('[app] DB loaded');
|
||||||
|
if (!canUseLocalDB && !$('#menu-welcome').hasClass('menu-active')) {
|
||||||
|
function NoDbWarningOk() {
|
||||||
|
createCookie('regatten_nodb_banner', true, 1);
|
||||||
|
$('#menu-nodb-warning').hideMenu();
|
||||||
|
}
|
||||||
|
function showNoDbWarning() {
|
||||||
|
if (!readCookie('regatten_nodb_banner')) {
|
||||||
|
$('#menu-nodb-warning').showMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#menu-nodb-warning-okay').click(NoDbWarningOk);
|
||||||
|
showNoDbWarning();
|
||||||
|
}
|
||||||
|
|
||||||
onServiceWorkerLoaded();
|
onServiceWorkerLoaded();
|
||||||
initPushSettings();
|
initPushSettings();
|
||||||
|
|
||||||
|
updateNewsBadge();
|
||||||
|
}
|
||||||
|
|
||||||
|
var onAfterSync = function() {
|
||||||
|
updateNewsBadge();
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendErrorReport() {
|
||||||
|
alert('FEHLERBERICHT\nEs wird jetzt ein Fehlerbericht an die Entwickler geschickt.\nBitte stelle sicher, dass Du mit dem Internet verbunden bist und drücke dann auf OK.');
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'error_report',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
errors: JSON.stringify(consoleOutput),
|
||||||
|
device: navigator.userAgent,
|
||||||
|
version: '<?php echo PWA_VERSION; ?>'
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 0) {
|
||||||
|
alert('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Fehlerbericht zu senden');
|
||||||
|
} else {
|
||||||
|
alert('Beim Senden ist ein unbekannter Fehler aufgetreten. Bitte versuche es noch einmal');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
alert('Wir leiten Dich jetzt zum erstellten Fehlerbericht um, sodass Du ggf. weitere Informationen ergänzen kannst.');
|
||||||
|
location.href = 'https://github.com/ostertun/RegattenApp/issues/' + data.issueNumber;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add console opener to preloader
|
||||||
|
var addConsoleOpenerToPreloader = function() {
|
||||||
|
addConsoleOpenerToPreloader = function(){};
|
||||||
|
var preloader = document.getElementById('preloader');
|
||||||
|
var button = document.createElement('a');
|
||||||
|
button.id = 'button-show-console';
|
||||||
|
button.href = '#';
|
||||||
|
button.classList = 'btn rounded-s text-uppercase font-900 shadow-m m-3 bg-red2-dark bg-white';
|
||||||
|
button.style.position = 'fixed';
|
||||||
|
button.style.bottom = 0;
|
||||||
|
button.style.left = 0;
|
||||||
|
button.style.right = 0;
|
||||||
|
button.innerHTML = 'Fehlerbericht senden';
|
||||||
|
button.onclick = function(){
|
||||||
|
sendErrorReport();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
preloader.appendChild(button);
|
||||||
|
$(button).hide();
|
||||||
|
}
|
||||||
|
addConsoleOpenerToPreloader();
|
||||||
|
|
||||||
|
function m2s_getLink(type, eventId, classId) {
|
||||||
|
switch (type) {
|
||||||
|
case 'entrylist':
|
||||||
|
return 'https://manage2sail.com/de-DE/event/' + eventId + '#!/entries?classId=' + classId;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
function ro_getLink(type, eventId, classId) {
|
||||||
|
switch (type) {
|
||||||
|
case 'entrylist':
|
||||||
|
return 'http://www.raceoffice.org/entrylist.php?eid=' + eventId;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
function extServiceGetLink(serviceName, type, eventId = '', classId = '') {
|
||||||
|
switch (serviceName) {
|
||||||
|
case 'm2s':
|
||||||
|
return m2s_getLink(type, eventId, classId);
|
||||||
|
case 'ro':
|
||||||
|
return ro_getLink(type, eventId);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,4 +194,4 @@ blockquote {
|
|||||||
-ms-animation: fa-blink .75s linear infinite;
|
-ms-animation: fa-blink .75s linear infinite;
|
||||||
-o-animation: fa-blink .75s linear infinite;
|
-o-animation: fa-blink .75s linear infinite;
|
||||||
animation: fa-blink .75s linear infinite;
|
animation: fa-blink .75s linear infinite;
|
||||||
}
|
}
|
||||||
|
|||||||
20
index.php
20
index.php
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once(__DIR__ . '/server/version.php');
|
require_once(__DIR__ . '/server/version.php');
|
||||||
require_once(__DIR__ . '/server/config.php');
|
require_once(__DIR__ . '/server/config.php');
|
||||||
require_once(__DIR__ . '/server/log.php');
|
require_once(__DIR__ . '/server/log.php');
|
||||||
require_once(__DIR__ . '/server/templates.php');
|
require_once(__DIR__ . '/server/templates.php');
|
||||||
require_once(__DIR__ . '/server/scripts.php');
|
require_once(__DIR__ . '/server/scripts.php');
|
||||||
|
|
||||||
define('LINK_PRE', SERVER_ADDR . '/');
|
define('LINK_PRE', SERVER_ADDR . '/');
|
||||||
|
|
||||||
$request = false;
|
$request = false;
|
||||||
if (isset($_GET['request'])) {
|
if (isset($_GET['request'])) {
|
||||||
$request = explode('/', $_GET['request']);
|
$request = explode('/', $_GET['request']);
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
header('Location: ' . LINK_PRE . 'index');
|
header('Location: ' . LINK_PRE . 'index');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists(__DIR__ . '/server/content/' . $site . '.php')) {
|
if (!file_exists(__DIR__ . '/server/content/' . $site . '.php')) {
|
||||||
$site = '404';
|
$site = '404';
|
||||||
}
|
}
|
||||||
|
|
||||||
$sp = [
|
$sp = [
|
||||||
'title' => 'Regatten.net ' . $_CLASS['name'], // This is the page title
|
'title' => 'Regatten.net ' . $_CLASS['name'], // This is the page title
|
||||||
'backbutton' => false, // Show a back button (true, false, string). If a string is given, the back button is a link to this page.
|
'backbutton' => false, // Show a back button (true, false, string). If a string is given, the back button is a link to this page.
|
||||||
@@ -37,12 +37,12 @@
|
|||||||
'menus' => '', // Additional menus go here
|
'menus' => '', // Additional menus go here
|
||||||
'scripts' => '' // Site specific scripts
|
'scripts' => '' // Site specific scripts
|
||||||
];
|
];
|
||||||
|
|
||||||
$tpl = new Templates(__DIR__ . '/server/templates/');
|
$tpl = new Templates(__DIR__ . '/server/templates/');
|
||||||
$scripts = new Scripts(__DIR__ . '/server/scripts/');
|
$scripts = new Scripts(__DIR__ . '/server/scripts/');
|
||||||
|
|
||||||
require_once(__DIR__ . '/server/content/' . $site . '.php');
|
require_once(__DIR__ . '/server/content/' . $site . '.php');
|
||||||
|
|
||||||
require_once(__DIR__ . '/server/buildpage.php');
|
require_once(__DIR__ . '/server/buildpage.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
13
server/content/go2url.php
Normal file
13
server/content/go2url.php
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sp['title'] = 'Umleitung - Regatten.net ' . $_CLASS['name'];
|
||||||
|
|
||||||
|
// Title
|
||||||
|
$content = '<h1>Umleitung</h1>';
|
||||||
|
$content .= '<p>Wir leiten Dich in Kürze zur gewünschten Website weiter</p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-title']);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('go2url');
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,61 +1,72 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Startseite - Regatten.net ' . $_CLASS['name'];
|
$sp['title'] = 'Startseite - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['activenav'] = 1;
|
$sp['activenav'] = 1;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
$content = "<h1>$_CLASS[name]</h1>";
|
$content = "<h1>$_CLASS[name]</h1>";
|
||||||
$content .= "<p>$_CLASS[desc]</p>";
|
$content .= "<p>$_CLASS[desc]</p>";
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// Favorites
|
// Favorites
|
||||||
$content = '<h2>Deine Favoriten</h2>';
|
$content = '<h2>Deine Favoriten</h2>';
|
||||||
$thead = '<tr><th>Segler</th><th id="th-ranking">Rangliste</th></tr>';
|
$content .= '<div id="div-favorites" class="normal-list mb-0"></div>';
|
||||||
$content .= $tpl->load('table', [$thead, 'html-id' => 'table-favorites', 'css-class' => 'mb-0 mt-3']);
|
|
||||||
$content .= '<p id="p-favorites" class="mt-3">';
|
$content .= '<p id="p-favorites" class="mt-3">';
|
||||||
$content .= 'Du folgst <b>keinen</b> Seglern.<br>';
|
$content .= 'Du folgst <b>keinen</b> Seglern.<br>';
|
||||||
$content .= 'Um jemandem zu folgen, gehe zur <a href="' . LINK_PRE . 'sailors">Segler-Liste</a> und wähle bis zu fünf Segler aus.';
|
$content .= 'Um jemandem zu folgen, gehe zur <a href="' . LINK_PRE . 'sailors">Segler-Liste</a> und wähle bis zu fünf Segler aus.';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-favorites']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-favorites']);
|
||||||
|
|
||||||
// Planning next
|
// Planning next
|
||||||
$content = '<h2>Deine nächsten Regatten</h2>';
|
$content = '<h2>Deine nächsten Regatten</h2>';
|
||||||
$content .= '<div id="div-yournext" class="regattas-list mb-0"></div>';
|
$content .= '<div id="div-yournext" class="regattas-list mb-0"></div>';
|
||||||
$content .= '<p id="p-yournext" class="mt-3">';
|
$content .= '<p id="p-yournext" class="mt-3">';
|
||||||
$content .= 'Du fährst in den nächsten vier Wochen auf keine Regatta!';
|
$content .= 'Du fährst in den nächsten vier Wochen auf keine Regatta!';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-yournext']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-yournext']);
|
||||||
|
|
||||||
// Not logged in
|
// Not logged in
|
||||||
$content = '<h2>Nicht angemeldet</h2>';
|
$content = '<h2>Nicht angemeldet</h2>';
|
||||||
$content .= '<p class="mt-3">';
|
$content .= '<p class="mt-3">';
|
||||||
$content .= 'Um alle Funktionen dieser Seite nutzen zu können, <a href="#" data-menu="menu-login">logge Dich bitte ein</a>.<br>';
|
$content .= 'Um alle Funktionen dieser Seite nutzen zu können, <a href="#" data-menu="menu-login">logge Dich bitte ein</a>.<br>';
|
||||||
$content .= 'Solltest Du noch kein Benutzerkonto haben, kannst Du Dich kostenlos <a href="#" data-menu="menu-signup">registrieren</a>.';
|
$content .= 'Solltest Du noch kein Benutzerkonto haben, kannst Du Dich kostenlos <a href="#" data-menu="menu-signup">registrieren</a>.';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notloggedin']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notloggedin']);
|
||||||
|
|
||||||
|
// Notification Info
|
||||||
|
$content = '<h2 class="color-white">Push-Benachrichtigungen</h2>';
|
||||||
|
$content .= '<p class="mt-3 mb-3 color-white">';
|
||||||
|
$content .= '<b>Bleibe immer auf dem Laufendem!</b><br>';
|
||||||
|
$content .= 'Aktiviere einfach unsere Push-Benachrichtigungen und wir informieren Dich über alle Änderungen.<br>';
|
||||||
|
$content .= 'Du bestimmst natürlich, welche Benachrichtigungen Du bekommen möchtest.';
|
||||||
|
$content .= '</p>';
|
||||||
|
$content .= $tpl->load('button', ['Jetzt aktivieren', '#', 'html-id' => 'button-notifications-activate', 'css-class' => 'bg-green2-dark']);
|
||||||
|
$content .= '<p class="text-center mt-3"><a id="a-notifications-later" class="color-grey2-light text-uppercase font-900">Vielleicht später</a></p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-notifications', 'css-class' => 'bg-blue2-dark']);
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
$content = '<h2>Nächste Regatten</h2>';
|
$content = '<h2>Nächste Regatten</h2>';
|
||||||
$content .= '<div id="div-next" class="regattas-list mb-0"></div>';
|
$content .= '<div id="div-next" class="regattas-list mb-0"></div>';
|
||||||
$content .= '<p id="p-next" class="mt-3">';
|
$content .= '<p id="p-next" class="mt-3">';
|
||||||
$content .= 'Keine Regatten in den nächsten zwei Wochen!';
|
$content .= 'Keine Regatten in den nächsten zwei Wochen!';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-next']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-next']);
|
||||||
|
|
||||||
// Last
|
// Last
|
||||||
$content = '<h2>Letzte Regatten</h2>';
|
$content = '<h2>Letzte Regatten</h2>';
|
||||||
$content .= '<div id="div-last" class="regattas-list mb-0"></div>';
|
$content .= '<div id="div-last" class="regattas-list mb-0"></div>';
|
||||||
$content .= '<p id="p-last" class="mt-3">';
|
$content .= '<p id="p-last" class="mt-3">';
|
||||||
$content .= 'Keine Regatten in den letzten zwei Wochen!';
|
$content .= 'Keine Regatten in den letzten zwei Wochen!';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-last']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-last']);
|
||||||
|
|
||||||
// Calendar
|
// Calendar
|
||||||
$content = '<h2>Regatta-Kalender</h2>';
|
$content = '<h2>Regatta-Kalender</h2>';
|
||||||
$content .= '<p>Du willst alle Regatta-Termine in deinem Kalender, aber nicht alles abtippen?<br>Kein Problem! Abonniere einfach unseren ics-Kalender.</p>';
|
$content .= '<p>Du willst alle Regatta-Termine in deinem Kalender, aber nicht alles abtippen?<br>Kein Problem! Abonniere einfach unseren ics-Kalender.</p>';
|
||||||
@@ -65,21 +76,28 @@
|
|||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Regatta-Kalender', 'https://regatten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']);
|
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Regatta-Kalender', 'https://regatten.net/client/calendar/' . BOATCLASS . '/everything.ics', 'css-class' => 'mb-2']);
|
||||||
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender für <font class="replace-username"></font>', 'https://regatten.net/client/calendar/' . BOATCLASS . '/user_%USERID%.ics', 'css-class' => 'show-loggedin replace-userid-href']);
|
$content .= $tpl->load('button', ['<i class="fas fa-calendar-alt"></i> Kalender für <font class="replace-username"></font>', 'https://regatten.net/client/calendar/' . BOATCLASS . '/user_%USERID%.ics', 'css-class' => 'show-loggedin replace-userid-href']);
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// Regattas Menu
|
// Regattas Menu
|
||||||
$items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
$items = '<p id="menu-item-special" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
$items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']);
|
$items .= '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
|
$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', ['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', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
|
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
|
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
|
||||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]);
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]);
|
||||||
|
|
||||||
|
// Favorites Menu
|
||||||
|
$items = $tpl->load('menu/item-icon', ['Nicht mehr folgen', '#', 'html-id' => 'menu-item-unfollow', 'icon' => 'fa-heart', 'css-class' => ' border-0']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-favorite', 'title' => 'Favorit', 'height' => 200]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
||||||
$sp['scripts'] .= $scripts->load('index');
|
$sp['scripts'] .= $scripts->load('index');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,22 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'News - Regatten.net ' . $_CLASS['name'];
|
$sp['title'] = 'News - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = true;
|
$sp['backbutton'] = true;
|
||||||
$sp['activenav'] = 5;
|
$sp['activenav'] = 5;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
$content = "<h1>Neuigkeiten</h1>";
|
$content = "<h1>Neuigkeiten</h1>";
|
||||||
$content .= '<p>Aktuelles der letzten zwölf Monate</p>';
|
$content .= '<p>Aktuelles der letzten zwölf Monate</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
$sp['output'] .= '<div id="news-entries"></div>';
|
||||||
|
|
||||||
|
// Pagination
|
||||||
|
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$sp['menus'] .= $tpl->load('menu/modal', ['html-id' => 'menu-news', 'title' => 'Details']);
|
$sp['menus'] .= $tpl->load('menu/modal', ['html-id' => 'menu-news', 'title' => 'Details']);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||||
$cardTemplate = $tpl->load('card', ['%CONTENT%', 'html-id' => '%ID%', 'css-class' => 'card-news']);
|
$cardTemplate = $tpl->load('card', ['%CONTENT%', 'html-id' => '%ID%', 'css-class' => 'card-news']);
|
||||||
$cardTemplate = str_replace("\n", '', $cardTemplate);
|
$cardTemplate = str_replace("\n", '', $cardTemplate);
|
||||||
$cardTemplate = str_replace("\r", '', $cardTemplate);
|
$cardTemplate = str_replace("\r", '', $cardTemplate);
|
||||||
$sp['scripts'] .= "<script>const cardTemplate = '" . $cardTemplate . "';</script>";
|
$sp['scripts'] .= "<script>const cardTemplate = '" . $cardTemplate . "';</script>";
|
||||||
$sp['scripts'] .= $scripts->load('news');
|
$sp['scripts'] .= $scripts->load('news');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,19 +1,52 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// TODO: Create site
|
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
|
||||||
|
$sp['backbutton'] = 'index';
|
||||||
$sp['title'] = 'Seite noch nicht unterstuuml;tzt - Regatten.net ' . $_CLASS['name'];
|
$sp['activenav'] = 5;
|
||||||
$sp['backbutton'] = true;
|
|
||||||
|
// Title
|
||||||
$content = $tpl->load('error', ['404', 'Seite existiert noch nicht']);
|
$content = '<h1>Saison-Planung</h1>';
|
||||||
$content .= '<p>';
|
$content .= $tpl->load('button', ['<i class="fas fa-list"></i> Saison-Planungen anderer', 'html-id' => 'a-list-plannings', 'css-class' => 'mt-2 mb-2']);
|
||||||
$content .= 'Die gesuchte Seite ist leider noch nicht verfügbar.<br>';
|
$content .= '<p class="mb-1"><b>Hinweis:</b> Diese Seite kannst nur Du sehen.<br>Wenn Du Deine Saison-Planung teilen möchtest, <a id="a-share-planning">klicke hier</a></p>';
|
||||||
$content .= 'Wir arbeiten daran, sie schnellstmöglich zur Verfügung zu stellen.<br>';
|
$content .= $tpl->load('button', ['<i class="fas fa-edit"></i> bearbeiten', 'html-id' => 'a-edit-planning']);
|
||||||
$content .= 'Wie wäre es mit der Homepage?';
|
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= '</p>';
|
|
||||||
$content .= $tpl->load('button', ['Zur Startseite', LINK_PRE . 'index', 'css-class' => 'mb-3']);
|
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-loggedin']);
|
||||||
$content .= $tpl->load('button', ['Kontakt', LINK_PRE . 'contact']);
|
|
||||||
|
// Not loggedin
|
||||||
$sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']);
|
$content = '<h1>Saison-Planung</h1>';
|
||||||
|
$content .= '<p>Um Deine Saison-Planung zu sehen, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="#" data-menu="menu-signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||||
?>
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);
|
||||||
|
|
||||||
|
// Regattas
|
||||||
|
$content = '<p id="p-count" class="mb-0"></p>';
|
||||||
|
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
||||||
|
$content .= '<div id="div-regattas" class="regattas-list mb-0"></div>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas', 'css-class' => 'show-loggedin']);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
$items = '<p id="menu-item-special" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
|
$items .= '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Status bearbeiten', '#', 'html-id' => 'menu-item-status', 'icon' => 'fa-edit']);
|
||||||
|
$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', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]);
|
||||||
|
|
||||||
|
// Menu Edit status
|
||||||
|
$items = $tpl->load('menu/item-switch', ['Gemeldet', 'html-id' => 'switch-status-gemeldet', 'icon' => 'fa-file-signature']);
|
||||||
|
$items .= $tpl->load('menu/item-switch', ['Bezahlt', 'html-id' => 'switch-status-bezahlt', 'icon' => 'fa-euro-sign', 'css-class' => 'border-0']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-status', 'title' => 'Status bearbeiten', 'height' => 220]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
||||||
|
$sp['scripts'] .= $scripts->load('planning');
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,19 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// TODO: Create site
|
$sp['title'] = 'Saison-Planung bearbeiten - Regatten.net ' . $_CLASS['name'];
|
||||||
|
|
||||||
$sp['title'] = 'Seite noch nicht unterstuuml;tzt - Regatten.net ' . $_CLASS['name'];
|
|
||||||
$sp['backbutton'] = true;
|
$sp['backbutton'] = true;
|
||||||
|
$sp['activenav'] = 5;
|
||||||
$content = $tpl->load('error', ['404', 'Seite existiert noch nicht']);
|
|
||||||
$content .= '<p>';
|
// Title, Inputs
|
||||||
$content .= 'Die gesuchte Seite ist leider noch nicht verfügbar.<br>';
|
$content = "<h1>Saison-Planung bearbeiten</h1>";
|
||||||
$content .= 'Wir arbeiten daran, sie schnellstmöglich zur Verfügung zu stellen.<br>';
|
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= 'Wie wäre es mit der Homepage?';
|
|
||||||
$content .= '</p>';
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
$content .= $tpl->load('button', ['Zur Startseite', LINK_PRE . 'index', 'css-class' => 'mb-3']);
|
|
||||||
$content .= $tpl->load('button', ['Kontakt', LINK_PRE . 'contact']);
|
// Regattas
|
||||||
|
$content = '<p id="p-count" class="mb-0"></p>';
|
||||||
$sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']);
|
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
||||||
|
$content .= '<div id="div-regattas" class="ranking-detail-list mb-0"></div>';
|
||||||
?>
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
$items = $tpl->load('menu/item-switch', ['In die Saison-Planung aufnehmen', 'html-id' => 'switch-planning-include', 'icon' => 'fa-check']);
|
||||||
|
$items .= $tpl->load('menu/item-simple', ['', '#', 'html-id' => 'item-boat']);
|
||||||
|
$items .= $tpl->load('menu/item-simple', ['', '#', 'html-id' => 'item-steuermann']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edit', 'title' => 'Regatta bearbeiten', 'height' => 400]);
|
||||||
|
|
||||||
|
// Select boat
|
||||||
|
$items = $tpl->load('input', ['html-id' => 'input-edit-boat-search', 'placeholder' => 'Suche', 'type' => 'text']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-boat', 'height' => 500, 'width' => 350]);
|
||||||
|
|
||||||
|
// Select sailor
|
||||||
|
$items = $tpl->load('input', ['html-id' => 'input-edit-search', 'placeholder' => 'Suche', 'type' => 'text']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/modal', [$items, 'html-id' => 'menu-sailor', 'height' => 500, 'width' => 350]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('planning_edit');
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,19 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// TODO: Create site
|
$sp['title'] = 'Saison-Planungen - Regatten.net ' . $_CLASS['name'];
|
||||||
|
|
||||||
$sp['title'] = 'Seite noch nicht unterstuuml;tzt - Regatten.net ' . $_CLASS['name'];
|
|
||||||
$sp['backbutton'] = true;
|
$sp['backbutton'] = true;
|
||||||
|
$sp['activenav'] = 5;
|
||||||
$content = $tpl->load('error', ['404', 'Seite existiert noch nicht']);
|
|
||||||
$content .= '<p>';
|
// Title
|
||||||
$content .= 'Die gesuchte Seite ist leider noch nicht verfügbar.<br>';
|
$content = '<h1>Saison-Planungen</h1>';
|
||||||
$content .= 'Wir arbeiten daran, sie schnellstmöglich zur Verfügung zu stellen.<br>';
|
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= 'Wie wäre es mit der Homepage?';
|
|
||||||
$content .= '</p>';
|
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-loggedin']);
|
||||||
$content .= $tpl->load('button', ['Zur Startseite', LINK_PRE . 'index', 'css-class' => 'mb-3']);
|
|
||||||
$content .= $tpl->load('button', ['Kontakt', LINK_PRE . 'contact']);
|
// Not loggedin
|
||||||
|
$content = '<h1>Saison-Planungen</h1>';
|
||||||
$sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']);
|
$content .= '<p>Um die Saison-Planungen anderer zu sehen, musst Du angemeldet sein.<br><a href="#" data-menu="menu-login">Melde Dich hier an</a> oder <a href="#" data-menu="menu-signup">registriere Dich jetzt kostenlos</a>.</p>';
|
||||||
|
|
||||||
?>
|
$sp['output'] .= $tpl->load('card', [$content, 'css-class' => 'show-notloggedin']);
|
||||||
|
|
||||||
|
// Regattas
|
||||||
|
$content = $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text']);
|
||||||
|
$content .= '<div id="div-users" class="normal-list mb-0"></div>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas', 'css-class' => 'show-loggedin']);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('planning_list');
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,19 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// TODO: Create site
|
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
|
||||||
|
|
||||||
$sp['title'] = 'Seite noch nicht unterstuuml;tzt - Regatten.net ' . $_CLASS['name'];
|
|
||||||
$sp['backbutton'] = true;
|
$sp['backbutton'] = true;
|
||||||
|
$sp['activenav'] = 5;
|
||||||
$content = $tpl->load('error', ['404', 'Seite existiert noch nicht']);
|
|
||||||
$content .= '<p>';
|
// Title
|
||||||
$content .= 'Die gesuchte Seite ist leider noch nicht verfügbar.<br>';
|
$content = '<h1>Saison-Planung</h1>';
|
||||||
$content .= 'Wir arbeiten daran, sie schnellstmöglich zur Verfügung zu stellen.<br>';
|
$content .= '<p id="p-username" class="mb-1"></p>';
|
||||||
$content .= 'Wie wäre es mit der Homepage?';
|
$content .= $tpl->load('button', ['<i class="fas fa-share-alt"></i> Teilen', '#', 'html-id' => 'button-share']);
|
||||||
$content .= '</p>';
|
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= $tpl->load('button', ['Zur Startseite', LINK_PRE . 'index', 'css-class' => 'mb-3']);
|
|
||||||
$content .= $tpl->load('button', ['Kontakt', LINK_PRE . 'contact']);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
$sp['output'] = $tpl->load('card', [$content, 'css-class' => 'text-center pt-3']);
|
// Regattas
|
||||||
|
$content = '<p id="p-count" class="mb-0"></p>';
|
||||||
?>
|
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
||||||
|
$content .= '<div id="div-regattas" class="ranking-detail-list mb-0"></div>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
$items = '<p id="menu-item-special" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
|
$items .= '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
|
$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', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
||||||
|
$sp['scripts'] .= $scripts->load('planning_view');
|
||||||
|
|
||||||
|
?>
|
||||||
|
|||||||
@@ -1,46 +1,45 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Ranglisten - Regatten.net ' . $_CLASS['name'];
|
$sp['title'] = 'Ranglisten - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = 'index';
|
$sp['backbutton'] = 'index';
|
||||||
$sp['activenav'] = 3;
|
$sp['activenav'] = 3;
|
||||||
|
|
||||||
// Title, Inputs
|
// Title, Inputs
|
||||||
$content = "<h1>Ranglisten</h1>";
|
$content = "<h1>Ranglisten</h1>";
|
||||||
|
|
||||||
$options = '<option value="year">Jahres-Rangliste</option>';
|
|
||||||
$options .= '<option value="youth">Jugend-Rangliste</option>';
|
|
||||||
$options .= '<option value="idjm">' . $_CLASS['youth-german-name'] . '-Rangliste</option>';
|
|
||||||
$options .= '<option value="user">Benutzerdefiniert</option>';
|
|
||||||
$content .= $tpl->load('select', ['html-id' => 'select-type', 'placeholder' => 'Rangliste', 'options' => $options, 'css-class' => 'mt-3 mb-0']);
|
|
||||||
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||||
|
$content .= $tpl->load('select', ['html-id' => 'select-type', 'placeholder' => 'Rangliste', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-from', 'placeholder' => 'Von', 'type' => 'date', 'css-class' => 'mt-3']);
|
$content .= $tpl->load('input', ['html-id' => 'input-from', 'placeholder' => 'Von', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-to', 'placeholder' => 'Bis', 'type' => 'date']);
|
$content .= $tpl->load('input', ['html-id' => 'input-to', 'placeholder' => 'Bis', 'type' => 'date']);
|
||||||
$chbox = $tpl->load('checkbox', ['html-id' => 'input-jugend', 'placeholder' => 'Jugend']);
|
$content .= $tpl->load('input', ['html-id' => 'input-altm', 'placeholder' => 'alt. m', 'type' => 'number']);
|
||||||
$content .= '<div class="mb-3" style="display:inline-block; width:50%;">' . $chbox . '</div>';
|
$content .= $tpl->load('input', ['html-id' => 'input-maxage', 'placeholder' => 'max. Alter (leer = nicht prüfen)', 'type' => 'number']);
|
||||||
$chbox = $tpl->load('checkbox', ['html-id' => 'input-jugstrict', 'placeholder' => 'Streng']);
|
$content .= $tpl->load('checkbox', ['html-id' => 'input-agestrict', 'placeholder' => 'unb. Jahrgänge ausschließen']);
|
||||||
$content .= '<div class="mb-3" style="display:inline-block; width:50%;">' . $chbox . '</div>';
|
$content .= $tpl->load('checkbox', ['html-id' => 'input-agecrew', 'placeholder' => 'Crew auch prüfen']);
|
||||||
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show']);
|
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show']);
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// Sepcial ranks
|
||||||
|
$sp['output'] .= $tpl->load('card', ['', 'html-id' => 'card-special-ranks']);
|
||||||
|
|
||||||
// No Results
|
// No Results
|
||||||
$content = '<h2 class="color-white">ACHTUNG</h2>';
|
$content = '<h2 class="color-white">ACHTUNG</h2>';
|
||||||
$content .= '<p class="color-white">Zu folgenden Regatten wurden noch keine Ergebnisse hinterlegt:</p>';
|
$content .= '<p class="color-white">Zu folgenden Regatten wurden noch keine Ergebnisse hinterlegt:</p>';
|
||||||
$content .= '<ul id="ul-noresults"></ul>';
|
$content .= '<ul id="ul-noresults"></ul>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-noresults', 'css-class' => 'bg-red2-dark']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-noresults', 'css-class' => 'bg-red2-dark']);
|
||||||
|
|
||||||
// Ranking
|
// Ranking
|
||||||
$content = $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text']);
|
$content = $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text']);
|
||||||
$content .= '<div id="div-rank" class="ranking-list mb-0"></div>';
|
$content .= '<div id="div-rank" class="ranking-list mb-0"></div>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-rank']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-rank']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$items = '<p id="menu-item-text" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
$items = '<p id="menu-item-text" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
$items .= '<div id="div-details" class="ranking-detail-list mb-3" style="line-height: 2em;"></div>';
|
$items .= '<div id="div-details" class="ranking-detail-list mb-3" style="line-height: 2em;"></div>';
|
||||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-rank', 'title' => 'Ranglisten-Details', 'height' => 500]);
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-rank', 'title' => 'Ranglisten-Details', 'height' => 500]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('rank');
|
$sp['scripts'] .= $scripts->load('rank');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
49
server/content/regatta_facts.php
Normal file
49
server/content/regatta_facts.php
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sp['title'] = 'Fakten - Regatten.net ' . $_CLASS['name'];
|
||||||
|
$sp['backbutton'] = true;
|
||||||
|
$sp['activenav'] = 2;
|
||||||
|
|
||||||
|
// Title, Inputs
|
||||||
|
$content = '<h1 id="h1-title"></h1>';
|
||||||
|
$content .= '<p id="p-title"></p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// NO FACTS INFO
|
||||||
|
$content = '<p>Es sind keine Fakten zu dieser Veranstaltung hinterlegt. Bitte lies die Ausschreibung.</p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-nofactsinfo']);
|
||||||
|
|
||||||
|
// Meldegeld
|
||||||
|
$content = '<h2>Meldegeld</h2>';
|
||||||
|
$content .= '<p></p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-entryfee']);
|
||||||
|
|
||||||
|
// Wettfahrten
|
||||||
|
$content = '<h2>Wettfahrten</h2>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-races']);
|
||||||
|
|
||||||
|
// Zeitplan
|
||||||
|
$content = '<h2>Zeitplan</h2>';
|
||||||
|
$content .= $tpl->load('table', ['css-class' => 'mb-0 text-nowrap']);
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-times']);
|
||||||
|
|
||||||
|
// Camping
|
||||||
|
$content = '<h2>Camping</h2>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-camping']);
|
||||||
|
|
||||||
|
// Verpflegung
|
||||||
|
$content = '<h2>Verpflegung</h2>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-food']);
|
||||||
|
|
||||||
|
// Weitere Infos
|
||||||
|
$content = '<h2>Weitere Informationen</h2><p></p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-text']);
|
||||||
|
|
||||||
|
// Disclaimer
|
||||||
|
$content = '<p><i>Alle Angaben ohne Gewähr. Änderungen vorbehalten. Am Ende gilt, was in der Ausschreibung / Segelanweisung steht!</i></p>';
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('regatta_facts');
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,31 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
|
$sp['title'] = 'Saison-Planung - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = 'regattas';
|
$sp['backbutton'] = 'regattas';
|
||||||
$sp['activenav'] = 2;
|
$sp['activenav'] = 2;
|
||||||
|
|
||||||
// Title, Inputs
|
// Title, Inputs
|
||||||
$content = '<h1 id="h1-title"></h1>';
|
$content = '<h1 id="h1-title"></h1>';
|
||||||
$content .= '<p id="p-title"></p>';
|
$content .= '<p id="p-title"></p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// Plannings
|
// Plannings
|
||||||
$content = '<p id="p-info" class="mb-0"></p>';
|
$content = '<p id="p-info" class="mb-0"></p>';
|
||||||
$thead = '<tr><th>Benutzer</th><th>Steuermann/-frau</th><th>Crew</th></tr>';
|
$thead = '<tr><th>Benutzer</th><th>Boot</th><th>Steuermann/-frau</th><th>Crew</th></tr>';
|
||||||
$content .= $tpl->load('table', [$thead, 'html-id' => 'table-plannings', 'css-class' => 'mb-0 text-nowrap']);
|
$content .= $tpl->load('table', [$thead, 'html-id' => 'table-plannings', 'css-class' => 'mb-0 text-nowrap']);
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-plannings']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-plannings']);
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
$content = '<p>Du planst, hier hinzufahren, aber stehst nicht auf dieser Liste?<br>';
|
$content = '<p>Du planst, hier hinzufahren, aber stehst nicht auf dieser Liste?<br>';
|
||||||
$content .= 'Das kannst Du ändern! ';
|
$content .= 'Das kannst Du ändern! ';
|
||||||
$content .= '<font class="show-loggedin">Erstelle einfach <a href="' . LINK_PRE . 'planning">hier</a> Deine eigene Saison-Planung.</font>';
|
$content .= '<font class="show-loggedin">Erstelle einfach <a href="' . LINK_PRE . 'planning">hier</a> Deine eigene Saison-Planung.</font>';
|
||||||
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-login">Melde Dich an</a> oder <a href="#" data-menu="menu-signup">registriere Dich kostenlos</a> und erstelle Deine eigene Saison-Planung.</font>';
|
$content .= '<font class="show-notloggedin"><a href="#" data-menu="menu-login">Melde Dich an</a> oder <a href="#" data-menu="menu-signup">registriere Dich kostenlos</a> und erstelle Deine eigene Saison-Planung.</font>';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('regatta_plan');
|
$sp['scripts'] .= $scripts->load('regatta_plan');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,38 +1,48 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Regatten - Regatten.net ' . $_CLASS['name'];
|
$sp['title'] = 'Regatten - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = 'index';
|
$sp['backbutton'] = 'index';
|
||||||
$sp['activenav'] = 2;
|
$sp['activenav'] = 2;
|
||||||
|
|
||||||
// Title, Inputs
|
// Title, Inputs
|
||||||
$content = "<h1>Regatten</h1>";
|
$content = "<h1>Regatten</h1>";
|
||||||
|
|
||||||
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
$content .= $tpl->load('select', ['html-id' => 'select-year', 'placeholder' => 'Jahr', 'css-class' => 'mt-3 mb-0']);
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-from', 'placeholder' => 'Von', 'type' => 'date', 'css-class' => 'mt-3']);
|
$content .= $tpl->load('input', ['html-id' => 'input-from', 'placeholder' => 'Von', 'type' => 'date', 'css-class' => 'mt-3']);
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-to', 'placeholder' => 'Bis', 'type' => 'date']);
|
$content .= $tpl->load('input', ['html-id' => 'input-to', 'placeholder' => 'Bis', 'type' => 'date']);
|
||||||
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show']);
|
$content .= $tpl->load('button', ['Anzeigen', '#', 'html-id' => 'button-show']);
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// To today
|
||||||
|
$content = $tpl->load('button', ['<i class="fas fa-arrow-down"></i> Heute <i class="fas fa-arrow-down"></i>', '#', 'html-id' => 'button-totoday']);
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// Regattas
|
// Regattas
|
||||||
$content = '<p id="p-count" class="mb-0"></p>';
|
$content = '<p id="p-count" class="mb-0"></p>';
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
||||||
$content .= '<div id="div-regattas" class="regattas-list mb-0"></div>';
|
$content .= '<div id="div-regattas" class="regattas-list mb-0"></div>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-regattas']);
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', ['<p></p>', 'html-id' => 'card-special']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$items = '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
$items = '<p id="menu-item-special" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
$items .= $tpl->load('menu/item-icon', ['Saison-Planungen', '', 'html-id' => 'menu-item-plannings', 'icon' => 'fa-calendar-alt']);
|
$items .= '<p id="menu-item-yourplanning" class="mb-2 mt-1" style="line-height: 1.5em;"></p>';
|
||||||
|
$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', ['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', ['Bericht', '', 'html-id' => 'menu-item-bericht', 'icon' => 'fa-book']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['Fakten', '', 'html-id' => 'menu-item-facts', 'icon' => 'fa-list']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
$items .= $tpl->load('menu/item-icon', ['Informationen', '', 'html-id' => 'menu-item-info', 'icon' => 'fa-info']);
|
||||||
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
$items .= $tpl->load('menu/item-icon-badge', ['Meldung', '', 'html-id' => 'menu-item-meldung', 'icon' => 'fa-file-signature', 'badge-id' => 'badge-regatta-meldung']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
|
$items .= $tpl->load('menu/item-icon', ['offizielle Ergebnisse', '', 'html-id' => 'menu-item-oresults', 'icon' => 'fa-poll']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
|
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe']);
|
||||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 320]);
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-regatta', 'title' => 'Regatta-Details', 'height' => 400]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
$sp['scripts'] .= $scripts->load('onRegattaClicked');
|
||||||
$sp['scripts'] .= $scripts->load('regattas');
|
$sp['scripts'] .= $scripts->load('regattas');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name'];
|
$sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = 'index';
|
$sp['backbutton'] = 'index';
|
||||||
$sp['activenav'] = 4;
|
$sp['activenav'] = 4;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
$content = "<h1>Segler</h1>";
|
$content = "<h1>Segler</h1>";
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// Info Years
|
// Info Years
|
||||||
$content = '<h2>Jahrgänge</h2>';
|
$content = '<h2>Jahrgänge</h2>';
|
||||||
$content .= '<p>';
|
$content .= '<p>';
|
||||||
@@ -17,30 +17,32 @@
|
|||||||
$content .= 'Klicke dazu einfach auf den entsprechenden Segler und wähle Jahrgang bearbeiten aus.<br>';
|
$content .= 'Klicke dazu einfach auf den entsprechenden Segler und wähle Jahrgang bearbeiten aus.<br>';
|
||||||
$content .= 'Vielen Dank für Deine Unterstützung!';
|
$content .= 'Vielen Dank für Deine Unterstützung!';
|
||||||
$content .= '</p>';
|
$content .= '</p>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content]);
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
// List
|
// List
|
||||||
$content = '<p id="p-count" class="mb-0"></p>';
|
$content = '<p id="p-count" class="mb-0"></p>';
|
||||||
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
$content .= $tpl->load('input', ['html-id' => 'input-search', 'placeholder' => 'Suche', 'type' => 'text', 'css-class' => 'mt-2']);
|
||||||
$content .= '<div id="div-list" class="normal-list mb-0"></div>';
|
$content .= '<div id="div-list" class="normal-list mb-0"></div>';
|
||||||
|
|
||||||
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']);
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']);
|
||||||
|
|
||||||
// Pagination
|
// Pagination
|
||||||
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
|
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
|
||||||
|
|
||||||
// Menu
|
// Menu
|
||||||
$items = $tpl->load('menu/item-icon', ['', '#', 'html-id' => 'menu-item-year', 'icon' => 'fa-edit']);
|
$items = $tpl->load('menu/item-switch', ['Favorit', 'html-id' => 'menu-item-follow', 'icon' => 'fa-heart']);
|
||||||
|
$items .= $tpl->load('menu/item-icon-badge', ['Favorit', '#', 'html-id' => 'menu-item-follow-disabled', 'icon' => 'fa-heart', 'badge-value' => 'MAX REACHED']);
|
||||||
|
$items .= $tpl->load('menu/item-icon', ['', '#', 'html-id' => 'menu-item-year', 'icon' => 'fa-edit']);
|
||||||
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe', 'css-class' => 'border-0']);
|
$items .= $tpl->load('menu/item-icon', ['Vereins-Website', '', 'html-id' => 'menu-item-clubwebsite', 'icon' => 'fa-globe', 'css-class' => 'border-0']);
|
||||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-sailor', 'title' => 'Segler-Details', 'height' => 200]);
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-sailor', 'title' => 'Segler-Details', 'height' => 260]);
|
||||||
|
|
||||||
$items = '<p class="mb-2 mt-1" style="line-height: 1.5em;">Bitte trage hier den Jahrgang ein:</p>';
|
$items = '<p class="mb-2 mt-1" style="line-height: 1.5em;">Bitte trage hier den Jahrgang ein:</p>';
|
||||||
$items .= $tpl->load('input', ['html-id' => 'input-edityear', 'placeholder' => 'Jahrgang', 'type' => 'number']);
|
$items .= $tpl->load('input', ['html-id' => 'input-edityear', 'placeholder' => 'Jahrgang', 'type' => 'number']);
|
||||||
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-edityear']);
|
$items .= $tpl->load('button', ['Speichern', '#', 'html-id' => 'button-edityear']);
|
||||||
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edityear', 'height' => 240]);
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-edityear', 'height' => 240]);
|
||||||
|
|
||||||
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||||
$sp['scripts'] .= $scripts->load('sailors');
|
$sp['scripts'] .= $scripts->load('sailors');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
<div id="menu-share" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="345" data-menu-effect="menu-over">
|
<div id="menu-share" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="345" data-menu-effect="menu-over">
|
||||||
<div class="menu-title mt-n1"><h1>Share the Love</h1><p class="color-highlight">Just Tap the Social Icon. We'll add the Link</p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
<div class="menu-title mt-n1"><h1>Seite Teilen</h1><p class="color-highlight">Teile diese Seite mit Deinen Freunden!</p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
||||||
<div class="content mb-0">
|
<div class="content mb-0">
|
||||||
<div class="divider mb-0"></div>
|
<div class="divider mb-0"></div>
|
||||||
<div class="list-group list-custom-small list-icon-0">
|
<div class="list-group list-custom-small list-icon-0">
|
||||||
<a href="#" class="shareToFacebook">
|
<a href="#" class="shareToFacebook" target="_blank">
|
||||||
<i class="font-18 fab fa-facebook color-facebook"></i>
|
<i class="font-18 fab fa-facebook color-facebook"></i>
|
||||||
<span class="font-13">Facebook</span>
|
<span class="font-13">Facebook</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="shareToTwitter">
|
<a href="#" class="shareToTwitter" target="_blank">
|
||||||
<i class="font-18 fab fa-twitter-square color-twitter"></i>
|
<i class="font-18 fab fa-twitter-square color-twitter"></i>
|
||||||
<span class="font-13">Twitter</span>
|
<span class="font-13">Twitter</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="shareToLinkedIn">
|
<a href="#" class="shareToLinkedIn" target="_blank">
|
||||||
<i class="font-18 fab fa-linkedin color-linkedin"></i>
|
<i class="font-18 fab fa-linkedin color-linkedin"></i>
|
||||||
<span class="font-13">LinkedIn</span>
|
<span class="font-13">LinkedIn</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="shareToWhatsApp">
|
<a href="#" class="shareToWhatsApp" target="_blank">
|
||||||
<i class="font-18 fab fa-whatsapp-square color-whatsapp"></i>
|
<i class="font-18 fab fa-whatsapp-square color-whatsapp"></i>
|
||||||
<span class="font-13">WhatsApp</span>
|
<span class="font-13">WhatsApp</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="shareToMail border-0">
|
<a href="#" class="shareToMail border-0" target="_blank">
|
||||||
<i class="font-18 fa fa-envelope-square color-mail"></i>
|
<i class="font-18 fa fa-envelope-square color-mail"></i>
|
||||||
<span class="font-13">Email</span>
|
<span class="font-13">Email</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
(meine) bezieht sich auf die Regatten, die in Deiner Saison-Planung sind,<br>
|
(meine) bezieht sich auf die Regatten, die in Deiner Saison-Planung sind,<br>
|
||||||
(alle) informiert Dich über alle Regatten
|
(alle) informiert Dich über alle Regatten
|
||||||
</p>
|
</p>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-news" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-news" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-newspaper rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-newspaper rounded-s bg-highlight color-white"></i>
|
||||||
<span>Neuigkeiten</span>
|
<span>Neuigkeiten</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -162,15 +162,16 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-news"></label>
|
<label class="custom-control-label" for="switch-pushes-news"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-my" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-my" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
||||||
<span>Regatta verschoben (meine)</span>
|
<span>Regatta verschoben (meine)</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-regatta-changed-my">
|
<input type="checkbox" class="ios-input" id="switch-pushes-regatta-changed-my">
|
||||||
<label class="custom-control-label" for="switch-pushes-regatta-changed-my"></label>
|
<label class="custom-control-label" for="switch-pushes-regatta-changed-my"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-all" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-regatta-changed-all" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-calendar-check rounded-s bg-highlight color-white"></i>
|
||||||
<span>Regatta verschoben (alle)</span>
|
<span>Regatta verschoben (alle)</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -178,15 +179,16 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-regatta-changed-all"></label>
|
<label class="custom-control-label" for="switch-pushes-regatta-changed-all"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-result-ready-my" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-result-ready-my" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ergebnisse verfügbar (meine)</span>
|
<span>Ergebnisse verfügbar (meine)</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-result-ready-my">
|
<input type="checkbox" class="ios-input" id="switch-pushes-result-ready-my">
|
||||||
<label class="custom-control-label" for="switch-pushes-result-ready-my"></label>
|
<label class="custom-control-label" for="switch-pushes-result-ready-my"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-result-ready-all" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-result-ready-all" class="pb-2 a-switch-pushes-channel-all">
|
||||||
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-poll rounded-s bg-highlight color-white"></i>
|
||||||
<span>Ergebnisse verfügbar (alle)</span>
|
<span>Ergebnisse verfügbar (alle)</span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
@@ -194,9 +196,10 @@
|
|||||||
<label class="custom-control-label" for="switch-pushes-result-ready-all"></label>
|
<label class="custom-control-label" for="switch-pushes-result-ready-all"></label>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" data-trigger-switch="switch-pushes-meldeschluss" class="pb-2 a-switch-pushes-channel">
|
<a href="#" data-trigger-switch="switch-pushes-meldeschluss" class="pb-2 a-switch-pushes-channel-my">
|
||||||
<i class="fa font-14 fa-file-signature rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-file-signature rounded-s bg-highlight color-white"></i>
|
||||||
<span>Melde-Erinnerungen</span>
|
<span>Melde-Erinnerungen</span>
|
||||||
|
<span class="badge bg-red2-dark color-white"></span>
|
||||||
<div class="custom-control scale-switch ios-switch">
|
<div class="custom-control scale-switch ios-switch">
|
||||||
<input type="checkbox" class="ios-input" id="switch-pushes-meldeschluss">
|
<input type="checkbox" class="ios-input" id="switch-pushes-meldeschluss">
|
||||||
<label class="custom-control-label" for="switch-pushes-meldeschluss"></label>
|
<label class="custom-control-label" for="switch-pushes-meldeschluss"></label>
|
||||||
@@ -206,36 +209,46 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menu-developer" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="310">
|
<div id="menu-developer" class="menu menu-box-bottom menu-box-detached rounded-m" data-menu-height="400">
|
||||||
<div class="menu-title"><h1>Entwickler-Optionen</h1><p class="color-highlight">Version <?php echo PWA_VERSION; ?></p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
<div class="menu-title"><h1>Entwickler-Optionen</h1><p class="color-highlight">Version <?php echo PWA_VERSION; ?></p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
||||||
<div class="divider divider-margins mb-n2"></div>
|
<div class="divider divider-margins mb-n2"></div>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="list-group list-custom-small">
|
<div class="list-group list-custom-small">
|
||||||
<a href="https://info.ostertun.net/regatten/beta">
|
<a href="https://github.com/ostertun/RegattenApp/wiki">
|
||||||
<i class="fa font-14 fa-info rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-info rounded-s bg-highlight color-white"></i>
|
||||||
<span>Infos zur BETA</span>
|
<span>App-Wiki</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="javascript:resetDb(false);">
|
<a href="javascript:deleteDb();">
|
||||||
<i class="fa font-14 fa-database rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-database rounded-s bg-highlight color-white"></i>
|
||||||
<span>Reset Database</span>
|
<span>Reset Database</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="javascript:resetCache();">
|
<a href="javascript:deleteCache();">
|
||||||
<i class="fa font-14 fa-trash-alt rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-trash-alt rounded-s bg-highlight color-white"></i>
|
||||||
<span>Reset Cache</span>
|
<span>Reset Cache</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://report.regatten.net/" class="border-0">
|
<a href="https://github.com/ostertun/RegattenApp/issues/new">
|
||||||
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
||||||
<span>Problem melden</span>
|
<span>Problem melden</span>
|
||||||
<i class="fa fa-angle-right"></i>
|
<i class="fa fa-angle-right"></i>
|
||||||
</a>
|
</a>
|
||||||
|
<a href="#" onclick="sendErrorReport(); return false;" class="menu-close">
|
||||||
|
<i class="fa font-14 fa-bug rounded-s bg-highlight color-white"></i>
|
||||||
|
<span>Fehlerbericht senden</span>
|
||||||
|
<i class="fa fa-angle-right"></i>
|
||||||
|
</a>
|
||||||
|
<a href="#" onclick="mobileConsole.displayConsole(); return false;" class="border-0 menu-close">
|
||||||
|
<i class="fa font-14 fa-terminal rounded-s bg-highlight color-white"></i>
|
||||||
|
<span>Console anzeigen</span>
|
||||||
|
<i class="fa fa-angle-right"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menu-login" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="270">
|
<div id="menu-login" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="320">
|
||||||
<div class="content bottom-0">
|
<div class="content bottom-0">
|
||||||
<h1 class="text-center mt-5 font-900">Login</h1>
|
<h1 class="text-center mt-5 font-900">Login</h1>
|
||||||
<div class="input-style input-style-2 has-icon input-required">
|
<div class="input-style input-style-2 has-icon input-required">
|
||||||
@@ -249,18 +262,29 @@
|
|||||||
<input id="input-login-password" class="form-control" type="password" placeholder="Passwort" />
|
<input id="input-login-password" class="form-control" type="password" placeholder="Passwort" />
|
||||||
</div>
|
</div>
|
||||||
<a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="login();">Login</a>
|
<a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="login();">Login</a>
|
||||||
|
<p class="text-center mt-3"><a class="text-uppercase font-900" href="https://regatten.net/reset">Benutzername oder Passwort vergessen</a></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menu-signup" class="menu menu-box-modal menu-box-detached rounded-m" data-menu-height="300">
|
<div id="menu-signup" class="menu menu-box-top menu-box-detached rounded-m" data-menu-height="340">
|
||||||
<div class="content bottom-0">
|
<div class="content bottom-0">
|
||||||
<h1 class="text-center mt-5 font-900">Registrieren</h1>
|
<h1 class="text-center mt-5 font-900">Registrieren</h1>
|
||||||
<p class="text-center">
|
<div class="input-style input-style-2 has-icon input-required">
|
||||||
Momentan kannst Du Dich leider nicht in der App registrieren.<br>
|
<i class="input-icon fa fa-user color-theme"></i>
|
||||||
Das ist aber kein Problem, registriere Dich einfach kostenlos auf unserer Website!
|
<span class="color-highlight">Benutzername</span>
|
||||||
</p>
|
<input id="input-signup-username" class="form-control" type="name" placeholder="Benutzername" />
|
||||||
<a href="https://regatten.net/de/signup" class="btn btn-center-xl btn-m shadow-xl rounded-s bg-highlight font-900 text-center">Registrieren</a>
|
</div>
|
||||||
<p class="text-center font-10 bottom-0">Du kannst Dich danach in dieser App anmelden.</p>
|
<div class="input-style input-style-2 has-icon input-required">
|
||||||
|
<i class="input-icon fa fa-envelope color-theme"></i>
|
||||||
|
<span class="color-highlight">Email</span>
|
||||||
|
<input id="input-signup-email" class="form-control" type="email" placeholder="Email" />
|
||||||
|
</div>
|
||||||
|
<div class="input-style input-style-2 has-icon input-required">
|
||||||
|
<i class="input-icon fa fa-lock color-theme"></i>
|
||||||
|
<span class="color-highlight">Passwort</span>
|
||||||
|
<input id="input-signup-password" class="form-control" type="password" placeholder="Passwort" />
|
||||||
|
</div>
|
||||||
|
<a class="btn btn-m mt-2 mb-2 btn-full bg-green2-dark text-uppercase font-900" href="#" onclick="signup();">Registrieren</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -283,14 +307,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="menu-update">
|
<div id="menu-nodb-warning" class="menu menu-box-bottom menu-box-detached rounded-m" data-height="500">
|
||||||
|
<div class="menu-title"><h1>Warnung</h1><p class="color-highlight">Datenbank nicht unterstützt</p><a href="#" class="close-menu"><i class="fa fa-times"></i></a></div>
|
||||||
|
<div class="divider divider-margins mb-n2"></div>
|
||||||
<div class="content bottom-0">
|
<div class="content bottom-0">
|
||||||
<p class="text-center mt-5"><i class="fa fa-sync-alt fa-7x color-highlight fa-spin"></i></p>
|
<p>
|
||||||
<h1 class="text-center mt-5 font-900">Update Verfügbar</h1>
|
Das Speichern der benötigten Daten wird von Deinem Gerät nicht unterstützt.<br>
|
||||||
<p class="text-center">
|
Da deshalb die Daten jedesmal direkt vom Server geladen werden müssen, kannst Du die App nicht offline nutzen.<br>
|
||||||
Eine neue Version unserer App ist verfügbar. Keine Sorge, Du musst nichts machen. Wir aktuallisieren den Inhalt in wenigen Sekunden.
|
Das Nachladen kann außerdem gerade bei großen Datenmengen (wie Ranglisten) sehr lange dauern.
|
||||||
</p>
|
Wir empfehlen Dir daher, auf diesem Gerät unsere normale Website zu benutzen. Diese ist auch für Mobil-Geräte optimiert.
|
||||||
<a href="#" class="page-update btn btn-center-xl btn-m shadow-xl rounded-s bg-highlight font-900 text-center">Update</a>
|
</p>
|
||||||
<p class="text-center font-10 bottom-0">Die App wird neu laden und das Update ist abgeschlossen.</p>
|
<a class="btn btn-m mt-2 btn-full bg-highlight text-uppercase font-900" href="https://regatten.net/">Zur Website</a>
|
||||||
|
<a id="menu-nodb-warning-okay" class="btn btn-m mt-2 mb-3 btn-full bg-highlight text-uppercase font-900" href="#">Nicht erneut anzeigen</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<!DOCTYPE HTML>
|
<!DOCTYPE HTML>
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/mobileconsole.js"></script>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||||
@@ -16,36 +17,37 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="<?php echo SERVER_ADDR; ?>/client/app/icons/favicon.ico">
|
<link rel="icon" type="image/x-icon" href="<?php echo SERVER_ADDR; ?>/client/app/icons/favicon.ico">
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo SERVER_ADDR; ?>/client/app/icons/icon-192x192.png">
|
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo SERVER_ADDR; ?>/client/app/icons/icon-192x192.png">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="detect-theme" data-background="none" data-highlight="blue2">
|
<body class="detect-theme" data-background="none" data-highlight="blue2">
|
||||||
|
|
||||||
<div id="preloader"><div class="spinner-border color-highlight" role="status"></div></div>
|
<div id="preloader"><div class="spinner-border color-highlight" role="status"></div></div>
|
||||||
|
|
||||||
<div id="page">
|
<div id="page">
|
||||||
|
|
||||||
<?php include(__DIR__ . '/headerfooter.php'); ?>
|
<?php include(__DIR__ . '/headerfooter.php'); ?>
|
||||||
|
|
||||||
<!--start of page content, add your stuff here-->
|
<!--start of page content, add your stuff here-->
|
||||||
<div class="page-content header-clear-medium">
|
<div class="page-content header-clear">
|
||||||
|
<div id="syncstatus" class="text-right mr-2 mb-1">Zuletzt aktualisiert: nie</div>
|
||||||
<?php echo $sp['output']; ?>
|
<?php echo $sp['output']; ?>
|
||||||
</div>
|
</div>
|
||||||
<!--end of page content, off canvas elements here-->
|
<!--end of page content, off canvas elements here-->
|
||||||
|
|
||||||
<?php include(__DIR__ . '/menus.php'); ?>
|
<?php include(__DIR__ . '/menus.php'); ?>
|
||||||
|
|
||||||
<?php echo $sp['menus']; ?>
|
<?php echo $sp['menus']; ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($site == 'index') {
|
if ($site == 'index') {
|
||||||
include(__DIR__ . '/install.php');
|
include(__DIR__ . '/install.php');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!--end of div id page-->
|
<!--end of div id page-->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php echo $sp['scripts']; ?>
|
<?php echo $sp['scripts']; ?>
|
||||||
|
|
||||||
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/jquery.js"></script>
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/jquery.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/bootstrap.min.js"></script>
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/bootstrap.min.js"></script>
|
||||||
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/strings.js.php"></script>
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/strings.js.php"></script>
|
||||||
@@ -55,5 +57,5 @@
|
|||||||
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/custom.js.php"></script>
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/custom.js.php"></script>
|
||||||
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/pwa.js.php"></script>
|
<script type="text/javascript" src="<?php echo SERVER_ADDR; ?>/client/scripts/pwa.js.php"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ async function onEditBoatnameClick() {
|
|||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Bootsnamen zu bearbeiten');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Bootsnamen zu bearbeiten');
|
||||||
} else {
|
} else {
|
||||||
console.log('EditBoatname: unbekannter Fehler', status, error);
|
log('EditBoatname: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
@@ -47,9 +47,9 @@ async function onEditBoatnameClick() {
|
|||||||
|
|
||||||
async function onListClicked(id) {
|
async function onListClicked(id) {
|
||||||
var boat = await dbGetData('boats', id);
|
var boat = await dbGetData('boats', id);
|
||||||
|
|
||||||
$('#menu-boat').find('.menu-title').find('p').text(boat.sailnumber);
|
$('#menu-boat').find('.menu-title').find('p').text(boat.sailnumber);
|
||||||
|
|
||||||
// Edit Boatname
|
// Edit Boatname
|
||||||
$('#button-editboatname').attr('data-boat-id', boat.id);
|
$('#button-editboatname').attr('data-boat-id', boat.id);
|
||||||
$('#menu-editboatname').find('.menu-title').find('p').text(boat.sailnumber);
|
$('#menu-editboatname').find('.menu-title').find('p').text(boat.sailnumber);
|
||||||
@@ -63,7 +63,7 @@ async function onListClicked(id) {
|
|||||||
$('#input-editboatname').val(boat.name);
|
$('#input-editboatname').val(boat.name);
|
||||||
}
|
}
|
||||||
$('#input-editboatname').trigger('focusin').trigger('focusout');
|
$('#input-editboatname').trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
// club website
|
// club website
|
||||||
var clubwebsite = '';
|
var clubwebsite = '';
|
||||||
if (boat['club'] != null) {
|
if (boat['club'] != null) {
|
||||||
@@ -76,7 +76,7 @@ async function onListClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-clubwebsite').hide();
|
$('#menu-item-clubwebsite').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#menu-boat').showMenu();
|
$('#menu-boat').showMenu();
|
||||||
$('#menu-boat').scrollTop(0);
|
$('#menu-boat').scrollTop(0);
|
||||||
}
|
}
|
||||||
@@ -89,19 +89,19 @@ function pageChange() {
|
|||||||
async function drawList() {
|
async function drawList() {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
var list = '';
|
var list = '';
|
||||||
|
|
||||||
if (displayed.length > 0) {
|
if (displayed.length > 0) {
|
||||||
var offset = (page - 1) * showCount;
|
var offset = (page - 1) * showCount;
|
||||||
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
||||||
if (count == 0) count = showCount;
|
if (count == 0) count = showCount;
|
||||||
|
|
||||||
for (i = 0; i < count; i ++) {
|
for (i = 0; i < count; i ++) {
|
||||||
list += displayed[i + offset];
|
list += displayed[i + offset];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#div-list').html(list);
|
$('#div-list').html(list);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
@@ -135,9 +135,9 @@ var siteScript = async function() {
|
|||||||
$('#menu-item-boatname').click(function(){ $('#menu-boat').hideMenu(); $('#menu-editboatname').showMenu(); });
|
$('#menu-item-boatname').click(function(){ $('#menu-boat').hideMenu(); $('#menu-editboatname').showMenu(); });
|
||||||
$('#button-editboatname').click(onEditBoatnameClick);
|
$('#button-editboatname').click(onEditBoatnameClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
var results = await dbGetData('boats');
|
var results = await dbGetData('boats');
|
||||||
|
|
||||||
var count = results.length;
|
var count = results.length;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
@@ -147,51 +147,51 @@ var siteScript = async function() {
|
|||||||
}
|
}
|
||||||
$('#div-list').show();
|
$('#div-list').show();
|
||||||
$('#input-search').parent().show();
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
results.sort(function (a, b) {
|
results.sort(function (a, b) {
|
||||||
return a.sailnumber.localeCompare(b.sailnumber);
|
return a.sailnumber.localeCompare(b.sailnumber);
|
||||||
});
|
});
|
||||||
|
|
||||||
rows = [];
|
rows = [];
|
||||||
|
|
||||||
for (id in results) {
|
for (id in results) {
|
||||||
var entry = results[id];
|
var entry = results[id];
|
||||||
var club = null;
|
var club = null;
|
||||||
if (entry['club'] != null)
|
if (entry['club'] != null)
|
||||||
club = await dbGetData('clubs', entry['club']);
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
|
||||||
var row = { keywords: [], content: '' };
|
var row = { keywords: [], content: '' };
|
||||||
row.keywords.push(entry['sailnumber']);
|
row.keywords.push(entry['sailnumber']);
|
||||||
if (entry['name'] != '') row.keywords.push(entry['name']);
|
if (entry['name'] != '') row.keywords.push(entry['name']);
|
||||||
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
// Sailnumber
|
// Sailnumber
|
||||||
row.content += '<div><b>' + entry['sailnumber'] + '</b></div>';
|
row.content += '<div><b>' + entry['sailnumber'] + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
row.content += '<div>';
|
row.content += '<div>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
row.content += '<div>' + entry['name'] + '</div>';
|
row.content += '<div>' + entry['name'] + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
row.content += '</div></div>';
|
row.content += '</div></div>';
|
||||||
|
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
reSearch();
|
reSearch();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#p-count').html('Keine Boote gefunden!');
|
$('#p-count').html('Keine Boote gefunden!');
|
||||||
$('#div-list').hide();
|
$('#div-list').hide();
|
||||||
$('#input-search').parent().hide();
|
$('#input-search').parent().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function addRace() {
|
|||||||
var m = parseFloat($('#input-m').val());
|
var m = parseFloat($('#input-m').val());
|
||||||
var fb = parseFloat($('#input-fb').val());
|
var fb = parseFloat($('#input-fb').val());
|
||||||
var pl = parseFloat($('#input-pl').val().replace(',', '.'));
|
var pl = parseFloat($('#input-pl').val().replace(',', '.'));
|
||||||
|
|
||||||
if (isNaN(rlf) || (rlf < 1) || (rlf > 1.6)) {
|
if (isNaN(rlf) || (rlf < 1) || (rlf > 1.6)) {
|
||||||
toastError('RLF ungültig');
|
toastError('RLF ungültig');
|
||||||
return;
|
return;
|
||||||
@@ -59,7 +59,7 @@ function addRace() {
|
|||||||
toastError('pl ungültig');
|
toastError('pl ungültig');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var race = {
|
var race = {
|
||||||
rlf: rlf,
|
rlf: rlf,
|
||||||
m: m,
|
m: m,
|
||||||
@@ -67,12 +67,12 @@ function addRace() {
|
|||||||
pl: pl,
|
pl: pl,
|
||||||
rlp: (100 * rlf * ((fb + 1 - pl) / fb))
|
rlp: (100 * rlf * ((fb + 1 - pl) / fb))
|
||||||
};
|
};
|
||||||
|
|
||||||
$('#input-rlf').val('');
|
$('#input-rlf').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-m').val('');
|
$('#input-m').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-fb').val('');
|
$('#input-fb').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-pl').val('');
|
$('#input-pl').val('').trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
races.push(race);
|
races.push(race);
|
||||||
reCalc();
|
reCalc();
|
||||||
}
|
}
|
||||||
@@ -89,4 +89,4 @@ var siteScript = async function () {
|
|||||||
}
|
}
|
||||||
reCalc();
|
reCalc();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ function sendMessage() {
|
|||||||
var email = $('#input-email').val();
|
var email = $('#input-email').val();
|
||||||
var subject = $('#input-subject').val();
|
var subject = $('#input-subject').val();
|
||||||
var message = $('#input-message').val();
|
var message = $('#input-message').val();
|
||||||
|
|
||||||
if ((name == '') || (email == '') || (subject == '') || (message == '')) {
|
if ((name == '') || (email == '') || (subject == '') || (message == '')) {
|
||||||
toastError('Bitte fülle alle Felder aus!');
|
toastError('Bitte fülle alle Felder aus!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
showLoader();
|
showLoader();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: QUERY_URL + 'contact',
|
url: QUERY_URL + 'contact',
|
||||||
@@ -23,16 +23,16 @@ function sendMessage() {
|
|||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um eine Nachricht zu versenden');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um eine Nachricht zu versenden');
|
||||||
} else {
|
} else {
|
||||||
console.log('Contact: unbekannter Fehler', status, error);
|
log('Contact: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
},
|
},
|
||||||
success: function (data, status, xhr) {
|
success: function (data, status, xhr) {
|
||||||
toastOk('Nachricht erfolgreich versandt!');
|
toastOk('Nachricht erfolgreich versandt!');
|
||||||
$('#input-subject').val('');
|
$('#input-subject').val('').trigger('focusin').trigger('focusout');
|
||||||
$('#input-message').val('');
|
$('#input-message').val('').trigger('focusin').trigger('focusout');
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -46,4 +46,4 @@ var siteScript = async function () {
|
|||||||
}
|
}
|
||||||
$('#button-send').click(sendMessage);
|
$('#button-send').click(sendMessage);
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
12
server/scripts/go2url.js
Normal file
12
server/scripts/go2url.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
var siteScript = function() {
|
||||||
|
hideLoader();
|
||||||
|
setTimeout(function() {
|
||||||
|
var url = findGetParameter('url');
|
||||||
|
if (url === null) {
|
||||||
|
$('#card-title').find('p').html('Wir konnten Dich leider nicht umleiten.<br><a href="' + LINK_PRE + 'index">Hier kommst Du zurück zur Startseite</a>');
|
||||||
|
} else {
|
||||||
|
showLoader();
|
||||||
|
location.href = url;
|
||||||
|
}
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
@@ -1,13 +1,89 @@
|
|||||||
|
var firstCall = true;
|
||||||
var today;
|
var today;
|
||||||
|
var onUpdatePushBadge;
|
||||||
|
|
||||||
|
var onUnfollowClicked = async function() {
|
||||||
|
var id = $('#menu-item-unfollow').attr('data-sailor-id');
|
||||||
|
showLoader();
|
||||||
|
$('#menu-favorite').hideMenu();
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'sailor_unfollow',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
sailor: id
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Deine Favoriten zu bearbeiten.');
|
||||||
|
} else {
|
||||||
|
log('Unfollow: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
toastOk('Erfolgreich');
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var onFavoriteClicked = async function(id) {
|
||||||
|
var sailor = await dbGetData('sailors', id);
|
||||||
|
|
||||||
|
$('#menu-favorite').find('.menu-title').find('p').text(sailor.name);
|
||||||
|
|
||||||
|
$('#menu-item-unfollow').attr('data-sailor-id', sailor.id);
|
||||||
|
|
||||||
|
$('#menu-favorite').showMenu();
|
||||||
|
}
|
||||||
|
|
||||||
var siteScript = async function() {
|
var siteScript = async function() {
|
||||||
today = getToday();
|
today = getToday();
|
||||||
|
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
$('#button-notifications-activate').click(function(){
|
||||||
|
pushesOpenMenu();
|
||||||
|
});
|
||||||
|
$('#a-notifications-later').click(function(){
|
||||||
|
createCookie('regatten_app_' + BOATCLASS + '_rejected_push', true, 1);
|
||||||
|
$('#card-notifications').hide();
|
||||||
|
});
|
||||||
|
if (readCookie('regatten_app_' + BOATCLASS + '_rejected_push')) {
|
||||||
|
$('#card-notifications').hide();
|
||||||
|
} else {
|
||||||
|
onUpdatePushBadge = function () {
|
||||||
|
if (!pushesPossible || (Notification.permission == 'denied')) {
|
||||||
|
$('#card-notifications').hide();
|
||||||
|
} else {
|
||||||
|
swRegistration.pushManager.getSubscription().then(function(subscription) {
|
||||||
|
var isSub = (subscription !== null);
|
||||||
|
if (isSub) {
|
||||||
|
$('#card-notifications').hide();
|
||||||
|
} else {
|
||||||
|
$('#card-notifications').show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onUpdatePushBadge();
|
||||||
|
}
|
||||||
|
$('#menu-item-unfollow').click(onUnfollowClicked);
|
||||||
|
}
|
||||||
|
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
$('#card-notloggedin').hide();
|
$('#card-notloggedin').hide();
|
||||||
|
|
||||||
var user = await dbGetData('users', localStorage.getItem('auth_user'));
|
var user = await dbGetData('users', localStorage.getItem('auth_user'));
|
||||||
|
|
||||||
// Favorites
|
// Favorites
|
||||||
var watched = [];
|
var watched = [];
|
||||||
for (var i = 1; i <= 5; i ++) {
|
for (var i = 1; i <= 5; i ++) {
|
||||||
@@ -18,39 +94,49 @@ var siteScript = async function() {
|
|||||||
}
|
}
|
||||||
if (watched.length > 0) {
|
if (watched.length > 0) {
|
||||||
var year = (new Date()).getFullYear();
|
var year = (new Date()).getFullYear();
|
||||||
$('#th-ranking').html('Rangliste ' + year);
|
|
||||||
var ranking = (await dbGetRanking(parseDate('01.12.' + (year - 1)), parseDate('30.11.' + year), false, false))[0];
|
var ranking = (await dbGetRanking(parseDate('01.12.' + (year - 1)), parseDate('30.11.' + year), false, false))[0];
|
||||||
tbody = '';
|
var list = '';
|
||||||
for (i in watched) {
|
for (i in watched) {
|
||||||
sailor = watched[i];
|
sailor = watched[i];
|
||||||
tbody += '<tr><td>' + sailor.name + '</td><td>';
|
var club = null;
|
||||||
|
if (sailor.club != null)
|
||||||
|
club = await dbGetData('clubs', sailor.club);
|
||||||
var rank = null;
|
var rank = null;
|
||||||
for (r in ranking) {
|
for (r in ranking) {
|
||||||
if (ranking[r].id == sailor.id) {
|
if (ranking[r].id == sailor.id) {
|
||||||
rank = ranking[r].rank;
|
rank = ranking[r];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
list += '<div onclick="onFavoriteClicked(' + sailor.id + ');">';
|
||||||
|
list += '<div>';
|
||||||
|
// Name
|
||||||
|
list += '<div><b>' + sailor.name + '</b></div>';
|
||||||
|
list += '</div><div>';
|
||||||
if (rank == null) {
|
if (rank == null) {
|
||||||
tbody += '<i>nicht in der Rangliste</i>';
|
list += '<div>Nicht in der Rangliste</div>';
|
||||||
} else {
|
} else {
|
||||||
tbody += '<b>' + rank + '.</b> Platz';
|
// Rank
|
||||||
|
list += '<div>Platz <b>' + rank.rank + '</b></div>';
|
||||||
|
// rlp
|
||||||
|
list += '<div>' + rank.rlp.toFixed(3) + ' Punkte</div>';
|
||||||
}
|
}
|
||||||
tbody += '</td></tr>';
|
list += '</div></div>';
|
||||||
}
|
}
|
||||||
$('#table-favorites').find('tbody').html(tbody);
|
$('#div-favorites').html(list);
|
||||||
$('#p-favorites').hide();
|
$('#p-favorites').hide();
|
||||||
$('#table-favorites').show();
|
$('#div-favorites').show();
|
||||||
} else {
|
} else {
|
||||||
$('#table-favorites').hide();
|
$('#div-favorites').hide();
|
||||||
$('#p-favorites').show();
|
$('#p-favorites').show();
|
||||||
}
|
}
|
||||||
$('#card-favorites').show();
|
$('#card-favorites').show();
|
||||||
|
|
||||||
// Your next
|
// Your next
|
||||||
var planningsDB = await dbGetDataIndex('plannings', 'user', user.id);
|
var planningsDB = await dbGetDataIndex('plannings', 'user', user.id);
|
||||||
var minDate = getToday();
|
var minDate = getToday();
|
||||||
minDate.setDate(minDate.getDate() - 1);
|
minDate.setDate(minDate.getDate());
|
||||||
var maxDate = getToday();
|
var maxDate = getToday();
|
||||||
maxDate.setDate(maxDate.getDate() + 28);
|
maxDate.setDate(maxDate.getDate() + 28);
|
||||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
@@ -59,7 +145,7 @@ var siteScript = async function() {
|
|||||||
var planning = planningsDB[i];
|
var planning = planningsDB[i];
|
||||||
for (j in regattas) {
|
for (j in regattas) {
|
||||||
var regatta = regattas[j];
|
var regatta = regattas[j];
|
||||||
if (regatta.id == planning.regatta) {
|
if ((regatta.id == planning.regatta) && (regatta.length > 0)) {
|
||||||
planning.regatta = regatta;
|
planning.regatta = regatta;
|
||||||
plannings.push(planning);
|
plannings.push(planning);
|
||||||
}
|
}
|
||||||
@@ -75,35 +161,53 @@ var siteScript = async function() {
|
|||||||
for (i in plannings) {
|
for (i in plannings) {
|
||||||
var planning = plannings[i];
|
var planning = plannings[i];
|
||||||
var regatta = planning.regatta;
|
var regatta = planning.regatta;
|
||||||
|
|
||||||
if (regatta['length'] < 1) continue;
|
|
||||||
|
|
||||||
var club = null;
|
var club = null;
|
||||||
if (regatta['club'] != null)
|
if (regatta['club'] != null)
|
||||||
club = await dbGetData('clubs', regatta['club']);
|
club = await dbGetData('clubs', regatta['club']);
|
||||||
var dateFrom = regatta['dateFrom'];
|
var dateFrom = regatta['dateFrom'];
|
||||||
var dateTo = regatta['dateTo'];
|
var dateTo = regatta['dateTo'];
|
||||||
|
|
||||||
// output
|
// output
|
||||||
|
|
||||||
list += '<div onclick="onRegattaClicked(' + regatta['id'] + ');">';
|
list += '<div onclick="onRegattaClicked(' + regatta['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
// Name
|
// Name
|
||||||
list += '<div><b>' + (regatta['canceled'] == 1 ? '<s>' : '') + regatta['name'] + (regatta['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
list += '<div><b>' + (regatta['canceled'] == 1 ? '<s>' : '') + regatta['name'] + (regatta['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
list += '<div>' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '</div>';
|
list += '<div>' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = '* ' + regatta.special.substr(1);
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = regatta.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = regatta.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = regatta.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
value = 'U-' + value;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
regatta.special = regatta.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
list += '<div>' + regatta['special'] + '</div>';
|
list += '<div>' + regatta['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
var icons = [];
|
var icons = [];
|
||||||
if (regatta['info'] != '')
|
if (regatta['info'] != '')
|
||||||
@@ -120,8 +224,10 @@ var siteScript = async function() {
|
|||||||
ms = parseDate(regatta['meldungSchluss']);
|
ms = parseDate(regatta['meldungSchluss']);
|
||||||
}
|
}
|
||||||
var diff = Math.round((ms - today) / 86400000);
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
if ((ms >= today) && (diff < 7)) {
|
if (ms < today) {
|
||||||
color = ' color-red2-dark';
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,18 +240,18 @@ var siteScript = async function() {
|
|||||||
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
||||||
}
|
}
|
||||||
list += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
list += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
|
|
||||||
// ZEILE 3
|
// ZEILE 3
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
list += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
list += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
|
|
||||||
// RLF
|
// RLF
|
||||||
list += '<div>' + parseFloat(regatta['rlf']).toFixed(2) + '</div>';
|
list += '<div>' + parseFloat(regatta['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
list += '</div></div>';
|
list += '</div></div>';
|
||||||
}
|
}
|
||||||
$('#div-yournext').html(list);
|
$('#div-yournext').html(list);
|
||||||
@@ -161,46 +267,72 @@ var siteScript = async function() {
|
|||||||
$('#card-yournext').hide();
|
$('#card-yournext').hide();
|
||||||
$('#card-notloggedin').show();
|
$('#card-notloggedin').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next
|
// Next
|
||||||
var minDate = getToday();
|
var minDate = getToday();
|
||||||
minDate.setDate(minDate.getDate() - 1);
|
minDate.setDate(minDate.getDate());
|
||||||
var maxDate = getToday();
|
var maxDate = getToday();
|
||||||
maxDate.setDate(maxDate.getDate() + 14);
|
maxDate.setDate(maxDate.getDate() + 14);
|
||||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
i = 0;
|
||||||
|
while (i < regattas.length) {
|
||||||
|
if (regattas[i].length < 1) {
|
||||||
|
regattas.splice(i, 1);
|
||||||
|
} else {
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (regattas.length > 0) {
|
if (regattas.length > 0) {
|
||||||
list = '';
|
list = '';
|
||||||
for (i in regattas) {
|
for (i in regattas) {
|
||||||
var regatta = regattas[i];
|
var regatta = regattas[i];
|
||||||
|
|
||||||
if (regatta['length'] < 1) continue;
|
|
||||||
|
|
||||||
var club = null;
|
var club = null;
|
||||||
if (regatta['club'] != null)
|
if (regatta['club'] != null)
|
||||||
club = await dbGetData('clubs', regatta['club']);
|
club = await dbGetData('clubs', regatta['club']);
|
||||||
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
||||||
var dateFrom = regatta['dateFrom'];
|
var dateFrom = regatta['dateFrom'];
|
||||||
var dateTo = regatta['dateTo'];
|
var dateTo = regatta['dateTo'];
|
||||||
|
|
||||||
// output
|
// output
|
||||||
list += '<div onclick="onRegattaClicked(' + regatta['id'] + ');">';
|
list += '<div onclick="onRegattaClicked(' + regatta['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
// Name
|
// Name
|
||||||
list += '<div><b>' + (regatta['canceled'] == 1 ? '<s>' : '') + regatta['name'] + (regatta['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
list += '<div><b>' + (regatta['canceled'] == 1 ? '<s>' : '') + regatta['name'] + (regatta['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
list += '<div>' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '</div>';
|
list += '<div>' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = '* ' + regatta.special.substr(1);
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = regatta.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = regatta.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = regatta.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
value = 'U-' + value;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
regatta.special = regatta.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
list += '<div>' + regatta['special'] + '</div>';
|
list += '<div>' + regatta['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
var icons = [];
|
var icons = [];
|
||||||
if (regatta['info'] != '')
|
if (regatta['info'] != '')
|
||||||
@@ -227,8 +359,10 @@ var siteScript = async function() {
|
|||||||
ms = parseDate(regatta['meldungSchluss']);
|
ms = parseDate(regatta['meldungSchluss']);
|
||||||
}
|
}
|
||||||
var diff = Math.round((ms - today) / 86400000);
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
if ((ms >= today) && (diff < 7)) {
|
if (ms < today) {
|
||||||
color = ' color-red2-dark';
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -241,18 +375,18 @@ var siteScript = async function() {
|
|||||||
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
||||||
}
|
}
|
||||||
list += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
list += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
|
|
||||||
// ZEILE 3
|
// ZEILE 3
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
list += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
list += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
|
|
||||||
// RLF
|
// RLF
|
||||||
list += '<div>' + parseFloat(regatta['rlf']).toFixed(2) + '</div>';
|
list += '<div>' + parseFloat(regatta['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
list += '</div></div>';
|
list += '</div></div>';
|
||||||
}
|
}
|
||||||
$('#div-next').html(list);
|
$('#div-next').html(list);
|
||||||
@@ -262,52 +396,75 @@ var siteScript = async function() {
|
|||||||
$('#div-next').hide();
|
$('#div-next').hide();
|
||||||
$('#p-next').show();
|
$('#p-next').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Last
|
// Last
|
||||||
var minDate = getToday();
|
var minDate = getToday();
|
||||||
minDate.setDate(minDate.getDate() - 14);
|
minDate.setDate(minDate.getDate() - 14);
|
||||||
var maxDate = getToday();
|
var maxDate = getToday();
|
||||||
maxDate.setDate(maxDate.getDate() - 1);
|
maxDate.setDate(maxDate.getDate() - 1);
|
||||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
var regattaResults = [];
|
i = 0;
|
||||||
for (id in regattas) {
|
while (i < regattas.length) {
|
||||||
var entry = regattas[id];
|
if (regattas[i].length < 1) {
|
||||||
var results = await dbGetDataIndex('results', 'regatta', entry['id']);
|
regattas.splice(i, 1);
|
||||||
regattaResults[entry['id']] = (results.length > 0);
|
} else {
|
||||||
|
i ++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
regattas.sort(function(a,b){
|
||||||
|
return b.date.localeCompare(a.date);
|
||||||
|
});
|
||||||
if (regattas.length > 0) {
|
if (regattas.length > 0) {
|
||||||
list = '';
|
list = '';
|
||||||
for (i in regattas) {
|
for (i in regattas) {
|
||||||
var regatta = regattas[i];
|
var regatta = regattas[i];
|
||||||
|
|
||||||
if (regatta['length'] < 1) continue;
|
|
||||||
|
|
||||||
var club = null;
|
var club = null;
|
||||||
if (regatta['club'] != null)
|
if (regatta['club'] != null)
|
||||||
club = await dbGetData('clubs', regatta['club']);
|
club = await dbGetData('clubs', regatta['club']);
|
||||||
var dateFrom = regatta['dateFrom'];
|
var dateFrom = regatta['dateFrom'];
|
||||||
var dateTo = regatta['dateTo'];
|
var dateTo = regatta['dateTo'];
|
||||||
|
|
||||||
// output
|
// output
|
||||||
|
|
||||||
list += '<div onclick="onRegattaClicked(' + regatta['id'] + ');">';
|
list += '<div onclick="onRegattaClicked(' + regatta['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
// Name
|
// Name
|
||||||
list += '<div><b>' + (regatta['canceled'] == 1 ? '<s>' : '') + regatta['name'] + (regatta['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
list += '<div><b>' + (regatta['canceled'] == 1 ? '<s>' : '') + regatta['name'] + (regatta['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
list += '<div>' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '</div>';
|
list += '<div>' + ((regatta['number'] != null) ? ('# ' + regatta['number']) : '') + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
list += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = '* ' + regatta.special.substr(1);
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = regatta.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = regatta.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = regatta.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
value = 'U-' + value;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
regatta.special = regatta.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
list += '<div>' + regatta['special'] + '</div>';
|
list += '<div>' + regatta['special'] + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
var icons = [];
|
var icons = [];
|
||||||
if (regatta['info'] != '')
|
if (regatta['info'] != '')
|
||||||
@@ -316,22 +473,22 @@ var siteScript = async function() {
|
|||||||
icons.push('<i class="fas fa-book"></i>');
|
icons.push('<i class="fas fa-book"></i>');
|
||||||
if (regatta['canceled'] == '1') {
|
if (regatta['canceled'] == '1') {
|
||||||
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
||||||
} else if (regattaResults[regatta['id']]) {
|
} else if (regatta['results'] == '1') {
|
||||||
icons.push('<i class="fas fa-poll"></i>');
|
icons.push('<i class="fas fa-poll"></i>');
|
||||||
}
|
}
|
||||||
list += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
list += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
|
|
||||||
// ZEILE 3
|
// ZEILE 3
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
list += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
list += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
|
|
||||||
// RLF
|
// RLF
|
||||||
list += '<div>' + parseFloat(regatta['rlf']).toFixed(2) + '</div>';
|
list += '<div>' + parseFloat(regatta['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
list += '</div></div>';
|
list += '</div></div>';
|
||||||
}
|
}
|
||||||
$('#div-last').html(list);
|
$('#div-last').html(list);
|
||||||
@@ -341,6 +498,6 @@ var siteScript = async function() {
|
|||||||
$('#div-last').hide();
|
$('#div-last').hide();
|
||||||
$('#p-last').show();
|
$('#p-last').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,88 @@
|
|||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var page = 1;
|
||||||
|
var pageCount = 0;
|
||||||
|
const showCount = 10;
|
||||||
|
|
||||||
async function onNewsClicked(id) {
|
async function onNewsClicked(id) {
|
||||||
var newsEntry = await dbGetData('news', id);
|
var newsEntry = await dbGetData('news', id);
|
||||||
if (newsEntry == null) return;
|
if (newsEntry == null) return;
|
||||||
|
|
||||||
$('#menu-news').css('height', '80%');
|
$('#menu-news').css('height', '80%');
|
||||||
$('#menu-news').css('width', '90%');
|
$('#menu-news').css('width', '90%');
|
||||||
$('#menu-news').find('.menu-title').find('p').text(newsEntry.title);
|
$('#menu-news').find('.menu-title').find('p').text(newsEntry.title);
|
||||||
$('#menu-news').find('.content').addClass('pb-3');
|
$('#menu-news').find('.content').addClass('pb-3');
|
||||||
$('#menu-news').find('.content').html(newsEntry.html);
|
$('#menu-news').find('.content').html(newsEntry.html);
|
||||||
|
|
||||||
$('#menu-news').showMenu();
|
$('#menu-news').showMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pageChange() {
|
||||||
|
$('h1')[0].scrollIntoView({ behavior: "smooth" });
|
||||||
|
drawList();
|
||||||
|
}
|
||||||
|
|
||||||
function addCard(newsEntry) {
|
function addCard(newsEntry) {
|
||||||
console.log(newsEntry);
|
var badge = '';
|
||||||
var content = '<h2>' + newsEntry.title + '</h2>';
|
if (newsEntry.unread) {
|
||||||
|
badge += '<span class="badge bg-highlight color-white p-1">NEW</span> ';
|
||||||
|
}
|
||||||
|
var content = '<h2>' + badge + newsEntry.title + '</h2>';
|
||||||
content += '<p class="mb-2"><i>' + formatDate('d.m.Y', newsEntry.date) + '</i></p>';
|
content += '<p class="mb-2"><i>' + formatDate('d.m.Y', newsEntry.date) + '</i></p>';
|
||||||
content += '<p class="mb-0">' + newsEntry.description.replace('\n', '<br>') + '</p>';
|
content += '<p class="mb-0">' + newsEntry.description.replace('\n', '<br>') + '</p>';
|
||||||
if (newsEntry.html != '') {
|
if (newsEntry.html != '') {
|
||||||
content += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight mt-3" href="#" onclick="onNewsClicked(' + newsEntry.id + '); return false;">Mehr lesen</a>';
|
content += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight mt-3" href="#" onclick="onNewsClicked(' + newsEntry.id + '); return false;">Mehr lesen</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('.page-content').append(cardTemplate.replace('%ID%', 'card-news-' + newsEntry.id).replace('%CONTENT%', content));
|
$('#news-entries').append(cardTemplate.replace('%ID%', 'card-news-' + newsEntry.id).replace('%CONTENT%', content));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function drawList() {
|
||||||
|
$('.card-news').remove();
|
||||||
|
if (rows.length > 0) {
|
||||||
|
var offset = (page - 1) * showCount;
|
||||||
|
var count = (page == pageCount ? (rows.length % showCount) : showCount);
|
||||||
|
if (count == 0) count = showCount;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
addCard(rows[i + offset]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var siteScript = async function() {
|
var siteScript = async function() {
|
||||||
$('.card-news').remove();
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
initPagination();
|
||||||
|
}
|
||||||
|
rows = [];
|
||||||
var news = await dbGetData('news');
|
var news = await dbGetData('news');
|
||||||
news.sort(function (a,b) {
|
news.sort(function (a,b) {
|
||||||
return b.date.localeCompare(a.date);
|
return b.date.localeCompare(a.date);
|
||||||
});
|
});
|
||||||
var today = getToday();
|
var newsRead = await dbSettingsGet('news_read_' + BOATCLASS);
|
||||||
var lastYear = new Date(today);
|
var now = new Date();
|
||||||
|
var lastYear = new Date();
|
||||||
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
lastYear.setFullYear(lastYear.getFullYear() - 1);
|
||||||
console.log(today, lastYear);
|
|
||||||
for (var n in news) {
|
for (var n in news) {
|
||||||
var newsEntry = news[n];
|
var newsEntry = news[n];
|
||||||
newsEntry.date = parseDate(newsEntry.date.substring(0, 10));
|
newsEntry.date = parseDbTimestamp(newsEntry.date);
|
||||||
if (newsEntry.date > today) continue;
|
if (newsEntry.date > now) continue;
|
||||||
if (newsEntry.date < lastYear) break;
|
if (newsEntry.date < lastYear) break;
|
||||||
addCard(newsEntry);
|
newsEntry.unread = (newsEntry.date > newsRead);
|
||||||
|
rows.push(newsEntry);
|
||||||
}
|
}
|
||||||
|
pageCount = Math.ceil(rows.length / showCount);
|
||||||
|
if ((page < 1) || (page > pageCount)) {
|
||||||
|
if (page < 1) {
|
||||||
|
page = 1;
|
||||||
|
} else {
|
||||||
|
page = pageCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawPagination();
|
||||||
|
drawList();
|
||||||
|
dbSettingsSet('news_read_' + BOATCLASS, now);
|
||||||
|
updateNewsBadge();
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,48 @@
|
|||||||
async function onRegattaClicked(id) {
|
async function onRegattaClicked(id) {
|
||||||
var regatta = await dbGetData('regattas', id);
|
var regatta = await dbGetData('regattas', id);
|
||||||
|
|
||||||
$('#menu-regatta').find('.menu-title').find('p').text(regatta.name);
|
$('#menu-regatta').find('.menu-title').find('p').text(regatta.name);
|
||||||
|
|
||||||
var dateTo = parseDate(regatta['date']);
|
var dateTo = parseDate(regatta['date']);
|
||||||
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
||||||
|
|
||||||
|
var text = [];
|
||||||
|
var specialFields = await dbGetClassProp('special-fields');
|
||||||
|
if (specialFields === null) specialFields = {};
|
||||||
|
if (regatta.special.substr(0, 1) == '#') {
|
||||||
|
regatta.special = regatta.special.substr(1);
|
||||||
|
if (typeof specialFields[regatta.special] !== 'undefined') {
|
||||||
|
text.push(specialFields[regatta.special]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var pos;
|
||||||
|
while ((pos = regatta.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = regatta.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = regatta.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
var year = parseDate(regatta.date).getFullYear();
|
||||||
|
year = year - value + 1;
|
||||||
|
text.push('Jahrgänge ' + year + ' und jünger');
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
regatta.special = regatta.special.replace('$' + key + '$', '');
|
||||||
|
}
|
||||||
|
if (text.length > 0) {
|
||||||
|
text.sort();
|
||||||
|
for (i in text) {
|
||||||
|
text[i] = $('<div />').text(text[i]).html();
|
||||||
|
}
|
||||||
|
$('#menu-item-special').html(text.join('<br>'));
|
||||||
|
$('#menu-item-special').show();
|
||||||
|
} else {
|
||||||
|
$('#menu-item-special').hide();
|
||||||
|
}
|
||||||
|
|
||||||
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
||||||
var planning = null;
|
var planning = null;
|
||||||
if (isLoggedIn()) {
|
if (isLoggedIn()) {
|
||||||
@@ -16,15 +53,22 @@ async function onRegattaClicked(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Your Planning
|
// Your Planning
|
||||||
if (planning != null) {
|
if (planning != null) {
|
||||||
$('#menu-item-yourplanning').show();
|
$('#menu-item-yourplanning').show();
|
||||||
|
var boat = null;
|
||||||
|
if (planning.boat != null) {
|
||||||
|
boat = (await dbGetData('boats', planning.boat)).sailnumber;
|
||||||
|
}
|
||||||
var steuermann = null;
|
var steuermann = null;
|
||||||
if (planning.steuermann != null) {
|
if (planning.steuermann != null) {
|
||||||
steuermann = (await dbGetData('sailors', planning.steuermann)).name;
|
steuermann = (await dbGetData('sailors', planning.steuermann)).name;
|
||||||
}
|
}
|
||||||
var crew = [steuermann == null ? '[noch unklar]' : steuermann];
|
var crew = [
|
||||||
|
boat == null ? '[Boot unklar]' : boat,
|
||||||
|
steuermann == null ? '[St.mann unklar]' : steuermann
|
||||||
|
];
|
||||||
crewA = planning.crew.split(',');
|
crewA = planning.crew.split(',');
|
||||||
for (i in crewA) {
|
for (i in crewA) {
|
||||||
var sailor = await dbGetData('sailors', crewA[i]);
|
var sailor = await dbGetData('sailors', crewA[i]);
|
||||||
@@ -32,28 +76,58 @@ async function onRegattaClicked(id) {
|
|||||||
crew.push(sailor.name);
|
crew.push(sailor.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var status = '';
|
||||||
|
if (planning.gemeldet == '1') status = 'gemeldet';
|
||||||
|
if (planning.bezahlt == '1') {
|
||||||
|
if (status != '') status += ' und ';
|
||||||
|
status += 'bezahlt';
|
||||||
|
}
|
||||||
|
if (status != '') crew.push('<font style="font-style:italic;">' + status + '</font>');
|
||||||
$('#menu-item-yourplanning').html(crew.join('<br>'));
|
$('#menu-item-yourplanning').html(crew.join('<br>'));
|
||||||
} else {
|
} else {
|
||||||
$('#menu-item-yourplanning').hide();
|
$('#menu-item-yourplanning').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Planning: Edit Status
|
||||||
|
if ((planning != null) && (typeof planningEditStatus === 'function')) {
|
||||||
|
$('#menu-item-status').show();
|
||||||
|
$('#menu-item-status').attr('onclick', 'planningEditStatus(' + regatta['id'] + ')');
|
||||||
|
} else {
|
||||||
|
$('#menu-item-status').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Planning
|
// Planning
|
||||||
if ((plannings.length > 0) && (dateTo >= today)) {
|
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').attr('href', LINK_PRE + 'regatta_plan?regatta=' + regatta['id']);
|
||||||
|
$('#menu-item-plannings').show();
|
||||||
} else {
|
} else {
|
||||||
$('#menu-item-plannings').hide();
|
$('#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, extServiceData.classId)); // TODO
|
||||||
|
$('#menu-item-entrylist').show();
|
||||||
|
} else {
|
||||||
|
$('#menu-item-entrylist').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Results
|
// Results
|
||||||
var results = await dbGetDataIndex('results', 'regatta', regatta['id']);
|
if (regatta['results'] == '1') {
|
||||||
if (results.length > 0) {
|
|
||||||
$('#menu-item-results').show();
|
$('#menu-item-results').show();
|
||||||
$('#menu-item-results').attr('href', LINK_PRE + 'result?regatta=' + regatta['id']);
|
$('#menu-item-results').attr('href', LINK_PRE + 'result?regatta=' + regatta['id']);
|
||||||
} else {
|
} else {
|
||||||
$('#menu-item-results').hide();
|
$('#menu-item-results').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bericht
|
// Bericht
|
||||||
if (regatta['bericht'] != '') {
|
if (regatta['bericht'] != '') {
|
||||||
$('#menu-item-bericht').show();
|
$('#menu-item-bericht').show();
|
||||||
@@ -62,7 +136,15 @@ async function onRegattaClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-bericht').hide();
|
$('#menu-item-bericht').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fakten
|
||||||
|
if ('facts' in regatta && regatta['facts'] != null) {
|
||||||
|
$('#menu-item-facts').show();
|
||||||
|
$('#menu-item-facts').attr('href', LINK_PRE + 'regatta_facts?regatta=' + regatta['id']);
|
||||||
|
} else {
|
||||||
|
$('#menu-item-facts').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Info
|
// Info
|
||||||
if (regatta['info'] != '') {
|
if (regatta['info'] != '') {
|
||||||
$('#menu-item-info').show();
|
$('#menu-item-info').show();
|
||||||
@@ -71,7 +153,7 @@ async function onRegattaClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-info').hide();
|
$('#menu-item-info').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Meldung
|
// Meldung
|
||||||
if ((regatta['meldung'] != '') && (dateTo >= today)) {
|
if ((regatta['meldung'] != '') && (dateTo >= today)) {
|
||||||
$('#menu-item-meldung').show();
|
$('#menu-item-meldung').show();
|
||||||
@@ -120,7 +202,7 @@ async function onRegattaClicked(id) {
|
|||||||
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$('#badge-regatta-meldung').text('Meldeschluss abgelaufen');
|
$('#badge-regatta-meldung').text('Meldeschluss abgelaufen, Nachmeldung möglich');
|
||||||
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
$('#badge-regatta-meldung').addClass('bg-highlight').removeClass('bg-green2-dark bg-red2-dark bg-yellow2-dark');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -129,7 +211,7 @@ async function onRegattaClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-meldung').hide();
|
$('#menu-item-meldung').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// off. results
|
// off. results
|
||||||
if (regatta['oresults'] != '') {
|
if (regatta['oresults'] != '') {
|
||||||
$('#menu-item-oresults').show();
|
$('#menu-item-oresults').show();
|
||||||
@@ -138,7 +220,7 @@ async function onRegattaClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-oresults').hide();
|
$('#menu-item-oresults').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// club website
|
// club website
|
||||||
var clubwebsite = '';
|
var clubwebsite = '';
|
||||||
if (regatta['club'] != null) {
|
if (regatta['club'] != null) {
|
||||||
@@ -151,7 +233,7 @@ async function onRegattaClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-clubwebsite').hide();
|
$('#menu-item-clubwebsite').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#menu-regatta').showMenu();
|
$('#menu-regatta').showMenu();
|
||||||
$('#menu-regatta').scrollTop(0);
|
$('#menu-regatta').scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|||||||
338
server/scripts/planning.js
Normal file
338
server/scripts/planning.js
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
async function planningSwitchChanged() {
|
||||||
|
showLoader();
|
||||||
|
var id = $('#switch-status-gemeldet').data('regatta');
|
||||||
|
var gemeldet = $('#switch-status-gemeldet').prop('checked');
|
||||||
|
var bezahlt = $('#switch-status-bezahlt').prop('checked');
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'planning_set_state',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
regatta: id,
|
||||||
|
gemeldet: gemeldet,
|
||||||
|
bezahlt: bezahlt
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
log('authentification failed');
|
||||||
|
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Status zu ändern');
|
||||||
|
} else {
|
||||||
|
log('Login: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
$('#menu-status').hideMenu();
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
sync();
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function planningEditStatus(id) {
|
||||||
|
$('#menu-regatta').hideMenu();
|
||||||
|
|
||||||
|
var regatta = await dbGetData('regattas', id);
|
||||||
|
|
||||||
|
$('#menu-status').find('.menu-title').find('p').text(regatta.name);
|
||||||
|
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
||||||
|
var planning = null;
|
||||||
|
if (isLoggedIn()) {
|
||||||
|
for (i in plannings) {
|
||||||
|
if (plannings[i]['user'] == USER_ID) {
|
||||||
|
planning = plannings[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (planning !== null) {
|
||||||
|
$('#switch-status-gemeldet').data('regatta', id);
|
||||||
|
$('#switch-status-gemeldet').prop('checked', planning.gemeldet == '1');
|
||||||
|
$('#switch-status-bezahlt').prop('checked', planning.bezahlt == '1');
|
||||||
|
$('#menu-status').showMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectChange() {
|
||||||
|
var val = $('#select-year').val();
|
||||||
|
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?year=' + val);
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initYear() {
|
||||||
|
return new Promise(async function (resolve) {
|
||||||
|
var year = findGetParameter('year');
|
||||||
|
if (year === null) year = await dbGetCurrentYear();
|
||||||
|
|
||||||
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var today;
|
||||||
|
|
||||||
|
async function drawList () {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (entry == null) {
|
||||||
|
list += '<div><div align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
||||||
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
list += entry.content;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#div-regattas').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
hideLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
await initYear();
|
||||||
|
$('#select-year').change(selectChange);
|
||||||
|
$('#input-search').on('input', drawList);
|
||||||
|
$('#switch-status-gemeldet').parent().parent().click(planningSwitchChanged);
|
||||||
|
$('#switch-status-bezahlt').parent().parent().click(planningSwitchChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectedYear = $('#select-year').val();
|
||||||
|
|
||||||
|
$('#a-share-planning').attr('href', LINK_PRE + 'planning_view?user=' + USER_ID + '&year=' + selectedYear);
|
||||||
|
$('#a-edit-planning').attr('href', LINK_PRE + 'planning_edit?year=' + selectedYear);
|
||||||
|
$('#a-list-plannings').attr('href', LINK_PRE + 'planning_list?year=' + selectedYear);
|
||||||
|
|
||||||
|
today = getToday();
|
||||||
|
|
||||||
|
var minDate = parseDate(selectedYear + '-01-01');
|
||||||
|
var maxDate = parseDate(selectedYear + '-12-31');
|
||||||
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
||||||
|
for (var i = regattas.length - 1; i >= 0; i --) {
|
||||||
|
var entry = regattas[i];
|
||||||
|
var okay = false;
|
||||||
|
for (p in plannings) {
|
||||||
|
if (plannings[p].regatta == entry.id) {
|
||||||
|
regattas[i].planning = plannings[p];
|
||||||
|
okay = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!okay) {
|
||||||
|
regattas.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var years = await dbGetData('years');
|
||||||
|
years.sort(function (a, b) {
|
||||||
|
if (a['year'] > b['year']) return -1;
|
||||||
|
if (a['year'] < b['year']) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
var options = '';
|
||||||
|
for (id in years) {
|
||||||
|
var year = years[id]['year'];
|
||||||
|
options += '<option value="' + year + '">' + year + '</option>';
|
||||||
|
}
|
||||||
|
$('#select-year').html(options);
|
||||||
|
$('#select-year').val(selectedYear);
|
||||||
|
|
||||||
|
var count = regattas.length;
|
||||||
|
if (count > 0) {
|
||||||
|
if (count == 1) {
|
||||||
|
$('#p-count').html('Es wurde 1 Regatta gefunden!');
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Es wurden ' + count + ' Regatten gefunden!');
|
||||||
|
}
|
||||||
|
$('#div-regattas').show();
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
var heute = false;
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in regattas) {
|
||||||
|
var entry = regattas[id];
|
||||||
|
var club = null;
|
||||||
|
if (entry['club'] != null)
|
||||||
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
if (entry.planning.boat !== null) {
|
||||||
|
entry.planning.boat = (await dbGetData('boats', entry.planning.boat)).sailnumber;
|
||||||
|
}
|
||||||
|
if (entry.planning.steuermann !== null) {
|
||||||
|
entry.planning.steuermann = (await dbGetData('sailors', entry.planning.steuermann)).name;
|
||||||
|
}
|
||||||
|
var crewString = entry.planning.crew.split(',');
|
||||||
|
entry.planning.crew = [];
|
||||||
|
for (c in crewString) {
|
||||||
|
var sailor = await dbGetData('sailors', crewString[c]);
|
||||||
|
if (sailor !== null) {
|
||||||
|
entry.planning.crew.push(sailor.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var dateFrom = entry['dateFrom'];
|
||||||
|
var dateTo = entry['dateTo'];
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry['name']);
|
||||||
|
if (entry['number'] != null) row.keywords.push(entry['number']);
|
||||||
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
if (entry.planning.boat != null) row.keywords.push(entry.planning.boat);
|
||||||
|
if (entry.planning.steuermann != null) row.keywords.push(entry.planning.steuermann);
|
||||||
|
for (c in entry.planning.crew) row.keywords.push(entry.planning.crew[c]);
|
||||||
|
|
||||||
|
if (!heute && (today <= dateFrom)) {
|
||||||
|
rows.push(null);
|
||||||
|
heute = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
row.content += '<div onclick="onRegattaClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
// Name
|
||||||
|
row.content += '<div><b>' + (entry['canceled'] == 1 ? '<s>' : '') + entry['name'] + (entry['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Number
|
||||||
|
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||||
|
|
||||||
|
// Club
|
||||||
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
|
// Special
|
||||||
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = '* ' + entry.special.substr(1);
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = entry.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = entry.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = entry.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
value = 'U-' + value;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.special = entry.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
|
row.content += '<div>' + entry['special'] + '</div>';
|
||||||
|
|
||||||
|
// Icons
|
||||||
|
var icons = [];
|
||||||
|
if ((entry['meldung'] != '') && (dateTo >= today) && (entry['meldungOffen'] == '1') && (entry.planning.gemeldet != '1')) {
|
||||||
|
var color = '';
|
||||||
|
var planning = null;
|
||||||
|
if (isLoggedIn()) {
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'regatta', entry['id']);
|
||||||
|
for (id in plannings) {
|
||||||
|
if (plannings[id]['user'] == USER_ID) {
|
||||||
|
planning = plannings[id];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (entry['meldungSchluss'] != null) {
|
||||||
|
if ((planning == null) || (planning['gemeldet'] == '0')) {
|
||||||
|
var ms = 0;
|
||||||
|
if (entry['meldungEarly'] != null) {
|
||||||
|
ms = parseDate(entry['meldungEarly']);
|
||||||
|
}
|
||||||
|
if (ms < today) {
|
||||||
|
ms = parseDate(entry['meldungSchluss']);
|
||||||
|
}
|
||||||
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
|
if (ms < today) {
|
||||||
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((planning != null) && (planning['gemeldet'] == '0')) {
|
||||||
|
color += ' fa-blink';
|
||||||
|
}
|
||||||
|
icons.push('<i class="fas fa-file-signature' + color + '"></i>');
|
||||||
|
}
|
||||||
|
if (entry['bericht'] != '')
|
||||||
|
icons.push('<i class="fas fa-book"></i>');
|
||||||
|
if (entry['canceled'] == '1') {
|
||||||
|
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
||||||
|
} else if (entry['results'] == '1') {
|
||||||
|
icons.push('<i class="fas fa-poll"></i>');
|
||||||
|
}
|
||||||
|
if (entry.planning.gemeldet == '1') {
|
||||||
|
icons.push('<i class="fas fa-file-signature color-highlight"></i>');
|
||||||
|
}
|
||||||
|
if (entry.planning.bezahlt == '1') {
|
||||||
|
icons.push('<i class="fas fa-euro-sign color-highlight"></i>');
|
||||||
|
}
|
||||||
|
row.content += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 3
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Date
|
||||||
|
if (entry['length'] < 1) {
|
||||||
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
|
row.content += '<div><font class="color-red2-dark">Datum noch unklar</font></div>';
|
||||||
|
} else {
|
||||||
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font></div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// RLF
|
||||||
|
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div></div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!heute) {
|
||||||
|
rows.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawList();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Du hast noch keine Regatten in Deiner Saison-Planung!');
|
||||||
|
$('#div-regattas').hide();
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
638
server/scripts/planning_edit.js
Normal file
638
server/scripts/planning_edit.js
Normal file
@@ -0,0 +1,638 @@
|
|||||||
|
async function planningSwitchChanged() {
|
||||||
|
showLoader();
|
||||||
|
var id = $('#switch-planning-include').data('regatta');
|
||||||
|
var include = $('#switch-planning-include').prop('checked');
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
if (include) {
|
||||||
|
// add to planning
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'planning_add',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
regatta: id
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
log('authentification failed');
|
||||||
|
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||||
|
} else {
|
||||||
|
log('planning_add: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
$('#menu-edit').hideMenu();
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
planningEdit(id);
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// remove from planning
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'planning_remove',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
regatta: id
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
log('authentification failed');
|
||||||
|
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||||
|
} else {
|
||||||
|
log('planning_remove: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
$('#menu-edit').hideMenu();
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
planningEdit(id);
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var sailorIsSteuermann;
|
||||||
|
var sailors = [];
|
||||||
|
var knownIds = [];
|
||||||
|
var known = [];
|
||||||
|
|
||||||
|
async function sailorSelected(sid) {
|
||||||
|
$('#menu-sailor').hideMenu();
|
||||||
|
showLoader();
|
||||||
|
var rid = $('#switch-planning-include').data('regatta');
|
||||||
|
var action = (sailorIsSteuermann ? 'planning_set_steuermann' : 'planning_add_crew');
|
||||||
|
// add sailor
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + action,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
regatta: rid,
|
||||||
|
sailor: sid
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
log('authentification failed');
|
||||||
|
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||||
|
} else {
|
||||||
|
log(action + ': unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
if ((sid === null) || (sid in knownIds)) {
|
||||||
|
planningEdit(rid);
|
||||||
|
hideLoader();
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sailorsSearch() {
|
||||||
|
$('.item-sailor-search').remove();
|
||||||
|
if (sailorIsSteuermann) {
|
||||||
|
var item = '<a class="item-sailor-search" onclick="sailorSelected(null)">';
|
||||||
|
item += '<span style="font-style:italic;">noch unklar</span>';
|
||||||
|
item += '<i class="fa fa-angle-right"></i>';
|
||||||
|
item += '</a>';
|
||||||
|
$('#menu-sailor').find('.content').find('.list-group').append(item);
|
||||||
|
}
|
||||||
|
if ($('#input-edit-search').val().length == 0) {
|
||||||
|
known.forEach(function (entry) {
|
||||||
|
$('#menu-sailor').find('.content').find('.list-group').append(entry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ($('#input-edit-search').val().length >= 3) {
|
||||||
|
sailors.forEach(function (entry) {
|
||||||
|
if (search($('#input-edit-search').val(), entry.keywords)) {
|
||||||
|
$('#menu-sailor').find('.content').find('.list-group').append(entry.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var item = '<p class="item-sailor-search">Zum Suchen mindestens 3 Zeichen eingeben</p>';
|
||||||
|
$('#menu-sailor').find('.content').find('.list-group').append(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function planningChangeCrew(sid = null) {
|
||||||
|
if (sid !== null) {
|
||||||
|
showLoader();
|
||||||
|
var rid = $('#switch-planning-include').data('regatta');
|
||||||
|
// remove sailor
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + 'planning_remove_crew',
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
regatta: rid,
|
||||||
|
sailor: sid
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
log('authentification failed');
|
||||||
|
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||||
|
} else {
|
||||||
|
log('planning_remove_crew: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
$('#menu-edit').hideMenu();
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
planningEdit(rid);
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
sailorIsSteuermann = false;
|
||||||
|
$('#input-edit-search').val('').trigger('focusin').trigger('focusout');
|
||||||
|
sailorsSearch();
|
||||||
|
$('#menu-edit').hideMenu();
|
||||||
|
$('#menu-sailor').find('.menu-title').find('h1').text('Crew hinzufügen');
|
||||||
|
$('#menu-sailor').showMenu();
|
||||||
|
$('#input-edit-search').focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function planningChangeSteuermann() {
|
||||||
|
sailorIsSteuermann = true;
|
||||||
|
$('#input-edit-search').val('').trigger('focusin').trigger('focusout');
|
||||||
|
sailorsSearch();
|
||||||
|
$('#menu-edit').hideMenu();
|
||||||
|
$('#menu-sailor').find('.menu-title').find('h1').text('Steuermann/-frau bearbeiten');
|
||||||
|
$('#menu-sailor').showMenu();
|
||||||
|
$('#input-edit-search').focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
var boats = [];
|
||||||
|
var boatKnownIds = [];
|
||||||
|
var boatKnown = [];
|
||||||
|
|
||||||
|
async function boatSelected(bid) {
|
||||||
|
$('#menu-boat').hideMenu();
|
||||||
|
showLoader();
|
||||||
|
var rid = $('#switch-planning-include').data('regatta');
|
||||||
|
var action = 'planning_set_boat';
|
||||||
|
// add boat
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + action,
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
regatta: rid,
|
||||||
|
boat: bid
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 401) {
|
||||||
|
log('authentification failed');
|
||||||
|
toastError('Authentifizierung fehlgeschlagen. Versuche es erneut.');
|
||||||
|
} else if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um die Änderungen zu speichern');
|
||||||
|
} else {
|
||||||
|
log(action + ': unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
if ((bid === null) || (bid in boatKnownIds)) {
|
||||||
|
planningEdit(rid);
|
||||||
|
hideLoader();
|
||||||
|
} else {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function boatsSearch() {
|
||||||
|
$('.item-boat-search').remove();
|
||||||
|
var item = '<a class="item-boat-search" onclick="boatSelected(null)">';
|
||||||
|
item += '<span style="font-style:italic;">noch unklar</span>';
|
||||||
|
item += '<i class="fa fa-angle-right"></i>';
|
||||||
|
item += '</a>';
|
||||||
|
$('#menu-boat').find('.content').find('.list-group').append(item);
|
||||||
|
if ($('#input-edit-boat-search').val().length == 0) {
|
||||||
|
boatKnown.forEach(function (entry) {
|
||||||
|
$('#menu-boat').find('.content').find('.list-group').append(entry);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ($('#input-edit-boat-search').val().length >= 3) {
|
||||||
|
boats.forEach(function (entry) {
|
||||||
|
if (search($('#input-edit-boat-search').val(), entry.keywords)) {
|
||||||
|
$('#menu-boat').find('.content').find('.list-group').append(entry.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var item = '<p class="item-boat-search">Zum Suchen mindestens 3 Zeichen eingeben</p>';
|
||||||
|
$('#menu-boat').find('.content').find('.list-group').append(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function planningChangeBoat() {
|
||||||
|
$('#input-edit-boat-search').val('').trigger('focusin').trigger('focusout');
|
||||||
|
boatsSearch();
|
||||||
|
$('#menu-edit').hideMenu();
|
||||||
|
$('#menu-boat').find('.menu-title').find('h1').text('Boot bearbeiten');
|
||||||
|
$('#menu-boat').showMenu();
|
||||||
|
$('#input-edit-boat-search').focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function initBoatsSailors() {
|
||||||
|
boats = [];
|
||||||
|
sailors = [];
|
||||||
|
boatKnown = [];
|
||||||
|
known = [];
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
||||||
|
boatKnownIds = {};
|
||||||
|
knownIds = {};
|
||||||
|
for (var p in plannings) {
|
||||||
|
p = plannings[p];
|
||||||
|
if (p.boat !== null) boatKnownIds[p.boat] = true;
|
||||||
|
if (p.steuermann !== null) knownIds[p.steuermann] = true;
|
||||||
|
var crew = p.crew.split(',');
|
||||||
|
for (var c in crew) {
|
||||||
|
c = crew[c];
|
||||||
|
if (c != '') knownIds[c] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var dbBoats = await dbGetData('boats');
|
||||||
|
dbBoats.sort(function(a,b){
|
||||||
|
return a.sailnumber.localeCompare(b.sailnumber);
|
||||||
|
});
|
||||||
|
for (var b in dbBoats) {
|
||||||
|
var item = '<a class="item-boat-search" onclick="boatSelected(' + dbBoats[b].id + ')">';
|
||||||
|
item += '<span>' + dbBoats[b].sailnumber + ' - ' + dbBoats[b].name + '</span>';
|
||||||
|
item += '<i class="fa fa-angle-right"></i>';
|
||||||
|
item += '</a>';
|
||||||
|
boats.push({
|
||||||
|
keywords: [dbBoats[b].sailnumber, dbBoats[b].name],
|
||||||
|
content: item
|
||||||
|
});
|
||||||
|
if (dbBoats[b].id in boatKnownIds) boatKnown.push(item);
|
||||||
|
}
|
||||||
|
var dbSailors = await dbGetData('sailors');
|
||||||
|
dbSailors.sort(function(a,b){
|
||||||
|
return a.name.localeCompare(b.name);
|
||||||
|
});
|
||||||
|
for (var s in dbSailors) {
|
||||||
|
var item = '<a class="item-sailor-search" onclick="sailorSelected(' + dbSailors[s].id + ')">';
|
||||||
|
item += '<span>' + dbSailors[s].name + '</span>';
|
||||||
|
item += '<i class="fa fa-angle-right"></i>';
|
||||||
|
item += '</a>';
|
||||||
|
sailors.push({
|
||||||
|
keywords: [dbSailors[s].name],
|
||||||
|
content: item
|
||||||
|
});
|
||||||
|
if (dbSailors[s].id in knownIds) known.push(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function planningEdit(id) {
|
||||||
|
var regatta = await dbGetData('regattas', id);
|
||||||
|
|
||||||
|
$('#menu-edit').find('.menu-title').find('p').text(regatta.name);
|
||||||
|
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta['id']);
|
||||||
|
var planning = null;
|
||||||
|
if (isLoggedIn()) {
|
||||||
|
for (i in plannings) {
|
||||||
|
if (plannings[i]['user'] == USER_ID) {
|
||||||
|
planning = plannings[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#switch-planning-include').data('regatta', id);
|
||||||
|
if (planning !== null) {
|
||||||
|
$('#switch-planning-include').prop('checked', true);
|
||||||
|
$('#item-boat').show();
|
||||||
|
$('#item-steuermann').show();
|
||||||
|
if (planning.boat !== null) {
|
||||||
|
$('#item-boat').find('span').text('Boot: ' + (await dbGetData('boats', planning.boat)).sailnumber);
|
||||||
|
} else {
|
||||||
|
$('#item-boat').find('span').html('Boot: <font style="font-style:italic;">noch unklar</font>');
|
||||||
|
}
|
||||||
|
if (planning.steuermann !== null) {
|
||||||
|
$('#item-steuermann').find('span').text('Am Steuer: ' + (await dbGetData('sailors', planning.steuermann)).name);
|
||||||
|
} else {
|
||||||
|
$('#item-steuermann').find('span').html('Am Steuer: <font style="font-style:italic;">noch unklar</font>');
|
||||||
|
}
|
||||||
|
$('.item-crew').remove();
|
||||||
|
var crew = planning.crew.split(',');
|
||||||
|
for (c in crew) {
|
||||||
|
var sailor = await dbGetData('sailors', crew[c]);
|
||||||
|
if (sailor !== null) {
|
||||||
|
var item = '<a class="item-crew" onclick="planningChangeCrew(' + sailor.id + ')">';
|
||||||
|
item += '<span>' + sailor.name + '</span>';
|
||||||
|
item += '<i class="fa fa-angle-right"></i>';
|
||||||
|
item += '</a>';
|
||||||
|
$('#menu-edit').find('.content').find('.list-group').append(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var item = '<a class="item-crew" onclick="planningChangeCrew()">';
|
||||||
|
item += '<span style="font-style:italic;">Weiteren Segler hinzufügen</span>';
|
||||||
|
item += '<i class="fa fa-angle-right"></i>';
|
||||||
|
item += '</a>';
|
||||||
|
$('#menu-edit').find('.content').find('.list-group').append(item);
|
||||||
|
} else {
|
||||||
|
$('#switch-planning-include').prop('checked', false);
|
||||||
|
$('#item-boat').hide();
|
||||||
|
$('#item-steuermann').hide();
|
||||||
|
$('.item-crew').remove();
|
||||||
|
}
|
||||||
|
$('#menu-edit').showMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectChange() {
|
||||||
|
var val = $('#select-year').val();
|
||||||
|
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?year=' + val);
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initYear() {
|
||||||
|
return new Promise(async function (resolve) {
|
||||||
|
var year = findGetParameter('year');
|
||||||
|
if (year === null) year = await dbGetCurrentYear();
|
||||||
|
|
||||||
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var today;
|
||||||
|
|
||||||
|
async function drawList () {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (entry == null) {
|
||||||
|
list += '<div><div align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
||||||
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
list += entry.content;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#div-regattas').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
location.href = LINK_PRE + 'planning';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
await initYear();
|
||||||
|
$('#select-year').change(selectChange);
|
||||||
|
$('#input-search').on('input', drawList);
|
||||||
|
$('#switch-planning-include').parent().parent().click(planningSwitchChanged);
|
||||||
|
$('#item-boat').click(planningChangeBoat);
|
||||||
|
$('#item-steuermann').click(planningChangeSteuermann);
|
||||||
|
$('#input-edit-search').on('input', sailorsSearch);
|
||||||
|
$('#input-edit-boat-search').on('input', boatsSearch);
|
||||||
|
initBoatsSailors();
|
||||||
|
}
|
||||||
|
|
||||||
|
today = getToday();
|
||||||
|
|
||||||
|
var selectedYear = $('#select-year').val();
|
||||||
|
var minDate = parseDate(selectedYear + '-01-01');
|
||||||
|
var maxDate = parseDate(selectedYear + '-12-31');
|
||||||
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'user', USER_ID);
|
||||||
|
for (var i = regattas.length - 1; i >= 0; i --) {
|
||||||
|
var entry = regattas[i];
|
||||||
|
var okay = false;
|
||||||
|
for (p in plannings) {
|
||||||
|
if (plannings[p].regatta == entry.id) {
|
||||||
|
regattas[i].planning = plannings[p];
|
||||||
|
okay = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!okay) {
|
||||||
|
regattas[i].planning = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var years = await dbGetData('years');
|
||||||
|
years.sort(function (a, b) {
|
||||||
|
if (a['year'] > b['year']) return -1;
|
||||||
|
if (a['year'] < b['year']) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
var options = '';
|
||||||
|
for (id in years) {
|
||||||
|
var year = years[id]['year'];
|
||||||
|
options += '<option value="' + year + '">' + year + '</option>';
|
||||||
|
}
|
||||||
|
$('#select-year').html(options);
|
||||||
|
$('#select-year').val(selectedYear);
|
||||||
|
|
||||||
|
var count = regattas.length;
|
||||||
|
if (count > 0) {
|
||||||
|
if (count == 1) {
|
||||||
|
$('#p-count').html('Es wurde 1 Regatta gefunden!');
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Es wurden ' + count + ' Regatten gefunden!');
|
||||||
|
}
|
||||||
|
$('#div-regattas').show();
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
var heute = false;
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in regattas) {
|
||||||
|
var entry = regattas[id];
|
||||||
|
var club = null;
|
||||||
|
if (entry['club'] != null)
|
||||||
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
if (entry.planning !== null) {
|
||||||
|
if (entry.planning.boat !== null) {
|
||||||
|
entry.planning.boat = (await dbGetData('boats', entry.planning.boat)).sailnumber;
|
||||||
|
}
|
||||||
|
if (entry.planning.steuermann !== null) {
|
||||||
|
entry.planning.steuermann = (await dbGetData('sailors', entry.planning.steuermann)).name;
|
||||||
|
}
|
||||||
|
var crewString = entry.planning.crew.split(',');
|
||||||
|
entry.planning.crew = [];
|
||||||
|
for (c in crewString) {
|
||||||
|
var sailor = await dbGetData('sailors', crewString[c]);
|
||||||
|
if (sailor !== null) {
|
||||||
|
entry.planning.crew.push(sailor.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var dateFrom = entry['dateFrom'];
|
||||||
|
var dateTo = entry['dateTo'];
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry['name']);
|
||||||
|
if (entry['number'] != null) row.keywords.push(entry['number']);
|
||||||
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
|
if (!heute && (today <= dateFrom)) {
|
||||||
|
rows.push(null);
|
||||||
|
heute = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.planning !== null) {
|
||||||
|
row.content += '<div onclick="planningEdit(' + entry['id'] + ');">';
|
||||||
|
} else {
|
||||||
|
row.content += '<div onclick="planningEdit(' + entry['id'] + ');" style="opacity:0.5;">';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
// Name
|
||||||
|
row.content += '<div><b>' + (entry['canceled'] == 1 ? '<s>' : '') + entry['name'] + (entry['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Number
|
||||||
|
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||||
|
|
||||||
|
// Special
|
||||||
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = '* ' + entry.special.substr(1);
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = entry.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = entry.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = entry.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
value = 'U-' + value;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.special = entry.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
|
row.content += '<div>' + entry['special'] + '</div>';
|
||||||
|
|
||||||
|
// Club
|
||||||
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 3
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Date
|
||||||
|
if (entry['length'] < 1) {
|
||||||
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
|
row.content += '<div><font class="color-red2-dark">Datum noch unklar</font></div>';
|
||||||
|
} else {
|
||||||
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font></div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// RLF
|
||||||
|
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
if (entry.planning !== null) {
|
||||||
|
// ZEILE 4
|
||||||
|
row.content += '<div></div>';
|
||||||
|
|
||||||
|
// ZEILE 5
|
||||||
|
row.content += '<div>';
|
||||||
|
row.content += '<div>' + (entry.planning.boat !== null ? entry.planning.boat : '<i>Boot unklar</i>') + '</div>';
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 6
|
||||||
|
row.content += '<div>';
|
||||||
|
row.content += '<div>' + (entry.planning.steuermann !== null ? entry.planning.steuermann : '<i>St.mann unklar</i>') + '</div>';
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 7...
|
||||||
|
for (var i in entry.planning.crew) {
|
||||||
|
row.content += '<div>';
|
||||||
|
row.content += '<div>' + entry.planning.crew[i] + '</div>';
|
||||||
|
row.content += '</div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
row.content += '<div>Du planst nicht, hierhin zu fahren</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!heute) {
|
||||||
|
rows.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawList();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Keine Regatten gefunden!');
|
||||||
|
$('#div-regattas').hide();
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
151
server/scripts/planning_list.js
Normal file
151
server/scripts/planning_list.js
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
async function onUserClicked(id) {
|
||||||
|
var user = await dbGetData('users', id);
|
||||||
|
if (user !== null) {
|
||||||
|
location.href = LINK_PRE + 'planning_view?user=' + user.id + '&year=' + $('#select-year').val();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function selectChange() {
|
||||||
|
var val = $('#select-year').val();
|
||||||
|
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?year=' + val);
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initYear() {
|
||||||
|
return new Promise(async function (resolve) {
|
||||||
|
var year = findGetParameter('year');
|
||||||
|
if (year === null) year = await dbGetCurrentYear();
|
||||||
|
|
||||||
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var today;
|
||||||
|
|
||||||
|
async function drawList () {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
list += entry.content;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#div-users').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
if (!isLoggedIn()) {
|
||||||
|
hideLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
await initYear();
|
||||||
|
$('#select-year').change(selectChange);
|
||||||
|
$('#input-search').on('input', drawList);
|
||||||
|
}
|
||||||
|
|
||||||
|
var selectedYear = $('#select-year').val();
|
||||||
|
var minDate = parseDate(selectedYear + '-01-01');
|
||||||
|
var maxDate = parseDate(selectedYear + '-12-31');
|
||||||
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
var plannings = {};
|
||||||
|
for (var i in regattas) {
|
||||||
|
var entry = regattas[i];
|
||||||
|
var planning = await dbGetDataIndex('plannings', 'regatta', entry.id);
|
||||||
|
for (p in planning) {
|
||||||
|
if (!(planning[p].user in plannings)) {
|
||||||
|
plannings[planning[p].user] = {
|
||||||
|
user: await dbGetData('users', planning[p].user),
|
||||||
|
regattas: [],
|
||||||
|
sailors: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
plannings[planning[p].user].regattas.push(entry);
|
||||||
|
var sailor = null;
|
||||||
|
if (planning[p].steuermann !== null) sailor = await dbGetData('sailors', planning[p].steuermann);
|
||||||
|
if (sailor !== null) {
|
||||||
|
if (!(sailor.id in plannings[planning[p].user].sailors)) plannings[planning[p].user].sailors[sailor.id] = sailor.name;
|
||||||
|
}
|
||||||
|
var crew = planning[p].crew.split(',');
|
||||||
|
for (i in crew) {
|
||||||
|
sailor = await dbGetData('sailors', crew[i]);
|
||||||
|
if (sailor !== null) {
|
||||||
|
if (!(sailor.id in plannings[planning[p].user].sailors)) plannings[planning[p].user].sailors[sailor.id] = sailor.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plannings = Object.values(plannings);
|
||||||
|
plannings.sort(function(a,b){
|
||||||
|
return a.user.username.localeCompare(b.user.username);
|
||||||
|
});
|
||||||
|
|
||||||
|
var years = await dbGetData('years');
|
||||||
|
years.sort(function (a, b) {
|
||||||
|
if (a['year'] > b['year']) return -1;
|
||||||
|
if (a['year'] < b['year']) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
var options = '';
|
||||||
|
for (id in years) {
|
||||||
|
var year = years[id]['year'];
|
||||||
|
options += '<option value="' + year + '">' + year + '</option>';
|
||||||
|
}
|
||||||
|
$('#select-year').html(options);
|
||||||
|
$('#select-year').val(selectedYear);
|
||||||
|
|
||||||
|
var count = plannings.length;
|
||||||
|
if (count > 0) {
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in plannings) {
|
||||||
|
var entry = plannings[id];
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry.user.username);
|
||||||
|
for (i in entry.sailors) {
|
||||||
|
row.keywords.push(entry.sailors[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
row.content += '<div onclick="onUserClicked(' + entry.user.id + ');">';
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
row.content += '<div></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Name
|
||||||
|
row.content += '<div>' + entry.user.username + '</div>';
|
||||||
|
|
||||||
|
// Count of regattas
|
||||||
|
row.content += '<div>' + entry.regattas.length + ' Regatten</div>';
|
||||||
|
|
||||||
|
row.content += '</div></div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawList();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#div-users').html('Es hat noch niemand eine Saison-Planung erstellt');
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
255
server/scripts/planning_view.js
Normal file
255
server/scripts/planning_view.js
Normal file
@@ -0,0 +1,255 @@
|
|||||||
|
var userid;
|
||||||
|
|
||||||
|
function selectChange() {
|
||||||
|
var val = $('#select-year').val();
|
||||||
|
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?user=' + userid + '&year=' + val);
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initYear() {
|
||||||
|
return new Promise(async function (resolve) {
|
||||||
|
var year = findGetParameter('year');
|
||||||
|
if (year === null) year = await dbGetCurrentYear();
|
||||||
|
|
||||||
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
|
$('#select-year').val(year);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var today;
|
||||||
|
|
||||||
|
async function drawList () {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (entry == null) {
|
||||||
|
list += '<div><div align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
||||||
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
list += entry.content;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#div-regattas').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
userid = findGetParameter('user');
|
||||||
|
var user = null;
|
||||||
|
if (userid !== null) {
|
||||||
|
user = await dbGetData('users', userid);
|
||||||
|
}
|
||||||
|
if (user === null) {
|
||||||
|
location.href = LINK_PRE + 'planning_list';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#p-username').text(user.username);
|
||||||
|
|
||||||
|
if (isLoggedIn() && (userid == USER_ID)) {
|
||||||
|
$('#button-share').show();
|
||||||
|
$('#button-share').click(function(){
|
||||||
|
$('#menu-share').showMenu();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$('#button-share').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
await initYear();
|
||||||
|
$('#select-year').change(selectChange);
|
||||||
|
$('#input-search').on('input', drawList);
|
||||||
|
}
|
||||||
|
|
||||||
|
today = getToday();
|
||||||
|
|
||||||
|
var selectedYear = $('#select-year').val();
|
||||||
|
var minDate = parseDate(selectedYear + '-01-01');
|
||||||
|
var maxDate = parseDate(selectedYear + '-12-31');
|
||||||
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
|
var plannings = await dbGetDataIndex('plannings', 'user', user.id);
|
||||||
|
for (var i = regattas.length - 1; i >= 0; i --) {
|
||||||
|
var entry = regattas[i];
|
||||||
|
var okay = false;
|
||||||
|
for (p in plannings) {
|
||||||
|
if (plannings[p].regatta == entry.id) {
|
||||||
|
regattas[i].planning = plannings[p];
|
||||||
|
okay = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!okay) {
|
||||||
|
regattas.splice(i, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var years = await dbGetData('years');
|
||||||
|
years.sort(function (a, b) {
|
||||||
|
if (a['year'] > b['year']) return -1;
|
||||||
|
if (a['year'] < b['year']) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
var options = '';
|
||||||
|
for (id in years) {
|
||||||
|
var year = years[id]['year'];
|
||||||
|
options += '<option value="' + year + '">' + year + '</option>';
|
||||||
|
}
|
||||||
|
$('#select-year').html(options);
|
||||||
|
$('#select-year').val(selectedYear);
|
||||||
|
|
||||||
|
var count = regattas.length;
|
||||||
|
if (count > 0) {
|
||||||
|
if (count == 1) {
|
||||||
|
$('#p-count').html('Es wurde 1 Regatta gefunden!');
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Es wurden ' + count + ' Regatten gefunden!');
|
||||||
|
}
|
||||||
|
$('#div-regattas').show();
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
var heute = false;
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in regattas) {
|
||||||
|
var entry = regattas[id];
|
||||||
|
var club = null;
|
||||||
|
if (entry['club'] != null)
|
||||||
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
if (entry.planning.boat !== null) {
|
||||||
|
entry.planning.boat = (await dbGetData('boats', entry.planning.boat)).sailnumber;
|
||||||
|
}
|
||||||
|
if (entry.planning.steuermann !== null) {
|
||||||
|
entry.planning.steuermann = (await dbGetData('sailors', entry.planning.steuermann)).name;
|
||||||
|
}
|
||||||
|
var crewString = entry.planning.crew.split(',');
|
||||||
|
entry.planning.crew = [];
|
||||||
|
for (c in crewString) {
|
||||||
|
var sailor = await dbGetData('sailors', crewString[c]);
|
||||||
|
if (sailor !== null) {
|
||||||
|
entry.planning.crew.push(sailor.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var dateFrom = entry['dateFrom'];
|
||||||
|
var dateTo = entry['dateTo'];
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry['name']);
|
||||||
|
if (entry['number'] != null) row.keywords.push(entry['number']);
|
||||||
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
if (entry.planning.boat != null) row.keywords.push(entry.planning.boat);
|
||||||
|
if (entry.planning.steuermann != null) row.keywords.push(entry.planning.steuermann);
|
||||||
|
for (c in entry.planning.crew) row.keywords.push(entry.planning.crew[c]);
|
||||||
|
|
||||||
|
if (!heute && (today <= dateFrom)) {
|
||||||
|
rows.push(null);
|
||||||
|
heute = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
row.content += '<div onclick="onRegattaClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
// Name
|
||||||
|
row.content += '<div><b>' + (entry['canceled'] == 1 ? '<s>' : '') + entry['name'] + (entry['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Number
|
||||||
|
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||||
|
|
||||||
|
// Special
|
||||||
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = '* ' + entry.special.substr(1);
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = entry.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = entry.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = entry.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
value = 'U-' + value;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.special = entry.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
|
row.content += '<div>' + entry['special'] + '</div>';
|
||||||
|
|
||||||
|
// Club
|
||||||
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 3
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Date
|
||||||
|
if (entry['length'] < 1) {
|
||||||
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
|
row.content += '<div><font class="color-red2-dark">Datum noch unklar</font></div>';
|
||||||
|
} else {
|
||||||
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font></div>';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// RLF
|
||||||
|
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 4
|
||||||
|
row.content += '<div></div>';
|
||||||
|
|
||||||
|
// ZEILE 5
|
||||||
|
row.content += '<div>';
|
||||||
|
row.content += '<div>' + (entry.planning.boat !== null ? entry.planning.boat : '<i>Boot unklar</i>') + '</div>';
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 6
|
||||||
|
row.content += '<div>';
|
||||||
|
row.content += '<div>' + (entry.planning.steuermann !== null ? entry.planning.steuermann : '<i>St.mann unklar</i>') + '</div>';
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
// ZEILE 7...
|
||||||
|
for (var i in entry.planning.crew) {
|
||||||
|
row.content += '<div>';
|
||||||
|
row.content += '<div>' + entry.planning.crew[i] + '</div>';
|
||||||
|
row.content += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
row.content += '</div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!heute) {
|
||||||
|
rows.push(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawList();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#p-count').html(user.username + ' hat noch keine Regatten in seiner/ihrer Saison-Planung!');
|
||||||
|
$('#div-regattas').hide();
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
@@ -11,7 +11,7 @@ async function onRankingClicked(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sailor == null) return;
|
if (sailor == null) return;
|
||||||
|
|
||||||
$('#menu-rank').find('.menu-title').find('p').text(sailor.name);
|
$('#menu-rank').find('.menu-title').find('p').text(sailor.name);
|
||||||
if (lastRanking != null) {
|
if (lastRanking != null) {
|
||||||
var lastRank;
|
var lastRank;
|
||||||
@@ -25,172 +25,294 @@ async function onRankingClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-text').hide();
|
$('#menu-item-text').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
list = '';
|
list = '';
|
||||||
for (var i in sailor.regattas) {
|
for (var i in sailor.regattas) {
|
||||||
var entry = sailor.regattas[i];
|
var entry = sailor.regattas[i];
|
||||||
var regatta = entry.regatta;
|
var regatta = entry.regatta;
|
||||||
var boat = await dbGetData('boats', entry.boat);
|
var boat = await dbGetData('boats', entry.boat);
|
||||||
|
|
||||||
var dateFrom = parseDate(regatta.date);
|
var dateFrom = parseDate(regatta.date);
|
||||||
var dateTo = parseDate(regatta.date);
|
var dateTo = parseDate(regatta.date);
|
||||||
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta.length) - 1, 0));
|
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta.length) - 1, 0));
|
||||||
|
|
||||||
list += '<div onclick="onDetailClicked(' + regatta.id + ')">';
|
list += '<div onclick="onDetailClicked(' + regatta.id + ')">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
list += '<div><b>' + regatta.name + '</b></div>';
|
list += '<div><b>' + regatta.name + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// DATE
|
// DATE
|
||||||
list += '<div>' + formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo) + '</div>';
|
list += '<div>' + formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo) + '</div>';
|
||||||
|
|
||||||
// m
|
// m
|
||||||
list += '<div>m: ' + entry.m + '</div>';
|
list += '<div>m: ' + entry.m + '</div>';
|
||||||
|
|
||||||
// rlf
|
// rlf
|
||||||
list += '<div>RLF: ' + parseFloat(regatta.rlf).toFixed(2) + '</div>';
|
list += '<div>RLF: ' + parseFloat(regatta.rlf).toFixed(2) + '</div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
|
|
||||||
// ZEILE 3
|
// ZEILE 3
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Place
|
// Place
|
||||||
list += '<div>Platz ' + entry.place + ' / ' + entry.fb + '</div>';
|
list += '<div>Platz ' + entry.place + ' / ' + entry.fb + '</div>';
|
||||||
|
|
||||||
// rlp
|
// rlp
|
||||||
var color;
|
var color;
|
||||||
if (entry.used == 0) { color = 'color-red2-dark'; }
|
if (entry.used == 0) { color = 'color-red2-dark'; }
|
||||||
else if (entry.used == entry.m) { color = 'color-green2-dark'; }
|
else if (entry.used == entry.m) { color = 'color-green2-dark'; }
|
||||||
else { color = 'color-yellow2-dark'; }
|
else { color = 'color-yellow2-dark'; }
|
||||||
list += '<div>Punkte: ' + entry.used + ' x <b class="' + color + '">' + parseFloat(entry.rlp).toFixed(2) + '</b></div>';
|
list += '<div>Punkte: ' + entry.used + ' x <b class="' + color + '">' + parseFloat(entry.rlp).toFixed(2) + '</b></div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
|
|
||||||
// ZEILE 4
|
// ZEILE 4
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Sailnumber
|
// Sailnumber
|
||||||
list += '<div>' + boat.sailnumber + '</div>';
|
list += '<div>' + boat.sailnumber + '</div>';
|
||||||
|
|
||||||
// Boatname
|
// Boatname
|
||||||
list += '<div>' + boat.name + '</div>';
|
list += '<div>' + boat.name + '</div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
|
|
||||||
// ZEILE 5...
|
// ZEILE 5...
|
||||||
var crew = entry.crew.split(',');
|
var crew = entry.crew.split(',');
|
||||||
for (var c in crew) {
|
for (var c in crew) {
|
||||||
var cr = await dbGetData('sailors', crew[c]);
|
var cr = await dbGetData('sailors', crew[c]);
|
||||||
if (cr != null) {
|
if (cr != null) {
|
||||||
list += '<div>';
|
list += '<div>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
list += '<div>' + cr.name + '</div>';
|
list += '<div>' + cr.name + '</div>';
|
||||||
|
|
||||||
// Year
|
// Year
|
||||||
list += '<div>' + ((cr.year != null) ? ('(' + cr.year + ')') : '') + '</div>';
|
list += '<div>' + ((cr.year != null) ? ('(' + cr.year + ')') : '') + '</div>';
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list += '</div>';
|
list += '</div>';
|
||||||
}
|
}
|
||||||
$('#div-details').html(list);
|
$('#div-details').html(list);
|
||||||
|
|
||||||
$('#menu-rank').showMenu();
|
$('#menu-rank').showMenu();
|
||||||
$('#menu-rank').scrollTop(0);
|
$('#menu-rank').scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function selectChange(callSiteScript = true) {
|
var rankings;
|
||||||
var type = $('#select-type').val();
|
|
||||||
var year = parseInt($('#select-year').val());
|
function selectChange(callSiteScript = true) {
|
||||||
if (type == "user") {
|
return new Promise(async function (resolve) {
|
||||||
$('#select-year').parent().hide();
|
var year = $('#select-year').val();
|
||||||
$('#input-from').parent().show();
|
if (year == "user") {
|
||||||
$('#input-to').parent().show();
|
$('#select-type').parent().hide();
|
||||||
$('#input-jugend').parent().parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-jugstrict').parent().parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#button-show').show();
|
$('#input-altm').trigger('focusin').trigger('focusout').parent().show();
|
||||||
} else {
|
$('#input-maxage').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#select-year').parent().show();
|
$('#input-agestrict').parent().show();
|
||||||
$('#input-from').parent().hide();
|
$('#input-agecrew').parent().show();
|
||||||
$('#input-to').parent().hide();
|
$('#button-show').show();
|
||||||
$('#input-jugend').parent().parent().hide();
|
$('#card-special-ranks').hide();
|
||||||
$('#input-jugstrict').parent().parent().hide();
|
} else {
|
||||||
$('#button-show').hide();
|
year = parseInt(year);
|
||||||
|
var type = $('#select-type').val();
|
||||||
var from, to, jugend, jugstrict;
|
console.log('[rank] selected', year, type);
|
||||||
switch (type) {
|
$('#select-type').parent().show();
|
||||||
case 'year':
|
$('#input-from').parent().hide();
|
||||||
from = (year - 1) + '-12-01';
|
$('#input-to').parent().hide();
|
||||||
to = year + '-11-30';
|
$('#input-altm').parent().hide();
|
||||||
jugend = jugstrict = false;
|
$('#input-maxage').parent().hide();
|
||||||
break;
|
$('#input-agestrict').parent().hide();
|
||||||
case 'youth':
|
$('#input-agecrew').parent().hide();
|
||||||
from = (year - 1) + '-12-01';
|
$('#button-show').hide();
|
||||||
to = year + '-11-30';
|
$('#card-special-ranks').hide(); // first hide, show only when there are special ranks
|
||||||
jugend = jugstrict = true;
|
|
||||||
break;
|
var rankingsShow = {};
|
||||||
case 'idjm':
|
var options = '';
|
||||||
var beginn = null;
|
for (var i in rankings) {
|
||||||
var regattas = await dbGetData('regattas');
|
if (rankings[i].year_from !== null && rankings[i].year_from > year) continue;
|
||||||
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
|
if (rankings[i].year_to !== null && rankings[i].year_to < year) continue;
|
||||||
for (var r in regattas) {
|
var alias = rankings[i].alias;
|
||||||
var regatta = regattas[r];
|
options += '<option value="' + alias + '">' + rankings[i].name + '</option>';
|
||||||
var date = parseDate(regatta.date);
|
rankingsShow[alias] = rankings[i];
|
||||||
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
|
}
|
||||||
continue;
|
$('#select-type').html(options);
|
||||||
|
if (!(type in rankingsShow)) {
|
||||||
|
console.log('[rank] selected type', type, 'not found for year', year, '. Using `year`');
|
||||||
|
type = 'year';
|
||||||
|
}
|
||||||
|
$('#select-type').val(type).trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
|
// special ranks
|
||||||
|
getJSON(QUERY_URL + 'get_special_rankings', function (code, data) {
|
||||||
|
if (code == 200) {
|
||||||
|
var specialRanks = [];
|
||||||
|
for (var i in data.data) {
|
||||||
|
var sr = data.data[i];
|
||||||
|
if (sr.to < (year + '-01-01')) continue;
|
||||||
|
if (sr.to > (year + '-12-31')) continue;
|
||||||
|
specialRanks.push(sr);
|
||||||
}
|
}
|
||||||
if (regatta.name.indexOf(YOUTH_GERMAN_NAME) >= 0) {
|
if (specialRanks.length > 0) {
|
||||||
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
var btns = '';
|
||||||
break;
|
for (var i in specialRanks) {
|
||||||
|
var sr = specialRanks[i];
|
||||||
|
var link = 'https://regatten.net/frame.php?class=' + BOATCLASS + '&site=special_rank&rank_id=' + sr.id;
|
||||||
|
var name = sr.title;
|
||||||
|
var cssclass = i > 0 ? ' mt-3' : '';
|
||||||
|
btns += '<a class="btn btn-full rounded-s text-uppercase font-900 shadow-m bg-highlight' + cssclass + '" href="' + link + '">' + name + '</a>';
|
||||||
|
}
|
||||||
|
$('#card-special-ranks').find('.content').html(btns);
|
||||||
|
$('#card-special-ranks').show();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (beginn != null) {
|
|
||||||
from = new Date(beginn);
|
|
||||||
from.setFullYear(from.getFullYear() - 1);
|
|
||||||
from.setDate(from.getDate() - 13);
|
|
||||||
from = formatDate('Y-m-d', from);
|
|
||||||
to = new Date(beginn);
|
|
||||||
to.setDate(to.getDate() - 14);
|
|
||||||
to = formatDate('Y-m-d', to);
|
|
||||||
jugend = true;
|
|
||||||
jugstrict = false;
|
|
||||||
} else {
|
} else {
|
||||||
$('#div-rank').html('Keine ' + YOUTH_GERMAN_NAME + ' gefunden!');
|
log("[rank] special_ranks: Something went wrong (HTTP " + code + ")");
|
||||||
$('#input-search').parent().hide();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
break;
|
});
|
||||||
|
|
||||||
|
var from, to, altm, maxage, agestrict, agecrew;
|
||||||
|
altm = 9; maxage = false; agestrict = false; agecrew = false;
|
||||||
|
var r = rankingsShow[type];
|
||||||
|
console.log('[rank] type', type, '=>', r);
|
||||||
|
if (r.max_age !== null) {
|
||||||
|
maxage = r.max_age;
|
||||||
|
agestrict = r.age_strict == 1;
|
||||||
|
agecrew = r.age_crew == 1;
|
||||||
|
}
|
||||||
|
if (r.alt_m !== null) {
|
||||||
|
altm = r.alt_m;
|
||||||
|
}
|
||||||
|
switch (r.type) {
|
||||||
|
case 'year':
|
||||||
|
from = (year - 1) + '-12-01';
|
||||||
|
to = year + '-11-30';
|
||||||
|
break;
|
||||||
|
case 'quali':
|
||||||
|
// TODO: auslagern in function getRegattaBegin
|
||||||
|
var beginn = null;
|
||||||
|
var regattas = await dbGetData('regattas');
|
||||||
|
regattas.sort(function(a,b){ return b.date.localeCompare(a.date); });
|
||||||
|
for (var ri in regattas) {
|
||||||
|
var regatta = regattas[ri];
|
||||||
|
var date = parseDate(regatta.date);
|
||||||
|
if ((date < parseDate('01.01.' + year)) || (date > parseDate('31.12.' + year))) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (regatta.name.toLowerCase().indexOf(r.quali_search.toLowerCase()) >= 0) {
|
||||||
|
console.log('FOUND', regatta);
|
||||||
|
beginn = ((regatta.meldungSchluss != null) ? parseDate(regatta.meldungSchluss) : date);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// END OF TODO
|
||||||
|
if (beginn !== null) {
|
||||||
|
from = new Date(beginn);
|
||||||
|
from.setFullYear(from.getFullYear() - 1);
|
||||||
|
from.setDate(from.getDate() - 13);
|
||||||
|
from = formatDate('Y-m-d', from);
|
||||||
|
to = new Date(beginn);
|
||||||
|
to.setDate(to.getDate() - 14);
|
||||||
|
to = formatDate('Y-m-d', to);
|
||||||
|
} else {
|
||||||
|
console.log('[rank] no regatta found');
|
||||||
|
from = year + '-12-31'; // reverse => no regattas will be found => no ranking
|
||||||
|
to = year + '-01-01';
|
||||||
|
break; // TODO: bessere Fehlermeldung - keine Regatta gefunden
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // TODO: bessere Fehlermeldung - tritt nur bei Fehlkonfiguration in DB auf
|
||||||
|
from = (year - 1) + '-12-01';
|
||||||
|
to = year + '-11-30';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[rank] setting', from, to, altm, maxage, agestrict, agecrew);
|
||||||
|
$('#input-from').val(from);
|
||||||
|
$('#input-to').val(to);
|
||||||
|
$('#input-altm').val(altm);
|
||||||
|
$('#input-maxage').val(maxage == false ? '' : maxage);
|
||||||
|
$('#input-agestrict').prop('checked', agestrict);
|
||||||
|
$('#input-agecrew').prop('checked', agecrew);
|
||||||
|
|
||||||
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
|
history.replaceState(null, '', '?year=' + year + '&type=' + type);
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
resolve();
|
||||||
$('#input-from').val(from);
|
});
|
||||||
$('#input-to').val(to);
|
}
|
||||||
$('#input-jugend').prop('checked', jugend);
|
|
||||||
$('#input-jugstrict').prop('checked', jugstrict);
|
function buttonShowPressed() {
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
if (callSiteScript && (typeof siteScript === 'function'))
|
var additional = '';
|
||||||
siteScript();
|
if ($('#input-maxage').val() != '') additional += '&maxage=' + $('#input-maxage').val();
|
||||||
|
if ($('#input-agestrict').prop('checked')) additional += '&agestrict=on';
|
||||||
|
if ($('#input-agecrew').prop('checked')) additional += '&agecrew=on';
|
||||||
|
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val() + "&altm=" + $('#input-altm').val() + additional)
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initSelects() {
|
function initSelects() {
|
||||||
var type = findGetParameter('type');
|
return new Promise(async function(resolve) {
|
||||||
var year = findGetParameter('year');
|
var year = findGetParameter('year');
|
||||||
if (type === null) type = 'year';
|
var type = findGetParameter('type');
|
||||||
if (year === null) year = new Date().getFullYear();
|
if (year === null) year = new Date().getFullYear();
|
||||||
|
if (type === null) type = 'year';
|
||||||
|
|
||||||
$('#select-type').val(type);
|
var years = await dbGetData('years');
|
||||||
|
years.sort(function (a, b) {
|
||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
if (a['year'] > b['year']) return -1;
|
||||||
$('#select-year').val(year);
|
if (a['year'] < b['year']) return 1;
|
||||||
|
return 0;
|
||||||
selectChange(false);
|
});
|
||||||
|
var yearFound = year == 'user';
|
||||||
|
var options = '<option value="user">Benutzerdefiniert</option>';
|
||||||
|
for (id in years) {
|
||||||
|
var y = years[id]['year'];
|
||||||
|
options += '<option value="' + y + '">' + y + '</option>';
|
||||||
|
if (year == y) yearFound = true;
|
||||||
|
}
|
||||||
|
$('#select-year').html(options);
|
||||||
|
$('#select-year').val(yearFound ? year : years[0]);
|
||||||
|
|
||||||
|
$('#select-type').html('<option value="' + type + '">' + type + '</option>');
|
||||||
|
$('#select-type').val(type);
|
||||||
|
|
||||||
|
if (year == "user") {
|
||||||
|
var from = findGetParameter('from');
|
||||||
|
var to = findGetParameter('to');
|
||||||
|
if (from === null) from = formatDate('Y-m-d');
|
||||||
|
if (to === null) to = formatDate('Y-m-d');
|
||||||
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
|
var altm = findGetParameter('altm');
|
||||||
|
if (altm === null) altm = 9;
|
||||||
|
$('#input-altm').val(altm).trigger('focusin').trigger('focusout');
|
||||||
|
var maxage = findGetParameter('maxage');
|
||||||
|
if (maxage === null) maxage = '';
|
||||||
|
$('#input-maxage').val(maxage).trigger('focusin').trigger('focusout');
|
||||||
|
var agestrict = findGetParameter('agestrict');
|
||||||
|
var agecrew = findGetParameter('agecrew');
|
||||||
|
$('#input-agestrict').prop('checked', agestrict !== null);
|
||||||
|
$('#input-agecrew').prop('checked', agecrew !== null);
|
||||||
|
}
|
||||||
|
|
||||||
|
await selectChange(false);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstCall = true;
|
var firstCall = true;
|
||||||
@@ -203,7 +325,12 @@ async function drawList () {
|
|||||||
var list = '';
|
var list = '';
|
||||||
rows.forEach(function (entry) {
|
rows.forEach(function (entry) {
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
list += '<div><div align="center" class="color-highlight" style="white-space:normal;"><b>Ende der Rangliste gemäß DSV-Ranglistenverordnung (min. m = 9 Wertungen)</b></div></div>';
|
var altm = $('#input-altm').val(); if (altm == '') altm = 9; else altm = parseInt(altm);
|
||||||
|
if (altm == 9) {
|
||||||
|
list += '<div><div align="center" class="color-highlight" style="white-space:normal;"><b>Ende der Rangliste gemäß DSV-Ranglistenverordnung (min. m = 9 Wertungen)</b></div></div>';
|
||||||
|
} else {
|
||||||
|
list += '<div><div align="center" class="color-highlight" style="white-space:normal;"><b>Ende der Rangliste (min. m = ' + altm + ' Wertungen)</b></div></div>';
|
||||||
|
}
|
||||||
} else if (search($('#input-search').val(), entry.keywords)) {
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
list += entry.content;
|
list += entry.content;
|
||||||
}
|
}
|
||||||
@@ -215,48 +342,38 @@ async function drawList () {
|
|||||||
var siteScript = async function() {
|
var siteScript = async function() {
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
firstCall = false;
|
firstCall = false;
|
||||||
initSelects();
|
rankings = await dbGetData('rankings');
|
||||||
$('#select-type').change(selectChange);
|
await initSelects();
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(siteScript);
|
$('#select-type').change(selectChange);
|
||||||
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
var minDate = parseDate($('#input-from').val());
|
var minDate = parseDate($('#input-from').val());
|
||||||
var maxDate = parseDate($('#input-to').val());
|
var maxDate = parseDate($('#input-to').val());
|
||||||
var jugend = $('#input-jugend').prop('checked');
|
var altm = $('#input-altm').val(); if (altm == '') altm = 9; else altm = parseInt(altm);
|
||||||
var jugstrict = $('#input-jugstrict').prop('checked');
|
var maxage = $('#input-maxage').val(); if (maxage == '') maxage = false; else maxage = parseInt(maxage);
|
||||||
var dbRanking = await dbGetRanking(minDate, maxDate, jugend, jugstrict);
|
var agestrict = $('#input-agestrict').prop('checked');
|
||||||
|
var agecrew = $('#input-agecrew').prop('checked');
|
||||||
|
console.log('[rank] rank params:', minDate, maxDate, altm, maxage, agestrict, agecrew);
|
||||||
|
var dbRanking = await dbGetRanking(minDate, maxDate, maxage, agestrict, altm, agecrew);
|
||||||
ranking = dbRanking[0];
|
ranking = dbRanking[0];
|
||||||
|
|
||||||
lastRanking = null;
|
lastRanking = null; // TODO: also for quali ranks
|
||||||
if (($('#select-type').val() == 'year') || ($('#select-type').val() == 'youth')) {
|
if (($('#select-type').val() == 'year') || ($('#select-type').val() == 'youth')) {
|
||||||
lastRanking = {};
|
lastRanking = {};
|
||||||
var lYear = parseInt($('#select-year').val()) - 1;
|
var lYear = parseInt($('#select-year').val()) - 1;
|
||||||
var lMinDate = parseDate((lYear - 1) + '-12-01');
|
var lMinDate = parseDate((lYear - 1) + '-12-01');
|
||||||
var lMaxDate = parseDate(lYear + '-11-30');
|
var lMaxDate = parseDate(lYear + '-11-30');
|
||||||
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, jugend, jugstrict))[0];
|
var lDbRanking = (await dbGetRanking(lMinDate, lMaxDate, maxage, agestrict, altm, agecrew))[0];
|
||||||
for (var i in lDbRanking) {
|
for (var i in lDbRanking) {
|
||||||
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank;
|
lastRanking[lDbRanking[i].id] = lDbRanking[i].rank;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var selectedYear = $('#select-year').val();
|
var selectedYear = $('#select-year').val();
|
||||||
|
|
||||||
var years = await dbGetData('years');
|
|
||||||
years.sort(function (a, b) {
|
|
||||||
if (a['year'] > b['year']) return -1;
|
|
||||||
if (a['year'] < b['year']) return 1;
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
var options = '';
|
|
||||||
for (id in years) {
|
|
||||||
var year = years[id]['year'];
|
|
||||||
options += '<option value="' + year + '">' + year + '</option>';
|
|
||||||
}
|
|
||||||
$('#select-year').html(options);
|
|
||||||
$('#select-year').val(selectedYear);
|
|
||||||
|
|
||||||
if (dbRanking[1].length > 0) {
|
if (dbRanking[1].length > 0) {
|
||||||
$('#card-noresults').show();
|
$('#card-noresults').show();
|
||||||
list = '';
|
list = '';
|
||||||
@@ -269,18 +386,18 @@ var siteScript = async function() {
|
|||||||
} else {
|
} else {
|
||||||
$('#card-noresults').hide();
|
$('#card-noresults').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
var count = ranking.length;
|
var count = ranking.length;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
$('#input-search').parent().show();
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
var dsvEnd = false;
|
var dsvEnd = false;
|
||||||
|
|
||||||
rows = [];
|
rows = [];
|
||||||
|
|
||||||
for (id in ranking) {
|
for (id in ranking) {
|
||||||
var entry = ranking[id];
|
var entry = ranking[id];
|
||||||
|
|
||||||
for (var i in entry.regattas) {
|
for (var i in entry.regattas) {
|
||||||
entry.regattas[i].regatta = await dbGetData('regattas', entry.regattas[i].regatta);
|
entry.regattas[i].regatta = await dbGetData('regattas', entry.regattas[i].regatta);
|
||||||
}
|
}
|
||||||
@@ -288,26 +405,26 @@ var siteScript = async function() {
|
|||||||
entry.regattas.sort(function (a,b) {
|
entry.regattas.sort(function (a,b) {
|
||||||
return a.regatta.date.localeCompare(b.regatta.date);
|
return a.regatta.date.localeCompare(b.regatta.date);
|
||||||
});
|
});
|
||||||
|
|
||||||
var club = null;
|
var club = null;
|
||||||
if (entry['club'] != null)
|
if (entry['club'] != null)
|
||||||
club = await dbGetData('clubs', entry['club']);
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
|
||||||
var row = { keywords: [], content: '' };
|
var row = { keywords: [], content: '' };
|
||||||
row.keywords.push(entry['name']);
|
row.keywords.push(entry['name']);
|
||||||
if (entry['year'] != null) row.keywords.push(entry['year']);
|
if (entry['year'] != null) row.keywords.push(entry['year']);
|
||||||
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
if (!dsvEnd && (entry.m < 9)) {
|
if (!dsvEnd && (entry.m < altm)) {
|
||||||
rows.push(null);
|
rows.push(null);
|
||||||
dsvEnd = true;
|
dsvEnd = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
row.content += '<div onclick="onRankingClicked(' + entry['id'] + ');">';
|
row.content += '<div onclick="onRankingClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
row.content += '<div>';
|
row.content += '<div>';
|
||||||
|
|
||||||
// Rank
|
// Rank
|
||||||
var icon = '';
|
var icon = '';
|
||||||
if (lastRanking != null) {
|
if (lastRanking != null) {
|
||||||
@@ -321,39 +438,39 @@ var siteScript = async function() {
|
|||||||
icon = '<i class="font-16 fas ' + icon + '" style="width: 1.1em; text-align: center;"></i> ';
|
icon = '<i class="font-16 fas ' + icon + '" style="width: 1.1em; text-align: center;"></i> ';
|
||||||
}
|
}
|
||||||
row.content += '<div>' + icon + '<b>' + entry.rank + '.</b></div>';
|
row.content += '<div>' + icon + '<b>' + entry.rank + '.</b></div>';
|
||||||
|
|
||||||
// m
|
// m
|
||||||
row.content += '<div>m = ' + entry.m + '</div>';
|
row.content += '<div>m = ' + entry.m + '</div>';
|
||||||
|
|
||||||
// rlp
|
// rlp
|
||||||
row.content += '<div>' + entry.rlp.toFixed(3) + '</div>';
|
row.content += '<div>' + entry.rlp.toFixed(3) + '</div>';
|
||||||
|
|
||||||
row.content += '</div>';
|
row.content += '</div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
row.content += '<div>';
|
row.content += '<div>';
|
||||||
|
|
||||||
// Name
|
// Name
|
||||||
row.content += '<div><b>' + entry.name + '</b></div>';
|
row.content += '<div><b>' + entry.name + '</b></div>';
|
||||||
|
|
||||||
// Year
|
// Year
|
||||||
row.content += '<div>' + ((entry.year != null) ? ('(' + entry.year + ')') : '') + '</div>';
|
row.content += '<div>' + ((entry.year != null) ? ('(' + entry.year + ')') : '') + '</div>';
|
||||||
|
|
||||||
row.content += '</div></div>';
|
row.content += '</div></div>';
|
||||||
|
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dsvEnd) {
|
if (!dsvEnd) {
|
||||||
rows.push(null);
|
rows.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#div-rank').html('Keine Ergebnisse gefunden!');
|
$('#div-rank').html('Keine Ergebnisse gefunden!');
|
||||||
$('#input-search').parent().hide();
|
$('#input-search').parent().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
258
server/scripts/regatta_facts.js
Normal file
258
server/scripts/regatta_facts.js
Normal file
@@ -0,0 +1,258 @@
|
|||||||
|
var siteScript = async function() {
|
||||||
|
$('#card-nofactsinfo').hide();
|
||||||
|
$('#card-entryfee').hide();
|
||||||
|
$('#card-races').hide();
|
||||||
|
$('#card-races').find('p').remove();
|
||||||
|
$('#card-races').find('table').remove();
|
||||||
|
$('#card-times').hide();
|
||||||
|
$('#card-camping').hide();
|
||||||
|
$('#card-food').hide();
|
||||||
|
$('#card-text').hide();
|
||||||
|
|
||||||
|
var regattaId = findGetParameter('regatta');
|
||||||
|
if (regattaId == null) {
|
||||||
|
$('#h1-title').text('Regatta nicht gefunden');
|
||||||
|
hideLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var regatta = await dbGetData('regattas', regattaId);
|
||||||
|
if (regatta == null) {
|
||||||
|
$('#h1-title').text('Regatta nicht gefunden');
|
||||||
|
hideLoader();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var dateFrom = parseDate(regatta['date']);
|
||||||
|
var dateTo = parseDate(regatta['date']);
|
||||||
|
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
||||||
|
|
||||||
|
$('#h1-title').text(regatta.name);
|
||||||
|
if (regatta.length < 1) {
|
||||||
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
|
$('#p-title').html('<font class="color-red2-dark">Datum noch unklar</font>');
|
||||||
|
} else {
|
||||||
|
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - <font class="color-red2-dark">Datum nicht final</font>');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (regatta.facts != null) {
|
||||||
|
var facts = JSON.parse(regatta.facts);
|
||||||
|
|
||||||
|
// Meldegeld
|
||||||
|
if ('entry' in facts && 'price' in facts.entry) {
|
||||||
|
$('#card-entryfee').show();
|
||||||
|
var content = 'Meldegeld: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.price)) + '</b>';
|
||||||
|
if ('early' in facts.entry) {
|
||||||
|
content += '<br />vergünstigt: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.early)) + '</b> (bis ' + formatDate('d.m.Y', parseDate(regatta.meldungEarly)) + ')';
|
||||||
|
}
|
||||||
|
if ('late' in facts.entry) {
|
||||||
|
content += '<br />nach Meldeschluss (' + formatDate('d.m.Y', parseDate(regatta.meldungSchluss)) + '): <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.entry.late)) + '</b>';
|
||||||
|
}
|
||||||
|
$('#card-entryfee').find('p').html(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wettfahrten / Anzahl
|
||||||
|
if ('races' in facts && 'cnt' in facts.races) {
|
||||||
|
$('#card-races').show();
|
||||||
|
$('#card-races').find('.content').append('<p>Anzahl Wettfahrten: <b>' + facts.races.cnt + '</b></p>');
|
||||||
|
if ('days' in facts.races) {
|
||||||
|
var table = $('<table class="table table-striped table-bordered text-nowrap">');
|
||||||
|
var tbody = $('<tbody>');
|
||||||
|
for (var day in facts.races.days) {
|
||||||
|
var cnt = facts.races.days[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td><b>' + cnt + '</b></td></tr>')
|
||||||
|
}
|
||||||
|
table.append(tbody);
|
||||||
|
$('#card-races').find('.content').append(table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wettfahrten / Racetimes
|
||||||
|
if ('racetimes' in facts) {
|
||||||
|
$('#card-races').show();
|
||||||
|
var table = $('<table class="table table-striped table-bordered mb-0 text-nowrap">');
|
||||||
|
var tbody = $('<tbody>');
|
||||||
|
if ('sollzeit' in facts.racetimes) {
|
||||||
|
tbody.append('<tr><td>Sollzeit</td><td>' + facts.racetimes.sollzeit + ' min</td></tr>');
|
||||||
|
}
|
||||||
|
if ('zeitlimit' in facts.racetimes) {
|
||||||
|
tbody.append('<tr><td>Zeitlimit</td><td>' + facts.racetimes.zeitlimit + ' min</td></tr>');
|
||||||
|
}
|
||||||
|
if ('zielzeitfenster' in facts.racetimes) {
|
||||||
|
tbody.append('<tr><td>Zielzeitfenster</td><td>' + facts.racetimes.zielzeitfenster + ' min</td></tr>');
|
||||||
|
}
|
||||||
|
table.append(tbody);
|
||||||
|
$('#card-races').find('.content').append(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Zeitplan
|
||||||
|
if ('times' in facts) {
|
||||||
|
$('#card-times').show();
|
||||||
|
var tbody = $('#card-times').find('table').find('tbody');
|
||||||
|
tbody.html('');
|
||||||
|
if ('checkin' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Registrierung</td></tr>');
|
||||||
|
for (var day in facts.times.checkin) {
|
||||||
|
var times = facts.times.checkin[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
var content = '';
|
||||||
|
if ('from' in times && 'to' in times) content = times.from + ' bis ' + times.to; // TODO:
|
||||||
|
else if ('from' in times) content = 'ab ' + times.from;
|
||||||
|
else if ('to' in times) content = 'bis ' + times.to;
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + content + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('measurements' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Vermessung</td></tr>');
|
||||||
|
for (var day in facts.times.measurements) {
|
||||||
|
var times = facts.times.measurements[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
var content = '';
|
||||||
|
if ('from' in times && 'to' in times) content = times.from + ' bis ' + times.to; // TODO:
|
||||||
|
else if ('from' in times) content = 'ab ' + times.from;
|
||||||
|
else if ('to' in times) content = 'bis ' + times.to;
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + content + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('helmmeeting' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Steuerleutebesprechung</td></tr>');
|
||||||
|
for (var day in facts.times.helmmeeting) {
|
||||||
|
var time = facts.times.helmmeeting[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('firststart' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Erster Start</td></tr>');
|
||||||
|
for (var day in facts.times.firststart) {
|
||||||
|
var time = facts.times.firststart[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ('laststart' in facts.times) {
|
||||||
|
tbody.append('<tr><td colspan="2" style="text-align: center; font-weight: bold;">Letzter Start</td></tr>');
|
||||||
|
for (var day in facts.times.laststart) {
|
||||||
|
var time = facts.times.laststart[day];
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
tbody.append('<tr><td>' + day + '</td><td>' + time + '</td></tr>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Camping
|
||||||
|
if ('camping' in facts) {
|
||||||
|
$('#card-camping').show();
|
||||||
|
$('#card-camping').find('p').remove();
|
||||||
|
if ('tent' in facts.camping) {
|
||||||
|
var content = '';
|
||||||
|
if ('price' in facts.camping.tent && facts.camping.tent.price > 0) {
|
||||||
|
content += 'Zelten möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.price)) + '</b>';
|
||||||
|
}
|
||||||
|
else if ('pricepernight' in facts.camping.tent) {
|
||||||
|
content += 'Zelten möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.pricepernight)) + ' pro Nacht</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Zelten möglich und im Preis enthalten';
|
||||||
|
}
|
||||||
|
if ('electricity' in facts.camping.tent) {
|
||||||
|
content += '<br />';
|
||||||
|
if (facts.camping.tent.electricity > 0) {
|
||||||
|
content += 'Strom: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.tent.electricity)) + '</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Strom inklusive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
if ('van' in facts.camping) {
|
||||||
|
var content = '';
|
||||||
|
if ('price' in facts.camping.van && facts.camping.van.price > 0) {
|
||||||
|
content += 'Wohnwagen/-mobil möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.price)) + '</b>';
|
||||||
|
}
|
||||||
|
else if ('pricepernight' in facts.camping.van) {
|
||||||
|
content += 'Wohnwagen/-mobil möglich für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.pricepernight)) + ' pro Nacht</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Wohnwagen/-mobil möglich und im Preis enthalten';
|
||||||
|
}
|
||||||
|
if ('electricity' in facts.camping.van) {
|
||||||
|
content += '<br />';
|
||||||
|
if (facts.camping.van.electricity > 0) {
|
||||||
|
content += 'Strom: <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.van.electricity)) + '</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Strom inklusive';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
if ('beds' in facts.camping) {
|
||||||
|
var content = '';
|
||||||
|
if ('price' in facts.camping.beds && facts.camping.beds.price > 0) {
|
||||||
|
content += 'Betten im Clubhaus vorhanden für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.beds.price)) + '</b>';
|
||||||
|
}
|
||||||
|
else if ('pricepernight' in facts.camping.beds) {
|
||||||
|
content += 'Betten im Clubhaus vorhanden für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(facts.camping.beds.pricepernight)) + ' pro Nacht</b>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content += 'Betten im Clubhaus vorhanden und im Preis enthalten';
|
||||||
|
}
|
||||||
|
$('#card-camping').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
if ('text' in facts.camping) {
|
||||||
|
var p = $('<p>');
|
||||||
|
p.text(facts.camping.text);
|
||||||
|
p.html(p.html().replace(/\n/g, '<br />'));
|
||||||
|
$('#card-camping').find('.content').append(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verpflegung
|
||||||
|
if ('food' in facts) {
|
||||||
|
$('#card-food').show();
|
||||||
|
$('#card-food').find('p').remove();
|
||||||
|
for (var day in facts.food) {
|
||||||
|
var food = facts.food[day];
|
||||||
|
if (day == 'text') {
|
||||||
|
var p = $('<p>');
|
||||||
|
p.text(food);
|
||||||
|
p.html(p.html().replace(/\n/g, '<br />'));
|
||||||
|
$('#card-food').find('.content').append(p);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
day = formatDate('D, j.', parseDate(day));
|
||||||
|
var content = '';
|
||||||
|
if ('breakfast' in food) {
|
||||||
|
content += 'Frühstück am ' + day;
|
||||||
|
if (food.breakfast > 0) content += ' für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(food.breakfast)) + '</b><br />';
|
||||||
|
else content += ' inklusive<br />';
|
||||||
|
}
|
||||||
|
if ('dinner' in food) {
|
||||||
|
content += 'Abendessen';
|
||||||
|
if ('dinnerdesc' in food) content += ' (' + food.dinnerdesc + ')';
|
||||||
|
content += ' am ' + day;
|
||||||
|
if (food.dinner > 0) content += ' für <b>' + (new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(food.dinner)) + '</b><br />';
|
||||||
|
else content += ' inklusive<br />';
|
||||||
|
}
|
||||||
|
$('#card-food').find('.content').append('<p>' + content + '</p>');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weitere Informationen
|
||||||
|
if ('text' in facts) {
|
||||||
|
$('#card-text').show();
|
||||||
|
var p = $('#card-text').find('p');
|
||||||
|
p.text(facts.text);
|
||||||
|
p.html(p.html().replace(/\n/g, '<br />'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#card-nofactsinfo').show();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@ var siteScript = async function() {
|
|||||||
var dateFrom = parseDate(regatta['date']);
|
var dateFrom = parseDate(regatta['date']);
|
||||||
var dateTo = parseDate(regatta['date']);
|
var dateTo = parseDate(regatta['date']);
|
||||||
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
dateTo.setDate(dateTo.getDate() + Math.max(parseInt(regatta['length']) - 1, 0));
|
||||||
|
|
||||||
$('#h1-title').text(regatta.name);
|
$('#h1-title').text(regatta.name);
|
||||||
if (regatta.length < 1) {
|
if (regatta.length < 1) {
|
||||||
if (formatDate('d.m', dateFrom) == '01.01') {
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
@@ -25,7 +25,7 @@ var siteScript = async function() {
|
|||||||
} else {
|
} else {
|
||||||
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo));
|
$('#p-title').html(formatDate('d.m.Y', dateFrom) + ' - ' + formatDate('d.m.Y', dateTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta.id);
|
var plannings = await dbGetDataIndex('plannings', 'regatta', regatta.id);
|
||||||
if (plannings.length > 0) {
|
if (plannings.length > 0) {
|
||||||
$('#table-plannings').show();
|
$('#table-plannings').show();
|
||||||
@@ -33,17 +33,23 @@ var siteScript = async function() {
|
|||||||
var tbody = '';
|
var tbody = '';
|
||||||
for (var p in plannings) {
|
for (var p in plannings) {
|
||||||
var planning = plannings[p];
|
var planning = plannings[p];
|
||||||
|
|
||||||
tbody += '<tr>';
|
tbody += '<tr>';
|
||||||
|
|
||||||
tbody += '<td>' + (await dbGetData('users', planning.user)).username + '</td>';
|
tbody += '<td>' + (await dbGetData('users', planning.user)).username + '</td>';
|
||||||
|
|
||||||
|
if (planning.boat != null) {
|
||||||
|
tbody += '<td>' + (await dbGetData('boats', planning.boat)).sailnumber + '</td>';
|
||||||
|
} else {
|
||||||
|
tbody += '<td>(noch unklar)</td>';
|
||||||
|
}
|
||||||
|
|
||||||
if (planning.steuermann != null) {
|
if (planning.steuermann != null) {
|
||||||
tbody += '<td>' + (await dbGetData('sailors', planning.steuermann)).name + '</td>';
|
tbody += '<td>' + (await dbGetData('sailors', planning.steuermann)).name + '</td>';
|
||||||
} else {
|
} else {
|
||||||
tbody += '<td>(noch unklar)</td>';
|
tbody += '<td>(noch unklar)</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var crew = [];
|
var crew = [];
|
||||||
var cr = planning.crew.split(',');
|
var cr = planning.crew.split(',');
|
||||||
for (c in cr) {
|
for (c in cr) {
|
||||||
@@ -51,7 +57,7 @@ var siteScript = async function() {
|
|||||||
if (s != null) crew.push(s.name);
|
if (s != null) crew.push(s.name);
|
||||||
}
|
}
|
||||||
tbody += '<td>' + crew.join('<br>') + '</td>';
|
tbody += '<td>' + crew.join('<br>') + '</td>';
|
||||||
|
|
||||||
tbody += '</tr>';
|
tbody += '</tr>';
|
||||||
}
|
}
|
||||||
$('#table-plannings').find('tbody').html(tbody);
|
$('#table-plannings').find('tbody').html(tbody);
|
||||||
@@ -60,6 +66,6 @@ var siteScript = async function() {
|
|||||||
$('#p-info').show();
|
$('#p-info').show();
|
||||||
$('#table-plannings').hide();
|
$('#table-plannings').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,61 @@
|
|||||||
|
Element.prototype.documentOffsetTop = function() {
|
||||||
|
return this.offsetTop + (this.offsetParent ? this.offsetParent.documentOffsetTop() : 0);
|
||||||
|
};
|
||||||
|
function scrollToToday() {
|
||||||
|
window.scrollTo({ top: document.getElementById('div-today').documentOffsetTop() - (window.innerHeight / 2), behavior: 'smooth' });
|
||||||
|
}
|
||||||
|
|
||||||
function selectChange(callSiteScript = true) {
|
function selectChange(callSiteScript = true) {
|
||||||
var val = $('#select-year').val();
|
var val = $('#select-year').val();
|
||||||
if (val == "user") {
|
if (val == "user") {
|
||||||
$('#input-from').parent().show();
|
$('#input-from').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#input-to').parent().show();
|
$('#input-to').trigger('focusin').trigger('focusout').parent().show();
|
||||||
$('#button-show').show();
|
$('#button-show').show();
|
||||||
} else {
|
} else {
|
||||||
$('#input-from').parent().hide();
|
$('#input-from').parent().hide();
|
||||||
$('#input-to').parent().hide();
|
$('#input-to').parent().hide();
|
||||||
$('#button-show').hide();
|
$('#button-show').hide();
|
||||||
|
|
||||||
$('#input-from').val(val + '-01-01');
|
$('#input-from').val(val + '-01-01');
|
||||||
$('#input-to').val(val + '-12-31');
|
$('#input-to').val(val + '-12-31');
|
||||||
|
|
||||||
if (callSiteScript && (typeof siteScript === 'function'))
|
if (callSiteScript && (typeof siteScript === 'function')) {
|
||||||
|
history.replaceState(null, '', '?year=' + val);
|
||||||
|
showLoader();
|
||||||
siteScript();
|
siteScript();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buttonShowPressed() {
|
||||||
|
if (typeof siteScript === 'function') {
|
||||||
|
history.replaceState(null, '', '?year=user&from=' + $('#input-from').val() + "&to=" + $('#input-to').val());
|
||||||
|
showLoader();
|
||||||
|
siteScript();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function initYear() {
|
function initYear() {
|
||||||
var year = findGetParameter('year');
|
return new Promise(async function (resolve) {
|
||||||
if (year === null) year = new Date().getFullYear();
|
var year = findGetParameter('year');
|
||||||
|
if (year === null) year = await dbGetCurrentYear();
|
||||||
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
|
||||||
$('#select-year').val(year);
|
$('#select-year').html('<option value="' + year + '">' + year + '</option>');
|
||||||
|
$('#select-year').val(year);
|
||||||
selectChange(false);
|
|
||||||
|
if (year == "user") {
|
||||||
|
var from = findGetParameter('from');
|
||||||
|
var to = findGetParameter('to');
|
||||||
|
if (from === null) from = formatDate('Y-m-d')
|
||||||
|
if (to === null) to = formatDate('Y-m-d')
|
||||||
|
$('#input-from').val(from).trigger('focusin').trigger('focusout');
|
||||||
|
$('#input-to').val(to).trigger('focusin').trigger('focusout');
|
||||||
|
}
|
||||||
|
|
||||||
|
selectChange(false);
|
||||||
|
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var firstCall = true;
|
var firstCall = true;
|
||||||
@@ -36,7 +67,7 @@ async function drawList () {
|
|||||||
var list = '';
|
var list = '';
|
||||||
rows.forEach(function (entry) {
|
rows.forEach(function (entry) {
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
list += '<div><div align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
list += '<div><div id="div-today" align="center" class="color-highlight"><b>Heute ist der ' + formatDate('d.m.Y', today) + '</b></div></div>';
|
||||||
} else if (search($('#input-search').val(), entry.keywords)) {
|
} else if (search($('#input-search').val(), entry.keywords)) {
|
||||||
list += entry.content;
|
list += entry.content;
|
||||||
}
|
}
|
||||||
@@ -48,26 +79,24 @@ async function drawList () {
|
|||||||
var siteScript = async function() {
|
var siteScript = async function() {
|
||||||
if (firstCall) {
|
if (firstCall) {
|
||||||
firstCall = false;
|
firstCall = false;
|
||||||
initYear();
|
await initYear();
|
||||||
$('#select-year').change(selectChange);
|
$('#select-year').change(selectChange);
|
||||||
$('#button-show').click(siteScript);
|
$('#button-show').click(buttonShowPressed);
|
||||||
$('#input-search').on('input', drawList);
|
$('#input-search').on('input', drawList);
|
||||||
|
$('#button-totoday').click(scrollToToday);
|
||||||
}
|
}
|
||||||
|
|
||||||
today = getToday();
|
today = getToday();
|
||||||
|
|
||||||
var minDate = parseDate($('#input-from').val());
|
var minDate = parseDate($('#input-from').val());
|
||||||
var maxDate = parseDate($('#input-to').val());
|
var maxDate = parseDate($('#input-to').val());
|
||||||
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
var regattas = await dbGetRegattasRange(minDate, maxDate);
|
||||||
var regattaResults = [];
|
|
||||||
for (id in regattas) {
|
if (minDate <= today && maxDate >= today) $('#button-totoday').parent().parent().show();
|
||||||
var entry = regattas[id];
|
else $('#button-totoday').parent().parent().hide();
|
||||||
var results = await dbGetDataIndex('results', 'regatta', entry['id']);
|
|
||||||
regattaResults[entry['id']] = (results.length > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var selectedYear = $('#select-year').val();
|
var selectedYear = $('#select-year').val();
|
||||||
|
|
||||||
var years = await dbGetData('years');
|
var years = await dbGetData('years');
|
||||||
years.sort(function (a, b) {
|
years.sort(function (a, b) {
|
||||||
if (a['year'] > b['year']) return -1;
|
if (a['year'] > b['year']) return -1;
|
||||||
@@ -81,7 +110,7 @@ var siteScript = async function() {
|
|||||||
}
|
}
|
||||||
$('#select-year').html(options);
|
$('#select-year').html(options);
|
||||||
$('#select-year').val(selectedYear);
|
$('#select-year').val(selectedYear);
|
||||||
|
|
||||||
var count = regattas.length;
|
var count = regattas.length;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
@@ -91,49 +120,82 @@ var siteScript = async function() {
|
|||||||
}
|
}
|
||||||
$('#div-regattas').show();
|
$('#div-regattas').show();
|
||||||
$('#input-search').parent().show();
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
var heute = false;
|
var heute = false;
|
||||||
|
|
||||||
rows = [];
|
rows = [];
|
||||||
|
var specialFields = await dbGetClassProp('special-fields');
|
||||||
|
if (specialFields === null) specialFields = {};
|
||||||
|
var specialShown = {};
|
||||||
|
|
||||||
for (id in regattas) {
|
for (id in regattas) {
|
||||||
var entry = regattas[id];
|
var entry = regattas[id];
|
||||||
var club = null;
|
var club = null;
|
||||||
if (entry['club'] != null)
|
if (entry['club'] != null)
|
||||||
club = await dbGetData('clubs', entry['club']);
|
club = await dbGetData('clubs', entry['club']);
|
||||||
var plannings = await dbGetDataIndex('plannings', 'regatta', entry['id']);
|
var plannings = await dbGetDataIndex('plannings', 'regatta', entry['id']);
|
||||||
|
|
||||||
var dateFrom = entry['dateFrom'];
|
var dateFrom = entry['dateFrom'];
|
||||||
var dateTo = entry['dateTo'];
|
var dateTo = entry['dateTo'];
|
||||||
|
|
||||||
var row = { keywords: [], content: '' };
|
var row = { keywords: [], content: '' };
|
||||||
row.keywords.push(entry['name']);
|
row.keywords.push(entry['name']);
|
||||||
if (entry['number'] != null) row.keywords.push(entry['number']);
|
if (entry['number'] != null) row.keywords.push(entry['number']);
|
||||||
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
if (!heute && (today <= dateFrom)) {
|
if (!heute && (today <= dateFrom)) {
|
||||||
rows.push(null);
|
rows.push(null);
|
||||||
heute = true;
|
heute = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
row.content += '<div onclick="onRegattaClicked(' + entry['id'] + ');">';
|
row.content += '<div onclick="onRegattaClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
// Name
|
// Name
|
||||||
row.content += '<div><b>' + (entry['canceled'] == 1 ? '<s>' : '') + entry['name'] + (entry['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
row.content += '<div><b>' + (entry['canceled'] == 1 ? '<s>' : '') + entry['name'] + (entry['canceled'] == 1 ? '</s>' : '') + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
row.content += '<div>';
|
row.content += '<div>';
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
row.content += '<div>' + ((entry['number'] != null) ? ('# ' + entry['number']) : '') + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
row.content += '<div>' + entry['special'] + '</div>';
|
if (entry.special.substr(0, 1) == '#') {
|
||||||
|
entry.special = entry.special.substr(1);
|
||||||
|
if (typeof specialFields[entry.special] !== 'undefined') {
|
||||||
|
specialShown[entry.special] = specialFields[entry.special];
|
||||||
|
entry.special = '* ' + entry.special;
|
||||||
|
} else {
|
||||||
|
entry.special = 'ERROR';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// replace placeholders
|
||||||
|
var pos;
|
||||||
|
while ((pos = entry.special.indexOf('$')) >= 0) {
|
||||||
|
var pos2 = entry.special.indexOf('$', pos + 1);
|
||||||
|
if (pos2 < 0) break;
|
||||||
|
var key = entry.special.substring(pos + 1, pos2);
|
||||||
|
|
||||||
|
var value = '';
|
||||||
|
// age class
|
||||||
|
if ((key.substr(0, 1) == 'U') && (!isNaN(value = parseInt(key.substr(1))))) {
|
||||||
|
var year = parseDate(entry.date).getFullYear();
|
||||||
|
year = year - value + 1;
|
||||||
|
var text = 'Jahrgänge ' + year + ' und jünger';
|
||||||
|
value = 'U-' + value;
|
||||||
|
specialShown[value] = text;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.special = entry.special.replace('$' + key + '$', value);
|
||||||
|
}
|
||||||
|
row.content += '<div>' + entry.special + '</div>';
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
var icons = [];
|
var icons = [];
|
||||||
if (entry['info'] != '')
|
if (entry['info'] != '')
|
||||||
@@ -160,8 +222,10 @@ var siteScript = async function() {
|
|||||||
ms = parseDate(entry['meldungSchluss']);
|
ms = parseDate(entry['meldungSchluss']);
|
||||||
}
|
}
|
||||||
var diff = Math.round((ms - today) / 86400000);
|
var diff = Math.round((ms - today) / 86400000);
|
||||||
if ((ms >= today) && (diff < 7)) {
|
if (ms < today) {
|
||||||
color = ' color-red2-dark';
|
color = ' color-red2-dark';
|
||||||
|
} else if (diff < 7) {
|
||||||
|
color = ' color-yellow2-dark';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,16 +238,16 @@ var siteScript = async function() {
|
|||||||
icons.push('<i class="fas fa-book"></i>');
|
icons.push('<i class="fas fa-book"></i>');
|
||||||
if (entry['canceled'] == '1') {
|
if (entry['canceled'] == '1') {
|
||||||
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
icons.push('<i class="fas fa-times color-red2-dark"></i>');
|
||||||
} else if (regattaResults[entry['id']]) {
|
} else if (entry['results'] == '1') {
|
||||||
icons.push('<i class="fas fa-poll"></i>');
|
icons.push('<i class="fas fa-poll"></i>');
|
||||||
}
|
}
|
||||||
row.content += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
row.content += '<div class="color-green2-dark">' + icons.join(' ') + '</div>';
|
||||||
|
|
||||||
row.content += '</div>';
|
row.content += '</div>';
|
||||||
|
|
||||||
// ZEILE 3
|
// ZEILE 3
|
||||||
row.content += '<div>';
|
row.content += '<div>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
if (entry['length'] < 1) {
|
if (entry['length'] < 1) {
|
||||||
if (formatDate('d.m', dateFrom) == '01.01') {
|
if (formatDate('d.m', dateFrom) == '01.01') {
|
||||||
@@ -194,26 +258,41 @@ var siteScript = async function() {
|
|||||||
} else {
|
} else {
|
||||||
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
row.content += '<div>' + formatDate("d.m.Y", dateFrom) + ' - ' + formatDate("d.m.Y", dateTo) + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// RLF
|
// RLF
|
||||||
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
row.content += '<div>' + parseFloat(entry['rlf']).toFixed(2) + '</div>';
|
||||||
|
|
||||||
row.content += '</div></div>';
|
row.content += '</div></div>';
|
||||||
|
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!heute) {
|
if (!heute) {
|
||||||
rows.push(null);
|
rows.push(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var specialKeys = Object.keys(specialShown);
|
||||||
|
if (specialKeys.length > 0) {
|
||||||
|
specialKeys.sort();
|
||||||
|
var specialText = '';
|
||||||
|
for (i in specialKeys) {
|
||||||
|
var key = specialKeys[i];
|
||||||
|
specialText += '* ' + key + ': ' + specialShown[key] + '<br>';
|
||||||
|
}
|
||||||
|
$('#card-special').find('p').html(specialText);
|
||||||
|
$('#card-special').show();
|
||||||
|
} else {
|
||||||
|
$('#card-special').hide();
|
||||||
|
}
|
||||||
|
|
||||||
drawList();
|
drawList();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#p-count').html('Keine Regatten gefunden!');
|
$('#p-count').html('Keine Regatten gefunden!');
|
||||||
$('#div-regattas').hide();
|
$('#div-regattas').hide();
|
||||||
$('#input-search').parent().hide();
|
$('#input-search').parent().hide();
|
||||||
|
$('#card-special').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,40 @@ var displayed = [];
|
|||||||
var page = 1;
|
var page = 1;
|
||||||
var pageCount = 0;
|
var pageCount = 0;
|
||||||
const showCount = 25;
|
const showCount = 25;
|
||||||
|
var followedSailors = [];
|
||||||
|
|
||||||
|
async function onFollowChange() {
|
||||||
|
var id = $('#menu-item-follow').attr('data-sailor-id');
|
||||||
|
showLoader();
|
||||||
|
$('#menu-sailor').hideMenu();
|
||||||
|
var auth = {
|
||||||
|
id: localStorage.getItem('auth_id'),
|
||||||
|
hash: localStorage.getItem('auth_hash')
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
url: QUERY_URL + ($('#menu-item-follow').prop('checked') ? 'sailor_follow' : 'sailor_unfollow'),
|
||||||
|
method: 'POST',
|
||||||
|
data: {
|
||||||
|
auth: auth,
|
||||||
|
sailor: id
|
||||||
|
},
|
||||||
|
error: function (xhr, status, error) {
|
||||||
|
if (xhr.status == 0) {
|
||||||
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um Deine Favoriten zu bearbeiten.');
|
||||||
|
} else {
|
||||||
|
log('Un/Follow: unbekannter Fehler', status, error);
|
||||||
|
log(xhr);
|
||||||
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
|
}
|
||||||
|
hideLoader();
|
||||||
|
},
|
||||||
|
success: async function (data, status, xhr) {
|
||||||
|
await sync();
|
||||||
|
toastOk('Erfolgreich');
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async function onEditYearClick() {
|
async function onEditYearClick() {
|
||||||
var id = $('#button-edityear').attr('data-sailor-id');
|
var id = $('#button-edityear').attr('data-sailor-id');
|
||||||
@@ -21,8 +55,8 @@ async function onEditYearClick() {
|
|||||||
if (xhr.status == 0) {
|
if (xhr.status == 0) {
|
||||||
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Jahrgang zu bearbeiten');
|
toastError('Du bist momentan offline.<br>Stelle eine Internetverbindung her, um den Jahrgang zu bearbeiten');
|
||||||
} else {
|
} else {
|
||||||
console.log('EditYear: unbekannter Fehler', status, error);
|
log('EditYear: unbekannter Fehler', status, error);
|
||||||
console.log(xhr);
|
log(xhr);
|
||||||
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
toastError('Ein unbekannter Fehler ist aufgetreten. Bitte versuche es noch einmal', 5000);
|
||||||
}
|
}
|
||||||
hideLoader();
|
hideLoader();
|
||||||
@@ -47,9 +81,29 @@ async function onEditYearClick() {
|
|||||||
|
|
||||||
async function onListClicked(id) {
|
async function onListClicked(id) {
|
||||||
var sailor = await dbGetData('sailors', id);
|
var sailor = await dbGetData('sailors', id);
|
||||||
|
|
||||||
$('#menu-sailor').find('.menu-title').find('p').text(sailor.name);
|
$('#menu-sailor').find('.menu-title').find('p').text(sailor.name);
|
||||||
|
|
||||||
|
// Follow
|
||||||
|
if (isLoggedIn()) {
|
||||||
|
var found = false;
|
||||||
|
for (var i in followedSailors) {
|
||||||
|
if (followedSailors[i].id == sailor.id) found = true;
|
||||||
|
}
|
||||||
|
if (found || (followedSailors.length < 5)) {
|
||||||
|
$('#menu-item-follow').attr('data-sailor-id', sailor.id);
|
||||||
|
$('#menu-item-follow').prop('checked', found);
|
||||||
|
$('#menu-item-follow').parent().parent().show();
|
||||||
|
$('#menu-item-follow-disabled').hide();
|
||||||
|
} else {
|
||||||
|
$('#menu-item-follow').parent().parent().hide();
|
||||||
|
$('#menu-item-follow-disabled').show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$('#menu-item-follow').parent().parent().hide();
|
||||||
|
$('#menu-item-follow-disabled').hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Edit Year
|
// Edit Year
|
||||||
$('#button-edityear').attr('data-sailor-id', sailor.id);
|
$('#button-edityear').attr('data-sailor-id', sailor.id);
|
||||||
$('#menu-edityear').find('.menu-title').find('p').text(sailor.name);
|
$('#menu-edityear').find('.menu-title').find('p').text(sailor.name);
|
||||||
@@ -63,7 +117,7 @@ async function onListClicked(id) {
|
|||||||
$('#input-edityear').val(sailor.year);
|
$('#input-edityear').val(sailor.year);
|
||||||
}
|
}
|
||||||
$('#input-edityear').trigger('focusin').trigger('focusout');
|
$('#input-edityear').trigger('focusin').trigger('focusout');
|
||||||
|
|
||||||
// club website
|
// club website
|
||||||
var clubwebsite = '';
|
var clubwebsite = '';
|
||||||
if (sailor['club'] != null) {
|
if (sailor['club'] != null) {
|
||||||
@@ -76,7 +130,7 @@ async function onListClicked(id) {
|
|||||||
} else {
|
} else {
|
||||||
$('#menu-item-clubwebsite').hide();
|
$('#menu-item-clubwebsite').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#menu-sailor').showMenu();
|
$('#menu-sailor').showMenu();
|
||||||
$('#menu-sailor').scrollTop(0);
|
$('#menu-sailor').scrollTop(0);
|
||||||
}
|
}
|
||||||
@@ -89,19 +143,19 @@ function pageChange() {
|
|||||||
async function drawList() {
|
async function drawList() {
|
||||||
window.setTimeout(function () {
|
window.setTimeout(function () {
|
||||||
var list = '';
|
var list = '';
|
||||||
|
|
||||||
if (displayed.length > 0) {
|
if (displayed.length > 0) {
|
||||||
var offset = (page - 1) * showCount;
|
var offset = (page - 1) * showCount;
|
||||||
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
||||||
if (count == 0) count = showCount;
|
if (count == 0) count = showCount;
|
||||||
|
|
||||||
for (i = 0; i < count; i ++) {
|
for (i = 0; i < count; i ++) {
|
||||||
list += displayed[i + offset];
|
list += displayed[i + offset];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#div-list').html(list);
|
$('#div-list').html(list);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
@@ -134,10 +188,23 @@ var siteScript = async function() {
|
|||||||
$('#input-search').on('input', reSearch);
|
$('#input-search').on('input', reSearch);
|
||||||
$('#menu-item-year').click(function(){ $('#menu-sailor').hideMenu(); $('#menu-edityear').showMenu(); });
|
$('#menu-item-year').click(function(){ $('#menu-sailor').hideMenu(); $('#menu-edityear').showMenu(); });
|
||||||
$('#button-edityear').click(onEditYearClick);
|
$('#button-edityear').click(onEditYearClick);
|
||||||
|
$('#menu-item-follow').parent().parent().click(onFollowChange);
|
||||||
|
$('#menu-item-follow-disabled').click(function(){ $('#menu-sailor').hideMenu(); toastInfo('Du kannst maximal 5 Seglern folgen. Entferne erst einen Segler aus Deinen Favoriten, bevor Du andere aufnimmst.', 5000); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isLoggedIn()) {
|
||||||
|
var user = await dbGetData('users', USER_ID);
|
||||||
|
followedSailors = [];
|
||||||
|
for (var i = 1; i <= 5; i ++) {
|
||||||
|
sailor_id = user['sailor' + i];
|
||||||
|
if (sailor_id != null) {
|
||||||
|
followedSailors.push(await dbGetData('sailors', sailor_id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var results = await dbGetData('sailors');
|
var results = await dbGetData('sailors');
|
||||||
|
|
||||||
var count = results.length;
|
var count = results.length;
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
@@ -147,51 +214,51 @@ var siteScript = async function() {
|
|||||||
}
|
}
|
||||||
$('#div-list').show();
|
$('#div-list').show();
|
||||||
$('#input-search').parent().show();
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
results.sort(function (a, b) {
|
results.sort(function (a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
rows = [];
|
rows = [];
|
||||||
|
|
||||||
for (id in results) {
|
for (id in results) {
|
||||||
var entry = results[id];
|
var entry = results[id];
|
||||||
var club = null;
|
var club = null;
|
||||||
if (entry['club'] != null)
|
if (entry['club'] != null)
|
||||||
club = await dbGetData('clubs', entry['club']);
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
|
||||||
var row = { keywords: [], content: '' };
|
var row = { keywords: [], content: '' };
|
||||||
row.keywords.push(entry['name']);
|
row.keywords.push(entry['name']);
|
||||||
if (entry['year'] != null) row.keywords.push(entry['year']);
|
if (entry['year'] != null) row.keywords.push(entry['year']);
|
||||||
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
// ZEILE 1
|
// ZEILE 1
|
||||||
// Name
|
// Name
|
||||||
row.content += '<div><b>' + entry['name'] + '</b></div>';
|
row.content += '<div><b>' + entry['name'] + '</b></div>';
|
||||||
|
|
||||||
// ZEILE 2
|
// ZEILE 2
|
||||||
row.content += '<div>';
|
row.content += '<div>';
|
||||||
|
|
||||||
// Year
|
// Year
|
||||||
row.content += '<div>' + ((entry['year'] != null) ? (entry['year']) : '') + '</div>';
|
row.content += '<div>' + ((entry['year'] != null) ? (entry['year']) : '') + '</div>';
|
||||||
|
|
||||||
// Club
|
// Club
|
||||||
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
row.content += '</div></div>';
|
row.content += '</div></div>';
|
||||||
|
|
||||||
rows.push(row);
|
rows.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
reSearch();
|
reSearch();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$('#p-count').html('Keine Segler gefunden!');
|
$('#p-count').html('Keine Segler gefunden!');
|
||||||
$('#div-list').hide();
|
$('#div-list').hide();
|
||||||
$('#input-search').parent().hide();
|
$('#input-search').parent().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
hideLoader();
|
hideLoader();
|
||||||
}
|
}
|
||||||
|
|||||||
8
server/templates/menu/item-switch.html
Normal file
8
server/templates/menu/item-switch.html
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<a href="#" data-trigger-switch="$$html-id;" class="pb-2 $$css-class;">
|
||||||
|
<i class="fa font-14 $$icon; rounded-s bg-highlight color-white"></i>
|
||||||
|
<span>$$0;</span>
|
||||||
|
<div class="custom-control scale-switch ios-switch">
|
||||||
|
<input type="checkbox" class="ios-input" id="$$html-id;">
|
||||||
|
<label class="custom-control-label" for="$$html-id;"></label>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<nav id="$$html-id;">
|
<nav id="$$html-id;" class="$$css-class;">
|
||||||
<ul class="pagination justify-content-center">
|
<ul class="pagination justify-content-center">
|
||||||
<li id="$$html-id;-1" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">1</a></li>
|
<li id="$$html-id;-1" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">1</a></li>
|
||||||
<li id="$$html-id;-2" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">2</a></li>
|
<li id="$$html-id;-2" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">2</a></li>
|
||||||
@@ -8,4 +8,4 @@
|
|||||||
<li id="$$html-id;-6" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">6</a></li>
|
<li id="$$html-id;-6" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">6</a></li>
|
||||||
<li id="$$html-id;-7" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">7</a></li>
|
<li id="$$html-id;-7" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">7</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.6');
|
define('PWA_VERSION', '1.11.8');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
header('Content-Type: text/javascript');
|
header('Content-Type: text/javascript');
|
||||||
|
|
||||||
require_once(__DIR__ . '/server/config.php');
|
require_once(__DIR__ . '/server/config.php');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');
|
importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ workbox.precaching.precacheAndRoute([
|
|||||||
return $hash;
|
return $hash;
|
||||||
}
|
}
|
||||||
$hash = md5(getDirHash(__DIR__));
|
$hash = md5(getDirHash(__DIR__));
|
||||||
|
|
||||||
$path = __DIR__ . '/server/content/';
|
$path = __DIR__ . '/server/content/';
|
||||||
$dir = opendir($path);
|
$dir = opendir($path);
|
||||||
while ($file = readdir($dir)) {
|
while ($file = readdir($dir)) {
|
||||||
@@ -50,21 +50,25 @@ workbox.precaching.precacheAndRoute([
|
|||||||
echo "\t{url: '$file', revision: '$hash'},\n";
|
echo "\t{url: '$file', revision: '$hash'},\n";
|
||||||
}
|
}
|
||||||
closedir($dir);
|
closedir($dir);
|
||||||
|
|
||||||
// ASSETS
|
// ASSETS
|
||||||
$filesToCache = [
|
$filesToCache = [
|
||||||
'/manifest.json.php',
|
'/manifest.json.php',
|
||||||
];
|
];
|
||||||
$dirsToCache = [
|
$dirsToCache = [
|
||||||
'/client',
|
'/client/app',
|
||||||
|
'/client/fonts/css',
|
||||||
|
'/client/fonts/webfonts',
|
||||||
|
'/client/images',
|
||||||
|
'/client/scripts',
|
||||||
|
'/client/styles',
|
||||||
];
|
];
|
||||||
|
|
||||||
function addDir($path) {
|
function addDir($path) {
|
||||||
global $filesToCache;
|
global $filesToCache;
|
||||||
if ($dir = opendir(__DIR__ . $path)) {
|
if ($dir = opendir(__DIR__ . $path)) {
|
||||||
while (($file = readdir($dir)) !== false) {
|
while (($file = readdir($dir)) !== false) {
|
||||||
if ($file == '.') continue;
|
if (substr($file, 0, 1) == '.') continue;
|
||||||
if ($file == '..') continue;
|
|
||||||
if (is_dir(__DIR__ . $path . '/' . $file)) {
|
if (is_dir(__DIR__ . $path . '/' . $file)) {
|
||||||
addDir($path . '/' . $file);
|
addDir($path . '/' . $file);
|
||||||
} else {
|
} else {
|
||||||
@@ -74,11 +78,11 @@ workbox.precaching.precacheAndRoute([
|
|||||||
closedir($dir);
|
closedir($dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($dirsToCache as $path) {
|
foreach ($dirsToCache as $path) {
|
||||||
addDir($path);
|
addDir($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($filesToCache as $file) {
|
foreach ($filesToCache as $file) {
|
||||||
$revision = md5_file(__DIR__ . $file);
|
$revision = md5_file(__DIR__ . $file);
|
||||||
$file = SERVER_ADDR . $file;
|
$file = SERVER_ADDR . $file;
|
||||||
@@ -109,30 +113,41 @@ workbox.routing.registerRoute(
|
|||||||
|
|
||||||
// DB
|
// DB
|
||||||
|
|
||||||
var db = null;
|
function openDb() {
|
||||||
if (indexedDB) {
|
return new Promise(function(resolve) {
|
||||||
var request = indexedDB.open('regatten_app_db_<?php echo BOATCLASS; ?>');
|
if (indexedDB) {
|
||||||
request.onerror = function (e) {
|
var request = indexedDB.open('regatten_app_db_<?php echo BOATCLASS; ?>');
|
||||||
console.log('[sW] Cannot open DB:', e.target.errorCode);
|
request.onerror = function (e) {
|
||||||
};
|
console.log('[sW] Cannot open DB:', e.targer.errorCode);
|
||||||
request.onupgradeneeded = function (e) {
|
resolve(null);
|
||||||
console.log('[sW] DB does not exist');
|
};
|
||||||
e.target.transaction.abort();
|
request.onupgradeneeded = function (e) {
|
||||||
};
|
console.log('[sW] DB does not exist');
|
||||||
request.onsuccess = function (e) {
|
e.target.transaction.abort();
|
||||||
console.log('[sW] DB loaded');
|
resolve(null);
|
||||||
db = e.target.result;
|
};
|
||||||
db.onerror = function (e) {
|
request.onsuccess = function (e) {
|
||||||
console.log('[sW] DB Error:', e)
|
console.log('[sW] DB loaded');
|
||||||
|
var db = e.target.result;
|
||||||
|
db.onerror = function (e) {
|
||||||
|
console.log('[sW] DB Error:', e);
|
||||||
|
};
|
||||||
|
resolve(db);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resolve(null);
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbSettingsGet(key) {
|
function dbSettingsGet(key) {
|
||||||
return new Promise(function(resolve) {
|
return new Promise(async function(resolve) {
|
||||||
if (db != null) {
|
var db = await openDb();
|
||||||
|
if (db !== null) {
|
||||||
var request = db.transaction('settings').objectStore('settings').get(key);
|
var request = db.transaction('settings').objectStore('settings').get(key);
|
||||||
request.onsuccess = function (event) {
|
request.onsuccess = function (event) {
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
resolve(typeof request.result != 'undefined' ? request.result.value : null);
|
resolve(typeof request.result != 'undefined' ? request.result.value : null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -141,10 +156,20 @@ function dbSettingsGet(key) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbSettingsSet(key, value) {
|
async function dbSettingsSet(key, value) {
|
||||||
|
var db = await openDb();
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
var os = db.transaction('settings', 'readwrite').objectStore('settings');
|
var os = db.transaction('settings', 'readwrite').objectStore('settings');
|
||||||
os.put({ key: key, value: value});
|
var request = os.put({ key: key, value: value});
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('[sW] Error while saving data to DB:', e);
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -157,9 +182,9 @@ function getEntry(data, index, defaultValue) {
|
|||||||
return ((typeof data[index] !== "undefined") ? data[index] : defaultValue);
|
return ((typeof data[index] !== "undefined") ? data[index] : defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMyRegatta(id) {
|
function isMyRegatta(id, suffix = '') {
|
||||||
return new Promise(async function (resolve) {
|
return new Promise(async function (resolve) {
|
||||||
var regattas = await dbSettingsGet('myregattas_<?php echo BOATCLASS; ?>');
|
var regattas = await dbSettingsGet('myregattas_<?php echo BOATCLASS; ?>' + suffix);
|
||||||
if (regattas == null) resolve(false);
|
if (regattas == null) resolve(false);
|
||||||
else resolve(regattas.includes(id.toString()));
|
else resolve(regattas.includes(id.toString()));
|
||||||
});
|
});
|
||||||
@@ -167,7 +192,7 @@ function isMyRegatta(id) {
|
|||||||
|
|
||||||
self.addEventListener('push', async function(event) {
|
self.addEventListener('push', async function(event) {
|
||||||
console.log('[sW] Push received:', event.data.text());
|
console.log('[sW] Push received:', event.data.text());
|
||||||
|
|
||||||
var data;
|
var data;
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(event.data.text());
|
data = JSON.parse(event.data.text());
|
||||||
@@ -175,14 +200,14 @@ self.addEventListener('push', async function(event) {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
data = undefined;
|
data = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof data.type !== "undefined") {
|
if (typeof data.type !== "undefined") {
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case 'notification':
|
case 'notification':
|
||||||
if (typeof data.title === "undefined") break;
|
if (typeof data.title === "undefined") break;
|
||||||
if (typeof data.body === "undefined") break;
|
if (typeof data.body === "undefined") break;
|
||||||
if (typeof data.channel === "undefined") break;
|
if (typeof data.channel === "undefined") break;
|
||||||
|
|
||||||
// check channel
|
// check channel
|
||||||
var okay = false;
|
var okay = false;
|
||||||
switch (data.channel) {
|
switch (data.channel) {
|
||||||
@@ -203,48 +228,98 @@ self.addEventListener('push', async function(event) {
|
|||||||
break;
|
break;
|
||||||
case 'meldeschluss':
|
case 'meldeschluss':
|
||||||
if (await dbSettingsGet('notify_channel_<?php echo BOATCLASS; ?>_meldeschluss')) {
|
if (await dbSettingsGet('notify_channel_<?php echo BOATCLASS; ?>_meldeschluss')) {
|
||||||
if (await isMyRegatta(getEntry(data, 'id', ''))) okay = true;
|
if (await isMyRegatta(getEntry(data, 'id', ''), '_meldung_off')) okay = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unknown channel:', data.channel);
|
console.log('[sW] Unknown channel:', data.channel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!okay) {
|
if (!okay) {
|
||||||
console.log('Notification channel not subscribed');
|
console.log('[sW] Notification channel not subscribed');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
data: data,
|
data: data,
|
||||||
body: data.body,
|
body: data.body,
|
||||||
icon: getEntry(data, 'icon', '<?php echo SERVER_ADDR; ?>/client/app/icons/icon-512x512.png'),
|
icon: getEntry(data, 'icon', '<?php echo SERVER_ADDR; ?>/client/app/icons/icon-512x512.png'),
|
||||||
badge: '<?php echo SERVER_ADDR; ?>/client/app/icons/icon-96x96.png',
|
badge: '<?php echo SERVER_ADDR; ?>/client/app/icons/badge-128x128.png',
|
||||||
vibrate: [500,100,500]
|
vibrate: [500,100,500]
|
||||||
};
|
};
|
||||||
if ((image = getEntry(data, 'image', null)) !== null) {
|
if ((image = getEntry(data, 'image', null)) !== null) {
|
||||||
options.image = image;
|
options.image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force refresh on next app open
|
// Force refresh on next app open
|
||||||
var os = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
var db = await openDb();
|
||||||
os.put({ table: 'last_sync', time: 0 });
|
if (db != null) {
|
||||||
|
var os = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
console.log('Showing notification');
|
var request = os.put({ table: 'last_sync', time: 1 });
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('[sW] Error while saving data to DB:', e);
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('[sW] Showing notification');
|
||||||
self.registration.showNotification(data.title, options);
|
self.registration.showNotification(data.title, options);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'forcesync':
|
||||||
|
// Force refresh on next app open
|
||||||
|
var db = await openDb();
|
||||||
|
if (db != null) {
|
||||||
|
var os = db.transaction('update_times', 'readwrite').objectStore('update_times');
|
||||||
|
var request = os.put({ table: 'last_sync', time: 1 });
|
||||||
|
request.onerror = function (event) {
|
||||||
|
console.log('[sW] Error while saving data to DB:', e);
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
request.onsuccess = function (event) {
|
||||||
|
console.log('[sW] Data successfully saved');
|
||||||
|
db.close();
|
||||||
|
console.log('[sW] DB closed');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
console.log('[sW] Push type unknown:', data.type);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log('[sW] No push type given!');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.addEventListener('notificationclick', function(event) {
|
self.addEventListener('notificationclick', function(event) {
|
||||||
var data = event.notification.data;
|
var data = event.notification.data;
|
||||||
|
|
||||||
event.notification.close();
|
event.notification.close();
|
||||||
|
|
||||||
var url = '<?php echo SERVER_ADDR; ?>' + getEntry(data, 'url', '');
|
var url = '<?php echo SERVER_ADDR; ?>' + getEntry(data, 'url', '');
|
||||||
|
|
||||||
event.waitUntil(
|
event.waitUntil(
|
||||||
clients.openWindow(url)
|
clients.openWindow(url)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self.addEventListener('pushsubscriptionchange', function(event) {
|
||||||
|
var formData = new URLSearchParams();
|
||||||
|
formData.append('old', JSON.stringify(event.oldSubscription));
|
||||||
|
formData.append('new', JSON.stringify(event.newSubscription));
|
||||||
|
event.waitUntil(
|
||||||
|
fetch('<?php echo QUERY_URL; ?>update_subscription', {
|
||||||
|
method: 'POST',
|
||||||
|
cache: 'no-cache',
|
||||||
|
body: formData
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user