Merge branch 'master' into prevent_user_from_creating_or_renaming_to_an_existing_filename
Conflicts: apps/files/js/filelist.js
This commit is contained in:
commit
9019ad550f
3 changed files with 48 additions and 3 deletions
|
@ -252,9 +252,35 @@ var FileList={
|
|||
$('.creatable').toggleClass('hidden', !isCreatable);
|
||||
$('.notCreatable').toggleClass('hidden', isCreatable);
|
||||
},
|
||||
remove:function(name) {
|
||||
$('tr[data-file="'+name+'"]').find('td.filename').draggable('destroy');
|
||||
$('tr[data-file="'+name+'"]').remove();
|
||||
|
||||
/**
|
||||
* Shows/hides action buttons
|
||||
*
|
||||
* @param show true for enabling, false for disabling
|
||||
*/
|
||||
showActions: function(show){
|
||||
$('.actions,#file_action_panel').toggleClass('hidden', !show);
|
||||
if (show){
|
||||
// make sure to display according to permissions
|
||||
var permissions = $('#permissions').val();
|
||||
var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
|
||||
$('.creatable').toggleClass('hidden', !isCreatable);
|
||||
$('.notCreatable').toggleClass('hidden', isCreatable);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Enables/disables viewer mode.
|
||||
* In viewer mode, apps can embed themselves under the controls bar.
|
||||
* In viewer mode, the actions of the file list will be hidden.
|
||||
* @param show true for enabling, false for disabling
|
||||
*/
|
||||
setViewerMode: function(show){
|
||||
this.showActions(!show);
|
||||
$('#filestable').toggleClass('hidden', show);
|
||||
},
|
||||
remove:function(name){
|
||||
$('tr').filterAttr('data-file',name).find('td.filename').draggable('destroy');
|
||||
$('tr').filterAttr('data-file',name).remove();
|
||||
FileList.updateFileSummary();
|
||||
if ( ! $('tr[data-file]').exists() ) {
|
||||
$('#emptycontent').removeClass('hidden');
|
||||
|
|
|
@ -38,8 +38,15 @@ try {
|
|||
}
|
||||
OC_Group::addToGroup( $username, $i );
|
||||
}
|
||||
|
||||
// check whether the user's files home exists
|
||||
$userDirectory = OC_User::getHome($username) . '/files/';
|
||||
$homeExists = file_exists($userDirectory);
|
||||
|
||||
OC_JSON::success(array("data" =>
|
||||
array(
|
||||
// returns whether the home already existed
|
||||
"homeExists" => $homeExists,
|
||||
"username" => $username,
|
||||
"groups" => OC_Group::getUserGroups( $username ))));
|
||||
} catch (Exception $exception) {
|
||||
|
|
|
@ -467,6 +467,18 @@ $(document).ready(function () {
|
|||
var addedGroups = result.data.groups;
|
||||
UserList.availableGroups = $.unique($.merge(UserList.availableGroups, addedGroups));
|
||||
}
|
||||
if (result.data.homeExists){
|
||||
OC.Notification.hide();
|
||||
OC.Notification.show(t('settings', 'Warning: Home directory for user "{user}" already exists', {user: result.data.username}));
|
||||
if (UserList.notificationTimeout){
|
||||
window.clearTimeout(UserList.notificationTimeout);
|
||||
}
|
||||
UserList.notificationTimeout = window.setTimeout(
|
||||
function(){
|
||||
OC.Notification.hide();
|
||||
UserList.notificationTimeout = null;
|
||||
}, 10000);
|
||||
}
|
||||
if($('tr[data-uid="' + username + '"]').length === 0) {
|
||||
UserList.add(username, username, result.data.groups, null, 'default', true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue