implement button to create event in nextcloud
This commit is contained in:
1 parent
b424abe8e4
commit
88a9827de2
2 files changed
+96
No files matched your search
@@ -357,9 +357,12 @@ const meetingStartInput = document.getElementById("meetingStart");
|
|||||||
const meetingEndInput = document.getElementById("meetingEnd");
|
const meetingEndInput = document.getElementById("meetingEnd");
|
||||||
const meetingOrganizerInput = document.getElementById("meetingOrganizer");
|
const meetingOrganizerInput = document.getElementById("meetingOrganizer");
|
||||||
const createMeetingButton = document.getElementById("createMeetingButton");
|
const createMeetingButton = document.getElementById("createMeetingButton");
|
||||||
|
const createNextcloudButton = document.getElementById('createNextcloudButton');
|
||||||
const createAdhocButton = document.getElementById("createAdhocButton");
|
const createAdhocButton = document.getElementById("createAdhocButton");
|
||||||
const cancelCreateButton = document.getElementById("cancelCreateButton");
|
const cancelCreateButton = document.getElementById("cancelCreateButton");
|
||||||
const icsSuccess = document.getElementById("icsSuccess");
|
const icsSuccess = document.getElementById("icsSuccess");
|
||||||
|
const nextcloudStatus = document.getElementById('nextcloudStatus');
|
||||||
|
const nextcloudError = document.getElementById('nextcloudError');
|
||||||
const downloadIcsLink = document.getElementById("downloadIcsLink");
|
const downloadIcsLink = document.getElementById("downloadIcsLink");
|
||||||
const adhocResult = document.getElementById("adhocResult");
|
const adhocResult = document.getElementById("adhocResult");
|
||||||
const adhocLink = document.getElementById("adhocLink");
|
const adhocLink = document.getElementById("adhocLink");
|
||||||
@@ -1000,6 +1003,85 @@ function showMeetingCreator() {
|
|||||||
meetingEndInput.value = formatLocal(end);
|
meetingEndInput.value = formatLocal(end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openNextcloudCalendarCreator() {
|
||||||
|
const meetingName =
|
||||||
|
meetingNameInput.value.trim();
|
||||||
|
|
||||||
|
const description =
|
||||||
|
meetingDescriptionInput.value.trim();
|
||||||
|
|
||||||
|
const startTime =
|
||||||
|
meetingStartInput.value;
|
||||||
|
|
||||||
|
const endTime =
|
||||||
|
meetingEndInput.value;
|
||||||
|
|
||||||
|
const organizer =
|
||||||
|
meetingOrganizerInput.value.trim();
|
||||||
|
|
||||||
|
if (!meetingName) {
|
||||||
|
alert('Please enter a meeting name.');
|
||||||
|
meetingNameInput.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!startTime || !endTime) {
|
||||||
|
alert('Please enter start and end time.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const start = new Date(startTime);
|
||||||
|
const end = new Date(endTime);
|
||||||
|
|
||||||
|
if (Number.isNaN(start.getTime()) ||
|
||||||
|
Number.isNaN(end.getTime())) {
|
||||||
|
alert('Invalid start or end date.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end <= start) {
|
||||||
|
alert('End time must be after start time.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use exactly the same room-generation logic as the
|
||||||
|
* existing ICS creation.
|
||||||
|
*/
|
||||||
|
const roomName = createRoomName(meetingName);
|
||||||
|
|
||||||
|
const meetingUrl =
|
||||||
|
createLaunchUrl(roomName);
|
||||||
|
|
||||||
|
const nextcloudBase =
|
||||||
|
'https://cloud.bnvb-ingenieure.de';
|
||||||
|
|
||||||
|
const params = new URLSearchParams();
|
||||||
|
|
||||||
|
params.set('summary', meetingName);
|
||||||
|
|
||||||
|
if (description) {
|
||||||
|
params.set('description', description);
|
||||||
|
}
|
||||||
|
|
||||||
|
params.set('start', startTime);
|
||||||
|
params.set('end', endTime);
|
||||||
|
|
||||||
|
if (organizer) {
|
||||||
|
params.set('organizer', organizer);
|
||||||
|
}
|
||||||
|
|
||||||
|
params.set('location', meetingUrl);
|
||||||
|
params.set('url', meetingUrl);
|
||||||
|
|
||||||
|
const nextcloudUrl =
|
||||||
|
nextcloudBase +
|
||||||
|
'/index.php/apps/jitsi_calendar/confirm?' +
|
||||||
|
params.toString();
|
||||||
|
|
||||||
|
window.location.href = nextcloudUrl;
|
||||||
|
}
|
||||||
|
|
||||||
function createMeeting() {
|
function createMeeting() {
|
||||||
const meetingName = meetingNameInput.value.trim();
|
const meetingName = meetingNameInput.value.trim();
|
||||||
const description = meetingDescriptionInput.value.trim();
|
const description = meetingDescriptionInput.value.trim();
|
||||||
@@ -1262,6 +1344,13 @@ createMeetingButton.addEventListener(
|
|||||||
createMeeting
|
createMeeting
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (createNextcloudButton) {
|
||||||
|
createNextcloudButton.addEventListener(
|
||||||
|
'click',
|
||||||
|
openNextcloudCalendarCreator
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
createAdhocButton.addEventListener(
|
createAdhocButton.addEventListener(
|
||||||
"click",
|
"click",
|
||||||
createAdhocLink
|
createAdhocLink
|
||||||
|
|||||||
@@ -289,6 +289,9 @@
|
|||||||
<button id="createMeetingButton" class="button primary" type="button" data-i18n="creator.createButton">
|
<button id="createMeetingButton" class="button primary" type="button" data-i18n="creator.createButton">
|
||||||
Create Meeting
|
Create Meeting
|
||||||
</button>
|
</button>
|
||||||
|
<button id="createNextcloudButton" class="button primary" type="button" data-i18n="creator.nextcloudButton">
|
||||||
|
Create in Nextcloud Calendar
|
||||||
|
</button>
|
||||||
<button id="createAdhocButton" class="button secondary" type="button" data-i18n="creator.adhocButton">
|
<button id="createAdhocButton" class="button secondary" type="button" data-i18n="creator.adhocButton">
|
||||||
Create Adhoc Link
|
Create Adhoc Link
|
||||||
</button>
|
</button>
|
||||||
@@ -309,6 +312,10 @@
|
|||||||
<span data-i18n="creator.successMessage">Meeting created! Download your calendar file and open it to import the meeting into your personal calendar.</span>
|
<span data-i18n="creator.successMessage">Meeting created! Download your calendar file and open it to import the meeting into your personal calendar.</span>
|
||||||
<a id="downloadIcsLink" class="button primary" style="margin-top: 12px; display: inline-block;" data-i18n="creator.downloadButton">Download ICS File</a>
|
<a id="downloadIcsLink" class="button primary" style="margin-top: 12px; display: inline-block;" data-i18n="creator.downloadButton">Download ICS File</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="nextcloudStatus" class="success-message hidden" aria-live="polite"></div>
|
||||||
|
|
||||||
|
<div id="nextcloudError" class="error hidden" aria-live="assertive"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user