MDL-22056 simplified component name handling + converting reports to proper pluginname
AMOS BEGIN MOV [capability,report_capability],[pluginname,report_capability] MOV [questioninstances,report_questioninstances],[pluginname,report_questioninstances] MOV [reportsecurity,report_security],[pluginname,report_security] MOV [spamcleaner,report_spamcleaner],[pluginname,report_spamcleaner] AMOS END
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['capability'] = 'Capability report';
|
||||
$string['capabilitylabel'] = 'Capability:';
|
||||
$string['capabilityreport'] = 'Capability report';
|
||||
$string['forroles'] = 'For roles {$a}';
|
||||
@@ -31,6 +30,7 @@ $string['getreport'] = 'Get the report';
|
||||
$string['changeoverrides'] = 'Change overrides in this context';
|
||||
$string['changeroles'] = 'Change role definitions';
|
||||
$string['intro'] = 'This report shows, for a particular capability, what permission that capability has in the definition of every role (or a selection of roles), and everywhere in the site where that capability is overridden.';
|
||||
$string['pluginname'] = 'Capability report';
|
||||
$string['reportforcapability'] = 'Report for capability \'{$a}\'';
|
||||
$string['reportsettings'] = 'Report settings';
|
||||
$string['roleslabel'] = 'Roles:';
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('capability', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
|
||||
$ADMIN->add('roles', new admin_externalpage('reportcapability', get_string('pluginname', 'report_capability'), "$CFG->wwwroot/$CFG->admin/report/capability/index.php",'moodle/role:manage'));
|
||||
|
||||
@@ -24,3 +24,4 @@
|
||||
*/
|
||||
|
||||
$string['courseoverview:view'] = 'View course overview report';
|
||||
$string['pluginname'] = 'Course overview';
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('courseoverview', 'admin'), "$CFG->wwwroot/$CFG->admin/report/courseoverview/index.php",'report/courseoverview:view'));
|
||||
$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('pluginname', 'report_courseoverview'), "$CFG->wwwroot/$CFG->admin/report/courseoverview/index.php",'report/courseoverview:view'));
|
||||
|
||||
@@ -27,7 +27,7 @@ $string['editquestionshere'] = 'Edit questions in this context';
|
||||
$string['getreport'] = 'Get the report';
|
||||
$string['hiddenquestions'] = 'Hidden';
|
||||
$string['intro'] = 'This report lists all the contexts in the system where there are questions of a particular type.';
|
||||
$string['questioninstances'] = 'Question instances';
|
||||
$string['pluginname'] = 'Question instances';
|
||||
$string['questioninstances:view'] = 'View question instances report';
|
||||
$string['reportforallqtypes'] = 'Report for all question types';
|
||||
$string['reportformissingqtypes'] = 'Report for question of unknown types';
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$ADMIN->add('reports', new admin_externalpage('reportquestioninstances', get_string('questioninstances', 'report_questioninstances'), "$CFG->wwwroot/$CFG->admin/report/questioninstances/index.php", 'report/questioninstances:view'));
|
||||
$ADMIN->add('reports', new admin_externalpage('reportquestioninstances', get_string('pluginname', 'report_questioninstances'), "$CFG->wwwroot/$CFG->admin/report/questioninstances/index.php", 'report/questioninstances:view'));
|
||||
|
||||
@@ -131,7 +131,7 @@ $string['check_unsecuredataroot_name'] = 'Insecure dataroot';
|
||||
$string['check_unsecuredataroot_ok'] = 'Dataroot directory must not be accessible via the web.';
|
||||
$string['check_unsecuredataroot_warning'] = 'Your dataroot directory <code>{$a}</code> is in the wrong location and might be exposed to the web.';
|
||||
$string['issue'] = 'Issue';
|
||||
$string['reportsecurity'] = 'Security overview';
|
||||
$string['pluginname'] = 'Security overview';
|
||||
$string['security:view'] = 'View security report';
|
||||
$string['status'] = 'Status';
|
||||
$string['statuscritical'] = 'Critical';
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$ADMIN->add('reports', new admin_externalpage('reportsecurity', get_string('reportsecurity', 'report_security'), "$CFG->wwwroot/$CFG->admin/report/security/index.php",'report/security:view'));
|
||||
$ADMIN->add('reports', new admin_externalpage('reportsecurity', get_string('pluginname', 'report_security'), "$CFG->wwwroot/$CFG->admin/report/security/index.php",'report/security:view'));
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Spam cleaner';
|
||||
$string['spamauto'] = 'Autodetect common spam patterns';
|
||||
$string['spamcannotdelete'] = 'Cannot delete this user';
|
||||
$string['spamcannotfinduser'] = 'No users matching your search';
|
||||
$string['spamcleaner'] = 'Spam cleaner';
|
||||
$string['spamcleanerintro'] = 'This script allows you to search all user profiles for certain strings and then delete those accounts which are obviously created by spammers. You can search for multiple keywords using commas (eg casino, porn)<br /><br />Moodle docs has more information about <a href="http://docs.moodle.org/en/Reducing_spam_in_Moodle">Reducing spam in Moodle</a>.';
|
||||
$string['spamdeleteall'] = 'Delete all these user accounts';
|
||||
$string['spamdeleteallconfirm'] = 'Are you sure you want to delete all these user accounts? You can not undo this.';
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
// spam cleaner
|
||||
$ADMIN->add('reports', new admin_externalpage('reportspamcleaner', get_string('spamcleaner', 'report_spamcleaner'), "$CFG->wwwroot/$CFG->admin/report/spamcleaner/index.php", 'moodle/site:config'));
|
||||
$ADMIN->add('reports', new admin_externalpage('reportspamcleaner', get_string('pluginname', 'report_spamcleaner'), "$CFG->wwwroot/$CFG->admin/report/spamcleaner/index.php", 'moodle/site:config'));
|
||||
|
||||
|
||||
@@ -23,4 +23,5 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'Unit tests';
|
||||
$string['unittest:view'] = 'Execute unit tests';
|
||||
|
||||
+33
-76
@@ -3991,7 +3991,7 @@ function get_capability_string($capabilityname) {
|
||||
$dir = get_component_directory($component);
|
||||
if (!file_exists($dir)) {
|
||||
// plugin broken or does not exist, do not bother with printing of debug message
|
||||
return $capabilityname;
|
||||
return $capabilityname.' ???';
|
||||
}
|
||||
|
||||
// something is wrong in plugin, better print debug
|
||||
@@ -4008,84 +4008,41 @@ function get_capability_string($capabilityname) {
|
||||
*/
|
||||
function get_component_string($component, $contextlevel) {
|
||||
|
||||
switch ($contextlevel) {
|
||||
|
||||
case CONTEXT_SYSTEM:
|
||||
if (preg_match('|^enrol|', $component)) {
|
||||
$langname = str_replace('/', '_', $component);
|
||||
$string = get_string('pluginname', $langname);
|
||||
} else if (preg_match('|^block|', $component)) {
|
||||
$langname = str_replace('/', '_', $component);
|
||||
$string = get_string('pluginname', $langname);
|
||||
} else if (preg_match('|^local|', $component)) {
|
||||
$langname = str_replace('/', '_', $component);
|
||||
$string = get_string('local');
|
||||
} else if (preg_match('|^repository|', $component)) {
|
||||
$string = get_string('repository', 'repository').': '.get_string('pluginname', $component);
|
||||
} else if (preg_match('|^report|', $component)) {
|
||||
$string = get_string('reports');
|
||||
} else {
|
||||
$string = get_string('coresystem');
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTEXT_USER:
|
||||
$string = get_string('users');
|
||||
break;
|
||||
|
||||
case CONTEXT_COURSECAT:
|
||||
if (preg_match('|^enrol|', $component)) {
|
||||
$langname = str_replace('/', '_', $component);
|
||||
$string = get_string('pluginname', $langname);
|
||||
} else {
|
||||
$string = get_string('categories');
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTEXT_COURSE:
|
||||
if (preg_match('|^enrol|', $component)) {
|
||||
$langname = str_replace('/', '_', $component);
|
||||
$string = get_string('pluginname', $langname);
|
||||
} else if (preg_match('|^gradeimport|', $component)) {
|
||||
$string = get_string('gradeimport', 'grades').': '.get_string('pluginname', $component);
|
||||
} else if (preg_match('|^gradeexport|', $component)) {
|
||||
$string = get_string('gradeexport', 'grades').': '.get_string('pluginname', $component);
|
||||
} else if (preg_match('|^gradereport|', $component)) {
|
||||
$string = get_string('gradereport', 'grades').': '.get_string('pluginname', $component);
|
||||
} else if (preg_match('|^coursereport|', $component)) {
|
||||
$string = get_string('coursereport').': '.get_string('pluginname', $component);
|
||||
} else if (preg_match('|^webservice|', $component)) {
|
||||
$string = get_string('webservice', 'webservice').': '.get_string('pluginname', $component);
|
||||
if ($component === 'moodle' or $component === 'core') {
|
||||
switch ($contextlevel) {
|
||||
case CONTEXT_SYSTEM: return get_string('coresystem');
|
||||
case CONTEXT_USER: return get_string('users');
|
||||
case CONTEXT_COURSECAT: return get_string('categories');
|
||||
case CONTEXT_COURSE: return get_string('course');
|
||||
case CONTEXT_MODULE: return get_string('activities');
|
||||
case CONTEXT_BLOCK: return get_string('block');
|
||||
default: print_error('unknowncontext');
|
||||
}
|
||||
}
|
||||
|
||||
list($type, $name) = normalize_component($component);
|
||||
$dir = get_plugin_directory($type, $name);
|
||||
if (!file_exists($dir)) {
|
||||
// plugin not installed, bad luck, there is no way to find the name
|
||||
return $component.' ???';
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 'quiz': return get_string($name.':componentname', $component);// insane hack!!!
|
||||
case 'repository': return get_string('repository', 'repository').': '.get_string('pluginname', $component);
|
||||
case 'gradeimport': return get_string('gradeimport', 'grades').': '.get_string('pluginname', $component);
|
||||
case 'gradeexport': return get_string('gradeexport', 'grades').': '.get_string('pluginname', $component);
|
||||
case 'gradereport': return get_string('gradereport', 'grades').': '.get_string('pluginname', $component);
|
||||
case 'webservice': return get_string('webservice', 'webservice').': '.get_string('pluginname', $component);
|
||||
case 'block': return get_string('block').': '.get_string('pluginname', basename($component));
|
||||
case 'mod':
|
||||
if (get_string_manager()->string_exists('pluginname', $component)) {
|
||||
return get_string('activity').': '.get_string('pluginname', $component);
|
||||
} else {
|
||||
$string = get_string('course');
|
||||
return get_string('activity').': '.get_string('modulename', $component);
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTEXT_MODULE:
|
||||
if (preg_match('|^quiz_([a-z_]*)|', $component, $matches)){
|
||||
$langname = 'quiz_'.$matches[1];
|
||||
$string = get_string($matches[1].':componentname', $langname);
|
||||
} else if (preg_match('|^moodle|', $component)) {
|
||||
$string = get_string('activities');
|
||||
} else {
|
||||
$string = get_string('activity').': '.get_string('modulename', preg_replace('#(\w+_)#', '', basename($component)));
|
||||
}
|
||||
break;
|
||||
|
||||
case CONTEXT_BLOCK:
|
||||
if ($component == 'moodle' ){
|
||||
$string = get_string('block');
|
||||
}else{
|
||||
$string = get_string('block').': '.get_string('pluginname', basename($component));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
print_error('unknowncontext');
|
||||
return false;
|
||||
|
||||
default: return get_string('pluginname', $component);
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user