]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14129, creating error string
authordongsheng <dongsheng>
Thu, 10 Apr 2008 02:56:25 +0000 (02:56 +0000)
committerdongsheng <dongsheng>
Thu, 10 Apr 2008 02:56:25 +0000 (02:56 +0000)
admin/lang.php
admin/langimport.php
admin/maintenance.php
admin/modules.php

index 582b0ac136d34089c0b7840637eb1fc7701c748b..84930877dfcf3cbf35092f8384b15486eb7182c7 100644 (file)
     }
 
     if (!has_capability('moodle/site:langeditmaster', $context, $USER->id, false) && (!$uselocal)) {
-        print_error('cannoteditmasterlang');
+        print_error('cannoteditmasterlang', 'error');
     }
 
     if ((!has_capability('moodle/site:langeditlocal', $context, $USER->id, false)) && ($uselocal)) {
-        print_error('cannotcustomizelocallang');
+        print_error('cannotcustomizelocallang', 'error');
     }
 
     $strlanguage = get_string("language");
             $stringfiles += lang_extra_locations();
         }
         if (count($stringfiles) == 0) {
-            print_error("Could not find English language pack!");
+            print_error('cannotfindlang', 'error', '', 'English');
         }
     } elseif ($mode == 'helpfiles') {
         $helpfiles = lang_help_standard_locations();
             $helpfiles += lang_help_extra_locations();
         }
         if (count($helpfiles) == 0) {
-            print_error("Could not find help files in the English language pack!");
+            print_error("cannotfindhelp", 'error', '', 'English');
         }
     }
 
         echo $o;
 
         if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/help", "CVS")) {
