From 13d9e82d5533f53f8158dc3ca7f0426518982df8 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Fri, 12 Aug 2022 09:15:32 -0400 Subject: fully fix the import-event function! --- radicale_infcloud/web/data_process.js | 9 +++++++-- radicale_infcloud/web/forms.js | 12 ------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/radicale_infcloud/web/data_process.js b/radicale_infcloud/web/data_process.js index fb03b2c..d562927 100644 --- a/radicale_infcloud/web/data_process.js +++ b/radicale_infcloud/web/data_process.js @@ -2549,6 +2549,9 @@ function fullVcalendarToData(inputEvent) if(!vcalendar) return false; + // stackrpms,3 Handle not-to-spec upload of .ics file + // By adjusting the line endings, we can now immediately edit newly-imported events. + vcalendar = vcalendar.replace(/\r*\n+/gm,'\r\n'); var vcalendar_full=vcalendar.split('\r\n'); if((parsed=('\r\n'+vcalendar_full[0]+'\r\n').match(vCalendar.pre['contentline_parse']))==null) @@ -8546,7 +8549,8 @@ function stringToVevent(inputCollection, vstring, uid, etag, isNew) { repeatCount++; var tmpObj=new items(etag, start, end, title, all, uid, rid, evid, note, inputCollection.displayValue, alertTime, alertNote, realUntilDate, frequency, interval, realUntil, repeatStart, repeatEnd, byMonthDay,repeatCount, realRepeatCount, vcalendar, location, alertTimeOut,tzName, realStart, realEnd, byDay, rec_id,wkst,classType, avail,hrefUrl, compareString,priority,status,ruleString); - globalEventList.displayEventsArray[rid].splice(globalEventList.displayEventsArray[rid].length, 0, tmpObj); + // stackrpms,2 Disable this next line because it makes an uneditable, duplicate visible entry on the current calendar. + //globalEventList.displayEventsArray[rid].splice(globalEventList.displayEventsArray[rid].length, 0, tmpObj); } } @@ -8573,7 +8577,8 @@ function stringToVevent(inputCollection, vstring, uid, etag, isNew) if(needReload) showEventForm(null, null, tmpObj, globalJsEvent, 'show', ''); } - globalEventList.displayEventsArray[rid].splice(globalEventList.displayEventsArray[rid].length, 0, tmpObj); + // stackrpms,2 Disable this next line because it makes an uneditable, duplicate visible entry on the current calendar. + //globalEventList.displayEventsArray[rid].splice(globalEventList.displayEventsArray[rid].length, 0, tmpObj); } } } diff --git a/radicale_infcloud/web/forms.js b/radicale_infcloud/web/forms.js index e8155e9..441f0d6 100644 --- a/radicale_infcloud/web/forms.js +++ b/radicale_infcloud/web/forms.js @@ -57,18 +57,6 @@ function dropHandler(event) { if(window.console){console.log(reader.result)}; //dataToVcalendar('EDIT' var calEvent = uploadFile(reader.result); - // This lets it appear right away, but it is still not clickable. - console.log(`Using ${newEvent.id} as uid`); - $('#uid').val(calEvent.id); - $('#etag').val(calEvent.etag); - refetchCalendarEvents(); - { - var beforeScroll = $('#main').width()-$('#calendar').width(); - $('#calendar').fullCalendar('unselect'); - $('#calendar').fullCalendar('removeEvents', 'fooUID'); - var afterScroll = $('#main').width()-$('#calendar').width(); - rerenderCalendar(); - } }; reader.onerror = function(){if(window.console){console.log(reader.error)}}; } -- cgit