浏览代码

Add template for address book add/edit functions.

stevetruckstuff 19 年之前
父节点
当前提交
fe43630929
共有 2 个文件被更改,包括 167 次插入0 次删除
  1. 126 0
      templates/default/addrbook_addedit.tpl
  2. 41 0
      templates/default/stylesheet.tpl

+ 126 - 0
templates/default/addrbook_addedit.tpl

@@ -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>

+ 41 - 0
templates/default/stylesheet.tpl

@@ -408,4 +408,45 @@ tr.odd  {
 
 
 #addrBookSearch td.buttons  {
 #addrBookSearch td.buttons  {
     text-align: center;
     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%;
 }
 }