Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Toolkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
digital blueprint
Web Component Framework
Toolkit
Commits
6ef6abfc
Commit
6ef6abfc
authored
4 years ago
by
Steinwender, Tamara
Browse files
Options
Downloads
Patches
Plain Diff
Right handlich and small bugfixes
parent
8a672812
No related branches found
No related tags found
1 merge request
!1
Filehandling overwrite dialog
Pipeline
#12621
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/file-handling/src/dbp-nextcloud-file-picker.js
+66
-24
66 additions, 24 deletions
packages/file-handling/src/dbp-nextcloud-file-picker.js
with
66 additions
and
24 deletions
packages/file-handling/src/dbp-nextcloud-file-picker.js
+
66
−
24
View file @
6ef6abfc
...
@@ -289,10 +289,17 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -289,10 +289,17 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this
.
directoryPath
=
path
;
this
.
directoryPath
=
path
;
// see https://github.com/perry-mitchell/webdav-client#getdirectorycontents
// see https://github.com/perry-mitchell/webdav-client#getdirectorycontents
if
(
typeof
this
.
webDavClient
===
"
undefined
"
&&
!
this
.
webDavClient
)
if
(
this
.
webDavClient
===
null
)
{
{
console
.
log
(
"
no client detected
"
);
// client is broken reload try to reset & reconnect
//todo load new client
this
.
tabulatorTable
.
clearData
();
this
.
webDavClient
=
null
;
// TODO Übersetzung
let
reloadButton
=
html
`Something went wrong. Please reload <button class="button"
title="
${
i18n
.
t
(
'
nextcloud-file-picker.refresh-nextcloud-file-picker
'
)}
"
@click="
${
async
()
=>
{
this
.
openFilePicker
();
}
}
"><dbp-icon name="reload"></button>`
;
this
.
loading
=
false
;
this
.
statusText
=
reloadButton
;
}
}
this
.
webDavClient
this
.
webDavClient
.
getDirectoryContents
(
path
,
{
details
:
true
,
data
:
"
<?xml version=
\"
1.0
\"
?>
"
+
.
getDirectoryContents
(
path
,
{
details
:
true
,
data
:
"
<?xml version=
\"
1.0
\"
?>
"
+
...
@@ -322,7 +329,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -322,7 +329,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
console
.
error
(
error
.
message
);
console
.
error
(
error
.
message
);
// on Error: try to reload with home directory
// on Error: try to reload with home directory
if
(
path
!=
"
/
"
){
if
(
path
!=
"
/
"
&&
this
.
webDavClient
!==
null
){
this
.
loadDirectory
(
"
/
"
);
this
.
loadDirectory
(
"
/
"
);
}
}
else
{
else
{
...
@@ -331,9 +338,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -331,9 +338,10 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this
.
isPickerActive
=
false
;
this
.
isPickerActive
=
false
;
}
}
// client is broken reload try to reset & reconnect
this
.
tabulatorTable
.
clearData
();
this
.
webDavClient
=
null
;
this
.
webDavClient
=
null
;
let
reloadButton
=
html
`<button class="button"
// TODO Übersetzung
let
reloadButton
=
html
`Something went wrong. Please reload <button class="button"
title="
${
i18n
.
t
(
'
nextcloud-file-picker.refresh-nextcloud-file-picker
'
)}
"
title="
${
i18n
.
t
(
'
nextcloud-file-picker.refresh-nextcloud-file-picker
'
)}
"
@click="
${
async
()
=>
{
this
.
openFilePicker
();
}
}
"><dbp-icon name="reload"></button>`
;
@click="
${
async
()
=>
{
this
.
openFilePicker
();
}
}
"><dbp-icon name="reload"></button>`
;
this
.
loading
=
false
;
this
.
loading
=
false
;
...
@@ -356,6 +364,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -356,6 +364,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}
}
downloadFiles
(
files
)
{
downloadFiles
(
files
)
{
this
.
tabulatorTable
.
deselectRow
();
files
.
forEach
((
fileData
)
=>
this
.
downloadFile
(
fileData
));
files
.
forEach
((
fileData
)
=>
this
.
downloadFile
(
fileData
));
}
}
...
@@ -387,7 +396,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -387,7 +396,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
}
}
sendDirectory
(
directory
)
{
sendDirectory
(
directory
)
{
this
.
tabulatorTable
.
deselectRow
();
let
path
;
let
path
;
if
(
!
directory
[
0
])
if
(
!
directory
[
0
])
...
@@ -436,7 +445,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -436,7 +445,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
//this.loading = false;
//this.loading = false;
//this.statusText = error.message;
//this.statusText = error.message;
console
.
log
(
"
--- h-
"
,
error
.
message
);
console
.
log
(
"
--- h-
"
,
error
.
message
);
if
(
error
.
message
.
search
(
"
412
"
)
!==
-
1
)
{
if
(
error
.
message
.
search
(
"
412
"
)
!==
-
1
||
error
.
message
.
search
(
"
403
"
)
!==
-
1
)
{
this
.
forAll
?
this
.
uploadFileAfterConflict
()
:
this
.
replaceModalDialog
(
file
,
directory
);
this
.
forAll
?
this
.
uploadFileAfterConflict
()
:
this
.
replaceModalDialog
(
file
,
directory
);
}
}
});
});
...
@@ -508,7 +517,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -508,7 +517,12 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
let
perm
=
0
;
let
perm
=
0
;
let
active_directory_perm
=
this
.
activeDirectoryRights
;
let
active_directory_perm
=
this
.
activeDirectoryRights
;
let
rows
=
this
.
tabulatorTable
.
searchRows
(
"
basename
"
,
"
=
"
,
this
.
replaceFilename
);
let
rows
=
this
.
tabulatorTable
.
searchRows
(
"
basename
"
,
"
=
"
,
this
.
replaceFilename
);
if
(
typeof
rows
[
0
]
!==
'
undefined
'
&&
rows
[
0
])
{
perm
=
rows
[
0
].
getData
().
props
.
permissions
;
perm
=
rows
[
0
].
getData
().
props
.
permissions
;
}
else
{
perm
=
""
;
}
console
.
log
(
"
RIGHTS IN THIS FOLDER:
"
,
this
.
activeDirectoryRights
);
console
.
log
(
"
RIGHTS IN THIS FOLDER:
"
,
this
.
activeDirectoryRights
);
console
.
log
(
"
RIGHT OF FILE:
"
,
perm
);
console
.
log
(
"
RIGHT OF FILE:
"
,
perm
);
...
@@ -516,38 +530,69 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -516,38 +530,69 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
console
.
log
(
"
RIGHTS IN THIS FOLDER:
"
,
this
.
activeDirectoryRights
);
console
.
log
(
"
RIGHTS IN THIS FOLDER:
"
,
this
.
activeDirectoryRights
);
console
.
log
(
"
RIGHT OF FILE:
"
,
perm
);
console
.
log
(
"
RIGHT OF FILE:
"
,
perm
);
/* ACL TODO Check if ACL > Permissions
// if I'm in an group or external folder take the acl permissions
// if I'm in an group or external folder take the acl permissions
if(this.activeDirectoryACL !== '')
if(this.activeDirectoryACL !== '')
{
{
console.log("ACL SET");
console.log("ACL SET");
active_directory_perm
=
this
.
activeDirectoryACL
;
active_directory_perm = "MG";
if(this.activeDirectoryACL & (1 << (3 - 1)))
{
active_directory_perm = "CK";
console.log("ACL CREATE");
}
if(this.activeDirectoryACL & (1 << (2 - 1)))
{
active_directory_perm += "NV";
console.log("ACL WRITE");
}
}
}
// if file has acl rights take that
if(typeof rows[0].getData().props['acl-list'] !== 'undefined' && rows[0].getData().props['acl-list'] &&
rows[0].getData().props['acl-list']['acl']['acl-permissions'] !== '')
{
console.log("FILE HAS ACL");
perm = "MG";
if(rows[0].getData().props['acl-list']['acl']['acl-permissions'] & (1 << (3 - 1)))
{
perm = "CK";
console.log("FILE ACL CREATE");
}
if(rows[0].getData().props['acl-list']['acl']['acl-permissions'] & (1 << (2 - 1)))
{
perm += "NV";
console.log("FILE ACL WRITE");
}
}
*/
// read only directory
// read only directory
if
(
active_directory_perm
===
"
MG
"
||
active_directory_perm
===
"
SG
"
)
if
(
active_directory_perm
===
"
MG
"
||
active_directory_perm
===
"
SG
"
||
(
active_directory_perm
===
"
RMGD
"
&&
perm
===
""
)
)
{
{
console
.
log
(
"
0
"
);
console
.
log
(
"
0
"
);
return
0
;
return
0
;
}
}
// read only file
// read only file
if
((
perm
===
'
SG
'
||
perm
===
'
MG
'
)
&&
!
active_directory_perm
.
includes
(
"
CK
"
)
)
if
((
perm
===
'
SG
'
||
perm
===
'
MG
'
||
perm
===
'
MG
'
||
perm
===
'
RMGD
'
||
perm
===
'
SGD
'
)
&&
!
active_directory_perm
.
includes
(
"
CK
"
)
)
{
{
console
.
log
(
"
0
"
);
console
.
log
(
"
0
"
);
return
0
;
return
0
;
}
}
// read only file
// read only file
if
((
perm
===
'
SG
'
||
perm
===
'
MG
'
)
&&
active_directory_perm
.
includes
(
"
CK
"
)
)
if
((
perm
===
'
SG
'
||
perm
===
'
MG
'
||
perm
===
'
RMGD
'
||
perm
===
'
SGD
'
)
&&
active_directory_perm
.
includes
(
"
CK
"
)
)
{
{
console
.
log
(
"
1
"
);
console
.
log
(
"
1
"
);
return
1
;
return
1
;
}
}
// only create and no edit
// only create and no edit
if
((
active_directory_perm
.
includes
(
"
CK
"
)
&&
!
active_directory_perm
.
includes
(
"
NV
"
))
||
(
active_directory_perm
.
includes
(
"
CK
"
)
&&
!
perm
.
includes
(
"
NV
"
)))
{
if
((
active_directory_perm
.
includes
(
"
CK
"
)
&&
!
active_directory_perm
.
includes
(
"
NV
"
)
&&
!
perm
.
includes
(
"
NV
"
)
)
||
(
active_directory_perm
.
includes
(
"
CK
"
)
&&
!
perm
.
includes
(
"
NV
"
)))
{
console
.
log
(
"
1
"
);
console
.
log
(
"
1
"
);
return
1
;
return
1
;
}
}
...
@@ -582,7 +627,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -582,7 +627,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this
.
_
(
"
#replace-new-name
"
).
removeAttribute
(
"
disabled
"
);
this
.
_
(
"
#replace-new-name
"
).
removeAttribute
(
"
disabled
"
);
this
.
_
(
"
#replace-replace
"
).
checked
=
false
;
this
.
_
(
"
#replace-replace
"
).
checked
=
false
;
this
.
_
(
"
#replace-new-name
"
).
checked
=
true
;
this
.
_
(
"
#replace-new-name
"
).
checked
=
true
;
this
.
disable
InputField
();
this
.
set
InputField
Visibility
();
this
.
_
(
"
#replace-new-name
"
).
focus
();
this
.
_
(
"
#replace-new-name
"
).
focus
();
}
}
...
@@ -593,7 +638,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -593,7 +638,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this
.
_
(
"
#replace-replace
"
).
removeAttribute
(
"
disabled
"
);
this
.
_
(
"
#replace-replace
"
).
removeAttribute
(
"
disabled
"
);
this
.
_
(
"
#replace-new-name
"
).
checked
=
false
;
this
.
_
(
"
#replace-new-name
"
).
checked
=
false
;
this
.
_
(
"
#replace-replace
"
).
checked
=
true
;
this
.
_
(
"
#replace-replace
"
).
checked
=
true
;
this
.
disable
InputField
();
this
.
set
InputField
Visibility
();
this
.
_
(
"
#replace-replace
"
).
focus
();
this
.
_
(
"
#replace-replace
"
).
focus
();
}
}
else
{
else
{
...
@@ -601,7 +646,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -601,7 +646,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
this
.
_
(
"
#replace-replace
"
).
removeAttribute
(
"
disabled
"
);
this
.
_
(
"
#replace-replace
"
).
removeAttribute
(
"
disabled
"
);
this
.
_
(
"
#replace-replace
"
).
checked
=
false
;
this
.
_
(
"
#replace-replace
"
).
checked
=
false
;
this
.
_
(
"
#replace-new-name
"
).
checked
=
true
;
this
.
_
(
"
#replace-new-name
"
).
checked
=
true
;
this
.
disable
InputField
();
this
.
set
InputField
Visibility
();
this
.
_
(
"
#replace-new-name
"
).
focus
();
this
.
_
(
"
#replace-new-name
"
).
focus
();
}
}
MicroModal
.
show
(
this
.
_
(
'
#replace-modal
'
));
MicroModal
.
show
(
this
.
_
(
'
#replace-modal
'
));
...
@@ -1198,11 +1243,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
...
@@ -1198,11 +1243,8 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
</label>
</label>
</div>
</div>
<div>
<div>
<<<<<<< HEAD
<input type="radio" id="replace-replace" class="radio-btn" name="replacement" value="replace" @click="
${()
=>
{
this
.
setInputFieldVisibility
();}}
">
<input type="radio" id="replace-replace" class="radio-btn" name="replacement" value="replace" @click="
${()
=>
{
this
.
disableInputField
();}}
">
=======
<input type="radio" class="radio-btn" name="replacement" value="replace" @click="
${()
=>
{
this
.
setInputFieldVisibility
();}}
">
>>>>>>> 5445f10e252841df29248c0c518597ca6264da56
<label for="replace">
${
i18n
.
t
(
'
nextcloud-file-picker.replace-replace
'
)}
</label>
<label for="replace">
${
i18n
.
t
(
'
nextcloud-file-picker.replace-replace
'
)}
</label>
</div>
</div>
<div>
<div>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment