Annoying CKEditor4 security warning (#7543)
[openemr.git] / interface / forms / track_anything / report.js
blob4ebf30b14ed5653180af64aa84c7b5a1a1505fe9
1 /**
2  * Javascript functions for the track anything form
3  *
4  * @package   OpenEMR
5  * @link      http://www.open-emr.org
6  * @author    Joe Slam <trackanything@produnis.de>
7  * @copyright Copyright (c) 2014 Joe Slam <trackanything@produnis.de>
8  * @license   https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
9  */
11 //-------------- checkboxes checked checker --------------------
12 // Pass the checkbox name to the function
13 function ta_report_getCheckedBoxes(chkboxName) {
14   var checkboxes = document.getElementsByName(chkboxName);
15   var checkedValue = [];
16   // loop over them all
17   for (var i=0; i<checkboxes.length; i++) {
18      // And stick the checked ones onto an array...
19      if (checkboxes[i].checked) {
20         checkedValue.push(checkboxes[i].value);
21      }
22   }
23   return checkedValue;
25 //---------------------------------------------------------------
28 // plot the current graph
29 // this function is located here, as now all data-arrays are ready
30 //-----------------------------------------------------------------
31 function ta_report_plot_graph(formid,ofc_name,the_track_name,ofc_date,ofc_value){
32         //alert("get graph");
33         top.restoreSession();
34         var checkedBoxes = JSON.stringify(ta_report_getCheckedBoxes("check_col" + formid));
35         var theitems = JSON.stringify(ofc_name);
36         var thetrack = JSON.stringify(the_track_name + " [Track " + formid + "]");
37         var thedates = JSON.stringify(ofc_date);
38         var thevalues = JSON.stringify(ofc_value);
40         jQuery.ajax({ url: '../../../library/ajax/graph_track_anything.php',
41                      type: 'POST',
42                      data: { dates:  thedates,
43                                      values: thevalues,
44                                      items:  theitems,
45                                      track:  thetrack,
46                                      thecheckboxes: checkedBoxes,
47                                      csrf_token_form: csrf_token_js
48                                    },
49                          dataType: "json",
50                          success: function(returnData){
51                              g2 = new Dygraph(
52                                  document.getElementById("graph" + formid),
53                                  returnData.data_final,
54                                  {
55                                      title: returnData.title,
56                                      delimiter: '\t',
57                                      xRangePad: 20,
58                                      yRangePad: 20,
59                                      xlabel: xlabel_translate
60                                  }
61                              );
62                         },
63                         error: function (XMLHttpRequest, textStatus, errorThrown) {
64                                 alert(XMLHttpRequest.responseText);
65                                 //alert("XMLHttpRequest="+XMLHttpRequest.responseText+"\ntextStatus="+textStatus+"\nerrorThrown="+errorThrown);
66                         }
68         }); // end ajax query