mwf.xdesktop.requireapp("process.xform", "$module", null, false);
/** @class image 图片。
* @o2cn 图片
* @example
* //可以在脚本中获取该组件
* //方法1:
* var img = this.form.get("name"); //获取组件
* //方法2
* var img = this.target; //在组件事件脚本中获取
* @extends mwf.xapplication.process.xform.$module
* @o2category formcomponents
* @o2range {process|cms|portal}
* @hideconstructor
*/
mwf.xapplication.process.xform.image = mwf.appimage = new class(
{
extends: mwf.app$module,
_loaduserinterface: function(){
if (this.json.properties && this.json.properties["src"]){
var value = this.json.properties["src"];
if ((value.indexof("x_processplatform_assemble_surface")!=-1 || value.indexof("x_portal_assemble_surface")!=-1 || value.indexof("x_cms_assemble_control")!=-1)){
var host1 = mwf.actions.gethost("x_processplatform_assemble_surface");
var host2 = mwf.actions.gethost("x_portal_assemble_surface");
var host3 = mwf.actions.gethost("x_cms_assemble_control");
if (value.indexof("/x_processplatform_assemble_surface")!==-1){
value = value.replace("/x_processplatform_assemble_surface", host1 "/x_processplatform_assemble_surface");
}else if (value.indexof("x_processplatform_assemble_surface")!==-1){
value = value.replace("x_processplatform_assemble_surface", host1 "/x_processplatform_assemble_surface");
}
if (value.indexof("/x_portal_assemble_surface")!==-1){
value = value.replace("/x_portal_assemble_surface", host2 "/x_portal_assemble_surface");
}else if (value.indexof("x_portal_assemble_surface")!==-1){
value = value.replace("x_portal_assemble_surface", host2 "/x_portal_assemble_surface");
}
if (value.indexof("/x_cms_assemble_control")!==-1){
value = value.replace("/x_cms_assemble_control", host3 "/x_cms_assemble_control");
}else if (value.indexof("x_cms_assemble_control")!==-1){
value = value.replace("x_cms_assemble_control", host3 "/x_cms_assemble_control");
}
value = o2.filter;
}
try{
this.node.set("src", value);
}catch(e){}
}else if (this.json.srcfile && this.json.srcfile!="none"){
value = this.json.srcfile;
if (typeof(value)==="object"){
var url;
if(value.portal) {
url = mwf.xdesktop.getportalfileur(value.id, value.portal);
}else if(value.appid){
url = mwf.xdesktop.getcmsfileur(value.id, value.appid);
}else{
url = mwf.xdesktop.getprocessfileur(value.id, value.application);
}
url = o2.filter;
this.node.set("src", url);
}else{
var host = mwf.actions.gethost("x_portal_assemble_surface");
var action = mwf.actions.get("x_portal_assemble_surface");
var uri = action.action.actions.readfile.uri;
uri = uri.replace("{flag}", value);
uri = uri.replace("{applicationflag}", this.form.json.application);
value = host "/x_portal_assemble_surface" uri;
value = o2.filter;
this.node.set("src", value);
}
}else if (typeof(this.json.src)=="object"){
var src = mwf.xdesktop.getimagesrc( this.json.src.imageid );
this.node.set("src", src);
}
},
reset: function(){
this._loaduserinterface();
}
});
source