Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MOODLE_21_STABLE' into install_21_STABLE

  • Loading branch information...
commit 9d7b02bec08b0eaf19b9b3271be028c45471dcd9 2 parents 2de4e38 + 7294a06
AMOS bot authored
View
2  grade/import/xml/grade_import_form.php
@@ -32,6 +32,7 @@ function definition () {
$mform->setType('id', PARAM_INT);
$mform->addElement('header', 'general', get_string('importfile', 'grades'));
+ $mform->disabledIf('url', 'userfile', 'noteq', '');
$mform->addElement('advcheckbox', 'feedback', get_string('importfeedback', 'grades'));
$mform->setDefault('feedback', 0);
@@ -41,7 +42,6 @@ function definition () {
$mform->disabledIf('userfile', 'url', 'noteq', '');
$mform->addElement('text', 'url', get_string('fileurl', 'gradeimport_xml'), 'size="80"');
- $mform->disabledIf('url', 'userfile', 'noteq', '');
if (!empty($CFG->gradepublishing)) {
$mform->addElement('header', 'publishing', get_string('publishing', 'grades'));
View
10 lib/form/filemanager.js
@@ -53,9 +53,6 @@ M.form_filemanager.init = function(Y, options) {
api: M.cfg.wwwroot+'/repository/draftfiles_ajax.php',
menus: {},
initializer: function(options) {
- //For client side validation, remove hidden draft_id
- Y.one('#id_'+options.elementname).set('value', '');
-
this.options = options;
if (options.mainfile) {
this.enablemainfile = options.mainfile;
@@ -72,7 +69,6 @@ M.form_filemanager.init = function(Y, options) {
this.filepicker_options.maxbytes = this.maxbytes;
this.filepicker_options.env = 'filemanager';
this.filepicker_options.itemid = options.itemid;
- this.filepicker_options.elementname = options.elementname;
if (options.filecount) {
this.filecount = options.filecount;
@@ -154,12 +150,6 @@ M.form_filemanager.init = function(Y, options) {
button_addfile.setStyle('display', 'none');
}
this.refresh(this.currentpath);
- //When file is added then set draftid for validation
- var elementname = M.core_filepicker.instances[this.client_id].options.elementname;
- var itemid = M.core_filepicker.instances[this.client_id].options.itemid;
- Y.one('#id_'+elementname).set('value', itemid);
- //generate event to indicate changes which will be used by disable if code.
- Y.one('#id_'+elementname).simulate('change');
},
refresh: function(filepath) {
var scope = this;
View
9 lib/form/filemanager.php
@@ -45,7 +45,6 @@ function MoodleQuickForm_filemanager($elementName=null, $elementLabel=null, $att
if (!empty($options['maxbytes'])) {
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
}
- $this->_type = 'filemanager';
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
}
@@ -147,12 +146,14 @@ function toHtml() {
$options->accepted_types = $accepted_types;
$options->return_types = FILE_INTERNAL;
$options->context = $PAGE->context;
- $options->elementname = $elname;
$html = $this->_getTabs();
$html .= form_filemanager_render($options);
- $html .= '<input id="id_'.$elname.'" value="'.$draftitemid.'" name="'.$elname.'" type="hidden" class="filemanagerhidden"/>';
+ $html .= '<input value="'.$draftitemid.'" name="'.$elname.'" type="hidden" />';
+ // label element needs 'for' attribute work
+ $html .= '<input value="" id="id_'.$elname.'" type="hidden" />';
+
return $html;
}
}
@@ -302,7 +303,7 @@ function form_filemanager_render($options) {
$module = array(
'name'=>'form_filemanager',
'fullpath'=>'/lib/form/filemanager.js',
- 'requires' => array('core_filepicker', 'base', 'io-base', 'node', 'node-event-simulate', 'json', 'yui2-button', 'yui2-container', 'yui2-layout', 'yui2-menu', 'yui2-treeview'),
+ 'requires' => array('core_filepicker', 'base', 'io', 'node', 'json', 'yui2-button', 'yui2-container', 'yui2-layout', 'yui2-menu', 'yui2-treeview'),
'strings' => array(array('loading', 'repository'), array('nomorefiles', 'repository'), array('confirmdeletefile', 'repository'),
array('add', 'repository'), array('accessiblefilepicker', 'repository'), array('move', 'moodle'),
array('cancel', 'moodle'), array('download', 'moodle'), array('ok', 'moodle'),
View
9 lib/form/filepicker.js
@@ -5,21 +5,12 @@ M.form_filepicker = {};
M.form_filepicker.callback = function(params) {
var html = '<a href="'+params['url']+'">'+params['file']+'</a>';
document.getElementById('file_info_'+params['client_id']).innerHTML = html;
- //When file is added then set draftid for validation
- var elementname = M.core_filepicker.instances[params['client_id']].options.elementname;
- var itemid = M.core_filepicker.instances[params['client_id']].options.itemid;
- M.form_filepicker.YUI.one('#id_'+elementname).set('value', itemid);
- //generate event to indicate changes which will be used by disable if code.
- M.form_filepicker.YUI.one('#id_'+elementname).simulate('change');
};
/**
* This fucntion is called for each file picker on page.
*/
M.form_filepicker.init = function(Y, options) {
- //For client side validation, remove hidden draft_id
- M.form_filepicker.YUI = Y;
- Y.one('#id_'+options.elementname).set('value', '');
options.formcallback = M.form_filepicker.callback;
if (!M.core_filepicker.instances[options.client_id]) {
M.core_filepicker.init(Y, options);
View
5 lib/form/filepicker.php
@@ -29,7 +29,6 @@ function MoodleQuickForm_filepicker($elementName=null, $elementLabel=null, $attr
if (!empty($options['maxbytes'])) {
$this->_options['maxbytes'] = get_max_upload_file_size($CFG->maxbytes, $options['maxbytes']);
}
- $this->_type = 'filepicker';
parent::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
}
@@ -79,17 +78,15 @@ function toHtml() {
$args->maxbytes = $this->_options['maxbytes'];
$args->context = $PAGE->context;
$args->buttonname = $elname.'choose';
- $args->elementname = $elname;
$html = $this->_getTabs();
$fp = new file_picker($args);
$options = $fp->options;
$options->context = $PAGE->context;
- $fp->options->elementname = $elname;
$html .= $OUTPUT->render($fp);
$html .= '<input type="hidden" name="'.$elname.'" id="'.$id.'" value="'.$draftitemid.'" class="filepickerhidden"/>';
- $module = array('name'=>'form_filepicker', 'fullpath'=>'/lib/form/filepicker.js', 'requires'=>array('core_filepicker', 'node', 'node-event-simulate'));
+ $module = array('name'=>'form_filepicker', 'fullpath'=>'/lib/form/filepicker.js', 'requires'=>array('core_filepicker'));
$PAGE->requires->js_init_call('M.form_filepicker.init', array($fp->options), true, $module);
$nonjsfilepicker = new moodle_url('/repository/draftfiles_manager.php', array(
View
49 lib/formslib.php
@@ -340,43 +340,6 @@ function _validate_files(&$files) {
}
/**
- * Internal method. Validates filepicker and filemanager files if they are
- * set as required fields. Also, sets the error message if encountered one.
- *
- * @return bool/array with errors
- */
- protected function validate_draft_files() {
- global $USER;
- $mform =& $this->_form;
-
- $errors = array();
- //Go through all the required elements and make sure you hit filepicker or
- //filemanager element.
- foreach ($mform->_rules as $elementname => $rules) {
- $elementtype = $mform->getElementType($elementname);
- //If element is of type filepicker then do validation
- if (($elementtype == 'filepicker') || ($elementtype == 'filemanager')){
- //Check if rule defined is required rule
- foreach ($rules as $rule) {
- if ($rule['type'] == 'required') {
- $draftid = (int)$mform->getSubmitValue($elementname);
- $fs = get_file_storage();
- $context = get_context_instance(CONTEXT_USER, $USER->id);
- if (!$files = $fs->get_area_files($context->id, 'user', 'draft', $draftid, 'id DESC', false)) {
- $errors[$elementname] = $rule['message'];
- }
- }
- }
- }
- }
- if (empty($errors)) {
- return true;
- } else {
- return $errors;
- }
- }
-
- /**
* Load in existing data as form defaults. Usually new entry defaults are stored directly in
* form definition (new entry form); this function is used to load in data where values
* already exist and data is being edited (edit entry form).
@@ -476,16 +439,6 @@ function validate_defined_fields($validateonnosubmit=false) {
$files = array();
$file_val = $this->_validate_files($files);
- //check draft files for validation and flag them if required files
- //are not in draft area.
- $draftfilevalue = $this->validate_draft_files();
-
- if ($file_val !== true && $draftfilevalue !== true) {
- $file_val = array_merge($file_val, $draftfilevalue);
- } else if ($draftfilevalue !== true) {
- $file_val = $draftfilevalue;
- } //default is file_val, so no need to assign.
-
if ($file_val !== true) {
if (!empty($file_val)) {
foreach ($file_val as $element=>$msg) {
@@ -2340,7 +2293,7 @@ function finishForm(&$form){
if (!$form->isFrozen()) {
$args = $form->getLockOptionObject();
if (count($args[1]) > 0) {
- $PAGE->requires->js_init_call('M.form.initFormDependencies', $args, true, moodleform::get_js_module());
+ $PAGE->requires->js_init_call('M.form.initFormDependencies', $args, false, moodleform::get_js_module());
}
}
}
View
2  version.php
@@ -35,6 +35,6 @@
// RR = release increments - 00 in DEV branches
// .XX = incremental changes
-$release = '2.1.1+ (Build: 20110921)'; // Human-friendly version name
+$release = '2.1.1+ (Build: 20110925)'; // Human-friendly version name
$maturity = MATURITY_STABLE; // this version's maturity level
Please sign in to comment.
Something went wrong with that request. Please try again.