Skip to content

Commit

Permalink
MDL-33136 Dndupload filemanager - user asked to rename/overwrite file…
Browse files Browse the repository at this point in the history
… when droping file with existing name
  • Loading branch information
davosmith committed Jun 18, 2012
1 parent 52474d7 commit d0b2d44
Show file tree
Hide file tree
Showing 6 changed files with 412 additions and 103 deletions.
30 changes: 29 additions & 1 deletion files/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,8 @@ private function fp_js_template_message() {
* Must have one top element, CSS for this element must define width and height of the window;
*
* content of element with class 'fp-dlg-text' will be replaced with dialog text;
* elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
* elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename',
* 'fp-dlg-butoverwriteall', 'fp-dlg-butrenameall' and 'fp-dlg-butcancel' will
* hold onclick events;
*
* content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
Expand All @@ -821,6 +822,33 @@ private function fp_js_template_processexistingfile() {
return preg_replace('/\{\!\}/', '', $rv);
}

/**
* FilePicker JS template for popup dialogue window asking for action when file with the same name already exists (multiple-file version).
*
* Must have one top element, CSS for this element must define width and height of the window;
*
* content of element with class 'fp-dlg-text' will be replaced with dialog text;
* elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
* hold onclick events;
*
* content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
* (Note that it may have long text)
*
* @return string
*/
private function fp_js_template_processexistingfilemultiple() {
$rv = '
<div class="file-picker fp-dlg">
<p class="{!}fp-dlg-text"></p>
<a class="{!}fp-dlg-butoverwrite fp-panel-button" href="#">'.get_string('overwrite', 'repository').'</a>
<a class="{!}fp-dlg-butoverwriteall fp-panel-button" href="#">'.get_string('overwriteall', 'repository').'</a>
<a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
<a class="{!}fp-dlg-butrename fp-panel-button" href="#"></a>
<a class="{!}fp-dlg-butrenameall fp-panel-button" href="#">'.get_string('renameall', 'repository').'</a>
</div>';
return preg_replace('/\{\!\}/', '', $rv);
}

/**
* FilePicker JS template for repository login form including templates for each element type
*
Expand Down
3 changes: 2 additions & 1 deletion lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@
$string['failedloginattemptsall'] = '{$a->attempts} failed logins for {$a->accounts} accounts';
$string['feedback'] = 'Feedback';
$string['file'] = 'File';
$string['fileexists'] = 'There is already a file called {$a}';
$string['filemissing'] = '{$a} is missing';
$string['filetoolarge'] = 'is too large to upload';
$string['files'] = 'Files';
Expand Down Expand Up @@ -1714,7 +1715,7 @@
$string['uploadextension'] = 'File upload stopped by extension';
$string['uploadfailednotrecovering'] = 'Your file upload has failed because there was a problem with one of the files, {$a->name}.<br /> Here is a log of the problems:<br />{$a->problem}<br />Not recovering.';
$string['uploadfilelog'] = 'Upload log for file {$a}';
$string['uploadformlimit'] = 'Uploaded file exceeded the maximum size limit set by the form';
$string['uploadformlimit'] = 'Uploaded file {$a} exceeded the maximum size limit set by the form';
$string['uploadlabel'] = 'Title:';
$string['uploadnewfile'] = 'Upload new file';
$string['uploadnofilefound'] = 'No file was found - are you sure you selected one to upload?';
Expand Down
2 changes: 2 additions & 0 deletions lang/en/repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
$string['operation'] = 'Operation';
$string['on'] = 'Enabled and visible';
$string['overwrite'] = 'Overwrite';
$string['overwriteall'] = 'Overwrite all';
$string['personalrepositories'] = 'Available repository instances';
$string['plugin'] = 'Repository plug-ins';
$string['pluginerror'] = 'Errors in repository plugin.';
Expand All @@ -174,6 +175,7 @@
$string['refresh'] = 'Refresh';
$string['refreshnonjsfilepicker'] = 'Please close this window and refresh non-javascript file picker';
$string['removed'] = 'Repository removed';
$string['renameall'] = 'Rename all';
$string['renameto'] = 'Rename to "{$a}"';
$string['repositories'] = 'Repositories';
$string['repository'] = 'Repository';
Expand Down
Loading

0 comments on commit d0b2d44

Please sign in to comment.