Build an image gallery using APEX

Written by Paulo Vale on Friday, December 19, 2008


This time, I'll show how to build a simple image gallery using Oracle Application Express (APEX) and taking advantage of Jquery framework capabilities. But first of all, follow the link to see the magic happening ;)

There are several slideshow or gallery plugins for Jquery. You can choose the one you like more and re-adapt the code to fit the plugin requirements. My choice was Pikachoose.

Pikachoose is a lightweight Jquery plugin that allows easy presentation of photos with options for slideshows, navigation buttons, and auto play.



Lets begin creating a simple database structure to store the images.

Create a sequence to be used by image id:



Create a table to store the images:



Now on APEX, following the wizard, create a data entry form based on "GAL_IMAGES" table.


Go to Shared Components>Application Items and Create an Application Item. Ex: G_IMAGE_ID.

Create an Application Process to retrieve the image from the database. Identify the point at which this process will run as "On Demand". The point of "On Demand" is that it will only fire when requested by a page process.



Now create the page where you want to put the image gallery and then, Edit Page > HTML Header:




On the same page, create a PL/SQL Dynamic Content region:



And run...

Timepicker and APEX

Written by Paulo Vale on Tuesday, November 18, 2008

ClockPick is a jQuery time picker plugin. As I showed in previous posts, it's fairly easy to integrate third party javascript components with APEX.



A demo of ClockPick working with APEX can be found here.

How to do it?

1- Upload files to your APEX server. You can upload them directly to the server filesystem or use static files in Shared Components;

jquery.clockpick.1.2.4.js
clockpick.1.2.4.css
jquery-1.2.6.min.js

2- Include reference to the CSS file and ClockPick plugin JS file on the page template between HEADER tags or directly in you page properties, Header section:




3- Include reference to the JQuery library file (again in page template or page header):



4- Now the script to make it all happen. Note that this function is binding P9_TIME text element. You can reference the many items you want. You can also change the hour range to be displayed and execute a function after the selection is done. Read ClockPick website to get detailed information about all the configurations available.

Javascript Tooltip Integration

Written by Paulo Vale on Tuesday, January 08, 2008

As I've said in my previous post, there is another interesting project for handling tooltips, the BoxOver Tooltips from the same author of the calendar script.





It is a small javascript that you can integrate with you APEX applications. It is very simple to use and has powerful customizations possibilities like using your own CSS to change the look and feel. You can even include pictures in your tooltips. Go to the project page for nice examples and howtos. Click here to see it working with APEX.



To install the script, download the latest version of BoxOver tooltips and copy the boxover.js script into a filesystem directory or just upload it as a static file under Shared Components. Include the following somewhere in the HTML of your page (Header section of you page or directely in page template if you want the tooltip feature available in all application pages). Substitute the path of the file accordingly making sure it points to the correct location of the boxover.js file.





Now you can use this feature just by calling it in an appropriated place. A simple example, using a Text Field is adding the following tag to "HTML Form Element Attributes" property :

TITLE="header=[Date] body=[Click here to pick a date]";
BoxOver is configured through the "title" attribute of HTML elements. This means you can use it in all your HTML objects. Works in all latest browsers incl. IE 6, IE 5, Mozilla 1.4+, FireFox 0.9.3 Opera 7.

Javascript Calendar Integration

Written by Paulo Vale on Monday, January 07, 2008

One of the good things about APEX is that we're not limited to the buit-in features. There are hundreds of examples of free code you can find with the help of Mr. Google :)

Today I'll show one of these examples. A small javascript calendar that you can integrate in you APEX applications. Click here to see it working.


I've found this simple but great small javascript calendar at http://calendar.swazz.org/ . Click here to download the latest version.

To install the script:

1- Copy the calendar.js script into a filesystem directory or just upload it as a static file under Shared Components.

2- Include the following somewhere in the HTML of your page (Header section of you page or directely in page template if you want the calendar available in all application pages). Substitute the path of the file accordingly making sure it points to the correct location of the calendar.js file.



3. Create a Text Item in your page and open the item properties page. Add to the the code:
onfocus="this.select();lcs(this)"
onclick="event.cancelBubble=true;this.select();lcs(this)"

4. Run the page and click the Text Item.

There is another interesting project for tooltips from the same author of the calendar script. If I manage some free time i'll blog about it later.