Add label entry to accounts data
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Nov 2009 21:30:58 +0000 (14:30 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 3 Dec 2009 21:53:39 +0000 (14:53 -0700)
imp/lib/Accounts.php
imp/lib/Application.php
imp/templates/prefs/accountsmanagement.inc

index 96d5c61..483bcff 100644 (file)
@@ -92,6 +92,7 @@ class IMP_Accounts
      *
      * @param array $config  The necessary config:
      * <pre>
+     * 'label' - (string) The human-readable label for this account.
      * 'port' - (integer) The remote port.
      * 'secure' -(string) Either 'auto', 'no', or 'yes'.
      * 'server' - (string) The server hostspec.
index 122b10e..7695084 100644 (file)
@@ -929,8 +929,15 @@ class IMP_Application extends Horde_Registry_Application
                         $port = ($vars->accounts_type == 'imap') ? 143 : 110;
                     }
 
+                    /* Label is not required. */
+                    $label = $vars->accounts_label;
+                    if (!strlen($label)) {
+                        $label = $vars->accounts_server . ':' . $port . ' [' . $vars->accounts_type . ']';
+                    }
+
                     $imp_accounts = IMP_Accounts::singleton();
                     $imp_accounts->addAccount(array(
+                        'label' => $label,
                         'port' => $port,
                         'secure' => $vars->accounts_secure,
                         'server' => $vars->accounts_server,
index 89b55b0..b24817a 100644 (file)
@@ -4,6 +4,11 @@
 <?php if (Horde_Util::getFormData('accounts_action') == 'new'): ?>
 <table class="accountsmanagement">
  <tr>
+  <td class="item"><?php echo _("Label") ?>:</td>
+  <td class="item"><input name="accounts_label" size="30"/></td>
+  <td></td>
+ </tr>
+ <tr>
   <td class="item"><?php echo _("Type") ?>:</td>
   <td class="item">
    <select name="accounts_type">
@@ -53,6 +58,7 @@ $delete_img = Horde::img('delete.png');
 <table class="accountsmanagement">
  <thead>
   <tr>
+   <td><?php echo _("Label") ?></td>
    <td><?php echo _("Server") ?></td>
    <td><?php echo _("Type") ?></td>
    <td><?php echo _("Port") ?></td>
@@ -68,6 +74,7 @@ $delete_img = Horde::img('delete.png');
 <?php else: ?>
 <?php foreach ($accounts_list as $key => $val): ?>
   <tr id="accountsid_<?php echo $key ?>">
+   <td><?php echo htmlspecialchars($val['label']) ?></td>
    <td><?php echo htmlspecialchars($val['server']) ?></td>
    <td><?php echo htmlspecialchars($val['type']) ?></td>
    <td><?php echo htmlspecialchars($val['port']) ?></td>