svncommit
2006-06-29 a894ba5029a09fb9d0453b5cf9c944ce313f8a48
Removeable attachments, Auto-default folder creation, bug fixes

1 files added
15 files modified
152 ■■■■ changed files
CHANGELOG 9 ●●●●● patch | view | raw | blame | history
UPGRADING 1 ●●●● patch | view | raw | blame | history
index.php 2 ●●● patch | view | raw | blame | history
program/include/rcube_imap.inc 19 ●●●● patch | view | raw | blame | history
program/js/app.js 60 ●●●● patch | view | raw | blame | history
program/localization/it/labels.inc 4 ●●●● patch | view | raw | blame | history
program/localization/it/messages.inc 4 ●●●● patch | view | raw | blame | history
program/steps/mail/compose.inc 22 ●●●●● patch | view | raw | blame | history
program/steps/mail/func.inc 6 ●●●● patch | view | raw | blame | history
program/steps/mail/getunread.inc 4 ●●●● patch | view | raw | blame | history
program/steps/mail/move_del.inc 2 ●●● patch | view | raw | blame | history
program/steps/mail/upload.inc 6 ●●●●● patch | view | raw | blame | history
program/steps/settings/manage_folders.inc 4 ●●●● patch | view | raw | blame | history
skins/default/images/icons/remove-attachment.png patch | view | raw | blame | history
skins/default/mail.css 7 ●●●● patch | view | raw | blame | history
skins/default/templates/compose.html 2 ●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,15 @@
CHANGELOG RoundCube Webmail
---------------------------
2006/06/29 (richs)
----------
- Added ability to remove attachments (Feature #1436721)
- Default folders are now auto-created on first login (Feature #1471594)
- Fixed compatibility with folder apostrophes (e.g.: Joe's Folder) (Bug #1429458)
- Corrected Italian localizations
- Tweaked rename-folder form to clear after a rename
2006/06/26 (richs)
----------
- Added button to immediately check for new messages 
UPGRADING
@@ -123,6 +123,7 @@
  $rcmail_config['product_name'] = 'RoundCube Webmail';
  $rcmail_config['read_when_deleted'] = TRUE;
  $rcmail_config['enable_spellcheck'] = TRUE;
  $rcmail_config['protect_default_folders'] = TRUE;
- replace the following line from /config/main.inc.php
   @include($_SERVER['HTTP_HOST'].'.inc.php');
  with 
index.php
@@ -259,7 +259,7 @@
  if ($_action=='upload')
    include('program/steps/mail/upload.inc');
  if ($_action=='compose')
  if ($_action=='compose' || $_action=='remove-attachment')
    include('program/steps/mail/compose.inc');
  if ($_action=='addcontact')
program/include/rcube_imap.inc
@@ -362,13 +362,18 @@
    if (!is_array($a_folders) || !sizeof($a_folders))
      $a_folders = array();
    // create INBOX if it does not exist
    if (!in_array_nocase('INBOX', $a_folders))
    // create Default folders if they do not exist
    global $CONFIG;
    foreach ($CONFIG['default_imap_folders'] as $folder)
      {
      $this->create_mailbox('INBOX', TRUE);
      array_unshift($a_folders, 'INBOX');
      if (!in_array_nocase($folder, $a_folders))
        {
        $this->create_mailbox($folder, TRUE);
        $this->subscribe($folder);
        }
      }
    $a_folders = iil_C_ListSubscribed($this->conn, $this->_mod_mailbox($root), $filter);
    $a_mailbox_cache = array();
    // write mailboxlist to cache
@@ -991,6 +996,7 @@
  // append a mail message (source) to a specific mailbox
  function save_message($mbox_name, &$message)
    {
    $mbox_name = stripslashes($mbox_name);
    $mailbox = $this->_mod_mailbox($mbox_name);
    // make sure mailbox exists
@@ -1010,6 +1016,8 @@
  // move a message from one mailbox to another
  function move_message($uids, $to_mbox, $from_mbox='')
    {
    $to_mbox = stripslashes($to_mbox);
    $from_mbox = stripslashes($from_mbox);
    $to_mbox = $this->_mod_mailbox($to_mbox);
    $from_mbox = $from_mbox ? $this->_mod_mailbox($from_mbox) : $this->mailbox;
@@ -1067,6 +1075,7 @@
  // mark messages as deleted and expunge mailbox
  function delete_message($uids, $mbox_name='')
    {
    $mbox_name = stripslashes($mbox_name);
    $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
    // convert the list of uids to array
@@ -1114,6 +1123,7 @@
  // clear all messages in a specific mailbox
  function clear_mailbox($mbox_name=NULL)
    {
    $mbox_name = stripslashes($mbox_name);
    $mailbox = !empty($mbox_name) ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
    $msg_count = $this->_messagecount($mailbox, 'ALL');
    
@@ -1140,6 +1150,7 @@
  // send IMAP expunge command and clear cache
  function expunge($mbox_name='', $clear_cache=TRUE)
    {
    $mbox_name = stripslashes($mbox_name);
    $mailbox = $mbox_name ? $this->_mod_mailbox($mbox_name) : $this->mailbox;
    return $this->_expunge($mailbox, $clear_cache);
    }
program/js/app.js
@@ -143,7 +143,7 @@
        if (this.env.action=='compose')
          {
          this.enable_command('add-attachment', 'send-attachment', 'send', true);
          this.enable_command('add-attachment', 'send-attachment', 'remove-attachment', 'send', true);
          if (this.env.spellcheck)
            this.enable_command('spellcheck', true);
      if (this.env.drafts_mailbox)
@@ -945,6 +945,10 @@
      case 'send-attachment':
        this.upload_file(props)      
        break;
      case 'remove-attachment':
        this.remove_attachment(props);
        break;
      case 'reply-all':
      case 'reply':
@@ -1347,8 +1351,6 @@
      {
      if (this.env.mailbox==this.env.drafts_mailbox)
    {
    //alert(this.env.mailbox);
    //this.disable_command('reply', 'reply-all', 'forward', 'print', 'moveto');
    this.enable_command('show', selected);
    this.enable_command('delete', this.selection.length>0 ? true : false);
        }
@@ -1669,7 +1671,6 @@
      lock = true;
      this.set_busy(true, 'movingmessage');
      }
    // send request to server
    this.http_request('moveto', '_uid='+a_uids.join(',')+'&_mbox='+escape(this.env.mailbox)+'&_target_mbox='+escape(mbox)+'&_from='+(this.env.action ? this.env.action : ''), lock);
    };
@@ -2095,17 +2096,36 @@
  // add file name to attachment list
  // called from upload page
  this.add2attachment_list = function(name)
  this.add2attachment_list = function(name,content)
    {
    if (!this.gui_objects.attachmentlist)
      return false;
      
    var li = document.createElement('LI');
    li.innerHTML = name;
    li.id = name;
    li.innerHTML = content;
    this.gui_objects.attachmentlist.appendChild(li);
    return true;
    };
  this.remove_from_attachment_list = function(name)
    {
    if (!this.gui_objects.attachmentlist)
      return false;
    var list = this.gui_objects.attachmentlist.getElementsByTagName("li");
    for (i=0;i<list.length;i++)
      if (list[i].id == name)
    this.gui_objects.attachmentlist.removeChild(list[i]);
    }
  this.remove_attachment = function(name)
    {
    if (name)
      this.http_request('remove-attachment', '_filename='+escape(name));
    return true;
    }
  // send remote request to add a new contact
  this.add_contact = function(value)
@@ -2621,8 +2641,7 @@
    if (oldname && newname)
      this.http_request('rename-folder', '_folder_oldname='+escape(oldname)+'&_folder_newname='+escape(newname));
    else if (form.elements['_folder_newname'])
      form.elements['_folder_newname'].focus();
    };
@@ -2658,6 +2677,7 @@
          }
        }
      }
      form.elements['_folder_newname'].value='';
    };
@@ -2721,16 +2741,25 @@
   // add a new folder to the subscription list by cloning a folder row
   this.add_folder_row = function(name)
     {
     name = name.replace('\\',"");
     if (!this.gui_objects.subscriptionlist)
       return false;
     var tbody = this.gui_objects.subscriptionlist.tBodies[0];
     var id = tbody.childNodes.length+1;
     // clone a table row
     var row = this.clone_table_row(tbody.rows[0]);
     row.id = 'rcmrow'+id;
     tbody.appendChild(row);
     if (!tbody.rows[0])
       {
       // Refresh to create the first table row
       location.href = this.env.comm_path+'&_action=folders';
       }
     else
       {
       // clone a table row if there are existing rows
       var row = this.clone_table_row(tbody.rows[0]);
       row.id = 'rcmrow'+id;
       tbody.appendChild(row);
       }
     // add to folder/row-ID map
     this.env.subscriptionrows[row.id] = name;
@@ -2743,15 +2772,14 @@
       row.cells[1].firstChild.checked = true;
       }
     if (row.cells[2].firstChild.tagName=='A')
       row.cells[2].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name+"')");
       row.cells[2].firstChild.onclick = new Function(this.ref+".command('delete-folder','"+name.replace('\'','\\\'')+"')");
     var form;
     if ((form = this.gui_objects.editform) && form.elements['_folder_name'])
       form.elements['_folder_name'].value = '';
 
     // add new folder to rename-folder list
     if (form.elements['_folder_oldname'])
       form.elements['_folder_oldname'].options[form.elements['_folder_oldname'].options.length] = new Option(name,name);
     form.elements['_folder_oldname'].options[form.elements['_folder_oldname'].options.length] = new Option(name,name);
     };
program/localization/it/labels.inc
@@ -91,7 +91,7 @@
$labels['today'] = 'Oggi';
// toolbar buttons
$labels['checkmail']        = 'Controllando per vedere se c'è nuovi messaggi';
$labels['checkmail']        = 'Controllo per vedere se ci sono nuovi messaggi';
$labels['writenewmessage']  = 'Scrivi un nuovo messaggio';
$labels['replytomessage']   = 'Rispondi al messaggio';
$labels['replytoallmessage'] = 'Rispondi a tutti';
@@ -203,4 +203,4 @@
$labels['sortdesc'] = 'Ordinamento discendente';
?>
?>
program/localization/it/messages.inc
@@ -36,7 +36,7 @@
$messages['loadingdata'] = 'Caricamento dati...';
$messages['checkingmail'] = 'Controllando per vedere se c'è nuovi messaggi...';
$messages['checkingmail'] = 'Controllo per vedere se ci sono nuovi messaggi...';
$messages['sendingmessage'] = 'Invio messaggio in corso...';
@@ -95,4 +95,4 @@
$messages['nosearchname'] = 'Per favore, immetti un nome o un indirizzo e-mail';
?>
?>
program/steps/mail/compose.inc
@@ -32,6 +32,20 @@
if (!is_array($_SESSION['compose']))
  $_SESSION['compose'] = array('id' => uniqid(rand()));
