MDL-78806 core: Remove redundant site name

MDL-78806 core: Remove redundant site name on page titles

* With the site name now being appended to the page titles, there
is no need to manually append the page titles.
This commit is contained in:
Jun Pataleta 2023-08-03 16:29:13 +08:00
parent ff553e5cf4
commit 1eb8ee32bb
No known key found for this signature in database
GPG key ID: F83510526D99E2C7
43 changed files with 62 additions and 63 deletions

View file

@ -132,7 +132,7 @@ if ($savebutton) {
}
$visiblepathtosection = array_reverse($settingspage->visiblepath);
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_title(implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
if ($buttons) {
$PAGE->set_button($buttons);

View file

@ -224,7 +224,7 @@ if (!core_tables_exist()) {
$strlicense = get_string('license');
$PAGE->navbar->add($strlicense);
$PAGE->set_title($strinstallation.' - Moodle '.$CFG->target_release);
$PAGE->set_title($strinstallation . moodle_page::TITLE_SEPARATOR . 'Moodle ' . $CFG->target_release, false);
$PAGE->set_heading($strinstallation);
$PAGE->set_cacheable(false);
@ -818,7 +818,7 @@ $context = context_system::instance();
if (!has_capability('moodle/site:config', $context)) {
// Do not throw exception display an empty page with administration menu if visible for current user.
$PAGE->set_title($SITE->fullname);
$PAGE->set_title(get_string('home'));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->footer();

View file

@ -44,7 +44,7 @@ $PAGE->set_secondary_active_tab('modules');
// Start page output.
$heading = get_string('gradualreindex', 'search', '');
$PAGE->set_title($PAGE->title . ': ' . $heading);
$PAGE->set_title($areaname . ' - ' . get_string('gradualreindex', 'search', ''));
$PAGE->navbar->add($heading);
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);

View file

@ -131,7 +131,7 @@ if (empty($SITE->fullname)) {
$visiblepathtosection = array_reverse($settingspage->visiblepath);
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_title(implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

View file

@ -46,7 +46,7 @@ $PAGE->set_url(new \moodle_url('/admin/tool/filetypes/delete.php', array('extens
$PAGE->navbar->add($title);
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);
$PAGE->set_primary_active_tab('siteadminnode');
$PAGE->set_secondary_active_tab('server');

View file

@ -107,7 +107,7 @@ $PAGE->set_secondary_active_tab('server');
$PAGE->navbar->add($oldextension ? s($oldextension) : $title);
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);
// Display the page.
echo $OUTPUT->header();

View file

@ -34,7 +34,7 @@ $context = context_system::instance();
$PAGE->set_url(new \moodle_url('/admin/tool/filetypes/index.php'));
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);
$renderer = $PAGE->get_renderer('tool_filetypes');

View file

@ -46,7 +46,7 @@ $PAGE->set_url(new \moodle_url('/admin/tool/filetypes/revert.php', array('extens
$PAGE->navbar->add($title);
$PAGE->set_context($context);
$PAGE->set_pagelayout('admin');
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);
// Display the page.
echo $OUTPUT->header();

View file

@ -56,7 +56,7 @@ $context = context_system::instance();
$PAGE->set_url(new \moodle_url('/'.$CFG->admin.'/tool/mobile/logout.php'));
$PAGE->navbar->add($title);
$PAGE->set_context($context);
$PAGE->set_title($SITE->fullname. ': ' . $title);
$PAGE->set_title($title);
// Display the page.
echo $OUTPUT->header();

View file

@ -26,7 +26,7 @@ $sesskey = sesskey();
// when we've already left the page that set the timer.
$loginsite = get_string("loginsite");
$PAGE->navbar->add($loginsite);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();

View file

@ -26,7 +26,7 @@ if (!$authplugin->ntlmsso_finish()) {
// here (and not add 3 more secs).
$loginsite = get_string("loginsite");
$PAGE->navbar->add($loginsite);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading($site->fullname);
echo $OUTPUT->header();
redirect($CFG->wwwroot . '/login/index.php?authldap_skipntlmsso=1',

View file

@ -55,7 +55,7 @@
$PAGE->set_url('/auth/shibboleth/login.php');
$PAGE->set_context(context_system::instance());
$PAGE->navbar->add($loginsite);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading($site->fullname);
$PAGE->set_pagelayout('login');

View file

@ -143,7 +143,7 @@ if ($action === 'delete') {
'sesskey' => sesskey(),
'courseid' => $courseid);
$optionsno = array('userid' => $entry->userid, 'courseid' => $courseid);
$PAGE->set_title("$SITE->shortname: $strblogs");
$PAGE->set_title($strblogs);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
@ -164,11 +164,11 @@ if ($action === 'delete') {
}
} else if ($action == 'add') {
$editmodetitle = $strblogs . ': ' . get_string('addnewentry', 'blog');
$PAGE->set_title("$SITE->shortname: $editmodetitle");
$PAGE->set_title($editmodetitle);
$PAGE->set_heading(fullname($USER));
} else if ($action == 'edit') {
$editmodetitle = $strblogs . ': ' . get_string('editentry', 'blog');
$PAGE->set_title("$SITE->shortname: $editmodetitle");
$PAGE->set_title($editmodetitle);
$PAGE->set_heading(fullname($USER));
}

View file

@ -138,7 +138,7 @@ navigation_node::override_active_url(new moodle_url('/blog/external_blogs.php'))
$PAGE->navbar->add(get_string('addnewexternalblog', 'blog'));
$PAGE->set_heading(fullname($USER));
$PAGE->set_title("$SITE->shortname: $strblogs: $strexternalblogs");
$PAGE->set_title("$strblogs: $strexternalblogs");
echo $OUTPUT->header();
echo $OUTPUT->heading($strformheading, 2);

View file

@ -67,7 +67,7 @@ if ($delete && confirm_sesskey()) {
$blogs = $DB->get_records('blog_external', array('userid' => $USER->id));
$PAGE->set_heading(fullname($USER));
$PAGE->set_title("$SITE->shortname: $strblogs: $strexternalblogs");
$PAGE->set_title("$strblogs: $strexternalblogs");
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header();

View file

@ -716,9 +716,10 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
// Note: if action is set to 'add' or 'edit', we do this at the end.
if (empty($entryid) && empty($modid) && empty($courseid) && empty($userid) && !in_array($action, array('edit', 'add'))) {
$PAGE->navbar->add($strblogentries, $blogurl);
$PAGE->set_title($site->fullname);
$strsiteblog = get_string('siteblogheading', 'blog');
$PAGE->set_title($strsiteblog);
$PAGE->set_heading($site->fullname);
$headers['heading'] = get_string('siteblogheading', 'blog');
$headers['heading'] = $strsiteblog;
}
// Case 2: only entryid is requested, ignore all other filters. courseid is used to give more contextual information.
@ -742,9 +743,10 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$blogurl->remove_params('userid');
$PAGE->navbar->add($entry->subject, $blogurl);
$PAGE->set_title("$shortname: " . fullname($user) . ": $entry->subject");
$blogentryby = get_string('blogentrybyuser', 'blog', fullname($user));
$PAGE->set_title($entry->subject . moodle_page::TITLE_SEPARATOR . $blogentryby);
$PAGE->set_heading("$shortname: " . fullname($user) . ": $entry->subject");
$headers['heading'] = get_string('blogentrybyuser', 'blog', fullname($user));
$headers['heading'] = $blogentryby;
// We ignore tag and search params.
if (empty($action) || !$CFG->useblogassociations) {
@ -758,7 +760,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$shortname = format_string($site->shortname, true, array('context' => context_course::instance(SITEID)));
$blogurl->param('userid', $userid);
$PAGE->set_title("$shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
$PAGE->set_title(fullname($user) . ": " . get_string('blog', 'blog'));
$PAGE->set_heading("$shortname: " . fullname($user) . ": " . get_string('blog', 'blog'));
$headers['heading'] = get_string('userblog', 'blog', fullname($user));
$headers['strview'] = get_string('viewuserentries', 'blog', fullname($user));
@ -766,9 +768,10 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
} else if (!$CFG->useblogassociations && empty($userid) && !in_array($action, array('edit', 'add'))) {
// Case 4: No blog associations, no userid.
$PAGE->set_title($site->fullname);
$strsiteblog = get_string('siteblogheading', 'blog');
$PAGE->set_title($strsiteblog);
$PAGE->set_heading($site->fullname);
$headers['heading'] = get_string('siteblogheading', 'blog');
$headers['heading'] = $strsiteblog;
} else if (!empty($userid) && !empty($modid) && empty($entryid)) {
// Case 5: Blog entries associated with an activity by a specific user (courseid ignored).
@ -781,7 +784,7 @@ function blog_get_headers($courseid=null, $groupid=null, $userid=null, $tagid=nu
$PAGE->navbar->add(fullname($user), "$CFG->wwwroot/user/view.php?id=$user->id");
$PAGE->navbar->add($strblogentries, $blogurl);
$PAGE->set_title("$shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
$PAGE->set_title(fullname($user) . ': ' . get_string('blogentries', 'blog') . moodle_page::TITLE_SEPARATOR . $cm->name);
$PAGE->set_heading("$shortname: $cm->name: " . fullname($user) . ': ' . get_string('blogentries', 'blog'));
$a = new stdClass();

View file

@ -95,7 +95,7 @@ $site = get_site();
$strpreferences = get_string('preferences');
$strblogs = get_string('blogs', 'blog');
$title = "$site->shortname: $strblogs : $strpreferences";
$title = "$strblogs : $strpreferences";
$PAGE->set_title($title);
$PAGE->set_heading(fullname($USER));

View file

@ -92,7 +92,7 @@ $strcalendar = get_string('calendar', 'calendar');
$PAGE->navbar->add($strcalendar, $viewcalendarurl);
$PAGE->navbar->add($title);
$PAGE->set_title($site->shortname.': '.$strcalendar.': '.$title);
$PAGE->set_title($strcalendar.': '.$title);
$PAGE->set_heading($COURSE->fullname);
if ($course) {
$PAGE->set_secondary_navigation(false);

View file

@ -59,7 +59,7 @@ if ($delete === md5($course->timemodified)) {
$strdeletingcourse = get_string("deletingcourse", "", $courseshortname);
$PAGE->navbar->add($strdeletingcourse);
$PAGE->set_title("$SITE->shortname: $strdeletingcourse");
$PAGE->set_title($strdeletingcourse);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
@ -86,7 +86,7 @@ if ($delete === md5($course->timemodified)) {
$strdeletecheck = get_string("deletecheck", "", $courseshortname);
$PAGE->navbar->add($strdeletecheck);
$PAGE->set_title("$SITE->shortname: $strdeletecheck");
$PAGE->set_title($strdeletecheck);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

View file

@ -229,7 +229,7 @@ if (!empty($course->id)) {
$PAGE->navbar->add(get_string('coursemgmt', 'admin'), $managementurl);
$pagedesc = $straddnewcourse;
$title = "$site->shortname: $straddnewcourse";
$title = $straddnewcourse;
$fullname = format_string($category->name);
$PAGE->navbar->add($pagedesc);
}

View file

@ -72,7 +72,7 @@ if ($id) {
} else {
$context = context_system::instance();
$fullname = $SITE->fullname;
$title = "$SITE->shortname: $strtitle";
$title = $strtitle;
$PAGE->set_secondary_active_tab('courses');
}

View file

@ -1428,13 +1428,13 @@ class core_course_renderer extends plugin_renderer_base {
if (core_course_category::is_simple_site()) {
// There is only one category in the system, do not display link to it.
$strfulllistofcourses = get_string('fulllistofcourses');
$this->page->set_title("$site->shortname: $strfulllistofcourses");
$this->page->set_title($strfulllistofcourses);
} else if (!$coursecat->id || !$coursecat->is_uservisible()) {
$strcategories = get_string('categories');
$this->page->set_title("$site->shortname: $strcategories");
$this->page->set_title($strcategories);
} else {
$strfulllistofcourses = get_string('fulllistofcourses');
$this->page->set_title("$site->shortname: $strfulllistofcourses");
$this->page->set_title($strfulllistofcourses);
}
// Print current category description

View file

@ -86,10 +86,10 @@ if (!empty($search)) {
if (empty($searchcriteria)) {
// no search criteria specified, print page with just search form
$PAGE->set_title("$site->fullname : $strsearch");
$PAGE->set_title($strsearch);
} else {
// this is search results page
$PAGE->set_title("$site->fullname : $strsearchresults");
$PAGE->set_title($strsearchresults);
// Link to manage search results should be visible if user have system or category level capability
if ((can_edit_in_category() || !empty($usercatlist))) {
$aurl = new moodle_url('/course/management.php', $searchcriteria);

View file

@ -39,7 +39,7 @@ $url = new \moodle_url("/h5p/libraries.php");
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$PAGE->set_title("$SITE->shortname: " . $pagetitle);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($SITE->fullname);
$h5pfactory = new \core_h5p\factory();

View file

@ -35,7 +35,7 @@ $url = new \moodle_url("/h5p/overview.php");
$PAGE->set_context($context);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
$PAGE->set_title("$SITE->shortname: " . $pagetitle);
$PAGE->set_title($pagetitle);
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();

View file

@ -101,7 +101,7 @@ course_view(context_course::instance(SITEID));
$PAGE->set_pagetype('site-index');
$PAGE->set_docs_path('');
$editing = $PAGE->user_is_editing();
$PAGE->set_title($SITE->fullname);
$PAGE->set_title(get_string('home'));
$PAGE->set_heading($SITE->fullname);
$PAGE->set_secondary_active_tab('coursehome');

View file

@ -8735,7 +8735,7 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
$PAGE->set_button($OUTPUT->single_button($url, $caption, 'get'));
}
$PAGE->set_title("$SITE->shortname: " . implode(": ", $visiblepathtosection));
$PAGE->set_title(implode(": ", $visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
if ($hassiteconfig && empty($options['nosearch'])) {

View file

@ -1816,11 +1816,7 @@ class moodle_page {
'/settings.php?section=maintenancemode">' . get_string('maintenancemode', 'admin') .
'</a> ' . $this->button);
$title = $this->title;
if ($title) {
$title .= ' - ';
}
$this->set_title($title . get_string('maintenancemode', 'admin'));
$this->set_title(get_string('maintenancemode', 'admin'));
}
$this->initialise_standard_body_classes();

View file

@ -3210,7 +3210,6 @@ function print_maintenance_message() {
$PAGE->set_pagetype('maintenance-message');
$PAGE->set_pagelayout('maintenance');
$PAGE->set_title(strip_tags($SITE->fullname));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('sitemaintenance', 'admin'));

View file

@ -246,7 +246,7 @@ if ($frm and isset($frm->username)) { // Login WITH
$passwordchangeurl = $CFG->wwwroot.'/login/change_password.php';
}
$days2expire = $userauth->password_expire($USER->username);
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading("$site->fullname");
if (intval($days2expire) > 0 && intval($days2expire) < intval($userauth->config->expiration_warning)) {
echo $OUTPUT->header();
@ -369,7 +369,7 @@ if (!empty($SESSION->loginerrormsg) || !empty($SESSION->logininfomsg)) {
redirect(new moodle_url('/login/index.php'));
}
$PAGE->set_title("$site->fullname: $loginsite");
$PAGE->set_title($loginsite);
$PAGE->set_heading("$site->fullname");
echo $OUTPUT->header();

View file

@ -45,7 +45,7 @@ if (!isloggedin()) {
redirect($redirect);
} else if (!confirm_sesskey($sesskey)) {
$PAGE->set_title($SITE->fullname);
$PAGE->set_title(get_string('logout'));
$PAGE->set_heading($SITE->fullname);
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('logoutconfirm'), new moodle_url($PAGE->url, array('sesskey'=>sesskey())), $CFG->wwwroot.'/');
@ -61,4 +61,4 @@ foreach($authsequence as $authname) {
require_logout();
redirect($redirect);
redirect($redirect);

View file

@ -51,7 +51,7 @@ $PAGE->set_pagelayout('admin');
// Display page header.
$title = get_string('notifications', 'message');
$PAGE->set_title("{$SITE->shortname}: " . $title);
$PAGE->set_title($title);
$PAGE->set_heading(fullname($user));
// Grab the renderer.

View file

@ -67,7 +67,7 @@ admin_externalpage_setup('ltitoolproxies');
$PAGE->set_heading(get_string('toolproxyregistration', 'lti'));
$PAGE->set_title("{$SITE->shortname}: " . get_string('toolproxyregistration', 'lti'));
$PAGE->set_title(get_string('toolproxyregistration', 'lti'));
// Print the page header.
echo $OUTPUT->header();

View file

@ -84,7 +84,7 @@ if ($form->is_cancelled()) {
$id = lti_add_tool_proxy($data);
redirect($redirect);
} else {
$PAGE->set_title("{$SITE->shortname}: " . get_string('toolregistration', 'lti'));
$PAGE->set_title(get_string('toolregistration', 'lti'));
$PAGE->navbar->add(get_string('lti_administration', 'lti'), $redirect);
echo $OUTPUT->header();

View file

@ -45,7 +45,7 @@ if ($cartridgeurl) {
$pageurl = new moodle_url('/mod/lti/toolconfigure.php');
$PAGE->set_url($pageurl);
$PAGE->set_title("{$SITE->shortname}: " . get_string('toolregistration', 'mod_lti'));
$PAGE->set_title(get_string('toolregistration', 'mod_lti'));
$PAGE->requires->string_for_js('success', 'moodle');
$PAGE->requires->string_for_js('error', 'moodle');
$PAGE->requires->string_for_js('successfullycreatedtooltype', 'mod_lti');

View file

@ -35,7 +35,7 @@ $PAGE->set_url($pageurl);
admin_externalpage_setup('ltitoolproxies');
$PAGE->set_title("{$SITE->shortname}: " . get_string('toolregistration', 'lti'));
$PAGE->set_title(get_string('toolregistration', 'lti'));
$configuredtoolproxieshtml = '';
$pendingtoolproxieshtml = '';

View file

@ -106,7 +106,7 @@ if ($data = $form->get_data()) {
redirect($redirect);
}
$PAGE->set_title(format_string($SITE->shortname) . ': ' . get_string('toolsetup', 'lti'));
$PAGE->set_title(get_string('toolsetup', 'lti'));
$PAGE->navbar->add(get_string('lti_administration', 'lti'), $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=modsettinglti');
echo $OUTPUT->header();

View file

@ -158,7 +158,7 @@ if ($data = $form->get_data()) {
redirect($redirect);
}
$PAGE->set_title("$SITE->shortname: " . get_string('toolsetup', 'lti'));
$PAGE->set_title(get_string('toolsetup', 'lti'));
$PAGE->set_primary_active_tab('siteadminnode');
$PAGE->set_secondary_active_tab('ltitoolconfigure');
$PAGE->navbar->add(get_string('manage_external_tools', 'lti'), new moodle_url('/mod/lti/toolconfigure.php'));

View file

@ -37,7 +37,7 @@ if (!\core_analytics\manager::is_analytics_enabled()) {
exit(0);
}
$PAGE->set_title(get_site()->fullname);
$PAGE->set_title(get_string('insights', 'report_insights'));
$PAGE->set_url(new \moodle_url('/report/insights/done.php'));
echo $OUTPUT->header();

View file

@ -138,7 +138,7 @@ if ($PAGE->user_allowed_editing() && $adminediting != -1) {
if ($course->id == $SITE->id) {
admin_externalpage_setup('reportlog', '', null, '', array('pagelayout' => 'report'));
$PAGE->set_title($SITE->shortname .': '. $strlogs);
$PAGE->set_title($strlogs);
$PAGE->set_primary_active_tab('siteadminnode');
} else {
$PAGE->set_title($course->shortname .': '. $strlogs);

View file

@ -332,7 +332,8 @@ if ($user->id == -1 or ($user->id != $USER->id)) {
$streditmyprofile = get_string('editmyprofile');
$userfullname = fullname($user, true);
$PAGE->set_heading($userfullname);
$PAGE->set_title("$course->shortname: $streditmyprofile - $userfullname");
$coursename = $course->id !== SITEID ? "$course->shortname" : '';
$PAGE->set_title("$streditmyprofile: $userfullname" . moodle_page::TITLE_SEPARATOR . $coursename);
echo $OUTPUT->header();
echo $OUTPUT->heading($userfullname);
}

View file

@ -42,7 +42,7 @@ $a = new stdClass();
$a->fullname = fullname($user, true);
$stremailupdate = get_string('emailupdate', 'auth', $a);
$PAGE->set_title(format_string($SITE->fullname) . ": $stremailupdate");
$PAGE->set_title($stremailupdate);
$PAGE->set_heading(format_string($SITE->fullname) . ": $stremailupdate");
if (empty($preferences['newemailattemptsleft'])) {

View file

@ -83,7 +83,7 @@ if (!user_can_view_profile($user, null, $context)) {
// Course managers can be browsed at site level. If not forceloginforprofiles, allow access (bug #4366).
$struser = get_string('user');
$PAGE->set_context(context_system::instance());
$PAGE->set_title("$SITE->shortname: $struser"); // Do not leak the name.
$PAGE->set_title($struser); // Do not leak the name.
$PAGE->set_heading($struser);
$PAGE->set_pagelayout('mypublic');
$PAGE->add_body_class('limitedwidth');