Add custom HTML pages to P4V
When HTML Tools are enabled in P4V, you can extend P4V to host custom HMTL pages in the form of tabs or windows. For a list of functions you can use in your HTML page to communicate with P4V, and how to call them, see:
HTML tabs
Tabs become available as menu items in the Views menu. In P4V, HTML tabs open as tabs in the right pane. P4V handles an HTML tab like any other tab: You can undock it, and P4V remembers the window position. When you re-start P4V, P4V re-opens the tab if it was previously open.
To add a custom tab:
- Go to Tools > Manage Tools > HTML Tabs.
- In the Manage HTML Tabs dialog, click New and select Tab.
-
In the Add HTML Tab dialog, provide the following information:
- Name: The name of the menu item
- Placement: The placement of the new page in the View menu. By default, the highest level (HTML Tabs) is selected. You can select a subfolder, if available, or create a new folder.
- URL: The location of the HTML file
- Image: The icon used in the menu and the tab header
- Under HTML Page context menus, select any options you want to appear when you right-click (Windows) or context-click (Mac) a page.
- Click OK.
- Continue with Deploy custom HTML pages.
HTML windows
Windows becomes available as menu items in the Tools menu and as context-menu items when you right-click (Windows) or context-click (Mac) the relevant item in the P4V user interface. An HTML window displays an HTML page in a floating window. Depending on the argument type configured, P4V launches the HTML page with an additional argument. The following argument types are supported:
- %a: Selected label
- %b: Selected branch
- %C: Selected changelists
- %c: Selected changelist
- %D: Selected files or folders (depot syntax)
- %d: Selected file or folder (depot syntax)
- %F: Selected files (workspace syntax)
- %f: Selected file (workspace syntax)
- %i: Selected workspace
- %J: Selected jobs
- %j: Selected job
- %P: Selected pending changelists
- %p: Selected pending changelist
- %S: Selected submitted changelists
- %s: Selected submitted changelist
- %t: Selected stream
- %u: Selected user
Following is a list of arguments P4V adds when launching the HTML page:
- %a: <url>?label=<labelname>
- %b: <url>?branch=<branchname>
- %c: <url>?change=<changename>
- %C: <url>?changes=<changename1>,<changename2>,<changename3>
- %d: <url>?file=<filename>. // depot syntax
- %D: <url>?files=<filename1>, <filename2>, <filename3>
- %f: <url>?file=<filename> // local syntax
- %F: <url>?files=<filename1>, <filename2>, <filename3>
- %i: <url>?workspace=<workspacename>
- %j: <url>?job=<jobname>
- %J: <url>?jobs=<jobname1>,<jobname2>,<jobname3>
- %p: <url>?change=<changename> // pending change
- %P: <url>?changes=<changename1>,<changename2>,<changename3>
- %s: <url>?change=<changename> // submitted change
- %S: <url>?changes=<changename1>,<changename2>,<changename3>
- %t: <url>?stream=<steamname>
- %u: <url>?user=<username>
You can retrieve these arguments in the HTML page as follows:
branchName = GetURLParameter("branch");
Windows often 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:
- Go to Tools > Manage Tools > HTML Windows.
- In the Manage HTML Windows dialog, click New and select Window.
-
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
- Under HTML page context menus, select any options you want to appear when you right-click (Windows) or context-click (Mac) the page.
- Click OK.
- Continue with Deploy custom HTML pages.
Your search for returned result(s).