]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14129, creating error string
authordongsheng <dongsheng>
Thu, 10 Apr 2008 03:44:09 +0000 (03:44 +0000)
committerdongsheng <dongsheng>
Thu, 10 Apr 2008 03:44:09 +0000 (03:44 +0000)
admin/multilangupgrade.php
admin/register.php
admin/replace.php
admin/upgradeforumread.php
admin/upgradelogs.php
admin/uploadpicture.php
admin/uploaduser.php
admin/user.php
lang/en_utf8/debug.php
lang/en_utf8/error.php

index 257bea2c721515a1a4887a9a48d2798067ce959b..72dff0ae4445826a44f7e7fce44069c9fa11b5b0 100644 (file)
@@ -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');
index 877b787a1f7ca17dae886166b9278f5c400c5111..bb0ce1726659524893c31537238e81e1669557c7 100644 (file)
@@ -16,7 +16,7 @@
     }
 
     if (!$admin = get_admin()) {
-        print_error("No admins");
+        print_error('noadmins', 'error');
     }
 
     if (!$admin->country and $CFG->country) {
index 98783ca50760e1c3371bd9d7091b910f91e43794..1a6a2a35d1098a3fbfec56a4d117f18a3f125526 100644 (file)
@@ -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();
index edf0c4d791c83a99162f914ee787bf00acefddd4..55b46579ecf22a286b54446604ad5f2b5a9d8960 100644 (file)
@@ -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()) {
index fa27125d0abf7ef1ae08bb3793a07776e33d75fa..9a7ebed6d97e6e254f46b1ffee9cdedbfa4dbde1 100644 (file)
@@ -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()) {
index 99dce0de52c1a11897faa32029ca1a7e4703ec6b..e39111e1029b62a539efc6af0f284166cca42f28 100644 (file)
@@ -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');
index b8f8854d9f8f0f8404f57d57c20226f030902fc5..101dba6e7b84da39b9c395253487806713b8df9e 100755 (executable)
@@ -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
index eb1fd6f559796f579923f90a56e9b7803439de14..0eb045da652e72b0be5537d58a5721fd72c05100 100644 (file)
@@ -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);
     } 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)) {
     } 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)) {
             $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');
index 35ea066847a6c19cac655b7aef52b48e4f119633..58e972c463df0d346058d5a424f50a2a06b123e1 100644 (file)
@@ -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])';
index 297740afe0dbebd6c509daced0edd32d2ecad46a..d09ff857e17ce9e88540cb4bf0cdfe0acf12a02e 100644 (file)
@@ -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.';