~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#set( $width = 40 * $dataElementHistory.historyLength )
 
2
#set( $lastIndex = $dataElementHistory.historyLength - 1 )
 
3
#set( $average = $dataElementHistory.historyPoints.get( $lastIndex ).average )
 
4
 
 
5
#if( $dataElementHistory.minLimit )
 
6
        #set( $minLimit = $dataElementHistory.minLimit )
 
7
#else
 
8
        #set( $minLimit = $encoder.htmlEncode( $i18n.getString( "not_set" ) ) )
 
9
#end
 
10
 
 
11
#if( $dataElementHistory.maxLimit )
 
12
        #set( $maxLimit = $dataElementHistory.maxLimit )
 
13
#else
 
14
        #set( $maxLimit = $encoder.htmlEncode( $i18n.getString( "not_set" ) ) )
 
15
#end
 
16
 
 
17
#if( $isHistoryValid )
 
18
        <h2>$encoder.htmlEncode( $i18n.getString( "dataelement_history" ) )</h2>
 
19
        <h4>$encoder.htmlEncode( $dataElementHistory.dataElement.shortName )</h4>
 
20
#else
 
21
        <h2>$encoder.htmlEncode( $i18n.getString( "dataelement_history" ) )</h2>
 
22
        <h4>$encoder.htmlEncode( $i18n.getString( "history_not_valid" ) )</h4>  
 
23
#end    
 
24
 
 
25
<table>
 
26
        <tr>
 
27
                <td style="background-color:#ff0000">&nbsp;</td>
 
28
                <td>$encoder.htmlEncode( $i18n.getString( "max_limit" ) ) </td>
 
29
                <td><input type="text" id="maxLimit" style="width:10em" value="$maxLimit"
 
30
                        #if( $auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) && $auth.hasAccess( "dhis-web-dataentry", "removeMinMaxLimits" ))
 
31
                                onchange="saveMaxLimit( $dataElementHistory.organisationUnit.id, $dataElementHistory.dataElement.id )"
 
32
                        #else disabled="disabled" #end onfocus="this.select()"></td>
 
33
        </tr>
 
34
        <tr>
 
35
                <td style="background-color:#008000">&nbsp;</td>
 
36
                <td>$encoder.htmlEncode( $i18n.getString( "min_limit" ) ) </td>
 
37
                <td><input type="text" id="minLimit" style="width:10em" value="$minLimit"
 
38
                        #if( $auth.hasAccess( "dhis-web-dataentry", "saveMinMaxLimits" ) && $auth.hasAccess( "dhis-web-dataentry", "removeMinMaxLimits" ))
 
39
                           onchange="saveMinLimit( $dataElementHistory.organisationUnit.id, $dataElementHistory.dataElement.id )"
 
40
                        #else disabled="disabled" #end onfocus="this.select()"></td>
 
41
        </tr>
 
42
        <tr>
 
43
                <td style="background-color:#0080ff">&nbsp;</td>
 
44
                <td>$encoder.htmlEncode( $i18n.getString( "average" ) ) </td>
 
45
                <td><script type="text/javascript">document.write( ${average}.toFixed(1) );</script></td>
 
46
        </tr>
 
47
</table>
 
48
 
 
49
<div id="canvas" style="position:relative;width:${width}px;height:300px;border:1px solid black;background-color:#dddddd;margin-top:1em"></div>
 
50
 
 
51
<p><input type="button" value="$encoder.htmlEncode( $i18n.getString( "close" ) )" onclick="window.opener.location.reload();window.close()"></p>
 
52
 
 
53
<script type="text/javascript">
 
54
 
 
55
var historyLength = $dataElementHistory.historyLength;
 
56
var maxValue = $dataElementHistory.maxValue;
 
57
var minLimit = #if( $dataElementHistory.minLimit ) $dataElementHistory.minLimit #else Number.NaN #end;
 
58
var maxLimit = #if( $dataElementHistory.maxLimit ) $dataElementHistory.maxLimit #else Number.NaN #end;
 
59
 
 
60
var historyPoints = new Array( $dataElementHistory.historyLength );
 
61
#set( $i = 0 )
 
62
#foreach( $historyPoint in $dataElementHistory.historyPoints )
 
63
   historyPoints[$i] = [#if( $historyPoint.period ) '$format.formatPeriod( $historyPoint.period )' #else '-' #end, #if( $historyPoint.value ) $historyPoint.value #else Number.NaN #end, $historyPoint.average];
 
64
   #set( $i = $i + 1 )
 
65
#end
 
66
 
 
67
createChart();
 
68
 
 
69
</script>