…
In my main menu I use a div / article tag which includes more detailed
links.
<article onclick="location.href='offers_new.php'">
<h3>Angebote</h3>
<a href="offers_new.php" >Neues Angebot erstellen</a>
Angebotsliste
The css for this works like that: If you hover over the article, more
detailed links appear - but if You just point on a touchscreen device
directly on the article, the onclick function directs you to
offers_new.php.
The standalone html-version works, but when I use this in my app in
egroupware nothing happens- it looks like the onclick-function doesn’t
work. I also tried window.location instead of location.href.
…
I’m not sure what exactly is going wrong, but I’d expect the CSP is
blocking you.
http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful
For good reasons, we try to avoid inline javascript like that.
As frustrating as it may be, you should consider if you can re-work your
planned app to use some of the egroupware framework, such as the sidebox
menu.
We have some special handlers that automatically show & hide the sections,
though I have no idea if new ones can be added via ajax like that.
For your introduction to AJAX (outside of etemplate), it’s almost all this:
/** The constructor of the egw_json_request class.
*
-
@param _menuaction the menuaction function which should be called and
- which handles the actual request. If the menuaction is a full featured
- url, this one will be used instead.
-
@param _parameters which should be passed to the menuaction function.
-
@param _async specifies whether the request should be asynchronous or
- not.
-
@param _callback specifies the callback function which should be
- called, once the request has been sucessfully executed.
-
@param _context is the context which will be used for the callback
function
-
@param _sender is a parameter being passed to the _callback function
*/
json: function(_menuaction, _parameters, _callback, _context, _async,
_sender)
Use it like:
var callback_function(data) {…};
egw.json(myapp.class.function_name, [param, other_param],
callback_function, this).sendRequest();
You are encouraged to keep your application’s js in it’s own file(s) which
extend the AppJS base class, like this:
app.classes.myapp = AppJS.extend(
{
json_callback: function(data) {…},
})
Nathan