Make sort links and add form return to the same backend that is currently being viewed
[squirrelmail.git] / templates / default / addressbook_list.tpl
CommitLineData
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!
c91b2e3b 15 * $addresses - array of backends in the address book. Each element
a71b394e 16 * is an array containing the following fields:
c91b2e3b 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.
a71b394e 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 **/
caa596b2 46include_once(SM_PATH . 'functions/template/abook_util.php');
a71b394e 47
48/** extract template variables **/
49extract($t);
50
a71b394e 51/** Begin template **/
52$source = $addresses[$current_backend];
a71b394e 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">
b3384b4a 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 <?php if (!empty($plugin_output['address_book_navigation'])) echo $plugin_output['address_book_navigation']; ?>
a71b394e 67 </td>
68 <td colspan=<?php echo '"'.($colspan - 3).'"'; ?> class="abookSwitch">
a140c3b1 69 <?php
70 if (count($backends) > 0) {
71 ?>
a71b394e 72 <select name="new_bnum">
73 <?php
74 foreach ($backends as $id=>$name) {
75 echo '<option value="'.$id.'"'.($id==$current_backend ? ' selected="selected"' : '').'>'.$name.'</option>'."\n";
76 }
77 ?>
a140c3b1 78 </select>
a71b394e 79 <input type="submit" value=<?php echo '"'._("Change").'"'; ?> name="change_abook" id="change_abook" />
a140c3b1 80 <?php
81 } else {
82 echo '&nbsp;';
83 }
84 ?>
a71b394e 85 </td>
86 </tr>
87 <tr>
b3384b4a 88 <td class="colHeader" style="width:1%"><input type="checkbox" name="toggleAll" id="toggleAll" title="<?php echo _("Toggle All"); ?>" onclick="toggle_all('address_book_form', 'sel', false); return false;" /></td>
caa596b2 89 <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname', $current_backend); ?></td>
90 <td class="colHeader"><?php echo addAbookSort('fullname', $current_backend); ?></td>
91 <td class="colHeader"><?php echo addAbookSort('email', $current_backend); ?></td>
92 <td class="colHeader"><?php echo addAbookSort('info', $current_backend); ?></td>
a71b394e 93 <?php
94 if ($abook_has_extra_field) {
95 echo '<td class="colHeader"></td>';
96 }
97 ?>
98 </tr>
99 <?php
100 $count = 1;
101 if (count($source['Addresses']) == 0) {
102 echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n";
103 }
104 foreach ($source['Addresses'] as $contact) {
3c656c5f 105 $id = $contact['NickName'] .'_'. $current_backend;
a71b394e 106 ?>
107 <tr class=<?php echo '"'.($count%2 ? 'even' : 'odd').'"'; ?>>
aee13493 108 <td class="abookField" style="width:1%"><?php echo ($source['BackendWritable'] ? '<input type="checkbox" name="sel[' . $count . ']" value="'.$id.'" id="'.$id.'" ' . (!empty($plugin_output['address_book_checkbox_extra']) ? $plugin_output['address_book_checkbox_extra'] : '') . ' />' : ''); ?></td>
986089b1 109 <td class="abookField" style="width:15%"><label for=<?php echo '"'.$id.'"'; ?>><?php echo $contact['NickName']; ?></label></td>
a71b394e 110 <td class="abookField"><?php echo $contact['FullName']; ?></td>
111 <td class="abookField"><?php echo composeLink($contact); ?></td>
112 <td class="abookField"><?php echo $contact['Info']; ?></td>
113 <?php
114 if ($abook_has_extra_field) {
115 echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n";
116 }
117 ?>
118 </tr>
119 <?php
120 $count++;
121 }
122?>
123</table>
823d08e5 124</div>