[IMP] Creating folders - limit needed
Miroslaw Jaworski
mjaw@ipartners.pl
Wed, 13 Dec 2000 18:03:26 +0100
Hi
I've started to use Horde/IMP about 2 months ago.
It's used for free service - webmail accounts together with free
dialup access.
We made couple hundreds fixes, mostly to IMP; after hard work
period I'll be able to send more excerpts than this one.
Horde : 1.2.2
IMP : 2.2.2
Issue : creating IMAP folders
Problem: No IMP-side limit defined for folder names.
Long folder names cause :
- "select" list with subscribed folders in upper left
corner doesn't show ( BAD ) - no possibility to
choose a folder
- ugly looking folder view ( "select" on the right
side ( next to "move | copy " ) takes whole page
width, formatting is .......
- ugly looking directories on IMAP server ( something
admins dont like )
My solution :
- limit for created folder name
webmail# diff folders.php3 folders.php3.orig
77c77
< if
(!eregi("^[a-z0-9][a-z0-9_-]{1,9}$",$new_mailbox)) {
---
> if (!@imap_createmailbox($imp->stream, '{' . $imp->server . ':' . $imp->port . "}$preamble$new_mailbox")) {
79,86c79,82
< } else {
< if (!@imap_createmailbox($imp->stream,
'{' . $imp->server . ':' . $imp->port . "}$preamble$new_mailbox")) {
< $errormsg =
htmlentities($lang->create_folder_error);
< } else {
< if
($default->use_imap_subscribe) {
<
if(!@imap_subscribe($imp->stream, '{' . $imp->server . ':' . $imp->port
. "}$preamble$new_mailbox")) {
< $errormsg =
htmlentities($lang->subscribe_folder_error);
< }
---
> } else {
> if ($default->use_imap_subscribe) {
> if(!@imap_subscribe($imp->stream, '{' . $imp->server . ':' . $imp->port . "}$preamble$new_mailbox")) {
> $errormsg = htmlentities($lang->subscribe_folder_error);
89c85
< }
---
> }
- error messages in top frame ( status ) aren't quite visible - changed
immediate create folder action to javascript popup with info about the
limit ( also added $lang->confirm_create message string )
webmail# diff templates/folders/create.inc
templates/folders/create.inc.orig
2c2
< <form method="post" name="create" action="<?php $sess->pself_url() ?>"
onSubmit="return verifyCreate();">
---
> <form method="post" name="create" action="<?php $sess->pself_url() ?>">
24,32d23
<
< <script language="Javascript">
< <!--
< function verifyCreate () {
< return confirm("<?php echo addslashes($lang->confirm_create) ?>");
< }
< // -->
< </script>
<
webmail# diff locale/en/folders.lang locale/en/folders.lang.orig
15d14
< $lang->confirm_create = 'Remember, that folder name can be up to 10
characters long. Allowed characters : a-z,A-z and 0-9.';
Mirek