Address book templates
authorstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Aug 2006 15:44:31 +0000 (15:44 +0000)
committerstevetruckstuff <stevetruckstuff@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Tue, 15 Aug 2006 15:44:31 +0000 (15:44 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11592 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/addrbook_popup.php
src/addrbook_search.php
src/addrbook_search_html.php
src/addressbook.php
templates/default/addrbook_search_list.tpl [new file with mode: 0644]
templates/default/addressbook_list.tpl
templates/default/addressbook_popup.tpl [new file with mode: 0644]
templates/default/addressbook_search_form.tpl [new file with mode: 0644]
templates/default/stylesheet.tpl

index 54abdbaff811c9932021da84fc3dbd217dd98e9f..7a9745880a63e6de17a9db70c4402cb099c2e44b 100644 (file)
  */
 include('../include/init.php');
 
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
-  "http://www.w3.org/TR/1999/REC-html401-19991224/frameset.dtd">
+displayHtmlHeader($org_title .': '. _("AddressBook"), '', false, true);
 
-<html>
-    <head>
-        <meta name="robots" content="noindex,nofollow">
-        <title><?php echo "$org_title: " . _("Address Book"); ?></title>
-    </head>
-    <frameset rows="60,*" border="0">
-        <frame name="abookmain"
-               marginwidth="0"
-               scrolling="no"
-               border="0"
-               src="addrbook_search.php?show=form" />
-        <frame name="abookres"
-               marginwidth="0"
-               border="0"
-               src="addrbook_search.php?show=blank" />
-    </frameset>
-</html>
\ No newline at end of file
+$oTemplate->display('addressbook_popup.tpl');
+
+$oTemplate->display('footer.tpl');
+?>
\ No newline at end of file
index f75abff9ce2143422f44613f20f2b879b000fff4..a403ca7461f175a12fabf1e595e3449466c98bd0 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 /**
  * addrbook_search.php
  *
@@ -23,75 +22,7 @@ require('../include/init.php');
 
 include_once(SM_PATH . 'functions/forms.php');
 include_once(SM_PATH . 'functions/addressbook.php');
-
-/**
- * Function to include JavaScript code
- * @return void
- */
-function insert_javascript() {
-    ?>
-    <script type="text/javascript"><!--
-
-    function to_and_close($addr) {
-        to_address($addr);
-        parent.close();
-    }
-
-    function to_address($addr) {
-        var prefix    = "";
-        var pwintype = typeof parent.opener.document.compose;
-
-        $addr = $addr.replace(/ {1,35}$/, "");
-
-        if (pwintype != "undefined") {
-            if (parent.opener.document.compose.send_to.value) {
-                prefix = ", ";
-                parent.opener.document.compose.send_to.value =
-                    parent.opener.document.compose.send_to.value + ", " + $addr;
-            } else {
-                parent.opener.document.compose.send_to.value = $addr;
-            }
-        }
-    }
-
-    function cc_address($addr) {
-        var prefix    = "";
-        var pwintype = typeof parent.opener.document.compose;
-
-        $addr = $addr.replace(/ {1,35}$/, "");
-
-        if (pwintype != "undefined") {
-            if (parent.opener.document.compose.send_to_cc.value) {
-                prefix = ", ";
-                parent.opener.document.compose.send_to_cc.value =
-                    parent.opener.document.compose.send_to_cc.value + ", " + $addr;
-            } else {
-                parent.opener.document.compose.send_to_cc.value = $addr;
-            }
-        }
-    }
-
-    function bcc_address($addr) {
-        var prefix    = "";
-        var pwintype = typeof parent.opener.document.compose;
-
-        $addr = $addr.replace(/ {1,35}$/, "");
-
-        if (pwintype != "undefined") {
-            if (parent.opener.document.compose.send_to_bcc.value) {
-                prefix = ", ";
-                parent.opener.document.compose.send_to_bcc.value =
-                    parent.opener.document.compose.send_to_bcc.value + ", " + $addr;
-            } else {
-                parent.opener.document.compose.send_to_bcc.value = $addr;
-            }
-        }
-    }
-
-// --></script>
-<?php
-} /* End of included JavaScript */
-
+include_once(SM_PATH . 'templates/util_addressbook.php');
 
 /**
  * List search results
@@ -100,55 +31,15 @@ function insert_javascript() {
  * @return void
  */
 function display_result($res, $includesource = true) {
-    global $color;
+    global $oTemplate, $oErrorHandler;
 
     if(sizeof($res) <= 0) return;
 
-    insert_javascript();
-
-    $line = 0;
-    echo html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) .
-    html_tag( 'tr', '', '', $color[9] ) .
-    html_tag( 'th', '&nbsp;', 'left' ) .
-    html_tag( 'th', '&nbsp;' . _("Name"), 'left' ) .
-    html_tag( 'th', '&nbsp;' . _("E-mail"), 'left' ) .
-    html_tag( 'th', '&nbsp;' . _("Info"), 'left' );
-
-    if ($includesource) {
-        echo html_tag( 'th', '&nbsp;' . _("Source"), 'left', '', 'width="10%"' );
-    }
-    echo "</tr>\n";
-
-    while (list($undef, $row) = each($res)) {
-        $email = htmlspecialchars(addcslashes(AddressBook::full_address($row), "'"), ENT_QUOTES);
-        if ($line % 2) {
-            $tr_bgcolor = $color[12];
-        } else {
-            $tr_bgcolor = $color[4];
-        }
-        echo html_tag( 'tr', '', '', $tr_bgcolor, 'style="white-space: nowrap;"' ) .
-        html_tag( 'td',
-             '<small><a href="javascript:to_address(' .
-                                       "'" . $email . "');\">"._("To")."</a> | " .
-             '<a href="javascript:cc_address(' .
-                                       "'" . $email . "');\">"._("Cc")."</a> | " .
-             '<a href="javascript:bcc_address(' .
-                                 "'" . $email . "');\">"._("Bcc")."</a></small>",
-        'center', '', 'valign="top" width="5%" style="white-space: nowrap;"' ) .
-        html_tag( 'td', '&nbsp;' . htmlspecialchars($row['name']), 'left', '', 'valign="top" style="white-space: nowrap;"' ) .
-        html_tag( 'td', '&nbsp;' .
-             '<a href="javascript:to_and_close(' .
-                 "'" . $email . "');\">" . htmlspecialchars($row['email']) . '</a>'
-        , 'left', '', 'valign="top"' ) .
-        html_tag( 'td', htmlspecialchars($row['label']), 'left', '', 'valign="top" style="white-space: nowrap;"' );
-        if ($includesource) {
-            echo html_tag( 'td', '&nbsp;' . $row['source'], 'left', '', 'valign="top" style="white-space: nowrap;"' );
-        }
-
-        echo "</tr>\n";
-        $line++;
-    }
-    echo '</table>';
+    $oTemplate->assign('use_js', true);
+    $oTemplate->assign('include_abook_name', $includesource);
+    $oTemplate->assign('addresses', formatAddressList($res));
+    
+    $oTemplate->display('addrbook_search_list.tpl');    
 }
 
 /* ================= End of functions ================= */
