MDL-22734, added text to prompt empty repositories list, and added shorttitle for long filename

This commit is contained in:
Dongsheng Cai
2010-06-22 03:55:45 +00:00
parent f7c6cb8033
commit f00340e2ca
6 changed files with 29 additions and 7 deletions
+2
View File
@@ -119,6 +119,8 @@ $string['nomorefiles'] = 'No more attachments allowed';
$string['nopathselected'] = 'No destination path select yet (double click tree node to select)';
$string['nopermissiontoaccess'] = 'No permission to access this repository';
$string['noresult'] = 'No search result';
$string['norepositoriesavailable'] = 'Sorry, none of your current repositories can return files in the required format.';
$string['norepositoriesavexternalailable'] = '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['openpicker'] = 'Choose a file...';
+2 -2
View File
@@ -378,8 +378,8 @@ class page_requirements_manager {
array('saving', 'repository'), array('search', 'repository'), array('searching', 'repository'), array('size', 'repository'),
array('submit', 'repository'), array('sync', 'repository'), array('title', 'repository'), array('upload', 'repository'),
array('uploading', 'repository'), array('xhtmlerror', 'repository'),
array('xhtml', 'quiz'), array('chooselicense', 'repository'), array('author', 'repository'),
array('ok', 'moodle'), array('error', 'moodle'), array('info', 'moodle')
array('xhtml', 'quiz'), array('cancel'), array('chooselicense', 'repository'), array('author', 'repository'),
array('ok', 'moodle'), array('error', 'moodle'), array('info', 'moodle'), array('norepositoriesavailable', 'repository'), array('norepositoriesavexternalailable', 'repository')
));
break;
case 'core_comment':
+14 -5
View File
@@ -206,9 +206,6 @@ M.core_filepicker.init = function(Y, options) {
thumbnail:node.thumbnail,
path:node.path?node.path:[]
};
var tmpNode = new YAHOO.widget.TextNode(info, level, false);
//var tooltip = new YAHOO.widget.Tooltip(tmpNode.labelElId, {
//context:tmpNode.labelElId, text:info.title});
if(node.repo_id) {
tmpNode.repo_id=node.repo_id;
}else{
@@ -337,10 +334,14 @@ M.core_filepicker.init = function(Y, options) {
var title = document.createElement('DIV');
title.id = 'grid-title-'+client_id+'-'+String(count);
title.className = 'label';
var filename = node.title;
console.info(node);
if (node.shorttitle) {
node.title = node.shorttitle;
filename = node.shorttitle;
}
title.innerHTML += '<a href="###"><span>'+node.title+"</span></a>";
var filename_id = 'filname-link-'+client_id+'-'+String(count);
title.innerHTML += '<a href="###" id="'+filename_id+'" title="'+node.title+'"><span>'+filename+"</span></a>";
if(node.thumbnail_width){
grid.style.width = node.thumbnail_width+'px';
@@ -355,6 +356,7 @@ M.core_filepicker.init = function(Y, options) {
}
var img = document.createElement('img');
img.src = node.thumbnail;
img.title = node.title;
if(node.thumbnail_alt) {
img.alt = node.thumbnail_alt;
}
@@ -651,6 +653,13 @@ M.core_filepicker.init = function(Y, options) {
}, this /*handler running scope*/, this/*second argument*/, r[i].id/*third argument of handler*/);
count++;
}
if (count==0) {
if (this.options.externallink) {
list.set('innerHTML', M.str.repository.norepositoriesavexternalailable);
} else {
list.set('innerHTML', M.str.repository.norepositoriesavailable);
}
}
}, '#fp-list-'+client_id, this /* handler running scope */, '#fp-list-'+client_id /*first argument of handler*/);
},
parse_repository_options: function(data) {
+7
View File
@@ -1606,6 +1606,13 @@ abstract class repository {
public static function get_instance_option_names() {
return array();
}
public function get_short_filename($str, $maxlength) {
if (strlen($str) >= $maxlength) {
return trim(substr($str, 0, $maxlength)).'...';
} else {
return $str;
}
}
}
+3
View File
@@ -107,6 +107,7 @@ class repository_local extends repository {
// build file tree
$children = $fileinfo->get_children();
foreach ($children as $child) {
$shorttitle = $this->get_short_filename($child->get_visible_name(), 12);
if ($child->is_directory()) {
$params = $child->get_params();
$subdir_children = $child->get_children();
@@ -121,6 +122,7 @@ class repository_local extends repository {
}
$node = array(
'title' => $child->get_visible_name(),
'shorttitle'=>$shorttitle,
'size' => 0,
'date' => '',
'path' => $encodedpath,
@@ -133,6 +135,7 @@ class repository_local extends repository {
$icon = 'f/'.str_replace('.gif', '', mimeinfo('icon', $child->get_visible_name())).'-32';
$node = array(
'title' => $child->get_visible_name(),
'shorttitle'=>$shorttitle,
'size' => 0,
'date' => '',
'source'=> $encodedpath,
+1
View File
@@ -110,6 +110,7 @@ class repository_recent extends repository {
$icon = 'f/'.str_replace('.gif', '', mimeinfo('icon', $file['filename'])) . '-32';
$node = array(
'title' => $file['filename'],
'shorttitle' => $this->get_short_filename($file['filename'], 12),
'size' => 0,
'date' => '',
'source'=> $params,