Ignore:
Timestamp:
Aug 4, 2014 6:09:41 PM (11 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

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

    r18 r42  
    1515                        if( o.expandEasing == undefined ) o.expandEasing = null;
    1616                        if( o.collapseEasing == undefined ) o.collapseEasing = null;
     17                        if( o.me == undefined ) o.me = this;
    1718
    1819                        if( o.directoryTreeData == undefined ) o.directoryTreeData = null;
     
    107108                                        newdir.id = d.id;
    108109                                        newdir.name = d.name;
     110                                       
     111                                        console.log(d.currentNode);
     112                                       
    109113                                        newdir.parentID = $(o.container).find(d.currentNode).parent().attr('id').substring(o.dirIDprefix.length, $(d.currentNode).parent().attr('id').length);
    110114                                        o.directoryTreeData.DIRECTORIES.push(newdir);
     
    125129                                                                rename(el);
    126130                                                                break;
     131                                                        case 'newfolder':
    127132                                                        case 'share':
    128133                                                        case 'copy':
     
    144149                        }
    145150                        //END - Create a node of Tree
    146 
     151                       
    147152                        var deleteNode = function (parsedData) {
    148153                                if (parsedData.isSuccess == false) return false;
     
    190195                                if (o.grid == null) return false;
    191196                               
    192                                 o.grid.getData({
     197                                o.grid.setTree(o.me);
     198                                o.grid.setData({
    193199                                                                directoryTreeData: o.directoryTreeData,
    194200                                                                curentParent:$(o.container).find('.currentDir').parent().attr('id'),
     
    281287                        };
    282288
    283                         this.createDir = function(c) {
    284                                 var cid = $(c).parent().attr('id');
    285                                 var pid = cid.substring(o.dirIDprefix.length, cid.length);
    286 
    287                                 var dirName = prompt("Please enter new directory name", "");
    288                                 var script = 'ajax/privatecontent/createdir';
    289 
    290                                 if (dirName != null && dirName.length != 0) {
    291                                         sendCommand({
    292                                                 script: script,
    293                                                 postdata:{parentID:pid,name:dirName},
    294                                                 callbackSuccess: function (parsedData) {createNode({
    295                                                                                         id: parsedData.id,
    296                                                                                         name: parsedData.name,
    297                                                                                         curentNode: c,
    298                                                                                         hidden: false,
    299                                                                                         addToJSONData:true});
    300                                                                                 }
    301                                         });
    302                                 }
     289                        this.createDir = function(data) {
     290                                var cNode = $('#' + o.dirIDprefix + data.parentID).find('> A');
     291                               
     292                                createNode({
     293                                        id: data.id,
     294                                        name: data.name,
     295                                        currentNode: cNode,
     296                                        hidden: false,
     297                                        addToJSONData:true});
     298                               
     299                                //console.log($(o.container).find(cNode).parent().attr('id').substring(o.dirIDprefix.length, $(cNode).parent().attr('id').length));
    303300                        }
    304301
     
    328325                                });
    329326                        }
     327                       
     328                        this.upload = function () {
     329                                $('#box-upload').modal('show');
     330                               
     331                                $("#fileuploader").uploadFile({
     332                                        url: o.host + 'ajax/privatecontent/upload',
     333                                        fileName:"myfile",
     334                                        multiple:true,
     335                                        maxFileCount: 5,
     336                                        dragDropStr: "<span><b>Kéo thả các file vào đây!</b></span>",
     337                                        uploadErrorStr:"Tải lên có lỗi!"
     338                                });
     339                               
     340                                $('#box-upload').on('hide.bs.modal', function () {
     341                                        $('#box-upload').find('.modal-body>.row>.col-xs-12>').remove();
     342                                        $('#box-upload').find('.modal-body>.row>.col-xs-12').append('<div id="fileuploader">Chọn file:</div>');
     343                                });
     344                        }
    330345
    331346                        this.copy = function () {
    332                                 alert ('copy');
     347                               
    333348                        }
    334349
    335350                        this.paste = function () {
    336                                 alert ('paste');
     351                               
    337352                        }
    338353
Note: See TracChangeset for help on using the changeset viewer.