Changeset ca38db5 in github


Ignore:
Timestamp:
Jun 1, 2010 2:11:57 PM (3 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
5800fb6
Parents:
bb50290
Message:

Allow to drag into groups of another address source

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • program/js/app.js

    r8e32dcd rca38db5  
    12441244      var moffset = this.initialListScrollTop-this.gui_objects.folderlist.parentNode.scrollTop; 
    12451245      var toffset = -moffset-boffset; 
    1246       var li, div, pos, mouse; 
     1246      var li, div, pos, mouse, check, oldclass, 
     1247        layerclass = 'draglayernormal'; 
     1248       
     1249      if (this.contact_list && this.contact_list.draglayer) 
     1250        oldclass = this.contact_list.draglayer.attr('class'); 
    12471251 
    12481252      mouse = rcube_event.get_mouse_pos(e); 
     
    12571261          this.env.last_folder_target = null; 
    12581262        } 
     1263        if (layerclass != oldclass && this.contact_list && this.contact_list.draglayer) 
     1264          this.contact_list.draglayer.attr('class', layerclass); 
    12591265        return; 
    12601266      } 
     
    12641270        pos = this.env.folder_coords[k]; 
    12651271        if (mouse.x >= pos.x1 && mouse.x < pos.x2 && mouse.y >= pos.y1 && mouse.y < pos.y2){ 
    1266          if (this.check_droptarget(k)) { 
     1272         if ((check = this.check_droptarget(k))) { 
    12671273            li = this.get_folder_li(k); 
    12681274            div = $(li.getElementsByTagName('div')[0]); 
     
    12871293            this.env.folder_coords[k].on = 1; 
    12881294            this.env.last_folder_target = k; 
     1295            layerclass = 'draglayer' + (check > 1 ? 'copy' : 'normal'); 
    12891296          } else { // Clear target, otherwise drag end will trigger move into last valid droptarget 
    12901297            this.env.last_folder_target = null; 
     
    12961303        } 
    12971304      } 
     1305       
     1306      if (layerclass != oldclass && this.contact_list && this.contact_list.draglayer) 
     1307        this.contact_list.draglayer.attr('class', layerclass); 
    12981308    } 
    12991309  }; 
     
    15101520  this.check_droptarget = function(id) 
    15111521  { 
     1522    var allow = false, copy = false; 
     1523     
    15121524    if (this.task == 'mail') 
    1513       return (this.env.mailboxes[id] && this.env.mailboxes[id].id != this.env.mailbox && !this.env.mailboxes[id].virtual); 
    1514     else if (this.task == 'addressbook') 
    1515       return (id != this.env.source && this.env.contactfolders[id] && !this.env.contactfolders[id].readonly && 
    1516         !(!this.env.source && this.env.contactfolders[id].group) && 
    1517         !(this.env.contactfolders[id].type == 'group' && this.env.contactfolders[this.env.source].readonly) && 
    1518         !(this.env.contactfolders[id].type == 'group' && this.env.contactfolders[id].source != this.env.source) && 
    1519         !(this.env.contactfolders[id].type == 'group' && this.env.contactfolders[id].id == this.env.group)); 
     1525      allow = (this.env.mailboxes[id] && this.env.mailboxes[id].id != this.env.mailbox && !this.env.mailboxes[id].virtual); 
    15201526    else if (this.task == 'settings') 
    1521       return (id != this.env.folder); 
     1527      allow = (id != this.env.folder); 
     1528    else if (this.task == 'addressbook') { 
     1529      if (id != this.env.source && this.env.contactfolders[id]) { 
     1530        if (this.env.contactfolders[id].type == 'group') { 
     1531          var target_abook = this.env.contactfolders[id].source; 
     1532          allow = this.env.contactfolders[id].id != this.env.group && !this.env.contactfolders[target_abook].readonly; 
     1533          copy = target_abook != this.env.source; 
     1534        } 
     1535        else { 
     1536          allow = !this.env.contactfolders[id].readonly; 
     1537          copy = true; 
     1538        } 
     1539      } 
     1540    } 
     1541     
     1542    return allow ? (copy ? 2 : 1) : 0; 
    15221543  }; 
    15231544 
     
    36343655      cid = this.contact_list.get_selection().join(','); 
    36353656 
    3636     if (to.type == 'group') 
    3637       this.http_post('group-addmembers', '_cid='+urlencode(cid)+'&_source='+urlencode(this.env.source)+'&_gid='+urlencode(to.id)); 
    3638     else if (to.id != this.env.source && cid && this.env.address_sources[to.id] && !this.env.address_sources[to.id].readonly) 
    3639       this.http_post('copy', '_cid='+urlencode(cid)+'&_source='+urlencode(this.env.source)+'&_to='+urlencode(to.id)+(this.env.group ? '&_gid='+urlencode(this.env.group) : '')); 
     3657    if (to.type == 'group' && to.source == this.env.source) { 
     3658      this.http_post('group-addmembers', '_cid='+urlencode(cid) 
     3659        + '&_source='+urlencode(this.env.source) 
     3660        + '&_gid='+urlencode(to.id)); 
     3661    } 
     3662    else if (to.type == 'group' && !this.env.address_sources[to.source].readonly) { 
     3663      this.http_post('copy', '_cid='+urlencode(cid) 
     3664        + '&_source='+urlencode(this.env.source) 
     3665        + '&_to='+urlencode(to.source) 
     3666        + '&_togid='+urlencode(to.id) 
     3667        + (this.env.group ? '&_gid='+urlencode(this.env.group) : '')); 
     3668    } 
     3669    else if (to.id != this.env.source && cid && this.env.address_sources[to.id] && !this.env.address_sources[to.id].readonly) { 
     3670      this.http_post('copy', '_cid='+urlencode(cid) 
     3671        + '&_source='+urlencode(this.env.source) 
     3672        + '&_to='+urlencode(to.id) 
     3673        + (this.env.group ? '&_gid='+urlencode(this.env.group) : '')); 
     3674    } 
    36403675  }; 
    36413676 
  • program/steps/addressbook/copy.inc

    re095094 rca38db5  
    2626$cid = get_input_value('_cid', RCUBE_INPUT_POST); 
    2727$target = get_input_value('_to', RCUBE_INPUT_POST); 
     28$target_group = get_input_value('_togid', RCUBE_INPUT_POST); 
    2829 
    2930if ($cid && preg_match('/^[a-z0-9\-_=]+(,[a-z0-9\-_=]+)*$/i', $cid) && strlen($target) && $target !== $source) 
     
    3334 
    3435  if ($TARGET && $TARGET->ready && !$TARGET->readonly) { 
     36    if ($target_group && $TARGET->groups) 
     37      $TARGET->set_group($target_group); 
     38     
    3539    $arr_cids = explode(',', $cid); 
    3640    foreach ($arr_cids as $cid) { 
    37       $plugin = $RCMAIL->plugins->exec_hook('create_contact', array('record' => $CONTACTS->get_record($cid, true), 'source' => $target)); 
    38     $a_record = $plugin['record']; 
     41      $plugin = $RCMAIL->plugins->exec_hook('create_contact', array( 
     42        'record' => $CONTACTS->get_record($cid, true), 
     43        'source' => $target, 
     44        'group' => $target_group, 
     45      )); 
     46      $a_record = $plugin['record']; 
    3947 
    40     if (!$plugin['abort']) 
     48      if (!$plugin['abort']) 
    4149        if ($TARGET->insert($a_record, true)) 
    4250          $success++; 
  • skins/default/common.css

    r35a39020 rca38db5  
    511511  font-size: 11px; 
    512512  white-space: nowrap; 
    513   opacity: 0.7; 
     513  opacity: 0.82; 
     514  border-radius: 3px; 
     515  -moz-border-radius: 3px; 
     516  -webkit-border-radius: 3px; 
     517  -moz-box-shadow: 1px 1px 12px #999; 
     518  -webkit-box-shadow: #999 1px 1px 12px; 
     519} 
     520 
     521.draglayernormal:before { 
     522   
     523} 
     524 
     525.draglayercopy:before { 
     526  position: absolute; 
     527  bottom: -5px; 
     528  left: -6px; 
     529  content: " "; 
     530  width: 14px; 
     531  height: 14px; 
     532  background: url(images/messageactions.png) -2px -128px no-repeat; 
    514533} 
    515534 
  • skins/default/ie6hacks.css

    r98ef63c rca38db5  
    7070  padding-bottom: 8px; 
    7171} 
     72 
     73.draglayercopy:before { 
     74  background-image: url(images/messageactions.png); 
     75} 
Note: See TracChangeset for help on using the changeset viewer.