2 include_once("../../globals.php");
3 include_once("../../../library/api.inc");
4 include_once("../../../library/sql.inc");
5 formHeader("Form: CAMOS");
6 $returnurl = $GLOBALS['concurrent_layout'] ?
'encounter_top.php' : 'patient_encounter.php';
14 $out_of_encounter = false;
15 if (($_SESSION['encounter'] == '') ||
($_SESSION['pid'] == '')) {
16 $out_of_encounter = true;
25 $previous_encounter_data = '';
26 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
27 $previous_encounter_data = '<hr><p>'.xl('Previous Encounter CAMOS entries').'</p><hr>';
28 //get data from previous encounter to show at bottom of form for reference
29 $query = "SELECT t1.category, t1.subcategory, t1.item, t1.content FROM form_CAMOS as t1 JOIN forms as t2 on (t1.id = t2.form_id) where t2.encounter=(select max(encounter) from forms where form_name like 'CAMOS%' and encounter < ".$_SESSION['encounter']." and pid=".$_SESSION['pid'].") and t1.pid=".$_SESSION['pid'];
30 $statement = sqlStatement($query);
31 while ($result = sqlFetchArray($statement)) {
32 $previous_encounter_data .= $result['category']." | ".$result['subcategory'].
33 " | ".$result['item']."<p><pre>".$result['content']."</pre></p><hr>";
37 //end of get data from previous encounter
38 //variables for preselect section below (after handle database changes):
39 $preselect_category = '';
40 $preselect_subcategory = '';
42 $preselect_category_override = '';
43 $preselect_subcategory_override = '';
44 $preselect_item_override = '';
46 $quote_search = array("\r","\n");
47 $quote_replace = array("\\r","\\n");
48 $quote_search_content = array("\r","\n");
49 $quote_replace_content = array("\\r","\\n");
50 $category = str_replace($quote_search,$quote_replace,$_POST['change_category']);
51 $subcategory = str_replace($quote_search,$quote_replace,$_POST['change_subcategory']);
52 $item = str_replace($quote_search,$quote_replace,$_POST['change_item']);
53 $content = str_replace($quote_search_content,$quote_replace_content,$_POST['textarea_content']);
54 $category = fixquotes($category);
55 $subcategory = fixquotes($subcategory);
56 $item = fixquotes($item);
57 $content = fixquotes($content);
59 if ($_POST['hidden_category']) {$preselect_category = $_POST['hidden_category'];}
60 if ($_POST['hidden_subcategory']) {$preselect_subcategory = $_POST['hidden_subcategory'];}
61 if ($_POST['hidden_item']) {$preselect_item = $_POST['hidden_item'];}
62 //handle changes to database
63 if ($_POST['hidden_mode'] == 'add') {
64 if ($_POST['hidden_selection'] == 'change_category') {
65 $preselect_category_override = $_POST['change_category'];
66 $query = "INSERT INTO form_CAMOS_category (category) values ('";
67 $query .= $category."')";
70 else if ($_POST['hidden_selection'] == 'change_subcategory') {
71 $preselect_subcategory_override = $_POST['change_subcategory'];
72 $category_id = $_POST['hidden_category'];
73 if ($category_id >= 0 ) {
74 $query = "INSERT INTO form_CAMOS_subcategory (subcategory, category_id) values ('";
75 $query .= $subcategory."', '".$category_id."')";
79 else if ($_POST['hidden_selection'] == 'change_item') {
80 $preselect_item_override = $_POST['change_item'];
81 $category_id = $_POST['hidden_category'];
82 $subcategory_id = $_POST['hidden_subcategory'];
83 if (($category_id >= 0 ) && ($subcategory_id >=0)) {
84 $query = "INSERT INTO form_CAMOS_item (item, content, subcategory_id) values ('";
85 $query .= $item."', '".$content."', '".$subcategory_id."')";
90 else if ($_POST['hidden_selection'] == 'change_content') {
91 $item_id = $_POST['hidden_item'];
93 $query = "UPDATE form_CAMOS_item set content = '".$content."' where id = ".$item_id;
98 else if ($_POST['hidden_mode'] == 'delete') {
99 if ($_POST['hidden_selection'] == 'change_category') {
100 $to_delete_id = $_POST['hidden_category'];
101 $to_delete_from_table = 'form_CAMOS_category';
102 $to_delete_from_subtable = 'form_CAMOS_subcategory';
103 $tablename = 'category';
104 $subtablename = 'subcategory';
106 else if ($_POST['hidden_selection'] == 'change_subcategory') {
107 $to_delete_id = $_POST['hidden_subcategory'];
108 $to_delete_from_table = 'form_CAMOS_subcategory';
109 $to_delete_from_subtable = 'form_CAMOS_item';
110 $tablename = 'subcategory';
111 $subtablename = 'item';
113 else if ($_POST['hidden_selection'] == 'change_item') {
114 $to_delete_id = $_POST['hidden_item'];
115 $to_delete_from_table = 'form_CAMOS_item';
116 $to_delete_from_subtable = '';
121 if ($subtablename == '') {
122 $query = "DELETE FROM ".$to_delete_from_table." WHERE id like '".$to_delete_id."'";
126 $query = "SELECT count(id) FROM ".$to_delete_from_subtable." WHERE ".$tablename."_id like '".$to_delete_id."'";
127 $statement = sqlStatement($query);
128 if ($result = sqlFetchArray($statement)) {
129 if ($result['count(id)'] == 0) {
130 $query = "DELETE FROM ".$to_delete_from_table." WHERE id like '".$to_delete_id."'";
134 $error = $subtablename." not empty!";
139 else if ($_POST['hidden_mode'] == 'alter') {
140 $newval = $_POST[$_POST['hidden_selection']];
141 if ($_POST['hidden_selection'] == 'change_category') {
142 $to_alter_id = $_POST['hidden_category'];
143 $to_alter_table = 'form_CAMOS_category';
144 $to_alter_column = 'category';
146 else if ($_POST['hidden_selection'] == 'change_subcategory') {
147 $to_alter_id = $_POST['hidden_subcategory'];
148 $to_alter_table = 'form_CAMOS_subcategory';
149 $to_alter_column = 'subcategory';
151 else if ($_POST['hidden_selection'] == 'change_item') {
152 $to_alter_id = $_POST['hidden_item'];
153 $to_alter_table = 'form_CAMOS_item';
154 $to_alter_column = 'item';
156 $query = "UPDATE ".$to_alter_table." set ".$to_alter_column." = '".$newval."' where id = ".$to_alter_id;
159 // end handle changes to database
161 //preselect column items
162 //either a database change has been made, so the user should be made to feel that they never left the same CAMOS screen
163 //or, CAMOS has been started freshly, therefore the last entry of the current patient should be selected.
164 $preselect_mode = '';
165 if ($preselect_category == '' && !$out_of_encounter) {
166 $preselect_mode = 'by name';
167 //at this point, if this variable has not been set, CAMOS must have been start over
168 //so let's get the most recent values from form_CAMOS for this patient's pid
169 $query = "SELECT category, subcategory, item FROM form_CAMOS WHERE id =(SELECT max(id) from form_CAMOS WHERE pid=".$_SESSION['pid'].")";
170 $statement = sqlStatement($query);
171 if ($result = sqlFetchArray($statement)) {
172 $preselect_category = $result['category'];
173 $preselect_subcategory = $result['subcategory'];
174 $preselect_item = $result['item'];
176 else {$preselect_mode = '';}
179 $preselect_mode = 'by number';
181 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
182 //cloning - similar process to preselect set to first time starting CAMOS
184 $clone_category = '';
185 $clone_subcategory = '';
190 $clone_data_array = array();
191 if (substr($_POST['hidden_mode'],0,5) == 'clone') {
192 $clone_category = $_POST['category'];
193 $query = "SELECT subcategory, item, content FROM form_CAMOS WHERE category like '".$clone_category."' and pid=".$_SESSION['pid']." order by id";
194 // if ($_POST['hidden_mode'] == 'clone last visit') {
195 // $query = "SELECT category, subcategory, item, content FROM form_CAMOS WHERE date(date) like (SELECT
196 // date(MAX(date)) FROM form_CAMOS where date(date) < date(now()) and pid=".$_SESSION['pid'].") and pid=".$_SESSION['pid']." order by id";
199 if ($_POST['hidden_mode'] == 'clone last visit') {
200 $query = "SELECT category, subcategory, item, content FROM form_CAMOS left join forms on (form_CAMOS.id = forms.form_id) where forms.encounter = (select max(encounter) from forms where encounter < ".$_SESSION['encounter']." and pid = ".$_SESSION['pid']." and form_name like 'CAMOS%') and form_CAMOS.pid=".$_SESSION['pid']." order by form_CAMOS.id";
204 $statement = sqlStatement($query);
205 while ($result = sqlFetchArray($statement)) {
206 if (preg_match('/^[\s\r\n]*$/',$result['content']) == 0) {
207 if ($_POST['hidden_mode'] == 'clone last visit') {
208 $clone_category = $result['category'];
210 $clone_subcategory = $result['subcategory'];
211 $clone_item = $result['item'];
212 $clone_content = $result['content'];
213 $clone_data1 = "/* camos :: $clone_category :: $clone_subcategory :: $clone_item :: ";
214 $clone_data2 = "$clone_content */";
215 if ($_POST['hidden_mode'] == 'clone last visit') {
216 //figure out how to make two orders of same category/subcat/item in same last visit appear
218 $clone_data_array[$clone_data1] = $clone_data2;
220 if ($_POST['hidden_mode'] == 'clone last visit') {
221 $query = "SELECT code_type, code, code_text, modifier, units, fee FROM billing WHERE encounter = (SELECT max(encounter) FROM billing where encounter < ".$_SESSION['encounter']." and pid=".$_SESSION['pid'].") and pid=".$_SESSION['pid']." and activity=1 order by id";}
222 $statement = sqlStatement($query);
223 while ($result = sqlFetchArray($statement)) {
224 $clone_code_type = $result['code_type'];
225 $clone_code = $result['code'];
226 $clone_code_text = $result['code_text'];
227 $clone_modifier = $result['modifier'];
228 $clone_units = $result['units'];
229 $clone_fee = $result['fee'];
230 $clone_billing_data = "/* billing :: $clone_code_type :: $clone_code :: $clone_code_text :: $clone_modifier :: $clone_units :: $clone_fee */";
231 $clone_data_array[$clone_billing_data] = '';
234 //foreach($clone_data_array as $key => $val) {
235 // print "<h2> $key </h2>\n";
239 //end preselect column items
240 } //end of 'do only if in an encounter stuff
244 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
246 <script language
="javascript" type
="text/javascript">
248 var array1
= new Array();
249 var array2
= new Array();
250 var array3
= new Array();
252 var preselect_off
= false;
253 var content_change_flag
= false;
254 var lock_override_flag
= false;
255 var switchbox_status
= 'main';
260 f3
= document
.CAMOS
.textarea_content
.value
;
261 document
.CAMOS
.textarea_multibox
.value
=
262 document
.CAMOS
.textarea_multibox
.value +
"/*camos::" +
263 f2
.select_category
.options
[f2
.select_category
.selectedIndex
].text +
265 f2
.select_subcategory
.options
[f2
.select_subcategory
.selectedIndex
].text +
267 f2
.select_item
.options
[f2
.select_item
.selectedIndex
].text +
271 function switchbox() {
272 var mainbox
= document
.getElementById('mainbox');
273 var multibox
= document
.getElementById('multibox');
274 if (switchbox_status
== 'main') {
275 switchbox_status
= 'multi';
276 mainbox
.style
.display
= 'none';
277 multibox
.style
.display
= 'block';
278 document
.CAMOS
.switch_box
.value
= 'hide multibox';
281 switchbox_status
= 'main';
282 multibox
.style
.display
= 'none';
283 mainbox
.style
.display
= 'block';
284 document
.CAMOS
.switch_box
.value
= 'show multibox';
287 //deal with locking of content = prevent accidental overwrite
289 function trimString (str
) {
290 str
= this
!= window? this
: str
;
291 return str
.replace(/^\s+
/g
, '').replace(/\s+$
/g
, '');
293 function isLocked() {
295 if (lock_override_flag
) {
296 lock_override_flag
= false;
299 return /\
/\
*\s
*lock\s
*\
:\
:\s
*\
*\
//.test(f2.textarea_content.value);
301 function lock_content() {
303 if ((trimString(f2
.textarea_content
.value
) != "") && (!isLocked())) {
304 f2
.textarea_content
.value
= f2
.textarea_content
.value +
"\n\n" +
"/*lock::*/";
305 lock_override_flag
= true;
306 js_button('add','change_content');
309 function allSelected() {
310 var f2
= document
.CAMOS
;
311 if ( (f2
.select_category
.selectedIndex
< 0) ||
(f2
.select_subcategory
.selectedIndex
< 0) ||
(f2
.select_item
.selectedIndex
< 0) ) {
312 return false; //one of the columns is not selected
315 return true; //all columns have a selection
319 function content_focus() {
320 if (content_change_flag
== false) {
321 if (!allSelected()) {
322 alert("If you add text to the 'content' box without a selection in each column (category, subcategory, item), you will likely lose your work.")
326 content_change_flag
= true;
328 function content_blur() {
329 if (content_change_flag
== true) {
330 content_change_flag
= false;
334 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
337 $query = "SELECT code_text, code FROM billing WHERE encounter=".$_SESSION['encounter'].
338 " AND pid=".$_SESSION['pid']." AND code_type like 'ICD9' AND activity=1";
339 $statement = sqlStatement($query);
340 if ($result = sqlFetchArray($statement)) {
342 echo "icd9_list = \"\\n\\n\\\n";
343 echo $result['code']." ".$result['code_text']."\\n\\\n";
345 while ($result = sqlFetchArray($statement)) {
346 echo $result['code']." ".$result['code_text']."\\n\\\n";
348 if ($icd9_flag) {echo "\";\n";}
351 $query = "SELECT id, category FROM form_CAMOS_category ORDER BY category";
352 $statement = sqlStatement($query);
354 while ($result = sqlFetchArray($statement)) {
355 echo "array1[".$i."] = new Array('".$result['category']."','".$result['id']."', new Array());\n";
359 $query = "SELECT id, subcategory, category_id FROM form_CAMOS_subcategory ORDER BY subcategory";
360 $statement = sqlStatement($query);
361 while ($result = sqlFetchArray($statement)) {
362 echo "array2[".$i."] = new Array('".$result['subcategory']."', '".$result['category_id']."', '".$result['id']."', new Array());\n";
366 $query = "SELECT id, item, content, subcategory_id FROM form_CAMOS_item ORDER BY item";
367 $statement = sqlStatement($query);
368 while ($result = sqlFetchArray($statement)) {
369 echo "array3[".$i."] = new Array('".$result['item']."', '".fixquotes(str_replace($quote_search_content,$quote_replace_content,strip_tags($result['content'],"<b>,<i>")))."', '".$result['subcategory_id'].
370 "','".$result['id']."');\n";
375 function append_icd9() {
376 var f2
= document
.CAMOS
;
377 f2
.textarea_content
.value
= f2
.textarea_content
.value + icd9_list
;
380 function select_word(mode
, mystring
, myselect
) { //take a string and select it in a select box if present
381 if (preselect_off
) return 0;
382 for (var i
=0;i
<myselect
.length
;i++
) {
384 if (mode
== 'by name') {
385 match
= myselect
.options
[i
].text
;
387 else if (mode
== 'by number') {
388 match
= myselect
.options
[i
].value
;
391 if (match
== mystring
) {
392 myselect
.selectedIndex
= i
;
399 var f2
= document
.CAMOS
;
400 for (i1
=0;i1
<array1
.length
;i1++
) {
401 f2
.select_category
.options
[f2
.select_category
.length
] = new Option(array1
[i1
][0], array1
[i1
][1]);
404 $temp_preselect_mode = $preselect_mode;
405 if ($preselect_category_override != '') {
406 $temp_preselect_mode = "by name";
407 $preselect_category = $preselect_category_override;
410 if (select_word('<? echo $temp_preselect_mode."', '".$preselect_category; ?>' ,f2
.select_category
)) {
415 function click_category() {
416 var f2
= document
.CAMOS
;
417 var category_index
= f2
.select_category
.selectedIndex
;
418 if ((category_index
< 0) ||
(category_index
> f2
.select_category
.length
-1)) {return 0;}
419 var sel
= f2
.select_category
.options
[f2
.select_category
.selectedIndex
].value
;
420 for (var i1
=0;i1
<array1
.length
;i1++
) {
421 if (array1
[i1
][1] == sel
) {
422 f2
.select_subcategory
.length
= 0;
423 f2
.select_item
.length
= 0;
424 f2
.textarea_content
.value
= '';
425 for (var i2
=0;i2
<array2
.length
;i2++
) {
426 if (array1
[i1
][1] == array2
[i2
][1]) {
427 f2
.select_subcategory
.options
[f2
.select_subcategory
.length
] = new Option(array2
[i2
][0], array2
[i2
][2]);
433 $temp_preselect_mode = $preselect_mode;
434 if ($preselect_subcategory_override != '') {
435 $temp_preselect_mode = "by name";
436 $preselect_subcategory = $preselect_subcategory_override;
439 if (select_word('<? echo $temp_preselect_mode."', '".$preselect_subcategory; ?>' ,f2
.select_subcategory
)) {
443 function click_subcategory() {
444 var f2
= document
.CAMOS
;
445 var subcategory_index
= f2
.select_subcategory
.selectedIndex
;
446 if ((subcategory_index
< 0) ||
(subcategory_index
> f2
.select_subcategory
.length
-1)) {return 0;}
447 var sel
= f2
.select_subcategory
.options
[f2
.select_subcategory
.selectedIndex
].value
;
448 for (var i1
=0;i1
<array2
.length
;i1++
) {
449 if (array2
[i1
][2] == sel
) {
450 f2
.select_item
.length
= 0;
451 f2
.textarea_content
.value
= '';
452 for (var i2
=0;i2
<array3
.length
;i2++
) {
453 if (array2
[i1
][2] == array3
[i2
][2]) {
454 f2
.select_item
.options
[f2
.select_item
.length
] = new Option(array3
[i2
][0], array3
[i2
][3]);
460 $temp_preselect_mode = $preselect_mode;
461 if ($preselect_item_override != '') {
462 $temp_preselect_mode = "by name";
463 $preselect_item = $preselect_item_override;
466 if (select_word('<? echo $temp_preselect_mode."', '".$preselect_item; ?>' ,f2
.select_item
)) {
468 preselect_off
= true;
471 function click_item() {
472 var f2
= document
.CAMOS
;
473 var item_index
= f2
.select_item
.selectedIndex
;
474 if ((item_index
< 0) ||
(item_index
> f2
.select_item
.length
-1)) {return 0;}
475 var sel
= f2
.select_item
.options
[item_index
].value
;
476 for (var i1
=0;i1
<array3
.length
;i1++
) {
477 if (array3
[i1
][3] == sel
) {
478 f2
.textarea_content
.value
= array3
[i1
][1].replace(/\\/g
,'');
480 if (substr($_POST['hidden_mode'],0,5) == 'clone') {
481 print "f2.textarea_content.value= ''\n";
482 foreach($clone_data_array as $key => $val) {
483 print "f2.textarea_content.value += \"\\n".fixquotes(str_replace($quote_search,$quote_replace,$key.$val))."\\n\"\n";
492 function selectContains(myselect
, str
) {
493 for (var i
=0;i
<myselect
.length
;i++
) {
494 if (myselect
.options
[i
].text
== trimString(str
)) {return true;}
498 function js_button(mode
,selection
) {
499 var f2
= document
.CAMOS
;
501 if ( (mode
== 'add') && (selection
== 'change_content') && (isLocked()) ) {
502 alert("You have attempted to alter content which is locked.\nRemove the lock if you want to do this.\nTo unlock, remove the line, '/*lock::*/'");
507 //check for blank or duplicate submissions
508 if ( (mode
== 'add') ||
(mode
== 'alter') ) {
509 if (selection
== 'change_category') {
510 if (trimString(f2
.change_category
.value
) == "") {
511 alert("You cannot add a blank value for a category!");
514 if (selectContains(f2
.select_category
, trimString(f2
.change_category
.value
))) {
515 alert("There is already a category named "+f2
.change_category
.value+
".");
519 if (selection
== 'change_subcategory') {
520 if (trimString(f2
.change_subcategory
.value
) == "") {
521 alert("You cannot add a blank value for a subcategory!");
524 if (selectContains(f2
.select_subcategory
, trimString(f2
.change_subcategory
.value
))) {
525 alert("There is already a subcategory named "+f2
.change_subcategory
.value+
".");
529 if (selection
== 'change_item') {
530 if (trimString(f2
.change_item
.value
) == "") {
531 alert("You cannot add a blank value for an item!");
534 if (selectContains(f2
.select_item
, trimString(f2
.change_item
.value
))) {
535 alert("There is already an item named "+f2
.change_item
.value+
".");
540 //end of check for blank or duplicate submissions
542 if (mode
== 'delete') {
543 if (!confirm("Are you sure you want to delete this item from the database?")) {
547 var f2
= document
.CAMOS
;
548 var category_index
= f2
.select_category
.selectedIndex
;
550 if (category_index
< 0) {
551 if ((selection
== 'change_subcategory') ||
(selection
== 'change_item') ||
552 (selection
== 'change_content')) {
553 alert ('You have not selected a category!');
559 category
= f2
.select_category
.options
[category_index
].value
;
561 var subcategory_index
= f2
.select_subcategory
.selectedIndex
;
563 if (subcategory_index
< 0) {
564 if ((selection
== 'change_item') ||
(selection
== 'change_content')) {
565 alert ('You have not selected a subcategory!');
571 subcategory
= f2
.select_subcategory
.options
[subcategory_index
].value
;
573 var item_index
= f2
.select_item
.selectedIndex
;
575 if (item_index
< 0) {
576 if (selection
== 'change_content') {
577 alert ('You have not selected an item!');
583 item
= f2
.select_item
.options
[item_index
].value
;
585 if (mode
== 'submit') {
586 f2
.category
.value
= f2
.select_category
.options
[f2
.select_category
.selectedIndex
].text
;
587 f2
.subcategory
.value
= f2
.select_subcategory
.options
[f2
.select_subcategory
.selectedIndex
].text
;
588 f2
.item
.value
= f2
.select_item
.options
[f2
.select_item
.selectedIndex
].text
;
589 if (selection
== 'submit_selection') {
590 f2
.content
.value
= (f2
.textarea_content
.value
).substring(f2
.textarea_content
.selectionStart
, f2
.textarea_content
.selectionEnd
);
592 else if (selection
== 'multibox') {f2
.content
.value
= f2
.textarea_multibox
.value
;}
593 else {f2
.content
.value
= f2
.textarea_content
.value
;}
594 f2
.action
= '<?echo $rootdir;?>/forms/CAMOS/save.php?mode=new';
598 if (mode
.substr(0,5) == 'clone') {
599 f2
.category
.value
= f2
.select_category
.options
[f2
.select_category
.selectedIndex
].text
;
601 f2
.hidden_mode
.value
= mode
;
602 f2
.hidden_selection
.value
= selection
;
603 f2
.hidden_category
.value
= category
;
604 f2
.hidden_subcategory
.value
= subcategory
;
605 f2
.hidden_item
.value
= item
;
606 f2
.action
= '<? print $GLOBALS['webroot
'] ?>/interface/patient_file/encounter/load_form.php?formname=CAMOS';
612 function selectItem () {
614 f2
.item
.value
=f2
.select_item
.options
[f2
.select_item
.selectedIndex
].text
;
615 f2
.content
.value
= f2
.textarea_content
.value
;
620 <body
<?
echo $top_bg_line;?
> topmargin
=0 rightmargin
=0 leftmargin
=2 bottommargin
=0 marginwidth
=2 marginheight
=0 onload
="init()">
621 <form method
=post action
="<?echo $rootdir;?>/forms/CAMOS/save.php?mode=new" name
="CAMOS">
622 <input type
=button name
='switch_box' value
='show multibox' onClick
="switchbox()">
623 <input type
=button name
='add_multibox' value
='add to multibox' onClick
="addbox()">
624 <input type
=button name
='submit_multibox' value
='submit multibox' onClick
="js_button('submit','multibox')">
626 echo "<a href='".$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl' onclick='top.restoreSession()'>[".xl('do not save')."]</a>";
628 <div id
=mainbox style
="display:block">
631 echo "<h1> error: ".$error."</h1>\n";
637 <?php
xl('Category',e
)?
>
640 <?php
xl('Subcategory',e
)?
>
646 <?php
xl('Content',e
)?
>
652 <select name
=select_category size
=<?
echo $select_size ?
> onchange
="click_category()"></select
><br
>
654 if (myAuth() == 1) {//root user only can see administration option
656 <input type
=text name
=change_category
><br
>
657 <input type
=button name
=add1 value
=add onClick
="js_button('add','change_category')">
658 <input type
=button name
=alter1 value
=alter onClick
="js_button('alter','change_category')">
659 <input type
=button name
=del1 value
=del onClick
="js_button('delete','change_category')"><br
>
665 <select name
=select_subcategory size
=<?
echo $select_size ?
> onchange
="click_subcategory()"></select
><br
>
667 if (myAuth() == 1) {//root user only can see administration option
669 <input type
=text name
=change_subcategory
><br
>
670 <input type
=button name
=add2 value
=add onClick
="js_button('add','change_subcategory')">
671 <input type
=button name
=alter1 value
=alter onClick
="js_button('alter','change_subcategory')">
672 <input type
=button name
=del2 value
=del onClick
="js_button('delete','change_subcategory')"><br
>
678 <select name
=select_item size
=<?
echo $select_size ?
> onchange
="click_item()"></select
><br
>
680 if (myAuth() == 1) {//root user only can see administration option
682 <input type
=text name
=change_item
><br
>
683 <input type
=button name
=add3 value
=add onClick
="js_button('add','change_item')">
684 <input type
=button name
=alter1 value
=alter onClick
="js_button('alter','change_item')">
685 <input type
=button name
=del3 value
=del onClick
="js_button('delete','change_item')"><br
>
691 <textarea name
=textarea_content cols
=<?
echo $textarea_cols ?
> rows
=<?
echo $textarea_rows ?
> onFocus
="content_focus()" onBlur
="content_blur()"></textarea
><br
>
693 if (myAuth() == 1) {//root user only can see administration option
695 <input type
=button name
=add4 value
=add onClick
="js_button('add','change_content')">
696 <input type
=button name
=lock value
=lock onClick
="lock_content()">
698 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
700 <input type
=button name
=icd9 value
=icd9 onClick
="append_icd9()">
701 <input type
=button name
=clone value
=clone onClick
="js_button('clone', 'clone')">
702 <input type
=button name
=clone_visit value
='clone last visit' onClick
="js_button('clone last visit', 'clone last visit')">
713 <input type
=hidden name
=hidden_mode
>
714 <input type
=hidden name
=hidden_selection
>
715 <input type
=hidden name
=hidden_category
>
716 <input type
=hidden name
=hidden_subcategory
>
717 <input type
=hidden name
=hidden_item
>
719 <input type
=hidden name
=category
>
720 <input type
=hidden name
=subcategory
>
721 <input type
=hidden name
=item
>
722 <input type
=hidden name
=content
>
724 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
726 <input type
=button name
='submit form' value
='submit all content' onClick
="js_button('submit','submit')">
727 <input type
=button name
='submit form' value
='submit selected content' onClick
="js_button('submit','submit_selection')">
732 if (!$out_of_encounter) { //do not do stuff that is encounter specific if not in an encounter
733 echo "<a href='".$GLOBALS['webroot'] . "/interface/patient_file/encounter/$returnurl' onclick='top.restoreSession()'>[".xl('do not save')."]</a>";
734 echo "<a href='".$GLOBALS['webroot'] . "/interface/forms/CAMOS/help.html' target='new'> | [".xl('help')."]</a>";
735 // echo $previous_encounter_data; //probably don't need anymore now that we have clone last visit
739 <div id
=multibox style
="display:none">
740 <textarea name
=textarea_multibox cols
=<?
echo $multibox_cols ?
> rows
=<?
echo $multibox_rows ?
> onFocus
="content_focus()" onBlur
="content_blur()"></textarea
>
748 function fixquotes ($string) {
749 $string = preg_replace('/([\\\])*\'/', "\\\'", $string);
750 $string = preg_replace('/([\\\])*\"/', "\\\"", $string);