source: pro-bachkim-filespace/sourcecode/assets/js/manager.js @ 277

Last change on this file since 277 was 277, checked in by quyenla, 11 years ago

lala

  • Property svn:mime-type set to text/plain
File size: 21.0 KB
Line 
1if(jQuery) (function($){
2        $.extend($.fn, {
3                violetFileManager : function (o) {
4                        if( !o ) var o = {};
5                        if( o.tree == undefined ) o.tree = null;
6                        if( o.grid == undefined ) o.grid = null;
7                       
8                        if( o.maincontainer == undefined ) o.maincontainer = null;
9                        if( o.titlebar == undefined ) o.titlebar = null;
10                        if( o.toolsbar == undefined ) o.toolsbar = null;
11                        if( o.statusbar == undefined ) o.statusbar = null;
12                       
13                        if( o.oTree == undefined ) o.oTree = null;
14                        if( o.oGrid == undefined ) o.oGrid = null;
15                        if( o.host == undefined ) o.host = 'http://localhost/';
16                        if( o.hostmodule == undefined ) o.hostmodule = 'privatecontent/';
17                        if( o.script == undefined ) o.script = 'getcontent';
18                        if( o.data == undefined ) o.data = null;
19                        if( o.datasource == undefined ) o.datasource = 'ajax';
20                       
21                        o.host = o.host + 'ajax/';
22                       
23                        var isDev = false;
24                        var contextmenu = null;
25                        var oContainer = this;
26                        var tree = [];
27                        var totalItem = 0;
28                        var countItem = 0;
29                        var maxWidth = 0;
30                        var treeCurrentNode = null;
31                        var self = this;
32                        var oClipBoard = {items:null, act:null};
33                       
34                        /**
35                         * Toolbar defined
36                         * */
37                        var btnNewFolder = $('#' + o.toolsbar + ' > DIV.btn-group.basic > #btnNewFolder');
38                        var btnDel = $('#' + o.toolsbar + ' > DIV.btn-group.basic > #btnDel');
39                        var btnCopy = $('#' + o.toolsbar + ' > DIV.btn-group.basic > #btnCopy');
40                        var btnCut = $('#' + o.toolsbar + ' > DIV.btn-group.basic > #btnCut');
41                        var btnPaste = $('#' + o.toolsbar + ' > DIV.btn-group.basic > #btnPaste');
42                        var btnShare = $('#' + o.toolsbar + ' > DIV.btn-group.social > #btnShare');
43                        var btnPreview = $('#' + o.toolsbar + ' > DIV.btn-group.social > #btnPreview');
44                        var btnDownload = $('#' + o.toolsbar + ' > DIV.btn-group.creation > #btnDownload');
45                        var btnUpload = $('#' + o.toolsbar + ' > DIV.btn-group.creation > #btnUpload');
46                        var btnRefresh = $('#' + o.toolsbar + ' > DIV.btn-group.control > #btnRefresh');
47                       
48                        var sendCommand = function (p) {
49                                if( p.postdata == undefined ) p.postdata = null;
50                                if( p.script == undefined ) p.script = o.script;
51                                if( p.callbackSuccess == undefined ) p.callbackSuccess = null;
52                                if( p.callbackDone == undefined ) p.callbackDone = null;
53                                if( p.callbackFail == undefined ) p.callbackFail = null;
54                                if( p.callbackAlways == undefined ) p.callbackAlways = null;
55                                if( p.parseData == undefined ) p.parseData = null;
56                                if( p.self == undefined ) p.self = this;
57
58                                if (p.script != null && (o.datasource == 'ajax' || isDev)) {
59                                        $.post(o.host + o.hostmodule + p.script, p.postdata, function (data){
60                                                if (data) {
61                                                        parseData = $.parseJSON(data);
62                                                        p.parseData = parseData;
63                                                }
64
65                                                if (p.callbackSuccess != null) {
66                                                        if (parseInt(parseData.ERROR.errCode) === 0)
67                                                                p.callbackSuccess(parseData);
68                                                        else {
69                                                                p.callbackFail(parseData.ERROR);
70                                                        }
71                                                }
72
73                                        }).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);});
74                                }
75                                else if (o.datasource == 'json'){
76                                        if (p.callbackSuccess != null) p.callbackSuccess(o.data);
77                                        if (p.callbackDone != null)     p.callbackDone(this);
78                                }
79                               
80                        };
81                       
82                        var getDirTreeMaxWidth = function  () {
83                                var scrWidth = $(o.maincontainer).width();
84                                return parseInt(scrWidth / 2);
85                        }
86                       
87                        var layoutRender = function () {
88                                var scrWidth = $('#' + o.maincontainer).width();
89                                var scrHeght = $(window).height();
90                                var dirTreeHeight = scrHeght - $('#' + o.titlebar).height() - $('#' + o.toolsbar).height() - $('#' + o.statusbar).height() - 2;
91                                $('#' + o.tree).parent().height(dirTreeHeight);
92                                $('#' + o.grid).parent().height(dirTreeHeight);
93                                $('#' + o.grid).parent().width('calc(100% - ' + ($('#' + o.tree).parent().width() + 8) + 'px)');
94                                var scollWidth = $('#' + o.grid).parent().width();
95                                maxWidth = getDirTreeMaxWidth();
96                                $(o.tree).height(dirTreeHeight - 5);
97                        }
98                       
99                        var createFileManager = function (parseData) {
100                                o.data = parseData;
101                                totalItem = o.data.DIRECTORIES.length;
102                                o.oTree = $('#' + o.tree).violetTree({data:o.data.DIRECTORIES,manager:oContainer});
103                                o.oGrid = $('#' + o.grid).violetGrid({data:o.data,manager:oContainer});
104                        };
105
106                        var getAllDirChild = function (parentID, aryChild) {
107                                parentID = parentID == null ? 0:parentID;
108                                var dirList = searchItemsByParent(parentID,'directory');
109                                var index = aryChild.length;
110                                aryChild[index] = parentID;
111                                if (dirList.length > 0) {
112                                        for (var i = 0; i < dirList.length; i++) {
113                                                getAllDirChild(dirList[i].id, aryChild);
114                                        }
115                                }
116                        }
117
118                        var buildTreeFromParent = function (dirID, node) {                             
119                                var aryChildFiles = [];
120                                var aryChildDirs = [];
121                                var aryChildIDs = [];
122                                var aryTmp = [];
123                                var dir = o.data.DIRECTORIES[searchItemByID(dirID, 'directory')];
124                                aryChildDirs = searchItemsByParent(dirID, 'directory');
125                                aryChildFiles = searchItemsByParent(dirID, 'file');
126
127                                node.id = dir.id;
128                                node.name = dir.name;
129                                node.type = 'directory';
130
131                                $(aryChildDirs).each(function (index) {
132                                        var id = this.id;
133                                        var name = this.name;
134                                        var type = 'directory';
135                                        var cDir = {id:id, name:name, type:type, childs:null};
136                                        aryChildIDs[index] = cDir;
137                                });
138
139                                if ($(aryChildFiles).length > 0 ) {
140                                        if (node.files == undefined) node.files = [];
141                                        $(aryChildFiles).each(function (index) {
142                                                var id = this.id;
143                                                var name = this.name;
144                                                var type = 'file';
145                                                var cFile = {id:id, name:name, type:type};
146                                                node.files[index] = cFile;
147                                        });
148                                }                               
149
150                                if ($(aryChildDirs).length > 0) {
151                                        if (node.childs == undefined) node.childs = [];
152                                        $(aryChildIDs).each(function (index) {
153                                                node.childs[index] = new Object;
154                                                buildTreeFromParent(aryChildIDs[index].id, node.childs[index]);
155                                        });
156                                }
157                        }
158                       
159                        var checkChildExisted = function (id) {
160                                var dirList = searchItemsByParent(id,'directory');
161                                var fileList = searchItemsByParent(id,'file');
162                                return (dirList.length > 0) || (fileList.length > 0);
163                        }
164                       
165                        var doneInit = function () {
166                                bindEventToToolbars();
167                                documentEventsBinding();
168                        };
169                       
170                        var failInit = function (er) {
171                                bootbox.alert(er.err);
172                        }
173                       
174                        var init = function () {
175                                layoutRender ();
176                                $('#' + o.tree).parent().resizable({
177                                        maxWidth: maxWidth,
178                                        minWidth: 220,
179                                        handles: "e",
180                                        resize: function (event, ui) {
181                                                layoutRender ();
182                                        }
183                                });
184                                $(window).resize (function() {layoutRender ();$('#' + o.tree).parent().resizable({maxWidth: maxWidth});});
185                                sendCommand ({postdata:null,callbackSuccess:createFileManager,callbackDone:doneInit,callbackFail:failInit});
186                        };
187                       
188                        var searchItemByID = function (id, type) {
189                                var data = {};
190                                switch (type) {
191                                        case 'directory':
192                                                data = o.data.DIRECTORIES;
193                                                break;
194                                        case 'file':
195                                                data = o.data.FILES;
196                                                break;
197                                        default:
198                                                break;
199                                }
200                               
201                                //for (var i = 0; i < data.length; i++) {
202                                for (var i in data) {
203                                        if (data[i].id == id) {
204                                                return i;
205                                        }
206                                }
207                        }
208                       
209                        var searchItemsByParent = function (parentID, type) {
210                                var data = {};
211                                var aryItem = [];
212                                var index = aryItem.length;
213                               
214                                switch (type) {
215                                        case 'directory':
216                                                data = o.data.DIRECTORIES;
217                                                break;
218                                        case 'file':
219                                                data = o.data.FILES;
220                                                break;
221                                        default:
222                                                break;
223                                }
224                               
225                                for(i in data) {
226                                        if (data[i].parentID == parentID) {
227                                                aryItem[index] = data[i];
228                                                index ++;
229                                        }
230                                }
231                               
232                                return aryItem;
233                        }
234                       
235                        /**************************
236                         * TOOLBAR EVENTS - START *
237                         **************************/
238                        var btnRefreshClick = function (obj) {
239                                $(o).find('i').addClass('icon-spin');                           
240                                sendCommand ({  postdata:null,
241                                                                callbackSuccess:function (parseData) {
242                                                                        o.data = parseData;
243                                                                        self.updateData({updateAll:true});
244                                                                        o.oTree.refeshTree();
245                                                                },
246                                                                callbackDone:function () {$(o).find('i').removeClass('icon-spin');},
247                                                                callbackFail:failInit
248                                        });
249                        }
250                       
251                        var btnNewFolderClick = function () {
252                                createFolderStart();
253                        }
254                       
255                        var btnUploadClick = function () {
256                                uploadStart();
257                upload_init();
258                        }
259                       
260                        var btnDelClick = function () {
261                                var items = o.oGrid.getHightLightItem();
262                                if ($(items).length == 0){
263                                        var dirID = $(o.oTree.getSelectedNode()).attr('id');
264                                        var item = o.data.DIRECTORIES[searchItemByID(dirID,'directory')];
265                                        item.type = 'directory';
266                                        items = [item];
267                                }
268                                self.deleteItem(items);
269                        }
270                       
271                        var btnCopyClick = function () {                               
272                                copy('copy');
273                        }
274
275                        var btnPasteClick = function () {
276                                paste();
277                        }
278                       
279                        var btnCutClick = function () {
280                                copy('move');
281                        }
282                       
283                        var bindEventToToolbars = function () {
284                                $(btnRefresh).click(function(e){btnRefreshClick(this)});
285                               
286                                $(btnNewFolder).click(function(e){btnNewFolderClick()});
287                $(btnUpload).click(function(e){btnUploadClick()});
288               
289                                $(btnDel).click(function(e){btnDelClick()});
290                                $(btnCopy).click(function(e){btnCopyClick()});
291                                $(btnCut).click(function(e){btnCutClick()});
292                                $(btnPaste).click(function(e){btnPasteClick()})
293                               
294                                /*btnShare
295                                btnPreview
296                                btnDownload
297                                btnUpload*/
298                        }
299                        /************************
300                         * TOOLBAR EVENTS - END *
301                         ************************/
302
303                        /***********************************
304                         * DOCUMENT EVENTS BINDING - START *
305                         ***********************************/
306                         var documentEventsBinding = function () {
307                                $(document).bind('keydown', function (e){
308                                        switch( e.which ) {
309                                                case 113:                                                       
310                                                case 27:
311                                                        var gridSelectedItems = o.oGrid.getHightLightItem();
312                                                        if ($(gridSelectedItems).length > 0) {
313                                                                o.oGrid.rename(e.which);
314                                                        }else {                                                         
315                                                                o.oTree.rename(e.which);
316                                                        }
317                                                        break;
318                                                case 46:
319                                                        //delete
320                                                        btnDelClick();
321                                                        break;
322                                                case 65:
323                                                        if (e.ctrlKey) {
324                                                                o.oGrid.selectAllNode();
325                                                        }
326                                                        break;
327                                                default:
328                                                        break;
329                                        }
330                                });
331                         }
332                        /***********************************
333                         * DOCUMENT EVENTS BINDING - END *
334                         ***********************************/                   
335                       
336                        /*******************************
337                         * CREATE FOLDER - START *
338                         *******************************/
339                        var createFolderStart = function () {
340                                var promptOptions = {
341                                                  title: "Tạo thư mục mới",
342                                                  buttons: {
343                                                    confirm: {
344                                                      label: "Lưu"
345                                                    },
346                                                    cancel: {
347                                                      label: "Há»§y"   
348                                                    }
349                                                  },
350                                                  callback: function(result) {               
351                                                      if (result === null) {                                             
352                                                                                     
353                                                      } else {
354                                                          createFolder(treeCurrentNode, result);
355                                                      }
356                                                    }
357                                                };
358
359                                return bootbox.prompt(promptOptions);
360                        }
361                       
362                        var uploadStart = function () {
363                           
364                                var promptOptions = {
365                                                  title: "Tải lên",
366                                                   message: "<form id='upload' method='post' action='http://api.violet.vn/space/spaceupload' enctype='multipart/form-data'><div id='drop'>Kéo thả tệp vào đây <a> Chọn tệp </a><input type='hidden' name='die' value='"+self.getTreeCurrentNode()+"'/><input type='file' name='upload_file' multiple /></div><ul></ul></form>",
367                                                  buttons: {
368                                                    confirm: {
369                                                      label: "Lưu"
370                                                    },
371                                                    cancel: {
372                                                      label: "Há»§y"   
373                                                    }
374                                                  },
375                                                  callback: function(result) {               
376                                                      if (result === null) {                                             
377                                                                                     
378                                                      } else {
379                                                         
380                                                         
381                                                          createFolder(treeCurrentNode, result);
382                                                      }
383                                                    }
384                                                };
385
386                                return bootbox.dialog(promptOptions);
387                        }
388                       
389                        var createFolder = function (parent, name) {
390                                var postdata = {fname:name,fparentid:parent};
391                                var script = 'createdir';
392                                /*isDev = true;*/
393                                sendCommand ({
394                                        postdata:postdata,
395                                        script:script,
396                                        callbackSuccess:function(parseData){createFolderFinish(parseData);},
397                                        callbackFail: function(){}
398                                });
399                        }
400                       
401                        var createFolderFinish = function (parseData) {
402                                /*isDev = false;*/
403                                if (parseData.ERROR.errCode == 0) {
404                                        var node = {id:parseData.id, name:parseData.name,parentID:parseData.parentID};
405                                        o.oTree.createNode(node);
406                                        o.data.DIRECTORIES[$(o.data.DIRECTORIES).length] = node;
407                                        if (o.oGrid) o.oGrid.reloadGrid();
408                                }
409                        }
410                        /*******************************
411                         * CREATE FOLDER - END         *
412                         *******************************/
413                        /********************************
414                         * COPY & PASTE & MOVE - START  *
415                         ************=*******************/     
416                        var copy = function (act){
417                                //detect selected items
418                                //push to clipboard
419                                var items = o.oGrid.getHightLightItem();
420                               
421                                if ($(items).length == 0) {
422                                        var node = o.oTree.getSelectedNode();
423                                        var itemID = $(node).attr('id');
424                                       
425                                        if (itemID == 0) return false;
426                                       
427                                        items[0] = o.data.DIRECTORIES[searchItemByID(itemID, 'directory')];
428                                        items[0].type = 'directory';
429                                }
430
431                                if ($(items).length > 0) {
432                                        oClipBoard.items = items;
433                                        oClipBoard.act = act;
434                                }
435                                return true;
436                        }
437                       
438                        var paste = function () {
439                                if ((oClipBoard.act != 'copy'
440                                        && oClipBoard.act != 'move')
441                                        || oClipBoard.items == null) return;
442                               
443                                var items = [];
444                                var destination = self.getTreeCurrentNode();
445                                if (oClipBoard.act != 'copy') {
446                                        $(oClipBoard.items).each(function (index) {
447                                                var node = new Object;
448                                                if (this.type == 'directory')
449                                                        buildTreeFromParent(this.id, node);
450                                                else {
451                                                        node.id = this.id;
452                                                        node.type = 'file';
453                                                }
454       
455                                                items[index] = node;
456                                        });
457                                }
458                                else {
459                                        items = oClipBoard.items;
460                                }
461                               
462                                var postdata = {act:oClipBoard.act,destination:destination,data:JSON.stringify(items)};
463                                var script = oClipBoard.act;
464                               
465                                sendCommand ({
466                                        postdata:postdata,
467                                        script:script,
468                                        callbackSuccess:function(parseData){
469                                                if (oClipBoard.act == 'copy'){
470                                                        $(parseData.DIRECTORIES).each(function (index) {
471                                                                o.data.DIRECTORIES[$(o.data.DIRECTORIES).length] = this;
472                                                        });
473                                                       
474                                                        $(parseData.FILES).each(function (index) {
475                                                                o.data.FILES[$(o.data.FILES).length] = this;
476                                                        });
477                                                                                                       
478                                                        o.data.DIRECTORIES.sort(function (a,b) {
479                                                                return a.parentID - b.parentID;
480                                                        });                                             
481                                                       
482                                                        o.oTree.setData (o.data.DIRECTORIES);
483                                                        o.oGrid.setData (o.data);                                               
484                                                        o.oTree.createCopyNode(parseData.DIRECTORIES);
485                                                        o.oGrid.reloadGrid();
486                                                }
487                                                else if (oClipBoard.act == 'move') {
488                                                       
489                                                }
490                                        }
491                                });
492                               
493                        }
494
495                        var move = function () {
496                               
497                        }
498
499                        var copyTo = function () {
500
501                        }
502
503                        var moveTo = function () {
504
505                        }
506                       
507                        /*****************************
508                         * COPY & PASTE & MOVE - END *
509                         *****************************/
510
511                        this.deleteItem = function (item) {
512                               
513                                var confirmText = 'Bạn có muốn xóa ';
514                               
515                                if ($.isArray(item) && item.length > 1) {
516                                        confirmText += 'các thư mục (và files) đã chọn?';
517                                }
518                                else if (item.length == 1) {
519                                        if (item[0].id == 0) return false;
520                                        confirmText += (item[0].type == 'directory')?'thư mục':'file';
521                                        confirmText += ' <span style="font-weight:bold">' + item[0].name + "</span> khÃŽng?";
522                                }
523                               
524                                confirmText += '<br /><div style="color:red">(hành động này sẜ xóa tất cả thư mục con và các file trong các thư mục đã chọn)</div>';
525                               
526                                var parentID = item[0].parentID;
527                               
528                                for (var i = 0; i < item.length; i++) {
529                                        if (item[i].type == 'directory') {
530                                                var aryChildDirTmp = [];
531                                                var aryChildDirID = [];
532                                                var aryChildFiles = searchItemsByParent(item[i].id, 'file');
533                                                var aryChildDirs = [];
534                                               
535                                                getAllDirChild (item[i].id, aryChildDirTmp);
536                                                for(var d = 1; d < aryChildDirTmp.length; d++) {
537                                                        aryChildDirID[d-1] = aryChildDirTmp[d];
538                                                }
539                                               
540                                                for (var j = 0; j < aryChildDirID.length; j++) {
541                                                        if (o.data.DIRECTORIES[searchItemByID(aryChildDirID[j],'directory')] != undefined)
542                                                                aryChildDirs[aryChildDirs.length] = o.data.DIRECTORIES[searchItemByID(aryChildDirID[j],'directory')];
543                                                       
544                                                        var aryTmp = searchItemsByParent(aryChildDirID[j], 'file');
545                                                        if (aryTmp.length > 0)
546                                                                for(var f in aryTmp) {
547                                                                        aryChildFiles[aryChildFiles.length] = aryTmp[f];
548                                                                }
549                                                }
550                                               
551                                                item[i].childDirs = aryChildDirs;
552                                                item[i].childFiles = aryChildFiles;
553                                        }
554                                }
555                               
556                                var confirmOptions = {
557                                                  message:confirmText,
558                                                  buttons: {
559                                                    confirm: {
560                                                      label: "Xóa"
561                                                    },
562                                                    cancel: {
563                                                      label: "KhÃŽng xóa"     
564                                                    }
565                                                  },
566                                                  callback: function(result) {               
567                                                          if (result) {
568                                                                        var delobj = JSON.stringify(item);
569                                                                        var postdata = {delobj:delobj};
570                                                                        var script = 'delete';
571                                                                        sendCommand ({
572                                                                                postdata:postdata,
573                                                                                script:script,
574                                                                                callbackSuccess:function(parseData){
575                                                                                        if($(parseData.DIRECTORIES).length > 0) {
576                                                                                                $(parseData.DIRECTORIES).each (function (index) {
577                                                                                                        o.oTree.deletion(this);
578                                                                                                        o.oGrid.deletion(this, 'directory');   
579                                                                                                });
580                                                                                        }
581
582                                                                                        if($(parseData.FILES).length > 0) {
583                                                                                                $(parseData.FILES).each (function (index) {
584                                                                                                        var file = o.data.FILES[searchItemByID(this, 'file')];                                                                                 
585                                                                                                        o.oGrid.deletion(this, file.minetype);
586                                                                                                });     
587                                                                                        }
588                                                                                },
589                                                                                callbackDone: function (obj) {
590                                                                                        if($(parseData.DIRECTORIES).length > 0) {
591                                                                                                $(parseData.DIRECTORIES).each(function(index){
592                                                                                                        delete o.data.DIRECTORIES[searchItemByID(this, 'directory')];
593                                                                                                });
594                                                                                        }
595                                                                                       
596                                                                                        if($(parseData.FILES).length > 0) {
597                                                                                                $(parseData.FILES).each(function(index){
598                                                                                                        delete o.data.FILES[searchItemByID(this, 'file')];
599                                                                                                });
600                                                                                        }
601                                                                                       
602                                                                                        o.oTree.setData (o.data.DIRECTORIES);
603                                                                                        o.oGrid.setData (o.data);
604                                                                                        self.setTreeCurrentNode(parentID);
605                                                                                        o.oGrid.reloadGrid();
606                                                                        },
607                                                                                callbackFail: function(){}
608                                                                        });
609                                                                }
610                                                    }
611                                                };
612                               
613                                bootbox.confirm(confirmOptions);
614                        }
615                       
616                        this.setTreeCurrentNode = function (treeNode) {
617                                //fire when click a node on Tree
618                                //then fire action of Grid
619                                treeCurrentNode = treeNode;
620                                if (o.oGrid) o.oGrid.reloadGrid();
621                        };
622                       
623                        this.getTreeCurrentNode = function () {
624                                return treeCurrentNode;
625                        }
626                       
627                        this.gridNodeDblClick = function (node) {
628                                if (node.minetype == 'directory') {
629                                        var treeNode = $('#' + o.tree).find('UL.vstree[rel^="node' + node.parentID + '"] > LI[rel^="folder"] > A#' + node.id);
630                                        o.oTree.activeNode(treeNode);
631                                }
632                                else {
633                                        //execute or preview file
634                                }
635                        };
636                       
637                        this.createNewFolder = function () {
638                               
639                        }
640                       
641                        this.updateData = function (p) {
642                                if( p.item == undefined ) p.item = null;
643                                if( p.updateAll == undefined ) p.updateAll = false;
644                                if( p.from == undefined ) p.from = null;
645                                if( p.type == undefined ) p.type = null;
646                                if( p.callback == undefined ) p.callback = null;
647
648                                var obj = p.from == 'tree' ? o.oGrid : o.oTree;
649                                if (!p.updateAll) {
650                                        var index = searchItemByID(p.item.id, p.type);
651                                        switch (p.type) {
652                                                case 'directory':
653                                                        o.data.DIRECTORIES[index].name = p.item.name;
654                                                        o.data.DIRECTORIES[index].parentID = p.item.parentID;
655                                                        break;
656                                                case 'file':
657                                                        o.data.FILES[index].name = p.item.name;
658                                                        o.data.FILES[index].parentID = p.item.parentID;
659                                                        o.data.FILES[index].minetype = p.item.minetype;
660                                                        break;
661                                                default:
662                                                        break;
663                                        }
664                                }
665                               
666                                o.oTree.setData (o.data.DIRECTORIES);
667                                o.oGrid.setData (o.data);
668                               
669                                if (p.callback != null) {
670                                        eval('obj.' + p.callback + '(p.item);')
671                                }
672                               
673                                //call sendCommand
674                        }
675                       
676                        this.searchItemsByParent = function (parentID, type) {
677                                return searchItemsByParent(parentID, type);
678                        }
679                       
680                        this.searchItemByID = function (parentID, type) {
681                                return searchItemByID(parentID, type);
682                        }
683                       
684                        this.initialize = function () {
685                                init();
686                                return this;
687                        };
688                       
689                        return this.initialize();
690                }
691        });
692})(jQuery);
Note: See TracBrowser for help on using the repository browser.