diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php
index 001f5a6d..5d493686 100644
--- a/code/LeftAndMain.php
+++ b/code/LeftAndMain.php
@@ -213,6 +213,7 @@ class LeftAndMain extends Controller {
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-livequery/jquery.livequery.js');
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery-cookie/jquery.cookie.js');
+ Requirements::javascript(CMS_DIR . '/thirdparty/jquery-notice/jquery.notice.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/jquery-ondemand/jquery.ondemand.js');
Requirements::javascript(CMS_DIR . '/javascript/jquery-changetracker/lib/jquery.changetracker.js');
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
diff --git a/css/cms_right.css b/css/cms_right.css
index 60de737f..dac79155 100644
--- a/css/cms_right.css
+++ b/css/cms_right.css
@@ -333,37 +333,57 @@
font-style: italic;
}
+
/**
* Status Messages
*/
-#statusMessage {
+.notice-wrap {
position: absolute;
z-index: 500;
bottom: 4px;
left: 10px;
- text-align: left;
- padding: 2px 20px 2px 20px;
- font-size: 14px;
- font-weight: bold;
- color: #660;
+ z-index: 9999;
+ width: auto;
+}
+
+* html .notice-wrap {
+ position: absolute;
+}
+
+.notice-item {
+ display: block;
+ position: relative;
+ width: auto;
background: #f4f3eb;
border: 1px solid #a9a67d;
- margin: 0 !important;
+ margin-top: 6px;
+ padding: 2px 20px 2px 20px;
+ font-size: 14px;
+ font-weight: bold;
line-height: 1.5;
}
- #statusMessage.good {
- padding: 2px 20px 2px 40px;
+
+.notice-item-close {
+ position: absolute;
+ font-family: Arial;
+ font-size: 12px;
+ font-weight: bold;
+ right: 6px;
+ top: 6px;
+ cursor: pointer;
+}
+
+ .notice-wrap .good {
+ padding-left: 40px;
color: #060;
background: #E2F9E3 url(../images/alert-good.gif) 7px 50% no-repeat;
border: 1px solid #8dd38d;
}
- #statusMessage.bad {
- padding: 2px 20px 2px 40px;
- border-color: #ff8e8e;
+ .notice-wrap .bad {
+ padding-left: 40px;
color: #c80700;
background: #ffe9e9 url(../images/alert-bad.gif) 7px 50% no-repeat;
- max-height: 300px;
- overflow: auto;
+ border: 1px solid #ff8e8e;
}
/**
diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js
index f7644bb1..cd27cdce 100644
--- a/javascript/LeftAndMain.js
+++ b/javascript/LeftAndMain.js
@@ -38,7 +38,7 @@
this.find('.ss-tabset').bind('tabsshow', function() {self._resizeChildren();});
$('#Form_EditForm').bind('loadnewpage', function() {self._resizeChildren();});
-
+
this._super();
},
@@ -278,135 +278,12 @@
})(jQuery);
-
-
-
-
-
-
-
-
-
-
-
-
-
-// Event.observe(window, 'beforeunload', LeftAndMain_window_unload);
-
-/**
- * Unlock the locked status message.
- * Show a queued message, if one exists
- */
-function unlockStatusMessage() {
- statusMessage.locked = false;
- if(statusMessage.queued) {
- statusMessage(
- statusMessage.queued.msg,
- statusMessage.queued.type,
- statusMessage.queued.showNetworkActivity);
-
- statusMessage.queued = null;
- }
+// Backwards compatibility
+var statusMessage = function(text, type) {
+ jQuery.noticeAdd({text: text, type: type});
}
-
-/**
- * Behaviour of the statuts message.
- */
-Behaviour.register({
- '#statusMessage' : {
- showMessage : function(message, type, waitTime, clearManually) {
- if(this.fadeTimer) {
- clearTimeout(this.fadeTimer);
- this.fadeTimer = null;
- }
- if(this.currentEffect) {
- this.currentEffect.cancel();
- this.currentEffect = null;
- }
-
- this.innerHTML = message;
- this.className = type;
- Element.setOpacity(this, 1);
-
- //this.style.position = 'absolute';
- this.style.display = '';
- this.style.visibility = '';
-
- if(!clearManually) {
- this.fade(0.5,waitTime ? waitTime : 5);
- }
- },
- clearMessage : function(waitTime) {
- this.fade(0.5, waitTime);
- },
- fade: function(fadeTime, waitTime) {
- if(!fadeTime) fadeTime = 0.5;
-
- // Wait a bit before fading
- if(waitTime) {
- this.fadeTimer = setTimeout((function() {
- this.fade(fadeTime);
- }).bind(this), waitTime * 1000);
-
- // Fade straight away
- } else {
- this.currentEffect = new Effect.Opacity(this,
- { duration: 0.5,
- transition: Effect.Transitions.linear,
- from: 1.0, to: 0.0,
- afterFinish : this.afterFade.bind(this) });
- }
- },
- afterFade : function() {
- this.style.visibility = 'hidden';
- this.style.display = 'none';
- this.innerHTML = '';
- }
- }
-});
-
-/**
- * Show a status message.
- *
- * @param msg String
- * @param type String (optional) can be 'good' or 'bad'
- * @param clearManually boolean Don't automatically fade message.
- * @param container custom #statusMessage element to show message.
- */
-function statusMessage(msg, type, clearManually, container) {
- var statusMessageEl = $('statusMessage');
- if(container != null) statusMessageEl = container;
- if(statusMessageEl) {
- if(msg) {
- statusMessageEl.showMessage(msg, type, msg.length / 10, clearManually);
- } else {
- statusMessageEl.clearMessage();
- }
- }
-}
-
-function clearStatusMessage() {
- $('statusMessage').clearMessage();
-}
-
-/**
- * Called when something goes wrong
- */
-function errorMessage(msg, fullMessage) {
- // Show complex error for developers in the console
- if(fullMessage) {
- // Get the message from an Ajax response object
- try {
- if(typeof fullMessage == 'object') fullMessage = fullMessage.status + '//' + fullMessage.responseText;
- } catch(er) {
- fullMessage = "";
- }
- console.error(fullMessage);
- }
-
- msg = msg.replace(/\n/g,'
');
-
- $('statusMessage').showMessage(msg,'bad');
+var errorMessage = function(text) {
+ jQuery.noticeAdd({text: text, type: 'error'});
}
function ajaxErrorHandler(response) {
diff --git a/templates/Includes/CommentAdmin_right.ss b/templates/Includes/CommentAdmin_right.ss
index 8b345eb7..c81356bd 100644
--- a/templates/Includes/CommentAdmin_right.ss
+++ b/templates/Includes/CommentAdmin_right.ss
@@ -9,4 +9,4 @@
<% end_if %>
-
'+options.text+'
').animate(options.inEffect, options.inEffectDuration).wrap(noticeItemOuter); + noticeItemClose = jQuery('').addClass('notice-item-close').prependTo(noticeItemInner).html('x').click(function() { jQuery.noticeRemove(noticeItemInner) }); + + if(!options.stay) + { + setTimeout(function() + { + jQuery.noticeRemove(noticeItemInner); + }, + options.stayTime); + } + }, + + noticeRemove: function(obj) + { + obj.animate({opacity: '0'}, 600, function() + { + obj.parent().animate({height: '0px'}, 300, function() + { + obj.parent().remove(); + }); + }); + } + }); +})(jQuery); \ No newline at end of file