2 // Copyright (C) 2006-2008 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 require_once("../globals.php");
10 require_once("$srcdir/acl.inc");
12 $popup = empty($_GET['popup']) ?
0 : 1;
14 $form_fname = trim($_POST['form_fname']);
15 $form_lname = trim($_POST['form_lname']);
16 $form_specialty = trim($_POST['form_specialty']);
18 $query = "SELECT * FROM users WHERE active = 1 AND ( authorized = 1 OR username = '' ) ";
19 if ($form_lname) $query .= "AND lname LIKE '$form_lname%' ";
20 if ($form_fname) $query .= "AND fname LIKE '$form_fname%' ";
21 if ($form_specialty) $query .= "AND specialty LIKE '%$form_specialty%' ";
22 $query .= "ORDER BY lname, fname, mname LIMIT 500";
23 $res = sqlStatement($query);
29 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
30 <title
><?php
xl('Address Book','e'); ?
></title
>
32 <!-- style tag moved into proper CSS file
-->
34 <?php
if ($popup) { ?
>
35 <script type
="text/javascript" src
="../../library/topdialog.js"></script
>
37 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
39 <script language
="JavaScript">
41 <?php
if ($popup) require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
43 // Callback from popups to refresh this display.
44 function refreshme() {
46 document
.forms
[0].submit();
49 // Process click to pop up the add/edit window.
50 function doedclick(userid
) {
51 dlgopen('addrbook_edit.php?userid=' + userid
, '_blank', 700, 550);
58 <body
class="body_top">
60 <div id
="addressbook_list">
61 <form method
='post' action
='addrbook_list.php'>
64 <tr
class='search'> <!-- bgcolor
='#ddddff' -->
66 <?php
xl('First Name:','e')?
>
67 <input type
='text' name
='form_fname' size
='10' value
='<?php echo $form_fname; ?>'
68 class='inputtext' title
='<?php xl("All or part of the first name","e") ?>' /> 
;
69 <?php
xl('Last Name:','e')?
>
70 <input type
='text' name
='form_lname' size
='10' value
='<?php echo $form_lname; ?>'
71 class='inputtext' title
='<?php xl("All or part of the last name","e") ?>' /> 
;
72 <?php
xl('Specialty:','e')?
>
73 <input type
='text' name
='form_specialty' size
='10' value
='<?php echo $form_specialty; ?>'
74 class='inputtext' title
='<?php xl("Any part of the desired specialty","e") ?>' /> 
; 
;
75 <input type
='submit' class='button' name
='form_search' value
='<?php xl("Search","e")?>' />
78 <input type
='button' class='button' value
='Add New' onclick
='doedclick(0)' />
85 <td title
='Click to view or edit'><?php
xl('Name','e'); ?
></td
>
86 <td
><?php
xl('Local','e'); ?
></td
><!-- empty for external
-->
87 <td
><?php
xl('Specialty','e'); ?
></td
>
88 <td
><?php
xl('Phone','e'); ?
></td
>
89 <td
><?php
xl('Mobile','e'); ?
></td
>
90 <td
><?php
xl('Fax','e'); ?
></td
>
91 <td
><?php
xl('Email','e'); ?
></td
>
92 <td
><?php
xl('Street','e'); ?
></td
>
93 <td
><?php
xl('City','e'); ?
></td
>
94 <td
><?php
xl('State','e'); ?
></td
>
95 <td
><?php
xl('Postal','e'); ?
></td
>
100 while ($row = sqlFetchArray($res)) {
102 //$bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
103 $bgclass = (($encount & 1) ?
"evenrow" : "oddrow");
104 $username = $row['username'];
105 if (! $row['active']) $username = '--';
106 $trTitle = "Edit ". $row['fname'] . ' ' . $row['mname'] . $row['lname'];
107 echo " <tr class='detail $bgclass' style='cursor:pointer' " .
108 "onclick='doedclick(" . $row['id'] . ")' title='$trTitle'>\n";
109 echo " <td>" . $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'] . "</td>\n";
110 echo " <td>" . ($username ?
'*' : '') . "</td>\n";
111 echo " <td>" . $row['specialty'] . "</td>\n";
112 echo " <td>" . $row['phonew1'] . "</td>\n";
113 echo " <td>" . $row['phonecell'] . "</td>\n";
114 echo " <td>" . $row['fax'] . "</td>\n";
115 echo " <td>" . $row['email'] . "</td>\n";
116 echo " <td>" . $row['street'] . "</td>\n";
117 echo " <td>" . $row['city'] . "</td>\n";
118 echo " <td>" . $row['state'] . "</td>\n";
119 echo " <td>" . $row['zip'] . "</td>\n";