added general-purpose fax support
[openemr.git] / interface / fax / faxq.php
blobfa68176019a851d50e61e22fc741e9c917876ed0
1 <?php
2 // Copyright (C) 2006 Rod Roark <rod@sunsetsystems.com>
3 //
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 // Get the recvq entries, parse and sort by filename.
14 $statlines = array();
15 exec("faxstat -r -l -h " . $GLOBALS['hylafax_server'], $statlines);
16 $mlines = array();
17 foreach ($statlines as $line) {
18 // This gets pagecount, sender, time, filename.
19 if (preg_match('/^-\S+\s+(\d+)\s+\S+\s+(.+)\s+(\S+)\s+(\S+)\s*$/', $line, $matches)) {
20 $mlines[$matches[4]] = $matches;
23 ksort($mlines);
25 // echo "<!--\n"; print_r($statlines); echo "-->\n"; // debugging
28 <html>
30 <head>
32 <link rel=stylesheet href='<? echo $css_header ?>' type='text/css'>
33 <title><? xl('Received Faxes','e'); ?></title>
35 <style>
36 tr.head { font-size:10pt; background-color:#cccccc; font-weight: bold; }
37 tr.detail { font-size:10pt; }
38 td { padding-left: 4px; padding-right: 4px; }
39 a, a:visited, a:hover { color:#0000cc; }
40 </style>
42 <script type="text/javascript" src="../../library/dialog.js"></script>
44 <script language="JavaScript">
46 // callback from popups to refresh this display.
47 function refreshme() {
48 location.reload();
51 // Process click on filename to view.
52 function dodclick(ffname) {
53 cascwin('fax_view.php?file=' + ffname, '_blank', 600, 475,
54 "resizable=1,scrollbars=1");
55 return false;
58 // Process click on More to pop up the dispatch window.
59 function domclick(ffname) {
60 dlgopen('fax_dispatch.php?file=' + ffname, '_blank', 700, 475);
63 </script>
65 </head>
67 <body <?echo $top_bg_line;?>>
68 <form method='post' action='faxq.php'>
70 <table width='100%' cellpadding='1' cellspacing='2'>
71 <tr class='head'>
72 <td colspan='2' title='Click to view'><? xl('Document','e'); ?></td>
73 <td><? xl('Received','e'); ?></td>
74 <td><? xl('From','e'); ?></td>
75 <td align='right'><? xl('Pages','e'); ?></td>
76 </tr>
78 $encount = 0;
79 foreach ($mlines as $matches) {
80 ++$encount;
81 $ffname = $matches[4];
82 $ffbase = basename("/$ffname", '.tif');
83 $bgcolor = "#" . (($encount & 1) ? "ddddff" : "ffdddd");
84 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
85 echo " <td onclick='dodclick(\"$ffname\")'>";
86 echo "<a href='fax_view.php?file=$ffname' onclick='return false'>$ffbase</a></td>\n";
87 // echo "<a href='fax_view.php?file=$ffname'>$ffname</a></td>\n";
88 echo " <td onclick='domclick(\"$ffname\")'>";
89 echo "<a href='fax_dispatch.php?file=$ffname' onclick='return false'>Dispatch</a></td>\n";
90 echo " <td>" . htmlentities($matches[3]) . "</td>\n";
91 echo " <td>" . htmlentities($matches[2]) . "</td>\n";
92 echo " <td align='right'>" . htmlentities($matches[1]) . "</td>\n";
93 echo " </tr>\n";
96 </table>
98 </form>
99 </body>
100 </html>