<commit_before><?php
if(!isset($_COOKIE['travelcounsellorid'])){
	echo "<li>no entry because of no cookie</li>";	
	return 0;
}
	      
	$cookieId = $_COOKIE['travelcounsellorid'];

	include 'db_connect.php';


	$sql = "SELECT * FROM my_route WHERE cookie_id = '$cookieId'";
		

?>

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
	<script src="js/jquery-sortable.js" type="text/javascript"></script>
    <title>Waypoints in directions</title>
    <style>
      #right-panel {
        font-family: 'Roboto','sans-serif';
        line-height: 30px;
        padding-left: 10px;
      }

      #right-panel select, #right-panel input {
        font-size: 15px;
      }

      #right-panel select {
        width: 100%;
      }

      #right-panel i {
        font-size: 12px;
      }
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
        float: left;
        width: 70%;
        height: 100%;
      }
      #right-panel {
        margin: 20px;
        border-width: 2px;
        width: 20%;
        height: 400px;
        float: left;
        text-align: left;
        padding-top: 0;
      }
      #directions-panel {
        margin-top: 10px;
        background-color: #ffffff;
        padding: 10px;
      }

      //code for list:
      body.dragging, body.dragging * {
    		cursor: move !important;
    	}

    	.dragged {
    		position: absolute;
    		opacity: 0.5;
    		z-index: 2000;
    	}

    	ol.example li.placeholder {
    		position: relative;
    		/** More li styles **/
    	}

    	ol.example li.placeholder:before {
      	position: absolute;
      	/** Define arrowhead **/
    	}
    </style>
  </head>
  <body>
    <div id="map"></div>
    <div id="right-panel">
      <style>
        body {
          margin: 0;
          background-color: #e0e0e0;
        }
      	li{
      		cursor:url(https://maps.gstatic.com/mapfiles/openhand_8_8.cur) 8 8, default;
      		border:solid #000 thin;
          background-color: #ffffff;
      	}
  	  </style>
      <ol class='locations'>
			 
<?php

	if ($result = $conn->query($sql)) {
  
    		$row_cnt = $result->num_rows;
    		if($row_cnt < 1) {
      			echo "<li>no results</li>";
      			return 1; 
    		}
	
	 while ($row = $result->fetch_assoc()) {
		//echo "<li>" . $row['street'] . " (" . $row['name'] . ")" . "</li>";
		 echo "<li value='test'>" . $row['street'] . "</li>";
			 
	 }
			
	}
	//$result->free();
	$conn->close();
	


?>

	      
  					
			
  		</ol>
      <input type="submit" id="submit" value="Recalculate">
      <div id="directions-panel"></div>
    </div>
    <script>
      function initMap() {
        var directionsService = new google.maps.DirectionsService;
        var directionsDisplay = new google.maps.DirectionsRenderer;
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 7,
          center: {lat: 47.85, lng: 11.65}
        });
        directionsDisplay.setMap(map);

        document.getElementById('submit').addEventListener('click', function() {
          calculateAndDisplayRoute(directionsService, directionsDisplay);
        });
      }

      function calculateAndDisplayRoute(directionsService, directionsDisplay) {
        var waypts = [];
		    for($i = 1; $i<$(".locations").children().length -1; $i++)
        	waypts.push({location: $(".locations").children()[$i].innerHTML,stopover:true});
        var checkboxArray = document.getElementById('waypoints');
        //for (var i = 0; i < checkboxArray.length; i++) {
        //  if (checkboxArray.options[i].selected) {
        //   waypts.push({
        //      location: checkboxArray[i].value,
        //      stopover: true
        //    });
        //  }
        //}

        directionsService.route({
          origin: $(".locations").children()[0].innerHTML,
          destination: $(".locations").children()[$(".locations").children().length-1].innerHTML,
          waypoints: waypts,
          optimizeWaypoints: false,
          travelMode: 'DRIVING'
        }, function(response, status) {
          if (status === 'OK') {
            directionsDisplay.setDirections(response);
            var route = response.routes[0];
            var summaryPanel = document.getElementById('directions-panel');
            summaryPanel.innerHTML = '';
            // For each route, display summary information.
            for (var i = 0; i < route.legs.length; i++) {
              var routeSegment = i + 1;
              summaryPanel.innerHTML += '<b>Route Segment: ' + routeSegment +
                  '</b><br>';
              summaryPanel.innerHTML += route.legs[i].start_address + ' to ';
              summaryPanel.innerHTML += route.legs[i].end_address + '<br>';
              summaryPanel.innerHTML += route.legs[i].distance.text + '<br><br>';
            }
          } else {
            window.alert('Directions request failed due to ' + status);
          }
        });
      }
    </script>

    <script>
		$(function () {
			$("ol.locations").sortable();
		});
		</script>

    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBxybL6xNd3g83vICS49hg5eyU9z-eGW0E&callback=initMap">
    </script>
  </body>
</html>
<commit_msg>Update maps.php<commit_after><?php
if(!isset($_COOKIE['travelcounsellorid'])){
	echo "<li>no entry because of no cookie</li>";	
	return 0;
}
	      
	$cookieId = $_COOKIE['travelcounsellorid'];

	include 'db_connect.php';


	$sql = "SELECT * FROM my_route WHERE cookie_id = '$cookieId'";
		

