Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

DriveParentCollab - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Changes for page DriveParentCollab

Last modified by bougault on 2022/01/07 11:03

From version 12.1
edited by bougault
on 2022/01/07 10:02
Change comment: There is no comment for this version
To version 7.1
edited by bougault
on 2022/01/05 15:46
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,1 +1,35 @@
1 -[[redirect from drive id fa50ac02-67cc-4d94-9c90-07da5fefbfde >>https://wiki-dev.ebrains.eu/bin/view/Collaboratory/Apps/DriveToCollabRedirect#fa50ac02-67cc-4d94-9c90-07da5fefbfde]]
1 +{{html clean="false"}}
2 +
3 +<label for="driveURL">Drive document url</label>
4 +<input type="text" id="driveURL" placeholder="Put drive document url here" />
5 +<button id="opencollab">Open Collab</button>
6 +<script>
7 +(function() {
8 + window.addEventListener("DOMContentLoaded", function() {
9 + const openCollabButton = document.getElementById("opencollab");
10 + openCollabButton.addEventListener("click", findCollab);
11 + });
12 + function findCollab() {
13 + const driveURL = document.getElementById("driveURL");
14 + const driveId = getDriveId(driveURL.value);
15 + if(driveId) {
16 + console.log('Perform request with id:', driveId);
17 + fetch(`/rest/v1/collabs?driveId=${driveId}`)
18 + .then(res => res.json())
19 + .then(json => {
20 + console.log(json);
21 + const { link } = json;
22 + console.log(link)
23 +// window.location.pathname = link;
24 + })
25 + }
26 + }
27 + function getDriveId(driveURL) {
28 + const url = new URL(driveURL);
29 + const re = /\/(library|lib)\/([^/]*)\/.*/;
30 + const id = re.exec(url.pathname)[2];
31 + return id;
32 + }
33 +})();
34 +</script>
35 +{{/html}}