]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14129, fix print_error call
authordongsheng <dongsheng>
Thu, 24 Apr 2008 02:24:49 +0000 (02:24 +0000)
committerdongsheng <dongsheng>
Thu, 24 Apr 2008 02:24:49 +0000 (02:24 +0000)
blog/edit.php
blog/header.php
lang/en_utf8/blog.php
lang/en_utf8/error.php

index 0e858febfaba69288cde7c295afcb2fe3bc98260..888dc18db03a89f28c118e04ad1c27e2bf465114 100755 (executable)
@@ -12,7 +12,7 @@ $courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tab - d
 require_login($courseid);
 
 if (empty($CFG->bloglevel)) {
-    print_error('Blogging is disabled!');
+    print_error('blogdisable', 'blog');
 }
 
 if (isguest()) {
@@ -21,13 +21,13 @@ if (isguest()) {
 
 $sitecontext = get_context_instance(CONTEXT_SYSTEM, SITEID);
 if (!has_capability('moodle/blog:create', $sitecontext) and !has_capability('moodle/blog:manageentries', $sitecontext)) {
-    print_error('You can not post or edit blogs.');
+    print_error('cannoteditpostorblog');
 }
 
 // Make sure that the person trying to edit have access right
 if ($id) {
     if (!$existing = get_record('post', 'id', $id)) {
-        print_error('Wrong blog post id');
+        print_error('wrongpostid', 'blog');
     }
 
     if (!blog_user_can_edit_post($existing)) {
@@ -52,7 +52,7 @@ $strblogs = get_string('blogs','blog');
 
 if ($action=='delete'){
     if (!$existing) {
-        print_error('Incorrect blog post id');
+        print_error('wrongpostid', 'blog');
     }
     if (data_submitted() and $confirm and confirm_sesskey()) {
         do_delete($existing);
@@ -83,12 +83,12 @@ if ($blogeditform->is_cancelled()){
 
         case 'edit':
             if (!$existing) {
-                print_error('Incorrect blog post id');
+                print_error('wrongpostid', 'blog');
             }
             do_edit($fromform, $blogeditform);
         break;
         default :
-            print_error('Unknown action!');
+            print_error('invalidaction');
     }
     redirect($returnurl);
 }
@@ -105,7 +105,7 @@ switch ($action) {
 
     case 'edit':
         if (!$existing) {
-            print_error('Incorrect blog post id');
+            print_error('wrongpostid', 'blog');
         }
         $post->id           = $existing->id;
         $post->subject      = $existing->subject;
@@ -124,12 +124,12 @@ switch ($action) {
         }
     break;
     default :
-        print_error('Unknown action!');
+        print_error('unknowaction');
 }
 
 // done here in order to allow deleting of posts with wrong user id above
 if (!$user = get_record('user', 'id', $userid)) {
-    print_error('Incorrect user id');
+    print_error('invaliduserid');
 }
 $navlinks = array();
 $navlinks[] = array('name' => fullname($user), 'link' => "$CFG->wwwroot/user/view.php?id=$userid", 'type' => 'misc');
@@ -164,7 +164,7 @@ function do_delete($post) {
     add_to_log(SITEID, 'blog', 'delete', 'index.php?userid='. $post->userid, 'deleted blog entry with entry id# '. $post->id);
 
     if (!$status) {
-        print_error('Error occured while deleting post', '', $returnurl);
+        print_error('deleteposterror', 'blog', $returnurl);
     }
 }
 
@@ -191,7 +191,7 @@ function do_add($post, $blogeditform) {
         add_to_log(SITEID, 'blog', 'add', 'index.php?userid='.$post->userid.'&postid='.$post->id, $post->subject);
 
     } else {
-        print_error('There was an error adding this post in the database', '', $returnurl);
+        print_error('deleteposterror', 'blog', $returnurl);
     }
 
 }
@@ -226,7 +226,7 @@ function do_edit($post, $blogeditform) {
         add_to_log(SITEID, 'blog', 'update', 'index.php?userid='.$USER->id.'&postid='.$post->id, $post->subject);
 
     } else {
-        print_error('There was an error updating this post in the database', '', $returnurl);
+        print_error('deleteposterror', 'blog', $returnurl);
     }
 }
 
index aee8625334cb7fd9281f1f1b8977a3d39f6ee776..63234d0c8a707fafb9d79446900e07a83076bce1 100755 (executable)
@@ -17,7 +17,7 @@ blog_check_and_install_blocks();
 
 
 if (!$course = get_record('course', 'id', $courseid)) {
-    print_error('The course number was incorrect ('. $courseid .')');
+    print_error('invalidcourseid', '', '', $courseid);
 }
 
 // Bounds for block widths
@@ -99,7 +99,7 @@ $tagstring = get_string('tag');
 
 // needed also for user tabs later
 if (!$course = get_record('course', 'id', $courseid)) {
-    print_error('Wrong course id');
+    print_error('invalidcourseid', '', '', $courseid);
 }
 
 $navlinks = array();
@@ -157,7 +157,7 @@ $navlinks = array();
                     print_header("$course->shortname: $blogstring", $course->fullname, $navigation,'','',true,$PAGE->get_extra_header_string());
                 }
             } else {
-                print_error('Unable to find group');
+                print_error('cannotfindgroup');
             }
 
         break;
@@ -165,7 +165,7 @@ $navlinks = array();
         case 'user':
             $participants = get_string('participants');
             if (!$user = get_record('user', 'id', $filterselect)) {
-               print_error('Wrong user id');
+               print_error('invaliduserid');
             }
 
             if ($course->id != SITEID) {
index d42dcffe77956fbaeb498b16636e4a5d2655883f..2e2d30154d65cf2a2f14b6991faebf53ef9a00ae 100755 (executable)
@@ -22,6 +22,7 @@ $string['courseblogdisable'] = 'Course blogs is not enabled';
 $string['courseblogs'] = 'Users can only see blogs for people who share a course';
 $strign['donothaveblog'] = 'You do not have your own blog, sorry.';
 $string['deleteotagswarn'] = 'Are you sure you want to remove this / these tags <br />from all blog posts and remove it from the system?';
+$string['deleteposterror'] = 'Error occured while deleting post';
 $string['disableblogs'] = 'Disable blog system completely';
 $string['emptybody'] = 'Blog entry body can not be empty';
 $string['emptytitle'] = 'Blog entry title can not be empty';
@@ -63,6 +64,7 @@ $string['userblog'] = 'User blog: $a';
 $string['viewcourseentries'] = 'View course entries';
 $string['viewmyentries'] = 'View my entries';
 $string['viewsiteentries'] = 'View site entries';
+$string['wrongpostid'] = 'Wrong blog post id';
 $string['worldblogs'] = 'The world can read entries set to be world-accessible';
 
 ?>
index dcee94252f4d3a8a23c2e78f81dfc18b216e3605..80fbbf3cde514acbd3304983fef8dda89fdab223 100644 (file)
@@ -22,10 +22,12 @@ $string['cannotdeleterolewithid'] = 'Could not delete role with ID $a';
 $string['cannotdownloadcomponents'] = 'Cannot download components.';
 $string['cannotdownloadlanguageupdatelist'] = 'Cannot download list of language updates from download.moodle.org';
 $string['cannotdownloadzipfile'] = 'Cannot download ZIP file.';
+$string['cannoteditpostorblog'] = 'You can not post or edit blogs.';
 $string['cannoteditmasterlang'] = 'You do not have permission to edit master language package. This permission is controlled by the capability "moodle/site:langeditmaster". Set this capability to allow you to edit master language packages in case you are the maintainer of a package.';
 $string['cannotfindcomponent'] = 'Cannot find component.';
 $string['cannotfindcategory'] = 'Cannot find category record from database by ID - $a';
 $string['cannotfinddocs'] = 'Cannot find \"$a\" language docs files';
+$string['cannotfindgroup'] = 'Unable to find group';
 $string['cannotfindinfo'] = 'Cannot find info for: \"$a\"';
 $string['cannotfindhelp'] = 'Cannot find \"$a\" language help files';
 $string['cannotfindlang'] = 'Cannot find \"$a\" language pack!';
@@ -83,7 +85,7 @@ $string['invalidaction'] = 'Invalid action parameter.';
 $string['invalidarguments'] = 'No valid arguments supplied';
 $string['invalidaccessparameter'] = 'Invalid access parameter.';
 $string['invalidcourse'] = 'Invalid course';
-$string['invalidcourseid'] = 'You are tring to view an invalid course. Id: $a';
+$string['invalidcourseid'] = 'You are tring to use an invalid course ID: ($a)';
 $string['invalidcoursemodule'] = 'Bad course module ID';
 $string['invalidfieldname'] = '\"$a\" is not a valid field name';
 $string['invalidfiletype'] = '\"$a\" is not a valid file type';
@@ -152,6 +154,7 @@ $string['statscatchupmode'] = 'Statistics is currently in catchup mode. So far $
 $string['tagnotfound'] = 'The specified tag was not found in the database';
 $string['unicodeupgradeerror'] = 'Sorry, but your database is not already in Unicode, and this version of Moodle is not able to migrate your database to Unicode.  Please upgrade to Moodle 1.7.x first and perform the Unicode migration from the Admin page.  After that is done you should be able to migrate to Moodle $a';
 $string['statsnodata'] = 'There is no available data for that combination of course and time period.';
+$string['unknowaction']= 'Unknown action!';
 $string['unknowncourse'] = 'Unknown course named \"$a\"';
 $string['unknowncourseidnumber'] = 'Unknown Course ID \"$a\"';
 $string['unknowngroup'] = 'Unknown group \"$a\"';