Template for advanced identity controls
authorstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 25 Aug 2006 23:09:07 +0000 (23:09 +0000)
committerstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 25 Aug 2006 23:09:07 +0000 (23:09 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11644 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/options_identities.php
templates/default/options_advidentity_list.tpl [new file with mode: 0644]
templates/default/stylesheet.tpl

index e6f348d4706d3f8273534578f3fd962a0f75fc65..792f9a92d2eab92f3199b95c30c52e7e961ec752 100644 (file)
@@ -66,44 +66,42 @@ displayPageHeader($color, 'None');
 /* since 1.1.3 */
 do_hook('options_identities_top');
 
-$td_str = '';
-$td_str .= '<form name="f" action="options_identities.php" method="post"><br />' . "\n";
-$td_str .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">' . "\n";
-$cnt = count($identities);
-foreach( $identities as $iKey=>$ident ) {
-
-    if ($iKey == 0) {
-        $hdr_str = _("Default Identity");
-    } else {
-        $hdr_str = sprintf( _("Alternate Identity %d"), $iKey);
-    }
+$i = array();
+foreach ($identities as $key=>$ident) {
+    $a = array();
+    $a['Title'] = $key==0 ? _("Default Identity") : sprintf(_("Alternate Identity %d"), $key);
+    $a['New'] = false;
+    $a['Default'] = $key==0;
+    $a['FullName'] = htmlspecialchars($ident['full_name']);
+    $a['Email'] = htmlspecialchars($ident['email_address']);
+    $a['ReplyTo'] = htmlspecialchars($ident['reply_to']);
+    $a['Signature'] = htmlspecialchars($ident['signature']);
+    $i[$key] = $a;
+}
 
-    $td_str .= ShowIdentityInfo( $hdr_str, $ident, $iKey );
+$a = array();
+$a['Title'] = _("Add New Identity");
+$a['New'] = true;
+$a['Default'] = false;
+$a['FullName'] = '';
+$a['Email'] = '';
+$a['ReplyTo'] = '';
+$a['Signature'] = '';
+$i[count($i)] = $a;
 
-}
+echo '<form name="f" action="options_identities.php" method="post">' . "\n";
+
+$oTemplate->assign('identities', $i);
+$oTemplate->display('options_advidentity_list.tpl');
 
-$td_str .= ShowIdentityInfo( _("Add a New Identity"), array('full_name'=>'','email_address'=>'','reply_to'=>'','signature'=>''), $cnt);
-$td_str .= '</table>' . "\n";
-$td_str .= '</form>';
-
-echo '<br /> ' . "\n" .
-    html_tag('table', "\n" .
-        html_tag('tr', "\n" .
-            html_tag('td' , "\n" .
-            '<b>' . _("Options") . ' - ' . _("Advanced Identities") . '</b><br />' .
-            html_tag('table', "\n" .
-                html_tag('tr', "\n" .
-                    html_tag('td', "\n" .
-                        html_tag('table' , "\n" .
-                            html_tag('tr' , "\n" .
-                                html_tag('td', "\n" .  $td_str ,'','', 'style="text-align:center;"')
-                            ),
-                        '', '', 'width="80%" cellpadding="2" cellspacing="0" border="0"' ) ,
-                    'center', $color[4])
-                ),
-            '', '', 'width="100%" border="0" cellpadding="1" cellspacing="1"' )) ,
-        'center', $color[0]),
-    'center', '', 'width="95%" border="0" cellpadding="2" cellspacing="0"' ) . '</body></html>';
+echo "</form>\n";
+
+$oTemplate->display('footer.tpl');
+
+/**
+ * The functions below should not be needed with the additions of templates,
+ * however they will remain in case plugins use them.
+ */
 
 /**
  * Returns html formated identity form fields
diff --git a/templates/default/options_advidentity_list.tpl b/templates/default/options_advidentity_list.tpl
new file mode 100644 (file)
index 0000000..cc09381
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+/**
+ * options_ident_advanced.tpl
+ *
+ * Template to handle advanced identity management
+ * 
+ * The following variables are available in this template:
+ *      $identities - array containing all identities.  Each element contains
+ *                    the following fields:
+ *          $el['Title']    - title to be displayed in each block
+ *          $el['New']      - boolean TRUE if this element is for a new identity.
+ *                            FALSE otherwise.
+ *          $el['Default']  - boolean TRUE if this is the default identity.
+ *          $el['FullName'] - value for the Full Name field
+ *          $el['Email']    - value for the email field
+ *          $el['ReplyTo']  - value for the Reply To field
+ *          $el['Signature']- value for the Signature field
+ *
+ * @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 **/
+?>
+<div id="optionsIdentity">
+<table cellspacing="0" class="table1">
+ <tr>
+  <td class="header1">
+   <?php echo _("Options"); ?> - <?php echo _("Advanced Identities"); ?>
+  </td>
+ </tr>
+ <tr>
+  <td>
+   <?php
+    foreach ($identities as $index=>$identity) {
+        if ($identity['New']) {
+            ?>
+   <hr />
+            <?php
+        }
+        ?>
+   <table cellspacing="0" class="table2">
+    <tr>
+     <td colspan="2" class="header2">
+      <?php echo $identity['Title']; ?>
+     </td>
+    </tr>
+    <tr>
+     <td class="fieldName">
+      <?php echo _("Full Name"); ?>
+     </td>
+     <td class="fieldValue">
+      <input type="text" name="newidentities[<?php echo $index; ?>][full_name]" size="50" value="<?php echo $identity['FullName']; ?>" />
+     </td>
+    </tr>
+    <tr>
+     <td class="fieldName">
+      <?php echo _("E-Mail Address"); ?>
+     </td>
+     <td class="fieldValue">
+      <input type="text" name="newidentities[<?php echo $index; ?>][email_address]" size="50" value="<?php echo $identity['Email']; ?>" />
+     </td>
+    </tr>
+    <tr>
+     <td class="fieldName">
+      <?php echo _("Reply To"); ?>
+     </td>
+     <td class="fieldValue">
+      <input type="text" name="newidentities[<?php echo $index; ?>][reply_to]" size="50" value="<?php echo $identity['ReplyTo']; ?>" />
+     </td>
+    </tr>
+    <tr>
+     <td class="fieldName">
+      <?php echo _("Signature"); ?>
+     </td>
+     <td class="fieldValue">
+      <textarea name="newidentities[<?php echo $index; ?>][signature]" cols="50" rows="5"><?php echo $identity['Signature']; ?></textarea>
+     </td>
+    </tr>
+    <?php echo concat_hook_function('options_identities_table', array('', $identity['New'], $index)); ?>
+    <tr>
+     <td colspan="2" class="actionButtons">
+      <input type="submit" name="smaction[save][<?php echo $index; ?>]" value="<?php echo _("Save / Update"); ?>" />
+      <?php
+        if ($index > 0 && !$identity['New']) {
+            ?>
+      <input type="submit" name="smaction[makedefault][<?php echo $index; ?>]" value="<?php echo _("Make Default"); ?>" />
+      <input type="submit" name="smaction[delete][<?php echo $index; ?>]" value="<?php echo _("Delete"); ?>" />
+            <?php
+        }
+        if ($index > 1 && !$identity['New']) {
+            ?>
+      <input type="submit" name="smaction[move][<?php echo $index; ?>]" value="<?php echo _("Move Up"); ?>" />
+            <?php
+        }
+        echo concat_hook_function('options_identities_buttons', array($identity['New'], $index));
+      ?>
+     </td>
+    </tr>
+   </table>
+        <?php
+    }
+   ?>
+  </td>
+ </tr>
+</table>
+</div>
\ No newline at end of file
index 4abb858738d7f196d4d1846f8435251e52a35b4d..dddc4c7fbc722da5a90c5ecb33452548b63b86ac 100644 (file)
@@ -138,6 +138,18 @@ table.table1    td  {
     padding-right: 2px;
 }
 
+table.table2    {
+    border: 1px solid <?php echo $color[9]; ?>;
+    width: 80%;
+    margin-left: auto;
+    margin-right: auto;
+}
+
+table.table2    td  {
+    padding-left: 2px;
+    padding-right: 2px;
+}
+
 td.emptyList    {
     text-align: center;
     font-weight: bold;
@@ -153,8 +165,8 @@ td.header2  {
     background: <?php echo $color[9]; ?>;
     text-align: center;
     font-weight: bold;
-    padding-top: 4px;
-    padding-bottom: 4px;
+    padding-top: 2px;
+    padding-bottom: 2px;
 }
 
 td.header3  {
@@ -695,3 +707,30 @@ tr.odd  {
     margin-left: 10px;
 }
 
+#optionsIdentity    table   {
+    margin-top: 10px;
+    margin-bottom: 10px;
+}
+
+#optionsIdentity    table.table2 tr  {
+    background: <?php echo $color[0]; ?>;
+}
+
+#optionsIdentity    td.fieldName    {
+    text-align: <?php echo SQM_ALIGN_RIGHT; ?>;
+    width: 30%;
+}
+
+#optionsIdentity    td.fieldValue   {
+    text-align: <?php echo SQM_ALIGN_LEFT; ?>;
+}
+
+#optionsIdentity    td.actionButtons  {
+    text-align: center;
+}
+
+#optionsIdentity hr  {
+    width: 95%;
+    border: 1px solid <?php echo $color[9]; ?>;
+}
+