~dongpo-deng/sahana-eden/test

« back to all changes in this revision

Viewing changes to views/gis/feature_layer_create.html

  • Committer: Deng Dongpo
  • Date: 2010-08-01 09:29:44 UTC
  • Revision ID: dongpo@dhcp-21193.iis.sinica.edu.tw-20100801092944-8t9obt4xtl7otesb
initial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{{extend "layout.html"}}
 
2
{{include "gis/catalogue_toolbar.html"}}
 
3
{{form[0].insert(-3, TR(TD(LABEL(T("Advanced:"))), INPUT(_name="advanced", _type="checkbox", _value="on", _id="advanced", _class="boolean")))}}
 
4
{{include "_create.html"}}
 
5
<script type="text/javascript">//<![CDATA[
 
6
$(function() {
 
7
    var advanced;
 
8
    var resource;
 
9
    var url;
 
10
    var options = '';
 
11
    // Hide the query row unless user clicks 'Advanced'
 
12
    $('#gis_feature_layer_query__row').hide();
 
13
    // Convert the field row to a dropdown (initially empty)
 
14
    $('#gis_feature_layer_filter_field').parent().html('<select id="gis_feature_layer_filter_field" name="filter_field"></select>');
 
15
    // When the checkbox changes:
 
16
        $('#advanced').change(function() {
 
17
                // What is the new value?
 
18
        advanced = $(this).attr('checked');
 
19
        if (advanced) {
 
20
            // Display the query row
 
21
            $("#gis_feature_layer_query__row").show();
 
22
            // Hide the simple rows
 
23
            $("#gis_feature_layer_resource__row").hide();
 
24
            $("#gis_feature_layer_filter_field__row").hide();
 
25
            $("#gis_feature_layer_filter_value__row").hide();
 
26
        } else {
 
27
            // Hide the query row again
 
28
            $("#gis_feature_layer_query__row").hide();
 
29
            // Show the simple rows
 
30
            $("#gis_feature_layer_resource__row").show();
 
31
            $("#gis_feature_layer_filter_field__row").show();
 
32
            $("#gis_feature_layer_filter_value__row").show();
 
33
        }
 
34
        })
 
35
    // @ToDo: Populate the list of fields from server when the resource changes
 
36
    $('#gis_feature_layer_resource').change(function() {
 
37
        resource = $(this).val();
 
38
        url = '{{=URL3(r=request)}}' + '/' + resource + '/fields.json';
 
39
        $.getS3(
 
40
                url,
 
41
                function(data) {
 
42
                    //for(key in data) {
 
43
                    //    options += '<option value="' + data[key] + '">' + data[key] + '</option>';
 
44
                    //}
 
45
                    //$('#gis_feature_layer_filter_field').html(options);
 
46
                }
 
47
            );
 
48
    });
 
49
});
 
50
//]]></script>
 
 
b'\\ No newline at end of file'