// remove an attachment
if ($_action=='remove-attachment' && !empty($_GET['_filename']))
  {
  if (is_array($_SESSION['compose']['attachments']))
    foreach ($_SESSION['compose']['attachments'] as $i => $attachment)
      if ($attachment['name'] == $_GET['_filename'])
        {
        @unlink($attachment['path']);
        unset($_SESSION['compose']['attachments'][$i]);
        $commands = sprintf("parent.%s.remove_from_attachment_list('%s');\n", $JS_OBJECT_NAME, $_GET['_filename']);
        rcube_remote_response($commands);
        exit;
        }
  }
// add some labels to client
rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'savingmessage', 'messagesaved');
@@ -611,8 +625,13 @@
  
  if (is_array($_SESSION['compose']['attachments']))
    {
    if ($attrib['deleteicon'])
      $button = sprintf('<img src="%s%s" alt="%s" border="0" / style="padding-right:2px;vertical-align:middle">', $CONFIG['skin_path'], $attrib['deleteicon'], rcube_label('delete'));
    else
      $button = rcube_label('delete');
    foreach ($_SESSION['compose']['attachments'] as $i => $a_prop)
      $out .= sprintf("<li>%s</li>\n", $a_prop['name']);
      $out .= sprintf('<li id="%s"><a href="#" onclick="%s.command(\'remove-attachment\',\'%s\')" title="%s">%s</a>%s</li>', $a_prop['name'], $JS_OBJECT_NAME, $a_prop['name'], rcube_label('deletefolder'),  $button, $a_prop['name']);
    }
  $OUTPUT->add_script(sprintf("%s.gui_object('attachmentlist', '%s');", $JS_OBJECT_NAME, $attrib['id']));  
@@ -662,7 +681,6 @@
  $out = '<input type="file" name="_attachments[]"'. $attrib_str . " />";
  return $out;
  }
function rcmail_priority_selector($attrib)
  {
program/steps/mail/func.inc
@@ -220,13 +220,13 @@
                    $class_name,
                    $zebra_class,
                    $unread_count ? ' unread' : '',
                    $folder['id']==$mbox_name ? ' selected' : '',
                    addslashes($folder['id'])==addslashes($mbox_name) ? ' selected' : '',
                    $COMM_PATH,
                    urlencode($folder['id']),
                    $JS_OBJECT_NAME,
                    $folder['id'],
                    addslashes($folder['id']),
                    $JS_OBJECT_NAME,
                    $folder['id'],
                    addslashes($folder['id']),
                    $title,
                    rep_specialchars_output($foldername, 'html', 'all'));
program/steps/mail/getunread.inc
@@ -27,10 +27,10 @@
  {
  foreach ($a_folders as $mbox_row)
    {
    $commands = sprintf("this.set_unread_count('%s', %d);\n", $mbox_row, $IMAP->messagecount($mbox_row, 'UNSEEN'));
    $commands = sprintf("this.set_unread_count('%s', %d);\n", addslashes($mbox_row), $IMAP->messagecount($mbox_row, 'UNSEEN'));
    rcube_remote_response($commands, TRUE);
    }
  }
exit;
?>
?>
program/steps/mail/move_del.inc
@@ -88,4 +88,4 @@
rcube_remote_response($commands);
exit;
?>
?>
program/steps/mail/upload.inc
@@ -45,7 +45,9 @@
                                                  'mimetype' => $_FILES['_attachments']['type'][$i],
                                                  'path' => $tmpfname);
    $response .= sprintf("parent.%s.add2attachment_list('%s');\n", $JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i]);
    $button = sprintf('<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle">', $CONFIG['skin_path'], rcube_label('delete'));
    $content = sprintf('<a href="#" onclick="%s.command(\\\'remove-attachment\\\',\\\'%s\\\')" title="%s">%s</a>%s',$JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i], rcube_label('deletefolder'), $button, $_FILES['_attachments']['name'][$i]);
    $response .= sprintf('parent.%s.add2attachment_list(\'%s\',\'%s\');',$JS_OBJECT_NAME, $_FILES['_attachments']['name'][$i], $content);
    }
  }
@@ -64,4 +66,4 @@
EOF;
exit;
?>
?>
program/steps/settings/manage_folders.inc
@@ -71,8 +71,8 @@
  if ($rename && $REMOTE_REQUEST)
    {
    $commands = sprintf("this.add_folder_row('%s');", rep_specialchars_output($rename, 'js'));
    $commands .= sprintf("this.remove_folder_row('%s')", rep_specialchars_output($_GET['_folder_oldname'], 'js'));
    $commands = sprintf("this.add_folder_row('%s');\n", addslashes(rep_specialchars_output($rename, 'js')));
    $commands .= sprintf("this.remove_folder_row('%s');", rep_specialchars_output($_GET['_folder_oldname'], 'js'));
    rcube_remote_response($commands);
    }
  else if (!$rename && $REMOTE_REQUEST)
skins/default/images/icons/remove-attachment.png
skins/default/mail.css
@@ -597,12 +597,11 @@
#attachment-list
{
  margin: 0px;
  padding: 0px 0px 0px 68px;
  padding: 0px 0px 0px 0px;
  height: 18px;
  list-style-image: none;
  list-style-type: none;
  background-color: #DFDFDF;
  background: url(images/icons/attachment.png) no-repeat #DFDFDF;
  background-position: 52px 1px;
  border-bottom: 1px solid #FFFFFF;
}
@@ -818,11 +817,9 @@
{
  height: 18px;
  font-size: 11px;
  padding-left: 26px;
  padding-left: 2px;
  padding-top: 2px;
  padding-right: 4px;
  background: url(images/icons/attachment.png) no-repeat;
  background-position: 4px 1px;
  border-bottom: 1px solid #EBEBEB;
  white-space: nowrap;
  overflow: hidden;
skins/default/templates/compose.html
@@ -112,7 +112,7 @@
<div id="compose-attachments">
<div><roundcube:label name="attachments" /></div>
<roundcube:object name="composeAttachmentList" />
<roundcube:object name="composeAttachmentList" deleteIcon="/images/icons/remove-attachment.png"/ >
<p><roundcube:button command="add-attachment" imagePas="/images/buttons/add_pas.png" imageSel="/images/buttons/add_sel.png" imageAct="/images/buttons/add_act.png" width="23" height="18" title="addattachment" />
</div>