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

Andrew Marold amarold at unidesk.com
Wed Aug 25 08:00:48 PDT 2010


I can definitely see the file, 'p4 print' displays it. I've tried every form of path specification including the one you suggested to no avail. Next I tried added a protect line just for my user, and listed the centralsettings.js file as a local path, using the path to the workspace where I've been trying to make this work. After that, p4v stopped reporting the not found or loaded error, but it still didn't display a new tab, or indicate one was available. I even changed the centralsettings file to say:

return ["http://www.google.com"];

just to avoid the whole depot path thing entirely. Still nothing.

	Drew

-----Original Message-----
From: perforce-user-bounces at perforce.com [mailto:perforce-user-bounces at perforce.com] On Behalf Of Matt Janulewicz
Sent: Tuesday, August 24, 2010 9:43 PM
To: perforce-user at perforce.com
Subject: Re: [p4] Anyone using the JSAPI ? Can't get the simple example to work

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
>    
_______________________________________________
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