Added some WebDAV draft code for Nextcloud plugin #96

This commit is contained in:
the-djmaze 2022-10-12 20:14:30 +02:00
parent 211600135d
commit 063ed7d844
2 changed files with 37 additions and 4 deletions

View file

@ -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
];
}
}

View file

@ -42,4 +42,33 @@
+ '<span class="g-ui-link" data-bind="click: saveNextcloud" data-i18n="NEXTCLOUD/SAVE_ATTACHMENTS">Save Nextcloud</span>'
+ '</span>'));
}
/** 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: '<?xml version="1.0"?>'
+ '<d:propfind xmlns:d="DAV:">'
+ '<d:prop><d:resourcetype/></d:prop>'
+ '</d:propfind>'
})
.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);