?>

<!DOCTYPE html>
<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
	<script src="../js/jquery-sortable.js" type="text/javascript"></script>
    <title>Waypoints in directions</title>
    <style>
      #right-panel {
        font-family: 'Roboto','sans-serif';
        line-height: 30px;
        padding-left: 10px;
      }

      #right-panel select, #right-panel input {
        font-size: 15px;
      }

      #right-panel select {
        width: 100%;
      }

      #right-panel i {
        font-size: 12px;
      }
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
        float: left;
        width: 70%;
        height: 100%;
      }
      #right-panel {
        margin: 20px;
        border-width: 2px;
        width: 20%;
        height: 400px;
        float: left;
        text-align: left;
        padding-top: 0;
      }
      #directions-panel {
        margin-top: 10px;
        background-color: #ffffff;
        padding: 10px;
      }

      //code for list:
      body.dragging, body.dragging * {
    		cursor: move !important;
    	}

    	.dragged {
    		position: absolute;
    		opacity: 0.5;
    		z-index: 2000;
    	}

    	ol.example li.placeholder {
    		position: relative;
    		/** More li styles **/
    	}

    	ol.example li.placeholder:before {
      	position: absolute;
      	/** Define arrowhead **/
    	}
    </style>
  </head>
  <body>
    <div id="map"></div>
    <div id="right-panel">
      <style>
        body {
          margin: 0;
          background-color: #e0e0e0;
        }
      	li{
      		cursor:url(https://maps.gstatic.com/mapfiles/openhand_8_8.cur) 8 8, default;
      		border:solid #000 thin;
          background-color: #ffffff;
      	}
  	  </style>
      <ol class='locations'>
			 
<?php

	if ($result = $conn->query($sql)) {
  
    		$row_cnt = $result->num_rows;
    		if($row_cnt < 1) {
      			echo "<li>no results</li>";
      			return 1; 
    		}
	
	 while ($row = $result->fetch_assoc()) {
		//echo "<li>" . $row['street'] . " (" . $row['name'] . ")" . "</li>";
		 echo "<li value='test'>" . $row['street'] . "</li>";
			 
	 }
			
	}
	//$result->free();
	$conn->close();
	


?>

	      
  					
			
  		</ol>
      <input type="submit" id="submit" value="Recalculate">
      <div id="directions-panel"></div>
    </div>
    <script>
      function initMap() {
        var directionsService = new google.maps.DirectionsService;
        var directionsDisplay = new google.maps.DirectionsRenderer;
        var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 7,
          center: {lat: 47.85, lng: 11.65}
        });
        directionsDisplay.setMap(map);

        document.getElementById('submit').addEventListener('click', function() {
          calculateAndDisplayRoute(directionsService, directionsDisplay);
        });
      }

      function calculateAndDisplayRoute(directionsService, directionsDisplay) {
        var waypts = [];
		    for($i = 1; $i<$(".locations").children().length -1; $i++)
        	waypts.push({location: $(".locations").children()[$i].innerHTML,stopover:true});
        var checkboxArray = document.getElementById('waypoints');
        //for (var i = 0; i < checkboxArray.length; i++) {
        //  if (checkboxArray.options[i].selected) {
        //   waypts.push({
        //      location: checkboxArray[i].value,
        //      stopover: true
        //    });
        //  }
        //}

        directionsService.route({
          origin: $(".locations").children()[0].innerHTML,
          destination: $(".locations").children()[$(".locations").children().length-1].innerHTML,
          waypoints: waypts,
          optimizeWaypoints: false,
          travelMode: 'DRIVING'
        }, function(response, status) {
          if (status === 'OK') {
            directionsDisplay.setDirections(response);
            var route = response.routes[0];
            var summaryPanel = document.getElementById('directions-panel');
            summaryPanel.innerHTML = '';
            // For each route, display summary information.
            for (var i = 0; i < route.legs.length; i++) {
              var routeSegment = i + 1;
              summaryPanel.innerHTML += '<b>Route Segment: ' + routeSegment +
                  '</b><br>';
              summaryPanel.innerHTML += route.legs[i].start_address + ' to ';
              summaryPanel.innerHTML += route.legs[i].end_address + '<br>';
              summaryPanel.innerHTML += route.legs[i].distance.text + '<br><br>';
            }
          } else {
            window.alert('Directions request failed due to ' + status);
          }
        });
      }
    </script>

    <script>
		$(function () {
			$("ol.locations").sortable();
		});
		</script>

    <script async defer
    src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBxybL6xNd3g83vICS49hg5eyU9z-eGW0E&callback=initMap">
    </script>
  </body>
</html>

{'fraction_non_alphanumeric': 0.16075867783813644, 'fraction_numerical': 0.016388914464598104, 'mean_word_length': 1.9564507348938487, 'pattern_counts': {'":': 0, '<': 111, '<?xml version=': 0, '>': 113, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6383725', 'n_tokens_mistral': 3708, 'n_tokens_neox': 3407, 'n_words': 643}