Skip to content

Commit

Permalink
Merge branch 'MOODLE_24_STABLE' into install_24_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
AMOS bot committed Jul 11, 2014
2 parents dadf5df + c110815 commit e417377
Show file tree
Hide file tree
Showing 35 changed files with 465 additions and 381 deletions.
16 changes: 1 addition & 15 deletions auth/shibboleth/index.php
Expand Up @@ -47,21 +47,7 @@
if ($shibbolethauth->user_login($frm->username, $frm->password) if ($shibbolethauth->user_login($frm->username, $frm->password)
&& $user = authenticate_user_login($frm->username, $frm->password)) { && $user = authenticate_user_login($frm->username, $frm->password)) {


enrol_check_plugins($user); complete_user_login($user);
session_set_user($user);

$USER->loggedin = true;
$USER->site = $CFG->wwwroot; // for added security, store the site in the

update_user_login_times();

// Don't show previous shibboleth username on login page

set_login_session_preferences();

unset($SESSION->lang);
$SESSION->justloggedin = true;

add_to_log(SITEID, 'user', 'login', "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id); add_to_log(SITEID, 'user', 'login', "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);


if (user_not_fully_set_up($USER)) { if (user_not_fully_set_up($USER)) {
Expand Down
1 change: 1 addition & 0 deletions grade/grading/form/guide/guideeditor.php
Expand Up @@ -100,6 +100,7 @@ public function toHtml() {
$mode = gradingform_guide_controller::DISPLAY_EDIT_FULL; $mode = gradingform_guide_controller::DISPLAY_EDIT_FULL;
$module = array('name'=>'gradingform_guideeditor', $module = array('name'=>'gradingform_guideeditor',
'fullpath'=>'/grade/grading/form/guide/js/guideeditor.js', 'fullpath'=>'/grade/grading/form/guide/js/guideeditor.js',
'requires' => array('base', 'dom', 'event', 'event-touch', 'escape'),
'strings' => array( 'strings' => array(
array('confirmdeletecriterion', 'gradingform_guide'), array('confirmdeletecriterion', 'gradingform_guide'),
array('clicktoedit', 'gradingform_guide'), array('clicktoedit', 'gradingform_guide'),
Expand Down
2 changes: 1 addition & 1 deletion grade/grading/form/guide/js/guide.js
Expand Up @@ -10,7 +10,7 @@ M.gradingform_guide.init = function(Y, options) {
currentfocus = e.currentTarget; currentfocus = e.currentTarget;
}); });
Y.all('.markingguidecomment').on('click', function(e) { Y.all('.markingguidecomment').on('click', function(e) {
currentfocus.set('value', currentfocus.get('value') + '\n' + e.currentTarget.get('innerHTML')); currentfocus.set('value', currentfocus.get('value') + '\n' + e.currentTarget.get('text'));
currentfocus.focus(); currentfocus.focus();
}); });


Expand Down
4 changes: 2 additions & 2 deletions grade/grading/form/guide/js/guideeditor.js
Expand Up @@ -111,9 +111,9 @@ M.gradingform_guideeditor.editmode = function(el, editmode) {
value = M.str.gradingform_guide.clicktoedit value = M.str.gradingform_guide.clicktoedit
taplain.addClass('empty') taplain.addClass('empty')
} }
taplain.one('.textvalue').set('innerHTML', value) taplain.one('.textvalue').set('innerHTML', Y.Escape.html(value))
if (tb) { if (tb) {
tbplain.one('.textvalue').set('innerHTML', tb.get('value')) tbplain.one('.textvalue').set('innerHTML', Y.Escape.html(tb.get('value')))
} }
// hide/display textarea, textbox and plaintexts // hide/display textarea, textbox and plaintexts
taplain.removeClass('hiddenelement') taplain.removeClass('hiddenelement')
Expand Down
2 changes: 1 addition & 1 deletion grade/grading/form/guide/lib.php
Expand Up @@ -845,7 +845,7 @@ public function render_grading_element($page, $gradingformelement) {
if (!empty($this->validationerrors)) { if (!empty($this->validationerrors)) {
foreach ($this->validationerrors as $id => $err) { foreach ($this->validationerrors as $id => $err) {
$a = new stdClass(); $a = new stdClass();
$a->criterianame = $criteria[$id]['shortname']; $a->criterianame = s($criteria[$id]['shortname']);
$a->maxscore = $criteria[$id]['maxscore']; $a->maxscore = $criteria[$id]['maxscore'];
$html .= html_writer::tag('div', get_string('err_scoreinvalid', 'gradingform_guide', $a), $html .= html_writer::tag('div', get_string('err_scoreinvalid', 'gradingform_guide', $a),
array('class' => 'gradingform_guide-error')); array('class' => 'gradingform_guide-error'));
Expand Down
30 changes: 15 additions & 15 deletions grade/grading/form/guide/renderer.php
Expand Up @@ -93,20 +93,20 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder'])); 'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder']));


$shortname = html_writer::empty_tag('input', array('type'=> 'text', $shortname = html_writer::empty_tag('input', array('type'=> 'text',
'name' => '{NAME}[criteria][{CRITERION-id}][shortname]', 'value' => htmlspecialchars($criterion['shortname']), 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]', 'value' => $criterion['shortname'],
'id ' => '{NAME}[criteria][{CRITERION-id}][shortname]')); 'id ' => '{NAME}[criteria][{CRITERION-id}][shortname]'));
$shortname = html_writer::tag('div', $shortname, array('class'=>'criterionname')); $shortname = html_writer::tag('div', $shortname, array('class'=>'criterionname'));
$description = html_writer::tag('textarea', htmlspecialchars($criterion['description']), $description = html_writer::tag('textarea', s($criterion['description']),
array('name' => '{NAME}[criteria][{CRITERION-id}][description]', 'cols' => '65', 'rows' => '5')); array('name' => '{NAME}[criteria][{CRITERION-id}][description]', 'cols' => '65', 'rows' => '5'));
$description = html_writer::tag('div', $description, array('class'=>'criteriondesc')); $description = html_writer::tag('div', $description, array('class'=>'criteriondesc'));


$descriptionmarkers = html_writer::tag('textarea', htmlspecialchars($criterion['descriptionmarkers']), $descriptionmarkers = html_writer::tag('textarea', s($criterion['descriptionmarkers']),
array('name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]', 'cols' => '65', 'rows' => '5')); array('name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]', 'cols' => '65', 'rows' => '5'));
$descriptionmarkers = html_writer::tag('div', $descriptionmarkers, array('class'=>'criteriondescmarkers')); $descriptionmarkers = html_writer::tag('div', $descriptionmarkers, array('class'=>'criteriondescmarkers'));


$maxscore = html_writer::empty_tag('input', array('type'=> 'text', $maxscore = html_writer::empty_tag('input', array('type'=> 'text',
'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'size' => '3', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]', 'size' => '3',
'value' => htmlspecialchars($criterion['maxscore']), 'value' => $criterion['maxscore'],
'id' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); 'id' => '{NAME}[criteria][{CRITERION-id}][maxscore]'));
$maxscore = html_writer::tag('div', $maxscore, array('class'=>'criterionmaxscore')); $maxscore = html_writer::tag('div', $maxscore, array('class'=>'criterionmaxscore'));
} else { } else {
Expand All @@ -125,7 +125,7 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
$mode == gradingform_guide_controller::DISPLAY_VIEW) { $mode == gradingform_guide_controller::DISPLAY_VIEW) {
$descriptionclass = 'descriptionreadonly'; $descriptionclass = 'descriptionreadonly';
} }
$shortname = html_writer::tag('div', $criterion['shortname'], $shortname = html_writer::tag('div', s($criterion['shortname']),
array('class'=>'criterionshortname', 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]')); array('class'=>'criterionshortname', 'name' => '{NAME}[criteria][{CRITERION-id}][shortname]'));
$descmarkerclass = ''; $descmarkerclass = '';
$descstudentclass = ''; $descstudentclass = '';
Expand All @@ -137,13 +137,13 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
$descstudentclass = ' hide'; $descstudentclass = ' hide';
} }
} }
$description = html_writer::tag('div', $criterion['description'], $description = html_writer::tag('div', s($criterion['description']),
array('class'=>'criteriondescription'.$descstudentclass, array('class'=>'criteriondescription'.$descstudentclass,
'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]')); 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]'));
$descriptionmarkers = html_writer::tag('div', $criterion['descriptionmarkers'], $descriptionmarkers = html_writer::tag('div', s($criterion['descriptionmarkers']),
array('class'=>'criteriondescriptionmarkers'.$descmarkerclass, array('class'=>'criteriondescriptionmarkers'.$descmarkerclass,
'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]')); 'name' => '{NAME}[criteria][{CRITERION-id}][descriptionmarkers]'));
$maxscore = html_writer::tag('div', $criterion['maxscore'], $maxscore = html_writer::tag('div', s($criterion['maxscore']),
array('class'=>'criteriondescriptionscore', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]')); array('class'=>'criteriondescriptionscore', 'name' => '{NAME}[criteria][{CRITERION-id}][maxscore]'));
} }


Expand Down Expand Up @@ -188,7 +188,7 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
$scoreclass = 'error'; $scoreclass = 'error';
$currentscore = $validationerrors[$criterion['id']]['score']; // Show invalid score in form. $currentscore = $validationerrors[$criterion['id']]['score']; // Show invalid score in form.
} }
$input = html_writer::tag('textarea', htmlspecialchars($currentremark), $input = html_writer::tag('textarea', s($currentremark),
array('name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'cols' => '65', 'rows' => '5', array('name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'cols' => '65', 'rows' => '5',
'class' => 'markingguideremark')); 'class' => 'markingguideremark'));
$criteriontemplate .= html_writer::tag('td', $input, array('class' => 'remark')); $criteriontemplate .= html_writer::tag('td', $input, array('class' => 'remark'));
Expand All @@ -197,7 +197,7 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
$score .= html_writer::empty_tag('input', array('type'=> 'text', $score .= html_writer::empty_tag('input', array('type'=> 'text',
'name' => '{NAME}[criteria][{CRITERION-id}][score]', 'class' => $scoreclass, 'name' => '{NAME}[criteria][{CRITERION-id}][score]', 'class' => $scoreclass,
'id' => '{NAME}[criteria][{CRITERION-id}][score]', 'id' => '{NAME}[criteria][{CRITERION-id}][score]',
'size' => '3', 'value' => htmlspecialchars($currentscore))); 'size' => '3', 'value' => $currentscore));
$score .= '/'.$maxscore; $score .= '/'.$maxscore;


$criteriontemplate .= html_writer::tag('td', $score, array('class' => 'score')); $criteriontemplate .= html_writer::tag('td', $score, array('class' => 'score'));
Expand All @@ -206,9 +206,9 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark)); 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark));
} else if ($mode == gradingform_guide_controller::DISPLAY_REVIEW || } else if ($mode == gradingform_guide_controller::DISPLAY_REVIEW ||
$mode == gradingform_guide_controller::DISPLAY_VIEW) { $mode == gradingform_guide_controller::DISPLAY_VIEW) {
$criteriontemplate .= html_writer::tag('td', $currentremark, array('class' => 'remark')); $criteriontemplate .= html_writer::tag('td', s($currentremark), array('class' => 'remark'));
if (!empty($options['showmarkspercriterionstudents'])) { if (!empty($options['showmarkspercriterionstudents'])) {
$criteriontemplate .= html_writer::tag('td', htmlspecialchars($currentscore). ' / '.$maxscore, $criteriontemplate .= html_writer::tag('td', s($currentscore). ' / '.$maxscore,
array('class' => 'score')); array('class' => 'score'));
} }
} }
Expand Down Expand Up @@ -267,7 +267,7 @@ public function comment_template($mode, $elementname = '{NAME}', $comment = null
$criteriontemplate .= html_writer::end_tag('td'); // Controls. $criteriontemplate .= html_writer::end_tag('td'); // Controls.
$criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden',
'name' => '{NAME}[comments][{COMMENT-id}][sortorder]', 'value' => $comment['sortorder'])); 'name' => '{NAME}[comments][{COMMENT-id}][sortorder]', 'value' => $comment['sortorder']));
$description = html_writer::tag('textarea', htmlspecialchars($comment['description']), $description = html_writer::tag('textarea', s($comment['description']),
array('name' => '{NAME}[comments][{COMMENT-id}][description]', 'cols' => '65', 'rows' => '5')); array('name' => '{NAME}[comments][{COMMENT-id}][description]', 'cols' => '65', 'rows' => '5'));
$description = html_writer::tag('div', $description, array('class'=>'criteriondesc')); $description = html_writer::tag('div', $description, array('class'=>'criteriondesc'));
} else { } else {
Expand All @@ -278,12 +278,12 @@ public function comment_template($mode, $elementname = '{NAME}', $comment = null
'name' => '{NAME}[comments][{COMMENT-id}][description]', 'value' => $comment['description'])); 'name' => '{NAME}[comments][{COMMENT-id}][description]', 'value' => $comment['description']));
} }
if ($mode == gradingform_guide_controller::DISPLAY_EVAL) { if ($mode == gradingform_guide_controller::DISPLAY_EVAL) {
$description = html_writer::tag('span', htmlspecialchars($comment['description']), $description = html_writer::tag('span', s($comment['description']),
array('name' => '{NAME}[comments][{COMMENT-id}][description]', array('name' => '{NAME}[comments][{COMMENT-id}][description]',
'title' => get_string('clicktocopy', 'gradingform_guide'), 'title' => get_string('clicktocopy', 'gradingform_guide'),
'id' => '{NAME}[comments][{COMMENT-id}]', 'class'=>'markingguidecomment')); 'id' => '{NAME}[comments][{COMMENT-id}]', 'class'=>'markingguidecomment'));
} else { } else {
$description = $comment['description']; $description = s($comment['description']);
} }
} }
$descriptionclass = 'description'; $descriptionclass = 'description';
Expand Down
4 changes: 2 additions & 2 deletions grade/grading/form/rubric/js/rubriceditor.js
Expand Up @@ -93,8 +93,8 @@ M.gradingform_rubriceditor.editmode = function(el, editmode, focustb) {
value = (el.hasClass('level')) ? M.str.gradingform_rubric.levelempty : M.str.gradingform_rubric.criterionempty value = (el.hasClass('level')) ? M.str.gradingform_rubric.levelempty : M.str.gradingform_rubric.criterionempty
taplain.addClass('empty') taplain.addClass('empty')
} }
taplain.one('.textvalue').set('innerHTML', value) taplain.one('.textvalue').set('innerHTML', Y.Escape.html(value));
if (tb) tbplain.one('.textvalue').set('innerHTML', tb.get('value')) if (tb) tbplain.one('.textvalue').set('innerHTML', Y.Escape.html(tb.get('value')));
// hide/display textarea, textbox and plaintexts // hide/display textarea, textbox and plaintexts
taplain.removeClass('hiddenelement') taplain.removeClass('hiddenelement')
ta.addClass('hiddenelement') ta.addClass('hiddenelement')
Expand Down
12 changes: 6 additions & 6 deletions grade/grading/form/rubric/renderer.php
Expand Up @@ -74,13 +74,13 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
} }
$criteriontemplate .= html_writer::end_tag('td'); // .controls $criteriontemplate .= html_writer::end_tag('td'); // .controls
$criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder'])); $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder']));
$description = html_writer::tag('textarea', htmlspecialchars($criterion['description']), array('name' => '{NAME}[criteria][{CRITERION-id}][description]', 'cols' => '10', 'rows' => '5')); $description = html_writer::tag('textarea', s($criterion['description']), array('name' => '{NAME}[criteria][{CRITERION-id}][description]', 'cols' => '10', 'rows' => '5'));
} else { } else {
if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FROZEN) { if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FROZEN) {
$criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder'])); $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][sortorder]', 'value' => $criterion['sortorder']));
$criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][description]', 'value' => $criterion['description'])); $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][description]', 'value' => $criterion['description']));
} }
$description = $criterion['description']; $description = s($criterion['description']);
} }
$descriptionclass = 'description'; $descriptionclass = 'description';
if (isset($criterion['error_description'])) { if (isset($criterion['error_description'])) {
Expand All @@ -106,12 +106,12 @@ public function criterion_template($mode, $options, $elementname = '{NAME}', $cr
$currentremark = $value['remark']; $currentremark = $value['remark'];
} }
if ($mode == gradingform_rubric_controller::DISPLAY_EVAL) { if ($mode == gradingform_rubric_controller::DISPLAY_EVAL) {
$input = html_writer::tag('textarea', htmlspecialchars($currentremark), array('name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'cols' => '10', 'rows' => '5')); $input = html_writer::tag('textarea', s($currentremark), array('name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'cols' => '10', 'rows' => '5'));
$criteriontemplate .= html_writer::tag('td', $input, array('class' => 'remark')); $criteriontemplate .= html_writer::tag('td', $input, array('class' => 'remark'));
} else if ($mode == gradingform_rubric_controller::DISPLAY_EVAL_FROZEN) { } else if ($mode == gradingform_rubric_controller::DISPLAY_EVAL_FROZEN) {
$criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark)); $criteriontemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][remark]', 'value' => $currentremark));
}else if ($mode == gradingform_rubric_controller::DISPLAY_REVIEW || $mode == gradingform_rubric_controller::DISPLAY_VIEW) { }else if ($mode == gradingform_rubric_controller::DISPLAY_REVIEW || $mode == gradingform_rubric_controller::DISPLAY_VIEW) {
$criteriontemplate .= html_writer::tag('td', $currentremark, array('class' => 'remark')); // TODO maybe some prefix here like 'Teacher remark:' $criteriontemplate .= html_writer::tag('td', s($currentremark), array('class' => 'remark'));
} }
} }
$criteriontemplate .= html_writer::end_tag('tr'); // .criterion $criteriontemplate .= html_writer::end_tag('tr'); // .criterion
Expand Down Expand Up @@ -163,15 +163,15 @@ public function level_template($mode, $options, $elementname = '{NAME}', $criter
$leveltemplate = html_writer::start_tag('td', $tdattributes); $leveltemplate = html_writer::start_tag('td', $tdattributes);
$leveltemplate .= html_writer::start_tag('div', array('class' => 'level-wrapper')); $leveltemplate .= html_writer::start_tag('div', array('class' => 'level-wrapper'));
if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FULL) { if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FULL) {
$definition = html_writer::tag('textarea', htmlspecialchars($level['definition']), array('name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][definition]', 'cols' => '10', 'rows' => '4')); $definition = html_writer::tag('textarea', s($level['definition']), array('name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][definition]', 'cols' => '10', 'rows' => '4'));
$score = html_writer::label(get_string('criterionempty', 'gradingform_rubric'), '{NAME}criteria{CRITERION-id}levels{LEVEL-id}', false, array('class' => 'accesshide')); $score = html_writer::label(get_string('criterionempty', 'gradingform_rubric'), '{NAME}criteria{CRITERION-id}levels{LEVEL-id}', false, array('class' => 'accesshide'));
$score .= html_writer::empty_tag('input', array('type' => 'text','id' => '{NAME}criteria{CRITERION-id}levels{LEVEL-id}', 'name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][score]', 'size' => '3', 'value' => $level['score'])); $score .= html_writer::empty_tag('input', array('type' => 'text','id' => '{NAME}criteria{CRITERION-id}levels{LEVEL-id}', 'name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][score]', 'size' => '3', 'value' => $level['score']));
} else { } else {
if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FROZEN) { if ($mode == gradingform_rubric_controller::DISPLAY_EDIT_FROZEN) {
$leveltemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][definition]', 'value' => $level['definition'])); $leveltemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][definition]', 'value' => $level['definition']));
$leveltemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][score]', 'value' => $level['score'])); $leveltemplate .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => '{NAME}[criteria][{CRITERION-id}][levels][{LEVEL-id}][score]', 'value' => $level['score']));
} }
$definition = $level['definition']; $definition = s($level['definition']);
$score = $level['score']; $score = $level['score'];
} }
if ($mode == gradingform_rubric_controller::DISPLAY_EVAL) { if ($mode == gradingform_rubric_controller::DISPLAY_EVAL) {
Expand Down
1 change: 1 addition & 0 deletions grade/grading/form/rubric/rubriceditor.php
Expand Up @@ -85,6 +85,7 @@ public function toHtml() {
if (!$this->_flagFrozen) { if (!$this->_flagFrozen) {
$mode = gradingform_rubric_controller::DISPLAY_EDIT_FULL; $mode = gradingform_rubric_controller::DISPLAY_EDIT_FULL;
$module = array('name'=>'gradingform_rubriceditor', 'fullpath'=>'/grade/grading/form/rubric/js/rubriceditor.js', $module = array('name'=>'gradingform_rubriceditor', 'fullpath'=>'/grade/grading/form/rubric/js/rubriceditor.js',
'requires' => array('base', 'dom', 'event', 'event-touch', 'escape'),
'strings' => array(array('confirmdeletecriterion', 'gradingform_rubric'), array('confirmdeletelevel', 'gradingform_rubric'), 'strings' => array(array('confirmdeletecriterion', 'gradingform_rubric'), array('confirmdeletelevel', 'gradingform_rubric'),
array('criterionempty', 'gradingform_rubric'), array('levelempty', 'gradingform_rubric') array('criterionempty', 'gradingform_rubric'), array('levelempty', 'gradingform_rubric')
)); ));
Expand Down
22 changes: 21 additions & 1 deletion lib/form/editor.php
Expand Up @@ -94,6 +94,25 @@ function MoodleQuickForm_editor($elementName=null, $elementLabel=null, $attribut
editors_head_setup(); editors_head_setup();
} }


/**
* Called by HTML_QuickForm whenever form event is made on this element
*
* @param string $event Name of event
* @param mixed $arg event arguments
* @param object $caller calling object
* @return bool
*/
function onQuickFormEvent($event, $arg, &$caller)
{
switch ($event) {
case 'createElement':
$caller->setType($arg[0] . '[format]', PARAM_ALPHANUM);
$caller->setType($arg[0] . '[itemid]', PARAM_INT);
break;
}
return parent::onQuickFormEvent($event, $arg, $caller);
}

/** /**
* Sets name of editor * Sets name of editor
* *
Expand Down Expand Up @@ -403,7 +422,8 @@ function toHtml() {
if (!during_initial_install() && empty($CFG->adminsetuppending)) { if (!during_initial_install() && empty($CFG->adminsetuppending)) {
// 0 means no files, -1 unlimited // 0 means no files, -1 unlimited
if ($maxfiles != 0 ) { if ($maxfiles != 0 ) {
$str .= '<input type="hidden" name="'.$elname.'[itemid]" value="'.$draftitemid.'" />'; $str .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => $elname.'[itemid]',
'value' => $draftitemid));


// used by non js editor only // used by non js editor only
$editorurl = new moodle_url("$CFG->wwwroot/repository/draftfiles_manager.php", array( $editorurl = new moodle_url("$CFG->wwwroot/repository/draftfiles_manager.php", array(
Expand Down
22 changes: 20 additions & 2 deletions lib/form/filemanager.php
Expand Up @@ -79,6 +79,24 @@ function MoodleQuickForm_filemanager($elementName=null, $elementLabel=null, $att
parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes); parent::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
} }


/**
* Called by HTML_QuickForm whenever form event is made on this element
*
* @param string $event Name of event
* @param mixed $arg event arguments
* @param object $caller calling object
* @return bool
*/
function onQuickFormEvent($event, $arg, &$caller)
{
switch ($event) {
case 'createElement':
$caller->setType($arg[0], PARAM_INT);
break;
}
return parent::onQuickFormEvent($event, $arg, $caller);
}

/** /**
* Sets name of filemanager * Sets name of filemanager
* *
Expand Down Expand Up @@ -263,9 +281,9 @@ function toHtml() {
$output = $PAGE->get_renderer('core', 'files'); $output = $PAGE->get_renderer('core', 'files');
$html .= $output->render($fm); $html .= $output->render($fm);


$html .= '<input value="'.$draftitemid.'" name="'.$elname.'" type="hidden" />'; $html .= html_writer::empty_tag('input', array('value' => $draftitemid, 'name' => $elname, 'type' => 'hidden'));
// label element needs 'for' attribute work // label element needs 'for' attribute work
$html .= '<input value="" id="id_'.$elname.'" type="hidden" />'; $html .= html_writer::empty_tag('input', array('value' => '', 'id' => 'id_'.$elname, 'type' => 'hidden'));


return $html; return $html;
} }
Expand Down

0 comments on commit e417377

Please sign in to comment.