Ignore:
Timestamp:
Sep 12, 2014 7:24:12 PM (11 years ago)
Author:
dungnv
Message:
 
Location:
pro-bachkim-filespace/sourcecode/assets/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pro-bachkim-filespace/sourcecode/assets/js/grid.js

    r70 r121  
    142142                                var nodeID = $(node).find('> DIV[class^="file-name"] > INPUT[type="hidden"][class^="id"]').val();
    143143                                var nodeType = $(node).find('> DIV[class^="file-name"] > INPUT[type="hidden"][class^="type"]').val();
    144                                 $(node).remove();                               
     144                                $(node).remove();
    145145                        }
    146146
  • pro-bachkim-filespace/sourcecode/assets/js/manager.js

    r70 r121  
    5151                                if( p.callbackFail == undefined ) p.callbackFail = null;
    5252                                if( p.callbackAlways == undefined ) p.callbackAlways = null;
     53                                if( p.parseData == undefined ) p.parseData = null;
     54                                if( p.self == undefined ) p.self = this;
    5355
    5456                                if (p.script != null && (o.datasource == 'ajax' || isDev)) {
     
    5658                                                if (data) {
    5759                                                        parseData = $.parseJSON(data);
     60                                                        p.parseData = parseData;
    5861                                                }
    5962
     
    6669                                                }
    6770
    68                                         }).done(function() {if (p.callbackDone != null)p.callbackDone(this);}).fail(function() {if (p.callbackFail != null)p.callbackFail(this);}).always(function() {if (p.callbackAlways != null)p.callbackAlways(this);});
     71                                        }).done(function() {if (p.callbackDone != null)p.callbackDone(p.parseData);}).fail(function() {if (p.callbackFail != null)p.callbackFail(this);}).always(function() {if (p.callbackAlways != null)p.callbackAlways(this);});
    6972                                }
    7073                                else if (o.datasource == 'json'){
     
    120123                                aryChildFiles = searchItemsByParent(dirID, 'file');
    121124
     125                                node.id = dir.id;
     126                                node.name = dir.name;
     127                                node.type = 'directory';
     128
    122129                                $(aryChildDirs).each(function (index) {
    123                                         aryChildIDs[index] = this.id;
     130                                        var id = this.id;
     131                                        var name = this.name;
     132                                        var type = 'directory';
     133                                        var cDir = {id:id, name:name, type:type, childs:null};
     134                                        aryChildIDs[index] = cDir;
    124135                                });
    125 
    126                                 if (node.id == undefined) node.id = dirID;                             
    127136
    128137                                if ($(aryChildFiles).length > 0 ) {
    129138                                        if (node.files == undefined) node.files = [];
    130139                                        $(aryChildFiles).each(function (index) {
    131                                                 node.files[index] = this.id;
     140                                                var id = this.id;
     141                                                var name = this.name;
     142                                                var type = 'file';
     143                                                var cFile = {id:id, name:name, type:type};
     144                                                node.files[index] = cFile;
    132145                                        });
    133146                                }                               
     
    137150                                        $(aryChildIDs).each(function (index) {
    138151                                                node.childs[index] = new Object;
    139                                                 buildTreeFromParent(aryChildIDs[index], node.childs[index]);
     152                                                buildTreeFromParent(aryChildIDs[index].id, node.childs[index]);
    140153                                        });
    141154                                }
     
    388401                                $(oClipBoard.items).each(function (index) {
    389402                                        var node = new Object;
    390                                         buildTreeFromParent(this.id, node);
     403                                        if (this.type == 'directory')
     404                                                buildTreeFromParent(this.id, node);
     405                                        else {
     406                                                node.id = this.id;
     407                                                node.type = 'file';
     408                                        }
     409
    391410                                        items[index] = node;
    392411                                });
     
    483502                                                                                callbackSuccess:function(parseData){
    484503                                                                                        if($(parseData.DIRECTORIES).length > 0) {
    485                                                                                                 for(var i = 0; i < $(parseData.DIRECTORIES).length; i++) {
    486                                                                                                         o.oTree.deletion($(parseData.DIRECTORIES).get(i));
    487                                                                                                         o.oGrid.deletion($(parseData.DIRECTORIES).get(i), 'directory');
    488                                                                                                 }
     504                                                                                                $(parseData.DIRECTORIES).each (function (index) {
     505                                                                                                        o.oTree.deletion(this);
     506                                                                                                        o.oGrid.deletion(this, 'directory');   
     507                                                                                                });
    489508                                                                                        }
    490509
    491510                                                                                        if($(parseData.FILES).length > 0) {
    492                                                                                                 for(var i = 0; i < $(parseData.FILES).length; i++) {   
    493                                                                                                         var id = $(parseData.FILES).get(i);
    494                                                                                                         var file = o.data.FILES[searchItemByID(id)];                                                                                   
    495                                                                                                         o.oGrid.deletion(file.id, file.minetype);
    496                                                                                                 }                                                                                               
     511                                                                                                $(parseData.FILES).each (function (index) {
     512                                                                                                        var file = o.data.FILES[searchItemByID(this, 'file')];                                                                                 
     513                                                                                                        o.oGrid.deletion(this, file.minetype);
     514                                                                                                });     
    497515                                                                                        }
    498 
     516                                                                                },
     517                                                                                callbackDone: function (obj) {
     518                                                                                        var dirs = [];
     519                                                                                        var files = [];
     520                                                                                        if($(parseData.DIRECTORIES).length > 0) {
     521                                                                                                $(o.data.DIRECTORIES).each(function (index){
     522                                                                                                        var found = $.inArray(this.id, parseData.DIRECTORIES);
     523                                                                                                        if(found == -1) {
     524                                                                                                                dirs[$(dirs).length] = this;
     525                                                                                                        }
     526                                                                                                });
     527                                                                                               
     528                                                                                                o.data.DIRECTORIES = dirs;
     529                                                                                        }
     530                                                                                       
     531                                                                                        if($(parseData.FILES).length > 0) {
     532                                                                                                $(o.data.FILES).each(function (index){
     533                                                                                                        var found = $.inArray(this.id, parseData.FILES);
     534                                                                                                        if(found == -1) {
     535                                                                                                                files[$(dirs).length] = this;
     536                                                                                                        }
     537                                                                                                })
     538                                                                                               
     539                                                                                                o.data.FILES = files;
     540                                                                                        }
     541                                                                                       
     542                                                                                        o.oTree.setData (o.data.DIRECTORIES);
     543                                                                                        o.oGrid.setData (o.data);
    499544                                                                                },
    500545                                                                                callbackFail: function(){}
Note: See TracChangeset for help on using the changeset viewer.