Commit 8e9d88f2 authored by dongsheng's avatar dongsheng
Browse files

MDL-14129, creating error string

parent e6924a01
......@@ -25,7 +25,7 @@ if (!$go or !data_submitted() or !confirm_sesskey()) { /// Print a form
if (!$tables = $db->Metatables() ) { // No tables yet at all.
print_error("no tables");
print_error('notables', 'debug');
}
print_simple_box_start('center');
......
......@@ -16,7 +16,7 @@
}
if (!$admin = get_admin()) {
print_error("No admins");
print_error('noadmins', 'error');
}
if (!$admin->country and $CFG->country) {
......
......@@ -35,7 +35,7 @@ if (!data_submitted() or !$search or !$replace or !confirm_sesskey()) { /// Pr
print_simple_box_start('center');
if (!db_replace($search, $replace)) {
print_error('An error has occured during this process');
print_error('erroroccur', debug);
}
print_simple_box_end();
......
......@@ -9,7 +9,7 @@
$confirm = optional_param('confirm', 0, PARAM_BOOL);
if ($CFG->version < 2005042300) {
print_error("This script does not work with this old version of Moodle");
print_error('doesnotworkwitholdversion', 'debug');
}
if (!$site = get_site()) {
......
......@@ -8,7 +8,7 @@
$confirm = optional_param('confirm', 0, PARAM_BOOL);
if ($CFG->version < 2004013101) {
print_error("This script does not work with this old version of Moodle");
print_error('doesnotworkwitholdversion', 'debug');
}
if (!$site = get_site()) {
......
......@@ -35,11 +35,11 @@ require_login();
require_capability('moodle/site:uploadusers', get_context_instance(CONTEXT_SYSTEM, SITEID));
if (!$site = get_site()) {
print_error("Could not find site-level course");
print_error('cannotfindsite', 'error');
}
if (!$adminuser = get_admin()) {
print_error("Could not find site admin");
print_error('noadmins', 'error');
}
$strfile = get_string('file');
......
......@@ -110,7 +110,7 @@ if (empty($iid)) {
}
if (!$columns = $cir->get_columns()) {
print_error('Error reading temporary file', '', $returnurl);
print_error('cannotreadtmpfile', 'error', $returnurl);
}
$mform = new admin_uploaduser_form2(null, $columns);
// get initial date from form1
......
......@@ -22,7 +22,7 @@
$site = get_site();
if (!has_capability('moodle/user:update', $sitecontext) and !has_capability('moodle/user:delete', $sitecontext)) {
print_error('You do not have the required permission to edit/delete users.');
print_error('nopermissions', 'error', '', 'edit/delete users');
}
$stredit = get_string('edit');
......@@ -40,7 +40,7 @@
if ($confirmuser and confirm_sesskey()) {
if (!$user = get_record('user', 'id', $confirmuser)) {
print_error("No such user!");
print_error('nousers');
}
$auth = get_auth_plugin($user->auth);
......@@ -56,15 +56,15 @@
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
if (!has_capability('moodle/user:delete', $sitecontext)) {
print_error('You do not have the required permission to delete a user.');
print_error('nopermissions', 'error', '', 'delete a user');
}
if (!$user = get_record('user', 'id', $delete)) {
print_error("No such user!");
print_error('nousers', 'error');
}
if (is_primary_admin($user->id)) {
print_error("You are not allowed to delete the primary admin user!");
print_error('nopermissions', 'error', '', 'delete the primary admin user');
}
if ($confirm != md5($delete)) {
......@@ -84,17 +84,17 @@
} else if ($acl and confirm_sesskey()) {
if (!has_capability('moodle/user:delete', $sitecontext)) {
// TODO: this should be under a separate capability
print_error('You are not permitted to modify the MNET access control list.');
print_error('nopermissions', 'error', '', 'modify the NMET access control list');
}
if (!$user = get_record('user', 'id', $acl)) {
print_error("No such user.");
print_error('nousers', 'error');
}
if (!is_mnet_remote_user($user)) {
print_error('Users in the MNET access control list must be remote MNET users.');
print_error('usermustbemnet', 'error');
}
$accessctrl = strtolower(required_param('accessctrl', PARAM_ALPHA));
if ($accessctrl != 'allow' and $accessctrl != 'deny') {
print_error('Invalid access parameter.');
print_error('invalidaccessparameter', 'error');
}
$aclrecord = get_record('mnet_sso_access_control', 'username', $user->username, 'mnet_host_id', $user->mnethostid);
if (empty($aclrecord)) {
......@@ -103,12 +103,12 @@
$aclrecord->username = $user->username;
$aclrecord->accessctrl = $accessctrl;
if (!insert_record('mnet_sso_access_control', $aclrecord)) {
print_error("Database error - Couldn't modify the MNET access control list.");
print_error('dbnotinsert', 'debug', '', 'the MNET access control list');
}
} else {
$aclrecord->accessctrl = $accessctrl;
if (!update_record('mnet_sso_access_control', $aclrecord)) {
print_error("Database error - Couldn't modify the MNET access control list.");
print_error('dbnotupdate', 'debug', '', 'the MNET access control list');
}
}
$mnethosts = get_records('mnet_host', '', '', 'id', 'id,wwwroot,name');
......
......@@ -7,9 +7,14 @@ $string['cannotupdateversion'] = 'Upgrade failed! (Could not update version in
$string['cannotupdaterelease'] = 'ERROR: Could not update release version in database!!';
$string['cannotsetupsite'] = 'Serious Error! Could not set up the site!';
$string['configmoodle'] = 'Moodle has not been configured yet. You need to edit config.php first.';
$string['dbnotinsert'] = 'Database error - Cannot insert ($a)';
$string['dbnotupdate'] = 'Database error - Cannot update ($a)'
$string['dbnotsupport'] = 'Error: Your database ($a) is not yet fully supported by Moodle or install.xml is not present. See the lib/db directory.';
$string['dbnotsetup'] = 'Error: Main databases NOT set up successfully';
$string['doesnotworkwitholdversion'] = 'This script does not work with this old verion of moodle';
$string['erroroccur'] = 'An error has occured during this process';
$string['fixsetting'] = 'Please fix your settings in config.php: <p>You have:</p> <p>\$CFG->dirroot = \"$a[0]\";</p> <p>but it should be:</p> <p>\$CFG->dirroot = \"$a[1]\"</p>';
$string['notables'] = 'No Tables!';
$string['phpvaroff'] = 'The PHP server variable \'$a[0]\' should be Off - $a[1]';
$string['phpvaron'] = 'The PHP server variable \'$a[0]\' is not turned On - $a[1]';
$string['prefixcannotbeempty'] = 'Table prefix \"$a[0]\" cannot be empty for your target DB ($a[1])';
......
......@@ -25,6 +25,8 @@ $string['cannotfinddocs'] = 'Cannot find \"$a\" language docs files';
$string['cannotfindinfo'] = 'Cannot find info for: \"$a\"';
$string['cannotfindhelp'] = 'Cannot find \"$a\" language help files';
$string['cannotfindlang'] = 'Cannot find \"$a\" language pack!';
$string['cannotfindsite'] = 'Cannot find site-level course';
$string['cannotreadtmpfile'] = 'Error reading temporary file';
$string['cannotsavefile'] = 'Cannot save the file \"$a\".';
$string['cannotsavemd5file'] = 'Cannot save md5 file.';
$string['cannotsavezipfile'] = 'Cannot save ZIP file.';
......@@ -65,6 +67,7 @@ $string['groupnotaddederror'] = 'Group \"$a\" not added';
$string['groupunknown'] = 'Group $a not associated to specified course';
$string['guestnoeditprofile'] = 'The guest user cannot edit their profile';
$string['guestnoeditprofileother'] = 'The guest user profile cannot be edited';
$string['invalidaccessparameter'] = 'Invalid access parameter.';
$string['invalidcourse'] = 'Invalid course';
$string['invalidfieldname'] = '\"$a\" is not a valid field name';
$string['invalidfiletype'] = '\"$a\" is not a valid file type';
......@@ -94,6 +97,8 @@ $string['mustbeteacher'] = 'You must be a teacher to look at this page';
$string['nocontext'] = 'Sorry, but that course is not a valid context';
$string['noinstances'] = 'There are no instances of $a in this course!';
$string['nologinas'] = 'You are not allowed to login as that user';
$string['noadmins'] = 'No administrators!';
$string['nousers'] = 'No such user!';
$string['nonmeaningfulcontent'] = 'Non meaningful content';
$string['noparticipatorycms'] = 'Sorry, but you have no participatory course modules to report on.';
$string['nopermissions'] = 'Sorry, but you do not currently have permissions to do that ($a)';
......@@ -124,6 +129,7 @@ $string['unknownuseraction'] = 'Sorry, I do not understand this user action.';
$string['userautherror'] = 'Unknown auth plugin.';
$string['userauthunsupported'] = 'Auth plugin not supported here.';
$string['useremailduplicate'] = 'Duplicate address';
$string['usermustbemnet'] = 'Users in the MNET access control list must be remote MNET users.';
$string['usernotaddedadmin'] = 'Can not delete admin accounts.';
$string['usernotaddederror'] = 'User not added - error.';
$string['usernotaddedregistered'] = 'User not added - already registered.';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment