22 changed files with 1611 additions and 281 deletions
-
9lib/ajax_asm.php
-
9lib/assembler.php
-
66lib/controller/addMap.php
-
440lib/controller/getGeoZones.php
-
57lib/controller/getLocationItems.php
-
134lib/controller/getLocationNodeProps.php
-
3lib/controller/getLocationNodes.php
-
49lib/controller/getMapData.php
-
47lib/controller/listMaps.php
-
1lib/controller/map_picture_upload.html
-
62lib/controller/updateLocation.php
-
44lib/controller/updateMap.php
-
38lib/javascript/jsapi_dynamic/mojo_global_vars.js
-
838lib/javascript/jsapi_dynamic/mojo_map.js
-
69lib/javascript/jsapi_dynamic/mojo_settings.js
-
9lib/js_asm.php
-
17lib/php/db/language_class.php
-
BINstyle/assets/anchor_sys-1.psd
-
BINstyle/assets/cust_map_cord_sys-0.png
-
BINstyle/assets/cust_map_cord_sys-1.png
-
BINstyle/assets/map_mode_decart.png
-
BINstyle/assets/map_mode_wgs84.png
@ -0,0 +1,66 @@ |
|||||
|
<?php |
||||
|
require_once('../ajax_asm.php'); |
||||
|
|
||||
|
function verbose( $ok=1,$info=""){ |
||||
|
// failure to upload throws 400 error
|
||||
|
if( $ok==0 ){ |
||||
|
http_response_code(400); |
||||
|
}; |
||||
|
die(json_encode(["ok"=>$ok, "info"=>$info])); |
||||
|
}; |
||||
|
if( $CUser->Data['id'] > 1 ){ |
||||
|
if( intval( $_POST['ctype'] ) == 1 ){ |
||||
|
$EURL = $DATABASE->escape($_POST['map_url']); |
||||
|
$ENAME = $DATABASE->escape($_POST['map_name']); |
||||
|
$EDESC = $DATABASE->escape($_POST['map_desc']); |
||||
|
$EATTR = $DATABASE->escape($_POST['map_attr']); |
||||
|
$IZOOM = intval( $_POST['map_maxz'] ); |
||||
|
$INZOOM = intval( $_POST['map_maxnz'] ); |
||||
|
$QS = "INSERT INTO `location_maps`(`type`,`name`,`layer_url`,`desc`,`maxNativeZoom`,`maxZoom`,`attribution`) values(1,'{$ENAME}','{$EURL}','{$EDESC}',{$INZOOM},{$IZOOM},'{$EATTR}')"; |
||||
|
$DATABASE->Query( $QS ); |
||||
|
} else { |
||||
|
if( empty( $_FILES ) || $_FILES['map_image']['error'] ){ |
||||
|
verbose( 0, "Failed to move uploaded file.[" . $_FILES['map_image']['error'] . "]" ); |
||||
|
}; |
||||
|
// upload destination
|
||||
|
//$filePath = __DIR__ . DIRECTORY_SEPARATOR . "../../vault/working_dir/uploads";
|
||||
|
$filePath = $SYSPath . 'lib/controller/data/assets/images'; |
||||
|
if( !file_exists( $filePath ) ){ |
||||
|
if (!mkdir($filePath, 0777, true)) { |
||||
|
verbose(0, "Failed to create $filePath" ); |
||||
|
}; |
||||
|
}; |
||||
|
if( file_exists( $_FILES['map_image']['tmp_name'] ) ){ |
||||
|
$MD5 = md5_file( $_FILES['map_image']['tmp_name'] ); |
||||
|
$TArr = explode( '.', $_FILES['map_image']['name'] ); |
||||
|
$EXT = $TArr[ count($TArr) - 1 ]; |
||||
|
$FNAME = $MD5 . '.' . $EXT; |
||||
|
copy( $_FILES['map_image']['tmp_name'], $filePath . '/' . $FNAME ); |
||||
|
@unlink( $_FILES['map_image']['tmp_name'] ); |
||||
|
list( $width, $height, $type, $attr ) = getimagesize( $filePath . '/' . $FNAME ); |
||||
|
$ENAME = $DATABASE->escape($_POST['map_name']); |
||||
|
$EDESC = $DATABASE->escape($_POST['map_desc']); |
||||
|
$EATTR = $DATABASE->escape($_POST['map_attr']); |
||||
|
$IZOOM = intval( $_POST['map_maxz'] ); |
||||
|
$INZOOM = intval( $_POST['map_maxz'] ); |
||||
|
$MA_WI = floatval( $_POST['map_width'] ); |
||||
|
$MA_HE = floatval( $_POST['map_height'] ); |
||||
|
$TB = intval( $_POST['map_tpb'] ); |
||||
|
$LB = intval( $_POST['map_lpb'] ); |
||||
|
$RB = intval( $_POST['map_rpb'] ); |
||||
|
$BB = intval( $_POST['map_bpb'] ); |
||||
|
$K_X = $MA_WI / ( $width - $LB - $RB ); |
||||
|
$K_Y = $MA_HE / ( $height - $TB - $BB ); |
||||
|
$IBLX = (-$LB)*$K_X; |
||||
|
$IBLY = (-$TB)*$K_Y; |
||||
|
$IBRX = ( $width + $RB ) * $K_X; |
||||
|
$IBRY = ( $height + $BB ) * $K_Y; |
||||
|
$QS = "INSERT INTO `location_maps`(`type`,`name`,`layer_url`,`desc`,`maxNativeZoom`,`maxZoom`,`attribution`,`bounds_lx`,`bounds_ly`,`bounds_rx`,`bounds_ry`) values(2,'{$ENAME}','{$FNAME}','{$EDESC}',{$INZOOM},{$IZOOM},'{$EATTR}',{$IBLX},{$IBLY},{$IBRX},{$IBRY})"; |
||||
|
$DATABASE->Query( $QS ); |
||||
|
verbose( 1, "ALL IS OK" ); |
||||
|
}; |
||||
|
}; |
||||
|
} else { |
||||
|
verbose( 0, 'Access Denied!' ); |
||||
|
}; |
||||
|
?>
|
||||
@ -0,0 +1,49 @@ |
|||||
|
<?php |
||||
|
require_once('../ajax_asm.php'); |
||||
|
$UID = intval( $CUser->Data['id'] ); |
||||
|
$ACCESS = intval( $CUser->Data['access'] ); |
||||
|
$Data = array(); |
||||
|
if( $UID > 1 ){ |
||||
|
if( isset( $_POST['MID'] ) ){ |
||||
|
$MID = intval($_POST['MID']); |
||||
|
$QS = "SELECT * FROM `location_maps` WHERE `id`={$MID}"; |
||||
|
$DDD = $DATABASE->Query( $QS ); |
||||
|
if( count( $DDD ) ){ |
||||
|
$Data = $DDD[0]; |
||||
|
} else { |
||||
|
// Default Map - OpenStreetMap
|
||||
|
$Data['id']=0; |
||||
|
$Data['type']=1; |
||||
|
$Data['name']='__DEFAULT__'; |
||||
|
$Data['layer_url']='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; |
||||
|
$Data['attribution']='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'; |
||||
|
$Data['maxNativeZoom']=18; |
||||
|
$Data['maxZoom']=24; |
||||
|
}; |
||||
|
} else { |
||||
|
$QS = "SELECT `map_id`, `local_binding` FROM `system_props` LIMIT 1"; |
||||
|
$DDD = $DATABASE->Query( $QS ); |
||||
|
$Data['selected_map'] = intval( $DDD[0]['map_id'] ); |
||||
|
$Data['local_binding'] = ( intval( $DDD[0]['local_binding'] ) > 0 ); |
||||
|
$QS = "SELECT * FROM `location_maps` WHERE `id`={$Data['selected_map']}"; |
||||
|
//$Data['maps'] = array();
|
||||
|
$R = $DATABASE->Query( $QS ); |
||||
|
if( count( $R ) ){ |
||||
|
$Data['maps']=$R[0]; |
||||
|
} else { |
||||
|
// Default Map - OpenStreetMap
|
||||
|
$MD['id']=0; |
||||
|
$MD['type']=1; |
||||
|
$MD['name']='OpenStreetMap'; |
||||
|
$MD['layer_url']='https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; |
||||
|
$MD['attribution']='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'; |
||||
|
$MD['maxNativeZoom']=18; |
||||
|
$MD['maxZoom']=24; |
||||
|
$Data['maps'] = $MD; |
||||
|
}; |
||||
|
}; |
||||
|
} else { |
||||
|
|
||||
|
}; |
||||
|
echo json_encode( $Data ); |
||||
|
?>
|
||||
@ -0,0 +1,47 @@ |
|||||
|
<?php |
||||
|
require_once('../ajax_asm.php'); |
||||
|
/* |
||||
|
$CREATE_SENTENCE = <<<_DATA_BOUNDARY |
||||
|
CREATE TABLE "location_maps" ( |
||||
|
"id" INTEGER NOT NULL UNIQUE, |
||||
|
"type" INTEGER NOT NULL DEFAULT 1, |
||||
|
"name" TEXT NOT NULL, |
||||
|
"desc" TEXT, |
||||
|
"layer_url" TEXT, |
||||
|
"maxNativeZoom" INTEGER, |
||||
|
"maxZoom" INTEGER, |
||||
|
"attribution" TEXT, |
||||
|
"bounds_lx" REAL, |
||||
|
"bounds_ly" REAL, |
||||
|
"bounds_rx" REAL, |
||||
|
"bounds_ry" REAL, |
||||
|
PRIMARY KEY("id" AUTOINCREMENT) |
||||
|
) |
||||
|
_DATA_BOUNDARY; |
||||
|
*/ |
||||
|
if( $CUser->Data['id'] > 1 ){ |
||||
|
$Data = array(); |
||||
|
$Data['success'] = false; |
||||
|
//$DATABASE->Query( $CREATE_SENTENCE );
|
||||
|
$QS = "SELECT * FROM `location_maps`"; |
||||
|
$Result = $DATABASE->Query($QS,false); |
||||
|
|
||||
|
if( count( $Result ) ){ |
||||
|
$Data['maps'] = array(); |
||||
|
foreach( $Result as $CD ){ |
||||
|
$cnode['map_id'] = intval($CD['id']); |
||||
|
$cnode['map_type'] = intval($CD['type']); |
||||
|
$cnode['map_name'] = $CD['name']; |
||||
|
$cnode['map_url'] = $CD['layer_url']; |
||||
|
$cnode['map_attr'] = $CD['attribution']; |
||||
|
$cnode['map_zoom'] = intval($CD['maxZoom']); |
||||
|
$cnode['map_native_zoom'] = intval($CD['maxNativeZoom']); |
||||
|
$Data['maps'][] = $cnode; |
||||
|
}; |
||||
|
$Data['success'] = true; |
||||
|
}; |
||||
|
echo json_encode( $Data ); |
||||
|
} else { |
||||
|
header('location: /'); |
||||
|
}; |
||||
|
?>
|
||||
@ -0,0 +1 @@ |
|||||
|
koko |
||||
@ -0,0 +1,44 @@ |
|||||
|
<?php |
||||
|
require_once('../ajax_asm.php'); |
||||
|
|
||||
|
function verbose( $ok=1,$info=""){ |
||||
|
// failure to upload throws 400 error
|
||||
|
if( $ok==0 ){ |
||||
|
http_response_code(400); |
||||
|
}; |
||||
|
die(json_encode(["ok"=>$ok, "info"=>$info])); |
||||
|
}; |
||||
|
if( $CUser->Data['id'] > 1 ){ |
||||
|
$MID = intval( $_POST['MID'] ); |
||||
|
if( $MID ){ |
||||
|
$QS = "SELECT * FROM `location_maps` WHERE `id`={$MID}"; |
||||
|
$DDD = $DATABASE->Query( $QS ); |
||||
|
if( count( $DDD ) ){ |
||||
|
$MD = $DDD[0]; |
||||
|
list( $width, $height, $type, $attr ) = getimagesize( $SYSPath . 'lib/controller/data/assets/images/' . $MD['layer_url'] ); |
||||
|
$ENAME = $DATABASE->escape($_POST['map_name']); |
||||
|
$EDESC = $DATABASE->escape($_POST['map_desc']); |
||||
|
$EATTR = $DATABASE->escape($_POST['map_attr']); |
||||
|
$IZOOM = intval( $_POST['map_maxz'] ); |
||||
|
$INZOOM = intval( $_POST['map_maxz'] ); |
||||
|
$MA_WI = floatval( $_POST['map_width'] ); |
||||
|
$MA_HE = floatval( $_POST['map_height'] ); |
||||
|
$TB = intval( $_POST['map_tpb'] ); |
||||
|
$LB = intval( $_POST['map_lpb'] ); |
||||
|
$RB = intval( $_POST['map_rpb'] ); |
||||
|
$BB = intval( $_POST['map_bpb'] ); |
||||
|
$K_X = $MA_WI / ( $width - $LB - $RB ); |
||||
|
$K_Y = $MA_HE / ( $height - $TB - $BB ); |
||||
|
$IBLX = (-$LB)*$K_X; |
||||
|
$IBLY = (-$TB)*$K_Y; |
||||
|
$IBRX = ( $width + $RB ) * $K_X; |
||||
|
$IBRY = ( $height + $BB ) * $K_Y; |
||||
|
$QS = "UPDATE `location_maps` SET `name`='{$ENAME}',`desc`='{$EDESC}', `maxNativeZoom`={$INZOOM},`maxZoom`={$IZOOM}, `attribution`='{$EATTR}',`bounds_lx`={$IBLX},`bounds_ly`={$IBLY}, `bounds_rx`={$IBRX},`bounds_ry`={$IBRY}, `img_w`={$width}, `img_h`={$height}, `img_lb`={$LB}, `img_rb`={$RB}, `img_tb`={$TB},`img_bb`={$BB}, `img_map_w`={$MA_WI}, `img_map_h`={$MA_HE} WHERE `id`={$MID}"; |
||||
|
$DATABASE->Query( $QS ); |
||||
|
verbose( 1, "ALL IS OK" ); |
||||
|
} else verbose( 0, "WRONG MAPID" ); |
||||
|
} else verbose( 0, "WRONG MAPID" ); |
||||
|
} else { |
||||
|
verbose( 0, 'Access Denied!' ); |
||||
|
}; |
||||
|
?>
|
||||
@ -1,25 +1,32 @@ |
|||||
<?php |
<?php |
||||
class Language{ |
class Language{ |
||||
var $Labels; |
var $Labels; |
||||
function Language($LangID=1, $_module = ''){ |
|
||||
|
function Language($LangID=1, $_module = '', $DBM = null ){ |
||||
global $DATABASE; |
global $DATABASE; |
||||
$this->Labels=array(); |
$this->Labels=array(); |
||||
$QS="SELECT key, label FROM labels" . $_module . " WHERE language_id='{$LangID}'"; |
$QS="SELECT key, label FROM labels" . $_module . " WHERE language_id='{$LangID}'"; |
||||
$result= $DATABASE->Query($QS); |
|
||||
|
if( $DBM == null ){ |
||||
|
$result= $DATABASE->Query($QS); |
||||
|
} else { |
||||
|
$result= $DBM->Query($QS); |
||||
|
} |
||||
foreach ( $result as $array) $this->Labels[$array['key']]=$array['label']; |
foreach ( $result as $array) $this->Labels[$array['key']]=$array['label']; |
||||
} |
} |
||||
function GetLabel($LabelKey){ |
function GetLabel($LabelKey){ |
||||
//global $Labels;
|
|
||||
if (isset($this->Labels[$LabelKey])){ |
if (isset($this->Labels[$LabelKey])){ |
||||
return $this->Labels[$LabelKey]; |
return $this->Labels[$LabelKey]; |
||||
} else return $LabelKey; |
} else return $LabelKey; |
||||
} |
} |
||||
function AddLabel($LabelKey, $LabelText, $LanguageID) |
|
||||
|
function AddLabel($LabelKey, $LabelText, $LanguageID, $DBM = null ) |
||||
{ |
{ |
||||
global $DATABASE; |
global $DATABASE; |
||||
|
|
||||
$QS="INSERT INTO labels SET key='$LabelKey', label='$LabelText', language_id=$LanguageID"; |
$QS="INSERT INTO labels SET key='$LabelKey', label='$LabelText', language_id=$LanguageID"; |
||||
$result= $DATABASE->Query($QS, false); |
|
||||
|
if( $DBM == null ){ |
||||
|
$DATABASE->Query($QS, false); |
||||
|
} else { |
||||
|
$DBM->Query($QS, false); |
||||
|
}; |
||||
} |
} |
||||
}; |
}; |
||||
|
|
||||
|
|||||
Binary file not shown.
Binary file not shown.
|
After Width: 64 | Height: 64 | Size: 3.0 KiB |
Binary file not shown.
|
After Width: 64 | Height: 64 | Size: 3.0 KiB |
Binary file not shown.
|
After Width: 128 | Height: 128 | Size: 13 KiB |
Binary file not shown.
|
After Width: 128 | Height: 128 | Size: 17 KiB |
Write
Preview
Loading…
Cancel
Save
Reference in new issue