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
825d92d5
Commit
825d92d5
authored
12 years ago
by
Sam Tuke
Browse files
Options
Downloads
Patches
Plain Diff
Added undo functionality to delete user procedure on user settings page
parent
6d3afb38
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
settings/js/users.js
+87
-9
87 additions, 9 deletions
settings/js/users.js
settings/templates/users.php
+2
-0
2 additions, 0 deletions
settings/templates/users.php
with
89 additions
and
9 deletions
settings/js/users.js
+
87
−
9
View file @
825d92d5
...
...
@@ -4,6 +4,72 @@
* See the COPYING-README file.
*/
UserList
=
{
useUndo
:
true
,
/**
* @brief Initiate user deletion process in UI
* @param string uid the user ID to be deleted
*
* Does not actually delete the user; it sets them for
* deletion when the current page is unloaded, at which point
* finishDelete() completes the process. This allows for 'undo'.
*/
do_delete
:
function
(
uid
)
{
UserList
.
deleteUid
=
uid
;
// Set undo flag
UserList
.
deleteCanceled
=
false
;
// Hide user in table to reflect deletion
$
(
this
).
parent
().
parent
().
hide
();
$
(
'
tr
'
).
filterAttr
(
'
data-uid
'
,
UserList
.
deleteUid
).
hide
();
// Provide user with option to undo
$
(
'
#notification
'
).
text
(
t
(
'
files
'
,
'
undo delete user
'
));
$
(
'
#notification
'
).
data
(
'
deleteuser
'
,
true
);
$
(
'
#notification
'
).
fadeIn
();
},
/**
* @brief Delete a user via ajax
* @param bool ready whether to use ready() upon completion
*
* Executes deletion via ajax of user identified by property deleteUid
* if 'undo' has not been used. Completes the user deletion procedure
* and reflects success in UI.
*/
finishDelete
:
function
(
ready
){
// Check deletion has not been undone
if
(
!
UserList
.
deleteCanceled
&&
UserList
.
deleteUid
){
// Delete user via ajax
$
.
post
(
OC
.
filePath
(
'
settings
'
,
'
ajax
'
,
'
removeuser.php
'
),
{
username
:
UserList
.
deleteUid
},
function
(
result
){
// Remove undo option, & remove user from table
boolOperationFinished
(
data
,
function
(){
$
(
'
#notification
'
).
fadeOut
();
$
(
'
tr
'
).
filterAttr
(
'
data-uid
'
,
username
).
remove
();
UserList
.
deleteCanceled
=
true
;
UserList
.
deleteFiles
=
null
;
if
(
ready
){
ready
();
}
}
);
}
);
}
}
}
$
(
document
).
ready
(
function
(){
function
setQuota
(
uid
,
quota
,
ready
){
$
.
post
(
...
...
@@ -61,15 +127,12 @@ $(document).ready(function(){
});
$
(
'
td.remove>img
'
).
live
(
'
click
'
,
function
(
event
){
var
uid
=
$
(
this
).
parent
().
parent
().
data
(
'
uid
'
);
$
.
post
(
OC
.
filePath
(
'
settings
'
,
'
ajax
'
,
'
removeuser.php
'
),
{
username
:
uid
},
function
(
result
){
}
);
$
(
this
).
parent
().
parent
().
remove
();
var
uid
=
$
(
this
).
parent
().
parent
().
data
(
'
uid
'
);
// Call function for handling delete/undo
UserList
.
do_delete
(
uid
);
});
$
(
'
td.password>img
'
).
live
(
'
click
'
,
function
(
event
){
...
...
@@ -222,4 +285,19 @@ $(document).ready(function(){
}
);
});
// Handle undo notifications
$
(
'
#notification
'
).
hide
();
$
(
'
#notification
'
).
click
(
function
(){
if
(
$
(
'
#notification
'
).
data
(
'
deleteuser
'
))
{
$
(
'
tr
'
).
filterAttr
(
'
data-uid
'
,
UserList
.
deleteUid
).
show
();
UserList
.
deleteCanceled
=
true
;
UserList
.
deleteFiles
=
null
;
}
$
(
'
#notification
'
).
fadeOut
();
});
UserList
.
useUndo
=
(
'
onbeforeunload
'
in
window
)
$
(
window
).
bind
(
'
beforeunload
'
,
function
(){
UserList
.
finishDelete
(
null
);
});
});
This diff is collapsed.
Click to expand it.
settings/templates/users.php
+
2
−
0
View file @
825d92d5
...
...
@@ -52,6 +52,8 @@ foreach($_["groups"] as $group) {
</div>
</div>
<div
id=
'notification'
></div>
<table
data-groups=
"
<?php
echo
implode
(
', '
,
$allGroups
);
?>
"
>
<thead>
<tr>
...
...
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