Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x3domlet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Elphel
x3domlet
Commits
c13fa0c8
Commit
c13fa0c8
authored
Jul 16, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added groups for linking
parent
97c7374b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
41 deletions
+93
-41
download.php
download.php
+1
-5
index.js
js/index.js
+26
-6
ui_init.js
js/ui_init.js
+9
-7
list.php
list.php
+57
-23
No files found.
download.php
View file @
c13fa0c8
...
@@ -34,11 +34,7 @@ $path = $pathinfo['dirname'];
...
@@ -34,11 +34,7 @@ $path = $pathinfo['dirname'];
$tmp
=
explode
(
"/"
,
$path
);
$tmp
=
explode
(
"/"
,
$path
);
if
(
$tmp
[
1
]
==
"_all"
){
$zipfile
=
(
array_slice
(
$tmp
,
-
2
)[
0
])
.
"_"
.
(
array_slice
(
$tmp
,
-
1
)[
0
])
.
".zip"
;
$zipfile
=
$tmp
[
2
]
.
"_"
.
$tmp
[
3
]
.
".zip"
;
}
else
{
$zipfile
=
$tmp
[
1
]
.
"_"
.
$tmp
[
2
]
.
".zip"
;
}
// alright, there's this file
// alright, there's this file
$contents
=
file_get_contents
(
$file
);
$contents
=
file_get_contents
(
$file
);
...
...
js/index.js
View file @
c13fa0c8
...
@@ -160,15 +160,33 @@ function update_links(){
...
@@ -160,15 +160,33 @@ function update_links(){
$
(
List
).
find
(
'model[name="'
+
$
(
arow
).
attr
(
"title"
)
+
'"]'
).
each
(
function
(){
$
(
List
).
find
(
'model[name="'
+
$
(
arow
).
attr
(
"title"
)
+
'"]'
).
each
(
function
(){
var
name
=
$
(
this
).
attr
(
"name"
);
var
name
=
$
(
this
).
attr
(
"name"
);
var
group
=
$
(
this
).
attr
(
"group"
);
var
vlist
=
""
;
var
vlist
=
""
;
$
(
this
).
find
(
"version"
).
each
(
function
(
i
,
v
){
$
(
this
).
find
(
"version"
).
each
(
function
(
i
,
v
){
var
comments
=
$
(
this
).
find
(
"comments"
).
text
();
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
center
=
map
.
getCenter
();
var
zoom
=
map
.
getZoom
();
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>, "
;
var
link
=
"<a title='"
+
comments
+
"' href='"
+
link_url
+
"'>"
+
$
(
this
).
attr
(
"name"
)
+
"</a>, "
;
vlist
+=
link
;
vlist
+=
link
;
});
});
...
@@ -192,10 +210,11 @@ function parse_list(res){
...
@@ -192,10 +210,11 @@ function parse_list(res){
var
row
=
$
(
"<tr class='arow'>"
);
var
row
=
$
(
"<tr class='arow'>"
);
var
name
=
$
(
this
).
attr
(
"name"
);
var
name
=
$
(
this
).
attr
(
"name"
);
var
group
=
$
(
this
).
attr
(
"group"
);
var
thumb
=
$
(
this
).
attr
(
"thumb"
);
var
thumb
=
$
(
this
).
attr
(
"thumb"
);
if
(
thumb
.
length
!=
""
){
if
(
thumb
.
length
!=
""
){
srcpath
=
SETTINGS
.
basepath
+
"/"
+
name
+
"/thumb.jpeg"
;
srcpath
=
SETTINGS
.
basepath
+
"/"
+
group
+
"/"
+
name
+
"/thumb.jpeg"
;
}
else
{
}
else
{
srcpath
=
"js/images/thumb_na.jpeg"
;
srcpath
=
"js/images/thumb_na.jpeg"
;
}
}
...
@@ -249,6 +268,7 @@ function parse_list(res){
...
@@ -249,6 +268,7 @@ function parse_list(res){
marker
.
index
=
index
;
marker
.
index
=
index
;
marker
.
name
=
name
;
marker
.
name
=
name
;
marker
.
group
=
group
;
marker
.
vlist
=
vlist
;
marker
.
vlist
=
vlist
;
marker
.
lat
=
lat
;
marker
.
lat
=
lat
;
marker
.
lng
=
lng
;
marker
.
lng
=
lng
;
...
@@ -275,7 +295,7 @@ function parse_list(res){
...
@@ -275,7 +295,7 @@ function parse_list(res){
function
popup_message
(
marker
){
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
){
markers
.
forEach
(
function
(
c
,
i
){
if
(
marker
[
0
].
lat
==
c
[
0
].
lat
){
if
(
marker
[
0
].
lat
==
c
[
0
].
lat
){
...
@@ -367,7 +387,7 @@ function register_row_events(elem){
...
@@ -367,7 +387,7 @@ function register_row_events(elem){
});
});
var
j
=
$
(
this
).
attr
(
"index"
);
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"
);
});
});
...
...
js/ui_init.js
View file @
c13fa0c8
...
@@ -63,6 +63,7 @@ var SETTINGS = {
...
@@ -63,6 +63,7 @@ var SETTINGS = {
'markercolor'
:
"#1f1"
,
'markercolor'
:
"#1f1"
,
'slidingdrag'
:
true
,
'slidingdrag'
:
true
,
'basepath'
:
"models"
,
'basepath'
:
"models"
,
'group'
:
""
,
'path'
:
"1487451413_967079"
,
'path'
:
"1487451413_967079"
,
'version'
:
""
,
'version'
:
""
,
'experimental'
:
false
,
'experimental'
:
false
,
...
@@ -128,6 +129,7 @@ function parseURL(){
...
@@ -128,6 +129,7 @@ function parseURL(){
case
"shiftspeed"
:
SETTINGS
.
shiftspeed
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"shiftspeed"
:
SETTINGS
.
shiftspeed
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"markersize"
:
SETTINGS
.
markersize
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"markersize"
:
SETTINGS
.
markersize
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
case
"basepath"
:
SETTINGS
.
basepath
=
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
"path"
:
SETTINGS
.
path
=
parameters
[
i
][
1
];
break
;
case
"ver"
:
SETTINGS
.
version
=
parameters
[
i
][
1
];
break
;
case
"ver"
:
SETTINGS
.
version
=
parameters
[
i
][
1
];
break
;
...
@@ -149,9 +151,9 @@ $(function(){
...
@@ -149,9 +151,9 @@ $(function(){
parseURL
();
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
// 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
();
title_init
();
help_init
();
help_init
();
...
@@ -180,9 +182,9 @@ function title_init(){
...
@@ -180,9 +182,9 @@ function title_init(){
$("body").append(html);
$("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"});
//$("#lpl").attr("href",title_url).css({color:"white"});
...
@@ -229,7 +231,7 @@ function background_init(){
...
@@ -229,7 +231,7 @@ function background_init(){
if
(
mback
.
length
>
0
){
if
(
mback
.
length
>
0
){
frontUrl
=
mback
.
attr
(
'frontUrl'
);
frontUrl
=
mback
.
attr
(
'frontUrl'
);
if
(
frontUrl
.
length
!=
0
){
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(){
...
@@ -294,10 +296,10 @@ function light_init(){
// get master kml file if possible
// get master kml file if possible
$
.
ajax
({
$
.
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
){
success
:
function
(
response
){
if
(
response
!=
"-1"
){
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
// ready to read kml files
...
...
list.php
View file @
c13fa0c8
...
@@ -27,6 +27,7 @@ if (isset($_GET['showall'])){
...
@@ -27,6 +27,7 @@ if (isset($_GET['showall'])){
}
}
$models
=
selective_scandir
(
$base
,
false
,
$rating
);
$models
=
selective_scandir
(
$base
,
false
,
$rating
);
$res
=
""
;
$res
=
""
;
foreach
(
$models
as
$model
){
foreach
(
$models
as
$model
){
...
@@ -34,41 +35,72 @@ foreach($models as $model){
...
@@ -34,41 +35,72 @@ foreach($models as $model){
$model_path
=
"
$base
/
$model
"
;
$model_path
=
"
$base
/
$model
"
;
$thumb
=
"
$model_path
/
$THUMBNAME
"
;
$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
(
$model_rating
>=
$rating
){
if
(
!
(
$f1
||
$f2
||
$f3
)
){
$versions
=
selective_scandir
(
$model_path
,
$showall
,
0
);
$group_path
=
selective_scandir
(
$model_path
,
false
,
$rating
);
foreach
(
$group_path
as
$group_item
){
$model_path
=
"
$base
/
$model
/
$group_item
"
;
$thumb
=
"
$model_path
/
$THUMBNAME
"
;
// create thumb
$model_rating
=
get_model_rating
(
"
$model_path
/
$RATINGFILE
"
);
create_thumbnail
(
$model_path
,
$versions
,
$thumb
);
if
(
$model_rating
>=
$rating
){
if
(
!
is_file
(
$thumb
)){
$versions
=
selective_scandir
(
$model_path
,
$showall
,
0
);
$thumb
=
""
;
// create thumb
}
create_thumbnail
(
$model_path
,
$versions
,
$thumb
);
$res
.=
"<model name='
$model
' thumb='
$thumb
'>
\n
"
;
if
(
!
is_file
(
$thumb
)){
$thumb
=
""
;}
// read kml
$res
.=
"<model name='
$group_item
' group='
$model
' thumb='
$thumb
'>
\n
"
;
$res
.=
"
\t
<map>
\n
"
.
parse_kml
(
"
$base
/
$model
/
$model
.kml"
)
.
"
\t
</map>
\n
"
;
// read kml
$res
.=
"
\t
<map>
\n
"
.
parse_kml
(
"
$model_path
/
$group_item
.kml"
)
.
"
\t
</map>
\n
"
;
foreach
(
$versions
as
$version
){
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
"
;
}
$res
.=
"
\t
<version name='
$version
'>
\n
"
;
}
$comments
=
"-"
;
}
else
{
$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
"
;
$model_rating
=
get_model_rating
(
"
$model_path
/
$RATINGFILE
"
);
if
(
$model_rating
>=
$rating
){
$res
.=
"
\t
</version>
\n
"
;
$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
.=
"</model>
\n
"
;
$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){
...
@@ -83,12 +115,14 @@ function selective_scandir($path,$showall,$rating=5){
$results
=
Array
();
$results
=
Array
();
$contents
=
scandir
(
$path
);
$contents
=
scandir
(
$path
);
$contents
=
array_diff
(
$contents
,
[
"."
,
".."
]);
foreach
(
$contents
as
$item
){
foreach
(
$contents
as
$item
){
if
(
$item
!=
'.'
&&
$item
!=
'..'
&&
$item
!=
"jp4"
&&
is_dir
(
"
$path
/
$item
"
)){
if
(
$item
!=
"jp4"
&&
is_dir
(
"
$path
/
$item
"
)){
if
(
$showall
){
if
(
$showall
){
array_push
(
$results
,
$item
);
array_push
(
$results
,
$item
);
}
else
{
}
else
{
// hidden directories
if
((
$item
[
0
]
!=
"."
)
&&
(
$item
[
0
]
!=
"_"
)){
if
((
$item
[
0
]
!=
"."
)
&&
(
$item
[
0
]
!=
"_"
)){
array_push
(
$results
,
$item
);
array_push
(
$results
,
$item
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment