silverstripe-cms/javascript/ImageEditor/ImageEditor.js
Andrew O'Neil b0d78ea5bd mujma: BUGFIX: All global variables added to ImageEditor namespace, solved issue reported in ticket 102, http://support.silverstripe.com/gsoc/ticket/102 (merged from gsoc branch, r42789)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42989 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-10-02 23:26:35 +00:00

44 lines
1.5 KiB
JavaScript

/**
* @author Mateusz
*/
ImageEditor.Main = {
initialize: function(imageFile) {
imageFile += '1234';
ImageEditor.crop = null;
ImageEditor.imageHistory = new ImageEditor.ImageHistory.initialize();
ImageEditor.environment = new ImageEditor.Environment.initialize(imageFile);
ImageEditor.imageTransformation = new ImageEditor.ImageTransformation.initialize();
ImageEditor.resize = new ImageEditor.Resize.initialize($('imageContainer'));
ImageEditor.effects = new ImageEditor.Effects.initialize();
ImageEditor.crop = new ImageEditor.Crop.initialize();
ImageEditor.documentBody = new ImageEditor.DocumentBody.initialize();
this.originalImageFile = imageFile;
this.tottalyOriginalImageFile = imageFile;
this.onSaveClick = ImageEditor.Main.onSaveClick.bind(this);
this.onCloseClick = ImageEditor.Main.onCloseClick.bind(this);
Event.observe($('SaveButton'),'click',this.onSaveClick);
Event.observe($('ExitButton'),'click',this.onCloseClick);
Element.hide($('CurrentAction'));
},
onSaveClick: function() {
if(this.tottalyOriginalImageFile != $('image').src) {
ImageEditor.imageTransformation.save(this.tottalyOriginalImageFile,$('image').src,this.onCloseClick);
} else {
this.onCloseClick();
}
},
onCloseClick: function() {
window.parent.frames[0].location.reload(1);
window.parent.frames[1].location.reload(1);
ImageEditor.imageTransformation.close(ImageEditor.Main.onCloseCallback.bind(this));
},
onCloseCallback: function() {
Element.hide(window.frameElement);
}
}