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

Matt Janulewicz matt.janulewicz at lucasfilm.com
Tue Aug 24 18:42:59 PDT 2010


I'd first verify 100% that the user has access to the settings file. Use 
'p4 protects'. Try to 'p4 print' it.

Also, I don't know if this is the *correct* syntax for referencing p4 
files/paths, but this is what worked for me. Try changing your return 
line to:

     return ["p4:///admin/jsapi/connect.html"];

Yep, that's three slashes.

If it's working the system info dialog should list available tabs. To 
open them look under View menu in P4V.


-Matt Janulewicz
Lucasfilm Entertainment Company Ltd.


On 08/24/2010 06:22 PM, Andrew Marold wrote:
> 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
>
>
>
> _______________________________________________
> perforce-user mailing list  -  perforce-user at perforce.com
> http://maillist.perforce.com/mailman/listinfo/perforce-user
>    



More information about the perforce-user mailing list