Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New dictation modernazation #818

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5b8a752
Finally got around to updating this feature.
juggernautsei Apr 8, 2017
6540378
Moved the code around as requested, tested and is working to my knowl…
juggernautsei Apr 10, 2017
551ab56
Merge branch 'master' of git://github.com/openemr/openemr
juggernautsei Apr 14, 2017
55576d3
Merge branch 'master' of git://github.com/openemr/openemr
juggernautsei May 2, 2017
dfc7adf
Merge branch 'master' of git://github.com/openemr/openemr
juggernautsei May 11, 2017
0981412
Merge branch 'master' of git://github.com/openemr/openemr
juggernautsei May 14, 2017
75f79de
Merge branch 'master' of git://github.com/openemr/openemr
juggernautsei Jun 1, 2017
6818c37
starting remodeling the dictation to get into the modernazation. Chan…
juggernautsei Jun 1, 2017
7d103bd
After the first review I went ahead and added the other supporting files
juggernautsei Jun 2, 2017
3e2d009
XSS prevention with html_entity_decode()
juggernautsei Jun 3, 2017
e2ab3e1
Added functionality that was needed.
juggernautsei Jun 3, 2017
5084ea8
I was looking at it the wrong way. The XSS has to be stopped on the s…
juggernautsei Jun 3, 2017
92f63ec
Here are the rest of the changes that go with the form updates to sec…
juggernautsei Jun 3, 2017
3b93b49
html purifier integration.
juggernautsei Jun 5, 2017
777a2b1
updates
juggernautsei Jun 7, 2017
87357b3
rebased my package and updated the files with the new CKEditor
juggernautsei Jun 8, 2017
d08959b
file removed as requested
juggernautsei Jun 8, 2017
af662e0
Reverted title
juggernautsei Jun 8, 2017
1a70cf6
Security features in place
juggernautsei Jun 8, 2017
c064b8e
fixed the folder location for samples
juggernautsei Jun 8, 2017
fc2d761
directory removed
juggernautsei Jun 12, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 37 additions & 16 deletions interface/forms/dictation/new.php
@@ -1,29 +1,50 @@
<!-- Form generated from formsWiz -->
<?php
/**
* Dictation Form
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
* @copyright Copyright (c) 2017 Sherwin Gaddis <sherwingaddis@gmail.com>
*
*/



use OpenEMR\Core\Header;

include_once("../../globals.php");
include_once("$srcdir/api.inc");
formHeader("Form: dictation");
$returnurl = 'encounter_top.php';
?>
<html><head>
<?php html_header_show();?>
<link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
<html>
<head>
<title><?php echo xlt('Dictation'); ?></title>
<?php Header::setupHeader(); ?>
<script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/ckeditor.js"</script>
<script src="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/js/samples/sample.js" type="text/javascript"></script>
<link href="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/css/samples/samples.css" rel="stylesheet" type="text/css" />
</head>
<body class="body_top">
<form method=post action="<?php echo $rootdir;?>/forms/dictation/save.php?mode=new" name="my_form">
<span class="title"><?php echo xlt('Speech Dictation'); ?></span><br><br>
<span class=text><?php echo xlt('Dictation: '); ?></span><br><textarea cols=80 rows=24 wrap=virtual name="dictation" ></textarea><br>
<span class=text><?php echo xlt('Additional Notes:'); ?> </span><br><textarea cols=80 rows=8 wrap=virtual name="additional_notes" ></textarea><br>
<br>
<a href="javascript:top.restoreSession();document.my_form.submit();" class="link_submit">[<?php echo xlt('Save'); ?>]</a>
<br>
<a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="link"
onclick="top.restoreSession()">[<?php echo xlt('Don\'t Save'); ?>]</a>
</form>
<div class="container">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Container should be up by the body, we want most everything contained

<div class="page-header">
<h1><?php echo xlt('Speech Dictation'); ?></h1><br><br>
</div>
<form method=post action="<?php echo $rootdir;?>/forms/dictation/save.php?mode=new" name="my_form" onclick="top.restoreSession()">

