You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Register layouts in PageLayouts so they appear in admin UI
Both layouts (DefaultView, SideBySideView) are now registered in RT's
PageLayouts config (RT::Ticket → Display) at plugin load time, making them
visible in Admin → Page Layouts alongside built-in layouts and assignable
to queues by administrators.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Users can choose between two named page layouts — both via their personal
6
6
preferences and via a one-click toggle button directly in the ticket menu bar.
7
-
No administrator involvement is required after installation.
7
+
Both layouts are also available in the RT admin interface under
8
+
*Admin → Page Layouts*, where they can be assigned to queues like any
9
+
built-in layout.
8
10
9
11
---
10
12
@@ -70,29 +72,42 @@ Narrow metadata column next to a wide transaction history.
70
72
71
73
## How it works
72
74
73
-
RT 6 determines the layout of a ticket display page via
74
-
`HTML::Mason::Commands::GetPageLayout`, which consults the global
75
-
`%PageLayoutMapping` configuration. Because that mapping is global and cannot
76
-
vary per user, this extension wraps `GetPageLayout` through RT's standard
77
-
overlay mechanism (`lib/RT/Interface/Web_Overlay.pm`). The wrapper checks the
78
-
current user's `TicketViewLayout` preference on every ticket display request
79
-
and, when a preference is set, returns the matching layout data structure
80
-
directly — bypassing the global mapping entirely for that user.
75
+
### Layout registration
81
76
82
-
The preference itself is registered as an `Overridable` RT config option with
83
-
a Select widget, so it appears automatically in the standard RT Preferences
84
-
page under *Ticket display* without any additional template changes.
77
+
At startup the extension registers both layouts in two places:
78
+
79
+
-**`PageLayouts`** — RT's config key for named layout definitions
80
+
(`RT::Ticket → Display → LayoutName`). This makes them appear in
81
+
*Admin → Page Layouts* alongside the built-in layouts and allows
82
+
administrators to assign them to queues via the normal admin interface.
83
+
-**`PageLayoutMapping`** — indirectly, because once a layout name is in
84
+
`PageLayouts`, an admin can add a queue assignment there just like any other
85
+
layout.
86
+
87
+
### Per-user preference override
88
+
89
+
Because the `PageLayout` queue mapping is global, the extension also wraps
90
+
`HTML::Mason::Commands::GetPageLayout` via RT's standard overlay mechanism
91
+
(`lib/RT/Interface/Web_Overlay.pm`). On every ticket display request the
92
+
wrapper checks the current user's `TicketViewLayout` preference and, when set,
93
+
returns the matching layout directly — taking priority over any queue-level
94
+
assignment for that user.
95
+
96
+
The preference is registered as an `Overridable` RT config option with a
97
+
Select widget so it appears automatically in *Preferences → Ticket display*
98
+
without any additional template changes.
99
+
100
+
### Toggle button
85
101
86
102
The toggle button is injected into the ticket menu bar via the
87
103
`Elements/Tabs/Privileged` callback, using the same `raw_html` / `sort_order`
88
-
pattern that RT core uses for Bookmark and Timer. Clicking it performs a GET
89
-
request to a small helper page (`SideBySideView/SetLayout.html`) that writes
90
-
the new value into the user's preferences and redirects back to the ticket,
91
-
which then re-renders with the new layout.
104
+
pattern that RT core uses for Bookmark and Timer. Clicking it sends a GET
105
+
request to `SideBySideView/SetLayout.html`, which writes the new value into
106
+
the user's preferences and redirects back to the ticket.
92
107
93
108
| File | Role |
94
109
|------|------|
95
-
|`lib/RT/Extension/SideBySideView.pm`| Registers the `TicketViewLayout` preference meta, defines both layout data structures, and adds the `layout-split` SVG icon to RT's icon set. |
110
+
|`lib/RT/Extension/SideBySideView.pm`| Registers the `TicketViewLayout` preference meta, defines both layout data structures, registers them in `PageLayouts`, and adds the `layout-split` SVG icon to RT's icon set. |
96
111
|`lib/RT/Interface/Web_Overlay.pm`| Loaded by RT's overlay mechanism at startup. Wraps `GetPageLayout` to honour the per-user layout preference for ticket display pages. |
97
112
|`html/Ticket/Elements/SideBySideViewToggle`| Renders the icon link in the menu bar. Reads the current preference and links to the opposite layout. |
98
113
|`html/Callbacks/SideBySideView/Elements/Tabs/Privileged`| Adds the toggle element to the ticket page menu at `sort_order => 97` (before Bookmark at 98, Timer at 99). |
0 commit comments