You can use a global notification to communicate system status. If your page template contains a #GLOBAL_NOTIFICATION# substitution string then the text entered here displays on each page. For example, suppose you entered the message "Team picnic this Friday" in this attribute. Assuming your page templates support the global notification substitution string then this message would display on each page.
To create a global notification:
1. Include the #GLOBAL_NOTIFICATION# substitution string in your page template.
2. Navigate to the Edit Application page and enter a message in the Global Notifications attribute.
3. Click Apply Changes.So let's see what we get if we put our message here:
<div class="u-info padding-md"> <span class="fa fa-info-circle"></span> The system will be down for essential maintenance over the weekend. </div>That looks like this:
- I need to remember that HTML mark-up each time I want to set up a global notification, or remove one.
- I need to amend the application to do it, rather than change some data outside the application.
select id, text , case state when 'info' then 'fa-info-circle' when 'danger' then 'fa-hand-stop-o' when 'warning' then 'fa-warning' when 'success' then 'fa-check-circle' end as iconclass , 'u-' || state as divclass from notices where sysdate between nvl(from_datetime,sysdate) and nvl(to_datetime,sysdate) and id not in (select column_value from apex_string.split(:APP_NOTICES_CLOSED)) order by case state when 'danger' then 1 when 'warning' then 2 end, state
The report SQL derives the icon type and the class to style the message based on the state. An enhancement would be to put these in a table of notification state attributes and look them up. The report region is defined on page 0 so that notifications appear on all pages, in the Before Content Body position. The region template is Blank with Attributes. I have created a bespoke report (row) template - I could have used the Universal Theme's "Alert" report template, but it isn't quite what I want. The template HTML is:
<div class="#DIVCLASS# padding-md"> <span class="fa #ICONCLASS#"></span> #TEXT# <a href="#" id="closeNotice-#ID#" class="closeNotice" title="Hide this notice"> <span class="fa fa-times-circle-o u-pullRight #DIVCLASS#"></span> </a> </div>
OK, let's set up a few notices and see what we get...
and id not in (select column_value from apex_string.split(:APP_NOTICES_CLOSED))We need to create an application item called APP_NOTICES_CLOSED. This will be a list of the notice IDs that the user has dismissed. Then we need the logic to maintain this item - a dynamic action defined on page 0 as follows:
$s ('P0_CLOSE_NOTICE_ID', $(this.triggeringElement).attr('id').substr(12));(So we also need a hidden page 0 item called P0_CLOSE_NOTICE_ID)
declare l_count integer; l_tab apex_t_varchar2; begin select count(*) into l_count from apex_string.split(:APP_NOTICES_CLOSED) where column_value = :P0_CLOSE_NOTICE_ID; if l_count = 0 then l_tab := apex_string.split(:APP_NOTICES_CLOSED); l_tab.extend; l_tab(l_tab.count) := :P0_CLOSE_NOTICE_ID; :APP_NOTICES_CLOSED := apex_string.join(l_tab); end if; end;
So there it is - a fairly quick and dirty global notification mechanism with scope for various enhancements.