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;
41 // Get the doneq entries, parse and sort by job ID
43 JID Pri S Owner Number Pages Dials TTS Status
44 155 123 D nobody 6158898622 1:1 5:12
45 153 124 D nobody 6158896439 1:1 4:12
46 154 124 F nobody 6153551807 0:1 4:12 No carrier detected
49 exec("faxstat -s -d -l -h " . $GLOBALS['hylafax_server'], $donelines);
50 foreach ($donelines as $line) {
51 // This gets jobid, priority, statchar, owner, phone, pages, dials and tts/status.
52 if (preg_match('/^(\d+)\s+(\d+)\s+(\S)\s+(\S+)\s+(\S+)\s+(\d+:\d+)\s+(\d+:\d+)(.*)$/', $line, $matches)) {
53 $dlines[$matches[1]] = $matches;
59 $scandir = $GLOBALS['scanner_output_directory'];
60 if ($scandir && $GLOBALS['enable_scanner']) {
61 // Get the directory entries, parse and sort by date and time.
62 $dh = opendir($scandir);
63 if (! $dh) die("Cannot read $scandir");
64 while (false !== ($sfname = readdir($dh))) {
65 if (substr($sfname, 0, 1) == '.') continue;
66 $tmp = stat("$scandir/$sfname");
67 $tmp[0] = $sfname; // put filename in slot 0 which we don't otherwise need
68 $slines[$tmp[9] . $tmp[1]] = $tmp; // key is file mod time and inode number
78 <?php
html_header_show();?
>
80 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
81 <title
><?php
xl('Received Faxes','e'); ?
></title
>
85 font
-family
: Arial
, Helvetica
, sans
-serif
;
89 a
, a
:visited
, a
:hover
{
94 background
-color
:#cccccc;
108 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
110 <script language
="JavaScript">
112 // Process click on a tab.
113 function tabclick(tabname
) {
114 var tabs
= new Array('faxin', 'faxout', 'scanin');
115 var visdisp
= document
.getElementById('bigtable').style
.display
;
116 for (var i in tabs
) {
117 var thistd
= document
.getElementById('td_tab_' + tabs
[i
]);
118 var thistable
= document
.getElementById('table_' + tabs
[i
]);
119 if (tabs
[i
] == tabname
) {
120 // thistd.style.borderBottom = '0px solid #000000';
121 thistd
.style
.borderBottom
= '2px solid transparent';
122 thistd
.style
.color
= '#cc0000';
123 thistd
.style
.cursor
= 'default';
124 thistable
.style
.display
= visdisp
;
126 thistd
.style
.borderBottom
= '2px solid #000000';
127 thistd
.style
.color
= '#777777';
128 thistd
.style
.cursor
= 'pointer';
129 thistable
.style
.display
= 'none';
134 // Callback from popups to refresh this display.
135 function refreshme() {
139 // Process click on filename to view.
140 function dodclick(ffname
) {
141 cascwin('fax_view.php?file=' + ffname
, '_blank', 600, 475,
142 "resizable=1,scrollbars=1");
146 // Process click on Job ID to view.
147 function dojclick(jobid
) {
148 cascwin('fax_view.php?jid=' + jobid
, '_blank', 600, 475,
149 "resizable=1,scrollbars=1");
153 // Process scanned document filename to view.
154 function dosvclick(sfname
) {
155 cascwin('fax_view.php?scan=' + sfname
, '_blank', 600, 475,
156 "resizable=1,scrollbars=1");
160 // Process click to pop up the fax dispatch window.
161 function domclick(ffname
) {
162 cascwin('fax_dispatch.php?file=' + ffname
, '_blank', 850, 550,
163 "resizable=1,scrollbars=1");
166 // Process click to pop up the scanned document dispatch window.
167 function dosdclick(sfname
) {
168 cascwin('fax_dispatch.php?scan=' + sfname
, '_blank', 850, 550,
169 "resizable=1,scrollbars=1");
176 <body
class="body_top">
177 <table cellspacing
='0' cellpadding
='0' style
='margin: 0 0 0 0; border: 2px solid #000000;'
178 id
='bigtable' width
='100%' height
='100%'>
179 <tr style
='height: 20px;'>
180 <td width
='33%' id
='td_tab_faxin' class='tabhead'
181 <?php
if ($GLOBALS['enable_hylafax']) { ?
>
182 style
='color: #cc0000; border-right: 2px solid #000000; border-bottom: 2px solid transparent;'
184 style
='color: #777777; border-right: 2px solid #000000; border-bottom: 2px solid #000000; cursor: pointer; display:none;'
186 onclick
='tabclick("faxin")'><?php
xl('Faxes In','e'); ?
></td
>
187 <td width
='33%' id
='td_tab_faxout' class='tabhead'
188 <?php
if ($GLOBALS['enable_hylafax']) { ?
>
189 style
='color: #777777; border-right: 2px solid #000000; border-bottom: 2px solid #000000; cursor: pointer;'
191 style
='color: #777777; border-right: 2px solid #000000; border-bottom: 2px solid #000000; cursor: pointer; display:none;'
193 onclick
='tabclick("faxout")'><?php
xl('Faxes Out','e'); ?
></td
>
194 <td width
='34%' id
='td_tab_scanin' class='tabhead'
195 <?php
if ($GLOBALS['enable_scanner']) { ?
>
196 style
='color: #777777; border-bottom: 2px solid #000000; cursor: pointer;'
198 style
='color: #cc0000; border-bottom: 2px solid transparent; display:none;'
200 onclick
='tabclick("scanin")'><?php
xl('Scanner In','e'); ?
></td
>
203 <td colspan
='3' style
='padding: 5px;' valign
='top'>
205 <form method
='post' action
='faxq.php'>
207 <table width
='100%' cellpadding
='1' cellspacing
='2' id
='table_faxin'
208 <?php
if (!$GLOBALS['enable_hylafax']) echo "style='display:none;'"; ?
>>
210 <td colspan
='2' title
='Click to view'><?php
xl('Document','e'); ?
></td
>
211 <td
><?php
xl('Received','e'); ?
></td
>
212 <td
><?php
xl('From','e'); ?
></td
>
213 <td align
='right'><?php
xl('Pages','e'); ?
></td
>
218 foreach ($mlines as $matches) {
220 $ffname = $matches[4];
221 $ffbase = basename("/$ffname", '.tif');
222 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
223 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
224 echo " <td onclick='dodclick(\"$ffname\")'>";
225 echo "<a href='fax_view.php?file=$ffname' onclick='return false'>$ffbase</a></td>\n";
226 echo " <td onclick='domclick(\"$ffname\")'>";
227 echo "<a href='fax_dispatch.php?file=$ffname' onclick='return false'>" . xl('Dispatch','e') . "</a></td>\n";
228 echo " <td>" . htmlentities($matches[3]) . "</td>\n";
229 echo " <td>" . htmlentities($matches[2]) . "</td>\n";
230 echo " <td align='right'>" . htmlentities($matches[1]) . "</td>\n";
236 <table width
='100%' cellpadding
='1' cellspacing
='2' id
='table_faxout'
237 style
='display:none;'>
239 <td title
='Click to view'><?php
xl('Job ID','e'); ?
></td
>
240 <td
><?php
xl('To','e'); ?
></td
>
241 <td
><?php
xl('Pages','e'); ?
></td
>
242 <td
><?php
xl('Dials','e'); ?
></td
>
243 <td
><?php
xl('TTS','e'); ?
></td
>
244 <td
><?php
xl('Status','e'); ?
></td
>
248 foreach ($dlines as $matches) {
250 $jobid = $matches[1];
251 $ffstatus = $faxstats[$matches[3]];
253 $ffstatend = trim($matches[8]);
254 if (preg_match('/^(\d+:\d+)\s*(.*)$/', $ffstatend, $tmp)) {
256 $ffstatend = $tmp[2];
258 if ($ffstatend) $ffstatus .= ': ' . $ffstatend;
259 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
260 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
261 echo " <td onclick='dojclick(\"$jobid\")'>" .
262 "<a href='fax_view.php?jid=$jobid' onclick='return false'>" .
264 echo " <td>" . htmlentities($matches[5]) . "</td>\n";
265 echo " <td>" . htmlentities($matches[6]) . "</td>\n";
266 echo " <td>" . htmlentities($matches[7]) . "</td>\n";
267 echo " <td>" . htmlentities($fftts) . "</td>\n";
268 echo " <td>" . htmlentities($ffstatus) . "</td>\n";
274 <table width
='100%' cellpadding
='1' cellspacing
='2' id
='table_scanin'
275 <?php
if ($GLOBALS['enable_hylafax']) echo "style='display:none;'"; ?
>>
277 <td colspan
='2' title
='Click to view'><?php
xl('Filename','e'); ?
></td
>
278 <td
><?php
xl('Scanned','e'); ?
></td
>
279 <td align
='right'><?php
xl('Length','e'); ?
></td
>
283 foreach ($slines as $sline) {
285 $bgcolor = "#" . (($encount & 1) ?
"ddddff" : "ffdddd");
286 $sfname = $sline[0]; // filename
287 $sfdate = date('Y-m-d H:i', $sline[9]);
288 echo " <tr class='detail' bgcolor='$bgcolor'>\n";
289 echo " <td onclick='dosvclick(\"$sfname\")'>" .
290 "<a href='fax_view.php?scan=$sfname' onclick='return false'>" .
291 "$sfname</a></td>\n";
292 echo " <td onclick='dosdclick(\"$sfname\")'>";
293 echo "<a href='fax_dispatch.php?scan=$sfname' onclick='return false'>" . xl('Dispatch','e') . "</a></td>\n";
294 echo " <td>$sfdate</td>\n";
295 echo " <td align='right'>" . $sline[7] . "</td>\n";