Commit dbfa2f03 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

kml save with error codes

parent 89aabfd0
...@@ -100,35 +100,35 @@ function parse_list(res){ ...@@ -100,35 +100,35 @@ function parse_list(res){
//row.append("<td class='acell' valign='top'><div>"+vlist+"</div></td>"); //row.append("<td class='acell' valign='top'><div>"+vlist+"</div></td>");
row.attr("index",index); row.attr("index",index);
row.attr("vlist",vlist);
register_row_events(row); register_row_events(row);
$("#model_table").append(row); $("#model_table").append(row);
//place markers //place markers
var subindex = 0;
$(this).find("Camera").each(function(){ $(this).find("Camera").each(function(){
var lat = $(this).find("latitude").text(); var lat = $(this).find("latitude").text();
var lng = $(this).find("longitude").text(); var lng = $(this).find("longitude").text();
if (markers[lat+lng]==undefined){ var marker = L.marker([lat, lng]).addTo(map);
marker.bindPopup(name+": "+vlist,{
direction:"top",
});
marker.index = index;
var marker = L.marker([lat, lng]).addTo(map); marker.on('click',function(){
marker.bindPopup(name+": "+vlist,{ //console.log("clicked"+this.index);
direction:"top", $(".arow[index="+this.index+"]").click();
}); });
markers[lat+lng] = marker;
}else{
console.log(markers[lat+lng]);
var content = markers[lat+lng]._popup.getContent();
markers[lat+lng]._popup.setContent(content+"<br/>"+name+": "+vlist);
if (markers[index]==undefined) {
markers[index] = [];
} }
markers[index][subindex] = marker;
subindex++;
}); });
...@@ -152,6 +152,8 @@ function register_row_events(elem){ ...@@ -152,6 +152,8 @@ function register_row_events(elem){
}); });
var index = $(this).attr("index"); var index = $(this).attr("index");
var vlist = $(this).attr("vlist");
var name = $(this).find("td").attr("title");
var list = $(List).find("model"); var list = $(List).find("model");
var item = list[index]; var item = list[index];
...@@ -160,8 +162,9 @@ function register_row_events(elem){ ...@@ -160,8 +162,9 @@ function register_row_events(elem){
map.panTo(new L.LatLng(lat, lng)); map.panTo(new L.LatLng(lat, lng));
if (markers[lat+lng]!=undefined){ if (markers[index]!=undefined){
markers[lat+lng].openPopup(); markers[index][0]._popup.setContent(name+": "+vlist);
markers[index][0].openPopup();
} }
} }
......
...@@ -226,7 +226,7 @@ function light_init(){ ...@@ -226,7 +226,7 @@ function light_init(){
function reset_to_initial_position(){ function reset_to_initial_position(){
$.ajax({ $.ajax({
url: SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.path+".kml", url: SETTINGS.files.kml+"?"+Date.now(),
success: function(response){ success: function(response){
var longitude = parseFloat($(response).find("Camera").find("longitude").text()); var longitude = parseFloat($(response).find("Camera").find("longitude").text());
......
...@@ -43,8 +43,13 @@ if (substr($target_filename,-4,4)!=".kml"){ ...@@ -43,8 +43,13 @@ if (substr($target_filename,-4,4)!=".kml"){
if (!is_file($target_filename)){ if (!is_file($target_filename)){
die("-2"); die("-2");
} }
if(!is_writable($target_filename)){
die("-3");
}
} }
$target_xml = simplexml_load_file($target_filename); $target_xml = simplexml_load_file($target_filename);
$changes_xml = simplexml_load_file('php://input'); $changes_xml = simplexml_load_file('php://input');
...@@ -92,6 +97,6 @@ foreach ($new_PhotoOverlay as $new_node) { ...@@ -92,6 +97,6 @@ foreach ($new_PhotoOverlay as $new_node) {
file_put_contents($target_filename, $target_xml->asXML()); file_put_contents($target_filename, $target_xml->asXML());
echo "ok"; die("0");
?> ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment