Commit 1ecdebb2 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

kml template testing

parent d77238d0
...@@ -52,13 +52,13 @@ function parse_list(res){ ...@@ -52,13 +52,13 @@ function parse_list(res){
function copy_models(){ function copy_models(){
// testing var kmldata = $('#kml')[0].files[0];
$.ajax({
url: "select.php?cmd=copy", if (kmldata!=undefined){
success: function(response){ if(kmldata.name.substr(-3)!="kml"){
console.log(response); kmldata = undefined;
}
} }
});
$(".chkbox").each(function(){ $(".chkbox").each(function(){
...@@ -66,7 +66,7 @@ function copy_models(){ ...@@ -66,7 +66,7 @@ function copy_models(){
$.ajax({ $.ajax({
url: "select.php?cmd=copy&set="+$(this).attr('set')+"&model="+$(this).attr('model'), url: "select.php?cmd=copy&set="+$(this).attr('set')+"&model="+$(this).attr('model'),
type:'post', type:'post',
data: $('#kml')[0].files[0], data: kmldata,
processData: false, processData: false,
success: function(response){ success: function(response){
console.log(response); console.log(response);
......
...@@ -12,6 +12,13 @@ if (isset($_GET['showall'])){ ...@@ -12,6 +12,13 @@ if (isset($_GET['showall'])){
if ($_GET['cmd']=='copy'){ if ($_GET['cmd']=='copy'){
$kml_template = file_get_contents('php://input'); $kml_template = file_get_contents('php://input');
if ($kml_template!=""){
if (!kml_test($kml_template)){
$kml_template = "";
}
}
die();
$set = $_GET['set']; $set = $_GET['set'];
$model = $_GET['model']; $model = $_GET['model'];
...@@ -82,6 +89,19 @@ return_xml($res); ...@@ -82,6 +89,19 @@ return_xml($res);
//functions //functions
function kml_test($data){
$result = false;
$xml = simplexml_load_string($data);
if ($xml->Document->PhotoOverlay){
$result = true;
}
return $result;
}
function selective_scandir($path,$showall){ function selective_scandir($path,$showall){
$results = Array(); $results = Array();
......
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