Closed Bolli84 closed 1 year ago
The code in that post is hardly readable. Can you use 3 backticks to properly code it?
Like:
var windowHtml = `<title>Add to Calendar</title>
<script>
var allOptions = "";
var optionString = 'option';
`;
You may also modify the code, test it and then create a pull request.
See the code at https://github.com/the-djmaze/snappymail/blob/master/plugins/nextcloud/ And especially https://github.com/the-djmaze/snappymail/blob/master/plugins/nextcloud/js/message.js
/*Holt sich die Dateinamen und Links aller Anhänge*/
function getFileInfo(){
var rainloopFrame = document.getElementById("rliframe");
var items = rainloopFrame.contentDocument.getElementsByClassName("attachmentItem");
var names = [];
var links = [];
for(let i=0; i<items.length; i++){
if (items[i].title.endsWith(".ics")){
names.push(items[i].title);
links.push(items[i].getElementsByTagName("a")[0].href);
break
}
}
return [names, links];
}
function getNamesString(names){
var full="";
for(let i=0; i<names.length; i++){
full += names[i];
}
return full;
}
//duplicate to make freebusy working
function getFileInfo2() {
var rainloopFrame = document.getElementById("rliframe");
var items = rainloopFrame.contentDocument.getElementsByClassName("attachmentItem");
var links = [];
for (let i = 0; i < items.length; i++) {
if (items[i].title.endsWith(".ics")) {
links.push(items[i].getElementsByTagName("a")[0].href);
}
}
return links;
}
//xmlhttpget but synchrone not async
// REMOVED BY DJMaze as nothing was related or working
Your code is incomplete and has loads of not related code. Could you properly upload the related code as attachment?
I uploaded the full file, since it was hard to remove some of the unneeded lines. But i suppose they might be needed.
The attached file contains everything now. rainloop (18).docx
Thanks. I've looked at it and it can't be used. That doesn't mean that it worthless because there are some good ideas in there to write and extend/improve the current Nextcloud integration.
All right. I created and used it in Rainloop and it was pretty useful there.
Oh yes, it works in RainLoop.
However it relies on jQuery and SnappyMail doesn't. Also Nextcloud is slowly abandoning jQuery.
Secondly your code requires iframe mode but SnappyMail can be run without iframe to be better integrated.
So i will use your usefull code as reference to built similar features.
The putICS is already a good solution, but the information for the calendar content is missing. It would be good to create a little box in the mail content, which is showing the calendar content (Title, Timezone, Date Time) to see this content.
The box and how to render it within nextcloud is already included in: https://github.com/pierre-alain-b/rainloop-nextcloud/issues/152#issue-613532704