nodebb-plugin-onekite-calendar 2.0.46 → 2.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api.js +34 -4
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/public/client.js +15 -24
package/lib/api.js
CHANGED
|
@@ -507,7 +507,7 @@ function eventsForOuting(o) {
|
|
|
507
507
|
type: 'outing',
|
|
508
508
|
id: String(o.oid),
|
|
509
509
|
uid: Number(o.uid) || 0,
|
|
510
|
-
title: String(o.title || '
|
|
510
|
+
title: String(o.title || 'Sortie'),
|
|
511
511
|
details: String(o.notes || ''),
|
|
512
512
|
location: String(o.address || ''),
|
|
513
513
|
allDay: false,
|
|
@@ -516,7 +516,7 @@ function eventsForOuting(o) {
|
|
|
516
516
|
});
|
|
517
517
|
return {
|
|
518
518
|
id: `outing:${o.oid}`,
|
|
519
|
-
title: `${o.title || '
|
|
519
|
+
title: `${o.title || 'Sortie'}`.trim(),
|
|
520
520
|
allDay: false,
|
|
521
521
|
start: startIso,
|
|
522
522
|
end: endIso,
|
|
@@ -882,6 +882,19 @@ api.getSpecialEventDetails = async function (req, res) {
|
|
|
882
882
|
const ev = await dbLayer.getSpecialEvent(eid);
|
|
883
883
|
if (!ev) return res.status(404).json({ error: 'not-found' });
|
|
884
884
|
|
|
885
|
+
// Calendar export links (ICS / Google Calendar)
|
|
886
|
+
const links = buildCalendarLinks({
|
|
887
|
+
type: 'special',
|
|
888
|
+
id: String(ev.eid),
|
|
889
|
+
uid: Number(ev.uid) || 0,
|
|
890
|
+
title: String(ev.title || 'Évènement'),
|
|
891
|
+
details: String(ev.notes || ''),
|
|
892
|
+
location: String(ev.address || ''),
|
|
893
|
+
allDay: false,
|
|
894
|
+
start: new Date(parseInt(ev.start, 10)),
|
|
895
|
+
end: new Date(parseInt(ev.end, 10)),
|
|
896
|
+
});
|
|
897
|
+
|
|
885
898
|
// Anyone who can see the calendar can view special events, but creator username
|
|
886
899
|
// is only visible to moderators/allowed users or the creator.
|
|
887
900
|
const out = {
|
|
@@ -894,6 +907,8 @@ api.getSpecialEventDetails = async function (req, res) {
|
|
|
894
907
|
lon: ev.lon || '',
|
|
895
908
|
notes: ev.notes || '',
|
|
896
909
|
canDeleteSpecial: canSpecialDelete,
|
|
910
|
+
icsUrl: links.icsUrl,
|
|
911
|
+
googleCalUrl: links.googleCalUrl,
|
|
897
912
|
};
|
|
898
913
|
if (ev.username && (canMod || canSpecialDelete || (uid && String(uid) === String(ev.uid)))) {
|
|
899
914
|
out.username = String(ev.username);
|
|
@@ -998,6 +1013,19 @@ api.getOutingDetails = async function (req, res) {
|
|
|
998
1013
|
const o = await dbLayer.getOuting(oid);
|
|
999
1014
|
if (!o) return res.status(404).json({ error: 'not-found' });
|
|
1000
1015
|
|
|
1016
|
+
// Calendar export links (ICS / Google Calendar)
|
|
1017
|
+
const links = buildCalendarLinks({
|
|
1018
|
+
type: 'outing',
|
|
1019
|
+
id: String(o.oid),
|
|
1020
|
+
uid: Number(o.uid) || 0,
|
|
1021
|
+
title: String(o.title || 'Sortie'),
|
|
1022
|
+
details: String(o.notes || ''),
|
|
1023
|
+
location: String(o.address || ''),
|
|
1024
|
+
allDay: false,
|
|
1025
|
+
start: new Date(parseInt(o.start, 10)),
|
|
1026
|
+
end: new Date(parseInt(o.end, 10)),
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1001
1029
|
const out = {
|
|
1002
1030
|
oid: o.oid,
|
|
1003
1031
|
title: o.title || '',
|
|
@@ -1008,6 +1036,8 @@ api.getOutingDetails = async function (req, res) {
|
|
|
1008
1036
|
lon: o.lon || '',
|
|
1009
1037
|
notes: o.notes || '',
|
|
1010
1038
|
canDeleteOuting: canMod || (uid && String(uid) === String(o.uid)),
|
|
1039
|
+
icsUrl: links.icsUrl,
|
|
1040
|
+
googleCalUrl: links.googleCalUrl,
|
|
1011
1041
|
};
|
|
1012
1042
|
if (o.username && (canMod || (uid && String(uid) === String(o.uid)))) {
|
|
1013
1043
|
out.username = String(o.username);
|
|
@@ -1023,7 +1053,7 @@ api.createOuting = async function (req, res) {
|
|
|
1023
1053
|
const ok = await canRequest(req.uid, settings, startTs);
|
|
1024
1054
|
if (!ok) return res.status(403).json({ error: 'not-allowed' });
|
|
1025
1055
|
|
|
1026
|
-
const title = String((req.body && req.body.title) || '').trim() || '
|
|
1056
|
+
const title = String((req.body && req.body.title) || '').trim() || 'Sortie';
|
|
1027
1057
|
const endTs = toTs(req.body && req.body.end);
|
|
1028
1058
|
if (!Number.isFinite(startTs) || !Number.isFinite(endTs) || !(startTs < endTs)) {
|
|
1029
1059
|
return res.status(400).json({ error: 'bad-dates' });
|
|
@@ -1934,7 +1964,7 @@ api.getIcs = async function (req, res) {
|
|
|
1934
1964
|
const end = new Date(parseInt(o.end, 10));
|
|
1935
1965
|
ics = buildIcs({
|
|
1936
1966
|
uid: `outing-${id}@onekite`,
|
|
1937
|
-
summary: String(o.title || '
|
|
1967
|
+
summary: String(o.title || 'Sortie'),
|
|
1938
1968
|
description: String(o.notes || ''),
|
|
1939
1969
|
location: String(o.address || ''),
|
|
1940
1970
|
allDay: false,
|
package/package.json
CHANGED
package/plugin.json
CHANGED
package/public/client.js
CHANGED
|
@@ -62,33 +62,24 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
/*
|
|
65
|
+
/* Creation chooser buttons: outline only, match calendar colors */
|
|
66
|
+
.btn-onekite-special,
|
|
67
|
+
.btn-onekite-outing,
|
|
68
|
+
.btn-onekite-location {
|
|
69
|
+
background: transparent;
|
|
70
|
+
border-width: 2px;
|
|
71
|
+
}
|
|
66
72
|
.btn-onekite-special {
|
|
67
|
-
background: #8e44ad;
|
|
68
73
|
border-color: #8e44ad;
|
|
69
|
-
color: #
|
|
70
|
-
}
|
|
71
|
-
.btn-onekite-special:hover {
|
|
72
|
-
filter: brightness(0.95);
|
|
73
|
-
color: #fff;
|
|
74
|
+
color: #8e44ad;
|
|
74
75
|
}
|
|
75
76
|
.btn-onekite-outing {
|
|
76
|
-
background: #2980b9;
|
|
77
77
|
border-color: #2980b9;
|
|
78
|
-
color: #
|
|
79
|
-
}
|
|
80
|
-
.btn-onekite-outing:hover {
|
|
81
|
-
filter: brightness(0.95);
|
|
82
|
-
color: #fff;
|
|
78
|
+
color: #2980b9;
|
|
83
79
|
}
|
|
84
80
|
.btn-onekite-location {
|
|
85
|
-
background: #27ae60;
|
|
86
81
|
border-color: #27ae60;
|
|
87
|
-
color: #
|
|
88
|
-
}
|
|
89
|
-
.btn-onekite-location:hover {
|
|
90
|
-
filter: brightness(0.95);
|
|
91
|
-
color: #fff;
|
|
82
|
+
color: #27ae60;
|
|
92
83
|
}
|
|
93
84
|
|
|
94
85
|
/* Mobile FAB date range picker (single calendar) */
|
|
@@ -294,8 +285,10 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
294
285
|
|
|
295
286
|
const seStartTime = timeString(seStart);
|
|
296
287
|
const seEndTime = timeString(seEnd);
|
|
297
|
-
|
|
298
|
-
|
|
288
|
+
// Same UX for all types: an example placeholder, but never pre-fill the value.
|
|
289
|
+
// If left empty, the server can still apply its own default label.
|
|
290
|
+
const defaultTitlePlaceholder = 'Ex: ...';
|
|
291
|
+
const defaultTitleValue = '';
|
|
299
292
|
|
|
300
293
|
const html = `
|
|
301
294
|
<div class="mb-3">
|
|
@@ -472,8 +465,6 @@ define('forum/calendar-onekite', ['alerts', 'bootbox', 'hooks'], function (alert
|
|
|
472
465
|
// a different title.
|
|
473
466
|
const payload = await openSpecialEventDialog(selectionInfo, { kind: 'outing' });
|
|
474
467
|
if (!payload) return null;
|
|
475
|
-
// Default title if empty
|
|
476
|
-
if (!payload.title) payload.title = 'Prévision de sortie';
|
|
477
468
|
return payload;
|
|
478
469
|
}
|
|
479
470
|
|
|
@@ -1696,7 +1687,7 @@ function toDatetimeLocalValue(date) {
|
|
|
1696
1687
|
`;
|
|
1697
1688
|
const canDel = !!(p.canDeleteOuting);
|
|
1698
1689
|
const dlg = bootbox.dialog({
|
|
1699
|
-
title: '
|
|
1690
|
+
title: 'Sortie',
|
|
1700
1691
|
message: html,
|
|
1701
1692
|
buttons: {
|
|
1702
1693
|
close: { label: 'Fermer', className: 'btn-secondary' },
|