~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/dataElement.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
<table class="mainPageTable" cellpadding="0">
 
2
        <col id="noCol">
 
3
        <col id="deCol">
 
4
        <col id="typeCol">
 
5
        <col id="minCol">
 
6
    <col id="entryCol">
 
7
        <col id="maxCol">
 
8
        <col id="commentCol">
 
9
        <!--
 
10
        <col>
 
11
        <col>
 
12
        -->
 
13
        <tr>
 
14
                <th>$i18n.getString( "nr" )</th>
 
15
                <th>$i18n.getString( "data_element" )</th>
 
16
                <th>$i18n.getString( "type" )</th>
 
17
                <th>$i18n.getString( "min" )</th>
 
18
                <th>$i18n.getString( "entry" )</th>
 
19
                <th>$i18n.getString( "max" )</th>
 
20
                <th>$i18n.getString( "comment" )</th>
 
21
                <!--<th>$i18n.getString( "timestamp" )</th>-->
 
22
                <!--<th>$i18n.getString( "stored_by" )</th>-->
 
23
        </tr>
 
24
#set( $count = 0 )
 
25
#set( $mark = 0 )
 
26
#set( $tabIndex = 1 )
 
27
#foreach( $dataElement in $section.dataElements )
 
28
        #set( $count = $count + 1 )
 
29
        #if( $mark == 1 )
 
30
                #set( $mark = 0 )
 
31
        #else
 
32
                #set( $mark = 1 )
 
33
        #end
 
34
        #set( $dataValue = false )
 
35
        #set( $dataValue = $dataValueMap.get( $dataElement.id ) )
 
36
        #set( $calculatedValue = false )
 
37
        #set( $calculatedValue = $calculatedValueMap.get( $dataElement ) )
 
38
        #set( $minMax = false )
 
39
        #set( $minMax = $minMaxMap.get( $dataElement.id ) )
 
40
        #set( $calculated = false )
 
41
        #set( $calculated = ($calculatedDataElementIds.contains($dataElement.id)) )
 
42
        <tr #if( $mark == 0 ) style="background-color:#dddddd" #end>
 
43
                ##count
 
44
                <td style="text-align:right">$count</td>
 
45
                
 
46
                ##data element name
 
47
                <td>
 
48
                        <span id="value[$dataElement.id].name" title="$!encoder.htmlEncode( $dataElement.description )">
 
49
                        #if( $dataElement.type == "int" && $auth.hasAccess( "dhis-web-dataentry", "viewHistory" ) )
 
50
                                <a href="javascript:viewHistory( $dataElement.id  )">
 
51
                        #end
 
52
                        #if( $useShortName )
 
53
                                $encoder.htmlEncode( $dataElement.shortName )
 
54
                        #else
 
55
                                $encoder.htmlEncode( $dataElement.name )
 
56
                        #end
 
57
                        #if( $dataElement.type == "int" && $auth.hasAccess( "dhis-web-dataentry", "viewHistory" ) )
 
58
                                </a>
 
59
                        #end
 
60
                    </span>
 
61
                </td>
 
62
                
 
63
                ##type
 
64
                <td>$dataElementTypeMap.get( $dataElement.type )<span id="value[$dataElement.id].type" style="display:none">$dataElement.type</span></td>
 
65
                
 
66
                ##min value
 
67
                <td>
 
68
                #if( $dataElement.type == "int" )
 
69
                        <div id="value[$dataElement.id].min" style="text-align:center">$!minMax.min</div>
 
70
                #end
 
71
                </td>
 
72
                
 
73
                ##entry
 
74
                <td>
 
75
                #if( $dataElement.type == "bool" )
 
76
                        <select name="entryselect" id="value[$dataElement.id].boolean" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue" )) onchange="saveBoolean( $dataElement.id, this )" #else disabled="disabled" #end style="width:100%" tabindex="$tabIndex">
 
77
                                <option value="">[$i18n.getString( "no_value" )]</option>
 
78
                                <option value="true" #if( $datavalue && $dataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
 
79
                                <option value="false" #if( $datavalue && $dataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
 
80
                        </select>
 
81
                #else
 
82
                        #set( $minMaxError = false )
 
83
                        #if( $dataElement.type == "int" && $dataValue && $minMax )
 
84
                                #if( $integer.parseInt( $dataValue.value ) < $minMax.min || $integer.parseInt( $dataValue.value ) > $minMax.max )
 
85
                                        #set( $minMaxError = true )
 
86
                                #end
 
87
                        #end
 
88
                        #if ( $calculated )
 
89
                        <input name="entryfield" id="value[$dataElement.id].value" class="calculated" type="text" value="#if($dataValue) $!encoder.htmlEncode( $dataValue.value ) #elseif( $calculatedValue )$!encoder.htmlEncode( $calculatedValue ) #end" disabled="disabled" onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end">
 
90
                        #else
 
91
                        <input name="entryfield" id="value[$dataElement.id].value" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, '$encoder.jsEncode( $dataElement.name )' )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex">
 
92
            #end
 
93
                #end
 
94
                </td>
 
95
                
 
96
                ##max value
 
97
                <td>
 
98
                #if( $dataElement.type == "int" )
 
99
                        <div id="value[$dataElement.id].max" style="text-align:center">$!minMax.max</div>
 
100
                #end
 
101
                </td>
 
102
                
 
103
                ##comment
 
104
                <td>
 
105
                        <select id="value[$dataElement.id].comments" #if( $auth.hasAccess( "dhis-web-dataentry", "saveComment" )) onchange="commentSelected( $dataElement.id )" #else disabled="disabled" #end #if( $dataValue.comment && !$standardComments.contains( $dataValue.comment )) style="display:none; width:100%" #end>
 
106
                                <option value="">[$i18n.getString( "no_comment" )]</option>
 
107
                                <option value="custom">[$i18n.getString( "custom_comment" )]</option>
 
108
                        #foreach( $comment in $standardComments )
 
109
                                <option value="$encoder.htmlEncode( $comment )" #if( $datavalue.comment && $comment == $dataValue.comment ) selected="selected" #end>$encoder.htmlEncode( $comment )</option>
 
110
                        #end
 
111
                        </select>
 
112
                        <input id="value[$dataElement.id].comment" type="text" value="$!encoder.htmlEncode( $dataValue.comment )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveComment" ))
 
113
                            onblur="commentLeft( $dataElement.id )" #else disabled="disabled" #end style="width:100% #if( !$dataValue.comment || $standardComments.contains( $dataValue.comment )) ;display:none #end">
 
114
                </td>
 
115
                <!--<td><span id="value[$dataElement.id].timestamp">#if( $dataValue.timestamp ) $format.formatDateTime( $dataValue.timestamp ) #end</span></td>-->
 
116
                <!--<td><span id="value[$dataElement.id].storedBy">$!encoder.htmlEncode( $dataValue.storedBy )</span></td>-->
 
117
        </tr>
 
118
        #set( $tabIndex = $tabIndex + 1 )
 
119
#end
 
120
</table>
 
 
b'\\ No newline at end of file'