mujma: ENHANCEMENT: Swaped alert() during crop to statusMessage().

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42050 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 02:25:07 +00:00
parent 4fd3e3510a
commit 29cf057e97
4 changed files with 12 additions and 9 deletions

View File

@ -116,7 +116,7 @@ var Crop = {
imageTransformation.crop(startTop,startLeft,newWidth,newHeight,Crop.cropCallback.bind(this)); imageTransformation.crop(startTop,startLeft,newWidth,newHeight,Crop.cropCallback.bind(this));
this.disable(); this.disable();
} else { } else {
alert('Crop area too small'); statusMessageWrapper.statusMessage("Crop area too small","bad");
return false; return false;
} }
$('image').style.visibility = 'visible';//hack for IE for not selecting image during crop $('image').style.visibility = 'visible';//hack for IE for not selecting image during crop

View File

@ -25,7 +25,6 @@ ImageHistory = {
this.disable = ImageHistory.disable.bind(this); this.disable = ImageHistory.disable.bind(this);
this.clear = ImageHistory.clear.bind(this); this.clear = ImageHistory.clear.bind(this);
this.addListeners(); this.addListeners();
statusMessage = new StatusMessage.initialize();
}, },
undo: function() { undo: function() {
@ -39,7 +38,7 @@ ImageHistory = {
this.historyPointer = this.historyPointer - 1; this.historyPointer = this.historyPointer - 1;
this.image.src = this.history[this.historyPointer].fileUrl; this.image.src = this.history[this.historyPointer].fileUrl;
} else { } else {
statusMessage.statusMessage("No more undo","bad"); statusMessageWrapper.statusMessage("No more undo","bad");
} }
}, },
@ -51,7 +50,7 @@ ImageHistory = {
this.historyPointer = this.historyPointer + 1; this.historyPointer = this.historyPointer + 1;
this.image.src = this.history[this.historyPointer].fileUrl; this.image.src = this.history[this.historyPointer].fileUrl;
} else { } else {
statusMessage.statusMessage("No more redo","bad"); statusMessageWrapper.statusMessage("No more redo","bad");
} }
}, },

View File

@ -87,16 +87,18 @@ Random = {
StatusMessage = { StatusMessage = {
initialize: function() { initialize: function() {
this.statusMessage = StatusMessage.statusMessage.bind(this); this.statusMessage = StatusMessage.statusMessage.bind(this);
window.frameElement.statusMessage = statusMessage; window.frameElement.statusMessage = window.top.statusMessage;
var s1 = $('statusMessage'); var s1 = $('statusMessage');
var s2 = window.top.document.getElementById('statusMessage'); var s2 = window.top.document.getElementById('statusMessage');
s1.showMessage = s2.showMessage; s1.showMessage = s2.showMessage;
s1.clearMessage = s2.clearMessage; s1.clearMessage = s2.clearMessage;
s1.fade = s2.fade; s1.fade = s2.fade;
s1.afterFade = s2.afterFade; s1.afterFade = s2.afterFade;
this.statusMessageContainer = s1;
}, },
statusMessage: function(msg, type, clearManually) { statusMessage: function(msg, type, clearManually) {
window.frameElement.statusMessage(msg, type, clearManually); window.frameElement.statusMessage(msg, type, clearManually,this.statusMessageContainer);
} }
} }
Event.observe(window,'load',function(e) {statusMessageWrapper = new StatusMessage.initialize();});

View File

@ -409,9 +409,11 @@ Behaviour.register({
* @param msg String * @param msg String
* @param type String (optional) can be 'good' or 'bad' * @param type String (optional) can be 'good' or 'bad'
* @param clearManually boolean Don't automatically fade message. * @param clearManually boolean Don't automatically fade message.
* @param container custom #statusMessage element to show message.
*/ */
function statusMessage(msg, type, clearManually) { function statusMessage(msg, type, clearManually, container) {
var statusMessageEl = $('statusMessage'); var statusMessageEl = $('statusMessage');
if(container != null) statusMessageEl = container;
if(statusMessageEl) { if(statusMessageEl) {
if(msg) { if(msg) {
statusMessageEl.showMessage(msg, type, msg.length / 20, clearManually); statusMessageEl.showMessage(msg, type, msg.length / 20, clearManually);