Skip to content
This repository has been archived by the owner on Apr 8, 2022. It is now read-only.

Commit

Permalink
MDL-28286 JavaScript: Convert all uses of M.str to M.util.get_string
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols authored and Sam Hemelryk committed Nov 30, 2014
1 parent d87bcfb commit 64e7aa4
Show file tree
Hide file tree
Showing 73 changed files with 427 additions and 440 deletions.
4 changes: 2 additions & 2 deletions admin/roles/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ M.core_role.init_cap_table_filter = function(Y, tableid, contextid) {
// Create the capability search input.
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
// Create a label for the search input.
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.str.moodle.filter+' </label>');
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.util.get_string('filter', 'moodle')+' </label>');
// Create a clear button to clear the input.
this.button = Y.Node.create('<input type="button" value="'+M.str.moodle.clear+'" />').set('disabled', filtervalue=='');
this.button = Y.Node.create('<input type="button" value="'+M.util.get_string('clear', 'moodle')+'" />').set('disabled', filtervalue=='');

// Tie it all together
this.div.append(this.label).append(this.input).append(this.button);
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/assignmentupgrade/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ M.tool_assignmentupgrade = {
assignmentsinput = Y.one('input.selectedassignments');
assignmentsinput.set('value', selectedassignments.join(','));
if (selectedassignments.length == 0) {
alert(M.str.tool_assignmentupgrade.noassignmentsselected);
alert(M.util.get_string('noassignmentsselected', 'tool_assignmentupgrade'));
e.preventDefault();
}
});
Expand Down
12 changes: 6 additions & 6 deletions admin/tool/spamcleaner/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ M.tool_spamcleaner = {
del_all: function() {
var context = M.tool_spamcleaner;

var yes = confirm(M.str.tool_spamcleaner.spamdeleteallconfirm);
var yes = confirm(M.util.get_string('spamdeleteallconfirm', 'tool_spamcleaner'));
if (yes) {
var cfg = {
method: "POST",
Expand All @@ -15,7 +15,7 @@ M.tool_spamcleaner = {
try {
var resp = context.Y.JSON.parse(o.responseText);
} catch(e) {
alert(M.str.tool_spamcleaner.spaminvalidresult);
alert(M.util.get_string('spaminvalidresult', 'tool_spamcleaner'));
return;
}
if (resp == true) {
Expand All @@ -36,7 +36,7 @@ M.tool_spamcleaner = {
return;
}

var yes = confirm(M.str.tool_spamcleaner.spamdeleteconfirm);
var yes = confirm(M.util.get_string('spamdeleteconfirm', 'tool_spamcleaner'));
if (yes) {
context.row = obj;
var cfg = {
Expand All @@ -46,7 +46,7 @@ M.tool_spamcleaner = {
try {
var resp = context.Y.JSON.parse(o.responseText);
} catch(e) {
alert(M.str.tool_spamcleaner.spaminvalidresult);
alert(M.util.get_string('spaminvalidresult', 'tool_spamcleaner'));
return;
}
if (context.row) {
Expand All @@ -57,7 +57,7 @@ M.tool_spamcleaner = {
context.row.parentNode.removeChild(context.row);
context.row = null;
} else {
alert(M.str.tool_spamcleaner.spamcannotdelete);
alert(M.util.get_string('spamcannotdelete', 'tool_spamcleaner'));
}
}
}
Expand All @@ -83,7 +83,7 @@ M.tool_spamcleaner = {
try {
var resp = context.Y.JSON.parse(o.responseText);
} catch(e) {
alert(M.str.tool_spamcleaner.spaminvalidresult);
alert(M.util.get_string('spaminvalidresult', 'tool_spamcleaner'));
return;
}
if (context.row) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ M.availability_completion.form.initInner = function(cms) {

M.availability_completion.form.getNode = function(json) {
// Create HTML structure.
var strings = M.str.availability_completion;
var html = strings.title + ' <span class="availability-group"><label>' +
'<span class="accesshide">' + strings.label_cm + ' </span>' +
'<select name="cm" title="' + strings.label_cm + '">' +
'<option value="0">' + M.str.moodle.choosedots + '</option>';
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.cms.length; i++) {
var cm = this.cms[i];
// String has already been escaped using format_string.
html += '<option value="' + cm.id + '">' + cm.name + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + strings.label_completion +
' </span><select name="e" title="' + strings.label_completion + '">' +
'<option value="1">' + strings.option_complete + '</option>' +
'<option value="0">' + strings.option_incomplete + '</option>' +
'<option value="2">' + strings.option_pass + '</option>' +
'<option value="3">' + strings.option_fail + '</option>' +
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_completion', 'availability_completion') +
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
'</select></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,21 @@ M.availability_completion.form.initInner = function(cms) {

M.availability_completion.form.getNode = function(json) {
// Create HTML structure.
var strings = M.str.availability_completion;
var html = strings.title + ' <span class="availability-group"><label>' +
'<span class="accesshide">' + strings.label_cm + ' </span>' +
'<select name="cm" title="' + strings.label_cm + '">' +
'<option value="0">' + M.str.moodle.choosedots + '</option>';
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.cms.length; i++) {
var cm = this.cms[i];
// String has already been escaped using format_string.
html += '<option value="' + cm.id + '">' + cm.name + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + strings.label_completion +
' </span><select name="e" title="' + strings.label_completion + '">' +
'<option value="1">' + strings.option_complete + '</option>' +
'<option value="0">' + strings.option_incomplete + '</option>' +
'<option value="2">' + strings.option_pass + '</option>' +
'<option value="3">' + strings.option_fail + '</option>' +
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_completion', 'availability_completion') +
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
'</select></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');

Expand Down
21 changes: 10 additions & 11 deletions availability/condition/completion/yui/src/form/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,21 @@ M.availability_completion.form.initInner = function(cms) {

M.availability_completion.form.getNode = function(json) {
// Create HTML structure.
var strings = M.str.availability_completion;
var html = strings.title + ' <span class="availability-group"><label>' +
'<span class="accesshide">' + strings.label_cm + ' </span>' +
'<select name="cm" title="' + strings.label_cm + '">' +
'<option value="0">' + M.str.moodle.choosedots + '</option>';
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
for (var i = 0; i < this.cms.length; i++) {
var cm = this.cms[i];
// String has already been escaped using format_string.
html += '<option value="' + cm.id + '">' + cm.name + '</option>';
}
html += '</select></label> <label><span class="accesshide">' + strings.label_completion +
' </span><select name="e" title="' + strings.label_completion + '">' +
'<option value="1">' + strings.option_complete + '</option>' +
'<option value="0">' + strings.option_incomplete + '</option>' +
'<option value="2">' + strings.option_pass + '</option>' +
'<option value="3">' + strings.option_fail + '</option>' +
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_completion', 'availability_completion') +
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
'</select></label></span>';
var node = Y.Node.create('<span>' + html + '</span>');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ M.availability_date.form.initInner = function(html, defaultTime) {
};

M.availability_date.form.getNode = function(json) {
var strings = M.str.availability_date;
var html = strings.direction_before + ' <span class="availability-group">' +
'<label><span class="accesshide">' + strings.direction_label + ' </span>' +
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
'<select name="direction">' +
'<option value="&gt;=">' + strings.direction_from + '</option>' +
'<option value="&lt;">' + strings.direction_until + '</option>' +
'<option value="&gt;=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
'<option value="&lt;">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
'</select></label></span> ' + this.html;
var node = Y.Node.create('<span>' + html + '</span>');

Expand All @@ -58,7 +57,7 @@ M.availability_date.form.getNode = function(json) {
}
},
failure : function() {
window.alert(M.str.availability_date.ajaxerror);
window.alert(M.util.get_string('ajaxerror', 'availability_date'));
}
}});
} else {
Expand Down Expand Up @@ -132,7 +131,7 @@ M.availability_date.form.updateTime = function(node) {
M.core_availability.form.update();
},
failure : function() {
window.alert(M.str.availability_date.ajaxerror);
window.alert(M.util.get_string('ajaxerror', 'availability_date'));
}
}});
};
Expand Down
Loading

0 comments on commit 64e7aa4

Please sign in to comment.