Просмотр исходного кода

允许操作条系统操作和自定义操作可以混合排序

unknown 5 лет назад
Родитель
Сommit
52371eabc1

+ 1 - 1
o2web/source/x_component_cms_FormDesigner/Module/Actionbar.js

@@ -267,7 +267,7 @@ MWF.xApplication.cms.FormDesigner.Module.Actionbar = MWF.CMSFCActionbar = new Cl
 				});
 			}
 		}
-		if (name=="defaultTools" || name=="tools" || name==="actionStyles"){
+		if (name=="defaultTools" || name=="tools" || name=="multiTools" || name==="actionStyles"){
 			this._refreshActionbar();
 		}
 	}

+ 20 - 7
o2web/source/x_component_query_Query/Viewer.js

@@ -2459,20 +2459,33 @@ MWF.xApplication.query.Query.Viewer.Actionbar = new Class({
             if (this.json.actionStyles) this.toolbarWidget.css = this.json.actionStyles;
             //alert(this.readonly)
 
-            if (this.json.hideSystemTools){
-                this.setCustomToolbars(this.json.tools, this.toolbarNode);
+            if( this.json.multiTools ){
+                this.json.multiTools.each( function (tool) {
+                    if( tool.system ){
+                        if( !this.json.hideSystemTools ){
+                            this.setToolbars([tool], this.toolbarNode, this.readonly);
+                        }
+                    }else{
+                        this.setCustomToolbars([tool], this.toolbarNode);
+                    }
+                }.bind(this));
                 this.toolbarWidget.load();
             }else{
-                if (this.json.defaultTools){
-                    this.setToolbars(this.json.defaultTools, this.toolbarNode, this.readonly);
+                if (this.json.hideSystemTools){
                     this.setCustomToolbars(this.json.tools, this.toolbarNode);
                     this.toolbarWidget.load();
                 }else{
-                    MWF.getJSON(this.form.path+"toolbars.json", function(json){
-                        this.setToolbars(json, this.toolbarNode, this.readonly, true);
+                    if (this.json.defaultTools){
+                        this.setToolbars(this.json.defaultTools, this.toolbarNode, this.readonly);
                         this.setCustomToolbars(this.json.tools, this.toolbarNode);
                         this.toolbarWidget.load();
-                    }.bind(this), null);
+                    }else{
+                        MWF.getJSON(this.form.path+"toolbars.json", function(json){
+                            this.setToolbars(json, this.toolbarNode, this.readonly, true);
+                            this.setCustomToolbars(this.json.tools, this.toolbarNode);
+                            this.toolbarWidget.load();
+                        }.bind(this), null);
+                    }
                 }
             }
 

+ 2 - 1
o2web/source/x_component_query_StatementDesigner/$Statement/actionbar.html

@@ -25,7 +25,8 @@
 	</div>
     <div title="操作"  class="MWFTab" style="overflow: hidden">
 <!--		<div class="MWFDefaultActionArea" name="defaultTools"></div>-->
-        <div class="MWFActionArea" name="tools"></div>
+<!--        <div class="MWFActionArea" name="tools"></div>-->
+		<div class="MWFMultiActionArea" name="multiTools"></div>
     </div>
     <div title="样式"  class="MWFTab">
         <div class="MWFActionStylesArea" name="actionStyles"></div>

+ 93 - 0
o2web/source/x_component_query_StatementDesigner/Property.js

@@ -75,5 +75,98 @@ MWF.xApplication.query.StatementDesigner.Property = MWF.SDProperty = new Class({
                 });
             }.bind(this));
         }.bind(this));