@@ -169,30 +60,17 @@ if (! sqgetGlobalVar('backend', $backend, SQ_POST)) {
 }
 
 displayHtmlHeader();
+echo "<body>\n";
 
 /** set correct value of $default_charset */
 global $default_charset;
 set_my_charset();
 
-/* Choose correct colors for top and bottom frame */
-if ($show == 'form' && !isset($listall)) {
-    echo '<body text="' . $color[6] . '" bgcolor="' . $color[3] . '" ' .
-               'link="' . $color[6] . '" vlink="'   . $color[6] . '" ' .
-                                        'alink="'   . $color[6] . '" ' .
-         'OnLoad="document.sform.query.focus();">';
-} else {
-    echo '<body text="' . $color[8] . '" bgcolor="' . $color[4] . '" ' .
-               'link="' . $color[7] . '" vlink="'   . $color[7] . '" ' .
-                                        'alink="'   . $color[7] . "\">\n";
-}
-
 /* Empty search */
 if (empty($query) && empty($show) && !isset($listall)) {
-    echo html_tag( 'p', '<br />' .
-                      _("No persons matching your search were found"),
-            'center' ) .
-          "\n</body></html>\n";
-    exit;
+    $oTemplate->assign('note', htmlspecialchars(_("No persons matching your search were found")));
+    $oTemplate->display('note.tpl');
+#    exit;
 }
 
 /* Initialize addressbook, show init errors only in bottom frame */
