| 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 © 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 | <?php if (!empty($plugin_output['address_book_navigation'])) echo $plugin_output['address_book_navigation']; ?> |
| 67 | </td> |
| 68 | <td colspan=<?php echo '"'.($colspan - 3).'"'; ?> class="abookSwitch"> |
| 69 | <?php |
| 70 | if (count($backends) > 0) { |
| 71 | ?> |
| 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 | ?> |
| 78 | </select> |
| 79 | <input type="submit" value=<?php echo '"'._("Change").'"'; ?> name="change_abook" id="change_abook" /> |
| 80 | <?php |
| 81 | } else { |
| 82 | echo ' '; |
| 83 | } |
| 84 | ?> |
| 85 | </td> |
| 86 | </tr> |
| 87 | <tr> |
| 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> |
| 89 | <td class="colHeader" style="width:15%"><?php echo addAbookSort('nickname'); ?></td> |
| 90 | <td class="colHeader"><?php echo addAbookSort('fullname'); ?></td> |
| 91 | <td class="colHeader"><?php echo addAbookSort('email'); ?></td> |
| 92 | <td class="colHeader"><?php echo addAbookSort('info'); ?></td> |
| 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) { |
| 105 | $id = $contact['NickName'] .'_'. $current_backend; |
| 106 | ?> |
| 107 | <tr class=<?php echo '"'.($count%2 ? 'even' : 'odd').'"'; ?>> |
| 108 | <td class="abookField" style="width:1%"><?php echo ($source['BackendWritable'] ? '<input type="checkbox" name="sel[' . $count . ']" value="'.$id.'" id="'.$id.'" />' : ''); ?></td> |
| 109 | <td class="abookField" style="width:15%"><label for=<?php echo '"'.$id.'"'; ?>><?php echo $contact['NickName']; ?></label></td> |
| 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> |
| 124 | </div> |