+    },
+    loadActionArea: function () {
+        debugger;
+        MWF.xApplication.process = MWF.xApplication.process || {};
+        MWF.APPFD = MWF.xApplication.process.FormDesigner = MWF.xApplication.process.FormDesigner || {};
+        MWF.xDesktop.requireApp("process.FormDesigner", "lp." + o2.language, null, false);
+
+        var multiActionArea = this.propertyContent.getElements(".MWFMultiActionArea");
+        multiActionArea.each(function(node){
+            debugger;
+            var name = node.get("name");
+            var actionContent = this.data[name];
+            MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function(){
+                var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
+                    "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
+                    "systemToolsAddress": "../x_component_query_StatementDesigner/$Statement/toolbars.json",
+                    "isSystemTool" : false,
+                    "noEditShow": true,
+                    "noReadShow": true,
+                    "onChange": function(){
+                        this.data[name] = actionEditor.data;
+                        this.changeData(name);
+                    }.bind(this)
+                });
+                actionEditor.load(actionContent);
+            }.bind(this));
+        }.bind(this));
+
+        var actionAreas = this.propertyContent.getElements(".MWFActionArea");
+        actionAreas.each(function (node) {
+            var name = node.get("name");
+            var actionContent = this.data[name];
+            MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function () {
+
+                // debugger;
+                // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
+                //     "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
+                //     "noCreate": true,
+                //     "noDelete": true,
+                //     "noCode": true,
+                //     "onChange": function(){
+                //         this.data[name] = actionEditor.data;
+                //     }.bind(this)
+                // });
+                // actionEditor.load(this.module.defaultToolBarsData);
+
+                var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
+                    "maxObj": this.propertyNode.parentElement.parentElement,
+                    "noEditShow": true,
+                    "noReadShow": true,
+                    "onChange": function () {
+                        this.data[name] = actionEditor.data;
+                        this.changeData(name);
+                    }.bind(this)
+                });
+                actionEditor.load(actionContent);
+            }.bind(this));
+
+        }.bind(this));
+
+        var actionAreas = this.propertyContent.getElements(".MWFDefaultActionArea");
+        actionAreas.each(function (node) {
+            var name = node.get("name");
+            var actionContent = this.data[name] || this.module.defaultToolBarsData;
+            MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function () {
+
+                var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
+                    "maxObj": this.propertyNode.parentElement.parentElement,
+                    "isSystemTool": true,
+                    "systemToolsAddress": "../x_component_query_StatementDesigner/$Statement/toolbars.json",
+                    "noCreate": true,
+                    "noDelete": false,
+                    "noCode": true,
+                    "noReadShow": true,
+                    "noEditShow": true,
+                    "onChange": function () {
+                        this.data[name] = actionEditor.data;
+                        this.changeData(name);
+                    }.bind(this)
+                });
+                actionEditor.load(actionContent);
+
+                // var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, {
+                //     "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
+                //     "onChange": function(){
+                //         this.data[name] = actionEditor.data;
+                //     }.bind(this)
+                // });
+                // actionEditor.load(actionContent);
+            }.bind(this));
+
+        }.bind(this));
+
     }
 });

+ 13 - 0
o2web/source/x_component_query_StatementDesigner/Statement.js

@@ -1828,6 +1828,19 @@ MWF.xApplication.query.StatementDesigner.View.Actionbar = new Class({
         //this._hideActions();
         this.hideProperty();
     },
+    showProperty: function(){
+        if (!this.property){
+            this.property = new MWF.xApplication.query.StatementDesigner.Property(this, this.view.designer.propertyContentArea, this.view.designer, {
+                "path": this.propertyPath,
+                "onPostLoad": function(){
+                    this.property.show();
+                }.bind(this)
+            });
+            this.property.load();
+        }else{
+            this.property.show();
+        }
+    }
 });
 
 MWF.xApplication.query.StatementDesigner.View.Paging = new Class({

+ 3 - 2
o2web/source/x_component_query_ViewDesigner/$View/actionbar.html

@@ -24,8 +24,9 @@
 		</table>
 	</div>
     <div title="操作"  class="MWFTab" style="overflow: hidden">
-		<div class="MWFDefaultActionArea" name="defaultTools"></div>
-        <div class="MWFActionArea" name="tools"></div>
+<!--		<div class="MWFDefaultActionArea" name="defaultTools"></div>-->
+<!--        <div class="MWFActionArea" name="tools"></div>-->
+		<div class="MWFMultiActionArea" name="multiTools"></div>
     </div>
     <div title="样式"  class="MWFTab">
         <div class="MWFActionStylesArea" name="actionStyles"></div>

+ 3 - 0
o2web/source/x_component_query_ViewDesigner/Property.js

@@ -941,7 +941,10 @@ MWF.xApplication.query.ViewDesigner.Property = MWF.FVProperty = new Class({
             MWF.xDesktop.requireApp("process.FormDesigner", "widget.ActionsEditor", function(){
                 var actionEditor = new MWF.xApplication.process.FormDesigner.widget.ActionsEditor(node, this.designer, this.data, {
                     "maxObj": this.propertyNode.parentElement.parentElement.parentElement,
+                    "systemToolsAddress": "../x_component_query_ViewDesigner/$View/toolbars.json",
                     "isSystemTool" : true,
+                    "noEditShow": true,
+                    "noReadShow": true,
                     "onChange": function(){
                         this.data[name] = actionEditor.data;
                         this.changeData(name);

+ 94 - 71
o2web/source/x_component_query_ViewDesigner/View.js

@@ -1883,36 +1883,28 @@ MWF.xApplication.query.ViewDesigner.View.Actionbar = new Class({
             this.toolbarWidget.css = Object.clone(this.json.actionStyles);
         }
 
-        //MWF.getJSON(this.path+"toolbars.json", function(json){
-        //    this.json.defaultTools = json;
-        //    this.setToolbars(json, this.toolbarNode);
-        //    debugger;
-        //    this.toolbarWidget.load();
-        //}.bind(this), false);
-        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();
-            this._setEditStyle_custom("hideSystemTools");
-            //json = null;
-        }else{
-            MWF.getJSON( this.getJsonPath(), 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();
-                this._setEditStyle_custom("hideSystemTools");
-                //json = null;
-            }.bind(this), false);
-        }
+        this.loadMultiToolbar();
+
+        // if (this.json.defaultTools){
+        //     var json = Array.clone(this.json.defaultTools);
+        //     this.setToolbars(json, this.toolbarNode);
+        //     if (this.json.tools){
+        //         this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+        //     }
+        //     this.toolbarWidget.load();
+        //     this._setEditStyle_custom("hideSystemTools");
+        // }else{
+        //     MWF.getJSON( this.getJsonPath(), function(json){
+        //         this.json.defaultTools = json;
+        //         var json = Array.clone(this.json.defaultTools);
+        //         this.setToolbars(json, this.toolbarNode);
+        //         if (this.json.tools){
+        //             this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+        //         }
+        //         this.toolbarWidget.load();
+        //         this._setEditStyle_custom("hideSystemTools");
+        //     }.bind(this), false);
+        // }
     },
 
     _refreshActionbar: function(){
@@ -1926,28 +1918,26 @@ MWF.xApplication.query.ViewDesigner.View.Actionbar = new Class({
             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);
-                //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.getJsonPath(), 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);
-            }
+            this.loadMultiToolbar();
+
+            // if (this.json.defaultTools){
+            //     var json = Array.clone(this.json.defaultTools);
+            //     this.setToolbars(json, this.toolbarNode);
+            //     if (this.json.tools){
+            //         this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+            //     }
+            //     this.toolbarWidget.load();
+            // }else{
+            //     MWF.getJSON( this.getJsonPath(), function(json){
+            //         this.json.defaultTools = json;
+            //         var json = Array.clone(this.json.defaultTools);
+            //         this.setToolbars(json, this.toolbarNode);
+            //         if (this.json.tools){
+            //             this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+            //         }
+            //         this.toolbarWidget.load();
+            //     }.bind(this), false);
+            // }
         //}
 
     },
@@ -1966,29 +1956,62 @@ MWF.xApplication.query.ViewDesigner.View.Actionbar = new Class({
                 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);
+            this.loadMultiToolbar();
+
+            // if (this.json.defaultTools){
+            //     var json = Array.clone(this.json.defaultTools);
+            //     this.setToolbars(json, this.toolbarNode);
+            //     if (this.json.tools){
+            //         this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+            //     }
+            //     this.toolbarWidget.load();
+            // }else{
+            //     MWF.getJSON(this.path+"toolbars.json", function(json){
+            //         this.json.defaultTools = json;
+            //         var json = Array.clone(this.json.defaultTools);
+            //         this.setToolbars(json, this.toolbarNode);
+            //         if (this.json.tools){
+            //             this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+            //         }
+            //         this.toolbarWidget.load();
+            //     }.bind(this), false);
+            // }
+        //}
+    },
+    loadMultiToolbar : function(){
+        if( this.json.multiTools ){
+            var json = Array.clone(this.json.multiTools);
+            this.setMultiToolbars(json, this.toolbarNode);
+            this.toolbarWidget.load();
+            this._setEditStyle_custom("hideSystemTools");
+        }else if( this.json.defaultTools ){
+            this.json.multiTools = this.json.defaultTools.map( function (d) { d.system = true; return d; });
+            if (this.json.tools){
+                this.json.multiTools = this.json.multiTools.concat( this.json.tools )
+            }
+            this.setMultiToolbars( Array.clone(this.json.multiTools), this.toolbarNode);
+            this.toolbarWidget.load();
+            this._setEditStyle_custom("hideSystemTools");
+        }else{
+            MWF.getJSON(this.path+"toolbars.json", function(json){
+                this.json.multiTools = json.map( function (d) { d.system = true; return d; });
                 if (this.json.tools){
-                    this.setCustomToolbars(Array.clone(this.json.tools), this.toolbarNode);
+                    this.json.multiTools = this.json.multiTools.concat( this.json.tools )
                 }
+                this.setMultiToolbars(Array.clone(this.json.multiTools), this.toolbarNode);
                 this.toolbarWidget.load();
-                //json = null;
+                this._setEditStyle_custom("hideSystemTools");
+            }.bind(this), false);
+        }
+    },
+    setMultiToolbars: function(tools, node){
+        tools.each(function(tool){
+            if( tool.system ){
+                this.setToolbars( [tool], node );
             }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);
+                this.setCustomToolbars( [tool], node );
             }
-        //}
+        }.bind(this));
     },
     setToolbars: function(tools, node){
         tools.each(function(tool){
@@ -2046,7 +2069,7 @@ MWF.xApplication.query.ViewDesigner.View.Actionbar = new Class({
                 });
             }
         }
-        if (name=="defaultTools" || name=="tools" || name==="actionStyles"){
+        if (name=="defaultTools" || name=="tools" || name=="multiTools" || name==="actionStyles"){
             this._refreshActionbar();
         }