Changeset 9251


Ignore:
Timestamp:
Jun 10, 2011, 5:22:01 PM (13 years ago)
Author:
dennisw
Message:

Datepicker works. Next, will link it to user/dataset and fix some minor things.

Location:
src/django_gheat/website
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/django_gheat/website/static/heatmap_extensions.js

    r9246 r9251  
    4444//    enc = $('#select_enc option:selected').text();
    4545//    date = $('#select_date option:selected').text();
     46    start_date = $('#start_date').val();
     47    end_date = $('#end_date').val();
    4648    colour = encodeURIComponent(document.getElementById("colour").value);
    4749    lname = encodeURIComponent(document.getElementById("lname").value);
     
    5658//    if (enc != ''){enc='&accespoint__encryptie='+enc;}
    5759//    if (date != ''){date='&meetrondje__datum='+date;}
    58     if (colour != ''){colour='colour='+colour;}
     60    if (start_date && end_date){
     61      sd_d=start_date.substr(0,2);
     62      sd_m=start_date.substr(3,2);
     63      sd_y=start_date.substr(6,4);
     64
     65      ed_d=end_date.substr(0,2);
     66      ed_m=end_date.substr(3,2);
     67      ed_y=end_date.substr(6,4);
     68
     69      start_date='&meetrondje__datum__gte=' + sd_y +'-'+ sd_m +'-'+ sd_d;
     70      end_date='&meetrondje__datum__lte=' + ed_y +'-'+ ed_m +'-'+ ed_d;
     71    }
     72
     73
     74    if (colour != 'NaN,NaN,NaN'){colour='colour='+colour;}
    5975    else {colour = '&colour='+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256)+','+Math.floor(Math.random()*256);}
    6076    if (lname != ''){lname=lname;}
     
    6682      initialize: function(name, options) {
    6783        var url = [
    68           baseurl + colour + user + dataset + wlnode /* + enc + date */
     84          baseurl + colour + user + dataset + wlnode + start_date + end_date /* + enc */
    6985        ];
    7086        document.getElementById('filter_text').innerHTML+="<br />Added: " + url;
  • src/django_gheat/website/templates/home.html

    r9249 r9251  
    33  <link href="{{ STATIC_URL }}style.css" rel="stylesheet" type="text/css" media="screen" />
    44  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}jquery-1.6.1.min.js"></script>
    5 <!--
     5
    66  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenLayers.js"></script>
    77  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}OpenStreetMap.js"></script>
    88  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap.js"></script>
    9 -->
     9
    1010  <script type="text/javascript" language="javascript" src="{{ STATIC_URL }}jquery.chained.js"></script>
    1111  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}heatmap_extensions.js"></script>
    1212  <script type="text/javascript" language="Javascript" src="{{ STATIC_URL }}colorpicker.js"></script>
    1313
    14 <!-- jquery UI datapicker -->
    15 <link type="text/css" href="{{ STATIC_URL }}jquery-ui-1.8.13.custom.css" rel="Stylesheet" />   
    16 <script type="text/javascript" src="{{ STATIC_URL }}jquery-ui-1.8.13.custom.min.js"></script>
     14  <!-- jquery UI datapicker -->
     15  <link type="text/css" href="{{ STATIC_URL }}jquery-ui-1.8.13.custom.css" rel="Stylesheet" /> 
     16  <script type="text/javascript" src="{{ STATIC_URL }}jquery-ui-1.8.13.custom.min.js"></script>
    1717
    1818
    1919  <script language="javascript" type="text/javascript">
    2020    $(function(){
    21       // enable colorpicker
    2221      $('#colour').colorPicker();
    23       $('#start_date').datepicker();
    24       $('#end_date').datepicker();
     22      $('#start_date, #end_date').datepicker({
     23        dateFormat: 'dd/mm/yy',
     24        beforeShow: setEnd,
     25      });
     26
     27      function setEnd(element){
     28        if (element.id=='end_date'){
     29          var start_date = new Date($('#start_date').val());
     30          start_date.setDate(start_date.getDate())
     31          return {
     32            minDate: start_date
     33          };
     34        }
     35      return {}
     36      }
     37
     38      $('#start_date').change(function(){
     39        $('#end_date').val('').text('');
     40      });
    2541
    2642      $('#menu_filter').click(function(){
Note: See TracChangeset for help on using the changeset viewer.