Commit d77238d0 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

kml template uploading

parent f781af46
div{
padding-bottom: 4px;
}
\ No newline at end of file
......@@ -52,11 +52,22 @@ function parse_list(res){
function copy_models(){
// testing
$.ajax({
url: "select.php?cmd=copy",
success: function(response){
console.log(response);
}
});
$(".chkbox").each(function(){
if ($(this).prop("checked")){
$.ajax({
url: "select.php?cmd=copy&set="+$(this).attr('set')+"&model="+$(this).attr('model'),
type:'post',
data: $('#kml')[0].files[0],
processData: false,
success: function(response){
console.log(response);
}
......
......@@ -21,6 +21,9 @@
</head>
<body>
<div>
KML template: <input id='kml' type='file' />
</div>
<div>
<button class='copy'>Copy checked to <i>models/</i></button>
</div>
......
......@@ -11,6 +11,8 @@ if (isset($_GET['showall'])){
if ($_GET['cmd']=='copy'){
$kml_template = file_get_contents('php://input');
$set = $_GET['set'];
$model = $_GET['model'];
......@@ -33,7 +35,12 @@ if ($_GET['cmd']=='copy'){
$kml = "$base0/$model/$model.kml";
if (!is_file($kml)){
file_put_contents($kml,generate_default_kml($model,$ts));
if ($kml_template==""){
$kml_data = generate_default_kml($model,$ts);
}else{
$kml_data = $kml_template;
}
file_put_contents($kml,$kml_data);
}
//gen thumbnail
......
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