Commit c13fa0c8 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

added groups for linking

parent 97c7374b
......@@ -34,11 +34,7 @@ $path = $pathinfo['dirname'];
$tmp = explode("/",$path);
if ($tmp[1]=="_all"){
$zipfile = $tmp[2]."_".$tmp[3].".zip";
}else{
$zipfile = $tmp[1]."_".$tmp[2].".zip";
}
$zipfile = (array_slice($tmp,-2)[0])."_".(array_slice($tmp,-1)[0]).".zip";
// alright, there's this file
$contents = file_get_contents($file);
......
......@@ -160,15 +160,33 @@ function update_links(){
$(List).find('model[name="'+$(arow).attr("title")+'"]').each(function(){
var name = $(this).attr("name");
var group = $(this).attr("group");
var vlist = "";
$(this).find("version").each(function(i,v){
var comments = $(this).find("comments").text();
var link_url = "viewer.html?path="+name+"&ver="+$(this).attr("name")+"&rating="+SETTINGS.rating;
link_url += "&basepath="+SETTINGS.basepath;
var center = map.getCenter();
var zoom = map.getZoom();
link_url += "&lat="+center.lat.toFixed(8)+"&lng="+center.lng.toFixed(8)+"&zoom="+zoom;
//var link_url = "viewer.html?path="+name+"&ver="+$(this).attr("name")+"&rating="+SETTINGS.rating;
//link_url += "&basepath="+SETTINGS.basepath;
//link_url += "&lat="+center.lat.toFixed(8)+"&lng="+center.lng.toFixed(8)+"&zoom="+zoom;
var link_url = [
"viewer.html",
"?basepath="+SETTINGS.basepath,
"&group="+group,
"&path="+name,
"&ver="+$(this).attr("name"),
"&rating="+SETTINGS.rating,
"&lat="+center.lat.toFixed(8),
"&lng="+center.lng.toFixed(8),
"&zoom="+zoom
].join("");
var link = "<a title='"+comments+"' href='"+link_url+"'>"+$(this).attr("name")+"</a>,&nbsp;";
vlist += link;
});
......@@ -192,10 +210,11 @@ function parse_list(res){
var row = $("<tr class='arow'>");
var name = $(this).attr("name");
var group = $(this).attr("group");
var thumb = $(this).attr("thumb");
if (thumb.length!=""){
srcpath = SETTINGS.basepath+"/"+name+"/thumb.jpeg";
srcpath = SETTINGS.basepath+"/"+group+"/"+name+"/thumb.jpeg";
}else{
srcpath ="js/images/thumb_na.jpeg";
}
......@@ -249,6 +268,7 @@ function parse_list(res){
marker.index = index;
marker.name = name;
marker.group = group;
marker.vlist = vlist;
marker.lat = lat;
marker.lng = lng;
......@@ -275,7 +295,7 @@ function parse_list(res){
function popup_message(marker){
var msg = "<div><img class='pimg' alt='n/a' src='"+SETTINGS.basepath+"/"+marker[0].name+"/thumb.jpeg' index='"+marker[0].index+"' ></img></div>";
var msg = "<div><img class='pimg' alt='n/a' src='"+SETTINGS.basepath+"/"+marker[0].group+"/"+marker[0].name+"/thumb.jpeg' index='"+marker[0].index+"' ></img></div>";
markers.forEach(function(c,i){
if (marker[0].lat==c[0].lat){
......@@ -367,7 +387,7 @@ function register_row_events(elem){
});
var j = $(this).attr("index");
$(".pimg").attr("src",SETTINGS.basepath+"/"+markers[j][0].name+"/thumb.jpeg");
$(".pimg").attr("src",SETTINGS.basepath+"/"+markers[j][0].group+"/"+markers[j][0].name+"/thumb.jpeg");
});
......
......@@ -63,6 +63,7 @@ var SETTINGS = {
'markercolor': "#1f1",
'slidingdrag': true,
'basepath': "models",
'group':"",
'path' : "1487451413_967079",
'version': "",
'experimental': false,
......@@ -128,6 +129,7 @@ function parseURL(){
case "shiftspeed": SETTINGS.shiftspeed = parseFloat(parameters[i][1]); break;
case "markersize": SETTINGS.markersize = parseFloat(parameters[i][1]); break;
case "basepath": SETTINGS.basepath = parameters[i][1]; break;
case "group": SETTINGS.group = parameters[i][1]; break;
case "path": SETTINGS.path = parameters[i][1]; break;
case "ver": SETTINGS.version = parameters[i][1]; break;
......@@ -149,9 +151,9 @@ $(function(){
parseURL();
SETTINGS.files.x3d = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path+".x3d";
SETTINGS.files.x3d = SETTINGS.basepath+"/"+SETTINGS.group+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path+".x3d";
// always reload kml
SETTINGS.files.kml = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.path+".kml";
SETTINGS.files.kml = SETTINGS.basepath+"/"+SETTINGS.group+"/"+SETTINGS.path+"/"+SETTINGS.path+".kml";
title_init();
help_init();
......@@ -180,9 +182,9 @@ function title_init(){
$("body").append(html);
*/
var title_url = "playloop.php?interval=200&sufx=D0.0.jpeg&path="+SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path;
var title_url = "playloop.php?interval=200&sufx=D0.0.jpeg&path="+SETTINGS.basepath+"/"+SETTINGS.group+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+SETTINGS.path;
var db_ml_url = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/ml";
var db_ml_url = SETTINGS.basepath+"/"+SETTINGS.group+"/"+SETTINGS.path+"/"+SETTINGS.version+"/ml";
//$("#lpl").attr("href",title_url).css({color:"white"});
......@@ -229,7 +231,7 @@ function background_init(){
if (mback.length>0){
frontUrl = mback.attr('frontUrl');
if (frontUrl.length!=0){
model_back_url = SETTINGS.basepath+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+frontUrl;
model_back_url = SETTINGS.basepath+"/"+SETTINGS.group+"/"+SETTINGS.path+"/"+SETTINGS.version+"/"+frontUrl;
}
}
......@@ -294,10 +296,10 @@ function light_init(){
// get master kml file if possible
$.ajax({
url: "check_master_kml.php?path="+SETTINGS.basepath+"/"+SETTINGS.path,
url: "check_master_kml.php?path="+SETTINGS.basepath+"/"+SETTINGS.group+"/"+SETTINGS.path,
success: function(response){
if (response!="-1"){
SETTINGS.files.kml = SETTINGS.basepath+"/"+response+"/"+response+".kml";
SETTINGS.files.kml = SETTINGS.basepath+"/"+SETTINGS.group+"/"+response+"/"+response+".kml";
}
// ready to read kml files
......
......@@ -27,6 +27,7 @@ if (isset($_GET['showall'])){
}
$models = selective_scandir($base,false,$rating);
$res = "";
foreach($models as $model){
......@@ -34,41 +35,72 @@ foreach($models as $model){
$model_path = "$base/$model";
$thumb = "$model_path/$THUMBNAME";
$model_rating = get_model_rating("$model_path/$RATINGFILE");
$f1 = is_file("$model_path/$THUMBNAME");
$f2 = is_file("$model_path/$RATINGFILE");
$f3 = is_file("$model_path/$model.kml");
if (!($f1||$f2||$f3)){
$group_path = selective_scandir($model_path,false,$rating);
foreach($group_path as $group_item){
$model_path = "$base/$model/$group_item";
$thumb = "$model_path/$THUMBNAME";
$model_rating = get_model_rating("$model_path/$RATINGFILE");
if ($model_rating>=$rating){
$versions = selective_scandir($model_path,$showall,0);
// create thumb
create_thumbnail($model_path,$versions,$thumb);
if (!is_file($thumb)){
$thumb="";
}
$res .= "<model name='$model' thumb='$thumb'>\n";
if (!is_file($thumb)){$thumb="";}
$res .= "<model name='$group_item' group='$model' thumb='$thumb'>\n";
// read kml
$res .= "\t<map>\n".parse_kml("$base/$model/$model.kml")."\t</map>\n";
$res .= "\t<map>\n".parse_kml("$model_path/$group_item.kml")."\t</map>\n";
foreach($versions as $version){
$res .= "\t<version name='$version'>\n";
$comments = "-";
$readme = "$model_path/$version/$READMENAME";
if (is_file($readme)){
$comments = trim(file_get_contents($readme),"\t\n\r");
}
$res .= "\t\t<comments>$comments</comments>\n";
$res .= "\t</version>\n";
}
$res .= "</model>\n";
}
}
}else{
$model_rating = get_model_rating("$model_path/$RATINGFILE");
if ($model_rating>=$rating){
$versions = selective_scandir($model_path,$showall,0);
// create thumb
create_thumbnail($model_path,$versions,$thumb);
if (!is_file($thumb)){$thumb="";}
$res .= "<model name='$model' group='' thumb='$thumb'>\n";
// read kml
$res .= "\t<map>\n".parse_kml("$model_path/$model.kml")."\t</map>\n";
foreach($versions as $version){
$res .= "\t<version name='$version'>\n";
$comments = "-";
$readme = "$model_path/$version/$READMENAME";
if (is_file($readme)){
$comments = trim(file_get_contents($readme),"\t\n\r");
}
$res .= "\t\t<comments>$comments</comments>\n";
$res .= "\t</version>\n";
}
$res .= "</model>\n";
}
}
......@@ -83,12 +115,14 @@ function selective_scandir($path,$showall,$rating=5){
$results = Array();
$contents = scandir($path);
$contents = array_diff($contents, [".", ".."]);
foreach($contents as $item){
if ($item!='.'&&$item!='..'&&$item!="jp4"&&is_dir("$path/$item")){
if ($item!="jp4"&&is_dir("$path/$item")){
if ($showall){
array_push($results,$item);
}else{
// hidden directories
if (($item[0]!=".")&&($item[0]!="_")){
array_push($results,$item);
}
......
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