From 491f2c4d42c7e69b01787601aea90323dc03aeca Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 20 Nov 2026 15:48:55 -0500 Subject: [PATCH] Tags in the row menu of every list - assets, clients, contacts, credentials, domains, documents, locations, networks, services, licenses, vendors, tickets, the tickets board, the Files grid and the Knowledge Base - opens the tag picker from the row menu button, the row tag line appears as tags are ticked and hides again while a row has none, cards keep their tags without the plus, the picker lines up with a menu button at the end of a row, and the ticket reply draft waits for the editor to be ready before reading it --- CHANGELOG.md | 4 ++-- agent/assets.php | 5 +++-- agent/clients.php | 5 +++-- agent/contacts.php | 5 +++-- agent/credentials.php | 5 +++-- agent/domains.php | 5 +++-- agent/files.php | 9 +++++---- agent/js/ticket_reply_extras.js | 4 +++- agent/kb.php | 3 ++- agent/locations.php | 5 +++-- agent/networks.php | 5 +++-- agent/services.php | 5 +++-- agent/software.php | 5 +++-- agent/ticket_kanban.php | 5 +++-- agent/ticket_list.php | 7 ++++--- agent/vendors.php | 5 +++-- css/itflow_custom.css | 8 ++++++++ functions/tags.php | 28 +++++++++++++++++++++++++++- js/tag_picker.js | 21 +++++++++++++++++---- 19 files changed, 101 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c56c99bb..f7e86f638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -202,7 +202,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Calendar: switched off, the calendar, its events and the calendar feeds go - a subscribed calendar stops getting them. Tickets are still booked from the ticket and on Dispatch, and booked work still shows on the dashboard. - Updated the libraries ITFlow is built on: the one that reads ticket mailboxes, the one that sends email, the text editor, the one that cleans up email and document HTML before it is shown, Stripe, the page styling, the charts, the tables, the calendar and the phone number fields. Nothing changes in how they look or work. The text editor's update fixes a security problem in its media plugin, which ITFlow doesn't use. - Pages are a little lighter: five add-on libraries are gone - three ITFlow no longer used, and two swapped for ITFlow's own code. The IP and MAC address fields on assets and the QR codes for setting up MFA and for shared links work as before. The download is about 5 MB smaller too, without the text editor add-ons and icon font files ITFlow never used. -- Lists: a row shows its tags only when it has some, so untagged rows are a line shorter - tag one from its own page, or tick it and use Tags in Bulk Action. A client's other pages show the client's tags without the +; change them on the client's overview or the clients list. +- Lists: a row shows its tags only when it has some, so untagged rows are a line shorter. To tag one, use Tags in its ⋮ menu - its tags show on the row as you tick them, no reload. Cards on the tickets board and the Files grid have it in their menu too. To tag several together, tick them and use Tags in Bulk Action. A client's other pages show the client's tags without the +; change them on the client's overview or the clients list. - Lists: the page numbers stay on one row - the first and last page and the ones next to yours - however long the list. - Tickets: Unassigned is amber, as the Unassigned view and the dashboard's tile are, and Not billable a light gray - red is kept for what is late. - Dashboard and client overview: when the last row of Needs attention is short, its tiles keep their width rather than one stretching across, and a count of one reads 1 Draft invoice, not 1 Draft invoices. @@ -413,7 +413,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Tickets: `ticketMailTry($from, $subject, $auto_reply)` in `functions/ticket_mail_try.php` asks what `cron/ticket_email_parser.php` asks, in its order, with no writes - `ticketMailTryReply()` mirrors `addReply()`. Kept in step with the parser by hand. `admin/modals/ticket_mail/ticket_mail_try.php` (`?try=1` answers JSON with the result). - Weekly summary: database 4.0.7 adds `settings.config_weekly_summary`, `_day` (1 Monday to 7 Sunday), `_to` (NULL for every admin) and `_sent_at`. `functions/weekly_summary.php`: `weeklySummaryReady()`, `weeklySummarySettings()`, `weeklySummaryRecipients()`, `weeklySummaryNumbers($from, $to)`, `weeklySummaryNeeds()`, `weeklySummaryEmail($until)`, `weeklySummarySend()` and `weeklySummaryRun()`, called by `cron/nightly_tasks.php`, which sends once on the day (`config_weekly_summary_sent_at`). `send_weekly_summary_now` in `admin/post/settings_notification.php`; the `weekly_summary` email preview. - Related tickets: database 4.0.8 adds `ticket_links` (`ticket_id` as the primary key, `link_group`, `linked_by`, `linked_at`; deleted with its ticket). `functions/ticket_link.php`: `ticketLinksReady()`, `ticketLinkGroup()`, `ticketLinkMembers()`, `ticketLinkTogether()` (any number of tickets and everything already related to them into one group, with a ticket history line naming the newly related ones), `ticketUnlink()`, `ticketRelated()` and `ticketLinkCounts()` (scoped to the agent's clients), `ticketLinkHidden()`, `ticketLinkCandidates()` and `ticketLinkCarry()` (from `ticketMergeInto()`). A group is numbered by its lowest ticket id, renumbered by `ticketLinkTidy()` as tickets leave, so one number never names two groups; a group left with one ticket is deleted. `agent/post/ticket_link.php` handles `link_tickets`, `unlink_ticket` and `bulk_link_tickets`; Reply to all and Resolve all open `ticket_bulk_reply.php` and `ticket_bulk_resolve.php` with `ticket_ids[]`. -- Look and feel: `.itflow-dash-rail` is a grid (`repeat(auto-fill, minmax(10rem, 1fr))`, `.itflow-dash-rail-clear` spans it; `.itflow-ov-stats` stays flex), and the attention items of `dashboardAttention()` and `clientOverviewAttention()` take `one`, used when the count is 1. `formatAssignee()` highlights unassigned in warning, `ticketBillableHtml()` draws not billable in `bg-body-secondary`, and `ticketSlaState()` gives `breached` for an open ticket with a `ticket_response_sla_met` or `ticket_resolution_sla_met` of 0 or a deadline in the past. `includes/filter_footer.php` links the first, last and neighboring pages with an ellipsis between, in place of every tenth page. The list pages render `tagPills()` only for a row with tags, and `agent/includes/inc_client_top_head.php` passes `$can_edit` false. `categoryAddButtonHtml()` and `quickAddButton()` are called with their default `btn-outline-secondary` everywhere. `js/app.js` focuses the dialog again on the next tick when AdminLTE's `shown.bs.modal` handler has put focus on its `.btn-close`. +- Look and feel: `.itflow-dash-rail` is a grid (`repeat(auto-fill, minmax(10rem, 1fr))`, `.itflow-dash-rail-clear` spans it; `.itflow-ov-stats` stays flex), and the attention items of `dashboardAttention()` and `clientOverviewAttention()` take `one`, used when the count is 1. `formatAssignee()` highlights unassigned in warning, `ticketBillableHtml()` draws not billable in `bg-body-secondary`, and `ticketSlaState()` gives `breached` for an open ticket with a `ticket_response_sla_met` or `ticket_resolution_sla_met` of 0 or a deadline in the past. `includes/filter_footer.php` links the first, last and neighboring pages with an ellipsis between, in place of every tenth page. A list row's `tagPills()` sits in `.itflow-tags-row`, hidden by CSS until it holds a tag, and `tagMenuItem()` (`functions/tags.php`) puts Tags in the row's menu - a `data-tag-picker` button, the panel hung off the menu's toggle. `tagSpot()` is an untagged card's empty spot (the Files grid, the tickets board); spots drawn without a + carry `data-tag-plain`, kept by the picker's redraw. `agent/includes/inc_client_top_head.php` passes `$can_edit` false. `categoryAddButtonHtml()` and `quickAddButton()` are called with their default `btn-outline-secondary` everywhere. `js/app.js` focuses the dialog again on the next tick when AdminLTE's `shown.bs.modal` handler has put focus on its `.btn-close`. - Starter content: `starterRenamed()` in `admin/post/starter_content_model.php` maps a starter item's old name, keyed as `starterExistingNames()` keys it, to its new one. Tags and canned responses here under the old name count as present (`starterExistingRenamed()`, `starterCannedResponseNames()`), `starterUpdateCannedResponses()` renames one before replacing it, and `demoAttachTags()` falls back to the old tag name. `demoDataRenamed()` holds the demo products' old name and description and the errand trip's old purpose; `demoProductId()` finds a demo product either way for load and removal, and a load renames an old one in place. - `admin/starter_content.php` is rebuilt on the Maintenance page layout (a hero card, then the packs as a `list-group` sharing Get started's `.itflow-gs-pack-icon` and `.itflow-gs-pack-about`, and an At a glance card); `.itflow-starter-pack-cell` is gone. Update and Remove demo data are `confirm-link` buttons in place of `onsubmit` confirms. - Starter content: `starterPackRecords()`, `starterPackHere()`, `starterPackUsed()`, `starterContentUnused()` and `starterClearUnused()` in `admin/post/starter_content_model.php`, `clear_starter_unused` in `admin/post/starter_content.php` (rechecked on post, with an Undo of the archive) and `admin/modals/starter_content/starter_clear.php`. A tag counts as used by any table with a `tag_id` or `*_tag_id` column (read from information_schema) or a seat count, a project template by its tickets' history line, and a category by `categoryUsage()` plus ticket templates, settings, RMM alerts, AI triage and child categories. `starterPickHtml()` takes `$open`; `js/starter_content.js` counts `data-starter-format="clear"` and sets up a pack in a window as it opens. diff --git a/agent/assets.php b/agent/assets.php index 71828bee8..9bb77dd16 100644 --- a/agent/assets.php +++ b/agent/assets.php @@ -624,8 +624,8 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets'
- -
+ = 2) { ?> +
@@ -763,6 +763,7 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets' Edit + Copy diff --git a/agent/clients.php b/agent/clients.php index 830f35b9b..106d08141 100644 --- a/agent/clients.php +++ b/agent/clients.php @@ -589,8 +589,8 @@ $total_leads = intval($row['leads']);
- -
+ +
@@ -714,6 +714,7 @@ $total_leads = intval($row['leads']); Edit + New Ticket diff --git a/agent/contacts.php b/agent/contacts.php index 963a0c99a..b475f93bb 100644 --- a/agent/contacts.php +++ b/agent/contacts.php @@ -630,8 +630,8 @@ $search_placeholder = $invites_view ? 'Search invites by email, name or client'
- -
+ +
@@ -698,6 +698,7 @@ $search_placeholder = $invites_view ? 'Search invites by email, name or client'
Edit + Add Note diff --git a/agent/credentials.php b/agent/credentials.php index f6c2187a1..553c4880a 100644 --- a/agent/credentials.php +++ b/agent/credentials.php @@ -383,8 +383,8 @@ $filter_url = function ($changes) use ($client_url) {
- -
+ +
@@ -433,6 +433,7 @@ $filter_url = function ($changes) use ($client_url) { Edit + Change password diff --git a/agent/domains.php b/agent/domains.php index 7cb95f3fd..813142c01 100644 --- a/agent/domains.php +++ b/agent/domains.php @@ -371,8 +371,8 @@ $bulk_vendor_options = $can_edit ? domainVendorChoices($client_url ? $client_id
- -
+ +
@@ -405,6 +405,7 @@ $bulk_vendor_options = $can_edit ? domainVendorChoices($client_url ? $client_id Edit + Look up now diff --git a/agent/files.php b/agent/files.php index df68465d8..99de3b434 100644 --- a/agent/files.php +++ b/agent/files.php @@ -256,6 +256,7 @@ function filesItemMenu($item) { if ($can_edit && !$archived) { $html .= ''; $html .= "Edit"; + $html .= tagMenuItem('document', $id, ''); $html .= "Rename"; $html .= "Copy"; $favorite = !empty($item['row']['document_favorite']); @@ -646,8 +647,8 @@ $preview = []; // the grid's previewer payload Review due - -
+ +
diff --git a/agent/js/ticket_reply_extras.js b/agent/js/ticket_reply_extras.js index 3686587cb..b0951efdd 100644 --- a/agent/js/ticket_reply_extras.js +++ b/agent/js/ticket_reply_extras.js @@ -22,8 +22,10 @@ var composer = document.getElementById('replyComposer'); var status = form.querySelector('[data-reply-draft-status]'); + // Only once it is ready - reading an editor still starting up throws function editor() { - return window.tinymce ? tinymce.get('ticket_reply') : null; + var ed = window.tinymce ? tinymce.get('ticket_reply') : null; + return ed && ed.initialized ? ed : null; } function content() { diff --git a/agent/kb.php b/agent/kb.php index cfce12c8f..e70452781 100644 --- a/agent/kb.php +++ b/agent/kb.php @@ -291,7 +291,7 @@ $csrf = $_SESSION['csrf_token'];
-
+
@@ -328,6 +328,7 @@ $csrf = $_SESSION['csrf_token']; Edit + Make draft diff --git a/agent/locations.php b/agent/locations.php index 4b7be319e..51aa6ffbc 100644 --- a/agent/locations.php +++ b/agent/locations.php @@ -311,8 +311,8 @@ $locations_counts = locationCounts(array_keys($locations));
- -
+ +
@@ -377,6 +377,7 @@ $locations_counts = locationCounts(array_keys($locations));
Edit + Make primary diff --git a/agent/networks.php b/agent/networks.php index 136ab993b..062f57631 100644 --- a/agent/networks.php +++ b/agent/networks.php @@ -356,8 +356,8 @@ $csrf = $_SESSION['csrf_token'];
- -
+ +
@@ -408,6 +408,7 @@ $csrf = $_SESSION['csrf_token'];
Edit + Document an address diff --git a/agent/services.php b/agent/services.php index 91c93f272..043d70b9f 100644 --- a/agent/services.php +++ b/agent/services.php @@ -331,8 +331,8 @@ $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['f
- -
+ +
@@ -397,6 +397,7 @@ $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['f Edit + Mark reviewed diff --git a/agent/software.php b/agent/software.php index e608e35b7..f7d0f648b 100644 --- a/agent/software.php +++ b/agent/software.php @@ -479,8 +479,8 @@ while ($license_type_row = mysqli_fetch_row($sql_license_types)) { Archived
- -
+ +
@@ -549,6 +549,7 @@ while ($license_type_row = mysqli_fetch_row($sql_license_types)) { Edit + Seats diff --git a/agent/ticket_kanban.php b/agent/ticket_kanban.php index 800420642..83ab197f3 100644 --- a/agent/ticket_kanban.php +++ b/agent/ticket_kanban.php @@ -110,6 +110,7 @@ $tickets_tags = tagsForRecords('ticket', $board_ids); Edit + Assign to me @@ -147,8 +148,8 @@ $tickets_tags = tagsForRecords('ticket', $board_ids); - -
+ +
diff --git a/agent/ticket_list.php b/agent/ticket_list.php index 813ba1fa4..89e4700d2 100644 --- a/agent/ticket_list.php +++ b/agent/ticket_list.php @@ -196,9 +196,9 @@ $sort_link = function ($column, $label, $class = '') use ($url_query_strings_sor
- - -
+ + +
@@ -300,6 +300,7 @@ $sort_link = function ($column, $label, $class = '') use ($url_query_strings_sor Edit + Assign to me diff --git a/agent/vendors.php b/agent/vendors.php index 77654be2f..c6fb3914e 100644 --- a/agent/vendors.php +++ b/agent/vendors.php @@ -362,8 +362,8 @@ $missing_templates = $view === 'client' && !$archived ? vendorTemplatesMissingFo
- -
+ +
@@ -436,6 +436,7 @@ $missing_templates = $view === 'client' && !$archived ? vendorTemplatesMissingFo Edit + diff --git a/css/itflow_custom.css b/css/itflow_custom.css index 2e7515ee3..b3d52537d 100644 --- a/css/itflow_custom.css +++ b/css/itflow_custom.css @@ -3206,6 +3206,14 @@ a.itflow-dash-rail-item:focus-visible { max-width: 100%; vertical-align: middle; } + +/* A list row's tag line shows once the row has a tag - the + alone is no reason + for a line on every untagged row. Tags in the row's menu (tagMenuItem()) + gives it its first, and the line appears as the picker redraws it. */ +.itflow-tags-row:not(:has(.itflow-tag:not(.itflow-tag-add))) { + display: none; +} + /* * A tag's colour (--itflow-tag-color, tagColor()) is its accent, not its fill: * a faint wash of it, a hairline of it and its icon in it, with the name in diff --git a/functions/tags.php b/functions/tags.php index 8c6509ba4..9fea039dd 100644 --- a/functions/tags.php +++ b/functions/tags.php @@ -174,7 +174,8 @@ function tagPills($entity, $record_id, array $tags, $filter = '', $can_edit = nu return ''; } - $html = ''; + // Drawn without a + (a card, a header) - the picker keeps it that way when it redraws + $html = ''; foreach ($tags as $tag) { $tag_id = intval($tag['tag_id']); @@ -195,6 +196,31 @@ function tagPills($entity, $record_id, array $tags, $filter = '', $can_edit = nu return $html . ''; } +/* + * An untagged record's empty spot on a card that shows tags without a + (the + * Files grid, the tickets board) - Tags in the card's menu fills it. + */ +function tagSpot($entity, $record_id, $filter = '') { + if (!tagEntity($entity)) { + return ''; + } + return ''; +} + +/* + * Tags in a list row's menu - the picker the + at the end of a record's tags + * opens (js/tag_picker.js), hung off the row's menu button. A list shows a + * row's tag line only once it has a tag (.itflow-tags-row), so this is how an + * untagged one gets its first. The caller checks the row can be edited. + */ +function tagMenuItem($entity, $record_id, $icon_class = 'text-secondary ') { + if (!tagEntity($entity)) { + return ''; + } + return ''; +} + /* A pill link base - a page of ours with a query string, or the default list. */ function tagFilterBase($entity, $filter) { $config = tagEntity($entity); diff --git a/js/tag_picker.js b/js/tag_picker.js index 03d73754b..728fdac14 100644 --- a/js/tag_picker.js +++ b/js/tag_picker.js @@ -17,6 +17,8 @@ * or for bulk, data-tag-bulk instead of data-tag-ids (the ticked .bulk-select * boxes on the page are the records - or only those named in data-tag-bulk, * such as "document_ids[]" on a list that mixes documents and uploads). + * Tags in a list row's menu (tagMenuItem()) is the same button in a + * .dropdown-menu; the panel hangs off the row's menu button, as the menu closes. * * Styled with the select picker's panel classes (css: "Select picker"), so * the two look and behave alike. @@ -71,8 +73,14 @@ holder.innerHTML = pills[id]; var fresh = holder.firstElementChild; if (fresh) { - // Keep this spot's own filter links + // Keep this spot's own filter links, and no + where it had none (a card) fresh.setAttribute('data-tag-filter', old.getAttribute('data-tag-filter') || fresh.getAttribute('data-tag-filter')); + if (old.hasAttribute('data-tag-plain')) { + fresh.setAttribute('data-tag-plain', ''); + fresh.querySelectorAll('[data-tag-picker]').forEach(function (plus) { + plus.remove(); + }); + } // The open picker hangs off the + in the pills being replaced - // move it to the new +, or the next redraw finds it detached // and closes the panel @@ -101,8 +109,11 @@ this.bulk = button.hasAttribute('data-tag-bulk'); this.ids = this.bulk ? bulkIds(button.dataset.tagBulk || '') : String(button.dataset.tagIds || '').split(',').filter(Boolean); this.csrf = csrfFor(button); - // Bulk opens from a menu item that closes - hang the panel off the Action button - this.anchor = this.bulk ? (document.querySelector('#bulkActionButton > button') || button) : button; + // Bulk and a row's Tags open from a menu item that closes - hang the panel + // off the Action button, or the row's menu button + var menu = button.closest('.dropdown-menu'); + var toggle = menu && menu.parentElement ? menu.parentElement.querySelector('[data-bs-toggle="dropdown"]') : null; + this.anchor = this.bulk ? (document.querySelector('#bulkActionButton > button') || button) : (toggle || button); this.query = ''; this.rows = []; this.active = -1; @@ -257,7 +268,9 @@ var width = Math.min(288, viewWidth - 16); var panel = this.panel; panel.style.width = width + 'px'; - panel.style.left = Math.min(Math.max(8, rect.left), viewWidth - width - 8) + 'px'; + // From the anchor's left edge, or its right where that runs off the page (a row's menu button) + var left = rect.left + width > viewWidth - 8 ? rect.right - width : rect.left; + panel.style.left = Math.min(Math.max(8, left), viewWidth - width - 8) + 'px'; this.list.style.maxHeight = ''; var height = panel.offsetHeight; var below = viewHeight - rect.bottom - 12;