Allow underscores in nicknames by changing id used in forms, add more labels for...
[squirrelmail.git] / templates / default / addressbook_list.tpl
1 <?php
2 /**
3 * addressbook_list.tpl
4 *
5 * Template for the basic address book list
6 *
7 * The following variables are available in this template:
8 * $compose_new_win - whether or not the user prefs are set to compose
9 * messages in a popup window
10 * $compose_width - width of popup compose window if needed
11 * $compose_height - height of popup compose window if needed
12 * $current_backend - integer containing backend currently displayed.
13 * $abook_select - string containing HTML to display the address book
14 * selection drop down
15 * $abook_has_extra_field - boolean TRUE if the address book contains an
16 * additional field. FALSE otherwise.
17 * $backends - array containing all available backends for selection.
18 * This will be empty if only 1 backend is available!
19 * $addresses - array of backends in the address book. Each element
20 * is an array containing the following fields:
21 * ['BackendID'] - integer unique identifier for each source of
22 * addresses in the book. this should also be
23 * the same as the array key for this value
24 * ['BackendSource'] - description of each source of addresses
25 * ['BackendWritable'] - boolean TRUE if the address book can be
26 * modified. FALSE otherwise.
27 * ['Addresses'] - array containing address from this source.
28 * Each array element contains the following:
29 * ['FirstName'] - The entry's first name
30 * ['LastName'] - The entry's last name (surname)
31 * ['FullName'] - The entry's full name (first + last)
32 * ['NickName'] - The entry's nickname
33 * ['Email'] - duh
34 * ['FullAddress'] - Email with full name or nick name
35 * optionally prepended.
36 * ['Info'] - Additional info about this contact
37 * ['Extra'] - Additional field, if provided. NULL if
38 * this field is not provided by the book.
39 * ['JSEmail'] - email address scrubbed for use with
40 * javascript functions.
41 *
42 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
43 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
44 * @version $Id$
45 * @package squirrelmail
46 * @subpackage templates
47 */
48
49 /** add required includes **/
50 include_once(SM_PATH . 'functions/template/abook_util.php');
51
52 /** extract template variables **/
53 extract($t);
54
55 /** Begin template **/
56 $source = $addresses[$current_backend];
57 $colspan = $abook_has_extra_field ? 6 : 5;
58 ?>
59 <div id="addressList">
60 <table cellspacing="0">
61 <tr>
62 <td colspan="<?php echo $colspan; ?>" class="header1">
63 <?php echo $source['BackendSource']; ?>
64 </td>
65 </tr>
66 <tr>
67 <td colspan="3" class="abookButtons">
68 <input type="submit" value="<?php echo _("Edit Selected"); ?>" name="editaddr" id="editaddr" />
69 <input type="submit" value="<?php echo _("Delete Selected"); ?>" name="deladdr" id="deladdr" />
70 <input type="submit" value="<?php echo _("Compose to Selected") . ($javascript_on && $compose_new_win ? '" onclick="var send_to = \'\'; var f = document.forms.length; var i = 0; var grab_next_hidden = \'\'; while (i < f) { var e = document.forms[i].elements.length; var j = 0; while (j < e) { if (document.forms[i].elements[j].type == \'checkbox\' && document.forms[i].elements[j].checked) { var pos = document.forms[i].elements[j].value.indexOf(\'_\'); if (pos >= 1) { grab_next_hidden = document.forms[i].elements[j].value; } } else if (document.forms[i].elements[j].type == \'hidden\' && grab_next_hidden == document.forms[i].elements[j].name) { if (send_to != \'\') { send_to += \', \'; } send_to += document.forms[i].elements[j].value; } j++; } i++; } if (send_to != \'\') { comp_in_new(\''. $base_uri . 'src/compose.php?send_to=\' + send_to, ' . $compose_width . ', ' . $compose_height . '); } return false;"' : '"'); ?> name="compose_to" id="compose_to" />
71 <?php if (!empty($plugin_output['address_book_navigation'])) echo $plugin_output['address_book_navigation']; ?>
72 </td>
73 <td colspan="<?php echo ($colspan - 3); ?>" class="abookSwitch">
74 <?php
75 if (count($backends) > 0) {
76 ?>
77 <select name="new_bnum">
78 <?php
79 foreach ($backends as $id=>$name) {
80 echo '<option value="' . $id . '"' . ($id == $current_backend ? ' selected="selected"' : '') . '>' . $name . '</option>' . "\n";
81 }
82 ?>
83 </select>
84 <input type="submit" value="<?php echo _("Change"); ?>" name="change_abook" id="change_abook" />
85 <?php
86 } else {
87 echo '&nbsp;';
88 }
89 ?>
90 </td>
91 </tr>
92 <tr>
93 <td class="colHeader" style="width:1%"><input type="checkbox" name="toggleAll" id="toggleAll" title="<?php echo _("Toggle All"); ?>" onclick="toggle_all('address_book_form', 'sel', false); return false;" /></td>
94 <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname', $current_backend); ?></td>
95 <td class="colHeader"><?php echo addAbookSort('fullname', $current_backend); ?></td>
96 <td class="colHeader"><?php echo addAbookSort('email', $current_backend); ?></td>
97 <td class="colHeader"><?php echo addAbookSort('info', $current_backend); ?></td>
98 <?php
99 if ($abook_has_extra_field) {
100 echo '<td class="colHeader"></td>';
101 }
102 ?>
103 </tr>
104 <?php
105 $count = 1;
106 if (count($source['Addresses']) == 0) {
107 echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n";
108 }
109 foreach ($source['Addresses'] as $contact) {
110 $id = $current_backend . '_' . $contact['NickName'];
111 ?>
112 <tr class="<?php echo ($count%2 ? 'even' : 'odd'); ?>">
113 <td class="abookField" style="width:1%"><?php echo ($source['BackendWritable'] ? '<input type="checkbox" name="sel[' . $count . ']" value="'.$id.'" id="'.$id.'" ' . (!empty($plugin_output['address_book_checkbox_extra']) ? $plugin_output['address_book_checkbox_extra'] : '') . ' />' : ''); ?></td>
114 <td class="abookField" style="width:15%"><label for="<?php echo $id . '">' . $contact['NickName']; ?></label></td>
115 <td class="abookField"><label for="<?php echo $id . '">' . $contact['FullName']; ?></label></td>
116 <td class="abookField"><input type="hidden" name="<?php echo $id; ?>" value="<?php echo rawurlencode($contact['FullAddress']); ?>" /><?php echo composeLink($contact); ?></td>
117 <td class="abookField"><label for="<?php echo $id . '">' . $contact['Info']; ?></label></td>
118 <?php
119 if ($abook_has_extra_field) {
120 echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n";
121 }
122 ?>
123 </tr>
124 <?php
125 $count++;
126 }
127 ?>
128 </table>
129 </div>