diff --git a/lib/ajax_asm.php b/lib/ajax_asm.php
index d60e595..de2c224 100644
--- a/lib/ajax_asm.php
+++ b/lib/ajax_asm.php
@@ -35,8 +35,13 @@ if( isset($_GET['Lang'])){
$UCL=$_GET['Lang']/1;
if ($UCL) $_SESSION['userlang']=$UCL; else $_SESSION['userlang']=$UserLang;
}
-if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang']);//, '_php');
-else $Labels=new Language( $UserLang );//, '_php');
+
+$LDB = new SQLite_DB( '/srv/www/web/lib/controller/data/language.db');
+if( isset($_SESSION['userlang']) ){
+ $Labels=new Language( $_SESSION['userlang'],'', $LDB );
+} else {
+ $Labels=new Language( $UserLang ,'', $LDB );
+};
if( $UserLang == 3 || $UserLang == 255 ){
$RTL_SITE = true;
diff --git a/lib/assembler.php b/lib/assembler.php
index f18a4f7..5f9bfb9 100644
--- a/lib/assembler.php
+++ b/lib/assembler.php
@@ -51,8 +51,13 @@ if( isset($_GET['Lang'])){
$UCL=$_GET['Lang']/1;
if ($UCL) $_SESSION['userlang']=$UCL; else $_SESSION['userlang']=$UserLang;
}
-if( isset($_SESSION['userlang']) )$Labels=new Language( $_SESSION['userlang'] ); // '_php');
-else $Labels=new Language( $UserLang );// '_php');
+
+$LDB = new SQLite_DB( 'lib/controller/data/language.db');
+if( isset($_SESSION['userlang']) ){
+ $Labels=new Language( $_SESSION['userlang'],'', $LDB );
+} else {
+ $Labels=new Language( $UserLang ,'', $LDB );
+};
if( $UserLang == 3 || $UserLang == 255 ){
$RTL_SITE = true;
diff --git a/lib/controller/addMap.php b/lib/controller/addMap.php
new file mode 100644
index 0000000..68a1710
--- /dev/null
+++ b/lib/controller/addMap.php
@@ -0,0 +1,66 @@
+$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!' );
+ };
+?>
\ No newline at end of file
diff --git a/lib/controller/getGeoZones.php b/lib/controller/getGeoZones.php
index 179c325..78c0a11 100644
--- a/lib/controller/getGeoZones.php
+++ b/lib/controller/getGeoZones.php
@@ -152,13 +152,20 @@ function ToLL($north, $east, $utmZone){
$SR = $DATABASE->Query( $QS, false );
if( count( $SR ) ){
$SS = $SR[0];
- $ANCHOR = new gPoint();
- $ANCHOR->setLongLat( floatval( $SS['anchor_lon'] ), floatval( $SS['anchor_lat'] ) );
- $ANCHOR->convertLLtoTM();
- $BASE_X = $ANCHOR->E();
- $BASE_Y = $ANCHOR->N();
- $BASE_Z = floatval( $SS['anchor_alt'] );
- $BASE_ZONE = $ANCHOR->Z();
+ $GPS = $SS['local_binding'] == 0;
+ if( $GPS ){
+ $ANCHOR = new gPoint();
+ $ANCHOR->setLongLat( floatval( $SS['anchor_lon'] ), floatval( $SS['anchor_lat'] ) );
+ $ANCHOR->convertLLtoTM();
+ $BASE_X = $ANCHOR->E();
+ $BASE_Y = $ANCHOR->N();
+ $BASE_ZONE = $ANCHOR->Z();
+ } else {
+ $BASE_X = floatval( $SS['anchor_lon'] );
+ $BASE_Y = floatval( $SS['anchor_lat'] );
+ $BASE_ZONE = 'N';
+ };
+ $BASE_Z = floatval( $SS['anchor_alt'] );
$QS = "SELECT * FROM nodes WHERE ((type!=0)AND(type!=20))";
$Result = $DATABASE->Query( $QS, false );
date_default_timezone_set('UTC');
@@ -173,39 +180,58 @@ function ToLL($north, $east, $utmZone){
$D = $DATABASE->Query( $QS, false );
if( count( $D ) ){
$CC = $D[0];
- $A = new gPoint();
- $A->setUTM( $CC['x'], $CC['y'] );
- $A->convertTMtoLL();
- $LAT = $A->Lat();
- $LON = $A->Long();
- //$A->setLongLat($CC['lon'],$CC['lat']);
- //$A->convertLLtoTM();
- $XC = $A->E();
- $YC = $A->N();
- $Z = $A->Z();
+ if( $GPS ){
+ $A = new gPoint();
+ $A->setUTM( $CC['x'], $CC['y'] );
+ $A->convertTMtoLL();
+ $LON = $A->Long();
+ $LAT = $A->Lat();
+ //$A->setLongLat($CC['lon'],$CC['lat']);
+ //$A->convertLLtoTM();
+ $XC = $A->E();
+ $YC = $A->N();
+ $Z = $A->Z();
+ } else {
+ $LON = $BASE_X + floatval( $CC['x'] );
+ $LAT = $BASE_Y + floatval( $CC['y'] );
+ $XC = $LON;
+ $YC = $LAT;
+ $Z = $BASE_Z;
+ };
$RAN = floatval( $CC['max_range'] );
if( 1 ){
$K = pi()/18.0;//10 deg
$Points = array();
- $Points[] = array( 'lat'=>$LAT, 'lon'=>$LON );
+ $Points[] = array( 'lon'=>$LON, 'lat'=>$LAT );
$SANG = ( pi() / 180 ) * floatval( $CC['yaw'] );
for( $i = 0; $i < 11; $i++ ){
$CA = $i * $K;
- $B = new gPoint();
- $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
- $B->convertTMtoLL();
- $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
+ $B->convertTMtoLL();
+ $Points[]=array( 'lon'=>$B->Long(), 'lat'=>$B->Lat() );
+ } else {
+ $PX = $XC + $RAN * cos( $SANG + $CA );
+ $PY = $YC + $RAN * sin( $SANG + $CA );
+ $Points[]=array( 'lon'=>$PX, 'lat'=>$PY );
+ };
};
if(1){
- $ZMARK = array();
- $B = new gPoint();
+ if( $GPS ){
+ $ZMARK = array();
+ $B = new gPoint();
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
-
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
//$SANG = $SANG - ( pi() / 180 );
//$RAN = $RAN + 0.5;
//$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
@@ -263,12 +289,18 @@ function ToLL($north, $east, $utmZone){
$Zone['bottomleft']=array($A->Lat(),$A->Long());
$ZMARK = array();
- $B = new gPoint();
+ if( $GPS ){
+ $B = new gPoint();
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
$Zone['zang'] = $ZMARK;
//*/
};
@@ -287,14 +319,22 @@ function ToLL($north, $east, $utmZone){
$Zone['dev_name'] = $R['name'];
if( count( $D ) ){
$CC = $D[0];
- $A = new gPoint();
- $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
- $A->convertTMtoLL();
- $LAT = $A->Lat();
- $LON = $A->Long();
- $XC = $A->E();
- $YC = $A->N();
- $Z = $A->Z();
+ if( $GPS ){
+ $A = new gPoint();
+ $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
+ $A->convertTMtoLL();
+ $LAT = $A->Lat();
+ $LON = $A->Long();
+ $XC = $A->E();
+ $YC = $A->N();
+ $Z = $A->Z();
+ } else {
+ $LON = $BASE_X + floatval( $CC['x'] );
+ $LAT = $BASE_Y + floatval( $CC['y'] );
+ $XC = $LON;
+ $YC = $LAT;
+ $Z = $BASE_Z;
+ };
$RAN = floatval( $CC['max_range'] );
$K = pi()/ 36; // 5 deg//
@@ -303,17 +343,29 @@ function ToLL($north, $east, $utmZone){
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ) + ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
for( $i = 0; $i < 20; $i++ ){
$CA = $i * $K;
+ if( $GPS ){
+ $B = new gPoint();
+ $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
+ $B->convertTMtoLL();
+ $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $PX = $XC + $RAN * cos( $SANG + $CA );
+ $PY = $YC + $RAN * sin( $SANG + $CA );
+ $Points[]=array( 'lon'=>$PX, 'lat'=>$PY );
+ };
+ };
+ $ZMARK = array();
+ if( $GPS ){
$B = new gPoint();
- $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
+ $SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
$B->convertTMtoLL();
- $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
};
- $ZMARK = array();
- $B = new gPoint();
- $SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
- $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
$Zone['zang'] = $ZMARK;
$Zone['type']='poly';
$Zone['points']=$Points;
@@ -334,18 +386,26 @@ function ToLL($north, $east, $utmZone){
$Zone['dev_name'] = $R['name'];
if( count( $D ) ){
$CC = $D[0];
- $A = new gPoint();
- $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
- $A->convertTMtoLL();
- $LAT = $A->Lat();
- $LON = $A->Long();
-
- //$A = new gPoint();
- //$A->setLongLat($CC['lon'],$CC['lat']);
- //$A->convertLLtoTM();
- $XC = $A->E();
- $YC = $A->N();
- $Z = $A->Z();
+ if( $GPS ){
+ $A = new gPoint();
+ $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
+ $A->convertTMtoLL();
+ $LAT = $A->Lat();
+ $LON = $A->Long();
+
+ //$A = new gPoint();
+ //$A->setLongLat($CC['lon'],$CC['lat']);
+ //$A->convertLLtoTM();
+ $XC = $A->E();
+ $YC = $A->N();
+ $Z = $A->Z();
+ } else {
+ $LON = $BASE_X + floatval( $CC['x'] );
+ $LAT = $BASE_Y + floatval( $CC['y'] );
+ $XC = $LON;
+ $YC = $LAT;
+ $Z = $BASE_Z;
+ };
$RAN = floatval( $CC['max_range'] );
if(1){
$K = pi()/ 36; // 10 deg//
@@ -354,40 +414,52 @@ function ToLL($north, $east, $utmZone){
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] ) + ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
for( $i = 0; $i < 40; $i++ ){
$CA = $i * $K;
- $B = new gPoint();
- $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
- $B->convertTMtoLL();
- $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
+ $B->convertTMtoLL();
+ $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $PX = $XC + $RAN * cos( $SANG + $CA );
+ $PY = $YC + $RAN * sin( $SANG + $CA );
+ $Points[]=array( 'lon'=>$PX, 'lat'=>$PY );
+ };
};
if(1){
$ZMARK = array();
- $B = new gPoint();
- // PLS
- $SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
-
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
- $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
-
- //$SANG = $SANG - ( pi() / 180 );
- //$RAN = $RAN + 0.5;
- //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- //$B->convertTMtoLL();
- //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
-
- //$SANG = $SANG + ( pi() / 180 );
- //$RAN = $RAN + 0.5;
- //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- //$B->convertTMtoLL();
- //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
-
- //$SANG = $SANG + ( pi() / 180 );
- //$RAN = $RAN - 0.5;
- //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- //$B->convertTMtoLL();
- //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ // PLS
+ $SANG = $SANG - ( pi()/3000.0 * floatval( $CC['base_shift'] ) );
+
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
+ $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+
+ //$SANG = $SANG - ( pi() / 180 );
+ //$RAN = $RAN + 0.5;
+ //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ //$B->convertTMtoLL();
+ //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+
+ //$SANG = $SANG + ( pi() / 180 );
+ //$RAN = $RAN + 0.5;
+ //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ //$B->convertTMtoLL();
+ //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+
+ //$SANG = $SANG + ( pi() / 180 );
+ //$RAN = $RAN - 0.5;
+ //$B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ //$B->convertTMtoLL();
+ //$ZMARK[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
$Zone['zang'] = $ZMARK;
}
$Zone['type']='poly';
@@ -427,12 +499,18 @@ function ToLL($north, $east, $utmZone){
$Zone['bottomleft']=array($A->Lat(),$A->Long());
//*/
$ZMARK = array();
- $B = new gPoint();
+ if( $GPS ){
+ $B = new gPoint();
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
$ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ }
$Zone['zang'] = $ZMARK;
};
$Zone['name'] = $R['name'];
@@ -451,19 +529,26 @@ function ToLL($north, $east, $utmZone){
$Zone['dev_name'] = $R['name'];
if( count( $D ) ){
$CC = $D[0];
- $A = new gPoint();
- $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
- $A->convertTMtoLL();
- $LAT = $A->Lat();
- $LON = $A->Long();
-
- //$A = new gPoint();
- //$A->setLongLat($CC['lon'],$CC['lat']);
- //$A->convertLLtoTM();
- $YC = $A->N();
- $XC = $A->E();
- $Z = $A->Z();
-
+ if( $GPS ){
+ $A = new gPoint();
+ $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
+ $A->convertTMtoLL();
+ $LAT = $A->Lat();
+ $LON = $A->Long();
+
+ //$A = new gPoint();
+ //$A->setLongLat($CC['lon'],$CC['lat']);
+ //$A->convertLLtoTM();
+ $YC = $A->N();
+ $XC = $A->E();
+ $Z = $A->Z();
+ } else {
+ $LON = $BASE_X + floatval( $CC['x'] );
+ $LAT = $BASE_Y + floatval( $CC['y'] );
+ $XC = $LON;
+ $YC = $LAT;
+ $Z = $BASE_Z;
+ };
$Zone['type']='circle';
$Zone['radius'] = floatval( $CC['max_range'] );
$Zone['color'] = '#8800FF';
@@ -472,12 +557,17 @@ function ToLL($north, $east, $utmZone){
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] );
$RAN = floatval( $CC['max_range'] );
$ZMARK = array();
- $B = new gPoint();
-
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
- $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
+ $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
$Zone['zang'] = $ZMARK;
$Zone['name'] = $R['name'];
$Data[] = $Zone;
@@ -490,14 +580,22 @@ function ToLL($north, $east, $utmZone){
$D = $DATABASE->Query( $QS, false );
if( count( $D ) ){
$CC = $D[0];
- $A = new gPoint();
- $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
- $A->convertTMtoLL();
- $LAT = $A->Lat();
- $LON = $A->Long();
- $YC = $A->N();
- $XC = $A->E();
- $Z = $A->Z();
+ if( $GPS ){
+ $A = new gPoint();
+ $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
+ $A->convertTMtoLL();
+ $LAT = $A->Lat();
+ $LON = $A->Long();
+ $YC = $A->N();
+ $XC = $A->E();
+ $Z = $A->Z();
+ } else {
+ $LON = $BASE_X + floatval( $CC['x'] );
+ $LAT = $BASE_Y + floatval( $CC['y'] );
+ $XC = $LON;
+ $YC = $LAT;
+ $Z = $BASE_Z;
+ }
$CFOV = (2.0*atan($AC_imager_width[$CC['imager_type']]/(2.0*$cam_predef_focal_length[$CC['lens_f']])));
$Points = array();
$A = new gPoint();
@@ -507,21 +605,33 @@ function ToLL($north, $east, $utmZone){
$RAN = floatval( $CC['max_range'] );
for( $i = 0; $i < 41; $i++ ){
$CA = $i * $K;
- $B = new gPoint();
- $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
- $B->convertTMtoLL();
- $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
+ $B->convertTMtoLL();
+ $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $PX = $XC + $RAN * cos( $SANG + $CA );
+ $PY = $YC + $RAN * sin( $SANG + $CA );
+ $Points[]=array( 'lon'=>$PX, 'lat'=>$PY );
+ };
};
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#000088';
$Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON );
$ZMARK = array();
- $B = new gPoint();
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG+( $CFOV / 2.0 ) ), $YC + $RAN * sin( $SANG +( $CFOV / 2.0 ) ), $Z );
- $B->convertTMtoLL();
- $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG+( $CFOV / 2.0 ) ), $YC + $RAN * sin( $SANG +( $CFOV / 2.0 ) ), $Z );
+ $B->convertTMtoLL();
+ $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
$Zone['zang'] = $ZMARK;
$Zone['name'] = $R['name'];
$Data[] = $Zone;
@@ -534,14 +644,22 @@ function ToLL($north, $east, $utmZone){
$D = $DATABASE->Query( $QS, false );
if( count( $D ) ){
$CC = $D[0];
- $A = new gPoint();
- $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
- $A->convertTMtoLL();
- $LAT = $A->Lat();
- $LON = $A->Long();
- $YC = $A->N();
- $XC = $A->E();
- $Z = $A->Z();
+ if( $GPS ){
+ $A = new gPoint();
+ $A->setUTM( $BASE_X + floatval( $CC['x'] ), $BASE_Y + floatval( $CC['y'] ), $BASE_ZONE );
+ $A->convertTMtoLL();
+ $LAT = $A->Lat();
+ $LON = $A->Long();
+ $YC = $A->N();
+ $XC = $A->E();
+ $Z = $A->Z();
+ } else {
+ $LON = $BASE_X + floatval( $CC['x'] );
+ $LAT = $BASE_Y + floatval( $CC['y'] );
+ $XC = $LON;
+ $YC = $LAT;
+ $Z = $BASE_Z;
+ };
if( intval( $CC['pan_angles'] ) < 360 ){
$Points = array();
$A = new gPoint();
@@ -551,21 +669,33 @@ function ToLL($north, $east, $utmZone){
$RAN = floatval( $CC['max_range'] );
for( $i = 0; $i < 41; $i++ ){
$CA = $i * $K;
- $B = new gPoint();
- $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
- $B->convertTMtoLL();
- $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ $B->setUTM( $XC + $RAN * cos( $SANG + $CA ), $YC + $RAN * sin( $SANG + $CA ), $Z );
+ $B->convertTMtoLL();
+ $Points[]=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $PX = $XC + $RAN * cos( $SANG + $CA );
+ $PY = $YC + $RAN * sin( $SANG + $CA );
+ $Points[]=array( 'lon'=>$PX, 'lat'=>$PY );
+ };
};
$Zone['type']='poly';
$Zone['points']=$Points;
$Zone['color'] = '#000088';
$Zone['center'] = array( 'lat'=>$LAT, 'lon'=>$LON );
$ZMARK = array();
- $B = new gPoint();
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
- $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
+ $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
$Zone['zang'] = $ZMARK;
} else {
$Zone['type']='circle';
@@ -575,11 +705,17 @@ function ToLL($north, $east, $utmZone){
$SANG = ( pi() / 180 ) * floatval( $CC['z_rot'] );
$RAN = floatval( $CC['max_range'] );
$ZMARK = array();
- $B = new gPoint();
- //$RAN = $RAN - 0.5;
- $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
- $B->convertTMtoLL();
- $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ if( $GPS ){
+ $B = new gPoint();
+ //$RAN = $RAN - 0.5;
+ $B->setUTM( $XC + $RAN * cos( $SANG ), $YC + $RAN * sin( $SANG ), $Z );
+ $B->convertTMtoLL();
+ $ZMARK=array('lat'=>$B->Lat(),'lon'=>$B->Long());
+ } else {
+ $ZPX = $XC + $RAN * cos( $SANG );
+ $ZPY = $YC + $RAN * sin( $SANG );
+ $ZMARK=array( 'lon'=>$ZPX, 'lat'=>$ZPY );
+ };
$Zone['zang'] = $ZMARK;
};
$Zone['name'] = $R['name'];
diff --git a/lib/controller/getLocationItems.php b/lib/controller/getLocationItems.php
index 314f8c2..e6e611c 100644
--- a/lib/controller/getLocationItems.php
+++ b/lib/controller/getLocationItems.php
@@ -10,21 +10,29 @@
$SLAT = $R[0]['anchor_lat'];
$SLON = $R[0]['anchor_lon'];
$SALT = $R[0]['anchor_alt'];
- $A = new gPoint();
- $A->setLongLat( $SLON, $SLAT );
- $A->convertLLtoTM();
- $XC = $A->E();
- $YC = $A->N();
- $ZC = $A->Z();
+ $DIFF = intval( $R[0]['local_binding'] );
+ if( $DIFF == 0 ){
+ $A = new gPoint();
+ $A->setLongLat( $SLON, $SLAT );
+ $A->convertLLtoTM();
+ $XC = $A->E();
+ $YC = $A->N();
+ $ZC = $A->Z();
+ } else {
+ $XC = $SLON;
+ $YC = $SLAT;
+ $ZC = $SALT;
+ };
$QS = "SELECT * FROM nodes";
$Result = $DATABASE->Query( $QS, false );
+ $index = 0;
foreach( $Result as $CD ){
$cnode['id'] = intval($CD['id']);
$cnode['type'] = intval($CD['type']);
$index++;
$PUPA = false;
- $CC = new gPoint();
+ if( $DIFF == 0 ) $CC = new gPoint();
switch( $CD['type'] ){
case ARGUS_ALS_SENSOR:
case ARGUS_LFS_SENSOR:
@@ -34,10 +42,15 @@
case ARGUS_NET_PLS_200:
$QS="SELECT x, y FROM lrf_sensors WHERE id={$CD['aux_id']}";
$RV = $DATABASE->Query( $QS );
- $CC->setUTM( $XC + floatval($RV[0]['x']), $YC+floatval($RV[0]['y']), $ZC );
- $CC->convertTMtoLL();
- $cnode['lat'] = $CC->Lat();
- $cnode['lon'] = $CC->Long();
+ if( $DIFF == 0 ){
+ $CC->setUTM( $XC + floatval($RV[0]['x']), $YC+floatval($RV[0]['y']), $ZC );
+ $CC->convertTMtoLL();
+ $cnode['lat'] = $CC->Lat();
+ $cnode['lon'] = $CC->Long();
+ } else {
+ $cnode['lat'] = $XC + floatval($RV[0]['y']);
+ $cnode['lon'] = $YC +floatval($RV[0]['x']);
+ };
//if( floatval($RV[0]['x']) == 0 && floatval($RV[0]['y']) == 0 ){
// $cnode['lat'] = $SLAT;
// $cnode['lon'] = $SLON;
@@ -55,19 +68,15 @@
case ARGUS_IP_PTZ_CAMERA:
$QS="SELECT x, y FROM cameras WHERE id={$CD['aux_id']}";
$RV = $DATABASE->Query( $QS );
- $CC->setUTM( $XC + floatval($RV[0]['x']), $YC+floatval($RV[0]['y']), $ZC );
- $CC->convertTMtoLL();
- $cnode['lat'] = $CC->Lat();
- $cnode['lon'] = $CC->Long();
- //if( floatval($RV[0]['x']) == 0 && floatval($RV[0]['y']) == 0 ){
- // $cnode['lat'] = $SLAT;
- // $cnode['lon'] = $SLON;
- //} else {
- // $CC->setUTM( floatval($RV[0]['x']), floatval($RV[0]['y']), $ZC );
- // $CC->convertTMtoLL();
- // $cnode['lat']= $CC->Lat();
- // $cnode['lon']= $CC->Long();
- //};
+ if( $DIFF == 0 ){
+ $CC->setUTM( $XC + floatval($RV[0]['x']), $YC+floatval($RV[0]['y']), $ZC );
+ $CC->convertTMtoLL();
+ $cnode['lat'] = $CC->Lat();
+ $cnode['lon'] = $CC->Long();
+ } else {
+ $cnode['lat'] = $XC + floatval($RV[0]['y']);
+ $cnode['lon'] = $YC + floatval($RV[0]['x']);
+ };
$PUPA = true;
break;
};
diff --git a/lib/controller/getLocationNodeProps.php b/lib/controller/getLocationNodeProps.php
index 14dd4ce..98105ac 100644
--- a/lib/controller/getLocationNodeProps.php
+++ b/lib/controller/getLocationNodeProps.php
@@ -2,6 +2,130 @@
require_once('../ajax_asm.php');
require_once('../php/utm/gPoint.php');
+$PROP_TPL=<<<_DATA_BOUNDARY
+{
+ xtype: 'form',
+ labelWidth: 40, // label settings here cascade unless overridden
+ frame: false,
+ bodyStyle:'padding:5px 5px 0',
+ defaultType: 'textfield',
+ labelAlign: 'right',
+ items: [{
+ xtype: 'panel',
+ height: 100,
+ html: '

%%%NAME%%%
'
+ },%%%LOCATION_PART%%%{
+ xtype:'fieldset',
+ title: 'Orientation',
+ collapsible: true,
+ autoHeight:true,
+ defaults: {
+ //width: 168
+ },
+ defaultType: 'textfield',
+ items :[{
+ fieldLabel: 'Roll',
+ id: 'sroll',
+ value: %%%ROLL%%%,
+ name: 'sroll',
+ allowBlank:false
+ },{
+ fieldLabel: 'Pitch',
+ id: 'spitch',
+ value: %%%PITCH%%%,
+ name: 'spitch',
+ allowBlank:false
+ },{
+ fieldLabel: 'Yaw',
+ id: 'syaw',
+ value: %%%YAW%%%,
+ name: 'syaw',
+ allowBlank:false
+ },{
+ xtype: 'button',
+ width: '100%',
+ text: 'Edit Orientation',
+ handler: orientationEditor
+ }]
+ },{
+ xtype:'fieldset',
+ title: 'Diff Position',
+ collapsible: true,
+ autoHeight:true,
+ defaults: {
+ //width: 168
+ },
+ defaultType: 'numberfield',
+ items :[{
+ fieldLabel: 'ΔX',
+ id: 'dx',
+ value: %%%DX%%%,
+ name: 'dx',
+ allowBlank:false
+ },{
+ fieldLabel: 'ΔY',
+ id: 'dy',
+ value: %%%DY%%%,
+ name: 'dy',
+ allowBlank:false
+ },{
+ fieldLabel: 'ΔZ',
+ id: 'dz',
+ value: %%%DZ%%%,
+ name: 'dz',
+ allowBlank:false
+ },{
+ xtype: 'button',
+ width: '100%',
+ text: 'Set Position',
+ handler: setNodeLocationByDelta
+ }]
+ },{
+ xtype: 'button',
+ text: 'Update',
+ width: '100%',
+ handler: updateLocationOrientation
+ }]
+}
+_DATA_BOUNDARY;
+$LOCA_TPL=<<<_DATA_BOUNDARY
+{
+ xtype:'fieldset',
+ //checkboxToggle:true,
+ collapsible: true,
+ title: 'Location',
+ autoHeight: true,
+ defaults: {
+ //width: 180
+ },
+ defaultType: 'textfield',
+ collapsed: false,
+ items :[{
+ fieldLabel: 'Lat',
+ name: 'slat',
+ value: %%%LAT%%%,
+ id: 'slat',
+ allowBlank:false
+ },{
+ fieldLabel: 'Lon',
+ id: 'slon',
+ value: %%%LON%%%,
+ name: 'slon',
+ allowBlank:false
+ },{
+ fieldLabel: 'Alt',
+ id: 'salt',
+ value: %%%ALT%%%,
+ name: 'salt',
+ allowBlank:false
+ },{
+ xtype: 'button',
+ text: 'Set To Anchor Position',
+ width: '100%',
+ handler: setNodeLocationToAnchor
+ }]
+ },
+_DATA_BOUNDARY;
if( $CUser->Data['id'] > 1 ){
$Node = intval( $_POST['NODE'] );
$QS = "SELECT * FROM `nodes` WHERE id = {$Node}";
@@ -12,6 +136,12 @@
$TName = 'props/loc_prop.js';
$QS = "SELECT * FROM `system_props`";
$R = $DATABASE->Query($QS);
+ $GPS = ( $R[0]['local_binding'] == 0 );
+ if( $GPS ){
+ $PROP_TPL = str_replace('%%%LOCATION_PART%%%', $LOCA_TPL, $PROP_TPL );
+ } else {
+ $PROP_TPL = str_replace('%%%LOCATION_PART%%%', '', $PROP_TPL );
+ };
$SLAT = $R[0]['anchor_lat'];
$SLON = $R[0]['anchor_lon'];
$SALT = $R[0]['anchor_alt'];
@@ -23,10 +153,10 @@
$Zo = floatval( $SALT );
$ZC = $A->Z();
- $Data = file_get_contents( $TName );
+ $Data = $PROP_TPL;//file_get_contents( $TName );
$Data = str_replace('%%%NODEID%%%', ''.$Node, $Data );
$Data = str_replace('%%%TYPE%%%', $Type, $Data );
- $Data = str_replace('%%%NAME%%%', $Props['name'] , $Data );
+ $Data = str_replace('%%%NAME%%%', urldecode( $Props['name'] ), $Data );
switch( $Type ){
case 1:
case 2:
diff --git a/lib/controller/getLocationNodes.php b/lib/controller/getLocationNodes.php
index 77ad613..cc0f9a6 100644
--- a/lib/controller/getLocationNodes.php
+++ b/lib/controller/getLocationNodes.php
@@ -9,8 +9,9 @@
foreach( $Result as $CD ){
$cid = intval($CD['id']);
$ct = intval($CD['type']);
+ $cname = urldecode( $CD['name'] );
if( in_array( $ct, array( 1, 2, 3, 5, 6, 10, 11, 12, 13 ) ) ){
- $DL[] = "{ xtype: 'button', text: '{$CD['name']}', width: '100%', handler: function(){ locationSelectedNode={$cid}; loadNodeLocationProps({$cid}); } }";
+ $DL[] = "{ xtype: 'button', text: '{$cname}', width: '100%', handler: function(){ locationSelectedNode={$cid}; loadNodeLocationProps({$cid}); } }";
};
};
echo $Data . implode(',',$DL) ."] }";
diff --git a/lib/controller/getMapData.php b/lib/controller/getMapData.php
new file mode 100644
index 0000000..c7a1e85
--- /dev/null
+++ b/lib/controller/getMapData.php
@@ -0,0 +1,49 @@
+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']='© OpenStreetMap 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']='© OpenStreetMap contributors';
+ $MD['maxNativeZoom']=18;
+ $MD['maxZoom']=24;
+ $Data['maps'] = $MD;
+ };
+ };
+ } else {
+
+ };
+ echo json_encode( $Data );
+?>
\ No newline at end of file
diff --git a/lib/controller/listMaps.php b/lib/controller/listMaps.php
new file mode 100644
index 0000000..c3b10be
--- /dev/null
+++ b/lib/controller/listMaps.php
@@ -0,0 +1,47 @@
+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: /');
+ };
+?>
\ No newline at end of file
diff --git a/lib/controller/map_picture_upload.html b/lib/controller/map_picture_upload.html
new file mode 100644
index 0000000..6d7b982
--- /dev/null
+++ b/lib/controller/map_picture_upload.html
@@ -0,0 +1 @@
+koko
\ No newline at end of file
diff --git a/lib/controller/updateLocation.php b/lib/controller/updateLocation.php
index 58fdbfb..abd7a55 100644
--- a/lib/controller/updateLocation.php
+++ b/lib/controller/updateLocation.php
@@ -4,6 +4,7 @@
if( $CUser->Data['id'] > 1 ){
$SITE = 0; $NID = 0;
+ $DIFF = 0;
//if( isset( $_POST['SITE'] ) ) $SITE = intval($_POST['SITE']);
$TYP = intval($_POST['TYPE']);
if( isset( $_POST['NODE'] ) ) $NID = intval($_POST['NODE']);
@@ -17,20 +18,25 @@
$YAW = floatval( $_POST['YAW'] );
};
};
- if( $TYP != 1 ){
+ if( $TYP != 1 && $TYP != 4 ){
$QS="SELECT `anchor_lat`, `anchor_lon`, `anchor_alt`, `local_binding` FROM `system_props` LIMIT 1";
$R = $DATABASE->Query( $QS );
$SLAT = $R[0]['anchor_lat'];
$SLON = $R[0]['anchor_lon'];
$SALT = $R[0]['anchor_alt'];
- $DIFF =intval( $R[0]['local_binding'] );
- $A = new gPoint();
- $A->setLongLat( $SLON, $SLAT );
- $A->convertLLtoTM();
- $XC = $A->E();
- $YC = $A->N();
- $ZC = $A->Z();
-
+ $DIFF = intval( $R[0]['local_binding'] );
+ if( $DIFF == 0 ){
+ $A = new gPoint();
+ $A->setLongLat( $SLON, $SLAT );
+ $A->convertLLtoTM();
+ $XC = $A->E();
+ $YC = $A->N();
+ $ZC = $A->Z();
+ } else {
+ $XC = $SLON;
+ $YC = $SLAT;
+ $ZC = $SALT;
+ };
$QS = "SELECT * FROM nodes WHERE id ={$NID}";
$Result = $DATABASE->Query( $QS, false );
$CD = $Result[0];
@@ -52,21 +58,18 @@
};
};
switch( $TYP ){
- case 0://Short update
- $CC = new gPoint();
- $CC->setLongLat( $LON, $LAT );
- $CC->convertLLtoTM();
- $XX = $CC->E();
- $YY = $CC->N();
- $ZZ = $CC->Z();
+ case 0://Short update
if( $DIFF ){
- $DX = $XX - $XC;
- $DY = $YY - $YC;
- $DZ = $ZZ - $ZC;
+ $DX = $LON - $XC;
+ $DY = $LAT - $YC;
+ $DZ = 0;//$ALT - $ZC;
} else {
- $DX = $XX;
- $DY = $YY;
- $DZ = $ZZ;
+ $CC = new gPoint();
+ $CC->setLongLat( $LON, $LAT );
+ $CC->convertLLtoTM();
+ $DX = $CC->E() - $XC;
+ $DY = $CC->N() - $YC;
+ $DZ = 0;//$CC->Z() - $ZC;
};
$QS="UPDATE `{$TBL}` SET `x`={$DX}, `y`={$DY}, `z`={$DZ} WHERE `id`={$CD['aux_id']}";
break;
@@ -94,6 +97,21 @@
case 3://update by cords -> no convert
$QS="UPDATE `{$TBL}` SET `x`={$LAT}, `y`={$LON}, `z`={$ALT} WHERE `id`={$CD['aux_id']}";
break;
+ case 4://Update Map TYPE
+ $MID = intval($_POST['MID']);
+ $QS = "SELECT * FROM `location_maps` WHERE `id`={$MID}";
+ $DDD = $DATABASE->Query( $QS );
+ if( count( $DDD ) ){
+ // Such map exists ->Check local Binding of coordinates
+ $MDATA = $DDD[0];
+ $LB = 0;
+ if( $MDATA['type'] == 2 ) $LB = 1;
+ $QS="UPDATE `system_props` SET `map_id`={$MID}, `local_binding`={$LB}";
+ } else {
+ // Falling to default map (OpenStreet)
+ $QS="UPDATE `system_props` SET `map_id`=0, `local_binding`=0";
+ };
+ break;
};
$DATABASE->Query( $QS );
echo "{ nid: {$NID}, QS:'{$QS}' }";
diff --git a/lib/controller/updateMap.php b/lib/controller/updateMap.php
new file mode 100644
index 0000000..106b1f8
--- /dev/null
+++ b/lib/controller/updateMap.php
@@ -0,0 +1,44 @@
+$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!' );
+ };
+?>
\ No newline at end of file
diff --git a/lib/javascript/jsapi_dynamic/mojo_global_vars.js b/lib/javascript/jsapi_dynamic/mojo_global_vars.js
index 043c3c2..9e39069 100644
--- a/lib/javascript/jsapi_dynamic/mojo_global_vars.js
+++ b/lib/javascript/jsapi_dynamic/mojo_global_vars.js
@@ -5,15 +5,15 @@ var SiteLat==$AP_DATA['anchor_lat'];?>;
var SiteLon==$AP_DATA['anchor_lon'];?>;
var SiteAlt==$AP_DATA['anchor_alt'];?>;
var ap_type==$AP_DATA['type'];?>;
-var ap_title = '=$AP_DATA['name'];?>';
-var winW = =intval($CUser->Data['width']);?>;
-var winH = =intval($CUser->Data['height']);?>;
-var my_access = =intval($CUser->Data['access']);?>;
-var initView = =intval($CUser->Data['last_content_view']);?>;
-var content_lvl0 = -1;
-var content_lvl1 = -1;
-var content_lvl2 = -1;
-var content_lvl3 = -1;
+var ap_title='=$AP_DATA['name'];?>';
+var winW==intval($CUser->Data['width']);?>;
+var winH==intval($CUser->Data['height']);?>;
+var my_access==intval($CUser->Data['access']);?>;
+var initView==intval($CUser->Data['last_content_view']);?>;
+var content_lvl0= -1;
+var content_lvl1= -1;
+var content_lvl2= -1;
+var content_lvl3= -1;
var SoundMode = 2;
var PanelW = winW;
var PanelH = winH-90;
@@ -29,6 +29,26 @@ var nodeTHREEanimationId = 0;
var serverIsOnLine = false;
var SelectedSensor = 0;
+var MAP_ID = =$AP_DATA['map_id'];?>;
+var MAP_IS_LOCAL = =($AP_DATA['map_id']!=0)?$AP_DATA['local_binding']:0;?>;
+var MAP_SET=Query( $QS );
+ if( count( $R ) ){
+ $MD=$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']='© OpenStreetMap contributors';
+ $MD['maxNativeZoom']=18;
+ $MD['maxZoom']=24;
+ };
+ echo json_encode( $MD );
+?>;
+
Data['ss_timeout']) ){
?>
diff --git a/lib/javascript/jsapi_dynamic/mojo_map.js b/lib/javascript/jsapi_dynamic/mojo_map.js
index f1e2452..3108496 100644
--- a/lib/javascript/jsapi_dynamic/mojo_map.js
+++ b/lib/javascript/jsapi_dynamic/mojo_map.js
@@ -7,6 +7,31 @@ var map = null;
var map_ed = null;
var markers = [];
+var mapListStore = new Ext.data.JsonStore({
+ root: 'maps',
+ totalProperty: 'totalCount',
+ idProperty: 'map_id',
+ remoteSort: false,
+ baseParams: {
+ UID: '=$CUser->Data['id'];?>',
+ SID: '=$Session;?>'//,
+ //SITE: =$SiteID;?>
+
+ },
+ fields: [{
+ name: 'map_id',
+ type: 'int'
+ },{
+ name: 'map_name',
+ type: 'string'
+ }],
+ proxy : new Ext.data.HttpProxy({
+ method: 'POST',
+ prettyUrls: false,
+ url: '/lib/controller/listMaps.php'
+ })
+});
+
var selectedMarkerIcon = L.icon({
iconUrl: '/style/assets/cursor.png',
iconSize: [32, 32],
@@ -252,8 +277,61 @@ function LoadMapEventsZ( Mode ){
});
};
-
function initMapMonitoring(){
+ var aK = true;
+ if( MAP_SET.attribution == '' ) aK = false;
+ var mapLayers = [];
+
+ if( map != null ){
+ map.off();
+ map.remove();
+ };
+ if( MAP_SET.type == 1 ){
+ map = L.map( 'event_map',{
+ //attributionControl: aK,
+ attributionControl: false,
+ preferCanvas: true,
+ zoomControl: true,
+ center: [SiteLat, SiteLon],
+ /*zoomControl: false,
+ zoom: 17,
+ minZoom: 17,
+ maxZoom: 17,*/
+ keyboard: false
+ });
+ //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
+ // attribution: MAP_SET.attribution,
+ // maxNativeZoom: MAP_SET.maxNativeZoom,
+ // maxZoom: MAP_SET.maxZoom
+ //});
+ L.tileLayer( MAP_SET.layer_url, {
+ attribution: MAP_SET.attribution,
+ attributionControl: false,
+ maxNativeZoom: MAP_SET.maxNativeZoom,
+ minZoom: 0,
+ maxZoom: MAP_SET.maxZoom
+ }).addTo( map );
+ } else {
+ map = L.map( 'event_map',{
+ crs: L.CRS.Simple,
+ attributionControl: false,
+ preferCanvas: true,
+ zoomControl: true,
+ center: [SiteLat, SiteLon],
+ /*zoomControl: false,*/
+ zoom: 0,
+ minZoom: 0,
+ maxZoom: 4,
+ keyboard: false
+ });
+ var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
+ var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map );
+ }
+ map.setView([SiteLat, SiteLon], 17 );
+ loadMapZones( 0 );
+};
+
+function initMapMonitoring_00(){
map = L.map('event_map',{
attributionControl: true,
//preferCanvas: true,
@@ -352,14 +430,14 @@ function updateLocation( e ){
locationSelectedNode = e.target.options.mycustomid;
Ext.Ajax.request({
url: '/lib/controller/updateLocation.php',
- params: {
- NODE: locationSelectedNode,
- SITE: =$SiteID;?>,
- UID: =$UserID;?>,
- TYPE: 0,
- SID: '=$Session;?>',
- LAT: e.target._latlng.lat,
- LON: e.target._latlng.lng
+ params: {
+ NODE: locationSelectedNode,
+ SITE: =$SiteID;?>,
+ UID: =$UserID;?>,
+ TYPE: 0,
+ SID: '=$Session;?>',
+ LAT: e.target._latlng.lat,
+ LON: e.target._latlng.lng
},
success: function( response, opts ){
loadNodeLocationProps( locationSelectedNode );
@@ -418,7 +496,7 @@ function setNodeLocationToAnchor(){
ALT: SiteAlt
},
success: function( response, opts ){
- loadLocationEditor();
+ loadLocationEditor('sys_location_map');
},
failure: failureAJAXFunction
});
@@ -441,7 +519,7 @@ function setNodeLocationByDelta(){
ALT: dz
},
success: function( response, opts ){
- loadLocationEditor();
+ loadLocationEditor('sys_location_map');
},
failure: failureAJAXFunction
});
@@ -558,7 +636,9 @@ function loadLocationNodes(){
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
- for( i=0; i < data.length; i++){
+ var i = 0;
+ var tall = Array();
+ for( ; i < data.length; i++){
switch( data[i].type ){
case 1:{
markers[i] = L.marker([data[i].lat, data[i].lon], {draggable: true,icon: ALS_Icon, mycustomid:data[i].id } ).addTo( map_ed ).on('click', loadLoactionProps ).on('dblclick', markerDblClick ).on('dragend', updateLocation );
@@ -595,8 +675,11 @@ function loadLocationNodes(){
break;
};
};
- //bindPopup('A pretty CSS3 popup.
Easily customizable.');//.openPopup();
+ tall[i] = markers[i];
};
+ tall[i++] = ed_anchor;
+ var cVisible = L.featureGroup( tall );
+ map_ed.flyToBounds( cVisible.getBounds() );
},
failure: function( response, opts ) {
//var tPanel = Ext.getCmp('main_portal');
@@ -783,7 +866,6 @@ function LoadNodesList(){
SID: '=$Session;?>'
},
success: function( response, opts ){
- // If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
var tPanel = Ext.getCmp('prop_content');
tPanel.remove(0);
@@ -794,8 +876,29 @@ function LoadNodesList(){
});
};
-
-function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
+function reloadSiteMapData(){
+ Ext.Ajax.request({
+ url: '/lib/controller/getMapData.php',
+ params: {
+ SITE: =$SiteID;?>,
+ UID: =$UserID;?>,
+ SID: '=$Session;?>'
+ },
+ success: function( response, opts ){
+ var data = Ext.decode(response.responseText);
+ MAP_ID = parseInt( data.selected_map );
+ MAP_IS_LOCAL = (MAP_ID)?data.local_binding:false;
+ MAP_SET = data.maps;
+ Ext.getCmp('lab_123').update( '=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> '+((MAP_IS_LOCAL)?'Pos X':'=$Labels->GetLabel('_LON_SHORT_LBL_');?>')+':' );
+ Ext.getCmp('lab_124').update( ((MAP_IS_LOCAL)?'Pos Y':'=$Labels->GetLabel('_LAT_SHORT_LBL_');?>')+':' );
+ document.getElementById('lab_125').src = ((MAP_IS_LOCAL)?'/style/assets/map_mode_decart.png':'/style/assets/map_mode_wgs84.png');
+ loadLocationEditor('sys_location_map');
+ },
+ failure: failureAJAXFunction
+ });
+};
+var ed_anchor = null;
+function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
if( tlInterval!= null ){
window.clearInterval( tlInterval );
tlInterval = null;
@@ -805,26 +908,64 @@ function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
if( lat == undefined ){
lat = SiteLat;
lon = SiteLon;
+ };
+ //var cMSET = mapListStore.getAt( MAP_ID );
+ //alert( MAP_SET.id );
+ var aK = true;
+ if( MAP_SET.attribution == '' ) aK = false;
+ var mapLayers = [];
+
+ if( map_ed != undefined ){
+ map_ed.off();
+ map_ed.remove();
};
-
- map_ed = L.map( el_id,{
- attributionControl: true,
- //preferCanvas: true,
- zoomControl: true,
- center: [SiteLat, SiteLon],
- /*zoomControl: false,
- zoom: 17,
- minZoom: 17,
- maxZoom: 17,*/
- keyboard: false
- }).setView([SiteLat, SiteLon], 17);
+ if( MAP_SET.type == 1 ){
+ map_ed = L.map( el_id,{
+ attributionControl: aK,
+ //preferCanvas: true,
+ zoomControl: true,
+ center: [SiteLat, SiteLon],
+ /*zoomControl: false,
+ zoom: 17,
+ minZoom: 17,
+ maxZoom: 17,*/
+ keyboard: false
+ });
+ //mapLayers[ MAP_SET.name ] = L.tileLayer( MAP_SET.layer_url, {
+ // attribution: MAP_SET.attribution,
+ // maxNativeZoom: MAP_SET.maxNativeZoom,
+ // maxZoom: MAP_SET.maxZoom
+ //});
+ L.tileLayer( MAP_SET.layer_url, {
+ attribution: MAP_SET.attribution,
+ maxNativeZoom: MAP_SET.maxNativeZoom,
+ minZoom: 0,
+ maxZoom: MAP_SET.maxZoom
+ }).addTo( map_ed );
+ } else {
+ map_ed = L.map( el_id,{
+ crs: L.CRS.Simple,
+ attributionControl: false,
+ preferCanvas: true,
+ zoomControl: true,
+ center: [SiteLat, SiteLon],
+ /*zoomControl: false,*/
+ zoom: 0,
+ minZoom: 0,
+ maxZoom: 4,
+ keyboard: false
+ });
+ var bounds = [[MAP_SET.bounds_lx,MAP_SET.bounds_ly], [MAP_SET.bounds_rx,MAP_SET.bounds_ry]];
+ var image = L.imageOverlay( '/lib/controller/data/assets/images/'+MAP_SET.layer_url, bounds ).addTo( map_ed );
+ }
+ map_ed.setView([SiteLat, SiteLon], MAP_SET.maxZoom);
if( node_type ){
- L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).bindPopup("=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?>");//.openPopup();
+ ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).bindPopup("=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?>");//.openPopup();
} else {
- L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).on('click', LoadNodesList ).bindPopup("=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?>");//.openPopup();
+ ed_anchor = L.marker([SiteLat, SiteLon], { draggable: false, icon: SITEZ_Icon, zIndexOffset: 1000 } ).addTo(map_ed).on('click', LoadNodesList ).bindPopup("=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?>");//.openPopup();
};
- var mapLayers = [];
+ /*
mapLayers["MyMap"] = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors',
maxNativeZoom: 18,
@@ -872,7 +1013,7 @@ function loadLocationEditor( el_id , node_type, node_id, lat, lon ){
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo( map_ed );
-
+ */
if( node_type ){
switch( node_type ){
case 1:{
@@ -919,19 +1060,49 @@ function updateSiteAnchor(){
SiteAlt = Ext.getCmp('siteAlt').getValue();
Ext.Ajax.request({
url: '/lib/controller/updateLocation.php',
- params: {
- SITE: =$SiteID;?>,
- UID: =$UserID;?>,
- TYPE: 1,
- SID: '=$Session;?>',
- LAT: SiteLat,
- LON: SiteLon,
- ALT: SiteAlt
- },
- failure: failureAJAXFunction
+ params: {
+ SITE: =$SiteID;?>,
+ UID: =$UserID;?>,
+ TYPE: 1,
+ SID: '=$Session;?>',
+ LAT: SiteLat,
+ LON: SiteLon,
+ ALT: SiteAlt
+ },
+ success: function(){
+ loadLocationEditor('sys_location_map');
+ },
+ failure: failureAJAXFunction
});
};
+function updateSiteMap(){
+ MAP_ID = Ext.getCmp('siteMap').getValue();
+ Ext.Ajax.request({
+ url: '/lib/controller/updateLocation.php',
+ params: {
+ SITE: =$SiteID;?>,
+ UID: =$UserID;?>,
+ TYPE: 4,
+ SID: '=$Session;?>',
+ MID: MAP_ID
+ },
+ success: function( response, opts ){
+ reloadSiteMapData();
+ },
+ failure: failureAJAXFunction
+ });
+};
+
+var mapDataLoadded = false;
+// Call this to prepare all data once in Session
+function prepareMapData(){
+ //if( ap_type == 1 ) return;//Metro No Map ...
+ if( !mapDataLoadded ){
+ mapListStore.load();
+ };
+};
+
function updateLocationOrientation(){
var tLat = Ext.getCmp('slat').getValue();
var tLon = Ext.getCmp('slon').getValue();
@@ -1015,7 +1186,7 @@ function markerDblClick( e ){
};
};
};
-
+/*
function setNodeLocationToAnchor(){
Ext.Ajax.request({
url: '/lib/controller/updateLocation.php',
@@ -1030,7 +1201,7 @@ function setNodeLocationToAnchor(){
ALT: SiteAlt
},
success: function( response, opts ){
- loadLocationEditor();
+ loadLocationEditor('sys_location_map');
},
failure: failureAJAXFunction
});
@@ -1058,3 +1229,582 @@ function setNodeLocationByDelta(){
failure: failureAJAXFunction
});
};
+*/
+var mapCreatorWindow = null;
+
+function createNewMap(){
+ if( mapCreatorWindow == null ){
+ mapCreatorWindow = new Ext.Window({
+ width: 800,
+ height: 440,
+ title: 'Creeate Custom Map',
+ modal: true,
+ frame: true,
+ border: false,
+ resizable: false,
+ items: [{
+ xtype: 'tabpanel',
+ id: 'mcr_tbp',
+ activeTab: 0,
+ items:[{
+ xtype: 'form',
+ title: 'Internet Map',
+ id: 'map_map_frm',
+ labelWidth: 250,
+ labelAlign: 'right',
+ height: 350,
+ items:[{
+ xtype: 'textfield',
+ fieldLabel: 'Map Name',
+ name: 'map_name',
+ width: 540,
+ },{
+ xtype: 'hidden',
+ name: 'ctype',
+ value: 1
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Tiles URL Pattern',
+ name: 'map_url',
+ width: 540,
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Layer Attribution',
+ name: 'map_attr',
+ width: 540,
+ },{
+ xtype: 'textarea',
+ fieldLabel: 'Description',
+ name: 'map_desc',
+ width: 540,
+ },{
+ xtype: 'combo',
+ fieldLabel: 'Max Zoom',
+ name: 'map_maxz',
+ editable: false,
+ typeAhead: true,
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '18',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ },{
+ xtype: 'combo',
+ fieldLabel: 'Max Native Zoom',
+ name: 'map_maxnz',
+ editable: false,
+ typeAhead: true,
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '16',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ }]
+ },{
+ xtype: 'form',
+ title: 'Local Picture Map',
+ id: 'map_pic_frm',
+ fileUpload: true,
+ height: 350,
+ //autoHeight: true,
+ //bodyStyle: 'padding: 10px 10px 0 10px;',
+ labelWidth: 250,
+ labelAlign: 'right',
+ defaults: {
+ //anchor: '95%',
+ //allowBlank: false,
+ msgTarget: 'side'
+ },
+ items: [{
+ xtype: 'textfield',
+ fieldLabel: '=$Labels->GetLabel('_MAP_NAME_');?>',
+ id: 'map_name_2',
+ name: 'map_name',
+ width: 540
+ },{
+ xtype: 'hidden',
+ name: 'ctype',
+ value: 2
+ },{
+ xtype: 'fileuploadfield',
+ id: 'form-file',
+ emptyText: '=$Labels->GetLabel('_SELE_ANIMAGE_');?>',
+ fieldLabel: '=$Labels->GetLabel('_MAP_PICTURE_');?>',
+ width: 500,
+ name: 'map_image',
+ buttonText: '=$Labels->GetLabel('_BROWSE_');?>'
+ },{
+ xtype: 'textfield',
+ fieldLabel: '=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
+ name: 'map_attr',
+ width: 540,
+ },{
+ xtype: 'textarea',
+ fieldLabel: '=$Labels->GetLabel('_DESCRIPTION_');?>',
+ name: 'map_desc',
+ width: 540,
+ },{
+ xtype: 'combo',
+ fieldLabel: '=$Labels->GetLabel('_MAX_ZOOM_');?>',
+ editable: false,
+ typeAhead: true,
+ name: 'map_maxz',
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '16',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ },{
+ xtype: 'combo',
+ fieldLabel: '=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
+ editable: false,
+ typeAhead: true,
+ name: 'map_maxnz',
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '16',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_TOP_PIC_BOUND_');?>',
+ name: 'map_tpb',
+ value: 0,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_LEFT_PIC_BOUND_');?>',
+ name: 'map_lpb',
+ value: 0,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_RIGHT_PIC_BOUND_');?>',
+ name: 'map_rpb',
+ value: 0,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_BOT_PIC_BOUND_');?>',
+ name: 'map_bpb',
+ value: 0,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_MAP_WIDTH_');?>',
+ name: 'map_width',
+ decimalPrecision: 2,
+ value: 1000.00,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_MAP_HEIGHT_');?>',
+ name: 'map_heigth',
+ decimalPrecision: 2,
+ value: 1000.00,
+ width: 540,
+ }]
+ }]
+ }],
+ bbar:[ '->',{
+ text: '=$Labels->GetLabel('_CANCEL_');?>',
+ handler: function(){
+ //Ext.getCmp('map_map_frm').getForm().reset();
+ //Ext.getCmp('map_pic_frm').getForm().reset();
+ mapCreatorEditorWindow.destroy();
+ }
+ },{
+ text: '=$Labels->GetLabel('_CREATE_NEW_LBL_');?>',
+ handler: function(){
+ var tt = Ext.getCmp('mcr_tbp').getActiveTab();
+ if( tt.id == 'map_map_frm' ){
+ if( Ext.getCmp('map_map_frm').getForm().isValid()){
+ Ext.getCmp('map_map_frm').getForm().submit({
+ url: '/lib/controller/addMap.php',
+ waitMsg: 'Uploading Data...',
+ encoding: 'multipart/form-data',
+ success: function(fp, o){
+ //msg('Success', 'Processed file "'+o.result.file+'" on the server');
+ alert('Processed file on the server');
+ }
+ });
+ };
+ } else {
+ if( Ext.getCmp('map_pic_frm').getForm().isValid()){
+ Ext.getCmp('map_pic_frm').getForm().submit({
+ url: '/lib/controller/addMap.php',
+ waitMsg: 'Uploading Image...',
+ encoding: 'multipart/form-data',
+ success: function(fp, o){
+ //msg('Success', 'Processed file "'+o.result.file+'" on the server');
+ alert('Processed file on the server');
+ }
+ });
+ };
+ };
+ }
+ }],
+ listeners:{
+ beforedestroy: function(){
+ mapCreatorEditorWindow = null;
+ }
+ }
+ });
+ };
+ mapCreatorWindow.show();
+};
+
+var mapEditorWindow = null;
+function editCurrentMap(){
+ Ext.Ajax.request({
+ url: '/lib/controller/getMapData.php',
+ params: {
+ SITE: =$SiteID;?>,
+ UID: =$UserID;?>,
+ MID: MAP_ID
+ },
+ success: function( response, opts ){
+ var newMapData = Ext.decode( response.responseText );
+ if( mapEditorWindow == null ){
+ switch( newMapData.type ){
+ case 1:{
+ mapEditorWindow = new Ext.Window({
+ width: 800,
+ height: 440,
+ title: 'Edit Current Map',
+ modal: true,
+ //closeAction: 'hide',
+ frame: true,
+ border: false,
+ resizable: false,
+ items: [{
+ xtype: 'form',
+ id: 'map_map_frm',
+ labelWidth: 250,
+ labelAlign: 'right',
+ height: 350,
+ items:[{
+ xtype: 'textfield',
+ fieldLabel: 'Map Name',
+ id: 'map_name_1',
+ name: 'map_name',
+ width: 540,
+ },{
+ xtype: 'hidden',
+ name: 'ctype',
+ value: 1
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Tiles URL Pattern',
+ name: 'map_url',
+ width: 540,
+ },{
+ xtype: 'textfield',
+ fieldLabel: 'Layer Attribution',
+ name: 'map_attr',
+ width: 540,
+ },{
+ xtype: 'textarea',
+ fieldLabel: 'Description',
+ name: 'map_desc',
+ width: 540,
+ },{
+ xtype: 'combo',
+ fieldLabel: 'Max Zoom',
+ name: 'map_maxz',
+ editable: false,
+ typeAhead: true,
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '18',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ },{
+ xtype: 'combo',
+ fieldLabel: 'Max Native Zoom',
+ name: 'map_maxnz',
+ editable: false,
+ typeAhead: true,
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '16',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ }]
+ }],
+ bbar:[ '->',{
+ text: '=$Labels->GetLabel('_CANCEL_');?>',
+ handler: function(){
+ mapEditorWindow.destroy();
+ }
+ },{
+ text: '=$Labels->GetLabel('_APPLY_CHANGES_');?>',
+ handler: function(){
+ var tt = Ext.getCmp('mcr_tbp').getActiveTab();
+ if( tt.id == 'map_map_frm' ){
+ if( Ext.getCmp('map_map_frm').getForm().isValid()){
+ Ext.getCmp('map_map_frm').getForm().submit({
+ url: '/lib/controller/addMap.php',
+ waitMsg: 'Uploading Image...',
+ encoding: 'multipart/form-data',
+ success: function(fp, o){
+ //msg('Success', 'Processed file "'+o.result.file+'" on the server');
+ alert('Processed file on the server');
+ }
+ });
+ };
+ } else {
+ if( Ext.getCmp('map_pic_frm').getForm().isValid()){
+ Ext.getCmp('map_pic_frm').getForm().submit({
+ url: '/lib/controller/addMap.php',
+ waitMsg: 'Uploading Image...',
+ encoding: 'multipart/form-data',
+ success: function(fp, o){
+ //msg('Success', 'Processed file "'+o.result.file+'" on the server');
+ alert('Processed file on the server');
+ }
+ });
+ };
+ };
+ }
+ }],
+ listeners: {
+ beforedestroy: function(){
+ mapEditorWindow = null;
+ }
+ }
+ });
+ break;
+ };
+ default:{
+ mapEditorWindow = new Ext.Window({
+ width: 800,
+ height: 540,
+ title: 'Edit Current Map',
+ modal: true,
+ //closeAction: 'hide',
+ frame: true,
+ border: false,
+ resizable: false,
+ items: [{
+ xtype: 'form',
+ id: 'map_edt_frm',
+ height: 480,
+ //autoHeight: true,
+ //bodyStyle: 'padding: 10px 10px 0 10px;',
+ labelWidth: 250,
+ labelAlign: 'right',
+ defaults: {
+ //anchor: '95%',
+ //allowBlank: false,
+ msgTarget: 'side'
+ },
+ items:[{
+ xtype: 'spacer',
+ height: 6
+ },{
+ xtype: 'textfield',
+ fieldLabel: '=$Labels->GetLabel('_MAP_NAME_');?>',
+ name: 'map_name',
+ value: newMapData.name,
+ width: 540
+ },{
+ xtype: 'hidden',
+ name: 'MID',
+ value: newMapData.id
+ },{
+ xtype: 'panel',
+ frame: false,
+ border: false,
+ html: '
'
+ },{
+ xtype: 'textfield',
+ fieldLabel: '=$Labels->GetLabel('_LAYER_ATTRIB_');?>',
+ name: 'map_attr',
+ value: newMapData.attribution,
+ width: 540,
+ },{
+ xtype: 'textarea',
+ fieldLabel: '=$Labels->GetLabel('_DESCRIPTION_');?>',
+ name: 'map_desc',
+ value: newMapData.desc,
+ width: 540,
+ },{
+ xtype: 'combo',
+ fieldLabel: '=$Labels->GetLabel('_MAX_ZOOM_');?>',
+ editable: false,
+ typeAhead: true,
+ name: 'map_maxz',
+ value: newMapData.maxZoom,
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '16',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ },{
+ xtype: 'combo',
+ fieldLabel: '=$Labels->GetLabel('_MAX_NATURAL_ZOOM_');?>',
+ editable: false,
+ typeAhead: true,
+ name: 'map_maxnz',
+ value: newMapData.maxNativeZoom,
+ triggerAction: 'all',
+ width: 100,
+ lazyRender:true,
+ mode: 'local',
+ store: new Ext.data.ArrayStore({
+ fields: ['zoom_l'],
+ data: [['16'], ['17'],['18'],['19'],['20'],['21'],['22'],['23'],['24'],['25'],['26'],['27'],['28']]
+ }),
+ value: '16',
+ valueField: 'zoom_l',
+ displayField: 'zoom_l'
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_TOP_PIC_BOUND_');?>',
+ name: 'map_tpb',
+ value: newMapData.img_tb,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_LEFT_PIC_BOUND_');?>',
+ name: 'map_lpb',
+ value: newMapData.img_lb,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_RIGHT_PIC_BOUND_');?>',
+ name: 'map_rpb',
+ value: newMapData.img_rb,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_BOT_PIC_BOUND_');?>',
+ name: 'map_bpb',
+ value: newMapData.img_bb,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_MAP_WIDTH_');?>',
+ name: 'map_width',
+ decimalPrecision: 2,
+ value: newMapData.img_map_w,
+ width: 540,
+ },{
+ xtype: 'numberfield',
+ fieldLabel: '=$Labels->GetLabel('_MAP_HEIGHT_');?>',
+ name: 'map_height',
+ decimalPrecision: 2,
+ value: newMapData.img_map_h,
+ width: 540,
+ },{
+ xtype: 'panel',
+ frame: false,
+ border: false,
+ layout: 'table',
+ layoutConfig: {
+ columns: 5
+ },
+ items:[{
+ xtype: 'spacer',
+ width: 250,
+ html: '=$Labels->GetLabel('_MAP_CENTER_MODE_');?>:
'
+ },{
+ xtype: 'radio',
+ name: 'bounds_mode',
+ value: 0,
+ checked: ( newMapData.bounds_mode == 0 ),
+ fieldLabel: '',
+ },{
+ width: 80,
+ html: '
'
+ },{
+ xtype: 'radio',
+ name: 'bounds_mode',
+ checked: ( newMapData.bounds_mode == 1 ),
+ value: 1,
+ fieldLabel: '',
+ },{
+ html: '
'
+ }]
+ }]
+ }],
+ bbar:[ '->',{
+ text: '=$Labels->GetLabel('_CANCEL_');?>',
+ handler: function(){
+ mapEditorWindow.destroy();
+ }
+ },{
+ text: '=$Labels->GetLabel('_APPLY_CHANGES_');?>',
+ handler: function(){
+ if( Ext.getCmp('map_edt_frm').getForm().isValid()){
+ Ext.getCmp('map_edt_frm').getForm().submit({
+ url: '/lib/controller/updateMap.php',
+ waitMsg: 'Uploading Image...',
+ encoding: 'multipart/form-data',
+ success: function(fp, o){
+ //msg('Success', 'Processed file "'+o.result.file+'" on the server');
+ alert('Processed file on the server');
+ }
+ });
+ };
+ }
+ }],
+ listeners: {
+ beforedestroy: function(){
+ mapEditorWindow = null;
+ }
+ }
+ });
+ break;
+ };
+ };
+
+ };
+ mapEditorWindow.show();
+ },
+ failure: failureAJAXFunction
+ });
+};
\ No newline at end of file
diff --git a/lib/javascript/jsapi_dynamic/mojo_settings.js b/lib/javascript/jsapi_dynamic/mojo_settings.js
index f60501e..a8ba2af 100644
--- a/lib/javascript/jsapi_dynamic/mojo_settings.js
+++ b/lib/javascript/jsapi_dynamic/mojo_settings.js
@@ -2060,6 +2060,10 @@ function showSettingsApplication(){
stopStatusUpdater();
content_lvl1 = 1;
content_lvl2 = 3;
+ //Load Location
+ prepareMapData();
+
+
var tPanel = Ext.getCmp('main_content');
tPanel.removeAll( true );
tPanel.add({
@@ -2277,7 +2281,7 @@ function showSettingsApplication(){
html: ' ',
listeners:{
afterrender: function( t, state ){
- loadLocationEditor( 'sys_location_map' );
+ loadLocationEditor('sys_location_map');
}
}
//}
@@ -2290,27 +2294,29 @@ function showSettingsApplication(){
},
layoutConfig: {
// The total column count must be specified here
- columns: 7,
+ columns: 8,
textAlign: 'center'
},
items:[{
border: false,
- html: '=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> =$Labels->GetLabel('_LAT_SHORT_LBL_');?>:'
+ id: 'lab_123',
+ html: '=$Labels->GetLabel('_SYS_ANCHORT_LBL_');?> '+((MAP_IS_LOCAL)?'Pos X':'=$Labels->GetLabel('_LON_SHORT_LBL_');?>')+':'
},{
xtype: 'numberfield',
- id: 'siteLat',
- decimalPrecision: 8,
width: 100,
- value: SiteLat
+ decimalPrecision: 8,
+ id: 'siteLon',
+ value: SiteLon
},{
border: false,
- html: '=$Labels->GetLabel('_LON_SHORT_LBL_');?>:'
+ id: 'lab_124',
+ html: ((MAP_IS_LOCAL)?'Pos Y':'=$Labels->GetLabel('_LAT_SHORT_LBL_');?>')+':'
},{
xtype: 'numberfield',
- width: 100,
+ id: 'siteLat',
decimalPrecision: 8,
- id: 'siteLon',
- value: SiteLon
+ width: 100,
+ value: SiteLat
},{
border: false,
html: '=$Labels->GetLabel('_ALT_SHORT_LBL_');?>:'
@@ -2324,6 +2330,12 @@ function showSettingsApplication(){
xtype: 'button',
text: '=$Labels->GetLabel('_UPDATE_LBL_');?>',
handler: updateSiteAnchor
+ },{
+ xtype: 'panel',
+ frame: false,
+ border: false,
+ rowspan: 2,
+ html: ((MAP_IS_LOCAL)?'
':'
')
},{
border: false,
html: '=$Labels->GetLabel('_MAP_TYP_LBL_');?>:'
@@ -2344,22 +2356,47 @@ function showSettingsApplication(){
disabled: false,
typeAhead: true,
triggerAction: 'all',
+ id: 'siteMap',
lazyRender:true,
- colspan: 5,
+ colspan: 3,
mode: 'local',
- store: new Ext.data.ArrayStore({
+ store: mapListStore /*new Ext.data.ArrayStore({
id: 0,
fields: ['map_id', 'map_text' ],
data: [[1, 'OpenStreetMap'], [2, 'OpenTopoMap'], [3, 'EsriSat'], [4, 'EsriStreet'], [5, 'EsriTopo']]
- }),
+ })*/,
+ value: MAP_ID,
valueField: 'map_id',
- displayField: 'map_text'
+ displayField: 'map_name',
+ listeners:{
+ select: function(){
+ updateSiteMap();
+ LoadNodesList();
+ }
+ }
+ },{
+ xtype: 'button',
+ disabled: false,
+ text: '=$Labels->GetLabel('_EDIT_');?>',
+ handler: function(){
+ editCurrentMap();
+ }
+ },{
+ xtype: 'button',
+ disabled: false,
+ text: '=$Labels->GetLabel('_DELETE_');?>',
+ handler: function(){
+ deleteCurrentMap();
+ }
},{
xtype: 'button',
id: 'add-c_map-btn',
- disabled: true,
- text: '=$Labels->GetLabel('_CREATE_NEW_LBL_');?>'
+ disabled: false,
+ text: '=$Labels->GetLabel('_CREATE_NEW_LBL_');?>',
+ handler: function(){
+ createNewMap();
+ }
}]
}]
},{
diff --git a/lib/js_asm.php b/lib/js_asm.php
index bfb5919..33c1bb2 100644
--- a/lib/js_asm.php
+++ b/lib/js_asm.php
@@ -61,8 +61,13 @@ if( isset($_GET['Lang'])){
$UCL=$_GET['Lang']/1;
if ($UCL) $_SESSION['userlang']=$UCL; else $_SESSION['userlang']=$UserLang;
}
-if( isset($_SESSION['userlang']) )$Labels=new Language($_SESSION['userlang']);//, '_js');
-else $Labels=new Language( $UserLang );//, '_js');
+
+$LDB = new SQLite_DB( '/srv/www/web/lib/controller/data/language.db');
+if( isset($_SESSION['userlang']) ){
+ $Labels=new Language( $_SESSION['userlang'],'', $LDB );
+} else {
+ $Labels=new Language( $UserLang ,'', $LDB );
+};
if( $UserLang == 3 || $UserLang == 255 ){
$RTL_SITE = true;
diff --git a/lib/php/db/language_class.php b/lib/php/db/language_class.php
index 364afa1..88581c5 100644
--- a/lib/php/db/language_class.php
+++ b/lib/php/db/language_class.php
@@ -1,25 +1,32 @@
Labels=array();
$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'];
}
function GetLabel($LabelKey){
- //global $Labels;
if (isset($this->Labels[$LabelKey])){
return $this->Labels[$LabelKey];
} else return $LabelKey;
}
- function AddLabel($LabelKey, $LabelText, $LanguageID)
+ function AddLabel($LabelKey, $LabelText, $LanguageID, $DBM = null )
{
global $DATABASE;
$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);
+ };
}
};
diff --git a/style/assets/anchor_sys-1.psd b/style/assets/anchor_sys-1.psd
new file mode 100644
index 0000000..941189e
Binary files /dev/null and b/style/assets/anchor_sys-1.psd differ
diff --git a/style/assets/cust_map_cord_sys-0.png b/style/assets/cust_map_cord_sys-0.png
new file mode 100644
index 0000000..e18c20a
Binary files /dev/null and b/style/assets/cust_map_cord_sys-0.png differ
diff --git a/style/assets/cust_map_cord_sys-1.png b/style/assets/cust_map_cord_sys-1.png
new file mode 100644
index 0000000..47c9fe9
Binary files /dev/null and b/style/assets/cust_map_cord_sys-1.png differ
diff --git a/style/assets/map_mode_decart.png b/style/assets/map_mode_decart.png
new file mode 100644
index 0000000..00faef3
Binary files /dev/null and b/style/assets/map_mode_decart.png differ
diff --git a/style/assets/map_mode_wgs84.png b/style/assets/map_mode_wgs84.png
new file mode 100644
index 0000000..d7d6ae8
Binary files /dev/null and b/style/assets/map_mode_wgs84.png differ