[dev] [imp-patch] hide identity selector when only one identity

Francois Marier francois at nit.ca
Mon Aug 9 13:26:31 PDT 2004


It's kind of redundant to see a drop down when there is only one
element in it, so this patch removes the identity selector when there
is only one identity in the configuration.  The identity is displayed
as text instead.

As soon as you configure a second identity, the drop down comes back
with the usual choices.

Francois
-------------- next part --------------
diff -rpuN -X ../ignorelist ../build/imp/templates/compose/compose.inc imp/templates/compose/compose.inc
--- ../build/imp/templates/compose/compose.inc	Tue Mar 23 15:26:31 2004
+++ imp/templates/compose/compose.inc	Mon Aug  9 16:17:46 2004
@@ -93,11 +93,18 @@
         <tr>
           <td align="left">
             <input type="hidden" name="last_identity" value="<?php echo $identity->getDefault() ?>" />
-            <select id="identity" name="identity" tabindex="<?php echo $tabindex++ ?>" onchange="change_identity(this.selectedIndex)">
-<?php foreach ($select_list as $key => $select): ?>
-              <option value="<?php echo $key ?>"<?php if ($key == $identity->getDefault()) echo ' selected="selected"' ?>><?php echo htmlspecialchars($select) ?></option>
-<?php endforeach; ?>
-            </select>
+    
+    <?php if (count(array_keys($select_list)) > 1): ?>
+        <select id="identity" name="identity" tabindex="<?php echo $tabindex++ ?>" onchange="change_identity(this.selectedIndex)">
+        <?php foreach ($select_list as $key => $select): ?>
+        <option value="<?php echo $key ?>"<?php if ($key == $identity->getDefault()) echo ' selected="selected"' ?>><?php echo htmlspecialchars($select) ?></option>
+        <?php endforeach; ?>
+        </select>
+    <?php else: ?>
+        <input type="hidden" name="identity" value="<?php echo $identity->getDefault() ?>" />
+        <?php echo $select_list[0] ?>
+    <?php endif; ?>
+        
           </td>
 <?php else: ?>
     <td class="light" align="right"><b><?php echo _("From") ?>&nbsp;</b></td>


More information about the dev mailing list