[p4] Anyone using the JSAPI ? Can't get the simple example to work

Andrew Marold amarold at unidesk.com
Tue Aug 24 18:22:25 PDT 2010


I'm trying to get an example from the p4JSAPI doc to work with no success. I added the centralsettings line to my protections table, created the centralsettings.js file, and told p4v to accept applets. When I run it, I don't see any new tabs, and in system info I get this:

Perforce Applet Configuration:
Central settings file specified for user: yes (line 30 of permissions table)
Central settings file: //admin/jsapi/centralsettings.js
Perforce applets accepted: yes
Warning: central settings file not found or loaded.

My protections table contains this line:

list user * centralsettings //admin/jsapi/centralsettings.js

The file //admin/jsapicentralsettings.js contains:

function settings(key) {
    if (key == "p4v_mainTabs")
        {
            return ["//admin/jsapi/connect.html"];
        }

    settings(P4JsApi.centralSettingsKey());
}

and //admin/jsapi/connect.html contains (cut & paste strait from the .pdf)

<html>
<head>
<title>Current Settings</title>
</head>
<body>
<script type="text/javascript">
content = '<H1>Current Settings</H1>' +
'<p><b>Port:</b> ' +
P4JsApi.encodeForHTML(P4JsApi.getPort()) +
'<p><b>Client workspace:</b> ' +
P4JsApi.encodeForHTML(P4JsApi.getClient()) +
'<p><b>User:</b> ' +
P4JsApi.encodeForHTML(P4JsApi.getUser()) +
'<p><b>Charset:</b> ' +
P4JsApi.encodeForHTML(P4JsApi.getCharset()) +
'<p><b>Server version:</b> ' +
P4JsApi.encodeForHTML(P4JsApi.getServerVersion()) +
'<p><b>Unicode?:</b> ' +
(P4JsApi.isServerUnicode() ? 'Yes' : 'No') +
'<p><b>Case sensitive?:</b> ' +
(P4JsApi.isServerCaseSensitive() ? 'Yes' : 'No') +
'<p><b>Security level:</b> ' +
P4JsApi.encodeForHTML(P4JsApi.getServerSecurityLevel());
document.write(content);
</script>
</body>
</html>

Any ideas as to where I'm going wrong ?

Thanks,
	Drew

Drew Marold - amarold at unidesk.com
Sr. Tools & Release Engineer - Unidesk Corporation

I hold . . . that a man should strive to the uttermost for his life's set prize.
Robert Browning






More information about the perforce-user mailing list