7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2006-2010 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
12 * @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\Common\Crypto\CryptoGen
;
23 use OpenEMR\Common\Csrf\CsrfUtils
;
24 use OpenEMR\Core\Header
;
27 if (!CsrfUtils
::verifyCsrfToken($_GET["csrf_token_form"])) {
28 CsrfUtils
::csrfNotVerified();
32 $filename = $_GET['file'];
34 // ensure the file variable has no illegal characters
35 check_file_dir_name($filename);
37 $filepath = $GLOBALS['hylafax_basedir'] . '/recvq/' . $filename;
38 } elseif ($_GET['scan']) {
39 if (!CsrfUtils
::verifyCsrfToken($_GET["csrf_token_form"])) {
40 CsrfUtils
::csrfNotVerified();
44 $filename = $_GET['scan'];
46 // ensure the file variable has no illegal characters
47 check_file_dir_name($filename);
49 $filepath = $GLOBALS['scanner_output_directory'] . '/' . $filename;
51 die("No filename was given.");
54 $ext = substr($filename, strrpos($filename, '.'));
55 $filebase = basename("/$filename", $ext);
56 $faxcache = $GLOBALS['OE_SITE_DIR'] . "/faxcache/$mode/$filebase";
60 // This function builds an array of document categories recursively.
61 // Kittens are the children of cats, you know. :-)getKittens
63 function getKittens($catid, $catstring, &$categories)
65 $cres = sqlStatement("SELECT id, name FROM categories " .
66 "WHERE parent = ? ORDER BY name", array($catid));
68 while ($crow = sqlFetchArray($cres)) {
70 getKittens($crow['id'], ($catstring ?
"$catstring / " : "") .
71 ($catid ?
$crow['name'] : ''), $categories);
74 // If no kitties, then this is a leaf node and should be listed.
76 $categories[$catid] = $catstring;
80 // This merges the tiff files for the selected pages into one tiff file.
89 // form_images are the checkboxes to the right of the images.
90 foreach ($_POST['form_images'] as $inbase) {
91 check_file_dir_name($inbase);
92 $inames .= ' ' . escapeshellarg("$inbase.tif");
96 die(xlt("Internal error - no pages were selected!"));
99 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; tiffcp $inames temp.tif", $tmp1, $tmp2);
101 $msg .= "tiffcp returned $tmp2: $tmp0 ";
107 // If we are submitting...
109 if ($_POST['form_save']) {
110 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
111 CsrfUtils
::csrfNotVerified();
114 $action_taken = false;
118 if ($_POST['form_cb_copy']) {
119 $patient_id = (int) $_POST['form_pid'];
121 die(xlt('Internal error - patient ID was not provided!'));
124 // Compute the name of the target directory and make sure it exists.
125 $docdir = $GLOBALS['OE_SITE_DIR'] . "/documents/" . check_file_dir_name($patient_id);
126 exec("mkdir -p " . escapeshellarg($docdir));
128 // If copying to patient documents...
130 if ($_POST['form_cb_copy_type'] == 1) {
131 // Compute a target filename that does not yet exist.
132 $ffname = check_file_dir_name(trim($_POST['form_filename']));
133 $i = strrpos($ffname, '.');
135 $ffname = trim(substr($ffname, 0, $i));
144 // If the target filename exists, modify it until it doesn't.
146 while (is_file("$docdir/$ffname$ffmod$ffsuff")) {
151 $target = "$docdir/$ffname$ffmod$ffsuff";
152 $docdate = fixDate($_POST['form_docdate']);
154 // Create the target PDF. Note that we are relying on the .tif files for
155 // the individual pages to already exist in the faxcache directory.
157 $info_msg .= mergeTiffs();
158 // The -j option here requires that libtiff is configured with libjpeg.
159 // It could be omitted, but the output PDFs would then be quite large.
160 $tmp0 = exec("tiff2pdf -j -p letter -o " . escapeshellarg($target) . " " . escapeshellarg($faxcache . '/temp.tif'), $tmp1, $tmp2);
163 $info_msg .= "tiff2pdf returned $tmp2: $tmp0 ";
165 $newid = generate_id();
166 $fsize = filesize($target);
167 $catid = (int) $_POST['form_category'];
168 // Update the database.
169 $query = "INSERT INTO documents ( " .
170 "id, type, size, date, url, mimetype, foreign_id, docdate" .
172 "?, 'file_url', ?, NOW(), ?, " .
173 "'application/pdf', ?, ? " .
175 sqlStatement($query, array($newid, $fsize, 'file://' . $target, $patient_id, $docdate));
176 $query = "INSERT INTO categories_to_documents ( " .
177 "category_id, document_id" .
181 sqlStatement($query, array($catid, $newid));
184 // If we are posting a note...
185 if ($_POST['form_cb_note'] && !$info_msg) {
186 // Build note text in a way that identifies the new document.
187 // See pnotes_full.php which uses this to auto-display the document.
188 $note = "$ffname$ffmod$ffsuff";
189 for ($tmp = $catid; $tmp;) {
190 $catrow = sqlQuery("SELECT name, parent FROM categories WHERE id = ?", array($tmp));
191 $note = $catrow['name'] . "/$note";
192 $tmp = $catrow['parent'];
195 $note = "New scanned document $newid: $note";
196 $form_note_message = trim($_POST['form_note_message']);
197 if ($form_note_message) {
198 $note .= "\n" . $form_note_message;
206 $_POST['form_note_type'],
207 $_POST['form_note_to']
209 // Link the new patient note to the document.
210 setGpRelation(1, $newid, 6, $noteid);
211 } // end post patient note
212 } else { // end copy to documents
213 // Otherwise creating a scanned encounter note...
214 // Get desired $encounter_id.
216 if (empty($_POST['form_copy_sn_visit'])) {
217 $info_msg .= "This patient has no visits! ";
219 $encounter_id = 0 +
$_POST['form_copy_sn_visit'];
223 // Merge the selected pages.
224 $info_msg .= mergeTiffs();
225 $tmp_name = "$faxcache/temp.tif";
229 // The following is cloned from contrib/forms/scanned_notes/new.php:
231 $query = "INSERT INTO form_scanned_notes ( notes ) VALUES ( ? )";
232 $formid = sqlInsert($query, array($_POST['form_copy_sn_comments']));
242 $imagedir = $GLOBALS['OE_SITE_DIR'] . "/documents/" . check_file_dir_name($patient_id) . "/encounters";
243 $imagepath = "$imagedir/" . check_file_dir_name($encounter_id) . "_" . check_file_dir_name($formid) . ".jpg";
244 if (! is_dir($imagedir)) {
245 $tmp0 = exec('mkdir -p ' . escapeshellarg($imagedir), $tmp1, $tmp2);
247 die("mkdir returned " . text($tmp2) . ": " . text($tmp0));
250 exec("touch " . escapeshellarg($imagedir . "/index.html"));
253 if (is_file($imagepath)) {
257 // TBD: There may be a faster way to create this file, given that
258 // we already have a jpeg for each page in faxcache.
259 $cmd = "convert -resize 800 -density 96 " . escapeshellarg($tmp_name) . " -append " . escapeshellarg($imagepath);
260 $tmp0 = exec($cmd, $tmp1, $tmp2);
262 die("\"" . text($cmd) . "\" returned " . text($tmp2) . ": " . text($tmp0));
266 // If we are posting a patient note...
267 if ($_POST['form_cb_note'] && !$info_msg) {
268 $note = "New scanned encounter note for visit on " . substr($erow['date'], 0, 10);
269 $form_note_message = trim($_POST['form_note_message']);
270 if ($form_note_message) {
271 $note .= "\n" . $form_note_message;
279 $_POST['form_note_type'],
280 $_POST['form_note_to']
282 } // end post patient note
285 $action_taken = true;
286 } // end copy to chart
288 if ($_POST['form_cb_forward']) {
289 $form_from = trim($_POST['form_from']);
290 $form_to = trim($_POST['form_to']);
291 $form_fax = trim($_POST['form_fax']);
292 $form_message = trim($_POST['form_message']);
293 $form_finemode = $_POST['form_finemode'] ?
'-m' : '-l';
295 // Generate a cover page using enscript. This can be a cool thing
296 // to do, as enscript is very powerful.
300 $tmpfn1 = tempnam("/tmp", "fax1");
301 $tmpfn2 = tempnam("/tmp", "fax2");
302 $tmph = fopen($tmpfn1, "w");
304 $fh = fopen($GLOBALS['OE_SITE_DIR'] . "/faxcover.txt", 'r');
306 $cpstring .= fread($fh, 8192);
310 $cpstring = str_replace('{CURRENT_DATE}', date('F j, Y'), $cpstring);
311 $cpstring = str_replace('{SENDER_NAME}', $form_from, $cpstring);
312 $cpstring = str_replace('{RECIPIENT_NAME}', $form_to, $cpstring);
313 $cpstring = str_replace('{RECIPIENT_FAX}', $form_fax, $cpstring);
314 $cpstring = str_replace('{MESSAGE}', $form_message, $cpstring);
315 fwrite($tmph, $cpstring);
317 $tmp0 = exec("cd " . escapeshellarg($webserver_root . '/custom') . "; " . escapeshellcmd((new CryptoGen())->decryptStandard($GLOBALS['more_secure']['hylafax_enscript'])) .
318 " -o " . escapeshellarg($tmpfn2) . " " . escapeshellarg($tmpfn1), $tmp1, $tmp2);
320 $info_msg .= "enscript returned $tmp2: $tmp0 ";
325 // Send the fax as the cover page followed by the selected pages.
326 $info_msg .= mergeTiffs();
328 "sendfax -A -n " . escapeshellarg($form_finemode) . " -d " .
329 escapeshellarg($form_fax) . " " . escapeshellarg($tmpfn2) . " " . escapeshellarg($faxcache . '/temp.tif'),
334 $info_msg .= "sendfax returned $tmp2: $tmp0 ";
339 $action_taken = true;
342 $form_cb_delete = $_POST['form_cb_delete'];
344 // If deleting selected, do it and then check if any are left.
345 if ($form_cb_delete == '1' && !$info_msg) {
346 foreach ($_POST['form_images'] as $inbase) {
347 check_file_dir_name($inbase);
348 unlink($faxcache . "/" . $inbase . ".jpg");
349 $action_taken = true;
352 // Check if any .jpg files remain... if not we'll clean up.
354 $dh = opendir($faxcache);
356 die("Cannot read " . text($faxcache));
359 $form_cb_delete = '2';
360 while (false !== ($jfname = readdir($dh))) {
361 if (preg_match('/\.jpg$/', $jfname)) {
362 $form_cb_delete = '1';
370 if ($form_cb_delete == '2' && !$info_msg) {
371 // Delete the tiff file, with archiving if desired.
372 if ($GLOBALS['hylafax_archdir'] && $mode == 'fax') {
373 rename($filepath, $GLOBALS['hylafax_archdir'] . '/' . $filename);
379 if (is_dir($faxcache)) {
380 $dh = opendir($faxcache);
381 while (($tmp = readdir($dh)) !== false) {
382 if (is_file("$faxcache/$tmp")) {
383 unlink("$faxcache/$tmp");
391 $action_taken = true;
394 if (!$action_taken && !$info_msg) {
395 $info_msg = xl('You did not choose any actions.');
398 if ($info_msg ||
$form_cb_delete != '1') {
399 // Close this window and refresh the fax list.
400 echo "<html>\n<body>\n<script>\n";
402 echo " alert('" . addslashes($info_msg) . "');\n";
405 echo " if (!opener.closed && opener.refreshme) opener.refreshme();\n";
406 echo " window.close();\n";
407 echo "</script>\n</body>\n</html>\n";
410 } // end submit logic
412 // If we get this far then we are displaying the form.
414 // Find out if the scanned_notes form is installed and active.
416 $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " .
417 "directory LIKE 'scanned_notes' AND state = 1 AND sql_run = 1");
418 $using_scanned_notes = $tmp['count'];
420 // If the image cache does not yet exist for this fax, build it.
421 // This will contain a .tif image as well as a .jpg image for each page.
423 if (! is_dir($faxcache)) {
424 $tmp0 = exec('mkdir -p ' . escapeshellarg($faxcache), $tmp1, $tmp2);
426 die("mkdir returned " . text($tmp2) . ": " . text($tmp0));
429 if (strtolower($ext) != '.tif') {
430 // convert's default density for PDF-to-TIFF conversion is 72 dpi which is
431 // not very good, so we upgrade it to "fine mode" fax quality. It's really
432 // better and faster if the scanner produces TIFFs instead of PDFs.
433 $tmp0 = exec("convert -density 203x196 " . escapeshellarg($filepath) . " " . escapeshellarg($faxcache . '/deleteme.tif'), $tmp1, $tmp2);
435 die("convert returned " . text($tmp2) . ": " . text($tmp0));
438 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; tiffsplit 'deleteme.tif'; rm -f 'deleteme.tif'", $tmp1, $tmp2);
440 die("tiffsplit/rm returned " . text($tmp2) . ": " . text($tmp0));
443 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; tiffsplit " . escapeshellarg($filepath), $tmp1, $tmp2);
445 die("tiffsplit returned " . text($tmp2) . ": " . text($tmp0));
449 $tmp0 = exec("cd " . escapeshellarg($faxcache) . "; mogrify -resize 750x970 -format jpg *.tif", $tmp1, $tmp2);
451 die("mogrify returned " . text($tmp2) . ": " . text($tmp0) . "; ext is '" . text($ext) . "'; filepath is '" . text($filepath) . "'");
455 // Get the categories list.
456 $categories = array();
457 getKittens(0, '', $categories);
459 // Get the users list.
460 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
461 "WHERE active = 1 AND ( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
462 "ORDER BY lname, fname");
467 <?php Header
::setupHeader(['opener', 'datetime-picker']);?
>
468 <title
><?php
echo xlt('Dispatch Received Document'); ?
></title
>
472 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
474 function divclick(cb
, divid
) {
475 var divstyle
= document
.getElementById(divid
).style
;
477 if (divid
== 'div_copy_doc') {
478 document
.getElementById('div_copy_sn').style
.display
= 'none';
480 else if (divid
== 'div_copy_sn') {
481 document
.getElementById('div_copy_doc').style
.display
= 'none';
483 divstyle
.display
= 'block';
485 divstyle
.display
= 'none';
490 // This is for callback by the find-patient popup.
491 function setpatient(pid
, lname
, fname
, dob
) {
492 var f
= document
.forms
[0];
493 f
.form_patient
.value
= lname +
', ' + fname
;
494 f
.form_pid
.value
= pid
;
495 <?php
if ($using_scanned_notes) { ?
>
496 // This loads the patient's list of recent encounters:
497 f
.form_copy_sn_visit
.options
.length
= 0;
498 f
.form_copy_sn_visit
.options
[0] = new Option('Loading...', '0');
499 $
.getScript("fax_dispatch_newpid.php?p=" +
encodeURIComponent(pid
) +
"&csrf_token_form=" +
<?php
echo js_url(CsrfUtils
::collectCsrfToken()); ?
>);
503 // This invokes the find-patient popup.
504 function sel_patient() {
505 dlgopen('../main/calendar/find_patient_popup.php', '_blank', 750, 550, false, 'Select Patient');
508 // Check for errors when the form is submitted.
509 function validate() {
510 var f
= document
.forms
[0];
512 if (f
.form_cb_copy
.checked
) {
513 if (! f
.form_pid
.value
) {
514 alert('You have not selected a patient!');
519 if (f
.form_cb_forward
.checked
) {
520 var s
= f
.form_fax
.value
;
522 alert('A fax number is required!');
526 for (var i
= 0; i
< s
.length
; ++i
) {
528 if (c
>= '0' && c
<= '9') {
531 else if (digcount
== 0 || c
!= '-') {
532 alert('Invalid character(s) in fax number!');
537 if (s
.charAt(0) < '2') {
538 alert('Local phone number starts with an invalid digit!');
542 else if (digcount
== 11) {
543 if (s
.charAt(0) != '1') {
544 alert('11-digit number must begin with 1!');
548 else if (digcount
== 10) {
549 if (s
.charAt(0) < '2') {
550 alert('10-digit number starts with an invalid digit!');
553 f
.form_fax
.value
= '1' + s
;
556 alert('Invalid number of digits in fax telephone number!');
561 if (f
.form_cb_copy
.checked || f
.form_cb_forward
.checked
) {
563 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
564 if (f
.elements
[i
].name
== 'form_images[]' && f
.elements
[i
].checked
)
567 if (check_count
== 0) {
568 alert('No pages have been selected!');
573 top
.restoreSession();
577 function allCheckboxes(issel
) {
578 var f
= document
.forms
[0];
579 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
580 if (f
.elements
[i
].name
== 'form_images[]') f
.elements
[i
].checked
= issel
;
585 $
('.datepicker').datetimepicker({
586 <?php
$datetimepicker_timepicker = false; ?
>
587 <?php
$datetimepicker_showseconds = false; ?
>
588 <?php
$datetimepicker_formatInput = false; ?
>
589 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
590 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
597 <body
class="body_top">
598 <h2
class="text-center"><?php
echo xlt('Dispatch Received Document'); ?
></h2
>
600 <form method
='post' name
='theform'
601 action
='fax_dispatch.php?<?php echo ($mode == 'fax
') ? 'file
' : 'scan
'; ?>=<?php echo attr_url($filename); ?>&csrf_token_form=<?php echo attr_url(CsrfUtils::collectCsrfToken()); ?>' onsubmit
='return validate()'>
602 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
604 <p
><input type
='checkbox' name
='form_cb_copy' value
='1'
605 onclick
='return divclick(this,"div_copy");' />
606 <span
class="font-weight-bold"><?php
echo xlt('Copy Pages to Patient Chart'); ?
></span
></p
>
608 <!-- Copy Pages to Patient Chart Section
-->
609 <div id
='div_copy' class='jumbotron' style
='display:none;'>
610 <!-- Patient Section
-->
611 <div
class="form-row mt-2">
612 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Patient'); ?
></label
>
614 <input type
='text' size
='10' name
='form_patient' class='form-control bg-light'
615 value
=' (<?php echo xla('Click to select
'); ?>)' onclick
='sel_patient()'
616 data
-toggle
='tooltip' data
-placement
='top'
617 title
='<?php echo xla('Click to select patient
'); ?>' readonly
/>
618 <input type
='hidden' name
='form_pid' value
='0' />
621 <!-- Patient Document Section
-->
622 <div
class="form-row mt-2">
623 <div
class="col-12 col-form-label">
624 <input type
='radio' name
='form_cb_copy_type' value
='1'
625 onclick
='return divclick(this,"div_copy_doc");' checked
/>
626 <label
class="font-weight-bold"><?php
echo xlt('Patient Document'); ?
></label
>
627 <?php
if ($using_scanned_notes) { ?
>
628 <input type
='radio' name
='form_cb_copy_type' value
='2'
629 onclick
='return divclick(this,"div_copy_sn");' />
630 <label
class="font-weight-bold"><?php
echo xlt('Scanned Encounter Note'); ?
></label
>
632 <!-- div_copy_doc Section
-->
633 <div id
='div_copy_doc' class='bg-secondary border rounded p-2'>
634 <!-- Category Section
-->
635 <div
class="form-row mt-2">
636 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Category'); ?
></label
>
638 <select name
='form_category' class='form-control'>
640 foreach ($categories as $catkey => $catname) {
641 echo " <option value='" . attr($catkey) . "'";
642 echo ">" . text($catname) . "</option>";
648 <!-- Filename Section
-->
649 <div
class="form-row mt-2">
650 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Filename'); ?
></label
>
652 <input type
='text' size
='10' name
='form_filename' class='form-control'
653 value
='<?php echo attr($filebase) . ".pdf" ?>'
654 data
-toggle
='tooltip' data
-placement
='top'
655 title
='Name for this document in the patient chart' />
658 <!-- Document Date Section
-->
659 <div
class="form-row mt-2">
660 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Document Date'); ?
></label
>
662 <input type
='text' class='datepicker form-control' size
='10' name
='form_docdate' id
='form_docdate'
663 value
='<?php echo date('Y
-m
-d
'); ?>'
664 data
-toggle
='tooltip' data
-placement
='top'
665 title
='<?php echo xla('yyyy
-mm
-dd date associated with this document
'); ?>' />
669 <!-- div_copy_sn Section
-->
670 <div id
='div_copy_sn' class='bg-secondary border rounded p-2' style
='display:none;margin-top:0.5em;'>
671 <!-- Visit Date Section
-->
672 <div
class="form-row mt-2">
673 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Visit Date'); ?
></label
>
675 <select name
='form_copy_sn_visit' class='form-control'>
679 <!-- Comments Section
-->
680 <div
class="form-row mt-2">
681 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Comments'); ?
></label
>
683 <textarea name
='form_copy_sn_comments' rows
='3' cols
='30' class='form-control'
684 data
-toggle
='tooltip' data
-placement
='top'
685 title
='Comments associated with this scanned note'>
692 <!-- Create Patient Note Section
-->
693 <div
class="form-gruop row">
694 <div
class="col-12 col-form-label">
695 <input type
='checkbox' name
='form_cb_note' value
='1'
696 onclick
='return divclick(this,"div_note");' />
697 <label
class="font-weight-bold"><?php
echo xlt('Create Patient Note'); ?
></label
>
698 <!-- div_note Section
-->
699 <div id
='div_note' class='bg-secondary border rounded p-2' style
='display:none;'>
700 <!-- Type Section
-->
701 <div
class="form-row mt-2">
702 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Type'); ?
></label
>
705 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings
706 generate_form_field(array('data_type' => 1,'field_id' => 'note_type','list_id' => 'note_type','empty_title' => 'SKIP'), '');
711 <div
class="form-row mt-2">
712 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('To'); ?
></label
>
714 <select name
='form_note_to' class='form-control'>
716 while ($urow = sqlFetchArray($ures)) {
717 echo " <option value='" . attr($urow['username']) . "'";
718 echo ">" . text($urow['lname']);
719 if ($urow['fname']) {
720 echo ", " . text($urow['fname']);
726 <option value
=''>** <?php
echo xlt('Close'); ?
> **</option
>
730 <!-- Message Section
-->
731 <div
class="form-row mt-2">
732 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Message'); ?
></label
>
734 <textarea name
='form_note_message' rows
='3' cols
='30' class='form-control'
735 data
-toggle
='tooltip' data
-placement
='top'
736 title
='Your comments'>
745 <p
><input type
='checkbox' name
='form_cb_forward' value
='1'
746 onclick
='return divclick(this,"div_forward");' />
747 <span
class="font-weight-bold"><?php
echo xlt('Forward Pages via Fax'); ?
></span
></p
>
749 <!-- Forward Pages via Fax Section
-->
750 <div id
='div_forward' class='jumbotron' style
='display:none;'>
751 <!-- From Section
-->
752 <div
class="form-row mt-2">
753 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('From'); ?
></label
>
755 <input type
='text' size
='10' name
='form_from' class='form-control' data
-toggle
='tooltip' data
-placement
='top' title
='Type your name here'>
759 <div
class="form-row mt-2">
760 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('To{{Destination}}'); ?
></label
>
762 <input type
='text' size
='10' name
='form_to' class='form-control' data
-toggle
='tooltip' data
-placement
='top' title
='Type the recipient name here'>
766 <div
class="form-row mt-2">
767 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Fax'); ?
></label
>
769 <input type
='text' size
='10' name
='form_fax' class='form-control' data
-toggle
='tooltip' data
-placement
='top' title
='The fax phone number to send this to'>
772 <!-- Message Section
-->
773 <div
class="form-row mt-2">
774 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Message'); ?
></label
>
776 <textarea name
='form_message' rows
='3' cols
='30' class='form-control'
777 data
-toggle
='tooltip' data
-placement
='top'
778 title
='Your comments to include with this message'>
782 <!-- Quality Section
-->
783 <div
class="form-row mt-2">
784 <label
class="col-2 col-form-label font-weight-bold"><?php
echo xlt('Quality'); ?
></label
>
786 <div
class="form-check form-check-inline">
787 <input type
='radio' class='form-check-input' name
='form_finemode' value
=''>
788 <label
class="form-check-label"><?php
echo xlt('Normal'); ?
></label
>
790 <div
class="form-check form-check-inline">
791 <input type
='radio' class='form-check-input' name
='form_finemode' value
='1' checked
>
792 <label
class="form-check-label"><?php
echo xlt('Fine'); ?
></label
>
798 <div
class="form-group form-inline">
799 <label
class="font-weight-bold"><?php
echo xlt('Delete Pages'); ?
>:</label
>
800 <div
class="form-check form-check-inline">
801 <input type
='radio' class='form-check-input' name
='form_cb_delete' value
='2' />
802 <label
class="form-check-label">All
</label
>
804 <div
class="form-check form-check-inline">
805 <input type
='radio' class='form-check-input' name
='form_cb_delete' value
='1' checked
/>
806 <label
class="form-check-label">Selected
</label
>
808 <div
class="form-check form-check-inline">
809 <input type
='radio' class='form-check-input' name
='form_cb_delete' value
='0' />
810 <label
class="form-check-label">None
</label
>
814 <div
class="btn-group">
815 <button type
='submit' class='btn btn-primary btn-save' name
='form_save' value
='<?php echo xla('OK
'); ?>'><?php
echo xla('OK'); ?
></button
>
816 <button type
='button' class='btn btn-secondary btn-cancel' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()'><?php
echo xla('Cancel'); ?
></button
>
817 <button type
='button' class='btn btn-secondary' value
='<?php echo xla('Select All
'); ?>' onclick
='allCheckboxes(true)'><?php
echo xla('Select All'); ?
></button
>
818 <button type
='button' class='btn btn-secondary' value
='<?php echo xla('Clear All
'); ?>' onclick
='allCheckboxes(false)'><?php
echo xla('Clear All'); ?
></button
>
821 <p
class="mt-2 font-weight-bold"><?php
echo xlt('Please select the desired pages to copy or forward:'); ?
></p
>
825 $dh = opendir($faxcache);
827 die("Cannot read " . text($faxcache));
831 while (false !== ($jfname = readdir($dh))) {
832 if (preg_match("/^(.*)\.jpg/", $jfname, $matches)) {
833 $jpgarray[$matches[1]] = $jfname;
838 // readdir does not read in any particular order, we must therefore sort
839 // by filename so the display order matches the original document.
842 foreach ($jpgarray as $jfnamebase => $jfname) {
845 echo " <td valign='top'>\n";
846 echo " <img src='../../sites/" . attr($_SESSION['site_id']) . "/faxcache/" . attr($mode) . "/" . attr($filebase) . "/" . attr($jfname) . "' />\n";
848 echo " <td align='center' valign='top'>\n";
849 echo " <input type='checkbox' name='form_images[]' value='" . attr($jfnamebase) . "' checked />\n";
850 echo " <br />" . text($page) . "\n";
860 $
('[data-toggle="tooltip"]').tooltip();