Przeglądaj źródła

修复内容管理表单操作条不能设置样式的问题

unknown 5 lat temu
rodzic
commit
1b0c9c978a

+ 44 - 3
o2web/source/x_component_cms_FormDesigner/Module/Actionbar.js

@@ -36,7 +36,8 @@ MWF.xApplication.cms.FormDesigner.Module.Actionbar = MWF.CMSFCActionbar = new Cl
 		this.json.customIconOverStyle = "white";
 	},
 	setAllStyles: function(){
-		this._refreshActionbar();
+		//this._refreshActionbar();
+		this._resetActionbar();
 	},
 	_createNode: function(callback){
 		this.node = new Element("div", {
@@ -86,8 +87,8 @@ MWF.xApplication.cms.FormDesigner.Module.Actionbar = MWF.CMSFCActionbar = new Cl
 			this.toolbarNode = this.node.getFirst("div");
 			this.toolbarNode.empty();
 			this.toolbarWidget = new MWF.widget.SimpleToolbar(this.toolbarNode, {"style": this.json.style}, this);
-            //if (!this.json.actionStyles) this.json.actionStyles = Object.clone(this.toolbarWidget.css);
-            //this.toolbarWidget.css = this.json.actionStyles;
+            if (!this.json.actionStyles) this.json.actionStyles = Object.clone(this.toolbarWidget.css);
+            this.toolbarWidget.css = this.json.actionStyles;
 
 			if (this.json.defaultTools){
 				var json = Array.clone(this.json.defaultTools);
@@ -146,6 +147,46 @@ MWF.xApplication.cms.FormDesigner.Module.Actionbar = MWF.CMSFCActionbar = new Cl
 	//	}
     //
 	//},
+	_resetActionbar: function(){
+        if (this.form.options.mode == "Mobile"){
+            this.node.set("text", MWF.APPFD.LP.notice.notUseModuleInMobile+"("+this.moduleName+")");
+            this.node.setStyles({"height": "24px", "line-height": "24px", "background-color": "#999"});
+        }else{
+            this.toolbarNode = this.node.getFirst("div");
+            this.toolbarNode.empty();
+			this.toolbarWidget = new MWF.widget.SimpleToolbar(this.toolbarNode, {"style": this.json.style}, this);
+            // this.toolbarWidget = new MWF.widget.Toolbar(this.toolbarNode, {"style": this.json.style}, this);
+            if (!this.json.actionStyles){
+                this.json.actionStyles = Object.clone(this.toolbarWidget.css);
+            }else{
+                this.toolbarWidget.css = Object.merge( Object.clone(this.json.actionStyles), this.toolbarWidget.css );
+                this.json.actionStyles = Object.clone(this.toolbarWidget.css);
+            }
+
+            if (this.json.defaultTools){
+                var json = Array.clone(this.json.defaultTools);
+                //if (this.json.tools) json.append(this.json.tools);
+                this.setToolbars(json, this.toolbarNode);
+                if (this.json.tools){
+                    this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+                }
+                this.toolbarWidget.load();
+                //json = null;
+            }else{
+                MWF.getJSON(this.path+"toolbars.json", function(json){
+                    this.json.defaultTools = json;
+                    var json = Array.clone(this.json.defaultTools);
+                    //if (this.json.tools) json.append(this.json.tools);
+                    this.setToolbars(json, this.toolbarNode);
+                    if (this.json.tools){
+                        this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+                    }
+                    this.toolbarWidget.load();
+                    //json = null;
+                }.bind(this), false);
+            }
+        }
+    },
 	setToolbars: function(tools, node){
 		tools.each(function(tool){
 			var actionNode = new Element("div", {

+ 1 - 0
o2web/source/x_component_cms_Xform/Actionbar.js

@@ -21,6 +21,7 @@ MWF.xApplication.cms.Xform.Actionbar = MWF.CMSActionbar =  new Class({
                     this.fireEvent("afterLoad");
                 }.bind(this)
             }, this);
+            if (this.json.actionStyles) this.toolbarWidget.css = this.json.actionStyles;
 
             //var json = this.readonly ? this.json.sysTools.readTools : this.json.sysTools.editTools;
             //if( this.json.style == "xform_red_simple" ){