Examples for P4V

When you install P4V, the example files for the P4VJS demo are included in the Perforce\P4VResources\resources folder. In demo mode, you have access to example HTML Tabs and HTML Windows from the View and Tools menus, and to the respective editors to manage custom HTML pages. You can activate demo mode from the Preferences window.

Note

In demo mode, P4V does not save any changes you make using the Manage HTML Windows and Manage HTML Tabs editors.

To run P4V in demo mode:

  1. In P4V, go to Edit > Preferences.
  2. In the Preferences window, on the HTML Tools tab, select Enable HTML Tools. In this mode, P4V supports P4VJS.
  3. Restart P4V for this change to take effect.
  4. Go to Edit > Preferences.
  5. In the Preferences window, on the HTML Tools tab, select the Run HTML Tools in demo mode check box.

    P4V runs in demo mode for the duration of this session or until you clear the check box.

List of examples for P4V

In demo mode, P4V includes the example custom HTML Tabs and HTML Windows. All examples are written in core HTML/JavaScript and P4JsApi/P4VJS (no frameworks used).

Note

This is not production code. The intent is to demonstrate possible use cases for the P4VJS API.

Example type Name Description Available from

Tab

Downloads

Shows the Perforce Downloads page.

View menu

Blogs

Shows the Perforce Blogs page.

Products

Shows the Perforce Products page.

Demo P4V Images

Shows how to retrieve images from P4V. It ports a P4JsApi example to P4VJS by emulating synchronous requests.

Demo Run Queries

Shows how to run queries and display the result in an HTML table. This example uses built-in queries that parse the JSON result into an HTML table, but you can enter your own queries.

Demo Server Info

Runs the p4 info command to show how to port a P4JsApi example to P4VJS in different files:

  • serverinfo1.html: Emulates synchronous requests
  • Serverinfo2.html: Implements an anonymous inline callback
  • Serverinfo3.html: Implements a named callback function

Window

Demo Connection Info

Runs the p4 info command.

Tools menu

Demo File Info

Shows how to handle multi-selection and run a series of commands.

Demo Submit

Shows the basic implementation of a Submit window.

Demo Edit Branch/Workspace/Job/Stream

Demonstrates how to create and populate a dynamic form (a FormSpec). This example consists of one HTML file registered as different HTML Windows to support different selected object types.

Note

In demo mode, P4V does not save any changes you make using the Manage HTML Windows and Manage HTML Tabs editors.

Ported examples

For a set of P4JsApi examples ported as P4VJS examples, see the <installation_root>\Perforce\P4VResources\p4vjs or <installation_root>/Perforce/P4VResources/p4vjs folder. For more information, see the P4JSAPI to P4VJS Conversion Guide.