| 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-2006 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 | <div id="addressList"> |
| 69 | <table cellspacing="0"> |
| 70 | <tr> |
| 71 | <td colspan="<?php echo $colspan; ?>" class="header1"> |
| 72 | <?php echo $source['BackendSource']; ?> |
| 73 | </td> |
| 74 | </tr> |
| 75 | <tr> |
| 76 | <td colspan="3" class="abookPaginationAndButtons"> |
| 77 | <div class="abookPagination"> |
| 78 | <?php |
| 79 | $this->display('addressbook_paginator.tpl'); |
| 80 | if (!empty($plugin_output['address_book_navigation'])) echo $plugin_output['address_book_navigation']; |
| 81 | ?> |
| 82 | </div><div class="abookButtons"> |
| 83 | <input type="submit" value="<?php echo _("Edit"); ?>" name="editaddr" id="editaddr" /> |
| 84 | <input type="submit" value="<?php echo _("Delete"); ?>" name="deladdr" id="deladdr" /> |
| 85 | <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" /> |
| 86 | <?php if (!empty($plugin_output['address_book_buttons'])) echo $plugin_output['address_book_buttons']; ?> |
| 87 | </div> |
| 88 | </td> |
| 89 | <td colspan="<?php echo ($colspan - 3); ?>" class="abookSwitch"> |
| 90 | <?php if (!empty($plugin_output['address_book_filter'])) echo $plugin_output['address_book_filter']; ?> |
| 91 | <?php |
| 92 | if (count($backends) > 0) { |
| 93 | ?> |
| 94 | <select name="new_bnum"> |
| 95 | <?php |
| 96 | foreach ($backends as $id=>$name) { |
| 97 | echo '<option value="' . $id . '"' . ($id == $current_backend ? ' selected="selected"' : '') . '>' . $name . '</option>' . "\n"; |
| 98 | } |
| 99 | ?> |
| 100 | </select> |
| 101 | <input type="submit" value="<?php echo _("Change"); ?>" name="change_abook" id="change_abook" /> |
| 102 | <?php |
| 103 | } else { |
| 104 | echo ' '; |
| 105 | } |
| 106 | ?> |
| 107 | </td> |
| 108 | </tr> |
| 109 | <tr> |
| 110 | <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> |
| 111 | <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname', $current_page_args); ?></td> |
| 112 | <td class="colHeader"><?php echo addAbookSort('fullname', $current_page_args); ?></td> |
| 113 | <td class="colHeader"><?php echo addAbookSort('email', $current_page_args); ?></td> |
| 114 | <td class="colHeader"><?php echo addAbookSort('info', $current_page_args); ?></td> |
| 115 | <?php |
| 116 | if ($abook_has_extra_field) { |
| 117 | echo '<td class="colHeader"></td>'; |
| 118 | } |
| 119 | ?> |
| 120 | </tr> |
| 121 | <?php |
| 122 | $count = 1; |
| 123 | if (count($source['Addresses']) == 0) { |
| 124 | echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n"; |
| 125 | } |
| 126 | foreach ($source['Addresses'] as $contact) { |
| 127 | echo '<tr class="' . ($count%2 ? 'even' : 'odd') . '">'; |
| 128 | if (!empty($contact['special_message'])) { |
| 129 | echo '<td class="abookEmpty" colspan="' . $colspan . '">' . $contact['special_message'] . '</td>'; |
| 130 | } else { |
| 131 | $id = $current_backend . '_' . $contact['NickName']; |
| 132 | ?> |
| 133 | <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> |
| 134 | <td class="abookField" style="width:15%"><label for="<?php echo $id . '">' . $contact['NickName']; ?></label></td> |
| 135 | <td class="abookField"><label for="<?php echo $id . '">' . $contact['FullName']; ?></label></td> |
| 136 | <td class="abookField"><input type="hidden" name="<?php echo $id; ?>" value="<?php echo rawurlencode($contact['FullAddress']); ?>" /><?php echo composeLink($contact); ?></td> |
| 137 | <td class="abookField"><label for="<?php echo $id . '">' . $contact['Info']; ?></label></td> |
| 138 | <?php |
| 139 | if ($abook_has_extra_field) { |
| 140 | echo '<td class="abookField">'.$contact['Extra'].'</td>'."\n"; |
| 141 | } |
| 142 | } |
| 143 | ?> |
| 144 | </tr> |
| 145 | <?php |
| 146 | $count++; |
| 147 | } |
| 148 | ?> |
| 149 | </table> |
| 150 | </div> |
| 151 | </form> |