@@ -201,43 +79,13 @@ $abook = addressbook_init($showerr);
 
 /* Create search form (top frame) */
 if ($show == 'form' && ! isset($listall)) {
-    echo '<form name="sform" target="abookres" action="addrbook_search.php'.
-            '" method="post">' . "\n" .
-         html_tag( 'table', '', '', '', 'border="0" width="100%" height="100%"' ) .
-         html_tag( 'tr' ) .
-         html_tag( 'td', '  <strong><label for="query">' . _("Search for") .
-             "</label></strong>\n", 'left', '',
-             'style="white-space: nowrap;" valign="middle" width="10%"' ) .
-         html_tag( 'td', '', 'left', '', '' ) .
-         addInput('query', $query, 28);
-
-    /* List all backends to allow the user to choose where to search */
-    if ($abook->numbackends > 1) {
-        echo '<strong><label for="backend">' . _("in") . '</label></strong>&nbsp;'."\n";
-        $selopts = array();
-        $selopts['-1'] = _("All address books");
-
-        $ret = $abook->get_backend_list();
-        while (list($undef,$v) = each($ret)) {
-            $selopts[$v->bnum] = $v->sname;
-        }
-        echo addSelect('backend', $selopts, '-1', TRUE);
-    } else {
-        echo addHidden('backend', '-1');
-    }
-
-    echo '</td></tr>' .
-    html_tag( 'tr',
-                    html_tag( 'td', '', 'left' ) .
-                    html_tag( 'td',
-                            '<input type="submit" value="' . _("Search") . '" name="show" />' .
-                            '&nbsp;|&nbsp;<input type="submit" value="' . _("List all") .
-                            '" name="listall" />' . "\n" .
-                            '&nbsp;|&nbsp;<input type="button" value="' . _("Close") .
-                            '" onclick="parent.close();" />' . "\n" ,
-                    'left' )
-            ) .
-         '</table></form>' . "\n";
+    echo "<form name=\"sform\" target=\"abookres\" action=\"addrbook_search.php\" method=\"POST\">\n";
+    
+    $oTemplate->assign('use_js', true);
+    $oTemplate->assign('backends', getBackends());
+    $oTemplate->display('addressbook_search_form.tpl');
+    
+    echo "</form>\n";
 } else {
     /**
      * List addresses (bottom frame)
@@ -257,10 +105,7 @@ if ($show == 'form' && ! isset($listall)) {
                 usort($res,'alistcmp');
                 display_result($res, false);
             } else {
-                echo html_tag( 'p', '<strong>' .
-                               sprintf(_("Unable to list addresses from %s"),
-                                       $abook->backends[$backend]->sname) . '</strong>' ,
-                               'center' ) . "\n";
+                plain_error_message(sprintf(_("Unable to list addresses from %s"), $abook->backends[$backend]->sname));
             }
         } else {
             $res = $abook->list_addr();
@@ -278,14 +123,10 @@ if ($show == 'form' && ! isset($listall)) {
         }
 
         if (!is_array($res)) {
-            echo html_tag( 'p', '<b><br />' .
-                           _("Your search failed with the following error(s)") .
-                           ':<br />' . nl2br(htmlspecialchars($abook->error)) . "</b>\n" ,
-                           'center' );
+            plain_error_message( _("Your search failed with the following error(s)") .':<br />'. nl2br(htmlspecialchars($abook->error)) );
         } elseif (sizeof($res) == 0) {
-            echo html_tag( 'p', '<br /><b>' .
-                           _("No persons matching your search were found") . "</b>\n" ,
-                           'center' );
+            $oTemplate->assign('note', _("No persons matching your search were found"));
+            $oTemplate->display('note.tpl');
         } else {
             display_result($res);
         }
@@ -294,8 +135,9 @@ if ($show == 'form' && ! isset($listall)) {
          * listall is not set, query is not set or empty.
          * User hit search button without entering search expression.
          */
-        echo html_tag( 'p', '<br /><b>' . _("Nothing to search") . "</b>\n",'center' );
+        plain_error_message(_("Nothing to search"));
     }
 }
+
 $oTemplate->display('footer.tpl');
