~intrahealth+informatics/ihris-common/3.1.4-release

« back to all changes in this revision

Viewing changes to templates/report.js

  • Committer: Carl Leitner
  • Date: 2007-10-03 18:12:42 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: litlfred@ibiblio.org-20071003181242-d5tpqmm3pof179ei
Added scripts/ and css/ directories     

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
var xmlHttp = false;
2
 
function setupHttp() {
3
 
        if ( !xmlHttp ) {
4
 
                try {
5
 
                        // Mozilla, Opera 8+, Safari
6
 
                        xmlHttp = new XMLHttpRequest();
7
 
                } catch ( e ) {
8
 
                        try {
9
 
                                // IE 6+
10
 
                                xmlHttp = new ActiveXObject( "Msxml2.XMLHTTP" );
11
 
                        } catch ( e ) {
12
 
                                try {
13
 
                                        // IE 5.5
14
 
                                        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
15
 
                                } catch ( e ) {
16
 
                                        alert( "Your browser doesn't support AJAX!" );
17
 
                                        return false;
18
 
                                }
19
 
                        }
20
 
                }
21
 
        }
22
 
}
23
 
function generateCache() {
24
 
        setupHttp();
25
 
        if( xmlHttp ) {
26
 
                xmlHttp.onreadystatechange=function() {
27
 
                        if ( xmlHttp.readyState == 4 ) {
28
 
                                document.getElementById( "report_cache" ).innerHTML = xmlHttp.responseText;
29
 
                                document.getElementById( "report_cache" ).className = "";
30
 
                                document.getElementById( "show_button" ).disabled = false;
31
 
                                document.getElementById( "show_button" ).className = "";                        
32
 
                        }
33
 
                }
34
 
                document.getElementById( "report_cache" ).innerHTML = "Generating new cache.";
35
 
                document.getElementById( "report_cache" ).className = "cache_loading";
36
 
                document.getElementById( "show_button" ).disabled = true;
37
 
                document.getElementById( "show_button" ).className = "disabled_button";
38
 
                xmlHttp.open( "GET", "report.php?generate=1&" + getTypeReport(), true );
39
 
                xmlHttp.send( null );
40
 
        }
41
 
}
42
 
function checkCache() {
43
 
        if ( document.getElementById( "show_button" ).disabled ) {
44
 
                return false;
45
 
        } else {
46
 
                return true;
47
 
        }
48
 
}
49
 
function getTypeReport() {
50
 
        var form = document.getElementById( "limit_form" );
51
 
        return "type=" + form.type.value + "&report=" + form.report.value;
52
 
}
53
 
function page( num, inc ) {
54
 
        form = document.getElementById( "limit_form" );
55
 
        if ( inc ) {
56
 
                cur_page = form.page.value;
57
 
                form.page.value = Number(cur_page) + num;
58
 
        } else {
59
 
                form.page.value = num;
60
 
        }
61
 
        if ( checkCache() ) form.submit();
62
 
        return false;
63
 
}
64
 
function resort( sort ) {
65
 
        form = document.getElementById( "limit_form" );
66
 
        form.sort.value = sort;
67
 
        if ( checkCache() ) form.submit();
68
 
        return false;
69
 
}
70
 
 
71
 
function print_options_hide() {
72
 
        options_menu = document.getElementById("print_options_menu");
73
 
        options_menu.style.display = "none";
74
 
}
75
 
 
76
 
function print_options_show() {
77
 
        options_menu = document.getElementById("print_options_menu");
78
 
        options_menu.style.display = "";
79
 
}       
80
 
 
81
 
function export_options_hide() {
82
 
        options_menu = document.getElementById("export_options_menu");
83
 
        options_menu.style.display = "none";
84
 
}
85
 
 
86
 
function export_options_show() {
87
 
        options_menu = document.getElementById("export_options_menu");
88
 
        options_menu.style.display = "";
89
 
}       
90
 
 
91