From 063ed7d844b966f9304a9e169629de8e7e454271 Mon Sep 17 00:00:00 2001
From: the-djmaze <>
Date: Wed, 12 Oct 2022 20:14:30 +0200
Subject: [PATCH] Added some WebDAV draft code for Nextcloud plugin #96
---
plugins/nextcloud/index.php | 12 ++++++++----
plugins/nextcloud/js/attachments.js | 29 +++++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/plugins/nextcloud/index.php b/plugins/nextcloud/index.php
index b67397a66..cb351e1e4 100644
--- a/plugins/nextcloud/index.php
+++ b/plugins/nextcloud/index.php
@@ -39,10 +39,6 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
}
/*
- $sUID = \OC::$server->getUserSession()->getUser()->getUID();
- WebDAV /nextcloud/remote.php/dav/files/$sUID/
- \OCP\Util::linkToRemote('files');
-
\OC::$server->getCalendarManager();
\OC::$server->getLDAPProvider();
\OC::$server->getAppDataDir('snappymail'); ??
@@ -106,6 +102,14 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
if (false !== $key) {
unset($aResult['Capa'][$key]);
}
+ $sUID = \OC::$server->getUserSession()->getUser()->getUID();
+ $sWebDAV = \OC::$server->getURLGenerator()->linkTo('', 'remote.php') . '/dav/';
+// $sWebDAV = \OCP\Util::linkToRemote('dav');
+ $aResult['Nextcloud'] = [
+ 'UID' => $sUID,
+ 'WebDAV' => $sWebDAV
+// 'WebDAV_files' => $sWebDAV . '/files/' . $sUID
+ ];
}
}
diff --git a/plugins/nextcloud/js/attachments.js b/plugins/nextcloud/js/attachments.js
index 2a3cf448c..1b438324e 100644
--- a/plugins/nextcloud/js/attachments.js
+++ b/plugins/nextcloud/js/attachments.js
@@ -42,4 +42,33 @@
+ 'Save Nextcloud'
+ ''));
}
+
+
+ /** TODO: File browser to attach files in composer */
+/*
+ let cfg = rl.settings.get('Nextcloud');
+ fetch(cfg.WebDAV . '/files/' . cfg.UID, {
+ method: 'PROPFIND',
+ mode: 'same-origin',
+ cache: 'no-cache',
+ redirect: 'error',
+ credentials: 'same-origin',
+ headers: {
+ 'Content-Type': 'application/xml; charset=utf-8',
+ },
+ body: ''
+ + ''
+ + ''
+ + ''
+ })
+ .then(response => response.text())
+ .then(text => {
+ console.dir({response:text});
+ parser = new DOMParser();
+ xmlDoc = parser.parseFromString(text, "text/xml");
+ })
+ .catch(error => console.error(error));
+*/
+
+
})(window.rl);