Ignore:
Timestamp:
Jul 1, 2014 9:23:18 AM (11 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

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

    r16 r17  
    5555                                                        break;
    5656                                                case 'copy':
    57                                                         showCopyModal();
    58                                                         break;
    5957                                                case 'cut':
    60                                                         showMoveModal();
     58                                                        showCopyModal(currentObj, action);
    6159                                                        break;
    6260                                                default:
     
    9189                        }
    9290                       
    93                         var showCopyModal = function () {
     91                        var showCopyModal = function (obj, action) {
     92                                var modalTitle = action == 'copy' ? 'Sao chép ' + (obj.type == 'directory'?'thư mục':'file') + ' [' + obj.name + ']':'Di chuyển ' + (obj.type == 'directory'?'thư mục':'file') + ' [' + obj.name + ']'
     93                                var submitTitle = action == 'copy' ? 'Sao chép' : 'Di chuyển';
     94                                var submitIcon = action == 'copy' ? '<i class="icon-copy"></i>' : '<i class="icon-cut"></i>';
     95                                               
     96                                //btn-primary
    9497                                $(o.copymodal).modal('show');
    95                                 /*$(o.copymodal).find('INPUT#txtSelectedObj').val(currentObj.name);
    96                                 $(o.copymodal).find('.modal-header').text('Chia sẻ ' + (currentObj.type == 'directory'?'thư mục':'file') + ' [' + currentObj.name + ']');*/
    97                         }
    98                        
    99                         var showMoveModal = function () {
    100                                 $(o.movemodal).modal('show');
     98                                $(o.copymodal).find('INPUT#txtSelectedObj').val(obj.name);
     99                                $(o.copymodal).find('.modal-header').text(modalTitle);
     100                                $(o.copymodal).find('.btn-primary').empty();
     101                                $(o.copymodal).find('.btn-primary').append(submitIcon + "\n" + submitTitle);
     102                               
     103                                var selectTree = $(o.copymodal).find('#select-destination-tree').violetTree({
     104                                        container: $('#select-destination-tree'),
     105                                        expandEasing: 'easeOutBounce',
     106                                        collapseEasing: 'easeOutBounce',
     107                                        homeDirNameDisplay: "Thư mục gốc",
     108                                        contextmenuON: false
     109                                });
     110                               
     111                                $(o.copymodal).find('.btn-primary').button().click(function() {excuteCopy(obj, selectTree, action)})
     112                               
     113                                $(o.copymodal).on('hide.bs.modal', function () {
     114                                        $(o.copymodal).find('.btn-primary').unbind('click');
     115                                });
     116                        }
     117                       
     118                        var excuteCopy = function (obj, tree, action) {
     119                                var destObj = tree.getSelectedObj();
     120                                //alert(action + ' ' + obj.type + ' ' + obj.name + ' to ' + destObj.type + ' ' + destObj.name);
     121                               
     122                                //sendCommand
     123                                var postdata = {sourceid:obj.id,
     124                                                sourcetype:obj.type,
     125                                                destid: destObj.id,
     126                                                desttype: destObj.type,
     127                                                flag:action}
     128                               
     129                                sendCommand({
     130                                        script:'ajax/privatecontent/copy',
     131                                        postdata:postdata,
     132                                        callbackSuccess: function (parsedData) {
     133                                                if (parsedData.RESULT == true) {
     134                                                        //please add code here
     135                                                }else return false;
     136                                        }
     137                                });
    101138                        }
    102139
     
    117154                                currentObj.id = $(i).attr('rel').substring(3);
    118155                                currentObj.type = $(i).find('>div>div').hasClass('icon-directory') ? 'directory':'file';
    119                                 console.log(currentObj.type);
    120156                        }
    121157
     
    229265                        }
    230266                       
    231                         this.showModal = function (act, obj) {
     267                        this.showModal = function (obj, act) {
    232268                                switch( act ) {
    233269                                        case 'copy':
    234                                                 break;
    235                                         case 'move':
     270                                        case 'cut':
     271                                                showCopyModal(obj, act);
    236272                                                break;
    237273                                        case 'share':
Note: See TracChangeset for help on using the changeset viewer.