在表单的预加载脚本中重现附件图片预览方法
```
MWF.xApplication.process.Xform.AttachmenPreview.implement({
previewImage : function(){
var imgContainerNode = new Element("div").inject(document.body).hide();
this.app.attachmentController.attachments.each(function(att){
if(["png","jpg","bmp","jpeg","gif"].contains(att.data.extension)){
this.app.getAttachmentUrl(att, function (url) {
new Element("img",{"src":url,"alt":att.data.name}).inject(imgContainerNode);
}.bind(this));
}
}.bind(this));
o2.loadCss("../o2_lib/viewer/viewer.css", document.body,function(){
o2.load("../o2_lib/viewer/viewer.js", function(){
this.viewer = new Viewer(imgContainerNode,{
navbar : true,
toolbar : true,
hidden : function(){
imgContainerNode.destroy();
this.viewer.destroy();
}.bind(this)
});
this.viewer.show();
}.bind(this));
}.bind(this));
}
})
```
评论