<?php
-
/**
* folders.php
*
/* switch to the right function based on what the user selected */
if ( sqgetGlobalVar('smaction', $action, SQ_POST) ) {
-
switch ($action)
{
case 'create':
}
+if (isset($td_str)) {
+ $oTemplate->assign('note', htmlspecialchars($td_str));
+ $oTemplate->display('note.tpl');
+}
+
$boxes = sqimap_mailbox_list($imapConnection,true);
/** CREATING FOLDERS **/
$rendel_folder_list = sqimap_mailbox_option_list($imapConnection, 0, $skip_folders, $boxes, NULL, true);
-$subbox_option_list = '';
+$subbox_option_list = array();
if ($show_only_subscribed_folders && !$no_list_for_subscribe) {
// FIXME: fix subscription options when top folder is not subscribed and sub folder is subscribed
+
// TODO: use checkboxes instead of select options.
+ // DONE Steve Brown 2006-08-08
/** SUBSCRIBE TO FOLDERS **/
$boxes_all = sqimap_mailbox_list_all ($imapConnection);
// so we keep only the unsubscribed ones.
foreach ($boxes_all as $box_a) {
- $use_folder = true;
- foreach ( $boxes as $box ) {
- if ($box_a['unformatted'] == $box['unformatted'] ||
- $box_a['unformatted-dm'] == $folder_prefix ) {
- $use_folder = false;
- }
- }
-
- if ($use_folder) {
- $box_enc = htmlspecialchars($box_a['unformatted-dm']);
- $box_disp = htmlspecialchars(imap_utf7_decode_local($box_a['unformatted-disp']));
- $subbox_option_list .= '<option value="' . $box_enc . '">'.$box_disp."</option>\n";
- }
+ $use_folder = true;
+ foreach ( $boxes as $box ) {
+ if ($box_a['unformatted'] == $box['unformatted'] ||
+ $box_a['unformatted-dm'] == $folder_prefix ) {
+ $use_folder = false;
+ }
+ }
+
+ if ($use_folder) {
+ $box_enc = htmlspecialchars($box_a['unformatted-dm']);
+ $box_disp = htmlspecialchars(imap_utf7_decode_local($box_a['unformatted-disp']));
+ $subbox_option_list[] = array( 'Value' => $box_enc, 'Display' => $box_disp);
+ }
}
}
sqimap_logout($imapConnection);
-$oTemplate->assign('td_str', @$td_str);
-$oTemplate->assign('color', $color);
+$oTemplate->assign('show_subfolders_option', $show_contain_subfolders_option);
+$oTemplate->assign('show_only_subscribed_folders', $show_only_subscribed_folders==1);
+$oTemplate->assign('no_list_for_subscribe', $no_list_for_subscribe);
+
$oTemplate->assign('mbx_option_list', $mbx_option_list);
-$oTemplate->assign('show_contain_subfolders_option', $show_contain_subfolders_option);
-$oTemplate->assign('show_only_subscribed_folders', $show_only_subscribed_folders);
$oTemplate->assign('rendel_folder_list', $rendel_folder_list);
$oTemplate->assign('subbox_option_list', $subbox_option_list);
-$oTemplate->assign('no_list_for_subscribe', $no_list_for_subscribe);
$oTemplate->display('folder_manip.tpl');
$oTemplate->display('footer.tpl');
-
+?>
\ No newline at end of file
*
* Template for folder management (create, rename, delete, (un)subscribe)
*
+ * The following variables are available in this template:
+ * + $mbx_option_list - string containing all mailboxes as <option>'s for
+ * use in <select>'s on this page.
+ * + $rendel_folder_list - string containing all mailboxes available for
+ * delete/rename as <option>'s for use in <select>'s
+ * on this page.
+ * + $show_subfolders_option - boolean TRUE if the a folder can contain
+ * subfolders in conf.pl > Folder Options
+ * + $show_only_subscribed_folders - boolean TRUE if the user only wants
+ * to see subscribed folders.
+ * + $no_list_for_subscribe = boolean TRUE if the subscribe list should NOT
+ * be displayed in conf.pl
+ * + $subbox_option_list - array containing a list of folders that can be
+ * subscribed to. Each array element contains an
+ * array with the following elements:
+ * $el['Value'] - encoded string for the VALUE
+ * field of an input element
+ * $el['Display'] - string containing the display
+ * name for the element
+ *
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
/* retrieve the template vars */
extract($t);
?>
-
-<br />
-<table bgcolor="<?php echo $color[0]; ?>" align="center" width="95%" cellpadding="1" cellspacing="0" border="0">
-<tr>
-<td align="center"><b><?php echo _("Folders"); ?></b>
-
-<table align="center" width="100%" cellpadding="5" cellspacing="0" border="0">
-<tr>
-<td bgcolor="<?php echo $color[4] ?>" align="center">
-
-<?php
-// if there are any messages, output them.
-if ( !empty($td_str) ) :
-?>
-<table align="center" width="100%" cellpadding="4" cellspacing="0" border="0">
-<tr><td align="center"><b><?php echo $td_str ?></b><br />
-<a href="left_main.php" target="left"><?php echo _("refresh folder list") ?></a>
-</td></tr>
+<div id="folderManip">
+<table cellspacing="0" class="wrapper">
+ <tr>
+ <td class="header1">
+ <?php echo _("Folders"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing="0">
+ <tr>
+ <td class="header2">
+ <?php echo _("Create Folder") ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="folderAction">
+ <form method="post" action="folders.php" name="cf" id="cf">
+ <input type="hidden" name="smaction" value="create" />
+ <input type="text" name="folder_name" size="25" value="" />
+ <br />
+ <?php echo _("as a subfolder of") ?>
+ <br />
+ <select name="subfolder">
+ <?php echo $mbx_option_list; ?>
+ </select>
+ <?php
+ if ($show_subfolders_option) {
+ ?>
+ <br />
+ <input type="checkbox" name="contain_subs" id="contain_subs" value="1" />
+
+ <label for="contain_subs"><?php echo _("Let this folder contain subfolders") ?></label>
+ <br />
+ <?php
+ }
+ ?>
+ <input type="submit" value="<?php echo _("Create") ?>" />
+ </form>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing="0">
+ <tr>
+ <td class="header2">
+ <?php echo _("Rename a Folder") ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="folderAction">
+ <?php
+ if ( !empty($rendel_folder_list) ) {
+ ?>
+ <form method="post" action="folders.php" name="rf" id="rf">
+ <input type="hidden" name="smaction" value="rename">
+ <select name="old_name">
+ <option value="">[ <?php echo _("Select a folder") ?> ]</option>
+ <?php echo $rendel_folder_list ?>
+ </select>
+ <input type="submit" value="<?php echo _("Rename") ?>" />
+ </form>
+ <?php
+ } else {
+ echo _("No folders found");
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table cellspacing="0">
+ <tr>
+ <td class="header2">
+ <?php echo _("Delete Folder") ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="folderAction">
+ <?php
+ if ( !empty($rendel_folder_list) ) {
+ ?>
+ <form method="post" action="folders.php" name="df" id="df">
+ <input type="hidden" name="smaction" value="delete">
+ <select name="folder_name">
+ <option value="">[ <?php echo _("Select a folder") ?> ]</option>
+ <?php echo $rendel_folder_list ?>
+ </select>
+ <input type="submit" value="<?php echo _("Delete") ?>" />
+ </form>
+ <?php
+ } else {
+ echo _("No folders found");
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <?php
+ if ($show_only_subscribed_folders) {
+ ?>
+ <table cellspacing="0">
+ <tr>
+ <td class="header2" colspan="2">
+ <?php echo _("Unsubscribe") .'/'. _("Subscribe"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td class="folderAction">
+ <?php
+ if (!empty($rendel_folder_list)) {
+ ?>
+ <form method="post" action="folders.php" name="uf" id="uf">
+ <input type="hidden" name="smaction" value="unsubscribe" />
+ <select name="folder_names[]" multiple="multiple" size="8">
+ <?php echo $rendel_folder_list ?>
+ </select>
+ <br /><br />
+ <input type="submit" value="<?php echo _("Unsubscribe") ?>" />
+ </form>
+ <?php
+ } else {
+ echo _("No folders were found to unsubscribe from.");
+ }
+ ?>
+ </td>
+ <td class="folderAction">
+ <?php
+ if ($no_list_for_subscribe) {
+ ?>
+ <form method="post" action="folders.php" name="sf" id="sf">
+ <input type="hidden" name="smaction" value="subscribe">
+ <input type="text" name="folder_names[]" size="25" />
+ <input type="submit" value="<?php echo _("Subscribe") ?>" />
+ </form>
+ <?php
+ } elseif (!empty($subbox_option_list)) {
+ ?>
+ <form method="post" action="folders.php" name="sf" id="sf">
+ <input type="hidden" name="smaction" value="subscribe" />
+ <div>
+ <?php
+/*
+ <select name="folder_names[]" multiple="multiple" size="8">
+ <?php echo $subbox_option_list ?>
+ </select>
+*/
+ foreach ($subbox_option_list as $folder) {
+ echo '<input type="checkbox" name="folder_names[]" value="'.$folder['Value'].'" />'.$folder['Display'].'<br />';
+ }
+ ?>
+ </div>
+ <br />
+ <input type="submit" value="<?php echo _("Subscribe") ?>" />
+ </form>
+ <?php
+ } else {
+ echo _("No folders were found to subscribe to.");
+ }
+ ?>
+ </td>
+ </tr>
+ </table>
+ <?php
+ }
+ ?>
+ </td>
+ </tr>
</table>
-
-<?php
-endif;
-?>
-
-<br />
-
-<table align="center" width="70%" cellpadding="4" cellspacing="0" border="0">
-<tr><td bgcolor="<?php echo $color[9]?>" align="center"><b><?php echo _("Create Folder") ?></b></td></tr>
-<tr><td bgcolor="<?php echo $color[0]?>" align="center">
-
-<form method="post" action="folders.php" name="cf" id="cf">
-<input type="hidden" name="smaction" value="create">
-<input type="text" name="folder_name" size="25" value=""><br />
-<?php echo _("as a subfolder of") ?><br />
-<select name="subfolder">
-<?php echo $mbx_option_list; ?>
-</select>
-<?php if ($show_contain_subfolders_option): ?>
-<br />
-<input type="checkbox" name="contain_subs" id="contain_subs" value="1"> <label
- for="contain_subs"><?php echo _("Let this folder contain subfolders") ?></label><br />
-<?php endif; ?>
-<input type="submit" value="<?php echo _("Create") ?>" />
-</form>
-</td></tr>
-
-<tr><td bgcolor="<?php echo $color[4] ?>"> </td></tr>
-
-
-<table align="center" width="70%" cellpadding="4" cellspacing="0" border="0">
-<tr><td bgcolor="<?php echo $color[9]?>" align="center"><b><?php echo _("Rename a Folder") ?></b></td></tr>
-<tr><td bgcolor="<?php echo $color[0]?>" align="center">
-
-<?php if ( !empty($rendel_folder_list) ) : ?>
-
-<form method="post" action="folders.php" name="rf" id="rf">
-<input type="hidden" name="smaction" value="rename">
-<select name="old_name">
-<option value="">[ <?php echo _("Select a folder") ?> ]</option>
-<?php echo $rendel_folder_list ?>
-</select>
-<input type="submit" value="<?php echo _("Rename") ?>" />
-</form>
-
-<?php else: ?>
-
-<?php echo _("No folders found") ?><br /><br />
-
-<?php endif; ?>
-</td></tr>
-
-
-<tr><td bgcolor="<?php echo $color[4] ?>"> </td></tr>
-
-
-<table align="center" width="70%" cellpadding="4" cellspacing="0" border="0">
-<tr><td bgcolor="<?php echo $color[9]?>" align="center"><b><?php echo _("Delete Folder") ?></b></td></tr>
-<tr><td bgcolor="<?php echo $color[0]?>" align="center">
-
-<?php if ( !empty($rendel_folder_list) ) : ?>
-
-<form method="post" action="folders.php" name="df" id="df">
-<input type="hidden" name="smaction" value="delete">
-<select name="folder_name">
-<option value="">[ <?php echo _("Select a folder") ?> ]</option>
-<?php echo $rendel_folder_list ?>
-</select>
-<input type="submit" value="<?php echo _("Delete") ?>" />
-</form>
-
-<?php else: ?>
-
-<?php echo _("No folders found") ?><br /><br />
-
-<?php endif; ?>
-</td></tr>
-
-
-<tr><td bgcolor="<?php echo $color[4] ?>"> </td></tr>
-
-<?php if ( $show_only_subscribed_folders ): ?>
-
-<table align="center" width="70%" cellpadding="4" cellspacing="0" border="0">
-<tr><td colspan="2" bgcolor="<?php echo $color[9]?>" align="center"><b><?php echo _("Unsubscribe") . '/' . _("Subscribe") ?></b></td></tr>
-<tr><td bgcolor="<?php echo $color[0]?>" align="center" width="50%">
-
-<?php if ( !empty($rendel_folder_list) ) { ?>
-
-<form method="post" action="folders.php" name="uf" id="uf">
-<input type="hidden" name="smaction" value="unsubscribe">
-<select name="folder_names[]" multiple="multiple" size="8">
-<?php echo $rendel_folder_list ?>
-</select><br /><br />
-<input type="submit" value="<?php echo _("Unsubscribe") ?>" />
-</form>
-
-<?php } else {
- echo _("No folders were found to unsubscribe from.");
- }
-?>
-</td>
-
-<td align="center" bgcolor="<?php echo $color[0]?>" width="50%">
-<?php
-if ( $no_list_for_subscribe ) {
-?>
-<form method="post" action="folders.php" name="sf" id="sf">
-<input type="hidden" name="smaction" value="subscribe">
-<input type="text" name="folder_names[]" size="25" />
-<input type="submit" value="<?php echo _("Subscribe") ?>" />
-</form>
-<?php
-} elseif ( !empty($subbox_option_list) ) {
-?>
-<form method="post" action="folders.php" name="sf" id="sf">
-<input type="hidden" name="smaction" value="subscribe">
-<select name="folder_names[]" multiple="multiple" size="8">
-<?php echo $subbox_option_list ?>
-</select><br /><br />
-<input type="submit" value="<?php echo _("Subscribe") ?>" />
-</form>
-
-<?php } else {
- echo _("No folders were found to subscribe to.");
- }
-?>
-
-
-
-<?php endif; ?>
-
<?php do_hook('folders_bottom'); ?>
-
-</td></tr>
-</table>
-</td></tr>
-</table>
-
+</div>
\ No newline at end of file
*
* Template for folder management dialogs (rename, delete)
*
+ * The following variables are available in this template:
+ * + $dialog_type - string containing 'rename' or 'delete' to determine
+ * the desired action
+ *
+ * Depending on $dialog_type, other variables will be available. If
+ * $dialog_type is 'rename', the following variables will be available:
+ * + $current_folder_name - the current name of the element being renamed
+ * + $parent_folder - the name of the parent of the element being renamed
+ * + $current_full_name - the current full mailbox name
+ * + $is_folder - boolean TRUE if the element being renamed is a folder
+ *
+ * If $dialog_type is 'delete', the following variables will be available:
+ * + $folder_name - the name of the element being deleted
+ * + $visible_folder_name - scrubbed string of the element begin deleted
+ *
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
/* retrieve the template vars */
extract($t);
?>
-
+<div id="folderManip">
<form action="folders.php" method="post">
-
-<?php if ( $dialog_type == 'rename' ) : ?>
-
-
-<input type="hidden" name="smaction" value="rename">
-<?php if ( $isfolder ) { ?>
-<input type="hidden" name="isfolder" value="true" />
-<?php } ?>
-<input type="hidden" name="orig" value="<?php echo $old ?>" />
-<input type="hidden" name="old_name" value="<?php echo $old_name ?>" />
-
-<table align="center" width="95%" border="0">
-<tr><td align="center" bgcolor="<?php echo $color[0] ?>"><b><?php echo _("Rename a folder") ?></b></td>
-
-<tr><td align="center" bgcolor="<?php echo $color[4] ?>">
-
-<label for="new_name"><?php echo _("New name:") ?></label><br />
-<b><?php echo $old_parent ?></b><input type="text" name="new_name" id="new_name"
-value="<?php echo $old_name ?>" size="25" /><br /><br />
-
-<input type="submit" value="<?php echo _("Rename") ?>" />
-<input type="submit" name="cancelbutton" value="<?php echo _("Cancel") ?>" />
-
-<?php elseif ( $dialog_type == 'delete' ) : ?>
-
-<input type="hidden" name="smaction" value="delete">
-<input type="hidden" name="folder_name" value="<?php echo $folder_name ?>" />
-
-<table align="center" width="95%" border="0">
-<tr><td align="center" bgcolor="<?php echo $color[0] ?>"><b><?php echo _("Delete Folder") ?></b></td>
-
-<tr><td align="center" bgcolor="<?php echo $color[4] ?>">
-
-<?php echo sprintf(_("Are you sure you want to delete %s?"),
- str_replace(array(' ','<','>'),array(' ','<','>'),$visible_folder_name)); ?>
-<br /><br />
-
-<input type="submit" name="confirmed" value="<?php echo _("Yes") ?>" />
-<input type="submit" name="cancelbutton" value="<?php echo _("No") ?>" />
-
-
-<?php endif; ?>
-
-</td></tr></table>
-
+<table cellspacing="0" class="wrapper">
+<?php
+if ( $dialog_type == 'rename' ) {
+ ?>
+ <tr>
+ <td class="header1">
+ <?php echo _("Rename a folder") ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <label for="new_name"><?php echo _("New name:") ?></label>
+ <br />
+ <b><?php echo $parent_folder ?></b>
+ <input type="text" name="new_name" id="new_name" value="<?php echo $current_folder_name ?>" size="25" />
+ <br /><br />
+ <?php
+ if ( $is_folder ) {
+ echo '<input type="hidden" name="isfolder" value="true" />';
+ }
+ ?>
+ <input type="hidden" name="smaction" value="rename" />
+ <input type="hidden" name="orig" value="<?php echo $current_full_name ?>" />
+ <input type="hidden" name="old_name" value="<?php echo $current_folder_name ?>" />
+ <input type="submit" value="<?php echo _("Rename") ?>" />
+ <input type="submit" name="cancelbutton" value="<?php echo _("Cancel") ?>" />
+ <?php
+} elseif ( $dialog_type == 'delete' ) {
+ ?>
+ <tr>
+ <td class="header1">
+ <?php echo _("Delete Folder") ?>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <?php echo sprintf(_("Are you sure you want to delete %s?"), $visible_folder_name); ?>
+ <br /><br />
+ <input type="hidden" name="smaction" value="delete">
+ <input type="hidden" name="folder_name" value="<?php echo $folder_name ?>" />
+ <input type="submit" name="confirmed" value="<?php echo _("Yes") ?>" />
+ <input type="submit" name="cancelbutton" value="<?php echo _("No") ?>" />
+ <?php
+}
+?>
+ </td>
+ </tr>
+</table>
</form>
-
-
+</div>
\ No newline at end of file