aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-08-12 09:50:37 -0400
committerB. Stack <bgstack15@gmail.com>2022-08-12 09:50:37 -0400
commitbd956a97f8f102f338d6c546398c52ccef1d3af0 (patch)
treece224293bb624f6cc2705898359654515c113ec1
parentfully fix the import-event function! (diff)
downloadradicaleinfcloud-bd956a97f8f102f338d6c546398c52ccef1d3af0.tar.gz
radicaleinfcloud-bd956a97f8f102f338d6c546398c52ccef1d3af0.tar.bz2
radicaleinfcloud-bd956a97f8f102f338d6c546398c52ccef1d3af0.zip
restore putVcalendarToCollection, hide dl button
And also improve code formatting and comments to match rest of project.
-rw-r--r--radicale_infcloud/web/data_process.js17
-rw-r--r--radicale_infcloud/web/forms.js9
-rw-r--r--radicale_infcloud/web/interface.js34
-rw-r--r--radicale_infcloud/web/webdav_protocol.js6
4 files changed, 19 insertions, 47 deletions
diff --git a/radicale_infcloud/web/data_process.js b/radicale_infcloud/web/data_process.js
index d562927..0e0df93 100644
--- a/radicale_infcloud/web/data_process.js
+++ b/radicale_infcloud/web/data_process.js
@@ -761,6 +761,8 @@ function getvCalendarstart(inputEvent)
{
var vcalendar_element='',
itsOK=false;
+ // stackrpms,3 Handle not-to-spec upload of .ics file
+ // By adjusting line endings, this function can process the fileContents and make it visible on the current view.
var vEvent=inputEvent.vcalendar.replace(/\r*\n+/gm,'\r\n');
if(vEvent.match(vCalendar.pre['vcalendar']))
{
@@ -3443,7 +3445,7 @@ function getDateFromDay(objComponent, t, disableRecursion,uid)
return {offsetFrom:objComponent.tzOffsetFROM, offsetTo: objComponent.tzOffsetTO, startDate: dayLightStartDate};
}
-/* FINDTHIS */
+/* stackrpms: reference function */
function vcalendarToData(inputCollection, inputEvent, isNew)
{
var vcalendarOrig=inputEvent.vcalendar;
@@ -3537,6 +3539,8 @@ function getDateFromDay(objComponent, t, disableRecursion,uid)
vcalendar=vcalendar.replace(vcalendar_element[0],'');
*/
var recurrence_id_array=new Array();
+ // stackrpms,3 Handle not-to-spec upload of .ics file
+ // By adjusting line endings, this function can process the fileContents and make it visible on the current view.
vcalendarOrig = vcalendarOrig.replace(/\r*\n+/gm,'\r\n');
while(vcalendarOrig.match(vCalendar.pre['vevent'])!=null)
{
@@ -7797,8 +7801,6 @@ function normalizeVcard(vcardString)
*/
function stringToVevent(inputCollection, vstring, uid, etag, isNew)
{
- //vcalendarToData(inputCollection, inputEvent, isNew)
- //var vcalendarOrig=inputEvent.vcalendar;
var vcalendarOrig=vstring;
var eventArray=new Array();
@@ -7884,15 +7886,8 @@ function stringToVevent(inputCollection, vstring, uid, etag, isNew)
vcalendar=vcalendarOrig.substring(0, beginTimeZone)+vcalendarOrig.substring(endTimeZone, vcalendarOrig.length);
}
- /*
- vcalendar_element=vcalendar.match(vCalendar.pre['tzone']);
- if(vcalendar_element!=null)
- vcalendar=vcalendar.replace(vcalendar_element[0],'');
- */
var recurrence_id_array=new Array();
- /* FINDTHIS matching for BEGIN:VEVENT */
- // this one works, but has 3 replace calls!
- //vcalendarOrig = vcalendarOrig.replace(/^\n/gm,'').replace('\n','\r\n').replace(/\r*\n/gm,'\r\n');
+ /* matching for BEGIN:VEVENT */
vcalendarOrig = vcalendarOrig.replace(/\r*\n+/gm,'\r\n');
while(vcalendarOrig.match(vCalendar.pre['vevent'])!=null)
{
diff --git a/radicale_infcloud/web/forms.js b/radicale_infcloud/web/forms.js
index 441f0d6..ab38864 100644
--- a/radicale_infcloud/web/forms.js
+++ b/radicale_infcloud/web/forms.js
@@ -39,7 +39,6 @@ function dragOverHandler(event) {
event.stopPropagation();
}
-/* Incomplete import process. The function logs to console but does not use the vcard contents. */
function dropHandler(event) {
if (event) {
event.preventDefault();
@@ -54,10 +53,9 @@ function dropHandler(event) {
let reader = new FileReader();
reader.readAsText(f);
reader.onload = function(){
- if(window.console){console.log(reader.result)};
- //dataToVcalendar('EDIT'
- var calEvent = uploadFile(reader.result);
- };
+ //if(window.console){console.log(reader.result)};
+ uploadFile(reader.result);
+ };
reader.onerror = function(){if(window.console){console.log(reader.error)}};
}
}
@@ -1623,6 +1621,7 @@ function showEventForm(date, allDay, calEvent, jsEvent, mod, repeatOne, confirmR
var color='';
if(mod=='new')
{
+ $('#downloadButton').hide();
var activeCollection = $('#ResourceCalDAVList').find('.resourceCalDAV_item.resourceCalDAV_item_selected');
if(activeCollection.length>0 && !globalResourceCalDAVList.getEventCollectionByUID(activeCollection.attr('data-id')).permissions.read_only)
color=rgbToHex(activeCollection.children('.resourceCalDAVColor').css('background-color'));
diff --git a/radicale_infcloud/web/interface.js b/radicale_infcloud/web/interface.js
index 8ea4777..b7a4d4c 100644
--- a/radicale_infcloud/web/interface.js
+++ b/radicale_infcloud/web/interface.js
@@ -1308,32 +1308,14 @@ function uploadFile(fileContents)
inputUID = $('#event_calendar').val()+'';
else
return false;
- // ripped from data_process.js:1474
- var newUID=globalEventList.getNewUID();
- //process_elem=process_elem.replace('##:::##uid##:::##', newUID);
- fileContents = fileContents.replace(/^UID:.*$/gm,String("UID:"+newUID));
- // FINDTHIS: Could also try adding inputUID+newUID. Not sure if it helps or hurts.
- newEvent = stringToVevent(coll, fileContents, inputUID, $('#etag').val(), true);
- console.log(newEvent);
- // This was an attempt to populate the form. I found it easier to just send the object to the caldav server right away.
- // ref: interface.js:2601
- //showEventForm(null, newEvent.allDay, newEvent, null, 'show', '');
- // Just call the caldav operation directly.
- //putVcalendarToCollection(accountUID, inputUID, inputEtag, inputS, delUID, 'vevent', isFormHidden, deleteMode, fixedArr);
- // putVcalendarToCollection("http://domainjoin@d2-03a/radicale/domainjoin", "http://domainjoin@d2-03a/radicale/domainjoin/4f58b6a8-014f-03b9-ae12-071eb28798de/", "", fileContents, "", 'vevent', undefined, undefined,
- // WORKHERE: The new object does appear in the current view, but is not clickable! The user has to re-login to view/edit details.
- // Perhaps somehow add this to the globalEventList thing, like adding a brand-new event by hand?
- // Maybe follow the stack trace on the "save" button click.
- //refetchCalendarEvents();
- //rerenderCalendar(true);
- //dataToVcalendar('EDIT',origUID, inputUID, $('#etag').val(), '', isFormHidden, deleteMode);
- // When returnFullUID is true (last parameter), it returns "http://username@server/radicale/username/CALID/hex.ics"
- // But unfortunately the globalEventList.events[rid] still does not populate with this.
- //newEvent.id = inputUID + newUID + ".ics";
- newEvent.vcalendar = newEvent.vcalendar.replace(/\r*\n+/gm,'\r\n');
- newEvent.id = putVcalendarToCollection(coll.accountUID, inputUID, "", fileContents, "", 'vevent', false, false, "", true);
- console.log("FINDTHIS");
- return newEvent;
+ // ripped from data_process.js:1474
+ var newUID=globalEventList.getNewUID();
+ fileContents = fileContents.replace(/^UID:.*$/gm,String("UID:"+newUID));
+ newEvent = stringToVevent(coll, fileContents, inputUID, $('#etag').val(), true);
+ //console.log(newEvent);
+ newEvent.vcalendar = newEvent.vcalendar.replace(/\r*\n+/gm,'\r\n');
+ putVcalendarToCollection(coll.accountUID, inputUID, "", fileContents, "", 'vevent', false, false, "");
+ return true;
}
/* STOP stackrpms */
diff --git a/radicale_infcloud/web/webdav_protocol.js b/radicale_infcloud/web/webdav_protocol.js
index b2b8efc..285c0b7 100644
--- a/radicale_infcloud/web/webdav_protocol.js
+++ b/radicale_infcloud/web/webdav_protocol.js
@@ -2319,7 +2319,7 @@ function moveVcalendarToCollection(accountUID, inputUID, inputEtag, inputVcalend
});
}
-function putVcalendarToCollection(accountUID, inputUID, inputEtag, inputVcalendar, delUID,inputForm,isFormHidden,deleteMode,textArray,returnFullUID)
+function putVcalendarToCollection(accountUID, inputUID, inputEtag, inputVcalendar, delUID,inputForm,isFormHidden,deleteMode,textArray)
{
var resultTimestamp=new Date().getTime();
if(inputForm=='vtodo')
@@ -2574,10 +2574,6 @@ function putVcalendarToCollection(accountUID, inputUID, inputEtag, inputVcalenda
return true;
}
});
- if(returnFullUID)
- {
- return inputUID;
- }
}
/*
bgstack15