How to Embed Custom Panels (e.g. DVR) in the Workspace
Note: Make sure all plugins are up to date in SiteAdmin > Plugins
Creating custom windows from Scripts
Custom windows can be created from UserRightClickMenu scripts. More information on enabling and creating this type of scripts can be found here.
This should be the content of the script:
Here is what each argument in the above call means:
- KEY - a unique key used to denote a specific script-generated window/panel. If a window with the specified key is already open, it will be updated instead of creating a new window.
- LABEL - displayed label for the window/panel.
- URL - a custom URL that will be loaded inside this window/panel as an iframe.
Note that it is not possible to embed every URL as an iframe. For example, embedding a page with a HTTP URL into a HTTPS page will not work. To open this kind of pages from Vehicle Tracker, see the section Opening a URL in New Browser Window below.
Example: Window Displaying Vehicle DVR
If you have vehicles with cameras that can be viewed from a web page, you can integrate this view into the Vehicle Tracker application.
Set up a user custom field with the label VehicleCameraURL.
Now edit a user corresponding to a vehicle with a camera to contain the URL of its camera feed in this field:
Next go to Developer > App Builder and create a new App. In this app, add a new Click Script. Select UserRightClickMenu as its kind. Call it ShowCamera. Click Edit and use the script provided below the screenshot.
Now edit the script to the content below:
Select the user that has the VehicleCameraURL value set when testing the script from the editor. Clicking Run Script will already open the URL in a new window, but you may close this window for now and save the script.
If you have a role with _UseClickScript privilege and Auto-allow new items enabled, the added script should immediately be available as a ShowCamera option in the right click menu of the vehicle list.
Clicking the option will open a window and load the URL specified in VehicleCameraURL of the selected user. If you now click on another user with a different VehicleCameraURL specified, it will reload the content of the same window (as denoted by “ShowCameraWindow” key in the script).
If you right click on this window’s title bar, you can convert it to a panel and handle it like any other panel in the Vehicle Tracker application. The final result can look like this:
Saving the workspace through Workspace > Save will save the position of windows/panels created this way. On next reload, URL that was displayed last before saving the workspace will be immediately loaded.
Opening a URL in New Browser Window
You can also trigger opening a specific URL from a script in a new browser window. Here is how to modify the script in the above example to open a new browser window: