فهرست منبع

修复新建栏目后的刷新

unknown 5 سال پیش
والد
کامیت
066e18b76f
1فایلهای تغییر یافته به همراه35 افزوده شده و 15 حذف شده
  1. 35 15
      o2web/source/x_component_cms_Column/Main.js

+ 35 - 15
o2web/source/x_component_cms_Column/Main.js

@@ -37,9 +37,14 @@ MWF.xApplication.cms.Column.Main = new Class({
             "styles": this.css.container
         }).inject(this.content);
     },
-    reload: function(){
-        this.columnContentAreaNode.empty();
-        this.createColumnNodes();
+    reload: function(appType, callback){
+        if( appType ){
+            this.reloadTop(appType, callback);
+        }else{
+            this.reloadTop();
+            this.columnContentAreaNode.empty();
+            this.createColumnNodes(callback);
+        }
     },
     loadApplicationContent: function () {
         //this.columnAreaNode = new Element("div", {
@@ -63,10 +68,19 @@ MWF.xApplication.cms.Column.Main = new Class({
             this.setContentSize();
         }.bind(this));
     },
-    loadTopNode: function(){
-        this.columnToolbarAreaNode = new Element("div.columnToolbarAreaNode", {
-            "styles": this.css.columnToolbarAreaNode
-        }).inject(this.node);
+    reloadTop : function( appType, callback ){
+        this.columnToolbarAreaNode.empty();
+        if( !appType )appType = this.currentAppType;
+        this.currentAppType = null;
+        this.currentAppTypeNode = null;
+        this.loadTopNode( appType, callback );
+    },
+    loadTopNode: function( appType, callback ){
+        if( !this.columnToolbarAreaNode ){
+            this.columnToolbarAreaNode = new Element("div.columnToolbarAreaNode", {
+                "styles": this.css.columnToolbarAreaNode
+            }).inject(this.node);
+        }
 
         this.columnAllTypeNode =  new Element("div.columnTop_All",{
             "styles" : this.css.columnTop_All,
@@ -106,7 +120,7 @@ MWF.xApplication.cms.Column.Main = new Class({
             "styles": this.css.columnTop_category
         }).inject(this.columnToolbarAreaNode);
 
-        this.loadAppType();
+        this.loadAppType( appType, callback );
 
 
         //this.columnToolbarTextNode = new Element("div.columnToolbarTextNode", {
@@ -114,11 +128,11 @@ MWF.xApplication.cms.Column.Main = new Class({
         //    "text": this.lp.column.title
         //}).inject(this.columnToolbarAreaNode);
     },
-    loadAppType : function(){
+    loadAppType : function( appType, callback ){
         var _self = this;
         this.restActions.listAllAppTypeByManager( function( json ){
             (json.data || []).each( function( typeObject ){
-                new Element( "div.columnTop_category", {
+                var cNode = new Element( "div.columnTop_category", {
                     "styles" : this.css.columnTop_categoryItem,
                     "text" : typeObject.appType + "(" + typeObject.count + ")",
                     "events" : {
@@ -133,6 +147,9 @@ MWF.xApplication.cms.Column.Main = new Class({
                         }.bind( typeObject.appType )
                     }
                 }).inject( this.columnTypeListContaienr )
+                if( appType && appType === typeObject.appType ){
+                    _self.setCurrentAppType( this, ev.target, callback );
+                }
             }.bind(this))
             if (this.columnTypeListContaienr.getScrollSize().y>this.columnTypeListContaienr.getSize().y) this.createTypeExpandButton();
         }.bind(this))
@@ -160,7 +177,7 @@ MWF.xApplication.cms.Column.Main = new Class({
         }
         e.stopPropagation();
     },
-    setCurrentAppType : function( appType, target ){
+    setCurrentAppType : function( appType, target, callback ){
         if( this.currentAppType ){
             if( this.currentAppType === "all" ){
                 this.currentAppTypeNode.setStyles( this.css.columnTop_All );
@@ -180,7 +197,7 @@ MWF.xApplication.cms.Column.Main = new Class({
         this.currentAppType = appType;
         this.currentAppTypeNode = target;
 
-        this.createColumnNodes();
+        this.createColumnNodes( callback );
     },
     setContentSize: function(){
         var nodeSize = this.node.getSize();
@@ -291,15 +308,17 @@ MWF.xApplication.cms.Column.Main = new Class({
     //hasPermision: function (appId) {
     //    return this.isAdmin || this.availableApp.contains(appId);
     //},
-    createColumnNodes: function () {
+    createColumnNodes: function ( callback ) {
         this.columnContentAreaNode.empty();
         if( this.currentAppType === "all" ){
             this.restActions.listAppByManager(function (json){
-                this._createColumnNodes( json )
+                this._createColumnNodes( json );
+                if(callback)callback();
             }.bind(this));
         }else{
             this.restActions.listWhatICanManageWithAppType(this.currentAppType, function (json){
-                this._createColumnNodes( json )
+                this._createColumnNodes( json );
+                if(callback)callback();
             }.bind(this))
         }
 
@@ -912,6 +931,7 @@ MWF.xApplication.cms.Column.PopupForm = new Class({
                         var column = new MWF.xApplication.cms.Column.Column(this.app, json.data, {"where": "top"});
                         column.load();
                         this.app.columns.push(column);
+                        this.app.
                     }else{
                         this.app.reload();
                     }