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

Last change on this file since 245 was 245, checked in by dungnv, 11 years ago
  • Property svn:mime-type set to text/plain
File size: 20.8 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                                $(btnDel).click(function(e){btnDelClick()});
289                                $(btnCopy).click(function(e){btnCopyClick()});
290                                $(btnCut).click(function(e){btnCutClick()});
291                                $(btnPaste).click(function(e){btnPasteClick()})
292                               
293                                /*btnShare
294                                btnPreview
295                                btnDownload
296                                btnUpload*/
297                        }
298                        /************************
299                         * TOOLBAR EVENTS - END *
300                         ************************/
301
302                        /***********************************
303                         * DOCUMENT EVENTS BINDING - START *
304                         ***********************************/
305                         var documentEventsBinding = function () {
306                                $(document).bind('keydown', function (e){
307                                        switch( e.which ) {
308                                                case 113:                                                       
309                                                case 27:
310                                                        var gridSelectedItems = o.oGrid.getHightLightItem();
311                                                        if ($(gridSelectedItems).length > 0) {
312                                                                o.oGrid.rename(e.which);
313                                                        }else {                                                         
314                                                                o.oTree.rename(e.which);
315                                                        }
316                                                        break;
317                                                case 46:
318                                                        //delete
319                                                        btnDelClick();
320                                                        break;
321                                                case 65:
322                                                        if (e.ctrlKey) {
323                                                                o.oGrid.selectAllNode();
324                                                        }
325                                                        break;
326                                                default:
327                                                        break;
328                                        }
329                                });
330                         }
331                        /***********************************
332                         * DOCUMENT EVENTS BINDING - END *
333                         ***********************************/                   
334                       
335                        /*******************************
336                         * CREATE FOLDER - START *
337                         *******************************/
338                        var createFolderStart = function () {
339                                var promptOptions = {
340                                                  title: "Tạo thư mục mới",
341                                                  buttons: {
342                                                    confirm: {
343                                                      label: "Lưu"
344                                                    },
345                                                    cancel: {
346                                                      label: "Há»§y"   
347                                                    }
348                                                  },
349                                                  callback: function(result) {               
350                                                      if (result === null) {                                             
351                                                                                     
352                                                      } else {
353                                                          createFolder(treeCurrentNode, result);
354                                                      }
355                                                    }
356                                                };
357
358                                return bootbox.prompt(promptOptions);
359                        }
360                       
361                        var uploadStart = function () {
362                                var promptOptions = {
363                                                  title: "Tải lên",
364                                                   message: "<form id='upload' method='post' action='upload/upload.php' enctype='multipart/form-data'><div id='drop'>Drop Here<a>Browse</a><input type='file' name='upl' multiple /></div><ul></ul></form>",
365                                                  buttons: {
366                                                    confirm: {
367                                                      label: "Lưu"
368                                                    },
369                                                    cancel: {
370                                                      label: "Há»§y"   
371                                                    }
372                                                  },
373                                                  callback: function(result) {               
374                                                      if (result === null) {                                             
375                                                                                     
376                                                      } else {
377                                                         
378                                                         
379                                                          createFolder(treeCurrentNode, result);
380                                                      }
381                                                    }
382                                                };
383
384                                return bootbox.dialog(promptOptions);
385                        }
386                       
387                        var createFolder = function (parent, name) {
388                                var postdata = {fname:name,fparentid:parent};
389                                var script = 'createdir';
390                                /*isDev = true;*/
391                                sendCommand ({
392                                        postdata:postdata,
393                                        script:script,
394                                        callbackSuccess:function(parseData){createFolderFinish(parseData);},
395                                        callbackFail: function(){}
396                                });
397                        }
398                       
399                        var createFolderFinish = function (parseData) {
400                                /*isDev = false;*/
401                                if (parseData.ERROR.errCode == 0) {
402                                        var node = {id:parseData.id, name:parseData.name,parentID:parseData.parentID};
403                                        o.oTree.createNode(node);
404                                        o.data.DIRECTORIES[$(o.data.DIRECTORIES).length] = node;
405                                        if (o.oGrid) o.oGrid.reloadGrid();
406                                }
407                        }
408                        /*******************************
409                         * CREATE FOLDER - END         *
410                         *******************************/
411                        /********************************
412                         * COPY & PASTE & MOVE - START  *
413                         ************=*******************/     
414                        var copy = function (act){
415                                //detect selected items
416                                //push to clipboard
417                                var items = o.oGrid.getHightLightItem();
418                               
419                                if ($(items).length == 0) {
420                                        var node = o.oTree.getSelectedNode();
421                                        var itemID = $(node).attr('id');
422                                       
423                                        if (itemID == 0) return false;
424                                       
425                                        items[0] = o.data.DIRECTORIES[searchItemByID(itemID, 'directory')];
426                                        items[0].type = 'directory';
427                                }
428
429                                if ($(items).length > 0) {
430                                        oClipBoard.items = items;
431                                        oClipBoard.act = act;
432                                }
433                                return true;
434                        }
435                       
436                        var paste = function () {
437                                if ((oClipBoard.act != 'copy'
438                                        && oClipBoard.act != 'move')
439                                        || oClipBoard.items == null) return;
440                               
441                                var items = [];
442                                var destination = self.getTreeCurrentNode();
443                                if (oClipBoard.act != 'copy') {
444                                        $(oClipBoard.items).each(function (index) {
445                                                var node = new Object;
446                                                if (this.type == 'directory')
447                                                        buildTreeFromParent(this.id, node);
448                                                else {
449                                                        node.id = this.id;
450                                                        node.type = 'file';
451                                                }
452       
453                                                items[index] = node;
454                                        });
455                                }
456                                else {
457                                        items = oClipBoard.items;
458                                }
459                               
460                                var postdata = {act:oClipBoard.act,destination:destination,data:JSON.stringify(items)};
461                                var script = oClipBoard.act;
462                               
463                                sendCommand ({
464                                        postdata:postdata,
465                                        script:script,
466                                        callbackSuccess:function(parseData){
467                                                if (oClipBoard.act == 'copy'){
468                                                        $(parseData.DIRECTORIES).each(function (index) {
469                                                                o.data.DIRECTORIES[$(o.data.DIRECTORIES).length] = this;
470                                                        });
471                                                       
472                                                        $(parseData.FILES).each(function (index) {
473                                                                o.data.FILES[$(o.data.FILES).length] = this;
474                                                        });
475                                                                                                       
476                                                        o.data.DIRECTORIES.sort(function (a,b) {
477                                                                return a.parentID - b.parentID;
478                                                        });                                             
479                                                       
480                                                        o.oTree.setData (o.data.DIRECTORIES);
481                                                        o.oGrid.setData (o.data);                                               
482                                                        o.oTree.createCopyNode(parseData.DIRECTORIES);
483                                                        o.oGrid.reloadGrid();
484                                                }
485                                                else if (oClipBoard.act == 'move') {
486                                                       
487                                                }
488                                        }
489                                });
490                               
491                        }
492
493                        var move = function () {
494                               
495                        }
496
497                        var copyTo = function () {
498
499                        }
500
501                        var moveTo = function () {
502
503                        }
504                       
505                        /*****************************
506                         * COPY & PASTE & MOVE - END *
507                         *****************************/
508
509                        this.deleteItem = function (item) {
510                               
511                                var confirmText = 'Bạn có muốn xóa ';
512                               
513                                if ($.isArray(item) && item.length > 1) {
514                                        confirmText += 'các thư mục (và files) đã chọn?';
515                                }
516                                else if (item.length == 1) {
517                                        if (item[0].id == 0) return false;
518                                        confirmText += (item[0].type == 'directory')?'thư mục':'file';
519                                        confirmText += ' <span style="font-weight:bold">' + item[0].name + "</span> khÃŽng?";
520                                }
521                               
522                                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>';
523                               
524                                var parentID = item[0].parentID;
525                               
526                                for (var i = 0; i < item.length; i++) {
527                                        if (item[i].type == 'directory') {
528                                                var aryChildDirTmp = [];
529                                                var aryChildDirID = [];
530                                                var aryChildFiles = searchItemsByParent(item[i].id, 'file');
531                                                var aryChildDirs = [];
532                                               
533                                                getAllDirChild (item[i].id, aryChildDirTmp);
534                                                for(var d = 1; d < aryChildDirTmp.length; d++) {
535                                                        aryChildDirID[d-1] = aryChildDirTmp[d];
536                                                }
537                                               
538                                                for (var j = 0; j < aryChildDirID.length; j++) {
539                                                        if (o.data.DIRECTORIES[searchItemByID(aryChildDirID[j],'directory')] != undefined)
540                                                                aryChildDirs[aryChildDirs.length] = o.data.DIRECTORIES[searchItemByID(aryChildDirID[j],'directory')];
541                                                       
542                                                        var aryTmp = searchItemsByParent(aryChildDirID[j], 'file');
543                                                        if (aryTmp.length > 0)
544                                                                for(var f in aryTmp) {
545                                                                        aryChildFiles[aryChildFiles.length] = aryTmp[f];
546                                                                }
547                                                }
548                                               
549                                                item[i].childDirs = aryChildDirs;
550                                                item[i].childFiles = aryChildFiles;
551                                        }
552                                }
553                               
554                                var confirmOptions = {
555                                                  message:confirmText,
556                                                  buttons: {
557                                                    confirm: {
558                                                      label: "Xóa"
559                                                    },
560                                                    cancel: {
561                                                      label: "KhÃŽng xóa"     
562                                                    }
563                                                  },
564                                                  callback: function(result) {               
565                                                          if (result) {
566                                                                        var delobj = JSON.stringify(item);
567                                                                        var postdata = {delobj:delobj};
568                                                                        var script = 'delete';
569                                                                        sendCommand ({
570                                                                                postdata:postdata,
571                                                                                script:script,
572                                                                                callbackSuccess:function(parseData){
573                                                                                        if($(parseData.DIRECTORIES).length > 0) {
574                                                                                                $(parseData.DIRECTORIES).each (function (index) {
575                                                                                                        o.oTree.deletion(this);
576                                                                                                        o.oGrid.deletion(this, 'directory');   
577                                                                                                });
578                                                                                        }
579
580                                                                                        if($(parseData.FILES).length > 0) {
581                                                                                                $(parseData.FILES).each (function (index) {
582                                                                                                        var file = o.data.FILES[searchItemByID(this, 'file')];                                                                                 
583                                                                                                        o.oGrid.deletion(this, file.minetype);
584                                                                                                });     
585                                                                                        }
586                                                                                },
587                                                                                callbackDone: function (obj) {
588                                                                                        if($(parseData.DIRECTORIES).length > 0) {
589                                                                                                $(parseData.DIRECTORIES).each(function(index){
590                                                                                                        delete o.data.DIRECTORIES[searchItemByID(this, 'directory')];
591                                                                                                });
592                                                                                        }
593                                                                                       
594                                                                                        if($(parseData.FILES).length > 0) {
595                                                                                                $(parseData.FILES).each(function(index){
596                                                                                                        delete o.data.FILES[searchItemByID(this, 'file')];
597                                                                                                });
598                                                                                        }
599                                                                                       
600                                                                                        o.oTree.setData (o.data.DIRECTORIES);
601                                                                                        o.oGrid.setData (o.data);
602                                                                                        self.setTreeCurrentNode(parentID);
603                                                                                        o.oGrid.reloadGrid();
604                                                                        },
605                                                                                callbackFail: function(){}
606                                                                        });
607                                                                }
608                                                    }
609                                                };
610                               
611                                bootbox.confirm(confirmOptions);
612                        }
613                       
614                        this.setTreeCurrentNode = function (treeNode) {
615                                //fire when click a node on Tree
616                                //then fire action of Grid
617                                treeCurrentNode = treeNode;
618                                if (o.oGrid) o.oGrid.reloadGrid();
619                        };
620                       
621                        this.getTreeCurrentNode = function () {
622                                return treeCurrentNode;
623                        }
624                       
625                        this.gridNodeDblClick = function (node) {
626                                if (node.minetype == 'directory') {
627                                        var treeNode = $('#' + o.tree).find('UL.vstree[rel^="node' + node.parentID + '"] > LI[rel^="folder"] > A#' + node.id);
628                                        o.oTree.activeNode(treeNode);
629                                }
630                                else {
631                                        //execute or preview file
632                                }
633                        };
634                       
635                        this.createNewFolder = function () {
636                               
637                        }
638                       
639                        this.updateData = function (p) {
640                                if( p.item == undefined ) p.item = null;
641                                if( p.updateAll == undefined ) p.updateAll = false;
642                                if( p.from == undefined ) p.from = null;
643                                if( p.type == undefined ) p.type = null;
644                                if( p.callback == undefined ) p.callback = null;
645
646                                var obj = p.from == 'tree' ? o.oGrid : o.oTree;
647                                if (!p.updateAll) {
648                                        var index = searchItemByID(p.item.id, p.type);
649                                        switch (p.type) {
650                                                case 'directory':
651                                                        o.data.DIRECTORIES[index].name = p.item.name;
652                                                        o.data.DIRECTORIES[index].parentID = p.item.parentID;
653                                                        break;
654                                                case 'file':
655                                                        o.data.FILES[index].name = p.item.name;
656                                                        o.data.FILES[index].parentID = p.item.parentID;
657                                                        o.data.FILES[index].minetype = p.item.minetype;
658                                                        break;
659                                                default:
660                                                        break;
661                                        }
662                                }
663                               
664                                o.oTree.setData (o.data.DIRECTORIES);
665                                o.oGrid.setData (o.data);
666                               
667                                if (p.callback != null) {
668                                        eval('obj.' + p.callback + '(p.item);')
669                                }
670                               
671                                //call sendCommand
672                        }
673                       
674                        this.searchItemsByParent = function (parentID, type) {
675                                return searchItemsByParent(parentID, type);
676                        }
677                       
678                        this.searchItemByID = function (parentID, type) {
679                                return searchItemByID(parentID, type);
680                        }
681                       
682                        this.initialize = function () {
683                                init();
684                                return this;
685                        };
686                       
687                        return this.initialize();
688                }
689        });
690})(jQuery);
Note: See TracBrowser for help on using the repository browser.