From 81431ce6cce507535d871020fcb4c9b3844ffd4a Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Fri, 12 Aug 2022 14:53:46 +0000 Subject: Add upload functionality --- radicale_infcloud/web/interface.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'radicale_infcloud/web/interface.js') diff --git a/radicale_infcloud/web/interface.js b/radicale_infcloud/web/interface.js index e5afb8d..7f7304b 100644 --- a/radicale_infcloud/web/interface.js +++ b/radicale_infcloud/web/interface.js @@ -1289,6 +1289,33 @@ 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; + // Always generate new UID for imported event + var newUID=globalEventList.getNewUID(); + fileContents = fileContents.replace(/^UID:.*$/gm,String("UID:"+newUID)); + putVcalendarToCollection(coll.accountUID, inputUID, "", fileContents, "", 'vevent', false, false, ""); + return true; +} +/* STOP stackrpms */ + function interResourceEdit(op, delUID,isFormHidden) { var inputUID=''; -- cgit