diff options
Diffstat (limited to 'radicale_infcloud/web/interface.js')
-rw-r--r-- | radicale_infcloud/web/interface.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/radicale_infcloud/web/interface.js b/radicale_infcloud/web/interface.js index e5afb8d..745d58d 100644 --- a/radicale_infcloud/web/interface.js +++ b/radicale_infcloud/web/interface.js @@ -1289,6 +1289,45 @@ function addAndEdit(isFormHidden, deleteMode) dataToVcalendar('EDIT',origUID, inputUID, $('#etag').val(), '', isFormHidden, deleteMode); } +/* START stackrpms 2022-08-10 + * uploadFile is a clone of addAndEdit + */ +function uploadFile(fileContents) +{ + var inputUID=''; + if($('#uid').val()!='') + var coll = globalResourceCalDAVList.getEventCollectionByUID($('#uid').val().substring(0, $('#uid').val().lastIndexOf('/')+1)); + else + var coll = globalResourceCalDAVList.getEventCollectionByUID($('#event_calendar').val()); + var res = getAccount(coll.accountUID); + var tmp=res.href.match(vCalendar.pre['hrefRex']); + var origUID=tmp[1]+res.userAuth.userName+'@'+tmp[2]; + if($('#etag').val()!='') + inputUID=$('#uid').val(); + else if($('#event_calendar').val()!='choose') + 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)); + // WORKHERE: Could also try adding inputUID+newUID. Not sure if it helps or hurts. + newEvent = stringToVevent(coll, fileContents, inputUID, $('#etag').val(), true); + console.log(newEvent); + console.log("All day:"); + console.log(newEvent.allDay); + console.log(newEvent.allDay); + // 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, + return putVcalendarToCollection(coll.accountUID, inputUID, "", fileContents, "", 'vevent', false, false, ""); + // WORKHERE: somehow add this to the globalEventList thing, like adding a brand-new event by hand? +} + function interResourceEdit(op, delUID,isFormHidden) { var inputUID=''; |