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

Trey Valenta trey at arena.net
Wed Aug 25 08:43:20 PDT 2010


Assuming you really want to apply this to everyone, perhaps you could change the protection entry from:

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

If the read permission isn't there, P4V can't load it. And of course you'd need to ensure that //admin/jsapi/connect.html is also readable.

trey



On Aug 25, 2010, at 8:16 AM, Andrew Marold wrote:

> Well some progress. I realized that my centralsettings.js had an error, in that the final settings() call was inside the settings function instead of the last line of the file. Can you say infinite recursion ? Once I fixed that, with the local file protections entry I was able to get tabs with content. Thinking I'd solved it, I took out the me-specific line and went back to just the all users depot path. Alas, now I'm back to 'not found or loaded'.
> 
> 	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
> 
> _______________________________________________
> 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