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