From: dongsheng Date: Wed, 14 Oct 2009 03:11:48 +0000 (+0000) Subject: "MDL-20470, add an option to enable/disable filepicker button" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=e98a55c06600cd0ccee6c21524e64fe8dbcf697d;p=moodle.git "MDL-20470, add an option to enable/disable filepicker button" --- diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index fd30e8239e..0fd5a1c7f6 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -206,7 +206,6 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) $temp->add(new admin_setting_heading('managerepositoriescommonheading', get_string('commonsettings', 'admin'), '')); $temp->add(new admin_setting_configtext('repositorycacheexpire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120)); $temp->add(new admin_setting_configcheckbox('repositoryuseexternallink', get_string('useexternallink', 'repository'), get_string('configuseexternallink', 'repository'), 0)); - $temp->add(new admin_setting_configcheckbox('repositoryusepickerbutton', get_string('usepickerbutton', 'repository'), '', 1)); $ADMIN->add('repositorysettings', $temp); $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', get_string('addplugin', 'repository'), $url, 'moodle/site:config', true), diff --git a/lang/en_utf8/repository.php b/lang/en_utf8/repository.php index 486a5f6187..586236c07d 100644 --- a/lang/en_utf8/repository.php +++ b/lang/en_utf8/repository.php @@ -121,7 +121,6 @@ $string['uploading'] = 'Uploading...'; $string['uploadsucc'] = 'The file has been uploaded successfully'; $string['useexternallink'] = 'Use external link instead downloading files'; $string['configuseexternallink'] = 'Will return the external link to file picker instead downloading external files'; -$string['usepickerbutton'] = 'Use file picker button beside text element'; $string['wrongcontext'] = 'You cannot access to this context'; $string['xhtmlerror'] = 'You are probably using XHTML strict header, some YUI Component doesn\'t work in this mode, please turn it off in moodle'; $string['ziped'] = 'Compress folder successfully'; diff --git a/lib/form/url.php b/lib/form/url.php index a167e365ba..2c82eeb1a7 100755 --- a/lib/form/url.php +++ b/lib/form/url.php @@ -23,6 +23,9 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{ foreach ($options as $name=>$value) { $this->_options[$name] = $value; } + if (!isset($this->_options['usefilepicker'])) { + $this->_options['usefilepicker'] = true; + } parent::HTML_QuickForm_text($elementName, $elementLabel, $attributes); repository_head_setup(); } @@ -43,7 +46,7 @@ class MoodleQuickForm_url extends HTML_QuickForm_text{ } else { $str = parent::toHtml(); } - if (!$CFG->repositoryusepickerbutton) { + if (empty($this->_options['usefilepicker'])) { return $str; } $strsaved = get_string('filesaved', 'repository'); diff --git a/mod/url/mod_form.php b/mod/url/mod_form.php index ce9b3db9b5..abab8c7ebb 100644 --- a/mod/url/mod_form.php +++ b/mod/url/mod_form.php @@ -46,7 +46,7 @@ class mod_url_mod_form extends moodleform_mod { //------------------------------------------------------- $mform->addElement('header', 'content', get_string('contentheader', 'url')); - $mform->addElement('url', 'externalurl', get_string('externalurl', 'url'), array('size'=>'60'), null); + $mform->addElement('url', 'externalurl', get_string('externalurl', 'url'), array('size'=>'60'), array('usefilepicker'=>true)); //------------------------------------------------------- $mform->addElement('header', 'optionssection', get_string('optionsheader', 'url'));