Permalink
Browse files

MDL-31901: filemanager: fixed 'Original' label, and small bug in tree…

…view navigation
  • Loading branch information...
1 parent 4325db5 commit e0ff0867bde8a0a9849e671879e56678cd079ae7 @marinaglancy marinaglancy committed May 7, 2012
Showing with 18 additions and 7 deletions.
  1. +2 −2 files/renderer.php
  2. +1 −0 lang/en/repository.php
  3. +15 −5 lib/form/filemanager.js
View
@@ -306,7 +306,7 @@ private function fm_js_template_message() {
* The elements will be assign with class 'uneditable' and input/select element will become
* disabled if they are not applicable for the particular file;
*
- * There may be present elements with classes 'fp-origpath', 'fp-datemodified', 'fp-datecreated',
+ * There may be present elements with classes 'fp-original', 'fp-datemodified', 'fp-datecreated',
* 'fp-size', 'fp-dimensions'. They will receive additional class 'fp-unknown' if information
* is unavailable. If there is information available, the content of embedded element
* with class 'fp-value' will be substituted with the value;
@@ -342,7 +342,7 @@ private function fm_js_template_fileselectlayout() {
<td class="mdl-left"><select></select></td></tr>
<tr class="{!}fp-path"><td class="mdl-right"><label>'.get_string('path', 'moodle').'</label>:</td>
<td class="mdl-left"><select></select></td></tr>
-<tr class="{!}fp-origpath"><td class="mdl-right"><label>'.get_string('originalpath', 'moodle').'</label>:</td>
+<tr class="{!}fp-original"><td class="mdl-right"><label>'.get_string('original', 'repository').'</label>:</td>
<td class="mdl-left"><span class="fp-value"/></td></tr>
</table>
<p><button class="{!}fp-file-update" >'.get_string('update', 'moodle').'</button>
@@ -148,6 +148,7 @@
$string['norepositoriesexternalavailable'] = 'Sorry, none of your current repositories can return external files.';
$string['notyourinstances'] = 'You can not view/edit repository instances of another user';
$string['off'] = 'Enabled but hidden';
+$string['original'] = 'Original';
$string['openpicker'] = 'Choose a file...';
$string['operation'] = 'Operation';
$string['on'] = 'Enabled and visible';
@@ -402,6 +402,13 @@ M.form_filemanager.init = function(Y, options) {
retrieved_children[node.children[i].path] = node.children[i];
}
}
+ if (!node.path || node.path == '/') {
+ // this is a root pseudo folder
+ node.fileinfo.filepath = '/';
+ node.fileinfo.type = 'folder';
+ node.fileinfo.fullname = node.fileinfo.title;
+ node.fileinfo.filename = '.';
+ }
this.request({
action:'list',
params: {filepath:node.path?node.path:''},
@@ -474,8 +481,12 @@ M.form_filemanager.init = function(Y, options) {
},
classnamecallback : function(node) {
var classname = '';
- if (node.type == 'folder') { classname = classname + ' fp-folder';}
- if (node.filepath) { classname = classname + ' fp-hascontextmenu';}
+ if (node.type == 'folder' || (!node.type && !node.filename)) {
+ classname = classname + ' fp-folder';
+ }
+ if (node.filename || node.filepath || (node.path && node.path != '/')) {
+ classname = classname + ' fp-hascontextmenu';
+ }
if (node.sortorder == 1) { classname = classname + ' fp-mainfile';}
return Y.Lang.trim(classname);
}
@@ -501,7 +512,7 @@ M.form_filemanager.init = function(Y, options) {
// save current path and filelist (in case we want to jump to other viewmode)
this.options.path = e.node.origpath;
this.options.list = e.node.origlist;
- this.currentpath = e.node.path;
+ this.currentpath = node.filepath;
this.print_path();
//this.content_scrolled();
}
@@ -740,7 +751,6 @@ M.form_filemanager.init = function(Y, options) {
this.selectui.fileinfo = node;
selectnode.one('.fp-saveas input').set('value', node.fullname);
var foldername = this.get_parent_folder_name(node);
- selectnode.all('.fp-origpath .fp-value').setContent(foldername);
selectnode.all('.fp-author input').set('value', node.author);
selectnode.all('.fp-license select option[selected]').set('selected', false);
selectnode.all('.fp-license select option[value='+node.license+']').set('selected', true);
@@ -750,7 +760,7 @@ M.form_filemanager.init = function(Y, options) {
});
selectnode.all('.fp-author input, .fp-license select').set('disabled',(node.type == 'folder')?'disabled':'');
// display static information about a file (when known)
- var attrs = ['datemodified','datecreated','size','dimensions'];
+ var attrs = ['datemodified','datecreated','size','dimensions','original'];
for (var i in attrs) {
if (selectnode.one('.fp-'+attrs[i])) {
var value = (node[attrs[i]+'_f']) ? node[attrs[i]+'_f'] : (node[attrs[i]] ? node[attrs[i]] : '');

0 comments on commit e0ff086

Please sign in to comment.