456164712c4be15483d204c907076381214444dd
[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 * $current_backend - integer containing backend currently displayed.
9 * $abook_select - string containing HTML to display the address book
10 * selection drop down
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
26 * $el['Email'] - duh
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.
32 *
33 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
34 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
35 * @version $Id$
36 * @package squirrelmail
37 * @subpackage templates
38 */
39
40 /** add required includes **/
41 include_once(SM_PATH . 'templates/util_addressbook.php');
42
43 /** extract template variables **/
44 extract($t);
45
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;
51 ?>
52 <div id="addressList">
53 <table cellspacing="0">
54 <tr>
55 <td colspan=<?php echo '"'.$colspan.'"'; ?> class="header1">
56 <?php echo $source['BackendSource']; ?>
57 </td>
58 </tr>
59 <tr>
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" />
63 </td>
64 <td colspan=<?php echo '"'.($colspan - 3).'"'; ?> class="abookSwitch">
65 <select name="new_bnum">
66 <?php
67 foreach ($backends as $id=>$name) {
68 echo '<option value="'.$id.'"'.($id==$current_backend ? ' selected="selected"' : '').'>'.$name.'</option>'."\n";
69 }
70 ?>
71 </select>
72 <input type="submit" value=<?php echo '"'._("Change").'"'; ?> name="change_abook" id="change_abook" />
73 </td>
74 </tr>
75 <tr>
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>
81 <?php
82 if ($abook_has_extra_field) {
83 echo '<td class="colHeader"></td>';
84 }
85 ?>
86 </tr>
87 <?php
88 $count = 1;
89 if (count($source['Addresses']) == 0) {
90 echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n";
91 }
92 foreach ($source['Addresses'] as $contact) {
93 $id = $current_backend.':'.$contact['NickName'];
94 ?>
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>
101 <?php
102 if ($abook_has_extra_field) {
103 echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n";
104 }
105 ?>
106 </tr>
107 <?php
108 $count++;
109 }
110 ?>
111 </table>
112 </div>