Skip to content
Browse files

MDL-30817 activity_completion: Fixed title and alt string (on checkbo…

…x) to have module name prefixed
  • Loading branch information...
1 parent c91704e commit aadf8518c462087d4a6a438946a686333326f4fb @rajeshtaneja rajeshtaneja committed
Showing with 23 additions and 14 deletions.
  1. +14 −6 course/completion.js
  2. +3 −2 course/lib.php
  3. +6 −6 lang/en/completion.php
View
20 course/completion.js
@@ -18,17 +18,21 @@ M.core_completion.init = function(Y) {
} else {
var current = args.state.get('value');
-
+ var modulename = args.modulename.get('value');
if (current == 1) {
+ var altstr = M.str.completion['completion-alt-manual-y'].replace('{$a}', modulename);
+ var titlestr = M.str.completion['completion-title-manual-y'].replace('{$a}', modulename);
args.state.set('value', 0);
args.image.set('src', M.util.image_url('i/completion-manual-y', 'moodle'));
- args.image.set('alt', M.str.completion['completion-alt-manual-y']);
- args.image.set('title', M.str.completion['completion-title-manual-y']);
+ args.image.set('alt', altstr);
+ args.image.set('title', titlestr);
} else {
+ var altstr = M.str.completion['completion-alt-manual-n'].replace('{$a}', modulename);
+ var titlestr = M.str.completion['completion-title-manual-n'].replace('{$a}', modulename);
args.state.set('value', 1);
args.image.set('src', M.util.image_url('i/completion-manual-n', 'moodle'));
- args.image.set('alt', M.str.completion['completion-alt-manual-n']);
- args.image.set('title', M.str.completion['completion-title-manual-n']);
+ args.image.set('alt', altstr);
+ args.image.set('title', titlestr);
}
}
@@ -48,6 +52,7 @@ M.core_completion.init = function(Y) {
var completionstate = 0;
var state = null;
var image = null;
+ var modulename = null;
var inputs = Y.Node.getDOMNode(form).getElementsByTagName('input');
for (var i=0; i<inputs.length; i++) {
@@ -59,6 +64,9 @@ M.core_completion.init = function(Y) {
completionstate = inputs[i].value;
state = Y.one(inputs[i]);
break;
+ case 'modulename':
+ modulename = Y.one(inputs[i]);
+ break;
}
if (inputs[i].type == 'image') {
image = Y.one(inputs[i]);
@@ -76,7 +84,7 @@ M.core_completion.init = function(Y) {
success: handle_success,
failure: handle_failure
},
- arguments: {state: state, image: image, ajax: ajax}
+ arguments: {state: state, image: image, ajax: ajax, modulename: modulename}
};
Y.use('io', function(Y) {
View
5 course/lib.php
@@ -1719,9 +1719,9 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
}
if ($completionicon) {
$imgsrc = $OUTPUT->pix_url('i/completion-'.$completionicon);
- $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion'));
+ $imgalt = s(get_string('completion-alt-'.$completionicon, 'completion', $mod->name));
if ($completion == COMPLETION_TRACKING_MANUAL && !$isediting) {
- $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion'));
+ $imgtitle = s(get_string('completion-title-'.$completionicon, 'completion', $mod->name));
$newstate =
$completiondata->completionstate==COMPLETION_COMPLETE
? COMPLETION_INCOMPLETE
@@ -1740,6 +1740,7 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
echo "
<form class='togglecompletion$extraclass' method='post' action='".$CFG->wwwroot."/course/togglecompletion.php'><div>
<input type='hidden' name='id' value='{$mod->id}' />
+<input type='hidden' name='modulename' value='".s($mod->name)."' />
<input type='hidden' name='sesskey' value='".sesskey()."' />
<input type='hidden' name='completionstate' value='$newstate' />
<input type='image' src='$imgsrc' alt='$imgalt' title='$imgtitle' />
View
12 lang/en/completion.php
@@ -36,12 +36,12 @@
$string['completion_link'] = 'activity/completion';
$string['completion-alt-auto-enabled'] = 'The system marks this item complete according to conditions';
$string['completion-alt-auto-fail'] = 'Completed (did not achieve pass grade)';
-$string['completion-alt-auto-n'] = 'Not completed';
+$string['completion-alt-auto-n'] = 'Not completed: {$a}';
$string['completion-alt-auto-pass'] = 'Completed (achieved pass grade)';
-$string['completion-alt-auto-y'] = 'Completed';
+$string['completion-alt-auto-y'] = 'Completed: {$a}';
$string['completion-alt-manual-enabled'] = 'Students can manually mark this item complete';
-$string['completion-alt-manual-n'] = 'Not completed; select to mark as complete';
-$string['completion-alt-manual-y'] = 'Completed; select to mark as not complete';
+$string['completion-alt-manual-n'] = 'Not completed: {$a}. Select to mark as complete.';
+$string['completion-alt-manual-y'] = 'Completed: {$a}. Select to mark as not complete.';
$string['completion_automatic'] = 'Show activity as complete when conditions are met';
$string['completiondisabled'] = 'Disabled, not shown in activity settings';
$string['completionexpected'] = 'Expect completed on';
@@ -54,8 +54,8 @@
If a blank tick box is shown, a tick will appear automatically when you have completed the activity according to conditions set by the teacher.';
$string['completion_manual'] = 'Students can manually mark the activity as completed';
$string['completion_none'] = 'Do not indicate activity completion';
-$string['completion-title-manual-n'] = 'Mark as complete';
-$string['completion-title-manual-y'] = 'Mark as not complete';
+$string['completion-title-manual-n'] = 'Mark as complete: {$a}';
+$string['completion-title-manual-y'] = 'Mark as not complete: {$a}';
$string['completionnotenabled'] = 'Completion is not enabled';
$string['completionnotenabledforcourse'] = 'Completion is not enabled for this course';
$string['completionnotenabledforsite'] = 'Completion is not enabled for this site';

0 comments on commit aadf851

Please sign in to comment.
Something went wrong with that request. Please try again.