Skip to content

Allow opening Persona Bar items in a new browser tab - #7583

Open
idumlupinar wants to merge 5 commits into
dnnsoftware:developfrom
idumlupinar:enh-7581
Open

idumlupinar wants to merge 5 commits into
dnnsoftware:developfrom
idumlupinar:enh-7581

Conversation

@idumlupinar

Copy link
Copy Markdown
Contributor

Closes #7581

Summary

Persona Bar menu items could only be opened in place. They were <li> elements with a click handler, and the Persona Bar runs in an iframe that never changes the page URL, so middle-click, Ctrl/Cmd-click and "Open link in new tab" did nothing useful. This PR makes them real links, so admins can, for example, keep Pages open in one tab and Recycle Bin in another.

Client (Dnn.PersonaBar.UI)

  • Each submenu item now contains an <a> whose href is the current page with ?personabar=<identifier> (e.g. /?personabar=Dnn.Recyclebin). Items that already have a Link (e.g. Site Assets) keep pointing to it.
  • A plain left-click works exactly as before: the panel opens in place. Ctrl/Cmd/Shift-click is left to the browser, and middle-click and the context menu work natively.
  • On page load, if a panel was requested, the Persona Bar opens it instead of the last-used panel, then removes the parameter from the address bar with history.replaceState.
  • The links are styled to look identical to the previous text.
  • When the Persona Bar is not visible (config.visible is false), the links are inert, as the items were before.

Server (PersonaBarContainer)

  • The personabar query value is matched (case-insensitively) against the current user's menu, which is already filtered by permissions and FilterMenu. Only panel items count: root menus such as Content/Manage and items with a Link are excluded.
  • Only a matching identifier is passed to the client, as requestedPanel in the Persona Bar settings. Unknown or unauthorized values are ignored, and raw URL text never reaches the client or a jQuery selector.

Security / multi-portal / multi-language

  • The parameter can only open a panel the user can already open from their menu, and no other URL values are passed to panels.
  • Links are built from the current page's own URL, so they stay on the same portal alias, child-portal path and culture path. Identifiers are not localized.

Note: the existing "last opened panel" user setting is still stored per user on the server, so a plain reload restores whichever panel was opened last in any tab. That behaviour is unchanged.

Release Note

Persona Bar menu items can now be opened in a new browser tab (middle-click, Ctrl/Cmd-click or "Open link in new tab"), for example to work in Pages and Recycle Bin side by side.

Testing Steps

  1. Log in as an administrator or host.
  2. Hover Content in the Persona Bar and middle-click Pages. A new tab opens with the Pages panel open, and ?personabar= is removed from the address bar.
  3. In the original tab, Ctrl/Cmd-click Recycle Bin (under Content). Another tab opens with Recycle Bin. Both tabs work independently.
  4. Right-click a menu item → "Open link in new tab" behaves the same.
  5. A plain click on any item still opens the panel in place without reloading the page.
  6. Site Assets (an item with its own link) still opens its page as before.
  7. Open /?personabar=Bogus and /?personabar=Content: no panel opens and there are no script errors.
  8. As a non-host administrator, open /?personabar=Dnn.Servers: nothing opens.

Added requested panel handling to the PersonaBarContainer class.
Correct HTML character encoding for proper rendering.
… new tabs

clicks: a plain click still opens the panel in place. Ctrl, Cmd and Shift clicks are left to the browser, so it opens a new tab or window.

page load: if the server sent a requested panel, it opens that panel and then removes the parameter from the address bar.

hidden Persona Bar: when the Persona Bar is disabled (not visible), the links do nothing, as before.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enhancement]: Offer opening Persona Bar items in a new browser tab

1 participant