Blog PostsStatistics Feedback About Login  


Go

Blog Selection


Extend APEX 4.0 JS using trigger events
4
Mark Lancaster 15-AUG-2010 01:31

APEX 4.0 has introduced JavaScript "trigger events" such as apexbeforerefreshapexafterrefresh and apexbeforepagesubmit.
I'm using them to show a "loading" mask on regions when Partial Page Refresh (PPR) is enabled by clicking on the next rows button, or clicking on the heading to sort by a column.
You can see a live demo of Over-riding APEX JS and using APEX event triggers.
The JavaScript to add this effect is very brief, but there's a lot of concepts to understand.
To implement just copy into your application's JavaScript.

// Copy the APEX function to a new name, so we can override the original.
var apexInitReport = initReport;

// Extend the APEX function by over-riding with our own version and adding functionality
initReport = function(pRegionID, pInternalRegionID, pStyleMouseOver, pStyleChecked) {
   // we can call still call the original (renamed) version to use the existing functionality
   apexInitReport(pRegionID, pInternalRegionID, pStyleMouseOver, pStyleChecked);

   // APEX wraps PPR regions with a DIV with id report_xxx_catch, xxx being the region number
   var c = 'report_' + pInternalRegionID + '_catch';

   // proceed if the PPR region exists
   if (apex.jQuery('#'+c).length) {
      // find the parent DOM node for the PPR
      var p = apex.jQuery('#'+c).parent();

      // Add a bind event to the parent, since the wrapper is deleted on each refresh action.
      // This uses jQuery "live" binding, taking advantage of event bubbling up the DOM hierarchy.
      // ExtJS has more a advanced Event handler.
      apex.jQuery(p).bind('apexbeforerefresh', function(){
          // add a mask when any PPR actions happen 
          // NOTE: this is using the ExtJS library, jQuery users will need to do more work here.
          new Ext.LoadMask(c).show();
      });

   }
}

Over-riding the original initReport function means I don't have to add a call to it in my pages - APEX already does that for me.
Another advantage is that it is automatically applied to all my PPR reports, regardless of what report template I use.

Those of you with sharp eyes will note the "Go to row" item in the bottom of the screenshot.
I've added extra functionality to allow me to jump to any row I like.
I'll be discussing this and other ideas at OpenWorld this year, as well as in my upcoming book on APEX 4.0 with Ext JS.


Show Comments (0)

Programmatically Reset Interactive Reports
4
Scott Spendolini 14-AUG-2010 10:24

This one may be review - and is definitely not a new feature of APEX 4.0 - but it's something that I just stumbled upon.  If you pass in "RIR" to the Clear Cache parameter of an APEX page that contains an Interactive Report, it will programmatically reset the Interactive Report on that page - the same way as if the user selected the Reset option from the IR's menu.

Best of all, you can pass both a page and the RIR directive simply by separating them with a comma.  For example, to clear the cache and reset the Interactive Report on page 10, you would pass 10,RIR to the clear cache parameter.
Show Comments (0)

How APEX Parses SQL
4
Scott Spendolini 14-AUG-2010 09:24

Joel Kallman from the APEX development team has another clearly written & concise article giving us a look at the inner-workings of APEX - specifically how it uses DBMS_SYS_SQL to parse as any schema.
Show Comments (0)

Oracle Sues Google
4
Scott Wesley 13-AUG-2010 22:03

No, that is not a pun.

Time has been weighed in the favour of personal life recently, but one can't help notice some big news in the local industry.

http://www.zdnet.com/blog/btl/oracle-sues-google-for-java-patent-copyright-infringement/38013

That particular link Scribd the official document, which relates to Google Andoid.

Oracle states "one of the most important technologies Oracle acquired with Sun was the Java platform." Past that slowly dissolved into lawyer speak that I often wonder how our ancient authors of writing could bare to comprehend.

I did notice at the end of page nine a "prayer for relief". Interesting the terminology from all directions that become common-speak. From "googling my employee" to "fall from grace" - sayings and idioms of always been a distant world to me.

Courtesy of Mr Spendolini.

**