<div class="form-group">
<label for="dictation"><?php echo xlt('Dictation: '); ?></label><br><textarea class="form-control ckeditor" name="dictation" ></textarea>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bradymiller, correct me if I'm wrong, but shouldn't end-of-line spaces and punctuation like this be avoided? Also, I'm in favor of yanking colons from labels all together

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robertdown
In this case, the damage was already done about 8 years ago; meaning, this "constant" was already sent to the translation pipeline in it's current form at that time. So, changing these can cause a new constant that needs to be translated. This isn't always the case; for example, here , the Dictation constant already exists, so changing this wouldn't even create a new constant:
https://github.com/openemr/openemr/blob/master/contrib/util/language_translations/currentConstants.txt#L1899

A good general strategy:
If there's a reason(such as not wanting to have the colons), then should change these constants, however, shouldn't do a codebase wide arbitrary fixing of leading/trailing spacing in contants. Hope that makes some sense.

</div>
<div class="form-group">
<label for="additional_notes"><?php echo xlt('Additional Notes:'); ?> </label><br><textarea class="form-control ckeditor" name="additional_notes" ></textarea>
</div>

<button type="submit" class="btn btn-default btn-save"><?php echo xlt('Save'); ?></button>

<a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="btn btn-cancel btn-link" onclick="top.restoreSession()"><?php echo xlt('Cancel'); ?></a>
</form>
</div>

<?php
formFooter();
?>
32 changes: 28 additions & 4 deletions interface/forms/dictation/report.php
@@ -1,7 +1,29 @@
<?php
//------------Forms generated from formsWiz
/**
* Dictation report for display
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
* @copyright Copyright (c) 2017 Sherwin Gaddis <sherwingaddis@gmail.com>
*
*/

include_once(dirname(__FILE__).'/../../globals.php');
include_once($GLOBALS["srcdir"]."/api.inc");


/**
* Retrieve data from the dictation table
*
* @param int $pid
* @param int $encounter
* @param int $cols
* @param int $id
*
*/

function dictation_report( $pid, $encounter, $cols, $id) {
$count = 0;
$data = formFetch("form_dictation", $id);
Expand All @@ -18,8 +40,11 @@ function dictation_report( $pid, $encounter, $cols, $id) {
$value = "yes";
}
$key=ucwords(str_replace("_"," ",$key));
print "<td><span class=bold>" . xlt($key) . ": </span><span class=text>" .
nl2br(text($value)) . "</span></td>";
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($value);
print "<td><span class='bold'>" . xlt($key) . ": </span><span class='text'>" .
$clean_html . "</span></td>";
$count++;
if ($count == $cols) {
$count = 0;
Expand All @@ -29,4 +54,3 @@ function dictation_report( $pid, $encounter, $cols, $id) {
}
print "</tr></table>";
}
?>
15 changes: 11 additions & 4 deletions interface/forms/dictation/save.php
@@ -1,7 +1,14 @@
<?php
//------------Forms generated from formsWiz


/**
* Dictation store
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
* @copyright Copyright (c) 2017 Sherwin Gaddis <sherwingaddis@gmail.com>
*
*/


include_once("../../globals.php");
Expand All @@ -19,4 +26,4 @@
formHeader("Redirecting....");
formJump();
formFooter();
?>

65 changes: 47 additions & 18 deletions interface/forms/dictation/view.php
@@ -1,31 +1,60 @@
<!-- Forms generated from formsWiz -->
<?php
/**
* Dictation Form Edit Saved Data
*
* @package OpenEMR
* @link http://www.open-emr.org
* @author Sherwin Gaddis <sherwingaddis@gmail.com>
* @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
* @copyright Copyright (c) 2017 Sherwin Gaddis <sherwingaddis@gmail.com>
*
*/




use OpenEMR\Core\Header;
include_once("../../globals.php");

$returnurl = 'encounter_top.php';
?>
<html><head>
<?php html_header_show();?>
<link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
<html>
<head>
<title><?php echo xlt('Dictation'); ?></title>
<?php Header::setupHeader(); ?>
<script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/ckeditor.js"</script>
<script src="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/js/samples/sample.js" type="text/javascript"></script>
<link href="<?php echo $GLOBALS['assets_static_relative']; ?>/ckeditor-4-7-0/css/samples/samples.css" rel="stylesheet" type="text/css" />
</head>
<body class="body_top">
<div class="container">
<?php
include_once("$srcdir/api.inc");
$obj = formFetch("form_dictation", $_GET["id"]);
$id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
$obj = formFetch("form_dictation", $id);
?>
<form method=post action="<?php echo $rootdir?>/forms/dictation/save.php?mode=update&id=<?php echo attr($_GET["id"]);?>" name="my_form">
<span class="title"><?php echo xlt('Speech Dictation'); ?></span><Br><br>
<span class=text><?php echo xlt('Dictation: '); ?></span><br><textarea cols=80 rows=24 wrap=virtual name="dictation" ><?php echo text($obj{"dictation"});?></textarea><br>
<span class=text><?php echo xlt('Additional Notes: '); ?></span><br><textarea cols=80 rows=8 wrap=virtual name="additional_notes" ><?php echo text($obj{"additional_notes"});?></textarea><br>
<br>
<a href="javascript:top.restoreSession();document.my_form.submit();" class="link_submit">[<?php echo xlt('Save'); ?>]</a>
<br>
<a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="link"
onclick="top.restoreSession()">[<?php echo xlt('Don\'t Save Changes'); ?>]</a>
</form>
<form method=post action="<?php echo $rootdir?>/forms/dictation/save.php?mode=update&id=<?php echo attr($id);?>" name="my_form" onclick="top.restoreSession()">
<div class="page-header">
<h1><?php echo xlt('Speech Dictation'); ?></h1>
</div>
<div class="form-group">
<label for="dictation"><?php echo xlt('Dictation: '); ?></label><br><textarea class="form-control ckeditor" name="dictation" ><?php
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($obj{"dictation"});
echo trim($clean_html); ?></textarea>
</div>
<div class="form-group">
<label for="additional_notes"><?php echo xlt('Additional Notes: '); ?></label><br><textarea class="form-control ckeditor" name="additional_notes" ><?php
$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier($config);
$clean_html = $purifier->purify($obj{"additional_notes"});
echo trim($clean_html); ?></textarea>
</div>

<button type="submit" class="btn btn-default btn-save"><?php echo xlt('Update'); ?></button>

<a href="<?php echo "$rootdir/patient_file/encounter/$returnurl";?>" class="btn btn-cancel btn-link" onclick="top.restoreSession()"><?php echo xlt('Cancel'); ?></a>
</form>
</div>

<?php
formFooter();
?>
13 changes: 13 additions & 0 deletions public/assets/htmlpurifier-4.9.2/.gitattributes
@@ -0,0 +1,13 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/Doxyfile export-ignore
/art/ export-ignore
/benchmarks/ export-ignore
/configdoc/ export-ignore
/configdoc/usage.xml -crlf
/docs/ export-ignore
/phpdoc.ini
/smoketests/ export-ignore
/tests/* export-ignore
/tests/path2class.func.php -export-ignore
28 changes: 28 additions & 0 deletions public/assets/htmlpurifier-4.9.2/.gitignore
@@ -0,0 +1,28 @@
tags
conf/
test-settings.php
config-schema.php
library/HTMLPurifier/DefinitionCache/Serializer/*/
library/standalone/
library/HTMLPurifier.standalone.php
library/HTMLPurifier*.tgz
library/package*.xml
smoketests/test-schema.html
configdoc/*.html
configdoc/configdoc.xml
docs/doxygen*
*.phpt.diff
*.phpt.exp
*.phpt.log
*.phpt.out
*.phpt.php
*.phpt.skip.php
*.htmlt.ini
*.patch
/*.php
vendor
composer.lock
*.rej
*.orig
*.bak
core
13 changes: 13 additions & 0 deletions public/assets/htmlpurifier-4.9.2/.travis.yml
@@ -0,0 +1,13 @@
language: php
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
before_script:
- git clone --depth=50 https://github.com/ezyang/simpletest.git
- cp test-settings.travis.php test-settings.php
script:
- php tests/index.php
9 changes: 9 additions & 0 deletions public/assets/htmlpurifier-4.9.2/CREDITS
@@ -0,0 +1,9 @@

CREDITS

Almost everything written by Edward Z. Yang (Ambush Commander). Lots of thanks
to the DevNetwork Community for their help (see docs/ref-devnetwork.html for
more details), Feyd especially (namely IPv6 and optimization). Thanks to RSnake
for letting me package his fantastic XSS cheatsheet for a smoketest.

vim: et sw=4 sts=4