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. |
3f92c0c7 |
34 | * $el['JSEmail'] - email address scrubbed for use with |
35 | * javascript functions. |
a71b394e |
36 | * |
37 | * @copyright © 1999-2006 The SquirrelMail Project Team |
38 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
39 | * @version $Id$ |
40 | * @package squirrelmail |
41 | * @subpackage templates |
42 | */ |
43 | |
44 | /** add required includes **/ |
45 | include_once(SM_PATH . 'templates/util_addressbook.php'); |
46 | |
47 | /** extract template variables **/ |
48 | extract($t); |
49 | |
a71b394e |
50 | /** Begin template **/ |
51 | $source = $addresses[$current_backend]; |
a71b394e |
52 | $colspan = $abook_has_extra_field ? 6 : 5; |
53 | ?> |
54 | <div id="addressList"> |
55 | <table cellspacing="0"> |
56 | <tr> |
57 | <td colspan=<?php echo '"'.$colspan.'"'; ?> class="header1"> |
58 | <?php echo $source['BackendSource']; ?> |
59 | </td> |
60 | </tr> |
61 | <tr> |
62 | <td colspan="3" class="abookButtons"> |
63 | <input type="submit" value=<?php echo '"'._("Edit selected").'"'; ?> name="editaddr" id="editaddr" /> |
64 | <input type="submit" value=<?php echo '"'._("Delete selected").'"'; ?> name="deladdr" id="deladdr" /> |
65 | </td> |
66 | <td colspan=<?php echo '"'.($colspan - 3).'"'; ?> class="abookSwitch"> |
a140c3b1 |
67 | <?php |
68 | if (count($backends) > 0) { |
69 | ?> |
a71b394e |
70 | <select name="new_bnum"> |
71 | <?php |
72 | foreach ($backends as $id=>$name) { |
73 | echo '<option value="'.$id.'"'.($id==$current_backend ? ' selected="selected"' : '').'>'.$name.'</option>'."\n"; |
74 | } |
75 | ?> |
a140c3b1 |
76 | </select> |
a71b394e |
77 | <input type="submit" value=<?php echo '"'._("Change").'"'; ?> name="change_abook" id="change_abook" /> |
a140c3b1 |
78 | <?php |
79 | } else { |
80 | echo ' '; |
81 | } |
82 | ?> |
a71b394e |
83 | </td> |
84 | </tr> |
85 | <tr> |
86 | <td class="colHeader" style="width:1%"></td> |
87 | <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname'); ?></td> |
88 | <td class="colHeader"><?php echo addAbookSort('fullname'); ?></td> |
89 | <td class="colHeader"><?php echo addAbookSort('email'); ?></td> |
90 | <td class="colHeader"><?php echo addAbookSort('info'); ?></td> |
91 | <?php |
92 | if ($abook_has_extra_field) { |
93 | echo '<td class="colHeader"></td>'; |
94 | } |
95 | ?> |
96 | </tr> |
97 | <?php |
98 | $count = 1; |
99 | if (count($source['Addresses']) == 0) { |
100 | echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n"; |
101 | } |
102 | foreach ($source['Addresses'] as $contact) { |
3c656c5f |
103 | $id = $contact['NickName'] .'_'. $current_backend; |
a71b394e |
104 | ?> |
105 | <tr class=<?php echo '"'.($count%2 ? 'even' : 'odd').'"'; ?>> |
106 | <td class="abookField" style="width:1%"><?php echo ($source['BackendWritable'] ? '<input type="checkbox" name="sel[]" value="'.$id.'" id="'.$id.'" />' : ''); ?></td> |
986089b1 |
107 | <td class="abookField" style="width:15%"><label for=<?php echo '"'.$id.'"'; ?>><?php echo $contact['NickName']; ?></label></td> |
a71b394e |
108 | <td class="abookField"><?php echo $contact['FullName']; ?></td> |
109 | <td class="abookField"><?php echo composeLink($contact); ?></td> |
110 | <td class="abookField"><?php echo $contact['Info']; ?></td> |
111 | <?php |
112 | if ($abook_has_extra_field) { |
113 | echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n"; |
114 | } |
115 | ?> |
116 | </tr> |
117 | <?php |
118 | $count++; |
119 | } |
120 | ?> |
121 | </table> |
122 | </div> |