/** * Purpose: Provides JS routines to show system notifications in a status div that popups in the page. * It also provides a function for toggling the display of that function * * Libraries: Prototype and Script.aculo.us * * Copyright: Up and Running * Date: 10/28/2007 * Author: Pete Hanson * */ Ajax.Responders.register({ onCreate: function() { if($('ajaxworking') && Ajax.activeRequestCount > 0) { Effect.Appear('ajaxworking',{duration: 0.25, queue: 'end'}); } }, onComplete: function() { if($('ajaxworking') && Ajax.activeRequestCount == 0) { Effect.Fade('ajaxworking',{duration: 0.25, queue: 'end'}); } } }); function toggleNotifications() { var elem = $('status'); var linkElem = $('show_status_link'); if (elem.visible() == true) { Effect.Fade(elem,{duration: 0.25, queue: 'end'}); linkElem.update("Show Notifications"); } else { Effect.Appear(elem,{duration: 0.25, queue: 'end'}); linkElem.update("Hide Notifications"); } } function flashNotification() { Effect.Appear('status',{duration: .75, queue: 'end'}); Effect.Fade('status',{duration: 3.0, queue: 'end'}); } function showNotification(text) { $('status').innerHTML = text; flashNotification(); } function showErrorNotification(text) { text = "
" + text + "
"; showNotification(text); } function showSuccessNotification(text) { text = "
" + text + "
"; showNotification(text); }