Ignore:
Timestamp:
Aug 7, 2014 5:37:02 PM (11 years ago)
Author:
dungnv
Message:
 
File:
1 edited

Legend:

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

    r42 r45  
    6565                                                        break;
    6666                                        }
    67                                        
    6867                                });
    6968                        }
     
    107106                                $('#box-newfolder').on('show.bs.modal', function () {
    108107                                        $('#box-newfolder').find('#frm-newfolder').get(0).reset();
     108                                       
     109                                });
     110                               
     111                                $('#box-newfolder').on('shown.bs.modal', function () {
     112                                        $('#box-newfolder').find('#frm-newfolder').find('#f-newfoldername').focus();
    109113                                });
    110114                               
     
    209213                        var searchItemByID = function (itemID, type) {
    210214                                var source = (type == 'directory') ? o.directoryTreeData.DIRECTORIES : (type == 'file') ? o.directoryTreeData.FILES : null;
    211                                 var item = null;
    212                                 for (var i = 0 ; i < source.length; i++) {
    213                                         if (source[i].id == itemID) {
    214                                                 item = source[i];
    215                                                 break;
    216                                         }
    217                                 }
     215                                var item = {};
     216                                if (itemID == 0) {
     217                                        item.id = 0;
     218                                        item.parentID = 0;
     219                                        item.name = 'Home';
     220                                }
     221                                else {
     222                                        for (var i = 0 ; i < source.length; i++) {
     223                                                if (source[i].id == itemID) {
     224                                                        item = source[i];
     225                                                        break;
     226                                                }
     227                                        }
     228                                }
     229                               
     230                                item.type = type;
    218231                                return item;
    219232                        }
     
    224237                                var childDir = o.directoryTreeData.DIRECTORIES;
    225238                                var childFile = o.directoryTreeData.FILES;
    226                                 var curentDirID = o.curentParent.substring(o.dirIDprefix.length, o.curentParent.length);
     239                                var currentDirID = o.curentParent.substring(o.dirIDprefix.length, o.curentParent.length);
     240                               
     241                                var disabledItemsList = ['preview','rename','copy','cut','delete','open'];
     242                                var item = searchItemByID(currentDirID,'directory');
     243                                console.log(item);
     244                                $(o.container).contextMenu({
     245                                        menu: 'gridMenuParent',
     246                                        disabledItems: disabledItemsList
     247                                }, function(action, el, pos) {
     248                                        switch(action) {
     249                                                case 'newfolder':
     250                                                        openNewFolderModal(item);
     251                                                        break;
     252                                                case 'share':
     253                                                        showShareModal(item);
     254                                                        break;
     255                                                default:
     256                                                        break;
     257                                        }
     258                                });
    227259                               
    228260                                for (var i = 0 ; i < childDir.length; i++) {
    229                                         if (childDir[i].parentID != curentDirID) continue;
     261                                        if (childDir[i].parentID != currentDirID) continue;
    230262                                        createNode ({
    231263                                                id: childDir[i].id,
    232264                                                name: childDir[i].name,
    233                                                 parentID: curentDirID,
     265                                                parentID: currentDirID,
    234266                                        });
    235267                                }
    236268                               
    237269                                for (var i = 0 ; i < childFile.length; i++) {
    238                                         if (childFile[i].parentID != curentDirID) continue;
     270                                        if (childFile[i].parentID != currentDirID) continue;
    239271                                        createNode ({
    240272                                                id: childFile[i].id,
    241273                                                name: childFile[i].name,
    242                                                 parentID: curentDirID,
     274                                                parentID: currentDirID,
    243275                                                minetype: childFile[i].minetype,
    244276                                        });
Note: See TracChangeset for help on using the changeset viewer.