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));
this.disable();
} else {
alert('Crop area too small');
statusMessageWrapper.statusMessage("Crop area too small","bad");
return false;
}
$('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.clear = ImageHistory.clear.bind(this);
this.addListeners();
statusMessage = new StatusMessage.initialize();
},
undo: function() {
@ -39,7 +38,7 @@ ImageHistory = {
this.historyPointer = this.historyPointer - 1;
this.image.src = this.history[this.historyPointer].fileUrl;
} else {
statusMessage.statusMessage("No more undo","bad");
statusMessageWrapper.statusMessage("No more undo","bad");
}
},
@ -51,7 +50,7 @@ ImageHistory = {
this.historyPointer = this.historyPointer + 1;
this.image.src = this.history[this.historyPointer].fileUrl;
} else {
statusMessage.statusMessage("No more redo","bad");
statusMessageWrapper.statusMessage("No more redo","bad");
}
},

View File

@ -87,16 +87,18 @@ Random = {
StatusMessage = {
initialize: function() {
this.statusMessage = StatusMessage.statusMessage.bind(this);
window.frameElement.statusMessage = statusMessage;
window.frameElement.statusMessage = window.top.statusMessage;
var s1 = $('statusMessage');
var s2 = window.top.document.getElementById('statusMessage');
s1.showMessage = s2.showMessage;
s1.clearMessage = s2.clearMessage;
s1.fade = s2.fade;
s1.afterFade = s2.afterFade;
this.statusMessageContainer = s1;
},
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 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) {
function statusMessage(msg, type, clearManually, container) {
var statusMessageEl = $('statusMessage');
if(container != null) statusMessageEl = container;
if(statusMessageEl) {
if(msg) {
statusMessageEl.showMessage(msg, type, msg.length / 20, clearManually);