From 22f6b8df6ef16b5eb3c04d7b28c23dec9b77d3a8 Mon Sep 17 00:00:00 2001
From: dongsheng <dongsheng>
Date: Thu, 24 Sep 2009 09:05:41 +0000
Subject: [PATCH] "MDL-16597, trim filemanager UI"

---
 lang/en_utf8/moodle.php          | 3 +++
 lib/form/filemanager.js          | 2 +-
 lib/form/filemanager.php         | 3 +--
 mod/resource/mod_form.php        | 6 +++---
 theme/standard/styles_layout.css | 2 +-
 5 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/lang/en_utf8/moodle.php b/lang/en_utf8/moodle.php
index d114b34515..97d4ad1660 100644
--- a/lang/en_utf8/moodle.php
+++ b/lang/en_utf8/moodle.php
@@ -1235,6 +1235,7 @@ $string['passwordsenttext'] = '<p>An email has been sent to your address at $a->
    <p><b>Please check your email for your new password</b></p>
    <p>The new password was automatically generated, so you might like to
    <a href=\"$a->link\">change it to something easier to remember</a>.</p>';
+$string['path'] = 'Path';
 $string['pathnotexists'] = 'Path doesn\'t exist in your server!';
 $string['pathslasherror'] = 'Path can\'t end with a slash!!';
 $string['paymentinstant'] = 'Use the button below to pay and be enrolled within minutes!';
@@ -1424,6 +1425,8 @@ $string['selectall'] = 'Select all';
 $string['selectdefault'] = 'Select default';
 $string['selectamodule'] = 'Please select an activity module';
 $string['selectednowmove'] = '$a files selected for moving. Now go into the destination folder and press \'Move files to here\'';
+$string['selectedfile'] = 'Selected file';
+$string['selectfiles'] = 'Select files';
 $string['selectnos'] = 'Select all \'no\'';
 $string['selectperiod'] = 'Select period';
 $string['senddetails'] = 'Send my details via email';
diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js
index a14995cdee..c0403a4ed6 100644
--- a/lib/form/filemanager.js
+++ b/lib/form/filemanager.js
@@ -118,7 +118,7 @@ function html_compiler(client_id, options) {
             var sep = document.createElement('SPAN');
             sep.innerHTML = ' ▶ ';
             if (count==0) {
-                sep.innerHTML = 'Path: ';
+                sep.innerHTML = mstr.moodle.path + ': ';
             } else {
                 sep.innerHTML = ' ▶ ';
             }
diff --git a/lib/form/filemanager.php b/lib/form/filemanager.php
index 7a824080d9..35e1b90f43 100644
--- a/lib/form/filemanager.php
+++ b/lib/form/filemanager.php
@@ -50,8 +50,6 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
         if (!empty($options['maxbytes'])) {
             $this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
         }
-        // XXX: hide element lable
-        $elementLabel = '';
         parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
 
         repository_head_setup();
@@ -170,6 +168,7 @@ class MoodleQuickForm_filemanager extends HTML_QuickForm_element {
         $PAGE->requires->string_for_js('confirmdeletefile', 'repository');
         $PAGE->requires->string_for_js('nopathselected', 'repository');
         $PAGE->requires->string_for_js('popupblockeddownload', 'repository');
+        $PAGE->requires->string_for_js('path', 'moodle');
 
         if (empty($draftitemid)) {
             // no existing area info provided - let's use fresh new draft area
diff --git a/mod/resource/mod_form.php b/mod/resource/mod_form.php
index 33a86461ce..4976370d34 100644
--- a/mod/resource/mod_form.php
+++ b/mod/resource/mod_form.php
@@ -58,11 +58,11 @@ class mod_resource_mod_form extends moodleform_mod {
         $mform->addElement('header', 'contentsection', get_string('contentheader', 'resource'));
         $mainfile = 'mainfile';
 
-        $options = array('mainfile'=>$mainfile, 'subdirs'=>0, 'maxbytes'=>0, 'maxfiles'=>-1, 'filetypes'=>'*', 'returnvalue'=>'*');
+        $options = array('mainfile'=>$mainfile, 'subdirs'=>0, 'maxbytes'=>0, 'maxfiles'=>-1, 'filetypes'=>'*', 'returnvalue'=>'ref_id');
 
         $mform->addElement('hidden', $mainfile, '', array('id'=>$mainfile.'-id'));
-        $mform->addElement('static', '', 'Main file', '<div id="'.$mainfile.'-label"></div>');
-        $mform->addElement('filemanager', 'files', get_string('file'), null, $options);
+        $mform->addElement('filemanager', 'files', get_string('selectfiles'), null, $options);
+        $mform->addElement('static', '', get_string('selectedfile'), '<div id="'.$mainfile.'-label"></div>');
 
         //-------------------------------------------------------
         $mform->addElement('header', 'optionssection', get_string('optionsheader', 'resource'));
diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css
index 886efde2d1..a0cddcf5bb 100644
--- a/theme/standard/styles_layout.css
+++ b/theme/standard/styles_layout.css
@@ -5855,7 +5855,7 @@ wikiadminactions {
     background: #CCC;
 }
 .fm-breadcrumb {
-    margin: 6px 0;
+    margin: 0;
 }
 .filemanager-container {
     padding: 5px;
-- 
2.39.5