提交 ade96afd 编写于 作者: 蔡祥熠

Merge branch 'hotfix/form_actionbar_icon' into 'master'

Merge of hotfix/form_actionbar_icon 修复表单操作条,系统操作选择图标无效的问题 to master

See merge request o2oa/o2oa!1084
......@@ -274,12 +274,36 @@ MWF.xApplication.cms.FormDesigner.Module.Actionbar = MWF.CMSFCActionbar = new Cl
}
}.bind(this));
},
getImagePath: function(img, iscustom){
if( iscustom ){
var style;
if( this.json.customIconStyle ){
style = this.json.customIconStyle;
}else{
style = (this.json.style || "default").indexOf("red") > -1 ? "red" : "blue";
}
return this.path+""+this.options.style +"/custom/"+ style +"/"+ img;
}else{
return this.path+""+this.options.style +"/tools/"+ (this.json.style || "default") +"/"+img;
}
},
getImageOverPath: function(img_over, img, iscustom){
if( iscustom ){
var style_over = this.json.customIconOverStyle || "white";
return this.path+""+this.options.style+"/custom/"+ style_over +"/"+img;
}else{
return this.path+""+this.options.style+"/tools/"+ (this.json.style || "default") +"/"+ img_over;
}
},
setToolbars: function(tools, node){
tools.each(function(tool){
var actionNode = new Element("div", {
"MWFnodetype": tool.type,
"MWFButtonImage": this.path+""+this.options.style +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
"MWFButtonImageOver": this.path+""+this.options.style+"/tools/"+ (this.json.style || "default") +"/"+tool.img_over,
//"MWFButtonImage": this.path+""+this.options.style +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
//"MWFButtonImageOver": this.path+""+this.options.style+"/tools/"+ (this.json.style || "default") +"/"+tool.img_over,
"MWFButtonImage": this.getImagePath(tool.img, tool.customImg),
"MWFButtonImageOver": this.getImageOverPath(tool.img_over, tool.img, tool.customImg),
"title": tool.title,
"MWFButtonAction": tool.action,
"MWFButtonText": tool.text
......
......@@ -244,6 +244,7 @@ MWF.xApplication.cms.FormDesigner.widget.ActionsEditor.ButtonAction = new Class(
var item = this.iconMenu.addMenuItem("", "click", function(ev){
var src = this.item.getElement("img").get("src");
_self.data.img = src.substr(src.lastIndexOf("/")+1, src.length);
_self.data.customImg = true;
_self.iconNode.setStyle("background-image", "url("+src+")");
_self.editor.fireEvent("change");
ev.stopPropagation();
......@@ -256,6 +257,7 @@ MWF.xApplication.cms.FormDesigner.widget.ActionsEditor.ButtonAction = new Class(
var item = this.iconMenu.addMenuItem("", "click", function(ev){
var src = this.item.getElement("img").get("src");
_self.data.img = src.substr(src.lastIndexOf("/")+1, src.length);
_self.data.customImg = true;
_self.iconNode.setStyle("background-image", "url("+src+")");
_self.editor.fireEvent("change");
ev.stopPropagation();
......
......@@ -135,6 +135,29 @@ MWF.xApplication.cms.Xform.Actionbar = MWF.CMSActionbar = new Class({
}
}.bind(this));
},
getImagePath: function(img, iscustom){
var path = "../x_component_cms_FormDesigner/Module/Actionbar/";
if( iscustom ){
var style;
if( this.json.customIconStyle ){
style = this.json.customIconStyle;
}else{
style = (this.json.style || "default").indexOf("red") > -1 ? "red" : "blue";
}
return path+""+this.form.options.style+"/custom/"+ style + "/" +img;
}else{
return path+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+img
}
},
getImageOverPath: function(img_over, img, iscustom){
var path = "../x_component_cms_FormDesigner/Module/Actionbar/";
if( iscustom ){
var style_over = this.json.customIconOverStyle || "white";
return path+""+this.form.options.style+"/custom/" + style_over + "/"+ img;
}else{
return path+(this.options.style||"default")+"/tools/"+ (this.json.style || "default") +"/"+img_over;
}
},
setToolbars: function(tools, node, readonly, noCondition){
tools.each(function(tool){
var flag = true;
......@@ -162,8 +185,10 @@ MWF.xApplication.cms.Xform.Actionbar = MWF.CMSActionbar = new Class({
var actionNode = new Element("div", {
"id": tool.id,
"MWFnodetype": tool.type,
"MWFButtonImage": "../x_component_cms_FormDesigner/Module/Actionbar/"+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
"MWFButtonImageOver": "../x_component_cms_FormDesigner/Module/Actionbar/"+(this.options.style||"default")+"/tools/"+ (this.json.style || "default") +"/"+tool.img_over,
//"MWFButtonImage": "../x_component_cms_FormDesigner/Module/Actionbar/"+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
//"MWFButtonImageOver": "../x_component_cms_FormDesigner/Module/Actionbar/"+(this.options.style||"default")+"/tools/"+ (this.json.style || "default") +"/"+tool.img_over,
"MWFButtonImage": this.getImagePath(tool.img, tool.customImg),
"MWFButtonImageOver": this.getImageOverPath(tool.img_over, tool.img, tool.customImg),
"title": tool.title,
"MWFButtonAction": tool.action,
"MWFButtonText": tool.text
......
......@@ -247,17 +247,32 @@ MWF.xApplication.process.FormDesigner.Module.Actionbar = MWF.FCActionbar = new C
}
}.bind(this));
},
getImagePath: function(img, iscustom){
if( iscustom ){
var path = this.json.customIconStyle ? (this.json.customIconStyle+ "/") : "";
return this.path+""+this.options.style +"/custom/"+path+img
}else{
return this.path+""+this.options.style+"/tools/"+(this.json.style || "default")+"/"+img;
}
},
getImageOverPath: function(img, iscustom){
if( iscustom && this.json.customIconOverStyle ){
return this.path+""+this.options.style +"/custom/"+this.json.customIconOverStyle+ "/" +img;
}else{
return this.path+""+this.options.style+"/tools/"+this.json.iconOverStyle+"/"+img;
}
},
setToolbars: function(tools, node){
tools.each(function(tool){
var actionNode = new Element("div", {
"MWFnodetype": tool.type,
"MWFButtonImage": this.path+""+this.options.style+"/tools/"+(this.json.style || "default")+"/"+tool.img,
"MWFButtonImage": this.getImagePath(tool.img, tool.customImg),
"title": tool.title,
"MWFButtonAction": tool.action,
"MWFButtonText": tool.text
}).inject(node);
if( this.json.iconOverStyle ){
actionNode.set("MWFButtonImageOver" , this.path+""+this.options.style+"/tools/"+this.json.iconOverStyle+"/"+tool.img );
actionNode.set("MWFButtonImageOver" , this.getImageOverPath(tool.img, tool.customImg) );
}
actionNode.isSystemTool = true;
this.systemTools.push(actionNode);
......
......@@ -363,6 +363,7 @@ MWF.xApplication.process.FormDesigner.widget.ActionsEditor.ButtonAction = new Cl
var item = this.iconMenu.addMenuItem("", "click", function(ev){
var src = this.item.getElement("img").get("src");
_self.data.img = src.substr(src.lastIndexOf("/")+1, src.length);
_self.data.customImg = true;
_self.iconNode.setStyle("background-image", "url("+src+")");
_self.editor.fireEvent("change");
ev.stopPropagation();
......
......@@ -201,6 +201,23 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class(
}.bind(this));
},
getImagePath: function(img, iscustom){
var path = "../x_component_process_FormDesigner/Module/Actionbar/";
if( iscustom ){
var iconPath = this.json.customIconStyle ? (this.json.customIconStyle+ "/") : "";
return path+""+this.form.options.style+"/custom/"+iconPath+img;
}else{
return path+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+img;
}
},
getImageOverPath: function(img, iscustom){
var path = "../x_component_process_FormDesigner/Module/Actionbar/";
if( iscustom && this.json.customIconOverStyle ){
return path+""+this.form.options.style +"/custom/"+this.json.customIconOverStyle+ "/" +img
}else{
return path+""+(this.options.style||"default")+"/tools/"+( this.json.iconOverStyle || "default" )+"/"+img;
}
},
setToolbarItem: function(tool, node, readonly, noCondition){
var path = "../x_component_process_FormDesigner/Module/Actionbar/";
var flag = true;
......@@ -235,13 +252,13 @@ MWF.xApplication.process.Xform.Actionbar = MWF.APPActionbar = new Class(
"id": tool.id,
"MWFnodetype": tool.type,
//"MWFButtonImage": this.form.path+""+this.form.options.style+"/actionbar/"+tool.img,
"MWFButtonImage": path+(this.options.style||"default") +"/tools/"+ (this.json.style || "default") +"/"+tool.img,
"MWFButtonImage": this.getImagePath(tool.img, tool.customImg),
"title": tool.title,
"MWFButtonAction": tool.action,
"MWFButtonText": tool.text
}).inject(node);
if( this.json.iconOverStyle ){
actionNode.set("MWFButtonImageOver" , path+""+(this.options.style||"default")+"/tools/"+( this.json.iconOverStyle || "default" )+"/"+tool.img );
actionNode.set("MWFButtonImageOver" , this.getImageOverPath(tool.img, tool.customImg) );
}
if( tool.properties ){
actionNode.set(tool.properties);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册