Mioplanet Documentation Center
Resources and Help
HomeProductsMioScriptJavaScriptTechNotesPHP
   Home | JavaScript | alertEngineEx.js SEARCH    

alertEngineEx.js

  Functions
alertEngine_init
alertEngine_popup_hide
alertEngine_processed

  Variables
alertEngine_default_textColor
alert_history_max
alert_toPopup_max

  Libraries
alertEngineEx.js
channels.js
gui.k
mioEngine.js
optionsMenu.js
popupAlert.kLIB
popupAlertEx.js
scrollingTicker.js
stats.js
window_resizable.k
xmlFeed.js
xmlSettings.js

  TechNotes
Adding a Login feature
Get the real size of a web page
How to create a Business Card
How to create a Desktop Alert
How to create a Desktop Ticker
How to create a Scrolling Alert Software
How to create a Scrolling Ticker
How to create a simple RSS Reader
How to debug
LCD Monitor Chart: Screen Resolution, Size, Pitch, Display Area
Managing read marks
Measuring Elements in JavaScript
Media center remote control
Statistics: How to track users and actions
XML Configuration File Format

Library
alertEngineEx.js

Language: JavaScript
Product: MioFactory


The purpose of this library is to create Desktop Alerts.

The library scans for updates in alerts feeds or RSS feeds and optionally displays popup alerts when new headlines are retrieved.

This library stores history files on the local computer in order to maintain a list of latest headlines.

A standard XML configuration file must be used.
For more information: xmlSettings.js

The library supports bandwidth optimization. A small XML file containing the update version of the alert XML file is downloaded. When the version number is increased, the alert XML file is downloaded to check for new headlines.

More information: XML Alerts Feeds


Scanning for Alerts

 
The library scans alerts and raises an event when a new alert is received.
To enable this feature, call alertEngine_init.
XML Alerts Feeds
 


Popup Alert window

 
The library can also be used with popupAlert.kLIB to automatically display the popup alert window.
To enable this feature:

Include the MioScript library popupAlert.kLIB in your project.

Call alertEngine_init from the main HTML document of your application;

The easier way to implement this feature is to create a new project using the template Desktop Alert.
 


Code Sample

 
The following code sample uses the library to scan alerts stored on an HTTP server, and displays a simple alert box to show the title, URL and publishing date. The automatic popup alert feature is not used.
 

ONLINE_ROOT = "http://www.mioplanet.com/"
CONFIG_FILE = "config.xml"

function loaded() {
    log_enabled = true;
    isDownloading = true;
    // Loads the application data as it contains the history of alerts.
    mio_data_load("data_load_completed()")
}

// Data loaded, starts downloading the XML configuration file
function data_load_completed() {
    no_cache_counter = mio_data_get("INTERNAL_COUNTER", 0)
    xml_settings_download(ONLINE_ROOT + CONFIG_FILE,
        "settings_downloaded");
}

function settings_downloaded(status) {
    isDownloading = false;
    if(status == 0) {
        sendToMio(
            "dialog=You are not connected."
            + "^^Close^^settings_downloaded_close_cb"
        );
    } else {
    if(!xml_settings_appUpdate()) { // No update required?
        alertEngine_init(false, "alert_received")
    }
}

function settings_downloaded_close_cb() {
    mio_close()
}

// Alert received, shows the title, URL and publication date.
function alert_received(alert_bag) {
    alert(alert_bag[B_TITLE]+" - "+alert_bag[B_URL]
        +" - "+alert_bag[B_DATE])
    alertEngine_processed()
}



Library alertEngineEx.js

Functions

alertEngine_init  |  alertEngine_popup_hide  |  alertEngine_processed

Variables

alertEngine_default_textColor  |  alert_history_max  |  alert_toPopup_max