Wednesday starts off with a presentation about a new feature in APEX 4.0 that I have not had a chance to look into. It is how you use and develop plugins. The presentation was held by Patrick Wolf who is also the developer of the plugin feature.
Scott began by showing how a plugin is used (that is using a plugin compared to developing it).
You install a plugin by selecting plugins in the shared components section, and then it is just a standard APEX import.
Using a plugin has the benefit that it is declarative while using javascript directly requires code changes and explicit inclusion of necessary code on every page it is used on.
Once installed, the use of it is identical to using other supplied item types in APEX. It is like the plugin was part of the product.
The productivity is much better than it is with just using javascript as once you have the plug in it is just a matter of selecting it to be used and not having to change code to match what you need.
There are already many plugins available and more are added all the time.
Patrick recommends starting with finding a JQuery plugin that performs the action you want and then trying it out on a static html page. When that works, you’re ready to create an APEX plugin for it.
When developing an APEX plugin, you need to follow certain API guidelines to make sure your functions has the signature they are expected to accept.
Patrick them moved on to showing how a plugin is developed.
You create your plugin in shared components and then it is a matter of providing calls to the PL/SQL code you write to generate the html and other things that are needed.
Patrick finished up with some recommendations for developing plugins and they are similar to what you would expect in any web oriented technology.
Always escape all data, both from the database and from the browser. Not doing that opens a risk of cross site scripting attacks. There is a function available for this, I believe it is sys.htf_escape_cs (possible typo as I wrote it from memory after he moved on to his next slide).
Reference apex.jquery in the code to make sure the apex supplied version of jquery is used.
Do not trust client side checks on data as the can easily be overridden. The same checks has to be performed on the server side also.
Look at Oracles Best Practice plugins to get a feeling for what to do and how to do it. They have lots of comments to guide you.
Use the packages apex_plugin_util, apex_javascript, apex_css.
Test your plugins with more than one item using it on a page.
Patrick recommends avoiding inline css and javascript when it becomes a lot to make sure the page loads faster.
Patrick finished up with reminding us to share plugins when it is possible to do so.
The only other presentation for the morning was a handson allowing the participants to repeat the steps that Patrick had just done. As with many hands on exercises it was too much of following a set of steps with instruction to click here or there and to type this or that into different places. Though useful it is not creative enough to allow me to fully understand the process. That can however be done some other time when I have a need to develop a real plugin.