Thank you this was definitely a step in the right direction as it fixed my
java controls.
However, in my custom application (Amateur Radio Logbook) I have a HTML
area
defined in my eTemplate. In the Class I am sending javascript to the HTML
area “map” to insert a Google Map (see below). On a side note the map
renders fine in Internet Explorer but not Firefox or Chrome.
You have 2 strategies to consider. One is to figure out how to set CSP for
your app, so it still works as it is. The other is to convert your
application to follow the new (in development, still mostly undocumented -
sorry) standards. Either way, you will have to do some adjusting to allow
the Google code.
Some links for CSP info
A pretty good intro to practical CSP, using google API as an example
http://www.html5rocks.com/en/tutorials/security/content-security-policy/
The spec:
http://www.w3.org/TR/CSP/
This refers specifically to chrome extensions, but much of the information
may also be relevant:
http://stackoverflow.com/questions/12129077/content-security-policy-cannot-load-google-api-in-chrome-extension
The “eTemplate2” way
SInce you mentioned you were adapting your applications to TRUNK, this is
probably the way you want to go. This is generally what we’re doing to all
the other apps, rather than a full conversion guide.
To turn on eTemplate2, change your creation of etemplate from something
like this:
$template = new etemplate();
to something like this:
$template = new etemplate_new();
Also, make sure your templates have been exported to XML, they go in
egroupware/your_app/templates/default/
eTemplate2 uses a file, your_app/js/app.js, as the primary javascript file
for your application. It is automatically loaded.
If your application uses etemplate2 and your javascript file extends AppJS
(see phpgwapi/js/jsapi/app_base.js), you get automatic instantiation via
init(), and notification when your template is fully rendered via
et2_ready(). You can look at some of the other applications for examples
of how to structure the file, but basically you would wind up with
something like:
app.your_app = AppJS.extend(
{
appname: ‘your_app’,
init: function()
{
// call parent
this._super.apply(this, arguments);
// This will still be refused unless CSP is adjusted to allow it
this.egw.includeJS(‘https://maps.googleapis.com…’);
},
// Template and all files are fully loaded before this is called
et2_ready: function(et2)
{
// call parent
this._super.apply(this, arguments);
// Pull variables from content & init map
this.initialize(
this.et2.getArrayMgr(“content”).getEntry(‘COL_LAT’) || ‘’,
this.et2.getArrayMgr(“content”).getEntry(‘COL_LON’) || ‘’,
…
);
},
/**
- Initialize the map - relatively unchanged, I think
- …
*/
initialize: function(lat, lon, …)
{
…
}
});
Of course, everywhere that says your_app needs to be changed to your actual
application’s name. I’m also probably forgetting a few critical details…
Nathan