Add template for address book add/edit functions.
authorstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Aug 2006 21:32:45 +0000 (21:32 +0000)
committerstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Aug 2006 21:32:45 +0000 (21:32 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11604 7612ce4b-ef26-0410-bec9-ea0150e637f0

templates/default/addrbook_addedit.tpl [new file with mode: 0644]
templates/default/stylesheet.tpl

diff --git a/templates/default/addrbook_addedit.tpl b/templates/default/addrbook_addedit.tpl
new file mode 100644 (file)
index 0000000..8164aa7
--- /dev/null
@@ -0,0 +1,126 @@
+<?php
+/**
+ * addrbook_addedit.tpl
+ *
+ * Display the form elements to add/edit an entry in the address book
+ * 
+ * The following variables are available in this template:
+ *      $edit       - boolean TRUE if we are editing an existing address.
+ *                    FALSE if the form is blank for adding a new address.
+ *      $writable_backends - array of address book backends that can be written
+ *                    to.  This will be NULL if $edit is TRUE.
+ *      $values     - array containing values for each field.  If $edit is TRUE,
+ *                    elements will contains the current values for each field
+ *                    of the entry.  If $edit is FALSE, each element will be
+ *                    empty.  The following elements will be present:
+ *              $el['FirstName'] - The entry's first name
+ *              $el['LastName']  - The entry's last name (surname)
+ *              $el['NickName']  - The entry's nickname
+ *              $el['Email']     - The entry's email.  Note that this field
+ *                                 could be an array!
+ *              $el['Info']      - Additional info about this contact
+ *
+ * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage templates
+ */
+
+/** add required includes **/
+
+/** extract template variables **/
+extract($t);
+
+/** Begin template **/
+$formname = $edit ? 'editaddr' : 'addaddr';
+?>
+<div id="addrAddEdit">
+<table cellspacing="0">
+ <tr>
+  <td class="header" colspan="2">
+   <?php echo $edit ? _("Update address") : _("Add to address book"); ?>
+  </td>
+ </tr>
+ <tr>
+  <td class="fieldName">
+   <label for="nickname"><?php echo _("Nickname"); ?>:</label>
+  </td>
+  <td>
+   <input type="text" name="<?php echo $formname; ?>[nickname]" id="nickname" value=<?php echo '"'.$values['NickName'].'"'; ?> size="15" />
+   <small><?php echo _("Must be unique"); ?></small>
+  </td>
+ </tr>
+ <tr>
+  <td class="fieldName">
+   <label for="email"><?php echo _("E-mail"); ?>:</label>
+  </td>
+  <td>
+   <?php
+    if (is_array($values['Email'])) {
+        echo '<select name="'.$formname.'[email]" id="email">'."\n";
+        foreach ($values['Email'] as $email) {
+            echo '<option value="'.htmlspecialchars($email).'">'.htmlspecialchars($email).'</option>'."\n";
+        }
+        echo '</select>'."\n";
+    } else {
+        echo '<input type="text" name="'.$formname.'[email]" id="email" value="'.$values['Email'].'" size="45" />'."\n";
+    }
+   ?>
+  </td>
+ </tr>
+ <tr>
+  <td class="fieldName">
+   <label for="firstname"><?php echo _("First name"); ?>:</label>
+  </td>
+  <td>
+   <input type="text" name="<?php echo $formname; ?>[firstname]" id="firstname" value=<?php echo '"'.$values['FirstName'].'"'; ?> size="45" />
+  </td>
+ </tr>
+ <tr>
+  <td class="fieldName">
+   <label for="lastname"><?php echo _("Last name"); ?>:</label>
+  </td>
+  <td>
+   <input type="text" name="<?php echo $formname; ?>[lastname]" id="lastname" value=<?php echo '"'.$values['LastName'].'"'; ?> size="45" />
+  </td>
+ </tr>
+ <tr>
+  <td class="fieldName">
+   <label for="info"><?php echo _("Additional info"); ?>:</label>
+  </td>
+  <td>
+   <input type="text" name="<?php echo $formname; ?>[label]" id="info" value=<?php echo '"'.$values['Info'].'"'; ?> size="45" />
+  </td>
+ </tr>
+ <?php
+    if (!$edit) {
+        if (count($writable_backends) > 1) {
+            ?>
+ <tr>
+  <td class="fieldName">
+   <label for="backend"><?php echo _("Add to:"); ?></label>
+  </td>
+  <td>
+   <select name="backend" id="backend">
+    <?php
+        foreach ($writable_backends as $id=>$name) {
+            echo '<option value="'.$id.'">'.htmlspecialchars($name).'</option>'."\n";
+        }
+    ?>
+   </select>
+  </td>
+ </tr>
+            <?php
+        } else {
+            echo '<input type="hidden" name="backend" value="1">'."\n";
+        }
+    }
+ ?>
+ <tr>
+  <td colspan="2" class="addButton">
+   <input type="submit" value=<?php echo '"'.($edit ? _("Update address") : _("Add address")).'"'; ?> name="<?php echo $formname; ?>[SUBMIT]" />
+  </td>
+ </tr>
+</table>
+</div>
\ No newline at end of file
index f26d255..b648152 100644 (file)
@@ -408,4 +408,45 @@ tr.odd  {
 
 #addrBookSearch td.buttons  {
     text-align: center;
+}
+
+#addrAddEdit    {
+    text-align: center;
+}
+
+#addrAddEdit    table   {
+    border: 1px solid <?php echo $color[9]; ?>;
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: 6px;
+    margin-bottom: 6px;
+    width: 95%
+}
+
+#addrAddEdit    td.header   {
+    background: <?php echo $color[9]; ?>;
+    text-align: center;
+    font-weight: bold;
+}
+
+#addrAddEdit    td.fieldName   {
+    text-align: right;
+    width: 30%;
+}
+
+#addrAddEdit    td.addButton   {
+    text-align: center;
+}
+
+#addrAddEdit    td  {
+    text-align: left;
+    padding: 2px;
+}
+
+#addrAddEdit    input   {
+    font-size: 75%;
+}
+
+#addrAddEdit    select  {
+    font-size: 75%;
 }
\ No newline at end of file