a71b394e |
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 |
a140c3b1 |
11 | * $abook_has_extra_field - boolean TRUE if the address book contains an |
12 | * additional field. FALSE otherwise. |
a71b394e |
13 | * $backends - array containing all available backends for selection. |
14 | * This will be empty if only 1 backend is available! |
15 | * $addresses - array of addresses in the address book. Each element |
16 | * is an array containing the following fields: |
17 | * $el['BackendID'] - integer unique identifier for each source of |
18 | * addresses in the book |
19 | * $el['BackendSource'] - description of each source of addresses |
20 | * $el['BackendWritable'] - boolean TRUE if the address book can be |
21 | * modified. FALSE otherwise. |
22 | * $el['Addresses'] - array containing address from this source. |
23 | * Each array element contains the following: |
24 | * $el['FirstName'] - The entry's first name |
25 | * $el['LastName'] - The entry's last name (surname) |
26 | * $el['FullName'] - The entry's full name (first + last) |
27 | * $el['NickName'] - The entry's nickname |
28 | * $el['Email'] - duh |
29 | * $el['FullAddress'] - Email with full name or nick name |
30 | * optionally prepended. |
31 | * $el['Info'] - Additional info about this contact |
32 | * $el['Extra'] - Additional field, if provided. NULL if this |
33 | * field is not provided by the book. |
34 | * |
35 | * @copyright © 1999-2006 The SquirrelMail Project Team |
36 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
37 | * @version $Id$ |
38 | * @package squirrelmail |
39 | * @subpackage templates |
40 | */ |
41 | |
42 | /** add required includes **/ |
43 | include_once(SM_PATH . 'templates/util_addressbook.php'); |
44 | |
45 | /** extract template variables **/ |
46 | extract($t); |
47 | |
48 | #echo dump_array($addresses).'<br>'; |
49 | /** Begin template **/ |
50 | $source = $addresses[$current_backend]; |
a71b394e |
51 | $colspan = $abook_has_extra_field ? 6 : 5; |
52 | ?> |
53 | <div id="addressList"> |
54 | <table cellspacing="0"> |
55 | <tr> |
56 | <td colspan=<?php echo '"'.$colspan.'"'; ?> class="header1"> |
57 | <?php echo $source['BackendSource']; ?> |
58 | </td> |
59 | </tr> |
60 | <tr> |
61 | <td colspan="3" class="abookButtons"> |
62 | <input type="submit" value=<?php echo '"'._("Edit selected").'"'; ?> name="editaddr" id="editaddr" /> |
63 | <input type="submit" value=<?php echo '"'._("Delete selected").'"'; ?> name="deladdr" id="deladdr" /> |
64 | </td> |
65 | <td colspan=<?php echo '"'.($colspan - 3).'"'; ?> class="abookSwitch"> |
a140c3b1 |
66 | <?php |
67 | if (count($backends) > 0) { |
68 | ?> |
a71b394e |
69 | <select name="new_bnum"> |
70 | <?php |
71 | foreach ($backends as $id=>$name) { |
72 | echo '<option value="'.$id.'"'.($id==$current_backend ? ' selected="selected"' : '').'>'.$name.'</option>'."\n"; |
73 | } |
74 | ?> |
a140c3b1 |
75 | </select> |
a71b394e |
76 | <input type="submit" value=<?php echo '"'._("Change").'"'; ?> name="change_abook" id="change_abook" /> |
a140c3b1 |
77 | <?php |
78 | } else { |
79 | echo ' '; |
80 | } |
81 | ?> |
a71b394e |
82 | </td> |
83 | </tr> |
84 | <tr> |
85 | <td class="colHeader" style="width:1%"></td> |
86 | <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname'); ?></td> |
87 | <td class="colHeader"><?php echo addAbookSort('fullname'); ?></td> |
88 | <td class="colHeader"><?php echo addAbookSort('email'); ?></td> |
89 | <td class="colHeader"><?php echo addAbookSort('info'); ?></td> |
90 | <?php |
91 | if ($abook_has_extra_field) { |
92 | echo '<td class="colHeader"></td>'; |
93 | } |
94 | ?> |
95 | </tr> |
96 | <?php |
97 | $count = 1; |
98 | if (count($source['Addresses']) == 0) { |
99 | echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n"; |
100 | } |
101 | foreach ($source['Addresses'] as $contact) { |
102 | $id = $current_backend.':'.$contact['NickName']; |
103 | ?> |
104 | <tr class=<?php echo '"'.($count%2 ? 'even' : 'odd').'"'; ?>> |
105 | <td class="abookField" style="width:1%"><?php echo ($source['BackendWritable'] ? '<input type="checkbox" name="sel[]" value="'.$id.'" id="'.$id.'" />' : ''); ?></td> |
106 | <td class="abookField" style="width:15%"><label for=<?php echo '"'.$id.'"'; ?>><?php echo $contact['NickName']; ?></lable></td> |
107 | <td class="abookField"><?php echo $contact['FullName']; ?></td> |
108 | <td class="abookField"><?php echo composeLink($contact); ?></td> |
109 | <td class="abookField"><?php echo $contact['Info']; ?></td> |
110 | <?php |
111 | if ($abook_has_extra_field) { |
112 | echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n"; |
113 | } |
114 | ?> |
115 | </tr> |
116 | <?php |
117 | $count++; |
118 | } |
119 | ?> |
120 | </table> |
121 | </div> |