Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
47863279
Commit
47863279
authored
12 years ago
by
Thomas Müller
Browse files
Options
Downloads
Plain Diff
Merge pull request #1225 from owncloud/add_multiselect_dnd
add multselect dnd
parents
bb48e0bb
81a398c2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
apps/files/ajax/move.php
+3
-3
3 additions, 3 deletions
apps/files/ajax/move.php
apps/files/css/files.css
+11
-0
11 additions, 0 deletions
apps/files/css/files.css
apps/files/js/files.js
+105
-23
105 additions, 23 deletions
apps/files/js/files.js
with
119 additions
and
26 deletions
apps/files/ajax/move.php
+
3
−
3
View file @
47863279
...
...
@@ -7,9 +7,9 @@ OCP\JSON::checkLoggedIn();
OCP\JSON
::
callCheck
();
// Get data
$dir
=
stripslashes
(
$_
GE
T
[
"dir"
]);
$file
=
stripslashes
(
$_
GE
T
[
"file"
]);
$target
=
stripslashes
(
rawurldecode
(
$_
GE
T
[
"target"
]));
$dir
=
stripslashes
(
$_
POS
T
[
"dir"
]);
$file
=
stripslashes
(
$_
POS
T
[
"file"
]);
$target
=
stripslashes
(
rawurldecode
(
$_
POS
T
[
"target"
]));
$l
=
OC_L10N
::
get
(
'files'
);
...
...
This diff is collapsed.
Click to expand it.
apps/files/css/files.css
+
11
−
0
View file @
47863279
...
...
@@ -122,3 +122,14 @@ a.action>img { max-height:16px; max-width:16px; vertical-align:text-bottom; }
#scanning-message
{
top
:
40%
;
left
:
40%
;
position
:
absolute
;
display
:
none
;
}
div
.crumb
a
{
padding
:
0.9em
0
0.7em
0
;
}
table
.dragshadow
{
width
:
auto
;
}
table
.dragshadow
td
.filename
{
padding-left
:
36px
;
padding-right
:
16px
;
}
table
.dragshadow
td
.size
{
padding-right
:
8px
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
apps/files/js/files.js
+
105
−
23
View file @
47863279
...
...
@@ -813,32 +813,101 @@ function updateBreadcrumb(breadcrumbHtml) {
$
(
'
p.nav
'
).
empty
().
html
(
breadcrumbHtml
);
}
//options for file drag/dropp
var
createDragShadow
=
function
(
event
){
//select dragged file
var
isDragSelected
=
$
(
event
.
target
).
parents
(
'
tr
'
).
find
(
'
td input:first
'
).
prop
(
'
checked
'
);
if
(
!
isDragSelected
)
{
//select dragged file
$
(
event
.
target
).
parents
(
'
tr
'
).
find
(
'
td input:first
'
).
prop
(
'
checked
'
,
true
);
}
var
selectedFiles
=
getSelectedFiles
();
if
(
!
isDragSelected
&&
selectedFiles
.
length
==
1
)
{
//revert the selection
$
(
event
.
target
).
parents
(
'
tr
'
).
find
(
'
td input:first
'
).
prop
(
'
checked
'
,
false
);
}
//also update class when we dragged more than one file
if
(
selectedFiles
.
length
>
1
)
{
$
(
event
.
target
).
parents
(
'
tr
'
).
addClass
(
'
selected
'
);
}
// build dragshadow
var
dragshadow
=
$
(
'
<table class="dragshadow"></table>
'
);
var
tbody
=
$
(
'
<tbody></tbody>
'
);
dragshadow
.
append
(
tbody
);
var
dir
=
$
(
'
#dir
'
).
val
();
$
(
selectedFiles
).
each
(
function
(
i
,
elem
){
var
newtr
=
$
(
'
<tr data-dir="
'
+
dir
+
'
" data-filename="
'
+
elem
.
name
+
'
">
'
+
'
<td class="filename">
'
+
elem
.
name
+
'
</td><td class="size">
'
+
humanFileSize
(
elem
.
size
)
+
'
</td>
'
+
'
</tr>
'
);
tbody
.
append
(
newtr
);
if
(
elem
.
type
===
'
dir
'
)
{
newtr
.
find
(
'
td.filename
'
).
attr
(
'
style
'
,
'
background-image:url(
'
+
OC
.
imagePath
(
'
core
'
,
'
filetypes/folder.png
'
)
+
'
)
'
);
}
else
{
getMimeIcon
(
elem
.
mime
,
function
(
path
){
newtr
.
find
(
'
td.filename
'
).
attr
(
'
style
'
,
'
background-image:url(
'
+
path
+
'
)
'
);
});
}
});
return
dragshadow
;
}
//options for file drag/drop
var
dragOptions
=
{
distance
:
20
,
revert
:
'
invalid
'
,
opacity
:
0.7
,
helper
:
'
clone
'
,
revert
:
'
invalid
'
,
revertDuration
:
300
,
opacity
:
0.7
,
zIndex
:
100
,
appendTo
:
'
body
'
,
cursorAt
:
{
left
:
-
5
,
top
:
-
5
},
helper
:
createDragShadow
,
cursor
:
'
move
'
,
stop
:
function
(
event
,
ui
)
{
$
(
'
#fileList tr td.filename
'
).
addClass
(
'
ui-draggable
'
);
}
};
}
var
folderDropOptions
=
{
drop
:
function
(
event
,
ui
)
{
var
file
=
ui
.
draggable
.
parent
().
data
(
'
file
'
);
var
target
=
$
(
this
).
find
(
'
.nametext
'
).
text
().
trim
();
var
dir
=
$
(
'
#dir
'
).
val
();
$
.
ajax
({
url
:
OC
.
filePath
(
'
files
'
,
'
ajax
'
,
'
move.php
'
),
data
:
"
dir=
"
+
encodeURIComponent
(
dir
)
+
"
&file=
"
+
encodeURIComponent
(
file
)
+
'
&target=
'
+
encodeURIComponent
(
dir
)
+
'
/
'
+
encodeURIComponent
(
target
),
complete
:
function
(
data
){
boolOperationFinished
(
data
,
function
(){
var
el
=
$
(
'
#fileList tr
'
).
filterAttr
(
'
data-file
'
,
file
).
find
(
'
td.filename
'
);
el
.
draggable
(
'
destroy
'
);
FileList
.
remove
(
file
);
});}
//don't allow moving a file into a selected folder
if
(
$
(
event
.
target
).
parents
(
'
tr
'
).
find
(
'
td input:first
'
).
prop
(
'
checked
'
)
===
true
)
{
return
false
;
}
var
target
=
$
.
trim
(
$
(
this
).
find
(
'
.nametext
'
).
text
());
var
files
=
ui
.
helper
.
find
(
'
tr
'
);
$
(
files
).
each
(
function
(
i
,
row
){
var
dir
=
$
(
row
).
data
(
'
dir
'
);
var
file
=
$
(
row
).
data
(
'
filename
'
);
$
.
post
(
OC
.
filePath
(
'
files
'
,
'
ajax
'
,
'
move.php
'
),
{
dir
:
dir
,
file
:
file
,
target
:
dir
+
'
/
'
+
target
},
function
(
result
)
{
if
(
result
)
{
if
(
result
.
status
===
'
success
'
)
{
//recalculate folder size
var
oldSize
=
$
(
'
#fileList tr
'
).
filterAttr
(
'
data-file
'
,
target
).
data
(
'
size
'
);
var
newSize
=
oldSize
+
$
(
'
#fileList tr
'
).
filterAttr
(
'
data-file
'
,
file
).
data
(
'
size
'
);
$
(
'
#fileList tr
'
).
filterAttr
(
'
data-file
'
,
target
).
data
(
'
size
'
,
newSize
);
$
(
'
#fileList tr
'
).
filterAttr
(
'
data-file
'
,
target
).
find
(
'
td.filesize
'
).
text
(
humanFileSize
(
newSize
));
FileList
.
remove
(
file
);
procesSelection
();
$
(
'
#notification
'
).
hide
();
}
else
{
$
(
'
#notification
'
).
hide
();
$
(
'
#notification
'
).
text
(
result
.
data
.
message
);
$
(
'
#notification
'
).
fadeIn
();
}
}
else
{
OC
.
dialogs
.
alert
(
t
(
'
Error moving file
'
));
}
});
});
}
},
tolerance
:
'
pointer
'
}
var
crumbDropOptions
=
{
drop
:
function
(
event
,
ui
)
{
var
file
=
ui
.
draggable
.
parent
().
data
(
'
file
'
);
var
target
=
$
(
this
).
data
(
'
dir
'
);
var
dir
=
$
(
'
#dir
'
).
val
();
while
(
dir
.
substr
(
0
,
1
)
==
'
/
'
){
//remove extra leading /'s
...
...
@@ -851,12 +920,25 @@ var crumbDropOptions={
if
(
target
==
dir
||
target
+
'
/
'
==
dir
){
return
;
}
$
.
ajax
({
url
:
OC
.
filePath
(
'
files
'
,
'
ajax
'
,
'
move.php
'
),
data
:
"
dir=
"
+
encodeURIComponent
(
dir
)
+
"
&file=
"
+
encodeURIComponent
(
file
)
+
'
&target=
'
+
encodeURIComponent
(
target
),
complete
:
function
(
data
){
boolOperationFinished
(
data
,
function
(){
FileList
.
remove
(
file
);
});}
var
files
=
ui
.
helper
.
find
(
'
tr
'
);
$
(
files
).
each
(
function
(
i
,
row
){
var
dir
=
$
(
row
).
data
(
'
dir
'
);
var
file
=
$
(
row
).
data
(
'
filename
'
);
$
.
post
(
OC
.
filePath
(
'
files
'
,
'
ajax
'
,
'
move.php
'
),
{
dir
:
dir
,
file
:
file
,
target
:
target
},
function
(
result
)
{
if
(
result
)
{
if
(
result
.
status
===
'
success
'
)
{
FileList
.
remove
(
file
);
procesSelection
();
$
(
'
#notification
'
).
hide
();
}
else
{
$
(
'
#notification
'
).
hide
();
$
(
'
#notification
'
).
text
(
result
.
data
.
message
);
$
(
'
#notification
'
).
fadeIn
();
}
}
else
{
OC
.
dialogs
.
alert
(
t
(
'
Error moving file
'
));
}
});
});
},
tolerance
:
'
pointer
'
...
...
@@ -963,7 +1045,7 @@ function getUniqueName(name){
num
=
parseInt
(
numMatch
[
numMatch
.
length
-
1
])
+
1
;
base
=
base
.
split
(
'
(
'
)
base
.
pop
();
base
=
base
.
join
(
'
(
'
)
.
trim
(
);
base
=
$
.
trim
(
base
.
join
(
'
(
'
));
}
name
=
base
+
'
(
'
+
num
+
'
)
'
;
if
(
extension
)
{
...
...
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