Databases Reference
In-Depth Information
The following is a description of the preceding code that is keyed to the line numbers:
349-354: Define the plug-in's attributes and use meaningful variables. All the
attributes are strings that need to be explicitly converted to appropriate PL/SQL
data types when applicable.
365-390: Reusable internal procedure to display each of the RSS titles in a table
format. The titles include links that will trigger some JavaScript code to display
the RSS content in a modal window. This will be used to make an AJAX call
395-400: Minimal debug information. Always include some debug information
in your plug-in.
402-449: Contains code that is only applicable in normal display mode. The
code is there to support the display of the RSS content in a modal window. If
the page is run in print mode, then this code is not required.
Line 404 references a JavaScript file that has yet to be created. You will create
this file when implementing the AJAX support.
When developing plug-ins with AJAX support, you may tend to initially focus on
getting the region to display what you want to display and then add the
additional code.
439: This line is very important for AJAX calls. The key component is the
reference to the apex_plugin.get_ajax_identifier function.
In the AJAX example at the beginning of the chapter, the JavaScript code
referenced the PL/SQL code to run by identifying the application process
AJAX_DEMO . Plug-ins need a similar identifier/reference. The APEX plug-in
APIs make things simple so that you don't need to worry about naming this
identifier. The apex_plugin.get_ajax_identifier function provides a unique
name.
451-472: Handle RSS type-specific code to obtain the RSS title and some meta
data. Lines 475-476 handle what happens if an unknown RSS type is defined. In
this case, it displays a simple error message. How you handle errors is entirely
up to you, depending on your business needs. You can use a “soft” error
message (as in this case) or a more “harsh” error messages (i.e., raise an
application error).
If you run Page 40, it should look like Figure 5-19. Note the values for the RSS feed may vary
depending on the URL. If you click on any of the titles, nothing happens as the JavaScript still hasn't
been added and the AJAX function has not been defined. This will be covered in the next section.
If you discard the JavaScript specific code, the code for this plug-in is pretty simple and straight
forward. The primary responsibility for a region plug-in is to display some content. You don't need to be
concerned about items and buttons attached to the region as they are handled as part of the standard
APEX region process.
 
Search WWH ::




Custom Search