On a lighter note, I've been informed I'm doing fairly well this month in Steven (& Finn's) PL/SQL Challenge. I think today's quiz might create some discussion on Steven's associated blog. Hopefully I can keep up my recent form and snare a prize ;-)
Show Comments (0)

Application Express and parsing of SQL
4
Joel Kallman 13-AUG-2010 15:03

Recently, I worked with Oracle Support who was helping a customer who had a variety of questions about Oracle Application Express. One of the questions was:

"Please provide a detailed explanation of how apex interacts with database security. It appears that apex is manipulating queries prior to presenting them tot he database to be run either by wrapping them in a pl/sql block that prevents role based security from working or doing a pre-security check that doesn't check role level security prior to issuing a query, or some other even that bypasses role based security. "


Since there really isn't any great explanation of this anywhere, I'd like to provide a brief but lucid explanation about how parsing of SQL works in Oracle Application Express.

  • The Oracle database ships with a supplied PL/SQL package named DBMS_SQL, to perform the execution of dynamic SQL.

  • The Oracle database also ships with a supplied but undocumented PL/SQL package named SYS.DBMS_SYS_SQL. This package enables the execution of dynamic SQL but it also enables the parsing of a statement as a specific database user and with the privileges of this specific database user. This PL/SQL package is highly privileged, obviously. The EXECUTE privilege on this package is not granted to database user, by default. It should almost never be granted to any database user, ever. When asked to grant execution on this package to someone, a smart DBA will always say "no."

  • Until Database version 10.2.0.3, both DBMS_SQL and DBMS_SYS_SQL would not observe roles when parsing SQL. This was consistent with database object access in PL/SQL itself (database roles are not observed in PL/SQL, in case you didn't know).

  • In Database 10.2.0.3 and later (and XE), SYS.DBMS_SYS_SQL was changed to support a flag which enabled the observation of database roles when parsing SQL.

  • In Application Express 2.1 and later, support was added to Oracle Application Express SQL Workshop on DB versions 10.2.0.3 and later to observe database roles, to be consistent with SQL*Plus. However, the execution of SQL in an Application Express application still does not observe roles when parsing user SQL. This remains true for the recently released Application Express 4.0.

So this explains a few things:

  1. If you've ever wondered how Application Express can parse SQL as a specific database user and with the privileges of this database user but without ever connecting as that database user, this is the answer - DBMS_SYS_SQL.

  2. When a new database user/schema is provisioned through Application Express, the discrete system privileges are granted to this new database user and not through any database role.

  3. When you look the underlying database view V$SESSION, it will show that the database sessions associated with Application Express applications are connected as the minimally privileged database user APEX_PUBLIC_USER (or ANONYMOUS, if you're using the embedded PL/SQL gateway). But within that session, the underlying Application Express engine is being invoked and, after determining who the SQL can be parsed as for that specific page view, the SQL is being parsed as a different database user.

  4. This also explains why, in some database versions, it will appear that roles are enabled when you issue DML statements from SQL Commands in SQL Workshop, but in the development of your application and in the execution of your application, it will appear that database roles are not enabled and that direct object privileges are required.

Show Comments (0)

APEX Discussed on Reddit
4
Scott Spendolini 13-AUG-2010 10:37

This thread (language NSFW) on Reddit discusses Oracle's decision to sue Google - and APEX gets some discussion about 2-3 pages down!

Unfortunately, most of the comments are just plain wrong.  I understand that people are entitled to their opinions, but when things are misstated, that's another issue entirely.  I think this is proof that most developers - Oracle and non-Oracle - simply don't know what APEX is and what it can & can't do.

Show Comments (0)

Debugging hint for your APEX pl/sql processes
4
Tobias Arnhold 12-AUG-2010 23:05

Often I use to much pl/sql code inside my APEX processes. As we all know it is just better using complex code inside packages. In case you got trouble with your APEX code and you can't find a fast way debugging it. Just use some javascript popup boxes:

-- Test Box
htp.prn('<script>alert("TEST");</script>');

-- Box with item values showing an IF validation:
htp.prn('<script>alert("'||:P1_TEST1 || ' = ' || :P1_TEST2 || '");</script>');

Summer is coming to an end and it becomes time to blog some more. Right now I'm developing a new small APEX application which describes a way how you can easily use hyphenation inside your application. In that combination I also found a trick how you can prevent the misbehavior of IE6 with fixed column width inside your Reports.

Tobias
Show Comments (0)

Oracle Sues Google
4
Scott Spendolini 12-AUG-2010 22:07

This one should be all over the news by tomorrow AM: Oracle Sues Google Over Java in Android

Not a lot of details about the specifics, but it should be interesting to see how it all plays out.
Show Comments (0)

Safari Extensions
4
Scott Spendolini 12-AUG-2010 22:01

For all of you Mac users out there, have a look at Safari Extensions.  I initially thought that these would be akin to Firefox Add-Ons.  However, they are a lot less and more at the same time.  Translation: they add bits & pieces of functionality that make your browsing experience better.

I started with the Google Reader extension.  Google does a lot of things well - UI, however, has not traditionally been one of them.  Apple is great at UI, but has no RSS reader aside from Mail - which doesn't sync with Google Reader.  The Google Reader extension marries the best of both worlds and provides an Apple-like UI right on top of Google Reader.

What was confusing to me at first was how to use this extension.  I struggled to look for a toolbar or menu entry.  Finally, I just navigated to reader.google.com, and there it was - a stunning new interface on top of Google's excellent RSS reader site.

Here's the before image:



And the after:


It's not a dramatic difference, but enough to add some style to an otherwise excellent RSS reader.

Anyone else have any must-have Safari extensions?  Please share them in the comments!
Show Comments (0)

Webinar: JavaScript in APEX – The Lost Lesson for Database Developers
4
Dan Mcghan 11-AUG-2010 12:44

I’ll be hosting another free webinar next week titled JavaScript in APEX – The Lost Lesson for Database Developers. The webinar will run on Friday, August 20th from 1pm to 2pm EDT (moved from Wednesday the 18th).  The presentation is the one I delivered at ODTUG Kaleidoscope 2010. So if you missed the conference or the presentation, now is your chance.  Click here to register.

Abstract

Oracle Application Express developers often have strong backgrounds in SQL and PL/SQL, but JavaScript is another story. However, JavaScript is a very important part of any well-built Web 2.0 application. In this session, explore JavaScript through a series of analogies, 9 in total, that will relate important concepts in the language back to what you already know in the database world.

Audience

Anyone interested in Oracle Application Express.

Language

English


Show Comments (0)

 1 2 3 4 5 6 7 8 9 10 








 
 
Blog Roll
  • APEXtras
  • Ahcene Bourouis
  • Andy Tulley
  • Anja Hildebrandt
  • Anthony Rayner
  • Anton Nielsen
  • Apex Blog
  • Apex dbe pl
  • Ben Burrell (Munky)
  • Bernard Fischer-Wasels
  • Bradley Brown
  • Carl Backstrom
  • Carsten Cerny
  • Carston Czarski
  • Christian Rokitta
  • Christopher Beck
  • Dan Durbaca
  • Dan Mcghan
  • David Njoku
  • David Peake
  • Denes Kubicek
  • Dietmar Aust
  • Dimitri Gielis
  • Dirk McComsey
  • Doug Gault
  • Douwe Pieter van den Bos
  • Duncan Mein
  • E-Dba
  • Eric Boissonneault
  • Evgeny Timoshinin
  • German APEX Community
  • Håvard Kristiansen
  • IAdvise
  • Ilmar Kerm
  • Iloon Ellen
  • Insum
  • Jason Aughenbaugh
  • Jason M.
  • Jason Straub
  • Jean-Phillipe Pinte
  • Jeff Holoman
  • Jeffrey Kemp
  • Joel Kallman
  • John Scott
  • Jon Trostheim
  • Jornica
  • João Oliveira
  • Kristian Jones
  • Learco Brizzi
  • Louis-Guillaume Carrier-Bédard
  • Marc Sewtz
  • Mark Lancaster
  • Martin B. Nielsen
  • Martin Giffy D'Souza
  • Matt Ball
  • Matt Nolan
  • Niels de Bruijn
  • Niels de Bruijn
  • Noel Portugal
  • Oracle Nerd
  • Oracle Quirks
  • Oradude
  • PL/GMaps
  • Patrick Wolf
  • Paul Brookes
  • Paulo Vale
  • Pawel Barut
  • Peter De Boer
  • Peter Manchev
  • Peter Raganitsch
  • Przemek Staniszewski
  • RCI
  • Roel Hartman
  • Rutger de Ruiter
  • Sara Blair
  • Sathish Kumar
  • Scott Spendolini
  • Scott Wesley
  • Stew Stryker
  • Sujay Dutta
  • Sumnertech Blog
  • Tobias Arnhold
  • Tyler Muth
  • Unknown APEX
  • Wei Zheng

    © Created and Hosted by Apex Evangelists