diff --git a/CHANGELOG.md b/CHANGELOG.md index 7437ce0f0..87a23e13b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -281,6 +281,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Messages: archiving, restoring, deleting, favoriting or setting the category of several contacts, clients, assets or products said contact(s), client(s) and so on, an import of network IPs said IP(s), and the message after restoring clients started "You restored". They now say 1 contact, 3 contacts, with the number in bold, like the rest. - Contacts: the button in the archive window read Arhive. - Tickets: cancelling Reset the timer still marked the timer as stopped in that browser, so it showed as stopped after a reload while it was still counting. +- Browser tabs: many pages were named after their file - Kb, Ai Providers, Rmm Providers, Sla, Settings Ticket, Profit Loss - and one with & in its name showed &. Each tab now has the name the menu gives the page, and a rack, an instance and a ticket, document or project template show their own name. ### Developer Updates @@ -447,6 +448,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Confirms: `itflowConfirm({title, text, button, icon, danger})` in `js/confirm_modal.js` asks the SweetAlert question from script and resolves true when confirmed; `confirm-link` goes through it, and with no `data-confirm-button` takes the link's own text (three words or fewer) for the button. `fa-ellipsis-v`, `fa-trash`, `fa-redo` and `fa-download` are the icons for More, Delete, Restore and Export - `fa-redo-alt` stays for recurring and `fa-undo` for restoring a backup or a version. - UI text: titles, menu items and buttons in Title Case, with a, an, the, and, but, or, for, as, at, by, in, of, on, to, via, from, with and into lower case unless first or last, and a verb's particle capitalised (Turn Off, Back Up, Sign In); field labels, section headings, tabs and help in sentence case. Proper names and acronyms keep their capitals either way. The empty-state and header `'actions'` labels are buttons, so Title Case too. - Lists: `sortLink($column, $label, $first, $title, $class)` in `functions/format.php` draws a sortable column header from what `includes/filter_header.php` sets, and `sortFirstOrder()` picks the first direction from the column's name. It replaces the 48 copied `$sort_link` closures and the 115 header links written out by hand; a page with its own first directions passes `$first`. +- Tab titles: `includes/page_title.php` takes a report's title from `reportCatalog()`, a settings page's from `settingsPages()` and a few others from a short list, and makes the rest from the file name with its acronyms in capitals. `$page_title` is no longer HTML-escaped there - the footer writes it with `json_encode()` and `emptyStateHtml()` escapes it. ## [26.11.8] diff --git a/admin/document_template.php b/admin/document_template.php index 296617a55..bbffb6b8c 100644 --- a/admin/document_template.php +++ b/admin/document_template.php @@ -24,6 +24,7 @@ if (!$template) { $document_template_id = intval($template['document_template_id']); $name = escapeHtml($template['document_template_name']); +$page_title = $template['document_template_name']; $archived = !empty($template['document_template_archived_at']); $usage = documentTemplateUsage([$document_template_id])[$document_template_id] ?? ['count' => 0, 'clients' => 0, 'last' => null]; $content = trim((string) $template['document_template_content']) !== '' ? documentTemplateMarkBrackets(documentHtmlPurify($template['document_template_content'])) : ''; diff --git a/admin/managed_instance.php b/admin/managed_instance.php index 5d5a8756c..313d87984 100644 --- a/admin/managed_instance.php +++ b/admin/managed_instance.php @@ -29,6 +29,7 @@ if (!$row) { ?> } $name = escapeHtml($row['managed_instance_name']); +$page_title = $row['managed_instance_name']; $removed = !empty($row['managed_instance_archived_at']); $health = managedInstanceHealth($row); $state = $health['state']; diff --git a/admin/project_template.php b/admin/project_template.php index 819b81c98..e7efd0b77 100644 --- a/admin/project_template.php +++ b/admin/project_template.php @@ -23,6 +23,8 @@ if (!$template) { ?> exit; } +$page_title = $template['project_template_name']; + // Its ticket templates in order, then all their tasks in one go $sql = mysqli_query($mysqli, "SELECT ticket_templates.ticket_template_id, ticket_template_name, ticket_template_subject, ticket_template_description, ticket_template_order FROM project_template_ticket_templates diff --git a/admin/ticket_template.php b/admin/ticket_template.php index 4e227cfac..b89a9280a 100644 --- a/admin/ticket_template.php +++ b/admin/ticket_template.php @@ -22,6 +22,7 @@ if (!$template) { $ticket_template_id = intval($template['ticket_template_id']); $name = escapeHtml($template['ticket_template_name']); +$page_title = $template['ticket_template_name']; $archived = !empty($template['ticket_template_archived_at']); $tasks = ticketTemplateTasks($ticket_template_id); $task_minutes = array_sum(array_column($tasks, 'estimate')); diff --git a/agent/rack.php b/agent/rack.php index 72905ad7b..169ef6ccb 100644 --- a/agent/rack.php +++ b/agent/rack.php @@ -40,6 +40,7 @@ if (mysqli_num_rows($sql) == 0) { $row = mysqli_fetch_assoc($sql); $rack_name = escapeHtml($row['rack_name']); + $page_title = $row['rack_name']; $rack_description = escapeHtml($row['rack_description']); $rack_model = escapeHtml($row['rack_model']); $rack_depth = escapeHtml($row['rack_depth']); diff --git a/includes/page_title.php b/includes/page_title.php index b8a782147..123a901c9 100644 --- a/includes/page_title.php +++ b/includes/page_title.php @@ -1,21 +1,63 @@ 'Knowledge Base', + 'software' => 'Licenses', + 'shares' => 'Shared Links', + 'sla' => 'SLAs', + 'tax_rates' => 'Taxes', + 'getting_started' => 'Get Started', + 'global_search' => 'Search', + 'products_reprice' => 'Update Prices', + 'products_count' => 'Count Stock', + 'client_overview' => 'Overview', + 'saved_payment_methods' => 'Saved Cards', + 'user_details' => 'Profile', + 'user_security' => 'Security', + 'user_preferences' => 'Preferences', + 'user_activity' => 'Activity', + 'user_canned_responses' => 'Canned Responses', +]; -// Capitize -$page_title = ucwords($page_title); +$page_title = ''; +if ($page_dir === 'reports') { + if ($page_file === 'index') { + $page_title = 'Reports'; + } else { + foreach (reportCatalog() as $report_group) { + if (isset($report_group['reports'][$page_file])) { + $page_title = $report_group['reports'][$page_file]['title']; + } + } + } +} elseif ($page_dir === 'admin' && strpos($page_file, 'settings_') === 0) { + foreach (settingsPages() as $settings_page) { + if (($settings_page['url'] ?? '') === "$page_file.php") { + $page_title = $settings_page['title']; + } + } +} +if ($page_title === '') { + $page_title = $page_names[$page_file] ?? ucwords(str_replace('_', ' ', $page_file)); + // Acronyms in capitals, and the small words in lower case after the first + $page_title = preg_replace_callback('/\b(Ai|Api|Rmm|Sla|Sms|Ip|Mfa|Pdf|Csv|Id)\b/', function ($m) { return strtoupper($m[1]); }, $page_title); + $page_title = preg_replace_callback('/(?<=\s)(By|And|Of|To|For|In|On|Vs)\b(?=\s)/', function ($m) { return strtolower($m[1]); }, $page_title); +} // Sanitize title for SQL input such as logging $page_title_sanitized = escapeSql($page_title); -// Sanitize the page title to prevent XSS for output -$page_title = escapeHtml($page_title); - $tab_title = $session_company_name;