Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
641210e7f4 | ||
|
|
c660fed9f0 |
@@ -43,6 +43,35 @@
|
|||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*** NORMAL LIST ***/
|
||||||
|
.normal-list > div {
|
||||||
|
padding-top: 1rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
border-bottom: 1px solid #dee2e6;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal-list > div:last-child {
|
||||||
|
border: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal-list div {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal-list > div > div > div {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.normal-list > div > div:nth-child(2) > div:nth-child(1) {
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
.normal-list > div > div:nth-child(2) > div:nth-child(2) {
|
||||||
|
width: 50%;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
/*** BLINKING ICONS ***/
|
/*** BLINKING ICONS ***/
|
||||||
@keyframes fa-blink {
|
@keyframes fa-blink {
|
||||||
0% { opacity: 1; }
|
0% { opacity: 1; }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Fehler 404 - Regatten.net Pirat';
|
$sp['title'] = 'Fehler 404 - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = true;
|
$sp['backbutton'] = true;
|
||||||
|
|
||||||
$content = $tpl->load('error', ['404', 'Seite nicht gefunden']);
|
$content = $tpl->load('error', ['404', 'Seite nicht gefunden']);
|
||||||
|
|||||||
42
server/content/boats.php
Normal file
42
server/content/boats.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sp['title'] = 'Boote - Regatten.net ' . $_CLASS['name'];
|
||||||
|
$sp['backbutton'] = 'index';
|
||||||
|
$sp['activenav'] = 4;
|
||||||
|
|
||||||
|
// Title
|
||||||
|
$content = "<h1>Boote</h1>";
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// Info Years
|
||||||
|
$content = '<h2>Bootsnamen</h2>';
|
||||||
|
$content .= '<p>';
|
||||||
|
$content .= 'Genauso wie bei den Jahrgängen der Segler fehlen uns auch viele Bootsnamen.<br>';
|
||||||
|
$content .= 'Kennst Du ein Boot, dessen Name hier noch nicht hinterlegt ist oder das vielleicht umgetauft wurde, <b>hilf uns bitte</b>, indem Du den Namen einträgst!<br>';
|
||||||
|
$content .= 'Klicke dazu einfach auf das entsprechende Boot und wähle Bootsnamen bearbeiten aus.<br>';
|
||||||
|
$content .= 'Vielen Dank für Deine Unterstützung!';
|
||||||
|
$content .= '</p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// List
|
||||||
|
$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-list" class="normal-list mb-0"></div>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']);
|
||||||
|
|
||||||
|
// Pagination
|
||||||
|
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
// TODO: add entries for jump2rank jump2club
|
||||||
|
$items = $tpl->load('menu/item-icon', ['', '#', 'html-id' => 'menu-item-boatname', 'icon' => 'fa-edit']);
|
||||||
|
$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-boat', 'title' => 'Boots-Details', 'height' => 320]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||||
|
$sp['scripts'] .= $scripts->load('boats');
|
||||||
|
|
||||||
|
?>
|
||||||
30
server/content/clubs.php
Normal file
30
server/content/clubs.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sp['title'] = 'Vereine - Regatten.net ' . $_CLASS['name'];
|
||||||
|
$sp['backbutton'] = 'index';
|
||||||
|
$sp['activenav'] = 4;
|
||||||
|
|
||||||
|
// Title
|
||||||
|
$content = "<h1>Vereine</h1>";
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// List
|
||||||
|
$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-list" class="normal-list mb-0"></div>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']);
|
||||||
|
|
||||||
|
// Pagination
|
||||||
|
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
// TODO: add entries for jump2rank jump2club
|
||||||
|
$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-club', 'title' => 'Vereins-Details', 'height' => 320]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||||
|
$sp['scripts'] .= $scripts->load('clubs');
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Startseite - Regatten.net Pirat';
|
$sp['title'] = 'Startseite - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['activenav'] = 1;
|
$sp['activenav'] = 1;
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$sp['title'] = 'Regatten - Regatten.net Pirat';
|
$sp['title'] = 'Regatten - Regatten.net ' . $_CLASS['name'];
|
||||||
$sp['backbutton'] = 'index';
|
$sp['backbutton'] = 'index';
|
||||||
$sp['activenav'] = 2;
|
$sp['activenav'] = 2;
|
||||||
|
|
||||||
|
|||||||
42
server/content/sailors.php
Normal file
42
server/content/sailors.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$sp['title'] = 'Segler - Regatten.net ' . $_CLASS['name'];
|
||||||
|
$sp['backbutton'] = 'index';
|
||||||
|
$sp['activenav'] = 4;
|
||||||
|
|
||||||
|
// Title
|
||||||
|
$content = "<h1>Segler</h1>";
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// Info Years
|
||||||
|
$content = '<h2>Jahrgänge</h2>';
|
||||||
|
$content .= '<p>';
|
||||||
|
$content .= 'Zu vielen Seglern fehlen uns leider noch die Jahrgänge. Diese benötigen wir jedoch, um die Ranglisten vernünftig zu erstellen.<br>';
|
||||||
|
$content .= 'Solltest Du jemanden kennen, dessen Jahrgang hier in der Liste noch nicht hinterlegt ist oder der womöglich falsch ist, <b>hilf uns bitte</b>, indem Du diesen einträgst!<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 .= '</p>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content]);
|
||||||
|
|
||||||
|
// List
|
||||||
|
$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-list" class="normal-list mb-0"></div>';
|
||||||
|
|
||||||
|
$sp['output'] .= $tpl->load('card', [$content, 'html-id' => 'card-list']);
|
||||||
|
|
||||||
|
// Pagination
|
||||||
|
$sp['output'] .= $tpl->load('pagination', ['html-id' => 'pagination']);
|
||||||
|
|
||||||
|
// Menu
|
||||||
|
// TODO: add entries for jump2rank jump2club
|
||||||
|
$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']);
|
||||||
|
$sp['menus'] .= $tpl->load('menu/bottom', [$items, 'html-id' => 'menu-sailor', 'title' => 'Segler-Details', 'height' => 320]);
|
||||||
|
|
||||||
|
$sp['scripts'] .= $scripts->load('pagination', ['pageChange', 'page', 'pageCount', 'pagination']);
|
||||||
|
$sp['scripts'] .= $scripts->load('sailors');
|
||||||
|
|
||||||
|
?>
|
||||||
149
server/scripts/boats.js
Normal file
149
server/scripts/boats.js
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var displayed = [];
|
||||||
|
var page = 1;
|
||||||
|
var pageCount = 0;
|
||||||
|
const showCount = 25;
|
||||||
|
|
||||||
|
async function onListClicked(id) {
|
||||||
|
var boat = await dbGetData('boats', id);
|
||||||
|
|
||||||
|
$('#menu-boat').find('.menu-title').find('p').text(boat.sailnumber);
|
||||||
|
|
||||||
|
// Edit Boatname
|
||||||
|
// TODO: create menu for edit boatname
|
||||||
|
if (boat['name'] == '') {
|
||||||
|
$('#menu-item-boatname').find('span').text('Bootsnamen hinzufügen');
|
||||||
|
} else {
|
||||||
|
$('#menu-item-boatname').find('span').text('Bootsnamen bearbeiten');
|
||||||
|
}
|
||||||
|
|
||||||
|
// club website
|
||||||
|
var clubwebsite = '';
|
||||||
|
if (boat['club'] != null) {
|
||||||
|
clubwebsite = (await dbGetData('clubs', boat['club'])).website;
|
||||||
|
}
|
||||||
|
if (clubwebsite != '') {
|
||||||
|
$('#menu-item-clubwebsite').show();
|
||||||
|
$('#menu-item-clubwebsite').attr('href', clubwebsite);
|
||||||
|
$('#menu-item-clubwebsite').attr('target', '_blank');
|
||||||
|
} else {
|
||||||
|
$('#menu-item-clubwebsite').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#menu-boat').showMenu();
|
||||||
|
$('#menu-boat').scrollTop(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pageChange() {
|
||||||
|
$('#p-count')[0].scrollIntoView({ behavior: "smooth" });
|
||||||
|
drawList();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function drawList() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
|
||||||
|
if (displayed.length > 0) {
|
||||||
|
var offset = (page - 1) * showCount;
|
||||||
|
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
||||||
|
if (count == 0) count = showCount;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
list += displayed[i + offset];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#div-list').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reSearch() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
displayed = [];
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
displayed.push(entry.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pageCount = Math.ceil(displayed.length / showCount);
|
||||||
|
if ((page < 1) || (page > pageCount)) {
|
||||||
|
if (page < 1) {
|
||||||
|
page = 1;
|
||||||
|
} else {
|
||||||
|
page = pageCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawPagination();
|
||||||
|
drawList();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
initPagination();
|
||||||
|
$('#input-search').on('input', reSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = await dbGetData('boats');
|
||||||
|
|
||||||
|
var count = results.length;
|
||||||
|
if (count > 0) {
|
||||||
|
if (count == 1) {
|
||||||
|
$('#p-count').html('Es wurde 1 Boot gefunden!');
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Es wurden ' + count + ' Boote gefunden!');
|
||||||
|
}
|
||||||
|
$('#div-list').show();
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
results.sort(function (a, b) {
|
||||||
|
return a.sailnumber.localeCompare(b.sailnumber);
|
||||||
|
});
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in results) {
|
||||||
|
var entry = results[id];
|
||||||
|
var club = null;
|
||||||
|
if (entry['club'] != null)
|
||||||
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry['sailnumber']);
|
||||||
|
if (entry['name'] != '') row.keywords.push(entry['name']);
|
||||||
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
|
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
// Sailnumber
|
||||||
|
row.content += '<div><b>' + entry['sailnumber'] + '</b></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Name
|
||||||
|
row.content += '<div>' + entry['name'] + '</div>';
|
||||||
|
|
||||||
|
// Club
|
||||||
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div></div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
reSearch();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Keine Boote gefunden!');
|
||||||
|
$('#div-list').hide();
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
136
server/scripts/clubs.js
Normal file
136
server/scripts/clubs.js
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var displayed = [];
|
||||||
|
var page = 1;
|
||||||
|
var pageCount = 0;
|
||||||
|
const showCount = 25;
|
||||||
|
|
||||||
|
async function onListClicked(id) {
|
||||||
|
var club = await dbGetData('clubs', id);
|
||||||
|
|
||||||
|
$('#menu-club').find('.menu-title').find('p').text(club.name);
|
||||||
|
|
||||||
|
// club website
|
||||||
|
if (club.website != '') {
|
||||||
|
$('#menu-item-clubwebsite').show();
|
||||||
|
$('#menu-item-clubwebsite').attr('href', club.website);
|
||||||
|
$('#menu-item-clubwebsite').attr('target', '_blank');
|
||||||
|
} else {
|
||||||
|
$('#menu-item-clubwebsite').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#menu-club').showMenu();
|
||||||
|
$('#menu-club').scrollTop(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pageChange() {
|
||||||
|
$('#p-count')[0].scrollIntoView({ behavior: "smooth" });
|
||||||
|
drawList();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function drawList() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
|
||||||
|
if (displayed.length > 0) {
|
||||||
|
var offset = (page - 1) * showCount;
|
||||||
|
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
||||||
|
if (count == 0) count = showCount;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
list += displayed[i + offset];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#div-list').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reSearch() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
displayed = [];
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
displayed.push(entry.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pageCount = Math.ceil(displayed.length / showCount);
|
||||||
|
if ((page < 1) || (page > pageCount)) {
|
||||||
|
if (page < 1) {
|
||||||
|
page = 1;
|
||||||
|
} else {
|
||||||
|
page = pageCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawPagination();
|
||||||
|
drawList();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
initPagination();
|
||||||
|
$('#input-search').on('input', reSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = await dbGetData('clubs');
|
||||||
|
|
||||||
|
var count = results.length;
|
||||||
|
if (count > 0) {
|
||||||
|
if (count == 1) {
|
||||||
|
$('#p-count').html('Es wurde 1 Verein gefunden!');
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Es wurden ' + count + ' Vereine gefunden!');
|
||||||
|
}
|
||||||
|
$('#div-list').show();
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
results.sort(function (a, b) {
|
||||||
|
var comp = a.kurz.localeCompare(b.kurz);
|
||||||
|
if (comp == 0)
|
||||||
|
comp = a.name.localeCompare(b.name);
|
||||||
|
return comp;
|
||||||
|
});
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in results) {
|
||||||
|
var entry = results[id];
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry['dsv'], entry['kurz'], entry['name']);
|
||||||
|
if (entry['website'] != '') row.keywords.push(entry['website']);
|
||||||
|
|
||||||
|
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
// Name
|
||||||
|
row.content += '<div><b>' + entry['name'] + '</b></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// DSV
|
||||||
|
row.content += '<div>' + entry['dsv'] + '</div>';
|
||||||
|
|
||||||
|
// Kurz
|
||||||
|
row.content += '<div>' + entry['kurz'] + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div></div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
reSearch();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Keine Vereine gefunden!');
|
||||||
|
$('#div-list').hide();
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
75
server/scripts/pagination.js
Normal file
75
server/scripts/pagination.js
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
// $$0; - site script for redraw content
|
||||||
|
// $$1; - current page
|
||||||
|
// $$2; - count of pages
|
||||||
|
// $$3; - pagination id
|
||||||
|
|
||||||
|
var paginationButtons = [];
|
||||||
|
|
||||||
|
function paginationSetActive() {
|
||||||
|
for (i = 1; i <= 7; i ++) {
|
||||||
|
if ($$1; == $('#$$3;-' + i).text()) {
|
||||||
|
$('#$$3;-' + i).addClass('active');
|
||||||
|
} else {
|
||||||
|
$('#$$3;-' + i).removeClass('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawPagination() {
|
||||||
|
if ($$2; > 1) {
|
||||||
|
$('#$$3;').show();
|
||||||
|
paginationButtons[6].text($$2;);
|
||||||
|
if ($$2; <= 7) {
|
||||||
|
for (i = 2; i <= $$2; - 1; i ++) {
|
||||||
|
paginationButtons[i-1].text(i);
|
||||||
|
$('#$$3;-' + i).show();
|
||||||
|
}
|
||||||
|
for (i = $$2;; i < 7; i ++) {
|
||||||
|
$('#$$3;-' + i).hide();
|
||||||
|
}
|
||||||
|
} else if ($$1; <= 4) {
|
||||||
|
for (i = 2; i <= 5; i ++) {
|
||||||
|
paginationButtons[i-1].text(i);
|
||||||
|
$('#$$3;-' + i).show();
|
||||||
|
}
|
||||||
|
paginationButtons[5].text('...');
|
||||||
|
$('#$$3;-6').show();
|
||||||
|
} else if ($$1; > $$2; - 4) {
|
||||||
|
paginationButtons[1].text('...');
|
||||||
|
$('#$$3;-2').show();
|
||||||
|
for (i = 3; i <= 6; i ++) {
|
||||||
|
paginationButtons[i-1].text($$2; + i - 7);
|
||||||
|
$('#$$3;-' + i).show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
paginationButtons[1].text('...');
|
||||||
|
$('#$$3;-2').show();
|
||||||
|
for (i = 3; i <= 5; i ++) {
|
||||||
|
paginationButtons[i-1].text($$1; + i - 4);
|
||||||
|
$('#$$3;-' + i).show();
|
||||||
|
}
|
||||||
|
paginationButtons[5].text('...');
|
||||||
|
$('#$$3;-6').show();
|
||||||
|
}
|
||||||
|
paginationSetActive();
|
||||||
|
} else {
|
||||||
|
$('#$$3;').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPaginationClick(paginationButton) {
|
||||||
|
var newPage = parseInt($(paginationButton).text());
|
||||||
|
if (!isNaN(newPage)) {
|
||||||
|
$$1; = newPage;
|
||||||
|
drawPagination();
|
||||||
|
$$0;();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function initPagination() {
|
||||||
|
paginationButtons = [];
|
||||||
|
for (i = 1; i <= 7; i ++) {
|
||||||
|
paginationButtons.push($('#$$3;-' + i).find('a'));
|
||||||
|
}
|
||||||
|
drawPagination();
|
||||||
|
}
|
||||||
149
server/scripts/sailors.js
Normal file
149
server/scripts/sailors.js
Normal file
@@ -0,0 +1,149 @@
|
|||||||
|
var firstCall = true;
|
||||||
|
var rows = [];
|
||||||
|
var displayed = [];
|
||||||
|
var page = 1;
|
||||||
|
var pageCount = 0;
|
||||||
|
const showCount = 25;
|
||||||
|
|
||||||
|
async function onListClicked(id) {
|
||||||
|
var sailor = await dbGetData('sailors', id);
|
||||||
|
|
||||||
|
$('#menu-sailor').find('.menu-title').find('p').text(sailor.name);
|
||||||
|
|
||||||
|
// Edit Year
|
||||||
|
// TODO: create menu for edit year
|
||||||
|
if (sailor['year'] == null) {
|
||||||
|
$('#menu-item-year').find('span').text('Jahrgang hinzufügen');
|
||||||
|
} else {
|
||||||
|
$('#menu-item-year').find('span').text('Jahrgang bearbeiten');
|
||||||
|
}
|
||||||
|
|
||||||
|
// club website
|
||||||
|
var clubwebsite = '';
|
||||||
|
if (sailor['club'] != null) {
|
||||||
|
clubwebsite = (await dbGetData('clubs', sailor['club'])).website;
|
||||||
|
}
|
||||||
|
if (clubwebsite != '') {
|
||||||
|
$('#menu-item-clubwebsite').show();
|
||||||
|
$('#menu-item-clubwebsite').attr('href', clubwebsite);
|
||||||
|
$('#menu-item-clubwebsite').attr('target', '_blank');
|
||||||
|
} else {
|
||||||
|
$('#menu-item-clubwebsite').hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#menu-sailor').showMenu();
|
||||||
|
$('#menu-sailor').scrollTop(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function pageChange() {
|
||||||
|
$('#p-count')[0].scrollIntoView({ behavior: "smooth" });
|
||||||
|
drawList();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function drawList() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
var list = '';
|
||||||
|
|
||||||
|
if (displayed.length > 0) {
|
||||||
|
var offset = (page - 1) * showCount;
|
||||||
|
var count = (page == pageCount ? (displayed.length % showCount) : showCount);
|
||||||
|
if (count == 0) count = showCount;
|
||||||
|
|
||||||
|
for (i = 0; i < count; i ++) {
|
||||||
|
list += displayed[i + offset];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
list = '<div><div>Keine Ergebnisse, die der Suche entsprechen</div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#div-list').html(list);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function reSearch() {
|
||||||
|
window.setTimeout(function () {
|
||||||
|
displayed = [];
|
||||||
|
rows.forEach(function (entry) {
|
||||||
|
if (search($('#input-search').val(), entry.keywords)) {
|
||||||
|
displayed.push(entry.content);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
pageCount = Math.ceil(displayed.length / showCount);
|
||||||
|
if ((page < 1) || (page > pageCount)) {
|
||||||
|
if (page < 1) {
|
||||||
|
page = 1;
|
||||||
|
} else {
|
||||||
|
page = pageCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
drawPagination();
|
||||||
|
drawList();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var siteScript = async function() {
|
||||||
|
if (firstCall) {
|
||||||
|
firstCall = false;
|
||||||
|
initPagination();
|
||||||
|
$('#input-search').on('input', reSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
var results = await dbGetData('sailors');
|
||||||
|
|
||||||
|
var count = results.length;
|
||||||
|
if (count > 0) {
|
||||||
|
if (count == 1) {
|
||||||
|
$('#p-count').html('Es wurde 1 Segler gefunden!');
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Es wurden ' + count + ' Segler gefunden!');
|
||||||
|
}
|
||||||
|
$('#div-list').show();
|
||||||
|
$('#input-search').parent().show();
|
||||||
|
|
||||||
|
results.sort(function (a, b) {
|
||||||
|
return a.name.localeCompare(b.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
rows = [];
|
||||||
|
|
||||||
|
for (id in results) {
|
||||||
|
var entry = results[id];
|
||||||
|
var club = null;
|
||||||
|
if (entry['club'] != null)
|
||||||
|
club = await dbGetData('clubs', entry['club']);
|
||||||
|
|
||||||
|
var row = { keywords: [], content: '' };
|
||||||
|
row.keywords.push(entry['name']);
|
||||||
|
if (entry['year'] != null) row.keywords.push(entry['year']);
|
||||||
|
if (club != null) row.keywords.push(club['kurz'], club['name']);
|
||||||
|
|
||||||
|
row.content += '<div onclick="onListClicked(' + entry['id'] + ');">';
|
||||||
|
|
||||||
|
// ZEILE 1
|
||||||
|
// Name
|
||||||
|
row.content += '<div><b>' + entry['name'] + '</b></div>';
|
||||||
|
|
||||||
|
// ZEILE 2
|
||||||
|
row.content += '<div>';
|
||||||
|
|
||||||
|
// Year
|
||||||
|
row.content += '<div>' + ((entry['year'] != null) ? (entry['year']) : '') + '</div>';
|
||||||
|
|
||||||
|
// Club
|
||||||
|
row.content += '<div>' + ((club != null) ? club['kurz'] : '') + '</div>';
|
||||||
|
|
||||||
|
row.content += '</div></div>';
|
||||||
|
|
||||||
|
rows.push(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
reSearch();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$('#p-count').html('Keine Segler gefunden!');
|
||||||
|
$('#div-list').hide();
|
||||||
|
$('#input-search').parent().hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
hideLoader();
|
||||||
|
}
|
||||||
11
server/templates/pagination.html
Normal file
11
server/templates/pagination.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<nav id="$$html-id;">
|
||||||
|
<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;-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;-3" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">3</a></li>
|
||||||
|
<li id="$$html-id;-4" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">4</a></li>
|
||||||
|
<li id="$$html-id;-5" class="page-item"><a onclick="onPaginationClick(this)" class="page-link color-black bg-theme rounded-xs shadow-x1 border-0" style="cursor: pointer;">5</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>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PWA_VERSION', '1.2');
|
define('PWA_VERSION', '1.3');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user