Fixed broken highlighting form (missing security tokens) (#3381117)
[squirrelmail.git] / templates / default / addressbook_list.tpl
1 <?php
2
3 /**
4 * addressbook_list.tpl
5 *
6 * Template for the basic address book list
7 *
8 * The following variables are available in this template:
9 *
10 * string $form_action The action for the main form tag
11 * array $current_page_args All known query string arguments for the
12 * current page request, for use when constructing
13 * links pointing back to same page (possibly
14 * changing one of them); structured as an
15 * associative array of key/value pairs
16 * boolean $compose_new_win Whether or not the user prefs are set to compose
17 * messages in a popup window
18 * int $compose_width Width of popup compose window if needed
19 * int $compose_height Height of popup compose window if needed
20 * int $current_backend Number of backend currently displayed.
21 * string $abook_select Code for widget to display the address book
22 * backend selection drop down
23 * boolean $abook_has_extra_field TRUE if the address book contains an
24 * additional field. FALSE otherwise.
25 * array $backends Contains all available abook backends for selection.
26 * This will be empty if only 1 backend is available!
27 * array $addresses Contains backends in the address book. Each element
28 * is an array containing the following fields:
29 * ['BackendID'] - integer unique identifier for each source of
30 * addresses in the book. this should also be
31 * the same as the array key for this value
32 * ['BackendSource'] - description of each source of addresses
33 * ['BackendWritable'] - boolean TRUE if the address book can be
34 * modified. FALSE otherwise.
35 * ['Addresses'] - array containing address from this source.
36 * Each array element contains the following:
37 * ['FirstName'] - The entry's first name
38 * ['LastName'] - The entry's last name (surname)
39 * ['FullName'] - The entry's full name (first + last)
40 * ['NickName'] - The entry's nickname
41 * ['Email'] - duh
42 * ['FullAddress'] - Email with full name or nick name
43 * optionally prepended.
44 * ['Info'] - Additional info about this contact
45 * ['Extra'] - Additional field, if provided. NULL if
46 * this field is not provided by the book.
47 * ['JSEmail'] - email address scrubbed for use with
48 * javascript functions.
49 *
50 * @copyright 1999-2011 The SquirrelMail Project Team
51 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
52 * @version $Id$
53 * @package squirrelmail
54 * @subpackage templates
55 */
56
57 /** add required includes **/
58 include_once(SM_PATH . 'functions/template/abook_util.php');
59
60 /** extract template variables **/
61 extract($t);
62
63 /** Begin template **/
64 $source = $addresses[$current_backend];
65 $colspan = $abook_has_extra_field ? 6 : 5;
66 ?>
67 <form action="<?php echo $form_action; ?>" method="post" id="address_book_form" name="address_book_form">
68 <input type="hidden" name="smtoken" value="<?php echo sm_generate_security_token(); ?>" />
69 <div id="addressList">
70 <table cellspacing="0">
71 <tr>
72 <td colspan="<?php echo $colspan; ?>" class="header1">
73 <?php echo $source['BackendSource']; ?>
74 </td>
75 </tr>
76 <tr>
77 <td colspan="3" class="abookPaginationAndButtons">
78 <div class="abookPagination">
79 <?php
80 $this->display('addressbook_paginator.tpl');
81 if (!empty($plugin_output['address_book_navigation'])) echo $plugin_output['address_book_navigation'];
82 ?>
83 </div><div class="abookButtons">
84 <input type="submit" value="<?php echo _("Edit"); ?>" name="editaddr" id="editaddr" />
85 <input type="submit" value="<?php echo _("Delete"); ?>" name="deladdr" id="deladdr" />
86 <input type="submit" value="<?php echo _("Compose To") . ($javascript_on && $compose_new_win ? '" onclick="var send_to = \'\'; var f = document.forms.length; var i = 0; var grab_next_hidden = \'\'; while (i < f) { var e = document.forms[i].elements.length; var j = 0; while (j < e) { if (document.forms[i].elements[j].type == \'checkbox\' && document.forms[i].elements[j].checked) { var pos = document.forms[i].elements[j].value.indexOf(\'_\'); if (pos >= 1) { grab_next_hidden = document.forms[i].elements[j].value; } } else if (document.forms[i].elements[j].type == \'hidden\' && grab_next_hidden == document.forms[i].elements[j].name) { if (send_to != \'\') { send_to += \', \'; } send_to += document.forms[i].elements[j].value; } j++; } i++; } if (send_to != \'\') { comp_in_new(\''. $base_uri . 'src/compose.php?send_to=\' + send_to, ' . $compose_width . ', ' . $compose_height . '); } return false;"' : '"'); ?> name="compose_to" id="compose_to" />
87 <?php if (!empty($plugin_output['address_book_buttons'])) echo $plugin_output['address_book_buttons']; ?>
88 </div>
89 </td>
90 <td colspan="<?php echo ($colspan - 3); ?>" class="abookSwitch">
91 <?php if (!empty($plugin_output['address_book_filter'])) echo $plugin_output['address_book_filter']; ?>
92 <?php
93 if (count($backends) > 0) {
94 ?>
95 <select name="new_bnum">
96 <?php
97 foreach ($backends as $id=>$name) {
98 echo '<option value="' . $id . '"' . ($id == $current_backend ? ' selected="selected"' : '') . '>' . $name . '</option>' . "\n";
99 }
100 ?>
101 </select>
102 <input type="submit" value="<?php echo _("Change"); ?>" name="change_abook" id="change_abook" />
103 <?php
104 } else {
105 echo '&nbsp;';
106 }
107 ?>
108 </td>
109 </tr>
110 <tr>
111 <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>
112 <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname', $current_page_args); ?></td>
113 <td class="colHeader"><?php echo addAbookSort('fullname', $current_page_args); ?></td>
114 <td class="colHeader"><?php echo addAbookSort('email', $current_page_args); ?></td>
115 <td class="colHeader"><?php echo addAbookSort('info', $current_page_args); ?></td>
116 <?php
117 if ($abook_has_extra_field) {
118 echo '<td class="colHeader"></td>';
119 }
120 ?>
121 </tr>
122 <?php
123 $count = 1;
124 if (count($source['Addresses']) == 0) {
125 echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n";
126 }
127 foreach ($source['Addresses'] as $contact) {
128 echo '<tr class="' . ($count%2 ? 'even' : 'odd') . '">';
129 if (!empty($contact['special_message'])) {
130 echo '<td class="abookEmpty" colspan="' . $colspan . '">' . $contact['special_message'] . '</td>';
131 } else {
132 $id = $current_backend . '_' . $contact['NickName'];
133 ?>
134 <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>
135 <td class="abookField" style="width:15%"><label for="<?php echo $id . '">' . $contact['NickName']; ?></label></td>
136 <td class="abookField"><label for="<?php echo $id . '">' . $contact['FullName']; ?></label></td>
137 <td class="abookField"><input type="hidden" name="<?php echo $id; ?>" value="<?php echo rawurlencode($contact['FullAddress']); ?>" /><?php echo composeLink($contact); ?></td>
138 <td class="abookField"><label for="<?php echo $id . '">' . $contact['Info']; ?></label></td>
139 <?php
140 if ($abook_has_extra_field) {
141 echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n";
142 }
143 }
144 ?>
145 </tr>
146 <?php
147 $count++;
148 }
149 ?>
150 </table>
151 </div>
152 </form>