From de832702ad768a35fc48f129eb690a47a2ca2ca8 Mon Sep 17 00:00:00 2001 From: jerome mouneyrac Date: Tue, 22 Jun 2010 04:01:33 +0000 Subject: [PATCH] course publication MDL-22762 improve the publication confirmation/error message --- course/publish/index.php | 9 +++++---- course/publish/metadata.php | 3 ++- lang/en/hub.php | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/course/publish/index.php b/course/publish/index.php index f178e2ef69b..2ea43c3ade2 100644 --- a/course/publish/index.php +++ b/course/publish/index.php @@ -31,6 +31,8 @@ require_once($CFG->dirroot.'/admin/registration/lib.php'); require_once($CFG->dirroot.'/course/publish/lib.php'); $id = optional_param('id', 0, PARAM_INT); +$hubname = optional_param('hubname', 0, PARAM_TEXT); +$huburl = optional_param('huburl', 0, PARAM_URL); $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST); @@ -99,9 +101,7 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE, /// UNPUBLISH $cancel = optional_param('cancel', 0, PARAM_BOOL); if (!empty($cancel) and confirm_sesskey()) { - $confirm = optional_param('confirm', 0, PARAM_BOOL); - $hubname = optional_param('hubname', 0, PARAM_TEXT); - $huburl = optional_param('huburl', 0, PARAM_URL); + $confirm = optional_param('confirm', 0, PARAM_BOOL); $hubcourseid = optional_param('hubcourseid', 0, PARAM_INT); $publicationid = optional_param('publicationid', 0, PARAM_INT); $timepublished = optional_param('timepublished', 0, PARAM_INT); @@ -144,7 +144,8 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE, //check if a course was published if (optional_param('published', 0, PARAM_TEXT)) { - $confirmmessage = $OUTPUT->notification(get_string('coursepublished', 'hub'), 'notifysuccess'); + $confirmmessage = $OUTPUT->notification(get_string('coursepublished', 'hub', + empty($hubname)?$huburl:$hubname), 'notifysuccess'); } diff --git a/course/publish/metadata.php b/course/publish/metadata.php index 59b72c33610..3fb7c4e6934 100644 --- a/course/publish/metadata.php +++ b/course/publish/metadata.php @@ -217,7 +217,8 @@ if (has_capability('moodle/course:publish', get_context_instance(CONTEXT_COURSE, } else { //redirect to the index publis page redirect(new moodle_url('/course/publish/index.php', - array('sesskey' => sesskey(), 'id' => $id, 'published' => true))); + array('sesskey' => sesskey(), 'id' => $id, 'published' => true, + 'hubname' => $hubname, 'huburl' => $huburl))); } } diff --git a/lang/en/hub.php b/lang/en/hub.php index 7170635bcbd..79d2b2831dc 100644 --- a/lang/en/hub.php +++ b/lang/en/hub.php @@ -59,7 +59,7 @@ $string['coursemap'] = 'Course map'; $string['coursename'] = 'Name'; $string['courseprivate'] = 'Private'; $string['coursepublic'] = 'Public'; -$string['coursepublished'] = 'Course published or updated'; +$string['coursepublished'] = 'This course has been published on \'{$a}\' successfully. The course will be checked for approval before to appears on the course listing.'; $string['courseshortname'] = 'Shortname'; $string['courseshortname_help'] = 'Enter any shortname for your course. It is not an identifier (i.e many courses can have a same shortname in a search result.)'; $string['coursesnumber'] = 'Number of courses ({$a})';