Changeset 9b3fdc2 in github


Ignore:
Timestamp:
Mar 19, 2010 7:20:12 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
02f7cb8
Parents:
f093291
Message:
  • Implemented messages copying using drag&drop + SHIFT (#1484086)
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r15e00bd r9b3fdc2  
    22=========================== 
    33 
     4- Implemented messages copying using drag&drop + SHIFT (#1484086) 
    45- Improved performance of folders operations (#1486525) 
    56- Fix blocked.gif attachment is not attached to the message (#1486516) 
  • program/include/rcube_imap.php

    r15e00bd r9b3fdc2  
    22032203    $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
    22042204 
     2205    // convert the list of uids to array 
     2206    $a_uids = is_string($uids) ? explode(',', $uids) : (is_array($uids) ? $uids : NULL); 
     2207 
     2208    // exit if no message uids are specified 
     2209    if (!is_array($a_uids) || empty($a_uids)) 
     2210      return false; 
     2211 
    22052212    // make sure mailbox exists 
    22062213    if ($to_mbox != 'INBOX' && !$this->mailbox_exists($tbox)) 
     
    22112218        return false; 
    22122219      } 
    2213  
    2214     // convert the list of uids to array 
    2215     $a_uids = is_string($uids) ? explode(',', $uids) : (is_array($uids) ? $uids : NULL); 
    2216  
    2217     // exit if no message uids are specified 
    2218     if (!is_array($a_uids) || empty($a_uids)) 
    2219       return false; 
    22202220 
    22212221    // flag messages as read before moving them 
     
    22672267 
    22682268    return $moved; 
     2269  } 
     2270 
     2271 
     2272  /** 
     2273   * Copy a message from one mailbox to another 
     2274   * 
     2275   * @param string List of UIDs to copy, separated by comma 
     2276   * @param string Target mailbox 
     2277   * @param string Source mailbox 
     2278   * @return boolean True on success, False on error 
     2279   */ 
     2280  function copy_message($uids, $to_mbox, $from_mbox='') 
     2281  { 
     2282    $fbox = $from_mbox; 
     2283    $tbox = $to_mbox; 
     2284    $to_mbox = $this->mod_mailbox($to_mbox); 
     2285    $from_mbox = $from_mbox ? $this->mod_mailbox($from_mbox) : $this->mailbox; 
     2286 
     2287    // convert the list of uids to array 
     2288    $a_uids = is_string($uids) ? explode(',', $uids) : (is_array($uids) ? $uids : NULL); 
     2289 
     2290    // exit if no message uids are specified 
     2291    if (!is_array($a_uids) || empty($a_uids)) 
     2292      return false; 
     2293 
     2294    // make sure mailbox exists 
     2295    if ($to_mbox != 'INBOX' && !$this->mailbox_exists($tbox)) 
     2296      { 
     2297      if (in_array($tbox, $this->default_folders)) 
     2298        $this->create_mailbox($tbox, true); 
     2299      else 
     2300        return false; 
     2301      } 
     2302 
     2303    // copy messages 
     2304    $iil_copy = iil_C_Copy($this->conn, join(',', $a_uids), $from_mbox, $to_mbox); 
     2305    $copied = !($iil_copy === false || $iil_copy < 0); 
     2306 
     2307    if ($copied) { 
     2308      $this->_clear_messagecount($to_mbox); 
     2309    } 
     2310 
     2311    return $copied; 
    22692312  } 
    22702313 
  • program/include/rcube_template.php

    rfe7d78a r9b3fdc2  
    861861            $attrib['href'] = '#'; 
    862862        } 
    863         if ($command) { 
     863        if ($command && !$attrib['onclick']) { 
    864864            $attrib['onclick'] = sprintf( 
    865865                "return %s.command('%s','%s',this)", 
  • program/js/app.js

    rc16986b r9b3fdc2  
    198198        if (this.env.action=='show' || this.env.action=='preview') 
    199199          { 
    200           this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete', 
     200          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete', 
    201201            'open', 'mark', 'edit', 'viewsource', 'download', 'print', 'load-attachment', 'load-headers', true); 
    202202 
     
    673673        else if (this.task == 'addressbook' && this.drag_active) 
    674674          this.copy_contact(null, props); 
     675        break; 
     676 
     677      case 'copy': 
     678        if (this.task == 'mail') 
     679          this.copy_messages(props); 
    675680        break; 
    676681 
     
    11951200    // handle mouse release when dragging 
    11961201    if (this.drag_active && model && this.env.last_folder_target) { 
     1202      var mbox = model[this.env.last_folder_target].id; 
     1203 
    11971204      $(this.get_folder_li(this.env.last_folder_target)).removeClass('droptarget'); 
    1198       this.command('moveto', model[this.env.last_folder_target].id); 
    11991205      this.env.last_folder_target = null; 
    12001206      list.draglayer.hide(); 
     1207 
     1208      if (!this.drag_menu(e, mbox)) 
     1209        this.command('moveto', mbox); 
    12011210    } 
    12021211     
     
    12081217      this.buttons_sel = {}; 
    12091218    } 
     1219  }; 
     1220 
     1221  this.drag_menu = function(e, mbox) 
     1222  { 
     1223    var modkey = rcube_event.get_modifier(e); 
     1224    var menu = $('#'+this.gui_objects.message_dragmenu); 
     1225 
     1226    if (menu && modkey == SHIFT_KEY) { 
     1227      var pos = rcube_event.get_mouse_pos(e); 
     1228      this.env.drag_mbox = mbox; 
     1229      menu.css({top: (pos.y-10)+'px', left: (pos.x-10)+'px'}).show(); 
     1230      return true; 
     1231    } 
     1232  }; 
     1233 
     1234  this.drag_menu_action = function(action) 
     1235  { 
     1236    var menu = $('#'+this.gui_objects.message_dragmenu); 
     1237    if (menu) { 
     1238      menu.hide(); 
     1239    } 
     1240    this.command(action, this.env.drag_mbox); 
     1241    this.env.drag_mbox = null; 
    12101242  }; 
    12111243 
     
    13901422      this.enable_command('reply', 'reply-all', 'forward', false); 
    13911423      this.enable_command('show', 'print', 'open', 'edit', 'download', 'viewsource', selected); 
    1392       this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false)); 
     1424      this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); 
    13931425      } 
    13941426    else 
    13951427      { 
    13961428      this.enable_command('show', 'reply', 'reply-all', 'forward', 'print', 'edit', 'open', 'download', 'viewsource', selected); 
    1397       this.enable_command('delete', 'moveto', 'mark', (list.selection.length > 0 ? true : false)); 
     1429      this.enable_command('delete', 'moveto', 'copy', 'mark', (list.selection.length > 0 ? true : false)); 
    13981430      } 
    13991431 
     
    21202152    else 
    21212153      $(row.obj).removeClass('unroot'); 
     2154    }; 
     2155 
     2156  // copy selected messages to the specified mailbox 
     2157  this.copy_messages = function(mbox) 
     2158    { 
     2159    // exit if current or no mailbox specified or if selection is empty 
     2160    if (!mbox || mbox == this.env.mailbox || (!this.env.uid && (!this.message_list || !this.message_list.get_selection().length))) 
     2161      return; 
     2162 
     2163    var add_url = '&_target_mbox='+urlencode(mbox)+'&_from='+(this.env.action ? this.env.action : ''); 
     2164    var a_uids = new Array(); 
     2165 
     2166    if (this.env.uid) 
     2167      a_uids[0] = this.env.uid; 
     2168    else 
     2169    { 
     2170      var selection = this.message_list.get_selection(); 
     2171      var id; 
     2172      for (var n=0; n<selection.length; n++) { 
     2173        id = selection[n]; 
     2174        a_uids[a_uids.length] = id; 
     2175      } 
     2176    } 
     2177 
     2178    // send request to server 
     2179    this.http_post('copy', '_uid='+a_uids.join(',')+'&_mbox='+urlencode(this.env.mailbox)+add_url, false); 
    21222180    }; 
    21232181 
     
    46264684            this.show_contentframe(false); 
    46274685          // disable commands useless when mailbox is empty 
    4628           this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'delete',  
     4686          this.enable_command('show', 'reply', 'reply-all', 'forward', 'moveto', 'copy', 'delete',  
    46294687            'mark', 'viewsource', 'open', 'edit', 'download', 'print', 'load-attachment',  
    46304688            'purge', 'expunge', 'select-all', 'select-none', 'sort', 
  • program/localization/en_US/labels.inc

    rf52c936f r9b3fdc2  
    6060$labels['messagenrof'] = 'Message $nr of $count'; 
    6161 
     62$labels['copy']     = 'Copy'; 
     63$labels['move']     = 'Move'; 
    6264$labels['moveto']   = 'Move to...'; 
    6365$labels['download'] = 'Download'; 
  • program/localization/en_US/messages.inc

    re4acbbd r9b3fdc2  
    8787$messages['errorsavingcontact'] = 'Could not save the contact address'; 
    8888$messages['movingmessage'] = 'Moving message...'; 
     89$messages['copyingmessage'] = 'Copying message...'; 
    8990$messages['receiptsent'] = 'Successfully sent a read receipt'; 
    9091$messages['errorsendingreceipt'] = 'Could not send the receipt'; 
  • program/localization/pl_PL/labels.inc

    r71e7545 r9b3fdc2  
    5454$labels['messagenrof'] = 'Wiadomość $nr z $count'; 
    5555$labels['moveto'] = 'Przenieś do...'; 
     56$labels['move'] = 'Przenieś'; 
     57$labels['copy'] = 'Kopiuj'; 
    5658$labels['download'] = 'Pobierz'; 
    5759$labels['filename'] = 'Nazwa pliku'; 
  • program/localization/pl_PL/messages.inc

    r71e7545 r9b3fdc2  
    77 |                                                                       | 
    88 | Language file of the RoundCube Webmail client                         | 
    9  | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland                 | 
     9 | Copyright (C) 2005-2010, RoundCube Dev. - Switzerland                 | 
    1010 | Licensed under the GNU GPL                                            | 
    1111 |                                                                       | 
     
    114114$messages['errorsavingcontact'] = 'Nie moÅŒna było zapisać adresu kontaktu'; 
    115115$messages['movingmessage'] = 'Przenoszenie wiadomości...'; 
     116$messages['copyingmessage'] = 'Kopiowanie wiadomości...'; 
    116117$messages['receiptsent'] = 'Pomyślnie wysłano potwierdzenie dostarczenia'; 
    117118$messages['errorsendingreceipt'] = 'Nie moÅŒna wysłać potwierdzenia'; 
  • program/steps/mail/func.inc

    r15e00bd r9b3fdc2  
    131131 
    132132  if (!$OUTPUT->ajax_call) 
    133     $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 'movingmessage'); 
     133    $OUTPUT->add_label('checkingmail', 'deletemessage', 'movemessagetotrash', 
     134      'movingmessage', 'copyingmessage', 'copy', 'move'); 
    134135 
    135136  $OUTPUT->set_pagetitle(rcmail_localize_foldername($mbox_name)); 
     
    14581459} 
    14591460 
    1460  
    14611461function rcmail_search_filter($attrib) 
    14621462{ 
     
    14901490  return $out;                                                                           
    14911491} 
     1492 
    14921493 
    14931494// register UI objects 
  • skins/default/common.css

    rc16986b r9b3fdc2  
    350350} 
    351351 
     352.popupmenu ul 
     353{ 
     354  margin: -4px 0; 
     355  padding: 0; 
     356  list-style: none; 
     357} 
     358 
     359.popupmenu ul li 
     360{ 
     361  font-size: 11px; 
     362  white-space: nowrap; 
     363  min-width: 100px; 
     364  margin: 3px -4px; 
     365} 
     366 
     367.popupmenu li a 
     368{ 
     369  display: block; 
     370  color: #a0a0a0; 
     371  padding: 2px 10px; 
     372  text-decoration: none; 
     373  min-height: 14px; 
     374} 
     375 
     376.popupmenu li a.active, 
     377.popupmenu li a.active:active, 
     378.popupmenu li a.active:visited 
     379{ 
     380  color: #333; 
     381} 
     382 
     383.popupmenu li a.active:hover 
     384{ 
     385  color: #fff; 
     386  background-color: #c00; 
     387} 
     388 
     389     
    352390 
    353391/***** common table settings ******/ 
  • skins/default/functions.js

    rf52c936f r9b3fdc2  
    126126  this.messagemenu = $('#messagemenu'); 
    127127  this.listmenu = $('#listmenu'); 
     128  this.dragmessagemenu = $('#dragmessagemenu'); 
    128129} 
    129130 
     
    260261  else if (this.messagemenu && this.messagemenu.is(':visible') && target != rcube_find_object('messagemenulink')) 
    261262    this.show_messagemenu(false); 
     263  else if (this.dragmessagemenu && this.dragmessagemenu.is(':visible') && !rcube_mouse_is_over(evt, rcube_find_object('dragmessagemenu'))) 
     264    this.dragmessagemenu.hide(); 
    262265  else if (this.listmenu && this.listmenu.is(':visible') && target != rcube_find_object('listmenulink')) { 
    263266    var menu = rcube_find_object('listmenu'); 
     
    291294    if (this.listmenu && this.listmenu.is(':visible')) 
    292295      this.show_listmenu(false); 
     296    if (this.dragmessagemenu && this.dragmessagemenu.is(':visible')) 
     297      this.dragmessagemenu.hide(); 
    293298  } 
    294299} 
     
    305310  rcmail.addEventListener('menu-open', 'open_listmenu', rcmail_ui); 
    306311  rcmail.addEventListener('menu-save', 'save_listmenu', rcmail_ui); 
    307 } 
     312  rcmail.gui_object('message_dragmenu', 'dragmessagemenu'); 
     313} 
  • skins/default/templates/mail.html

    rf52c936f r9b3fdc2  
    153153</div> 
    154154 
     155<div id="dragmessagemenu" class="popupmenu"> 
     156  <ul> 
     157    <li><roundcube:button command="moveto" onclick="return rcmail.drag_menu_action('moveto')" label="move" classAct="active" /></li> 
     158    <li><roundcube:button command="copy" onclick="return rcmail.drag_menu_action('copy')" label="copy" classAct="active" /></li> 
     159  </ul> 
     160</div> 
     161 
    155162<div id="listmenu" class="popupmenu"> 
    156163<fieldset class="thinbordered"><legend><roundcube:label name="listmode" /></legend> 
Note: See TracChangeset for help on using the changeset viewer.