"MDL-23920, added prompt message to user/files.php"
authorDongsheng Cai <unoter@gmail.com>
Wed, 8 Sep 2010 14:01:58 +0000 (14:01 +0000)
committerDongsheng Cai <unoter@gmail.com>
Wed, 8 Sep 2010 14:01:58 +0000 (14:01 +0000)
blocks/private_files/lang/en/block_private_files.php
blocks/private_files/renderer.php
user/renderer.php

index 51abdcc..f13e21f 100644 (file)
@@ -26,4 +26,3 @@
 $string['managemyfiles'] = 'Manage my files';
 $string['pluginname'] = 'User private files';
 $string['privatefiles'] = 'Private files';
-$string['nofiles'] = 'There are no files added yet, please click "Manage my private file" button to add files';
index b9bbbec..5c27971 100644 (file)
@@ -40,7 +40,7 @@ class block_private_files_renderer extends plugin_renderer_base {
     public function render_private_files_tree(private_files_tree $tree) {
         $module = array('name'=>'block_private_files', 'fullpath'=>'/blocks/private_files/module.js', 'requires'=>array('yui2-treeview'));
         if (empty($tree->dir['subdirs']) && empty($tree->dir['files'])) {
-            $html = $this->output->box(get_string('nofiles', 'block_private_files'));
+            $html = $this->output->box(get_string('nofilesavailable', 'repository'));
         } else {
             $htmlid = 'private_files_tree_'.uniqid();
             $this->page->requires->js_init_call('M.block_private_files.init_tree', array(false, $htmlid));
index 9b09392..73212d5 100644 (file)
@@ -38,13 +38,16 @@ class core_user_renderer extends plugin_renderer_base {
     }
 
     public function render_user_files_tree(user_files_tree $tree) {
-        $htmlid = 'user_files_tree_'.uniqid();
-        $module = array('name'=>'core_user', 'fullpath'=>'/user/module.js');
-        $this->page->requires->js_init_call('M.core_user.init_tree', array(false, $htmlid), false, $module);
-
-        $html = '<div id="'.$htmlid.'">';
-        $html .= $this->htmllize_tree($tree, $tree->dir);
-        $html .= '</div>';
+        if (empty($tree->dir['subdirs']) && empty($tree->dir['files'])) {
+            $html = $this->output->box(get_string('nofilesavailable', 'repository'));
+        } else {
+            $htmlid = 'user_files_tree_'.uniqid();
+            $module = array('name'=>'core_user', 'fullpath'=>'/user/module.js');
+            $this->page->requires->js_init_call('M.core_user.init_tree', array(false, $htmlid), false, $module);
+            $html = '<div id="'.$htmlid.'">';
+            $html .= $this->htmllize_tree($tree, $tree->dir);
+            $html .= '</div>';
+        }
         return $html;
     }