-            print_error("Could not find English language help files!");
+            print_error("cannotfindhelp", 'error', '', 'English');
         }
 
         foreach ($files as $filekey => $file) {    // check all the help files.
         }
 
         if (! $files = get_directory_list("$CFG->dirroot/lang/en_utf8/docs", "CVS")) {
-            print_error("Could not find English language docs files!");
+            print_error("cannotfinddoc", 'error', '', 'English');
         }
         foreach ($files as $filekey => $file) {    // check all the docs files.
             if (!file_exists("$langdir/docs/$file")) {
 
         if (!file_exists($langbase) ){
             if (!lang_make_directory($langbase) ){
-                print_error('ERROR: Could not create base lang directory ' . $langbase);
+                print_error('cannotcreatelangbase', 'error');
             } else {
                 echo '<div class="notifysuccess">Created directory '.
                                                      $langbase .'</div>'."<br />\n";
         }
         if (!$uselocal && !file_exists($langdir)) {
             if (!lang_make_directory($langdir)) {
-                print_error('ERROR: Could not create directory '.$langdir);
+                print_error('cannotcreatelangdir', 'error');
             } else {
                 echo '<div class="notifysuccess">Created directory '.
                                                      $langdir .'</div>'."<br />\n";
 
         if ($currentfile <> '') {
             if (!$fileinfo = lang_get_file_info($currentfile, $stringfiles)) {
-                print_error('Unable to find info for: '.$currentfile);
+                print_error('cannotfindinfo', 'error', '', $currentfile);
             }
             // check the filename is set up correctly, prevents bugs similar to MDL-10920
             $location = $fileinfo['location'];
             if ($location || $plugin) {
                 // file in an extra location
                 if ($currentfile != "{$prefix}{$plugin}.php") {
-                    print_error("Non-core filename mismatch. The file $currentfile should be {$prefix}{$plugin}.php");
+                    print_error('filemismatch', 'error', '', array($currectfile, $prefix, $plugin));
                 }
                 if (!$uselocal) {
                     notify($streditingnoncorelangfile);
             } else {
                 // file in standard location
                 if ($currentfile != $filename) {
-                    print_error("Core filename mismatch. The file $currentfile should be $filename");
+                    print_error('filemismatch', 'error', '', array($currectfile, $filename, ''));
                 }
             }
 
             if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
                 notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
             } else {
-                print_error("Could not save the file '$saveinto/$currentfile'!", '', "lang.php?mode=compare&amp;currentfile=$currentfile");
+                print_error('cannotsavefile', 'error', 'lang.php?mode=compare&amp;currentfile=$currentfile', array($saveinto, $currentfile));
             }
             unset($packstring);
         }
             if (lang_help_save_file($saveto, $currentfile, $_POST['filedata'])) {
                 notify(get_string("changessaved")." ($saveto/$currentfile)", "notifysuccess");
             } else {
-                print_error("Could not save the file '$currentfile'!", '', "lang.php?mode=helpfiles&amp;currentfile=$currentfile&amp;sesskey=$USER->sesskey");
+                print_error('cannotsavefile', 'error', 'lang.php?mode=compare&amp;currentfile=$currentfile', array($saveinto, $currentfile));
             }
         }
 
index d5d3d2d1f1f3934035c7beb2397518705c6827bf..02b57d3b60616ab50d00ad5ff7d90cfeb3251a18 100755 (executable)
@@ -30,7 +30,7 @@
     //reset and diagnose lang cache permissions
     @unlink($CFG->dataroot.'/cache/languages');
     if (file_exists($CFG->dataroot.'/cache/languages')) {
-        print_error('Language cache can not be deleted, please fix permissions in dataroot/cache/languages!');
+        print_error('cannotdeletelangcache', 'error');
     }
     get_list_of_languages(true); //refresh lang cache
 
 
 
             if (!$availablelangs = get_remote_list_of_languages()) {
-                print_error('cannotdownloadlanguageupdatelist');
+                print_error('cannotdownloadlanguageupdatelist', 'error');
             }
 
             //and build an associative array
index 6f0498d3ebbe8331ebe98497b588905117881363..071a873254c34327cd91d64a5022814bb33d5055 100644 (file)
@@ -10,7 +10,7 @@
 
     //Check folder exists
     if (! make_upload_directory(SITEID)) {   // Site folder
-            print_error("Could not create site folder.  The site administrator needs to fix the file permissions");
+            print_error('cannotcreatesitedir', 'error');
         }
 
     $filename = $CFG->dataroot.'/'.SITEID.'/maintenance.html';
index 8c53465b2d7a948baf499e0d2b7aaf4e5ec24cb0..ae83eb8a1b1c534ba5652144eb38f66c9dfe551c 100644 (file)
@@ -34,7 +34,7 @@
 
     if (!empty($hide) and confirm_sesskey()) {
         if (!$module = get_record("modules", "name", $hide)) {
-            print_error("Module doesn't exist!");
+            print_error('moduledoesnotexist', 'error');
         }
         set_field("modules", "visible", "0", "id", $module->id); // Hide main module
         // Remember the visibility status in visibleold
@@ -57,7 +57,7 @@
 
     if (!empty($show) and confirm_sesskey()) {
         if (!$module = get_record("modules", "name", $show)) {
-            print_error("Module doesn't exist!");
+            print_error('moduledoesnotexist', 'error');
         }
         set_field("modules", "visible", "1", "id", $module->id); // Show main module
         set_field('course_modules', 'visible', '1', 'visibleold',
         } else {  // Delete everything!!
 
             if ($delete == "forum") {
-                print_error("You can not delete the forum module!!");
+                print_error("cannotdeleteforummudule", 'forum');
             }
 
             if (!$module = get_record("modules", "name", $delete)) {
-                print_error("Module doesn't exist!");
+                print_error('moduledoesnotexist', 'error');
             }
 
             // OK, first delete all the relevant instances from all course sections
 /// Get and sort the existing modules
 
     if (!$modules = get_records("modules")) {
-        print_error("No modules found!!");        // Should never happen
+        print_error('moduledoesnotexist', 'error');
     }
 
     foreach ($modules as $module) {