2 // Copyright (C) 2006 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");
14 'D' => xl('Sent successfully'),
17 'R' => xl('Send in progress'),
18 'S' => xl('Sleeping'),
19 'T' => xl('Suspended'),
27 if ($GLOBALS['enable_hylafax']) {
28 // Get the recvq entries, parse and sort by filename.
30 exec("faxstat -r -l -h " . $GLOBALS['hylafax_server'], $statlines);
31 foreach ($statlines as $line) {
32 // This gets pagecount, sender, time, filename. We are expecting the
33 // string to start with "-rw-rw-" so as to exclude faxes not yet fully
34 // received, for which permissions are "-rw----".
35 if (preg_match('/^-r\S\Sr\S\S\s+(\d+)\s+\S+\s+(.+)\s+(\S+)\s+(\S+)\s*$/', $line, $matches)) {
36 $mlines[$matches[4]] = $matches;
42 // Get the doneq entries, parse and sort by job ID
44 JID Pri S Owner Number Pages Dials TTS Status
45 155 123 D nobody 6158898622 1:1 5:12
46 153 124 D nobody 6158896439 1:1 4:12
47 154 124 F nobody 6153551807 0:1 4:12 No carrier detected
50 exec("faxstat -s -d -l -h " . $GLOBALS['hylafax_server'], $donelines);
51 foreach ($donelines as $line) {
52 // This gets jobid, priority, statchar, owner, phone, pages, dials and tts/status.
53 if (preg_match('/^(\d+)\s+(\d+)\s+(\S)\s+(\S+)\s+(\S+)\s+(\d+:\d+)\s+(\d+:\d+)(.*)$/', $line, $matches)) {
54 $dlines[$matches[1]] = $matches;
61 $scandir = $GLOBALS['scanner_output_directory'];
62 if ($scandir && $GLOBALS['enable_scanner']) {
63 // Get the directory entries, parse and sort by date and time.
64 $dh = opendir($scandir);
66 die("Cannot read $scandir");
69 while (false !== ($sfname = readdir($dh))) {
70 if (substr($sfname, 0, 1) == '.') {
74 $tmp = stat("$scandir/$sfname");
75 $tmp[0] = $sfname; // put filename in slot 0 which we don't otherwise need
76 $slines[$tmp[9] . $tmp[1]] = $tmp; // key is file mod time and inode number
87 <?php
html_header_show();?
>
89 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
90 <title
><?php
xl('Received Faxes', 'e'); ?
></title
>
94 font
-family
: Arial
, Helvetica
, sans
-serif
;
98 a
, a
:visited
, a
:hover
{
103 background
-color
:#cccccc;
117 <script type
="text/javascript" src
="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
119 <script language
="JavaScript">
121 // Process click on a tab.
122 function tabclick(tabname
) {
123 var tabs
= new Array('faxin', 'faxout', 'scanin');
124 var visdisp
= document
.getElementById('bigtable').style
.display
;
125 for (var i in tabs
) {
126 var thistd
= document
.getElementById('td_tab_' + tabs
[i
]);
127 var thistable
= document
.getElementById('table_' + tabs
[i
]);
128 if (tabs
[i
] == tabname
) {
129 // thistd.style.borderBottom = '0px solid #000000';
130 thistd
.style
.borderBottom
= '2px solid transparent';
131 thistd
.style
.color
= '#cc0000';
132 thistd
.style
.cursor
= 'default';
133 thistable
.style
.display
= visdisp
;
135 thistd
.style
.borderBottom
= '2px solid #000000';
136 thistd
.style
.color
= '#777777';
137 thistd
.style
.cursor
= 'pointer';
138 thistable
.style
.display
= 'none';
143 // Callback from popups to refresh this display.
144 function refreshme() {
148 // Process click on filename to view.
149 function dodclick(ffname
) {
150 cascwin('fax_view.php?file=' + ffname
, '_blank', 600, 475,
151 "resizable=1,scrollbars=1");
155 // Process click on Job ID to view.
156 function dojclick(jobid
) {
157 cascwin('fax_view.php?jid=' + jobid
, '_blank', 600, 475,
158 "resizable=1,scrollbars=1");
162 // Process scanned document filename to view.
163 function dosvclick(sfname
) {
164 cascwin('fax_view.php?scan=' + sfname
, '_blank', 600, 475,
165 "resizable=1,scrollbars=1");
169 // Process click to pop up the fax dispatch window.
170 function domclick(ffname
) {
171 cascwin('fax_dispatch.php?file=' + ffname
, '_blank', 850, 550,
172 "resizable=1,scrollbars=1");
175 // Process click to pop up the scanned document dispatch window.
176 function dosdclick(sfname
) {
177 cascwin('fax_dispatch.php?scan=' + sfname
, '_blank', 850, 550,
178 "resizable=1,scrollbars=1");
185 <body
class="body_top">
186 <table cellspacing
='0' cellpadding
='0' style
='margin: 0 0 0 0; border: 2px solid #000000;'
187 id
='bigtable' width
='100%' height
='100%'>
188 <tr style
='height: 20px;'>
189 <td width
='33%' id
='td_tab_faxin' class='tabhead'
190 <?php
if ($GLOBALS['enable_hylafax']) { ?
>
191 style
='color: #cc0000; border-right: 2px solid #000000; border-bottom: 2px solid transparent;'
193 style
='color: #777777; border-right: 2px solid #000000; border-bottom: 2px solid #000000; cursor: pointer; display:none;'
195 onclick
='tabclick("faxin")'><?php
xl('Faxes In', 'e'); ?
></td
>
196 <td width
='33%' id
='td_tab_faxout' class='tabhead'
197 <?php
if ($GLOBALS['enable_hylafax']) { ?
>
198 style
='color: #777777; border-right: 2px solid #000000; border-bottom: 2px solid #000000; cursor: pointer;'
200 style
='color: #777777; border-right: 2px solid #000000; border-bottom: 2px solid #000000; cursor: pointer; display:none;'
202 onclick
='tabclick("faxout")'><?php
xl('Faxes Out', 'e'); ?
></td
>
203 <td width
='34%' id
='td_tab_scanin' class='tabhead'
204 <?php
if ($GLOBALS['enable_scanner']) { ?
>
205 style
='color: #777777; border-bottom: 2px solid #000000; cursor: pointer;'
207 style
='color: #cc0000; border-bottom: 2px solid transparent; display:none;'
209 onclick
='tabclick("scanin")'><?php
xl('Scanner In', 'e'); ?
></td
>
212 <td colspan
='3' style
='padding: 5px;' valign
='top'>
214 <form method
='post' action
='faxq.php'>
216 <table width
='100%' cellpadding
='1' cellspacing
='2' id
='table_faxin'
217 <?php
if (!$GLOBALS['enable_hylafax']) {
218 echo "style='display:none;'";
221 <td colspan
='2' title
='Click to view'><?php
xl('Document', 'e'); ?
></td
>
222 <td
><?php
xl('Received', 'e'); ?
></td
>
223 <td
><?php
xl('From', 'e'); ?
></td
>
224 <td align
='right'><?php
xl('Pages', 'e'); ?
></td
>
229 foreach ($mlines as $matches) {
231 $ffname = $matches[4];
232 $ffbase = basename("/$ffname", '.tif');
233 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
234 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
235 echo " <td onclick='dodclick(\"$ffname\")'>";
236 echo "<a href='fax_view.php?file=$ffname' onclick='return false'>$ffbase</a></td>\n";
237 echo " <td onclick='domclick(\"$ffname\")'>";
238 echo "<a href='fax_dispatch.php?file=$ffname' onclick='return false'>" . xl('Dispatch', 'e') . "</a></td>\n";
239 echo " <td>" . htmlentities($matches[3]) . "</td>\n";
240 echo " <td>" . htmlentities($matches[2]) . "</td>\n";
241 echo " <td align='right'>" . htmlentities($matches[1]) . "</td>\n";
247 <table width
='100%' cellpadding
='1' cellspacing
='2' id
='table_faxout'
248 style
='display:none;'>
250 <td title
='Click to view'><?php
xl('Job ID', 'e'); ?
></td
>
251 <td
><?php
xl('To', 'e'); ?
></td
>
252 <td
><?php
xl('Pages', 'e'); ?
></td
>
253 <td
><?php
xl('Dials', 'e'); ?
></td
>
254 <td
><?php
xl('TTS', 'e'); ?
></td
>
255 <td
><?php
xl('Status', 'e'); ?
></td
>
259 foreach ($dlines as $matches) {
261 $jobid = $matches[1];
262 $ffstatus = $faxstats[$matches[3]];
264 $ffstatend = trim($matches[8]);
265 if (preg_match('/^(\d+:\d+)\s*(.*)$/', $ffstatend, $tmp)) {
267 $ffstatend = $tmp[2];
271 $ffstatus .= ': ' . $ffstatend;
274 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
275 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
276 echo " <td onclick='dojclick(\"$jobid\")'>" .
277 "<a href='fax_view.php?jid=$jobid' onclick='return false'>" .
279 echo " <td>" . htmlentities($matches[5]) . "</td>\n";
280 echo " <td>" . htmlentities($matches[6]) . "</td>\n";
281 echo " <td>" . htmlentities($matches[7]) . "</td>\n";
282 echo " <td>" . htmlentities($fftts) . "</td>\n";
283 echo " <td>" . htmlentities($ffstatus) . "</td>\n";
289 <table width
='100%' cellpadding
='1' cellspacing
='2' id
='table_scanin'
290 <?php
if ($GLOBALS['enable_hylafax']) {
291 echo "style='display:none;'";
294 <td colspan
='2' title
='Click to view'><?php
xl('Filename', 'e'); ?
></td
>
295 <td
><?php
xl('Scanned', 'e'); ?
></td
>
296 <td align
='right'><?php
xl('Length', 'e'); ?
></td
>
300 foreach ($slines as $sline) {
302 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
303 $sfname = $sline[0]; // filename
304 $sfdate = date('Y-m-d H:i', $sline[9]);
305 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
306 echo " <td onclick='dosvclick(\"$sfname\")'>" .
307 "<a href='fax_view.php?scan=$sfname' onclick='return false'>" .
308 "$sfname</a></td>\n";
309 echo " <td onclick='dosdclick(\"$sfname\")'>";
310 echo "<a href='fax_dispatch.php?scan=$sfname' onclick='return false'>" . xl('Dispatch', 'e') . "</a></td>\n";
311 echo " <td>$sfdate</td>\n";
312 echo " <td align='right'>" . $sline[7] . "</td>\n";