HTML Windows

An HTML Window displays an HTML page in a floating window. The user can resize and close the window.

If you add an HTML Window to P4V or P4Admin, it becomes available in two ways:

  • as a menu item in the Tools menu
  • as a context-menu item when you right-click (Microsoft Windows) or context-click (macOS) the relevant item in the graphical user interface.

Argument types

Depending on the argument type configured, P4V launches the HTML page with an additional argument.

The following argument types are supported:

Argument type

Parameter

Meaning

%a label Selected label
%b branch Selected branch
%C changes Selected changelists
%c change Selected changelist
%D files Selected files or folders (depot syntax)
%d file Selected file or folder (depot syntax)
%F files Selected files (workspace syntax)
%f file Selected file (workspace syntax)
%i workspace Selected workspace
%J jobs Selected jobs
%j job Selected job
%P changes Selected pending changelists
%p change Selected pending changelist
%S changes Selected submitted changelists
%s change Selected submitted changelist
%t stream Selected stream
%u user Selected user
Note

In P4Admin, each connection has four tabs (Home, Users, Permissions, and Depots ). These tabs are not closeable, and you cannot float them. All connections are managed in one window. If the user switches the connection, the set of tabs switch.

P4Admin accepts only the following arguments for HTML Windows:

Argument type

Parameter

Meaning

%g group Selected group
%u user Selected user
%d depot Selected depot
%F files Selected files
%f file Selected file
%r directory Selected directory

To retrieve the value of an argument in the HTML page, specify the argument. For example:

branchName = p4vjs.getParameter("branch");

Your HTML Windows can include buttons with labels such as OK, Yes, No, Cancel, Submit, or Save. When clicked, these buttons are expected to close the window. To achieve this in the HTML page, call the following function:

p4vjs.closeWindow();

This only works from HTML Windows. You cannot close an HTML Tab from the HTML code. This is consistent with the behavior of existing tabs and windows in P4V.

To add a custom window:

  1. Go to Tools > Manage Tools > HTML Windows.
  2. In the Manage HTML Windows dialog, click New and select Window.
  3. In the Add HTML Window dialog, provide the following information:

    • Name: The name of the menu item.
    • Placement: The placement of the new page in the Tools menu. By default, the highest level (HTML Windows) is selected. You can select a subfolder, if available, or create a new folder. For new folders, you can also specify if you want them to appear as an additional level in context menus.
    • URL: The location of the HTML file.
    • Argument Type: The type of the selected object. See the list of arguments here.
    • Width and Height: The dimension of the window, in pixels
  4. Under HTML page context menus, select any options you want to appear when you right-click (Windows) or context-click (Mac) the page.
  5. Click OK.

Next step

Continue with Deploy custom HTML pages.