Changeset 121 for pro-bachkim-filespace/sourcecode/assets/js
- Timestamp:
- Sep 12, 2014 7:24:12 PM (11 years ago)
- Location:
- pro-bachkim-filespace/sourcecode/assets/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-bachkim-filespace/sourcecode/assets/js/grid.js
r70 r121 142 142 var nodeID = $(node).find('> DIV[class^="file-name"] > INPUT[type="hidden"][class^="id"]').val(); 143 143 var nodeType = $(node).find('> DIV[class^="file-name"] > INPUT[type="hidden"][class^="type"]').val(); 144 $(node).remove(); 144 $(node).remove(); 145 145 } 146 146 -
pro-bachkim-filespace/sourcecode/assets/js/manager.js
r70 r121 51 51 if( p.callbackFail == undefined ) p.callbackFail = null; 52 52 if( p.callbackAlways == undefined ) p.callbackAlways = null; 53 if( p.parseData == undefined ) p.parseData = null; 54 if( p.self == undefined ) p.self = this; 53 55 54 56 if (p.script != null && (o.datasource == 'ajax' || isDev)) { … … 56 58 if (data) { 57 59 parseData = $.parseJSON(data); 60 p.parseData = parseData; 58 61 } 59 62 … … 66 69 } 67 70 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);}); 69 72 } 70 73 else if (o.datasource == 'json'){ … … 120 123 aryChildFiles = searchItemsByParent(dirID, 'file'); 121 124 125 node.id = dir.id; 126 node.name = dir.name; 127 node.type = 'directory'; 128 122 129 $(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; 124 135 }); 125 126 if (node.id == undefined) node.id = dirID;127 136 128 137 if ($(aryChildFiles).length > 0 ) { 129 138 if (node.files == undefined) node.files = []; 130 139 $(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; 132 145 }); 133 146 } … … 137 150 $(aryChildIDs).each(function (index) { 138 151 node.childs[index] = new Object; 139 buildTreeFromParent(aryChildIDs[index] , node.childs[index]);152 buildTreeFromParent(aryChildIDs[index].id, node.childs[index]); 140 153 }); 141 154 } … … 388 401 $(oClipBoard.items).each(function (index) { 389 402 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 391 410 items[index] = node; 392 411 }); … … 483 502 callbackSuccess:function(parseData){ 484 503 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 }); 489 508 } 490 509 491 510 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 }); 497 515 } 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); 499 544 }, 500 545 callbackFail: function(){}
Note: See TracChangeset
for help on using the changeset viewer.