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