Commit 6745acfb authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Copyright notice added on file upload

parent bb9482d2
......@@ -29,22 +29,17 @@ define('MENUITEM', 'myfiles');
require(dirname(dirname(dirname(__FILE__))) . '/init.php');
safe_require('artefact', 'file');
$strings = array('cancel', 'delete', 'description', 'edit', 'editfile', 'editfolder',
'home', 'name', 'nofilesfound', 'savechanges');
$getstring = array();
foreach ($strings as $string) {
$getstring[$string] = "'" . get_string($string) . "'";
}
$copyright = get_field('site_content', 'content', 'name', 'uploadcopyright');
$javascript = <<<JAVASCRIPT
var copyrightnotice = '{$copyright}';
var browser = new FileBrowser('filelist');
var uploader = new FileUploader('uploader', null, null, browser.refresh, browser.fileexists);
browser.changedircallback = uploader.updatedestination;
JAVASCRIPT;
$smarty = smarty(array('tablerenderer',
'artefact/file/js/filebrowser.js',
'artefact/file/js/uploader.js'));
......
......@@ -54,12 +54,16 @@ function FileUploader(element, foldername, folderid, uploadcallback, fileexists)
hideElement(self.form);
showElement(self.openbutton);
};
var notice = SPAN(null);
notice.innerHTML = copyrightnotice;
appendChildNodes(form,
TABLE(null,
TBODY(null,
TR(null, TH({'colSpan':2}, LABEL(null, get_string('uploadfile')))),
TR(null, TH(null, LABEL(null, get_string('destination'))),
TD(null, SPAN({'id':'uploaddest'},self.foldername))),
TR(null, TH(null,LABEL(null,get_string('copyrightnotice'))),
TD(null,INPUT({'type':'checkbox','name':'notice'}),notice)),
TR(null, TH(null, LABEL(null, get_string('file'))),
TD(null, INPUT({'type':'file','name':'userfile','size':40,'onchange':function () {
self.form.title.value = self.filepart(self.form.userfile.value);
......@@ -90,6 +94,10 @@ function FileUploader(element, foldername, folderid, uploadcallback, fileexists)
}
this.sendform = function (replacefile) {
if (!self.form.notice.checked) {
$('uploadformmessage').innerHTML = get_string('youmustagreetothecopyrightnotice');
return;
}
var localname = self.form.userfile.value;
if (isEmpty(localname)) {
$('uploadformmessage').innerHTML = get_string('filenamefieldisrequired');
......
......@@ -26,6 +26,7 @@
defined('INTERNAL') || die();
$string['copyrightnotice'] = 'Copyright notice';
$string['create'] = 'Create';
$string['createfolder'] = 'Create folder';
$string['deletefile?'] = 'Are you sure you want to delete this file?';
......@@ -34,27 +35,27 @@ $string['description'] = 'Description';
$string['destination'] = 'Destination';
$string['editfile'] = 'Edit file';
$string['editfolder'] = 'Edit folder';
$string['file'] = 'file';
$string['File'] = 'File';
$string['file'] = 'File';
$string['fileexistsoverwritecancel'] = 'A file with that name already exists. You can rename the file you are about to upload, or overwrite the existing file.';
$string['filenamefieldisrequired'] = 'File field is required';
$string['filenamefieldisrequired'] = 'The file field is required';
$string['folder'] = 'folder';
$string['home'] = 'Home';
$string['image'] = 'image';
$string['myfiles'] = 'My Files';
$string['name'] = 'Name';
$string['namefieldisrequired'] = 'Name field is required';
$string['namefieldisrequired'] = 'The name field is required';
$string['nofilesfound'] = 'No files found';
$string['overwrite'] = 'Overwrite';
$string['savechanges'] = 'Save changes';
$string['size'] = 'Size';
$string['title'] = 'Name';
$string['titlefieldisrequired'] = 'Name field is required';
$string['titlefieldisrequired'] = 'The name field is required';
$string['upload'] = 'Upload';
$string['uploadcomplete'] = 'Upload complete';
$string['uploadfailed'] = 'Upload failed';
$string['uploadfile'] = 'Upload file';
$string['uploadfileexistsoverwritecancel'] = 'A file with that name already exists. You can rename the file you are about to upload, or overwrite the existing file.';
$string['uploading'] = 'Uploading';
$string['youmustagreetothecopyrightnotice'] = 'You must agree to the copyright notice';
?>
......@@ -67,6 +67,7 @@ class PluginArtefactFile extends PluginArtefact {
static $jsstrings = array(
'uploader' => array(
'cancel' => 'mahara',
'copyrightnotice' => 'artefact.file',
'description' => 'artefact.file',
'destination' => 'artefact.file',
'file' => 'artefact.file',
......@@ -81,6 +82,7 @@ class PluginArtefactFile extends PluginArtefact {
'uploadfile' => 'artefact.file',
'uploadfileexistsoverwritecancel' => 'artefact.file',
'uploading' => 'artefact.file',
'youmustagreetothecopyrightnotice' => 'artefact.file',
),
'filebrowser' => array(
'cancel' => 'mahara',
......
......@@ -116,6 +116,6 @@ $string['termsandconditionsdefaultcontent'] = '<p>Terms and Conditions</p>
<p>Inappropriate behaviour includes misuse of the objectionable material reporting system, intentionally attempting to load files with virus content, placing objectionable or excessive feedback or comments on any other users portfolio and any other behaviour deemed to be nuisance or offensive by the Site Administrator.</p>
<p>Any unsolicited contact you receive as a result of personal information you have publicly released via your portfolio is your responsibility, however any misconduct in behaviour from users of the system should be reported to the Site Administrator | <a href="contact.php">Contact Us</a> immediately. We may occasionally make minor adjustments to our Terms and Condition to reflect changes to the system and in response to user feedback. As such we suggest you check the Terms and Conditions each time you visit this site. We will however notify users of any major changes to the Terms and Conditions via the [eP Site Name] homepage.</p>';
$string['uploadcopyrightdefaultcontent'] = '<p>Yes: The file I am attempting to upload is my own or I have express permission to reproduce and/or distribute this item. My use of this file does not breach any of my local Copyright legislation. This file also adheres to the Terms and Conditions outlined on this site.</p>';
$string['uploadcopyrightdefaultcontent'] = 'Yes: The file I am attempting to upload is my own or I have express permission to reproduce and/or distribute this item. My use of this file does not breach any of my local Copyright legislation. This file also adheres to the Terms and Conditions outlined on this site.';
?>
Markdown is supported
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