Commit f9c844af authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Better warnings when deleting files/folders


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent c8ede094
......@@ -249,23 +249,28 @@ function FileBrowser(idprefix, folderid, config, globalconfig) {
else if (name[1] == 'delete') {
var id = name[2];
var warn = '';
if (self.filedata[id].attachcount > 0) {
warn += get_string('fileattached', self.filedata[id].attachcount);
}
if (self.filedata[id].viewcount > 0) {
warn += ' ' + get_string('itemappearsinviews', self.filedata[id].viewcount);
}
if (self.filedata[id].artefacttype == 'folder') {
if (self.filedata[id].viewcount > 0) {
warn += get_string('folderappearsinviews') + ' ';
}
if (self.filedata[id].childcount > 0) {
warn += ' ' + get_string('foldernotempty');
warn += ' ' + get_string('confirmdeletefolderandcontents');
warn += get_string('foldernotempty') + ' ';
warn += get_string('confirmdeletefolderandcontents');
}
else if (warn != '') {
warn += ' ' + get_string('confirmdeletefolder');
warn += get_string('confirmdeletefolder');
}
}
else if (warn != '') {
warn += ' ' + get_string('confirmdeletefile');
else {
if (self.filedata[id].attachcount > 0) {
warn += get_string('fileattached', self.filedata[id].attachcount) + ' ';
}
if (self.filedata[id].viewcount > 0) {
warn += get_string('fileappearsinviews') + ' ';
}
if (warn != '') {
warn += get_string('confirmdeletefile');
}
}
if (warn != '') {
......
......@@ -61,6 +61,7 @@ $string['emptyfolder'] = 'Empty folder';
$string['file'] = 'File'; // Capitalised to be consistent with names of all the other artefact types
$string['File'] = 'File';
$string['filealreadyindestination'] = 'The file you moved is already in that folder';
$string['fileappearsinviews'] = 'This file appears in one or more of your views.';
$string['fileattached'] = 'This file is attached to %s other item(s) in your portfolio.';
$string['files'] = 'files';
$string['Files'] = 'Files';
......@@ -74,6 +75,7 @@ $string['filethingdeleted'] = '%s deleted';
$string['filewithnameexists'] = 'A file or folder with the name "%s" already exists.';
$string['folder'] = 'Folder';
$string['Folder'] = 'Folder';
$string['folderappearsinviews'] = 'This folder appears in one or more of your views.';
$string['Folders'] = 'Folders';
$string['foldernotempty'] = 'This folder is not empty.';
$string['foldercreated'] = 'Folder created';
......@@ -84,7 +86,6 @@ $string['home'] = 'Home';
$string['htmlremovedmessage'] = 'You are viewing <strong>%s</strong> by <a href="%s">%s</a>. The file displayed below has been filtered to remove malicious content, and is only a rough representation of the original.';
$string['htmlremovedmessagenoowner'] = 'You are viewing <strong>%s</strong>. The file displayed below has been filtered to remove malicious content, and is only a rough representation of the original.';
$string['image'] = 'Image';
$string['itemappearsinviews'] = 'This item appears in %s of your views.';
$string['lastmodified'] = 'Last Modified';
$string['myfiles'] = 'My Files';
$string['Name'] = 'Name';
......
......@@ -123,11 +123,12 @@ class PluginArtefactFile extends PluginArtefact {
'confirmdeletefolderandcontents',
'editfile',
'editfolder',
'fileappearsinviews',
'fileattached',
'filewithnameexists',
'folderappearsinviews',
'foldernamerequired',
'foldernotempty',
'itemappearsinviews',
'nametoolong',
'namefieldisrequired',
'uploadingfiletofolder',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment