diff options
author | svncommit <devs@roundcube.net> | 2006-06-29 23:41:40 +0000 |
---|---|---|
committer | svncommit <devs@roundcube.net> | 2006-06-29 23:41:40 +0000 |
commit | a894ba5029a09fb9d0453b5cf9c944ce313f8a48 (patch) | |
tree | 34ba2e7a2c82d680fb8d772568efa46a83967f98 | |
parent | ba8f44c4da7724f5e35866277e9775ec26616dc7 (diff) |
Removeable attachments, Auto-default folder creation, bug fixes
-rw-r--r-- | CHANGELOG | 9 | ||||
-rw-r--r-- | UPGRADING | 1 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | program/include/rcube_imap.inc | 19 | ||||
-rw-r--r-- | program/js/app.js | 60 | ||||
-rw-r--r-- | program/localization/it/labels.inc | 4 | ||||
-rw-r--r-- | program/localization/it/messages.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 22 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 6 | ||||
-rw-r--r-- | program/steps/mail/getunread.inc | 4 | ||||
-rw-r--r-- | program/steps/mail/move_del.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/upload.inc | 6 | ||||
-rw-r--r-- | program/steps/settings/manage_folders.inc | 4 | ||||
-rw-r--r-- | skins/default/images/icons/remove-attachment.png | bin | 0 -> 775 bytes | |||
-rw-r--r-- | skins/default/mail.css | 7 | ||||
-rw-r--r-- | skins/default/templates/compose.html | 2 |
16 files changed, 109 insertions, 43 deletions
@@ -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 @@ -123,6 +123,7 @@ form version 0.1-beta $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 @@ -259,7 +259,7 @@ if ($_task=='mail') 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') diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 16cfb522e..d825a35b0 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -362,13 +362,18 @@ class rcube_imap 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 @@ class rcube_imap // 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 @@ class rcube_imap // 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 @@ class rcube_imap // 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 @@ class rcube_imap // 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 @@ class rcube_imap // 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); } diff --git a/program/js/app.js b/program/js/app.js index c61c20a63..fb103bf43 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -143,7 +143,7 @@ function rcube_webmail() 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 @@ function rcube_webmail() 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 @@ function rcube_webmail() { 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 @@ function rcube_webmail() 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 @@ function rcube_webmail() // 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 @@ function rcube_webmail() 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 @@ function rcube_webmail() } } } + form.elements['_folder_newname'].value=''; }; @@ -2721,16 +2741,25 @@ function rcube_webmail() // 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 @@ function rcube_webmail() 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); }; diff --git a/program/localization/it/labels.inc b/program/localization/it/labels.inc index 0a080eafb..0f78e7014 100644 --- a/program/localization/it/labels.inc +++ b/program/localization/it/labels.inc @@ -91,7 +91,7 @@ $labels['saturday'] = 'Sabato'; $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['sortasc'] = 'Ordinamento ascendente'; $labels['sortdesc'] = 'Ordinamento discendente'; -?>
\ No newline at end of file +?> diff --git a/program/localization/it/messages.inc b/program/localization/it/messages.inc index ae3c81819..92b7013c3 100644 --- a/program/localization/it/messages.inc +++ b/program/localization/it/messages.inc @@ -36,7 +36,7 @@ $messages['loading'] = 'Caricamento...'; $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['nocontactsreturned'] = 'Nessun contatto trovato'; $messages['nosearchname'] = 'Per favore, immetti un nome o un indirizzo e-mail'; -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index ba80a54f1..6d4cf9a61 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -32,6 +32,20 @@ $DRAFT_MESSAGE = NULL; 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 @@ function rcmail_compose_attachment_list($attrib) 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'])); @@ -663,7 +682,6 @@ function rcmail_compose_attachment_field($attrib) return $out; } - function rcmail_priority_selector($attrib) { list($form_start, $form_end) = get_form_tags($attrib); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index eac4e3747..7e2b3b28d 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -220,13 +220,13 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m $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')); diff --git a/program/steps/mail/getunread.inc b/program/steps/mail/getunread.inc index 437e3aa00..ed4a5fb77 100644 --- a/program/steps/mail/getunread.inc +++ b/program/steps/mail/getunread.inc @@ -27,10 +27,10 @@ if (!empty($a_folders)) { 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; -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc index e4da207f4..116332a64 100644 --- a/program/steps/mail/move_del.inc +++ b/program/steps/mail/move_del.inc @@ -88,4 +88,4 @@ if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages) rcube_remote_response($commands); exit; -?>
\ No newline at end of file +?> diff --git a/program/steps/mail/upload.inc b/program/steps/mail/upload.inc index 4cd929d0d..7fe7d3dcc 100644 --- a/program/steps/mail/upload.inc +++ b/program/steps/mail/upload.inc @@ -45,7 +45,9 @@ foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) '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 @@ parent.$JS_OBJECT_NAME.show_attachment_form(false); EOF; exit; -?>
\ No newline at end of file +?> diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc index dd321f0d8..7274bdc50 100644 --- a/program/steps/settings/manage_folders.inc +++ b/program/steps/settings/manage_folders.inc @@ -71,8 +71,8 @@ else if ($_action=='rename-folder') 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) diff --git a/skins/default/images/icons/remove-attachment.png b/skins/default/images/icons/remove-attachment.png Binary files differnew file mode 100644 index 000000000..0712aaa71 --- /dev/null +++ b/skins/default/images/icons/remove-attachment.png diff --git a/skins/default/mail.css b/skins/default/mail.css index 808ab6ccb..4d54be31d 100644 --- a/skins/default/mail.css +++ b/skins/default/mail.css @@ -597,12 +597,11 @@ table.headers-table tr td.subject #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 @@ div.message-part pre { 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; diff --git a/skins/default/templates/compose.html b/skins/default/templates/compose.html index ab8b0ced0..bcb232fbc 100644 --- a/skins/default/templates/compose.html +++ b/skins/default/templates/compose.html @@ -112,7 +112,7 @@ self.setTimeout('rcmail_auto_save()',300000); <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> |