$form.find('.message').prop('disabled', false);
if(!_.isUndefined(commentId)) {
- OC.Notification.showTemporary(t('comments', 'Error occurred while updating comment with id {id}', {id: commentId}));
+ OC.Notification.show(t('comments', 'Error occurred while updating comment with id {id}', {id: commentId}), {type: 'error'});
} else {
- OC.Notification.showTemporary(t('comments', 'Error occurred while posting comment'));
+ OC.Notification.show(t('comments', 'Error occurred while posting comment'), {type: 'error'});
}
},
var showHidden = $('#showHiddenFiles').val() === "1";
this.$showHiddenFiles.prop('checked', showHidden);
if ($('#fileNotFound').val() === "1") {
- OC.Notification.showTemporary(t('files', 'File could not be found'));
+ OC.Notification.show(t('files', 'File could not be found'), {type: 'error'});
}
this._filesConfig = new OC.Backbone.Model({
OCA.Files.App.initialize();
});
});
-
deferred.resolve();
return;
}
- OC.Notification.showTemporary(t('files', 'Could not create folder "{dir}"', {dir: fullPath}));
+ OC.Notification.show(t('files', 'Could not create folder "{dir}"', {dir: fullPath}), {type: 'error'});
deferred.reject();
});
}, function() {
},
showUploadCancelMessage: _.debounce(function() {
- OC.Notification.showTemporary(t('files', 'Upload cancelled.'), {timeout: 10});
+ OC.Notification.show(t('files', 'Upload cancelled.'), {timeout : 7, type: 'error'});
}, 500),
/**
* callback for the conflicts dialog
self.showConflict(upload);
} else if (status === 404) {
// target folder does not exist any more
- OC.Notification.showTemporary(
- t('files', 'Target folder "{dir}" does not exist any more', {dir: upload.getFullPath()})
- );
+ OC.Notification.show(t('files', 'Target folder "{dir}" does not exist any more', {dir: upload.getFullPath()} ), {type: 'error'});
self.cancelUploads();
} else if (status === 507) {
// not enough space
- OC.Notification.showTemporary(
- t('files', 'Not enough free space')
- );
+ OC.Notification.show(t('files', 'Not enough free space'), {type: 'error'});
self.cancelUploads();
} else {
// HTTP connection problem or other error
- OC.Notification.showTemporary(data.errorThrown, {timeout: 10});
+ OC.Notification.show(data.errorThrown, {type: 'error'});
}
if (upload) {
return this.fileUploadParam;
}
}, OC.Backbone.Events);
-
-
deferred.resolve(status, data);
})
.fail(function(status) {
- OC.Notification.showTemporary(t('files', 'Could not load info for file "{file}"', {file: self.get('name')}));
+ OC.Notification.show(t('files', 'Could not load info for file "{file}"', {file: self.get('name')}), {type: 'error'});
deferred.reject(status);
});
if (status === 403) {
// Go home
this.changeDirectory('/');
- OC.Notification.showTemporary(t('files', 'This operation is forbidden'));
+ OC.Notification.show(t('files', 'This operation is forbidden'), {type: 'error'});
return false;
}
if (status === 500) {
// Go home
this.changeDirectory('/');
- OC.Notification.showTemporary(
- t('files', 'This directory is unavailable, please check the logs or contact the administrator')
+ OC.Notification.show(t('files', 'This directory is unavailable, please check the logs or contact the administrator'),
+ {type: 'error'}
);
return false;
}
if (this.getCurrentDirectory() !== '/') {
this.changeDirectory('/');
// TODO: read error message from exception
- OC.Notification.showTemporary(
- t('files', 'Storage is temporarily not available')
+ OC.Notification.show(t('files', 'Storage is temporarily not available'),
+ {type: 'error'}
);
}
return false;
.fail(function(status) {
if (status === 412) {
// TODO: some day here we should invoke the conflict dialog
- OC.Notification.showTemporary(
- t('files', 'Could not move "{file}", target exists', {file: fileName})
+ OC.Notification.show(t('files', 'Could not move "{file}", target exists',
+ {file: fileName}), {type: 'error'}
);
} else {
- OC.Notification.showTemporary(
- t('files', 'Could not move "{file}"', {file: fileName})
+ OC.Notification.show(t('files', 'Could not move "{file}"',
+ {file: fileName}), {type: 'error'}
);
}
})
// TODO: 409 means current folder does not exist, redirect ?
if (status === 404) {
// source not found, so remove it from the list
- OC.Notification.showTemporary(
- t(
- 'files',
- 'Could not rename "{fileName}", it does not exist any more',
- {fileName: oldName}
- )
+ OC.Notification.show(t('files', 'Could not rename "{fileName}", it does not exist any more',
+ {fileName: oldName}), {timeout: 7, type: 'error'}
);
+
self.remove(newName, {updateSummary: true});
return;
} else if (status === 412) {
// target exists
- OC.Notification.showTemporary(
- t(
- 'files',
- 'The name "{targetName}" is already used in the folder "{dir}". Please choose a different name.',
- {
- targetName: newName,
- dir: self.getCurrentDirectory()
- }
- )
+ OC.Notification.show(
+ t('files', 'The name "{targetName}" is already used in the folder "{dir}". Please choose a different name.',
+ {
+ targetName: newName,
+ dir: self.getCurrentDirectory(),
+ }),
+ {
+ type: 'error'
+ }
);
} else {
// restore the item to its previous state
- OC.Notification.showTemporary(
- t('files', 'Could not rename "{fileName}"', {fileName: oldName})
+ OC.Notification.show(t('files', 'Could not rename "{fileName}"',
+ {fileName: oldName}), {type: 'error'}
);
}
updateInList(oldFileInfo);
self.addAndFetchFileInfo(targetPath, '', {scrollTo: true}).then(function(status, data) {
deferred.resolve(status, data);
}, function() {
- OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name}));
+ OC.Notification.show(t('files', 'Could not create file "{file}"',
+ {file: name}), {type: 'error'}
+ );
});
})
.fail(function(status) {
if (status === 412) {
- OC.Notification.showTemporary(
- t('files', 'Could not create file "{file}" because it already exists', {file: name})
+ OC.Notification.show(t('files', 'Could not create file "{file}" because it already exists',
+ {file: name}), {type: 'error'}
);
} else {
- OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name}));
+ OC.Notification.show(t('files', 'Could not create file "{file}"',
+ {file: name}), {type: 'error'}
+ );
}
deferred.reject(status);
});
self.addAndFetchFileInfo(targetPath, '', {scrollTo:true}).then(function(status, data) {
deferred.resolve(status, data);
}, function() {
- OC.Notification.showTemporary(t('files', 'Could not create folder "{dir}"', {dir: name}));
+ OC.Notification.show(t('files', 'Could not create folder "{dir}"',
+ {dir: name}), {type: 'error'}
+ );
});
})
.fail(function(createStatus) {
// add it to the list, for completeness
self.addAndFetchFileInfo(targetPath, '', {scrollTo:true})
.done(function(status, data) {
- OC.Notification.showTemporary(
- t('files', 'Could not create folder "{dir}" because it already exists', {dir: name})
+ OC.Notification.show(t('files', 'Could not create folder "{dir}" because it already exists',
+ {dir: name}), {type: 'error'}
);
// still consider a failure
deferred.reject(createStatus, data);
})
.fail(function() {
- OC.Notification.showTemporary(
- t('files', 'Could not create folder "{dir}"', {dir: name})
+ OC.Notification.show(t('files', 'Could not create folder "{dir}"',
+ {dir: name}), {type: 'error'}
);
deferred.reject(status);
});
} else {
- OC.Notification.showTemporary(t('files', 'Could not create folder "{dir}"', {dir: name}));
+ OC.Notification.show(t('files', 'Could not create folder "{dir}"',
+ {dir: name}), {type: 'error'}
+ );
deferred.reject(createStatus);
}
});
deferred.resolve(status, data);
})
.fail(function(status) {
- OC.Notification.showTemporary(t('files', 'Could not create file "{file}"', {file: name}));
+ OC.Notification.show(t('files', 'Could not create file "{file}"',
+ {file: name}), {type: 'error'}
+ );
deferred.reject(status);
});
removeFromList(file);
} else {
// only reset the spinner for that one file
- OC.Notification.showTemporary(
- t('files', 'Error deleting file "{fileName}".', {fileName: file}),
- {timeout: 10}
+ OC.Notification.show(t('files', 'Error deleting file "{fileName}".',
+ {fileName: file}), {type: 'error'}
);
var deleteAction = self.findFileEl(file).find('.action.delete');
deleteAction.removeClass('icon-loading-small').addClass('icon-delete');
*/
_showPermissionDeniedNotification: function() {
var message = t('core', 'You don’t have permission to upload or create files here');
- OC.Notification.showTemporary(message);
+ OC.Notification.show(message, {type: 'error'});
},
/**
ownerDisplayName = $('#ownerDisplayName').val();
if (usedSpacePercent > 98) {
if (owner !== oc_current_user) {
- OC.Notification.showTemporary(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!',
- { owner: ownerDisplayName }));
+ OC.Notification.show(t('files', 'Storage of {owner} is full, files can not be updated or synced anymore!',
+ {owner: ownerDisplayName}), {type: 'error'}
+ );
return;
}
- OC.Notification.show(t('files', 'Your storage is full, files can not be updated or synced anymore!'));
+ OC.Notification.show(t('files',
+ 'Your storage is full, files can not be updated or synced anymore!'),
+ {type : 'error'}
+ );
return;
}
if (usedSpacePercent > 90) {
if (owner !== oc_current_user) {
- OC.Notification.showTemporary(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)',
- { usedSpacePercent: usedSpacePercent, owner: ownerDisplayName }));
+ OC.Notification.show(t('files', 'Storage of {owner} is almost full ({usedSpacePercent}%)',
+ {
+ usedSpacePercent: usedSpacePercent,
+ owner: ownerDisplayName
+ }),
+ {
+ type: 'error'
+ }
+ );
return;
}
OC.Notification.show(t('files', 'Your storage is almost full ({usedSpacePercent}%)',
- {usedSpacePercent: usedSpacePercent}));
+ {usedSpacePercent: usedSpacePercent}),
+ {type : 'error'}
+ );
}
},
if(response.responseJSON && response.responseJSON.message) {
message = ': ' + response.responseJSON.message;
}
- OC.Notification.showTemporary(t('files', 'An error occurred while trying to update the tags') + message);
+ OC.Notification.show(t('files', 'An error occurred while trying to update the tags' + message), {type: 'error'});
toggleStar($actionEl, isFavorite);
});
}
useHTTPS: false
});
redirectStub = sinon.stub(OC, 'redirect');
- notificationStub = sinon.stub(OC.Notification, 'showTemporary');
+ notificationStub = sinon.stub(OC.Notification, 'show');
// prevent resize algo to mess up breadcrumb order while
// testing
bcResizeStub = sinon.stub(OCA.Files.BreadCrumb.prototype, '_resize');
},
error: function (jqxhr, state, error) {
self.mountPointList = [];
- OC.Notification.showTemporary(t('files_external', 'Couldn\'t get the list of external mount points: {type}', {type: error}));
+ OC.Notification.show(t('files_external', 'Couldn\'t get the list of external mount points: {type}',
+ {type: error}), {type: 'error'}
+ );
},
complete: function () {
self.isGetMountPointListRunning = false;
// check if we have a list first
if (list === undefined && !self.emptyWarningShown) {
self.emptyWarningShown = true;
- OC.Notification.showTemporary(t('files_external', 'Couldn\'t get the list of Windows network drive mount points: empty response from the server'));
+ OC.Notification.show(t('files_external', 'Couldn\'t get the list of Windows network drive mount points: empty response from the server'),
+ {type: 'error'}
+ );
return;
}
if (list && list.length > 0) {
}
});
if (showNotification) {
- OC.Notification.showTemporary(t('files_external', 'Some of the configured external mount points are not connected. Please click on the red row(s) for more information'));
+ OC.Notification.show(t('files_external', 'Some of the configured external mount points are not connected. Please click on the red row(s) for more information'),
+ {type: 'error'}
+ );
}
}
});
}
},
success: function (data) {
- OC.Notification.showTemporary(t('files_external', 'Credentials saved'));
+ OC.Notification.show(t('files_external', 'Credentials saved'), {type: 'error'});
dialog.ocdialog('close');
/* Trigger status check again */
OCA.External.StatusManager.recheckConnectivityForMount([OC.basename(data.mountPoint)], true);
},
error: function () {
$('.oc-dialog-close').show();
- OC.Notification.showTemporary(t('files_external', 'Credentials saving failed'));
+ OC.Notification.show(t('files_external', 'Credentials saving failed'), {type: 'error'});
}
});
return false;
fileInfoModel.trigger('busy', fileInfoModel, false);
self.$el.find('.versions').removeClass('hidden');
self._toggleLoading(false);
- OC.Notification.showTemporary(
- t('files_version', 'Failed to revert {file} to revision {timestamp}.', {
+ OC.Notification.show(t('files_version', 'Failed to revert {file} to revision {timestamp}.',
+ {
file: versionModel.getFullPath(),
timestamp: OC.Util.formatDate(versionModel.get('timestamp') * 1000)
- })
+ }),
+ {
+ type: 'error'
+ }
);
}
});
expect(changes.etag).toBeDefined();
});
it('shows notification on revert error', function() {
- var notificationStub = sinon.stub(OC.Notification, 'showTemporary');
+ var notificationStub = sinon.stub(OC.Notification, 'show');
tabView.$el.find('.revertVersion').eq(1).click();
var text = t('core', '{version} is available. Get more information on how to update.', {version: oc_updateState.updateVersion}),
element = $('<a>').attr('href', oc_updateState.updateLink).attr('target','_blank').text(text);
- OC.Notification.showTemporary(
- element,
+ OC.Notification.show(element,
{
- isHTML: true
+ isHTML: true,
+ type: 'error'
}
);
});
-