Allow underscores in nicknames by changing id used in forms, add more labels for...
[squirrelmail.git] / templates / default / addrbook_addedit.tpl
CommitLineData
c1ce39b1 1<?php
2/**
3 * addrbook_addedit.tpl
4 *
5 * Display the form elements to add/edit an entry in the address book
6 *
7 * The following variables are available in this template:
f4f64c58 8 * $current_backend - integer containing backend currently displayed.
c1ce39b1 9 * $edit - boolean TRUE if we are editing an existing address.
10 * FALSE if the form is blank for adding a new address.
11 * $writable_backends - array of address book backends that can be written
12 * to. This will be NULL if $edit is TRUE.
13 * $values - array containing values for each field. If $edit is TRUE,
14 * elements will contains the current values for each field
15 * of the entry. If $edit is FALSE, each element will be
16 * empty. The following elements will be present:
17 * $el['FirstName'] - The entry's first name
18 * $el['LastName'] - The entry's last name (surname)
19 * $el['NickName'] - The entry's nickname
20 * $el['Email'] - The entry's email. Note that this field
21 * could be an array!
22 * $el['Info'] - Additional info about this contact
23 *
24 * @copyright &copy; 1999-2006 The SquirrelMail Project Team
25 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
26 * @version $Id$
27 * @package squirrelmail
28 * @subpackage templates
29 */
30
31/** add required includes **/
32
33/** extract template variables **/
34extract($t);
35
36/** Begin template **/
37$formname = $edit ? 'editaddr' : 'addaddr';
38?>
39<div id="addrAddEdit">
40<table cellspacing="0">
41 <tr>
42 <td class="header" colspan="2">
cfd49cc6 43 <?php echo $edit ? _("Update Address") : _("Add to Address Book"); ?>
c1ce39b1 44 </td>
45 </tr>
46 <tr>
47 <td class="fieldName">
48 <label for="nickname"><?php echo _("Nickname"); ?>:</label>
49 </td>
50 <td>
51 <input type="text" name="<?php echo $formname; ?>[nickname]" id="nickname" value=<?php echo '"'.$values['NickName'].'"'; ?> size="15" />
52 <small><?php echo _("Must be unique"); ?></small>
53 </td>
54 </tr>
55 <tr>
56 <td class="fieldName">
57 <label for="email"><?php echo _("E-mail"); ?>:</label>
58 </td>
59 <td>
60 <?php
61 if (is_array($values['Email'])) {
62 echo '<select name="'.$formname.'[email]" id="email">'."\n";
63 foreach ($values['Email'] as $email) {
f4f64c58 64//FIXME: htmlspecialchars should not be needed inside any template files - I think values are already sanitized by the time they get here
c1ce39b1 65 echo '<option value="'.htmlspecialchars($email).'">'.htmlspecialchars($email).'</option>'."\n";
66 }
67 echo '</select>'."\n";
68 } else {
69 echo '<input type="text" name="'.$formname.'[email]" id="email" value="'.$values['Email'].'" size="45" />'."\n";
70 }
71 ?>
72 </td>
73 </tr>
74 <tr>
75 <td class="fieldName">
76 <label for="firstname"><?php echo _("First name"); ?>:</label>
77 </td>
78 <td>
79 <input type="text" name="<?php echo $formname; ?>[firstname]" id="firstname" value=<?php echo '"'.$values['FirstName'].'"'; ?> size="45" />
80 </td>
81 </tr>
82 <tr>
83 <td class="fieldName">
84 <label for="lastname"><?php echo _("Last name"); ?>:</label>
85 </td>
86 <td>
87 <input type="text" name="<?php echo $formname; ?>[lastname]" id="lastname" value=<?php echo '"'.$values['LastName'].'"'; ?> size="45" />
88 </td>
89 </tr>
90 <tr>
91 <td class="fieldName">
92 <label for="info"><?php echo _("Additional info"); ?>:</label>
93 </td>
94 <td>
95 <input type="text" name="<?php echo $formname; ?>[label]" id="info" value=<?php echo '"'.$values['Info'].'"'; ?> size="45" />
96 </td>
97 </tr>
98 <?php
99 if (!$edit) {
100 if (count($writable_backends) > 1) {
101 ?>
102 <tr>
103 <td class="fieldName">
104 <label for="backend"><?php echo _("Add to:"); ?></label>
105 </td>
106 <td>
107 <select name="backend" id="backend">
108 <?php
109 foreach ($writable_backends as $id=>$name) {
f4f64c58 110//FIXME: htmlspecialchars should not be needed inside any template files - I think values are already sanitized by the time they get here
111 echo '<option value="' . $id
112 . ($current_backend == $id ? '" selected="selected"' : '"')
113 . '>' . htmlspecialchars($name) . '</option>' . "\n";
c1ce39b1 114 }
115 ?>
116 </select>
117 </td>
118 </tr>
119 <?php
120 } else {
b116fd78 121 echo '<input type="hidden" name="backend" value="1" />'."\n";
c1ce39b1 122 }
123 }
124 ?>
125 <tr>
126 <td colspan="2" class="addButton">
caa596b2 127 <input type="hidden" name="new_bnum" value="<?php echo $current_backend; ?>" />
cfd49cc6 128 <input type="submit" value=<?php echo '"'.($edit ? _("Update Address") : _("Add Address")).'"'; ?> name="<?php echo $formname; ?>[SUBMIT]" />
c1ce39b1 129 </td>
130 </tr>
131</table>
b116fd78 132</div>