5 * Template for the basic address book list
7 * The following variables are available in this template:
8 * $current_backend - integer containing backend currently displayed.
9 * $abook_select - string containing HTML to display the address book
11 * $backends - array containing all available backends for selection.
12 * This will be empty if only 1 backend is available!
13 * $addresses - array of addresses in the address book. Each element
14 * is an array containing the following fields:
15 * $el['BackendID'] - integer unique identifier for each source of
16 * addresses in the book
17 * $el['BackendSource'] - description of each source of addresses
18 * $el['BackendWritable'] - boolean TRUE if the address book can be
19 * modified. FALSE otherwise.
20 * $el['Addresses'] - array containing address from this source.
21 * Each array element contains the following:
22 * $el['FirstName'] - The entry's first name
23 * $el['LastName'] - The entry's last name (surname)
24 * $el['FullName'] - The entry's full name (first + last)
25 * $el['NickName'] - The entry's nickname
27 * $el['FullAddress'] - Email with full name or nick name
28 * optionally prepended.
29 * $el['Info'] - Additional info about this contact
30 * $el['Extra'] - Additional field, if provided. NULL if this
31 * field is not provided by the book.
33 * @copyright © 1999-2006 The SquirrelMail Project Team
34 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
36 * @package squirrelmail
37 * @subpackage templates
40 /** add required includes **/
41 include_once(SM_PATH . 'templates/util_addressbook.php');
43 /** extract template variables **/
46 #echo dump_array($addresses).'<br>';
47 /** Begin template **/
48 $source = $addresses[$current_backend];
49 $abook_has_extra_field = isset($source['Addresses'][0]) && !is_null($source['Addresses'][0]['Extra']);
50 $colspan = $abook_has_extra_field ? 6 : 5;
52 <div id="addressList">
53 <table cellspacing="0">
55 <td colspan=<?php echo '"'.$colspan.'"'; ?> class="header1">
56 <?php echo $source['BackendSource']; ?>
60 <td colspan="3" class="abookButtons">
61 <input type="submit" value=<?php echo '"'._("Edit selected").'"'; ?> name="editaddr" id="editaddr" />
62 <input type="submit" value=<?php echo '"'._("Delete selected").'"'; ?> name="deladdr" id="deladdr" />
64 <td colspan=<?php echo '"'.($colspan - 3).'"'; ?> class="abookSwitch">
65 <select name="new_bnum">
67 foreach ($backends as $id=>$name) {
68 echo '<option value="'.$id.'"'.($id==$current_backend ? ' selected="selected"' : '').'>'.$name.'</option>'."\n";
72 <input type="submit" value=<?php echo '"'._("Change").'"'; ?> name="change_abook" id="change_abook" />
76 <td class="colHeader" style="width:1%"></td>
77 <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname'); ?></td>
78 <td class="colHeader"><?php echo addAbookSort('fullname'); ?></td>
79 <td class="colHeader"><?php echo addAbookSort('email'); ?></td>
80 <td class="colHeader"><?php echo addAbookSort('info'); ?></td>
82 if ($abook_has_extra_field) {
83 echo '<td class="colHeader"></td>';
89 if (count($source['Addresses']) == 0) {
90 echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n";
92 foreach ($source['Addresses'] as $contact) {
93 $id = $current_backend.':'.$contact['NickName'];
95 <tr class=<?php echo '"'.($count%2 ? 'even' : 'odd').'"'; ?>>
96 <td class="abookField" style="width:1%"><?php echo ($source['BackendWritable'] ? '<input type="checkbox" name="sel[]" value="'.$id.'" id="'.$id.'" />' : ''); ?></td>
97 <td class="abookField" style="width:15%"><label for=<?php echo '"'.$id.'"'; ?>><?php echo $contact['NickName']; ?></lable></td>
98 <td class="abookField"><?php echo $contact['FullName']; ?></td>
99 <td class="abookField"><?php echo composeLink($contact); ?></td>
100 <td class="abookField"><?php echo $contact['Info']; ?></td>
102 if ($abook_has_extra_field) {
103 echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n";