-?>
+?>
\ No newline at end of file
index ac0be5609901293ef996935f7239efd147327d13..ec37906654d5a7acb9ba15641b2e08dcaa7d0c9e 100644 (file)
@@ -26,10 +26,11 @@ if (!isset($bInit)) {
 /** SquirrelMail required files. */
 include_once(SM_PATH . 'functions/date.php');
 include_once(SM_PATH . 'functions/addressbook.php');
+include_once(SM_PATH . 'templates/util_addressbook.php');
 
 sqgetGlobalVar('session',   $session,   SQ_POST);
 sqgetGlobalVar('mailbox',   $mailbox,   SQ_POST);
-if (! sqgetGlobalVar('addrquery', $addrquery, SQ_POST))
+if (! sqgetGlobalVar('query', $addrquery, SQ_POST))
      $addrquery='';
 sqgetGlobalVar('listall',   $listall,   SQ_POST);
 sqgetGlobalVar('backend',   $backend,   SQ_POST);
@@ -66,88 +67,21 @@ function addr_insert_hidden() {
 function addr_display_result($res, $includesource = true) {
     global $color, $javascript_on, $PHP_SELF, $squirrelmail_language;
 
+    global $oTemplate, $oErrorHandler;
+    
     if (sizeof($res) <= 0) return;
 
-    echo addForm($PHP_SELF, 'post', 'addrbook').
+    echo addForm($PHP_SELF, 'post', 'addressbook').
          addHidden('html_addr_search_done', 'true');
     addr_insert_hidden();
-    $line = 0;
 
-    if ($javascript_on) {
-        print
-            '<script type="text/javascript">' .
-            "\n<!-- \n" .
-            "function CheckAll(ch) {\n" .
-            "   for (var i = 0; i < document.addrbook.elements.length; i++) {\n" .
-            "       if( document.addrbook.elements[i].type == 'checkbox' &&\n" .
-            "           document.addrbook.elements[i].name.substr(0,16) == 'send_to_search['+ch ) {\n" .
-            "           document.addrbook.elements[i].checked = !(document.addrbook.elements[i].checked);\n".
-            "       }\n" .
-            "   }\n" .
-            "}\n" .
-            "//-->\n" .
-            "</script>\n";
-        $chk_all = '<a href="#" onclick="CheckAll(\'T\');">'._("All").'</a>&nbsp;<font color="'.$color[9].'">'._("To").'</font>'.
-            '&nbsp;&nbsp;'.
-            '<a href="#" onclick="CheckAll(\'C\');">' . _("All") . '</a>&nbsp;<font color="'.$color[9].'">'._("Cc").'</font>'.
-            '&nbsp;&nbsp;'.
-            '<a href="#" onclick="CheckAll(\'B\');">' . _("All") . '</a>';
-    } else {
-        // check_all links are used only in JavaScript. disable links in js=off environment.
-        $chk_all = '';
-    }
-    echo html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) .
-    html_tag( 'tr', '', '', $color[9] ) .
-    html_tag( 'th', '&nbsp;' . $chk_all, 'left' ) .
-    html_tag( 'th', '&nbsp;' . _("Name"), 'left' ) .
-    html_tag( 'th', '&nbsp;' . _("E-mail"), 'left' ) .
-    html_tag( 'th', '&nbsp;' . _("Info"), 'left' );
-
-    if ($includesource) {
-        echo html_tag( 'th', '&nbsp;' . _("Source"), 'left', '', 'width="10%"' );
-    }
-
-    echo "</tr>\n";
-
-    foreach ($res as $row) {
-        $email = AddressBook::full_address($row);
-        if ($line % 2) {
-            $tr_bgcolor = $color[12];
-        } else {
-            $tr_bgcolor = $color[4];
-        }
-
-        echo html_tag( 'tr', '', '', $tr_bgcolor, 'style="white-space: nowrap;"' ) .
-        html_tag( 'td',
-            addCheckBox('send_to_search[T'.$line.']', FALSE, $email).
-            '&nbsp;' . _("To") . '&nbsp;' .
-            addCheckBox('send_to_search[C'.$line.']', FALSE, $email).
-            '&nbsp;' . _("Cc") . '&nbsp;' .
-            addCheckBox('send_to_search[B'.$line.']', FALSE, $email).
-            '&nbsp;' . _("Bcc") . '&nbsp;' ,
-        'center', '', 'width="5%" style="white-space: nowrap;"' ) .
-        html_tag( 'td', '&nbsp;' . htmlspecialchars($row['name']) . '&nbsp;', 'left', '', 'style="white-space: nowrap;"' ) .
-        html_tag( 'td', '&nbsp;' . htmlspecialchars($row['email']) . '&nbsp;', 'left', '', 'style="white-space: nowrap;"' ) .
-        html_tag( 'td', '&nbsp;' . htmlspecialchars($row['label']) . '&nbsp;', 'left', '', 'style="white-space: nowrap;"' );
-
-        if ($includesource) {
-            echo html_tag( 'td', '&nbsp;' . $row['source'] . '&nbsp;', 'left', '', 'style="white-space: nowrap;"' );
-        }
-        echo "</tr>\n";
-        $line ++;
-    }
-    if ($includesource) { $td_colspan = '5'; } else { $td_colspan = '4'; }
-    echo html_tag( 'tr',
-                html_tag( 'td',
-                        '<input type="submit" name="addr_search_done" value="' .
-                        _("Use Addresses") . '" /> ' .
-                        '<input type="submit" name="addr_search_cancel" value="' .
-                        _("Cancel") . '" />',
-                'center', '', 'colspan="'. $td_colspan .'"' )
-            ) .
-         '</table>' .
-         addHidden('html_addr_search_done', '1').
-         '</form>';
+    $oTemplate->assign('use_js', false);
+    $oTemplate->assign('include_abook_name', $includesource);
+    $oTemplate->assign('addresses', formatAddressList($res));
+    
+    $oTemplate->display('addrbook_search_list.tpl');
+    
+    echo '</form>';
 }
 
 /* --- End functions --- */
@@ -167,49 +101,19 @@ set_my_charset();
 $abook = addressbook_init();
 
 
-echo '<br />' .
-html_tag( 'table',
-    html_tag( 'tr',
-        html_tag( 'td', '<b>' . _("Address Book Search") . '</b>', 'center', $color[0] )
-    ) ,
-'center', '', 'width="95%" cellpadding="2" cellspacing="2" border="0"' );
-
-
 /* Search form */
-echo '<div style="text-align: center;">' .
-    html_tag( 'table', '', 'center', '', 'border="0"' ) .
-    html_tag( 'tr' ) .
-    html_tag( 'td', '', 'left', '', 'style="white-space: nowrap;" valign="middle"' ) . "\n" .
-    addForm($PHP_SELF.'?html_addr_search=true', 'post', 'f').
-    "\n<div style=\"text-align: center;\">\n" .
-    '  <nobr><strong>' . _("Search for") . "</strong>\n";
+echo addForm($PHP_SELF.'?html_addr_search=true', 'post', 'f');
 addr_insert_hidden();
-echo addInput('addrquery', $addrquery, 26);
-
-/* List all backends to allow the user to choose where to search */
-if (!isset($backend)) { $backend = ''; }
-if ($abook->numbackends > 1) {
-    echo '<strong>' . _("in") . '</strong>&nbsp;';
-
-    $selopts['-1'] = _("All address books");
-    $ret = $abook->get_backend_list();
-
-    while (list($undef,$v) = each($ret)) {
-        $selopts[$v->bnum] = $v->sname;
-    }
-    echo addSelect('backend', $selopts, $backend, TRUE);
-} else {
-    echo addHidden('backend', '-1');
-}
 if (isset($session)) {
     echo addHidden('session', $session);
 }
 
-echo '<input type="submit" value="' . _("Search") . '" />' .
-     '&nbsp;|&nbsp;<input type="submit" value="' . _("List all") .
-     '" name="listall" />' . "\n" .
-     '</form></div></td></tr></table>' . "\n";
-echo '</div>';
+$oTemplate->assign('use_js', false);
+$oTemplate->assign('backends', getBackends());
+
+$oTemplate->display('addressbook_search_form.tpl');
+
+echo "</form>\n";
 do_hook('addrbook_html_search_below');
 /* End search form */
 
@@ -229,10 +133,7 @@ if ($addrquery == '' || ! empty($listall)) {
             usort($res,'alistcmp');
             addr_display_result($res, false);
         } else {
-            echo html_tag( 'p', '<strong><br />' .
-                 sprintf(_("Unable to list addresses from %s"),
-                 $abook->backends[$backend]->sname) . "</strong>\n" ,
-            'center' );
+            plain_error_message(_("Unable to list addresses from %s"), $abook->backends[$backend]->sname);
         }
 
     } else {
@@ -251,27 +152,17 @@ if ($addrquery == '' || ! empty($listall)) {
     }
 
     if (!is_array($res)) {
-        echo html_tag( 'p', '<b><br />' .
-                       _("Your search failed with the following error(s)") .
-                       ':<br />' . nl2br(htmlspecialchars($abook->error)) . "</b>\n" ,
-                       'center' ) . "\n";
-        $oTemplate->display('footer.tpl');
+        plain_error_message(_("Your search failed with the following error(s)") .':<br />'. nl2br(htmlspecialchars($abook->error)));
+    } elseif (sizeof($res) == 0) {
+        $oTemplate->assign('note', _("No persons matching your search were found"));
+        $oTemplate->display('note.tpl');
     } else {
-        if (sizeof($res) == 0) {
-            echo html_tag( 'p', '<br /><b>' .
-                           _("No persons matching your search were found") . "</b>\n" ,
-                           'center' ) . "\n";
-            $oTemplate->display('footer.tpl');
-        } else {
-            addr_display_result($res);
-        }
+        addr_display_result($res);
     }
 } else {
     // not first time display, not listall and search is empty
     // TODO: I think, this part of control structure is never reached.
-    echo html_tag( 'p', '<br /><b>' .
-                   _("Nothing to search") . "</b>\n" ,
-                   'center' );
+    plain_error_message(_("Nothing to search"));
 }
 
 if ($addrquery == '' || sizeof($res) == 0) {
@@ -282,5 +173,7 @@ if ($addrquery == '' || sizeof($res) == 0) {
          '</form></div></nobr>';
 }
 
+echo '<hr />';
+
 $oTemplate->display('footer.tpl');
 ?>
\ No newline at end of file
index 42f5d2dd90c735acfd9a3ead024f623b5dc97924..4edf5a72436c14c131e87a669d386bf22e2a66ec 100644 (file)
@@ -20,6 +20,8 @@ include('../include/init.php');
 /** SquirrelMail required files. */
 /* address book functions */
 require_once(SM_PATH . 'functions/addressbook.php');
+include_once(SM_PATH . 'templates/util_addressbook.php');
+
 /* form functions */
 require_once(SM_PATH . 'functions/forms.php');
 
@@ -251,19 +253,7 @@ while (list($k, $backend) = each ($abook->backends)) {
     if ($start >= $count) $start = 0;
     $alist = array_slice($alist,$start,15);
    
-    while(list($undef,$row) = each($alist)) {
-        $contact = array (
-                            'FirstName'     => htmlspecialchars($row['firstname']),
-                            'LastName'      => htmlspecialchars($row['lastname']),
-                            'FullName'      => htmlspecialchars($row['name']),
-                            'NickName'      => htmlspecialchars($row['nickname']),
-                            'Email'         => htmlspecialchars($row['email']),
-                            'FullAddress'   => htmlspecialchars($abook->full_address($row)),
-                            'Info'          => htmlspecialchars($row['label']),
-                            'Extra'         => (isset($row['extra']) ? $row['extra'] : NULL),
-                         );
-        $a['Addresses'][] = $contact;
-    }
+    $a['Addresses'] = formatAddressList($alist);
   
     $addresses[$backend->bnum] = $a;
 }
diff --git a/templates/default/addrbook_search_list.tpl b/templates/default/addrbook_search_list.tpl
new file mode 100644 (file)
index 0000000..d581f49
--- /dev/null
@@ -0,0 +1,102 @@
+<?php
+/**
+ * addrbook_search_list.tpl
+ *
+ * Display a list of addresses from the search forms
+ * 
+ * The following variables are available in this template:
+ *      $use_js             - boolean TRUE if we should use Javascript in this book.
+ *      $include_abook_name - boolean TRUE if the resuls should also display
+ *                            the name of the address book the result is in.
+ *      $addresses - array containing search results.  Each element contains the 
+ *                 following fields:
+ *              $el['FirstName'] - The entry's first name
+ *              $el['LastName']  - The entry's last name (surname)
+ *              $el['FullName']  - The entry's full name (first + last)
+ *              $el['NickName']  - The entry's nickname
+ *              $el['Email']     - duh
+ *              $el['FullAddress'] - Email with full name or nick name
+ *                                 optionally prepended.
+ *              $el['Info']      - Additional info about this contact
+ *              $el['Extra']     - Additional field, if provided.  NULL if this
+ *                                 field is not provided by the book.
+ *              $el['JSEmail']   - email address scrubbed for use with
+ *                                 javascript functions.
+ *
+ * @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 **/
+$colspan = $include_abook_name ? 5 : 4;
+?>
+<?php
+if ($use_js) {
+    insert_javascript(); 
+}
+?>
+<div id="addressList">
+<table cellspacing="0">
+ <tr>
+  <td class="colHeader" style="width:1%"></td>
+  <td class="colHeader"><?php echo _("Name"); ?></td>
+  <td class="colHeader"><?php echo _("E-mail"); ?></td>
+  <td class="colHeader"><?php echo _("Info"); ?></td>
+  <?php
+   if ($include_abook_name) {
+    echo '<td class="colHeader">'. _("Source") .'</td>';
+   }
+  ?>
+ </tr>
+ <?php
+    if (count($addresses) == 0) {
+        echo '<tr><td class="abookEmpty" colspan="'.$colspan.'">'._("Address book is empty").'</td></tr>'."\n";
+    }
+    foreach ($addresses as $index=>$contact) {
+        ?>
+ <tr class=<?php echo '"'.(($index+1)%2 ? 'even' : 'odd').'"'; ?>>
+  <td class="abookCompose" style="width:1%">
+   <?php
+    if ($use_js) {
+        ?>
+   <a href="javascript:to_address('<?php echo $contact['JSEmail']; ?>')"><?php echo _("To"); ?></a> |
+   <a href="javascript:cc_address('<?php echo $contact['JSEmail']; ?>')"><?php echo _("Cc"); ?></a> |
+   <a href="javascript:bcc_address('<?php echo $contact['JSEmail']; ?>')"><?php echo _("Bcc"); ?></a>
+        <?php
+    } else {
+        ?>
+   <input type="checkbox" name=<?php echo '"send_to_search[T'.$index.']"'; ?> value=<?php echo '"'.$contact['FullAddress'].'"'; ?> id=<?php echo '"send_to_search_T'.$index.'_"'; ?>><label for=<?php echo '"send_to_search_T'.$index.'_"'; ?>><?php echo _("To"); ?></label>
+   <input type="checkbox" name=<?php echo '"send_to_search[C'.$index.']"'; ?> value=<?php echo '"'.$contact['FullAddress'].'"'; ?> id=<?php echo '"send_to_search_C'.$index.'_"'; ?>><label for=<?php echo '"send_to_search_C'.$index.'_"'; ?>><?php echo _("Cc"); ?></label>
+   <input type="checkbox" name=<?php echo '"send_to_search[B'.$index.']"'; ?> value=<?php echo '"'.$contact['FullAddress'].'"'; ?> id=<?php echo '"send_to_search_B'.$index.'_"'; ?>><label for=<?php echo '"send_to_search_B'.$index.'_"'; ?>><?php echo _("Bcc"); ?></label>
+        <?php
+    }
+   ?> 
+  </td>
+  <td class="abookField"><?php echo $contact['FullName']; ?></td>
+  <td class="abookField"><a href="javascript:to_and_close('<?php echo $contact['JSEmail']; ?>')"><?php echo $contact['Email']; ?></a></td>
+  <td class="abookField"><?php echo $contact['Info']; ?></td>
+        <?php 
+        if ($include_abook_name) {
+            echo '<td class="abookField">'.$contact['Source'].'</td>'."\n";
+        }
+        ?>
+ </tr>
+        <?php
+    }
+?>
+</table>
+<?php
+if (!$use_js) {
+    echo '<input type="submit" name="addr_search_done" value="'. _("Use Addresses") .'" />'."\n";
+    echo '<input type="submit" name="addr_search_cancel" value="'. _("Cancel") .'" />'."\n";
+}
+?>
+</div>
\ No newline at end of file
index 0907b71ddef712d8d826021b784eb6548836d1be..cb64960236c943249985105cbd12177f75dcd52c 100644 (file)
@@ -31,6 +31,8 @@
  *              $el['Info']      - Additional info about this contact
  *              $el['Extra']     - Additional field, if provided.  NULL if this
  *                                 field is not provided by the book.
+ *              $el['JSEmail']   - email address scrubbed for use with
+ *                                 javascript functions.
  *
  * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
@@ -45,7 +47,6 @@ include_once(SM_PATH . 'templates/util_addressbook.php');
 /** extract template variables **/
 extract($t);
 
-#echo dump_array($addresses).'<br>';
 /** Begin template **/
 $source = $addresses[$current_backend];
 $colspan = $abook_has_extra_field ? 6 : 5;
diff --git a/templates/default/addressbook_popup.tpl b/templates/default/addressbook_popup.tpl
new file mode 100644 (file)
index 0000000..5ccad0d
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * addressbook_popup.tpl
+ *
+ * Description
+ * 
+ * The following variables are available in this template:
+ *
+ * @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 **/
+?>
+<frameset rows="80,*" border="0">
+    <frame name="abookmain"
+           marginwidth="0"
+           scrolling="no"
+           border="0"
+           src="addrbook_search.php?show=form" />
+    <frame name="abookres"
+           marginwidth="0"
+           border="0"
+           src="addrbook_search.php?show=blank" />
+</frameset>
\ No newline at end of file
diff --git a/templates/default/addressbook_search_form.tpl b/templates/default/addressbook_search_form.tpl
new file mode 100644 (file)
index 0000000..8f6cb69
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+/**
+ * addressbook_search_form.tpl
+ *
+ * Display the form for searching the address book.  Called from addrbook_search.php
+ * 
+ * The following variables are available in this template:
+ *      $use_js   - boolean TRUE if we should use Javascript in the address book
+ *      $backends - array containing list of all available backends.
+ *
+ * @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="addrBookSearch">
+<table cellspacing="0" class="wrapper">
+ <tr>
+  <td class="header2">
+   <?php echo _("Address book search"); ?>
+  </td>
+ </tr>
+ <tr>
+  <td>
+<table cellspacing="0">
+ <tr>
+  <td>
+   <label for="query"><?php echo _("Search for"); ?>:</label>
+  </td>
+  <td>
+   <input type="text" id="query" name="query" />
+  </td>
+  <td>
+   <?php
+    if (count($backends) > 1) {
+        ?>
+   <label for="backend"><?php echo _("in"); ?></label>
+   <select name="backend" id="backend">
+        <?php
+        foreach ($backends as $id=>$name) {
+            echo '<option value="'.$id.'">'.htmlspecialchars($name).'</option>'."\n";
+        }
+        ?>
+   </select>
+        <?php
+    } else {
+        ?>
+   <input type="hidden" name="backend" value="-1">
+        <?php
+    }
+   ?>
+  </td>
+ </tr>
+ <tr>
+  <td colspan="3" class="buttons">
+   <input type="submit" name="show" value=<?php echo '"'._("Search").'"'; ?> />
+   &nbsp;&nbsp;
+   <input type="submit" name="listall" value=<?php echo '"'._("List all").'"'; ?> />
+   <?php
+    if ($use_js) {
+        ?>
+   &nbsp;&nbsp;
+   <input type="submit" onclick="parent.close()" value=<?php echo '"'._("Close").'"'; ?> />
+        <?php
+    }
+   ?>
+  </td>
+ </tr>
+</table>
+  </td>
+ </tr>
+</table>
+</div>
\ No newline at end of file
index 14dd669e72f194d8a74e7102b6b6313fb3038c9e..f26d25526022061661db5a0db169e936ff9acfb8 100644 (file)
@@ -311,7 +311,7 @@ tr.odd  {
 }
 
 #addressList    input   {
-    font-size: 75%;
+    font-size: 8pt;
 }
 
 #addressList    select  {
@@ -321,7 +321,7 @@ tr.odd  {
 #addressList    table   {
     margin-left: auto;
     margin-right: auto;
-    width: 90%;
+    width: 95%;
     border: 1px solid <?php echo $color[9]; ?>;
     margin-top: 8px;
     margin-bottom: 8px;
@@ -348,6 +348,8 @@ tr.odd  {
 #addressList    td.abookField   {
     border-left: 1px solid <?php echo $color[9]; ?>;
     border-right: 1px solid <?php echo $color[9]; ?>;
+    white-space: nowrap;
+    overflow: hidden;
 }
 
 #addressList    td.colHeader {
@@ -362,4 +364,48 @@ tr.odd  {
 #addressList    td.abookEmpty   {
     text-align:center;
     font-weight: bold;
+}
+
+#addressList    td.abookCompose {
+    font-size: 8pt;
+    white-space: nowrap;
+}
+
+#addrBookSearch {
+    text-align: center;
+}
+
+#addrBookSearch table   {
+    padding: 0;
+    border: 0;
+    margin-left: auto;
+    margin-right: auto;
+}
+
+#addrBookSearch   table.wrapper   {
+    border: 1px solid <?php echo $color[9]; ?>;
+    width: 95%;
+    margin-left: auto;
+    margin-right: auto;
+    padding: 0;
+}
+
+#addrBookSearch td  {
+    padding: 2px;
+}
+
+#addrBookSearch label   {
+    font-weight: bold;
+}
+
+#addrBookSearch input   {
+    font-size: 75%;
+}
+
+#addrBookSearch select  {
+    font-size: 75%;
+}
+
+#addrBookSearch td.buttons  {
+    text-align: center;
 }
\ No newline at end of file