2 // Copyright (C) 2006-2009 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");
11 require_once("$srcdir/formdata.inc.php");
13 $popup = empty($_GET['popup']) ?
0 : 1;
15 $form_fname = formData("form_fname","P",true);
16 $form_lname = formData("form_lname","P",true);
17 $form_specialty = formData("form_specialty","P",true);
18 $form_external = $_POST['form_external'] ?
1 : 0;
20 $query = "SELECT * FROM users WHERE active = 1 AND ( authorized = 1 OR username = '' ) ";
21 if ($form_lname) $query .= "AND lname LIKE '$form_lname%' ";
22 if ($form_fname) $query .= "AND fname LIKE '$form_fname%' ";
23 if ($form_specialty) $query .= "AND specialty LIKE '%$form_specialty%' ";
24 if ($form_external) $query .= "AND username = '' ";
25 $query .= "ORDER BY lname, fname, mname LIMIT 500";
26 $res = sqlStatement($query);
32 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
33 <title
><?php
xl('Address Book','e'); ?
></title
>
35 <!-- style tag moved into proper CSS file
-->
37 <?php
if ($popup) { ?
>
38 <script type
="text/javascript" src
="../../library/topdialog.js"></script
>
40 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
42 <script language
="JavaScript">
44 <?php
if ($popup) require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
46 // Callback from popups to refresh this display.
47 function refreshme() {
49 document
.forms
[0].submit();
52 // Process click to pop up the add/edit window.
53 function doedclick(userid
) {
54 dlgopen('addrbook_edit.php?userid=' + userid
, '_blank', 700, 550);
61 <body
class="body_top">
63 <div id
="addressbook_list">
64 <form method
='post' action
='addrbook_list.php'>
67 <tr
class='search'> <!-- bgcolor
='#ddddff' -->
69 <?php
xl('First Name','e')?
>:
70 <input type
='text' name
='form_fname' size
='10' value
='<?php echo htmlspecialchars(strip_escape_custom($_POST['form_fname
']),ENT_QUOTES); ?>'
71 class='inputtext' title
='<?php xl("All or part of the first name","e") ?>' /> 
;
72 <?php
xl('Last Name','e')?
>:
73 <input type
='text' name
='form_lname' size
='10' value
='<?php echo htmlspecialchars(strip_escape_custom($_POST['form_lname
']),ENT_QUOTES); ?>'
74 class='inputtext' title
='<?php xl("All or part of the last name","e") ?>' /> 
;
75 <?php
xl('Specialty','e')?
>:
76 <input type
='text' name
='form_specialty' size
='10' value
='<?php echo htmlspecialchars(strip_escape_custom($_POST['form_specialty
']),ENT_QUOTES); ?>'
77 class='inputtext' title
='<?php xl("Any part of the desired specialty","e") ?>' /> 
;
78 <input type
='checkbox' name
='form_external' value
='1'<?php
if ($form_external) echo ' checked'; ?
>
79 title
='<?php xl("Omit internal users?","e") ?>' />
80 <?php
xl('External Only','e')?
> 
; 
;
81 <input type
='submit' class='button' name
='form_search' value
='<?php xl("Search","e")?>' />
84 <input type
='button' class='button' value
='<?php xl("Add New","e"); ?>' onclick
='doedclick(0)' />
91 <td title
=<?php
xl('Click to view or edit','e','\'','\''); ?
>><?php
xl('Name','e'); ?
></td
>
92 <td
><?php
xl('Local','e'); ?
></td
><!-- empty for external
-->
93 <td
><?php
xl('Specialty','e'); ?
></td
>
94 <td
><?php
xl('Phone','e'); ?
></td
>
95 <td
><?php
xl('Mobile','e'); ?
></td
>
96 <td
><?php
xl('Fax','e'); ?
></td
>
97 <td
><?php
xl('Email','e'); ?
></td
>
98 <td
><?php
xl('Street','e'); ?
></td
>
99 <td
><?php
xl('City','e'); ?
></td
>
100 <td
><?php
xl('State','e'); ?
></td
>
101 <td
><?php
xl('Postal','e'); ?
></td
>
106 while ($row = sqlFetchArray($res)) {
108 //$bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
109 $bgclass = (($encount & 1) ?
"evenrow" : "oddrow");
110 $username = $row['username'];
111 if (! $row['active']) $username = '--';
112 $trTitle = xl('Edit','','',' ') . $row['fname'] . ' ' . $row['mname'] . ' ' . $row['lname'];
113 echo " <tr class='detail $bgclass' style='cursor:pointer' " .
114 "onclick='doedclick(" . $row['id'] . ")' title='$trTitle'>\n";
115 echo " <td>" . $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname'] . "</td>\n";
116 echo " <td>" . ($username ?
'*' : '') . "</td>\n";
117 echo " <td>" . $row['specialty'] . "</td>\n";
118 echo " <td>" . $row['phonew1'] . "</td>\n";
119 echo " <td>" . $row['phonecell'] . "</td>\n";
120 echo " <td>" . $row['fax'] . "</td>\n";
121 echo " <td>" . $row['email'] . "</td>\n";
122 echo " <td>" . $row['street'] . "</td>\n";
123 echo " <td>" . $row['city'] . "</td>\n";
124 echo " <td>" . $row['state'] . "</td>\n";
125 echo " <td>" . $row['zip'] . "</td>\n";