6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2006-2010 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/pnotes.inc");
18 require_once("$srcdir/forms.inc");
19 require_once("$srcdir/options.inc.php");
20 require_once("$srcdir/gprelations.inc.php");
22 use OpenEMR\Core\Header
;
25 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
30 $filename = $_GET['file'];
32 // ensure the file variable has no illegal characters
33 check_file_dir_name($filename);
35 $filepath = $GLOBALS['hylafax_basedir'] . '/recvq/' . $filename;
36 } else if ($_GET['scan']) {
37 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
42 $filename = $_GET['scan'];
44 // ensure the file variable has no illegal characters
45 check_file_dir_name($filename);
47 $filepath = $GLOBALS['scanner_output_directory'] . '/' . $filename;
49 die("No filename was given.");
52 $ext = substr($filename, strrpos($filename, '.'));
53 $filebase = basename("/$filename", $ext);
54 $faxcache = $GLOBALS['OE_SITE_DIR'] . "/faxcache/$mode/$filebase";
58 // This function builds an array of document categories recursively.
59 // Kittens are the children of cats, you know. :-)getKittens
61 function getKittens($catid, $catstring, &$categories)
63 $cres = sqlStatement("SELECT id, name FROM categories " .
64 "WHERE parent = ? ORDER BY name", array($catid));
66 while ($crow = sqlFetchArray($cres)) {
68 getKittens($crow['id'], ($catstring ?
"$catstring / " : "") .
69 ($catid ?
$crow['name'] : ''), $categories);
72 // If no kitties, then this is a leaf node and should be listed.
74 $categories[$catid] = $catstring;
78 // This merges the tiff files for the selected pages into one tiff file.
87 // form_images are the checkboxes to the right of the images.
88 foreach ($_POST['form_images'] as $inbase) {
89 check_file_dir_name($inbase);
90 $inames .= ' ' . escapeshellarg("$inbase.tif");
94 die(xlt("Internal error - no pages were selected!"));
97 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; tiffcp $inames temp.tif", $tmp1, $tmp2);
99 $msg .= "tiffcp returned $tmp2: $tmp0 ";
105 // If we are submitting...
107 if ($_POST['form_save']) {
108 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
112 $action_taken = false;
116 if ($_POST['form_cb_copy']) {
117 $patient_id = (int) $_POST['form_pid'];
119 die(xlt('Internal error - patient ID was not provided!'));
122 // Compute the name of the target directory and make sure it exists.
123 $docdir = $GLOBALS['OE_SITE_DIR'] . "/documents/" . check_file_dir_name($patient_id);
124 exec("mkdir -p " . escapeshellarg($docdir));
126 // If copying to patient documents...
128 if ($_POST['form_cb_copy_type'] == 1) {
129 // Compute a target filename that does not yet exist.
130 $ffname = check_file_dir_name(trim($_POST['form_filename']));
131 $i = strrpos($ffname, '.');
133 $ffname = trim(substr($ffname, 0, $i));
142 // If the target filename exists, modify it until it doesn't.
144 while (is_file("$docdir/$ffname$ffmod$ffsuff")) {
149 $target = "$docdir/$ffname$ffmod$ffsuff";
150 $docdate = fixDate($_POST['form_docdate']);
152 // Create the target PDF. Note that we are relying on the .tif files for
153 // the individual pages to already exist in the faxcache directory.
155 $info_msg .= mergeTiffs();
156 // The -j option here requires that libtiff is configured with libjpeg.
157 // It could be omitted, but the output PDFs would then be quite large.
158 $tmp0 = exec("tiff2pdf -j -p letter -o " . escapeshellarg($target) . " " . escapeshellarg($faxcache.'/temp.tif'), $tmp1, $tmp2);
161 $info_msg .= "tiff2pdf returned $tmp2: $tmp0 ";
163 $newid = generate_id();
164 $fsize = filesize($target);
165 $catid = (int) $_POST['form_category'];
166 // Update the database.
167 $query = "INSERT INTO documents ( " .
168 "id, type, size, date, url, mimetype, foreign_id, docdate" .
170 "?, 'file_url', ?, NOW(), ?, " .
171 "'application/pdf', ?, ? " .
173 sqlStatement($query, array($newid, $fsize, 'file://'.$target, $patient_id, $docdate));
174 $query = "INSERT INTO categories_to_documents ( " .
175 "category_id, document_id" .
179 sqlStatement($query, array($catid, $newid));
182 // If we are posting a note...
183 if ($_POST['form_cb_note'] && !$info_msg) {
184 // Build note text in a way that identifies the new document.
185 // See pnotes_full.php which uses this to auto-display the document.
186 $note = "$ffname$ffmod$ffsuff";
187 for ($tmp = $catid; $tmp;) {
188 $catrow = sqlQuery("SELECT name, parent FROM categories WHERE id = ?", array($tmp));
189 $note = $catrow['name'] . "/$note";
190 $tmp = $catrow['parent'];
193 $note = "New scanned document $newid: $note";
194 $form_note_message = trim($_POST['form_note_message']);
195 if ($form_note_message) {
196 $note .= "\n" . $form_note_message;
204 $_POST['form_note_type'],
205 $_POST['form_note_to']
207 // Link the new patient note to the document.
208 setGpRelation(1, $newid, 6, $noteid);
209 } // end post patient note
210 } // end copy to documents
212 // Otherwise creating a scanned encounter note...
215 // Get desired $encounter_id.
217 if (empty($_POST['form_copy_sn_visit'])) {
218 $info_msg .= "This patient has no visits! ";
220 $encounter_id = 0 +
$_POST['form_copy_sn_visit'];
224 // Merge the selected pages.
225 $info_msg .= mergeTiffs();
226 $tmp_name = "$faxcache/temp.tif";
230 // The following is cloned from contrib/forms/scanned_notes/new.php:
232 $query = "INSERT INTO form_scanned_notes ( notes ) VALUES ( ? )";
233 $formid = sqlInsert($query, array($_POST['form_copy_sn_comments']));
243 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/" . check_file_dir_name($patient_id) . "/encounters";
244 $imagepath = "$imagedir/" . check_file_dir_name($encounter_id) . "_" . check_file_dir_name($formid) . ".jpg";
245 if (! is_dir($imagedir)) {
246 $tmp0 = exec('mkdir -p ' . escapeshellarg($imagedir), $tmp1, $tmp2);
248 die("mkdir returned " . text($tmp2) . ": " . text($tmp0));
251 exec("touch " . escapeshellarg($imagedir."/index.html"));
254 if (is_file($imagepath)) {
258 // TBD: There may be a faster way to create this file, given that
259 // we already have a jpeg for each page in faxcache.
260 $cmd = "convert -resize 800 -density 96 " . escapeshellarg($tmp_name) . " -append " . escapeshellarg($imagepath);
261 $tmp0 = exec($cmd, $tmp1, $tmp2);
263 die("\"" . text($cmd) . "\" returned " . text($tmp2) . ": " . text($tmp0));
267 // If we are posting a patient note...
268 if ($_POST['form_cb_note'] && !$info_msg) {
269 $note = "New scanned encounter note for visit on " . substr($erow['date'], 0, 10);
270 $form_note_message = trim($_POST['form_note_message']);
271 if ($form_note_message) {
272 $note .= "\n" . $form_note_message;
280 $_POST['form_note_type'],
281 $_POST['form_note_to']
283 } // end post patient note
286 $action_taken = true;
287 } // end copy to chart
289 if ($_POST['form_cb_forward']) {
290 $form_from = trim($_POST['form_from']);
291 $form_to = trim($_POST['form_to']);
292 $form_fax = trim($_POST['form_fax']);
293 $form_message = trim($_POST['form_message']);
294 $form_finemode = $_POST['form_finemode'] ?
'-m' : '-l';
296 // Generate a cover page using enscript. This can be a cool thing
297 // to do, as enscript is very powerful.
301 $tmpfn1 = tempnam("/tmp", "fax1");
302 $tmpfn2 = tempnam("/tmp", "fax2");
303 $tmph = fopen($tmpfn1, "w");
305 $fh = fopen($GLOBALS['OE_SITE_DIR'] . "/faxcover.txt", 'r');
307 $cpstring .= fread($fh, 8192);
311 $cpstring = str_replace('{CURRENT_DATE}', date('F j, Y'), $cpstring);
312 $cpstring = str_replace('{SENDER_NAME}', $form_from, $cpstring);
313 $cpstring = str_replace('{RECIPIENT_NAME}', $form_to, $cpstring);
314 $cpstring = str_replace('{RECIPIENT_FAX}', $form_fax, $cpstring);
315 $cpstring = str_replace('{MESSAGE}', $form_message, $cpstring);
316 fwrite($tmph, $cpstring);
318 $tmp0 = exec("cd " . escapeshellarg($webserver_root.'/custom') . "; " . escapeshellcmd($GLOBALS['hylafax_enscript']) .
319 " -o " . escapeshellarg($tmpfn2) . " " . escapeshellarg($tmpfn1), $tmp1, $tmp2);
321 $info_msg .= "enscript returned $tmp2: $tmp0 ";
326 // Send the fax as the cover page followed by the selected pages.
327 $info_msg .= mergeTiffs();
329 "sendfax -A -n " . escapeshellarg($form_finemode) . " -d " .
330 escapeshellarg($form_fax) . " " . escapeshellarg($tmpfn2) . " " . escapeshellarg($faxcache.'/temp.tif'),
335 $info_msg .= "sendfax returned $tmp2: $tmp0 ";
340 $action_taken = true;
343 $form_cb_delete = $_POST['form_cb_delete'];
345 // If deleting selected, do it and then check if any are left.
346 if ($form_cb_delete == '1' && !$info_msg) {
347 foreach ($_POST['form_images'] as $inbase) {
348 check_file_dir_name($inbase);
349 unlink($faxcache . "/" . $inbase . ".jpg");
350 $action_taken = true;
353 // Check if any .jpg files remain... if not we'll clean up.
355 $dh = opendir($faxcache);
357 die("Cannot read " . text($faxcache));
360 $form_cb_delete = '2';
361 while (false !== ($jfname = readdir($dh))) {
362 if (preg_match('/\.jpg$/', $jfname)) {
363 $form_cb_delete = '1';
371 if ($form_cb_delete == '2' && !$info_msg) {
372 // Delete the tiff file, with archiving if desired.
373 if ($GLOBALS['hylafax_archdir'] && $mode == 'fax') {
374 rename($filepath, $GLOBALS['hylafax_archdir'] . '/' . $filename);
380 if (is_dir($faxcache)) {
381 $dh = opendir($faxcache);
382 while (($tmp = readdir($dh)) !== false) {
383 if (is_file("$faxcache/$tmp")) {
384 unlink("$faxcache/$tmp");
392 $action_taken = true;
395 if (!$action_taken && !$info_msg) {
396 $info_msg = xl('You did not choose any actions.');
399 if ($info_msg ||
$form_cb_delete != '1') {
400 // Close this window and refresh the fax list.
401 echo "<html>\n<body>\n<script language='JavaScript'>\n";
403 echo " alert('" . addslashes($info_msg) . "');\n";
406 echo " if (!opener.closed && opener.refreshme) opener.refreshme();\n";
407 echo " window.close();\n";
408 echo "</script>\n</body>\n</html>\n";
411 } // end submit logic
413 // If we get this far then we are displaying the form.
415 // Find out if the scanned_notes form is installed and active.
417 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
418 "directory LIKE 'scanned_notes' AND state = 1 AND sql_run = 1");
419 $using_scanned_notes = $tmp['count'];
421 // If the image cache does not yet exist for this fax, build it.
422 // This will contain a .tif image as well as a .jpg image for each page.
424 if (! is_dir($faxcache)) {
425 $tmp0 = exec('mkdir -p ' . escapeshellarg($faxcache), $tmp1, $tmp2);
427 die("mkdir returned " . text($tmp2) . ": " . text($tmp0));
430 if (strtolower($ext) != '.tif') {
431 // convert's default density for PDF-to-TIFF conversion is 72 dpi which is
432 // not very good, so we upgrade it to "fine mode" fax quality. It's really
433 // better and faster if the scanner produces TIFFs instead of PDFs.
434 $tmp0 = exec("convert -density 203x196 " . escapeshellarg($filepath) . " " . escapeshellarg($faxcache.'/deleteme.tif'), $tmp1, $tmp2);
436 die("convert returned " . text($tmp2) . ": " . text($tmp0));
439 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; tiffsplit 'deleteme.tif'; rm -f 'deleteme.tif'", $tmp1, $tmp2);
441 die("tiffsplit/rm returned " . text($tmp2) . ": " . text($tmp0));
444 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; tiffsplit " . escapeshellarg($filepath), $tmp1, $tmp2);
446 die("tiffsplit returned " . text($tmp2) . ": " . text($tmp0));
450 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; mogrify -resize 750x970 -format jpg *.tif", $tmp1, $tmp2);
452 die("mogrify returned " . text($tmp2) . ": " . text($tmp0) . "; ext is '" . text($ext) . "'; filepath is '" . text($filepath) . "'");
456 // Get the categories list.
457 $categories = array();
458 getKittens(0, '', $categories);
460 // Get the users list.
461 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
462 "WHERE active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
463 "ORDER BY lname, fname");
468 <?php Header
::setupHeader(['opener', 'datetime-picker', 'jquery-ui']);?
>
469 <title
><?php
echo xlt('Dispatch Received Document'); ?
></title
>
473 td
, input
, select
, textarea
{
484 border
-color
: #0000ff;
491 <script language
="JavaScript">
493 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
495 function divclick(cb
, divid
) {
496 var divstyle
= document
.getElementById(divid
).style
;
498 if (divid
== 'div_copy_doc') {
499 document
.getElementById('div_copy_sn').style
.display
= 'none';
501 else if (divid
== 'div_copy_sn') {
502 document
.getElementById('div_copy_doc').style
.display
= 'none';
504 divstyle
.display
= 'block';
506 divstyle
.display
= 'none';
511 // This is for callback by the find-patient popup.
512 function setpatient(pid
, lname
, fname
, dob
) {
513 var f
= document
.forms
[0];
514 f
.form_patient
.value
= lname +
', ' + fname
;
515 f
.form_pid
.value
= pid
;
516 <?php
if ($using_scanned_notes) { ?
>
517 // This loads the patient's list of recent encounters:
518 f
.form_copy_sn_visit
.options
.length
= 0;
519 f
.form_copy_sn_visit
.options
[0] = new Option('Loading...', '0');
520 $
.getScript("fax_dispatch_newpid.php?p=" +
encodeURIComponent(pid
) +
"&csrf_token_form=" +
<?php
echo js_url(collectCsrfToken()); ?
>);
524 // This invokes the find-patient popup.
525 function sel_patient() {
526 dlgopen('../main/calendar/find_patient_popup.php', '_blank', 750, 550, false, 'Select Patient');
529 // Check for errors when the form is submitted.
530 function validate() {
531 var f
= document
.forms
[0];
533 if (f
.form_cb_copy
.checked
) {
534 if (! f
.form_pid
.value
) {
535 alert('You have not selected a patient!');
540 if (f
.form_cb_forward
.checked
) {
541 var s
= f
.form_fax
.value
;
543 alert('A fax number is required!');
547 for (var i
= 0; i
< s
.length
; ++i
) {
549 if (c
>= '0' && c
<= '9') {
552 else if (digcount
== 0 || c
!= '-') {
553 alert('Invalid character(s) in fax number!');
558 if (s
.charAt(0) < '2') {
559 alert('Local phone number starts with an invalid digit!');
563 else if (digcount
== 11) {
564 if (s
.charAt(0) != '1') {
565 alert('11-digit number must begin with 1!');
569 else if (digcount
== 10) {
570 if (s
.charAt(0) < '2') {
571 alert('10-digit number starts with an invalid digit!');
574 f
.form_fax
.value
= '1' + s
;
577 alert('Invalid number of digits in fax telephone number!');
582 if (f
.form_cb_copy
.checked || f
.form_cb_forward
.checked
) {
584 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
585 if (f
.elements
[i
].name
== 'form_images[]' && f
.elements
[i
].checked
)
588 if (check_count
== 0) {
589 alert('No pages have been selected!');
594 top
.restoreSession();
598 function allCheckboxes(issel
) {
599 var f
= document
.forms
[0];
600 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
601 if (f
.elements
[i
].name
== 'form_images[]') f
.elements
[i
].checked
= issel
;
605 $
(document
).ready(function(){
606 $
('.datepicker').datetimepicker({
607 <?php
$datetimepicker_timepicker = false; ?
>
608 <?php
$datetimepicker_showseconds = false; ?
>
609 <?php
$datetimepicker_formatInput = false; ?
>
610 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
611 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
618 <body
class="body_top" onunload
='imclosing()'>
620 <center
><h2
><?php
echo xlt('Dispatch Received Document'); ?
></h2
></center
>
622 <form method
='post' name
='theform'
623 action
='fax_dispatch.php?<?php echo ($mode == 'fax
') ? 'file
' : 'scan
'; ?>=<?php echo attr_url($filename); ?>' onsubmit
='return validate()'>
624 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
626 <p
><input type
='checkbox' name
='form_cb_copy' value
='1'
627 onclick
='return divclick(this,"div_copy");' />
628 <b
><?php
echo xlt('Copy Pages to Patient Chart'); ?
></b
></p
>
630 <div id
='div_copy' class='section' style
='display:none;'>
633 <td
class='itemtitle' width
='1%' nowrap
><?php
echo xlt('Patient'); ?
></td
>
635 <input type
='text' size
='10' name
='form_patient' style
='width:100%'
636 value
=' (<?php echo xla('Click to select
'); ?>)' onclick
='sel_patient()'
637 title
='<?php echo xla('Click to select patient
'); ?>' readonly
/>
638 <input type
='hidden' name
='form_pid' value
='0' />
642 <td colspan
='2' style
='padding-top:0.5em;'>
643 <input type
='radio' name
='form_cb_copy_type' value
='1'
644 onclick
='return divclick(this,"div_copy_doc");' checked
/>
645 <b
><?php
echo xlt('Patient Document'); ?
></b
> 
;
646 <?php
if ($using_scanned_notes) { ?
>
647 <input type
='radio' name
='form_cb_copy_type' value
='2'
648 onclick
='return divclick(this,"div_copy_sn");' />
649 <b
><?php
echo xlt('Scanned Encounter Note'); ?
></b
>
651 <div id
='div_copy_doc' class='section' style
='margin-top:0.5em;'>
654 <td
class='itemtitle' nowrap
><?php
echo xlt('Category'); ?
></td
>
656 <select name
='form_category' style
='width:100%'>
658 foreach ($categories as $catkey => $catname) {
659 echo " <option value='" . attr($catkey) . "'";
660 echo ">" . text($catname) . "</option>\n";
667 <td
class='itemtitle' nowrap
><?php
echo xlt('Filename'); ?
></td
>
669 <input type
='text' size
='10' name
='form_filename' style
='width:100%'
670 value
='<?php echo attr($filebase) . ".pdf" ?>'
671 title
='Name for this document in the patient chart' />
675 <td
class='itemtitle' nowrap
><?php
echo xlt('Document Date'); ?
></td
>
677 <input type
='text' class='datepicker' size
='10' name
='form_docdate' id
='form_docdate'
678 value
='<?php echo date('Y
-m
-d
'); ?>'
679 title
='<?php echo xla('yyyy
-mm
-dd date associated with this document
'); ?>' />
683 </div
><!-- end div_copy_doc
-->
684 <div id
='div_copy_sn' class='section' style
='display:none;margin-top:0.5em;'>
687 <td
class='itemtitle' width
='1%' nowrap
><?php
echo xlt('Visit Date'); ?
></td
>
689 <select name
='form_copy_sn_visit' style
='width:100%'>
694 <td
class='itemtitle' width
='1%' nowrap
><?php
echo xlt('Comments'); ?
></td
>
696 <textarea name
='form_copy_sn_comments' rows
='3' cols
='30' style
='width:100%'
697 title
='Comments associated with this scanned note'
702 </div
><!-- end div_copy_sn
-->
706 <td colspan
='2' style
='padding-top:0.5em;'>
707 <input type
='checkbox' name
='form_cb_note' value
='1'
708 onclick
='return divclick(this,"div_note");' />
709 <b
><?php
echo xlt('Create Patient Note'); ?
></b
>
710 <div id
='div_note' class='section' style
='display:none;margin-top:0.5em;'>
713 <td
class='itemtitle' width
='1%' nowrap
><?php
echo xlt('Type'); ?
></td
>
716 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings
717 generate_form_field(array('data_type'=>1,'field_id'=>'note_type','list_id'=>'note_type','empty_title'=>'SKIP'), '');
722 <td
class='itemtitle' width
='1%' nowrap
>To
</td
>
724 <select name
='form_note_to' style
='width:100%'>
726 while ($urow = sqlFetchArray($ures)) {
727 echo " <option value='" . attr($urow['username']) . "'";
728 echo ">" . text($urow['lname']);
729 if ($urow['fname']) {
730 echo ", " . text($urow['fname']);
736 <option value
=''>** <?php
echo xlt('Close'); ?
> **</option
>
741 <td
class='itemtitle' nowrap
><?php
echo xlt('Message'); ?
></td
>
743 <textarea name
='form_note_message' rows
='3' cols
='30' style
='width:100%'
744 title
='Your comments' /></textarea
>
748 </div
><!-- end div_note
-->
752 </div
><!-- end div_copy
-->
754 <p
><input type
='checkbox' name
='form_cb_forward' value
='1'
755 onclick
='return divclick(this,"div_forward");' />
756 <b
><?php
echo xlt('Forward Pages via Fax'); ?
></b
></p
>
758 <div id
='div_forward' class='section' style
='display:none;'>
761 <td
class='itemtitle' width
='1%' nowrap
><?php
echo xlt('From'); ?
></td
>
763 <input type
='text' size
='10' name
='form_from' style
='width:100%'
764 title
='Type your name here' />
768 <td
class='itemtitle' nowrap
><?php
echo xlt('To'); ?
></td
>
770 <input type
='text' size
='10' name
='form_to' style
='width:100%'
771 title
='Type the recipient name here' />
775 <td
class='itemtitle' nowrap
><?php
echo xlt('Fax'); ?
></td
>
777 <input type
='text' size
='10' name
='form_fax' style
='width:100%'
778 title
='The fax phone number to send this to' />
782 <td
class='itemtitle' nowrap
><?php
echo xlt('Message'); ?
></td
>
784 <textarea name
='form_message' rows
='3' cols
='30' style
='width:100%'
785 title
='Your comments to include with this message' /></textarea
>
789 <td
class='itemtitle' nowrap
><?php
echo xlt('Quality'); ?
></td
>
791 <input type
='radio' name
='form_finemode' value
='' /><?php
echo xlt('Normal'); ?
>  
;
792 <input type
='radio' name
='form_finemode' value
='1' checked
/><?php
echo xlt('Fine'); ?
>  
;
796 </div
><!-- end div_forward
-->
798 <p
><b
><?php
echo xlt('Delete Pages'); ?
>:</b
> 
;
799 <input type
='radio' name
='form_cb_delete' value
='2' />All
 
;
800 <input type
='radio' name
='form_cb_delete' value
='1' checked
/>Selected
 
;
801 <input type
='radio' name
='form_cb_delete' value
='0' />None
806 <input type
='submit' name
='form_save' value
='<?php echo xla('OK
'); ?>' />
808 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
810 <input type
='button' value
='<?php echo xla('Select All
'); ?>' onclick
='allCheckboxes(true)' />
812 <input type
='button' value
='<?php echo xla('Clear All
'); ?>' onclick
='allCheckboxes(false)' />
815 <p
><br
/><b
><?php
echo xlt('Please select the desired pages to copy or forward:'); ?
></b
></p
>
819 $dh = opendir($faxcache);
821 die("Cannot read " . text($faxcache));
825 while (false !== ($jfname = readdir($dh))) {
826 if (preg_match("/^(.*)\.jpg/", $jfname, $matches)) {
827 $jpgarray[$matches[1]] = $jfname;
832 // readdir does not read in any particular order, we must therefore sort
833 // by filename so the display order matches the original document.
836 foreach ($jpgarray as $jfnamebase => $jfname) {
839 echo " <td valign='top'>\n";
840 echo " <img src='../../sites/" . attr($_SESSION['site_id']) . "/faxcache/" . attr($mode) . "/" . attr($filebase) . "/" . attr($jfname) . "' />\n";
842 echo " <td align='center' valign='top'>\n";
843 echo " <input type='checkbox' name='form_images[]' value='" . attr($jfnamebase) . "' checked />\n";
844 echo " <br />" . text($page) . "\n";