Changeset 7020


Ignore:
Timestamp:
Nov 19, 2015, 10:54:31 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

Fixes #1969: Can't remove user/group/project from a shared item

Send a custom event 'base-removed' to the list when an item is removed so that it is possible to set the (permission) value to 0.

Location:
branches/3.6-stable/www
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/3.6-stable/www/common/share/share.js

    r6576 r7020  
    5252    Buttons.addClickHandler('btnAddPermissionTemplates', share.addPermissionTemplates);
    5353    Events.addEventHandler('btnAddPermissionTemplates', 'base-selected', share.addPermissionTemplateCallback);
     54    Events.addEventHandler('members', 'base-removed', share.itemRemoved);
    5455
    5556    // Permission checkboxes
     
    142143    event.detail.name += ' ['+permissionString+']';
    143144    event.detail.value = permissionCode;
     145    event.detail.originalValue = 0;
    144146   
    145147    Link.addItem('members', 'USER', event.detail);
     
    175177    event.detail.name += ' ['+permissionString+']';
    176178    event.detail.value = permissionCode;
     179    event.detail.originalValue = 0;
    177180   
    178181    Link.addItem('members', 'GROUP', event.detail);
     
    203206    event.detail.name += ' ['+permissionString+']';
    204207    event.detail.value = permissionCode;
     208    event.detail.originalValue = 0;
    205209   
    206210    Link.addItem('members', 'PROJECT', event.detail);
     
    233237  }
    234238
     239  /**
     240    Set the permission value to 0 when an item is removed
     241  */
     242  share.itemRemoved = function(event)
     243  {
     244    event.detail.item.value = 0;
     245  }
     246 
    235247  /**
    236248    Get a textual description of the permissions that are included in
  • branches/3.6-stable/www/include/scripts/linkitems-2.js

    r6880 r7020  
    104104        'action': link.ADD,
    105105        'value': item.value,
    106         'originalValue': item.value
     106        'originalValue': item.originalValue != undefined ? item.originalValue : item.value
    107107        };
    108108     
     
    167167        item.value = item.originalValue;
    168168        item.option = null;
     169        Events.sendCustomEvent(list, 'base-removed', list[i]);
    169170        list[i--] = null;
    170171      }
  • branches/3.6-stable/www/my_base/projects/projects.js

    r6412 r7020  
    5656      Events.addEventHandler('btnAddGroups', 'base-selected', projects.addGroupCallback);
    5757      Events.addEventHandler('members', 'change', projects.membersOnChange);
    58      
     58      Events.addEventHandler('members', 'base-removed', projects.memberRemoved);
     59   
    5960      // Permissions
    6061      Events.addEventHandler('read', 'click', projects.permissionsOnClick);
     
    275276    event.detail.name += ' ['+permissionString+']';
    276277    event.detail.value = permissionCode;
     278    event.detail.originalValue = 0;
    277279   
    278280    Link.addItem('members', 'USER', event.detail);
     
    302304    event.detail.name += ' ['+permissionString+']';
    303305    event.detail.value = permissionCode;
     306    event.detail.originalValue = 0;
    304307   
    305308    Link.addItem('members', 'GROUP', event.detail);
     309  }
     310
     311  /**
     312    Set the permission value to 0 when an item is removed
     313  */
     314  projects.memberRemoved = function(event)
     315  {
     316    event.detail.item.value = 0;
    306317  }
    307318
Note: See TracChangeset for help on using the changeset viewer.