silverstripe-reports/javascript/ImageEditor/ImageEditor.js
Ingo Schommer 1fe66c0bf4 mujma: Added comments for ImageEditor?.php, fixed JSON bug, added status message after saving, added tmp folder delete after editing.
(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41882 467b73ca-7a2a-4603-9d3b-597d59a354a9
2007-09-15 01:13:18 +00:00

44 lines
1.6 KiB
JavaScript

/**
* @author Mateusz
*/
Scriptaculous.require('cms/javascript/ImageEditor/Utils.js');
Scriptaculous.require('cms/javascript/ImageEditor/ImageHistory.js');
Scriptaculous.require('cms/javascript/ImageEditor/Image.js"');
Scriptaculous.require('cms/javascript/ImageEditor/ImageTransformation.js');
Scriptaculous.require('cms/javascript/ImageEditor/Resizeable.js');
Scriptaculous.require('cms/javascript/ImageEditor/Effects.js');
Scriptaculous.require('cms/javascript/ImageEditor/Environment.js');
Scriptaculous.require('cms/javascript/ImageEditor/Crop.js');
Scriptaculous.require('cms/javascript/ImageEditor/Resize.js');
Scriptaculous.require('cms/javascript/ImageEditor/ImageBox.js');
var ImageEditor = {
initialize: function(imageFile) {
imageHistory = new ImageHistory.initialize();
environment = new Environment.initialize(imageFile);
imageTransformation = new ImageTransformation.initialize();
resize = new Resize.initialize($('imageContainer'));
effects = new Effects.initialize();
crop = new Crop.initialize();
this.originalImageFile = imageFile;
this.tottalyOriginalImageFile = imageFile;
this.onSave = ImageEditor.onSave.bind(this);
this.onClose = ImageEditor.onClose.bind(this);
Event.observe($('saveButton'),'click',this.onSave);
Event.observe($('closeButton'),'click',this.onClose);
},
onSave: function() {
if(this.tottalyOriginalImageFile != $('image').src) {
imageTransformation.save(this.tottalyOriginalImageFile,$('image').src);
} else {
this.onClose();
}
},
onClose: function() {
window.parent.frames[1].location.reload(1);
Element.hide(window.frameElement);
imageTransformation.close();
}
}