diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bdf6ba9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +error.log diff --git a/index.php b/index.php index 150863d..247e859 100644 --- a/index.php +++ b/index.php @@ -4,19 +4,22 @@ if( $CUser->Data['access'] > 5 ){ UI_PageHeaderExt( 'rgoose_general.js', - array( + array( + 'rgoose_global_vars.js', 'rgoose_swupgrade.js', 'rgoose_map.js', 'rgoose_reports.js', 'rgoose_devices.js', 'rgoose_cameras.js', 'rgoose_modules.js', - 'rgoose_sysmap_editor.js', + 'mojo_monitoring.js', + //'rgoose_sysmap_editor.js', 'rgoose_location_editor.js', 'rgoose_dashboard.js', 'rgoose_users.js', 'rgoose_logs.js', 'rgoose_single_ipi.js', + 'mojo_settings.js', 'rgoose_main.js' ) ); diff --git a/lib/ajax_asm.php b/lib/ajax_asm.php index bf2569f..e5bef5a 100644 --- a/lib/ajax_asm.php +++ b/lib/ajax_asm.php @@ -4,7 +4,7 @@ require_once('settings.php'); require_once('defines.php'); // SET DATA CONNECTION AND GLOBAL USER VARIABLES -$TT_123 = explode( '.', PHP_VERSION ); +/*$TT_123 = explode( '.', PHP_VERSION ); if( $TT_123[0] == '4' ){ require_once( 'php/db/MySQL_class.php' ); $DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword); @@ -14,6 +14,9 @@ if( $TT_123[0] == '4' ){ } else { exit(); }; +*/ +require_once( 'php/db/SQLite_Class.php'); +$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db'); //$DATABASE->SetCacheDir( $DBCacheDir ); @@ -24,7 +27,7 @@ require_once('php/db/user_class.php'); require_once('php/auth/web.php'); require_once('php/db/language_class.php'); require_once('php/sys/r-goose_sys.php'); -require_once('php/argus/argus.php'); +require_once('php/argus/mojo.php'); diff --git a/lib/assembler.php b/lib/assembler.php index 63e54e1..cde2b1a 100644 --- a/lib/assembler.php +++ b/lib/assembler.php @@ -4,6 +4,7 @@ require_once('settings.php'); require_once('defines.php'); // SET DATA CONNECTION AND GLOBAL USER VARIABLES +/* $TT_123 = explode( '.', PHP_VERSION ); if( $TT_123[0] == '4' ){ require_once( 'php/db/MySQL_class.php' ); @@ -14,6 +15,10 @@ if( $TT_123[0] == '4' ){ } else { exit(); }; +*/ + +require_once( 'php/db/SQLite_Class.php'); +$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db'); $str = @file_get_contents('/proc/uptime'); $num = floatval($str); diff --git a/lib/controller/addModule.php b/lib/controller/addModule.php new file mode 100644 index 0000000..dd92a54 --- /dev/null +++ b/lib/controller/addModule.php @@ -0,0 +1,72 @@ +Data['id'] ); + $ACCESS = intval($CUser->Data['access'] ); + if( $UID > 1 && $ACCESS > 4 ){ + $Data['status'] = 'nok'; + $T = intval( $_POST['TYPE'] ); + if( $T ){ + $QS = "SELECT * FROM `module_types` WHERE `id`={$T}"; + $ZZ = $DATABASE->Query( $QS ); + if( count( $ZZ ) ){ + $CTI = $ZZ[0]; + $ADE = true; + if( intval( $CTI['allow_multiply'] ) == 0 ){ + $QS = "SELECT * FROM `modules` WHERE `type`={$T}"; + $SS = $DATABASE->Query( $QS ); + if( count( $SS ) ){ + $ADE = false; + $Data['msg'] = 'This type of Module can be added only Once!'; + }; + }; + if( $ADE ){ + $QAS = "INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES({$T},0,0);"; + $DATABASE->Query( $QAS ); + $MID = $DATABASE->getLastInsertID(); + $MCID = 0; + switch( $T ){ + case 3:{ + //Kafka + $QS = "INSERT INTO `module_kafka`(`brocker_port`) VALUES(2929)"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + $QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + break; + }; + case 6:{ + //SSDP + $QS = "INSERT INTO `module_ssdp`(`serial_number`) VALUES('2929')"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + $QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + break; + }; + case 9:{ + //EmbedVido + $QS = "INSERT INTO `module_eve`(`web_port`) VALUES(8972)"; + $DATABASE->Query( $QS ); + $MCID = $DATABASE->getLastInsertID(); + $QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $DATABASE->Query( $QS ); + break; + }; + }; + $Data['status'] = 'ok'; + //$fd = fopen( "debug.txt", "a+" ); + //fprintf( $fd, $DATABASE->getDebugLog() ); + //fclose( $fd ); + //$Data['dblog'] = $DATABASE->getDebugLog(); + }; + } else { + $Data['msg'] = 'Wrong Module Type is supplied!'; + }; + } else { + $Data['msg'] = 'No Module Type is supplied!'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/addNetworkNode.php b/lib/controller/addNode.php similarity index 92% rename from lib/controller/addNetworkNode.php rename to lib/controller/addNode.php index bfcfa4a..d39aa2e 100644 --- a/lib/controller/addNetworkNode.php +++ b/lib/controller/addNode.php @@ -3,14 +3,10 @@ if( $CUser->Data['id'] > 1 ){ $Data['success'] = false; - if( $CUser->Data['access'] > 5 ){ - if( isset($_POST['SITEID']) ) $SiteID = intval($_POST['SITEID']); else $SiteID = 0; - if( isset($_POST['SRVID']) ) $ServerID = intval($_POST['SRVID']); else $ServerID = 0; - if( $ServerID == 0 && isset($_POST['SERVER']) ) $ServerID = intval($_POST['SERVER']); - if( $ServerID == 0 && isset($_POST['UART']) ) $ServerID = getServerIdByUartId( intval($_POST['UART']) ); + if( $CUser->Data['access'] > 5 ){ if( isset($_POST['TYPE']) ) $NodeType = intval($_POST['TYPE']); else $NodeType = 0; - if( $SiteID && $ServerID && $NodeType ){ - $ServerNODE = getServerNode( $ServerID ); + if( $NodeType ){ + $ServerNODE = getServerNode( 1 ); if( $ServerNODE ){ switch( $NodeType ){ case ARGUS_ALS_SENSOR: @@ -128,7 +124,7 @@ if(isset($_POST['PROTOID'])) $PROTOID = intval( $_POST['PROTOID'] ); else $PROTOID = 0; if(isset($_POST['LAB'])) $CNAME = $DATABASE->escape($_POST['LAB']); else $CNAME = ''; if( $CamID && $CSTR && $CNAME!='' ){ - $Data['success'] = addIpPtzCamera( $SiteID, $ServerID, $CNAME, $CamID, $CSTR, $IMSIZE, $LFL, $ZOOM, $PANMODE, $PANANG, $TILTMODE, $TILTANG, $PTZ, $PROTOID, $UART ); + $Data['success'] = addIpPtzCamera( $CNAME, $CamID, $CSTR, $IMSIZE, $LFL, $ZOOM, $PANMODE, $PANANG, $TILTMODE, $TILTANG, $PTZ, $PROTOID, $UART ); if( !$Data['success'] ){ $Data['msg'] = $Labels->GetLabel('NODE_CREA_ERROR'); }; diff --git a/lib/controller/data/factory.db b/lib/controller/data/factory.db new file mode 100644 index 0000000..d6a8921 Binary files /dev/null and b/lib/controller/data/factory.db differ diff --git a/lib/controller/data/mysqlitedb.db b/lib/controller/data/mysqlitedb.db new file mode 100644 index 0000000..77a7a87 Binary files /dev/null and b/lib/controller/data/mysqlitedb.db differ diff --git a/lib/controller/data/mysqlitedb.sqbpro b/lib/controller/data/mysqlitedb.sqbpro new file mode 100644 index 0000000..ddfc6e7 --- /dev/null +++ b/lib/controller/data/mysqlitedb.sqbpro @@ -0,0 +1 @@ + diff --git a/lib/controller/data/reports.db b/lib/controller/data/reports.db new file mode 100644 index 0000000..b6db1d8 Binary files /dev/null and b/lib/controller/data/reports.db differ diff --git a/lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4 b/lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/094c688e5e8dc1f8ef21d6e2db1f6a5f.mp4 differ diff --git a/lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4 b/lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/3d795f358a9132dbfcd9893d1da802ce.mp4 differ diff --git a/lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4 b/lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/5867808c7150d49c86fd81abb3eeeafe.mp4 differ diff --git a/lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4 b/lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/69c511bc894dffaae421028dc1906ef7.mp4 differ diff --git a/lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4 b/lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/863cc02857069ff580c79e1cb1647f71.mp4 differ diff --git a/lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4 b/lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/99f3f89ac1dfe06dd18f8d18ce0ca8ab.mp4 differ diff --git a/lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4 b/lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/9eb1ee93cb0fc840c852676d78acb131.mp4 differ diff --git a/lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4 b/lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/a821bcaac7313ef47ef3a9fd48dc153b.mp4 differ diff --git a/lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4 b/lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4 new file mode 100644 index 0000000..2cf845b Binary files /dev/null and b/lib/controller/data/reports/cf2ae8197f26e5e0be501e364237a6c2.mp4 differ diff --git a/lib/controller/debug.txt b/lib/controller/debug.txt new file mode 100644 index 0000000..c5f7dc6 --- /dev/null +++ b/lib/controller/debug.txt @@ -0,0 +1,108 @@ +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=7] as (0), +[SELECT * FROM `modules` WHERE `type`=7] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (2), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=7] as (0), +[SELECT * FROM `modules` WHERE `type`=7] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (2), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=8] as (0), +[SELECT * FROM `modules` WHERE `type`=8] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(8,0,0);] as (3), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (2), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (3), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (4), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (5), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (6), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=7] as (0), +[SELECT * FROM `modules` WHERE `type`=7] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (7), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (8), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=7] as (0), +[SELECT * FROM `modules` WHERE `type`=7] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(7,0,0);] as (9), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=8] as (0), +[SELECT * FROM `modules` WHERE `type`=8] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(8,0,0);] as (10), +[SELECT login, pwdMD5, SID FROM users WHERE id='2'] as (0), +[SELECT * FROM users WHERE id=2] as (0), +[SELECT key, label FROM labels WHERE language_id='1'] as (0), +[SELECT * FROM `module_types` WHERE `id`=6] as (0), +[SELECT * FROM `modules` WHERE `type`=6] as (0), +[INSERT INTO `modules`(`type`,`aux_id`,`enabled`) VALUES(6,0,0);] as (1), diff --git a/lib/controller/discoverOnvifProfiles.php b/lib/controller/discoverOnvifProfiles.php new file mode 100644 index 0000000..8d2a2a4 --- /dev/null +++ b/lib/controller/discoverOnvifProfiles.php @@ -0,0 +1,116 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['success'] = false; + if( isset( $_POST['CID'] ) ){ + $ECID = intval( $_POST['CID'] ); + if( $ECID > 0 ){ + //Check if Camera Already has password and discovered sources! + $QS = "SELECT * FROM media_streams WHERE source_id={$ECID}"; + $Result = $DATABASE->Query($QS,false); + if( count( $Result ) > 0 ){ + foreach( $Result as $CD ){ + $cnode['id'] = $CD['id']; + $cnode['name'] = $CD['name']; + $cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; + $cnode['encode'] = $CD['compression_type']; + $cnode['bitrate'] = $CD['bitrate']; + $cnode['pic'] = $CD['picture_proto'] . '://' . $IP . ':' . $CD['picture_port'] . $CD['picture']; + $Data['nodes'][] = $cnode; + }; + $Data['success'] = true; + echo json_encode( $Data ); + exit(); + }; + }; + $EUser = $DATABASE->escape( $_POST['GUG'] ); + $EPass = $DATABASE->escape( $_POST['GOG'] ); + $AUTH = intval( $_POST['GAT'] ); + $QS = "SELECT * FROM cameras WHERE id = {$ECID}"; + $Result = $DATABASE->Query( $QS, false ); + if( count($Result) ){ + $IP = $Result[0]['ip']; + $onvif = new Ponvif(); + $onvif->setUsername( $EUser ); + $onvif->setPassword( $EPass ); + $onvif->setIPAddress( $IP ); + $onvif->setAuthMethod( $AUTH ); + try { + $onvif->initialize(); + if ( !$onvif->isFault($devices=$onvif->getSources())){// die("Error getting sources"); + foreach( $devices[0] as $source ) if( is_array( $source ) ){ + //print_r( $source ); + $Ename = $DATABASE->escape( $source['profilename']); + $Etoken = $DATABASE->escape( $source['profiletoken']); + $Eencode = $DATABASE->escape( $source['encoding']); + $Ewidth = intval($source['width']); + $Eheight = intval($source['height']); + $Efps = intval($source['fps']); + $Ebitrate = intval($source['bitrate']); + if( isset( $source['ptz'] ) ){ + $Eptz = $DATABASE->escape( $source['ptz']['nodetoken'] ); + } else { + $Eptz=''; + }; + $mrl = $onvif->media_GetStreamUri($source['profiletoken']); + $pic = $onvif->media_GetSnapshotUri($source['profiletoken']); + $TPArr = explode(':',$mrl); + $mrl_proto = $TPArr[0]; + $mrl_port = intval( $TPArr[2] ); + if( $mrl_port == 0 ) { + switch( $mrl_proto ){ + case 'rtsp': $mrl_port = 554; break; + case 'http': $mrl_port = 80; break; + case 'https': $mrl_port = 443; break; + }; + }; + $Emrl = $DATABASE->escape( $mrl ); + $Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl ); + $Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl ); + $TPArr = explode(':',$pic ); + $pic_proto = $TPArr[0]; + $pic_port = intval( $TPArr[2] ); + if($pic_port == 0 ) $pic_port = 80; + $Epic = $DATABASE->escape( $pic ); + $Epic = str_replace( $pic_proto . '://' . $IP . ':' . $pic_port, '', $Epic ); + $Epic = str_replace( $pic_proto . '://' . $IP , '', $Epic ); + $QS = "INSERT INTO `media_streams`(`source_id`,`source_type`,`valid`,`name`,`token`,`img_width`,`img_height`,`compression_type`,`bitrate`,`fps`,`mrl`,`mrl_proto`,`mrl_port`,`picture_proto`,`picture_port`,`picture`) VALUES({$ECID},'D',1,'{$Ename}','{$Etoken}',{$Ewidth},{$Eheight},'{$Eencode}',{$Ebitrate},{$Efps},'{$Emrl}','{$mrl_proto}','{$mrl_port}','{$pic_proto}','{$pic_port}','{$Epic}') ON CONFLICT(`source_id`,`token`) DO UPDATE SET `source_type`='D', `valid`=1, `mrl`='{$Emrl}', `mrl_proto`='{$mrl_proto}', `mrl_port`='{$mrl_port}', `picture_proto`='{$pic_proto}', `picture_port`='{$pic_port}', `picture`='{$Epic}'"; + $DATABASE->Query( $QS, false ); + }; + $QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH}, ptz_token='{$Eptz}' WHERE id={$ECID}"; + $DATABASE->Query( $QS, false ); + } else { + $Data['error'] = 'Provided Credentials are Wrong!'; + echo json_encode( $Data ); + exit(); + }; + } catch (Exception $e) { + if( stripos( $e->getMessage(), 'GetCapabilities')!== false ){ + $Data['error'] = '

Camera IP Address is Wrong!

Please consider run network discovery.

To refresh all aveable cameras addreses.

'; + } else { + $Data['error'] = 'Provided Credentials are Wrong!'; + }; + //$Data['error'] = 'Caught exception: '.$e->getMessage(); + echo json_encode( $Data ); + exit(); + }; + }; + $QS = "SELECT * FROM media_streams WHERE source_id={$ECID}"; + $Result = $DATABASE->Query($QS,false); + foreach( $Result as $CD ){ + $cnode['id'] = $CD['id']; + $cnode['name'] = $CD['name']; + $cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; + $cnode['encode'] = $CD['compression_type']; + $cnode['bitrate'] = $CD['bitrate']; + $Data['nodes'][] = $cnode; + }; + $Data['success'] = true; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/listAndDiscoverOnvifSources.php b/lib/controller/discoverOnvifSources.php similarity index 100% rename from lib/controller/listAndDiscoverOnvifSources.php rename to lib/controller/discoverOnvifSources.php diff --git a/lib/controller/doCameraOperation.php b/lib/controller/doCameraOperation.php new file mode 100644 index 0000000..c03f20d --- /dev/null +++ b/lib/controller/doCameraOperation.php @@ -0,0 +1,268 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['status'] = 'na'; + if( isset( $_POST['CMD'] ) ){ + $CMD = intval( $_POST['CMD'] ); + } else { + $CMD = 0; + }; + if( isset( $_POST['CID'] ) ) { + $CameraID = intval($_POST['CID']); + } else $CameraID = 0; + switch( $CMD ){ + case 0:{ + // List Discovered Cameras + break; + }; + case 1:{ + // List Registered Cameras + break; + }; + case 2: + case 3:{ + // Checkup Onvif Camera By IP + require_once('../php/onvif/toto.php'); + $EUser = $DATABASE->escape( $_POST['UU'] ); + $EPass = $DATABASE->escape( $_POST['PP'] ); + $AUTH = intval( $_POST['AU'] ); + $onvif = new Ponvif(); + $IP = ''; + if( $CameraID ){ + $QS ="SELECT `ip` FROM `cameras` WHERE `id`={$CameraID}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ){ + $IP = $JJ[0]['ip']; + $onvif->setIPAddress( $IP ); + } else $CameraID = 0; + } else { + $IP = $DATABASE->escape( $_POST['IP'] ); + $onvif->setIPAddress( $IP ); + $RR = $onvif->discover(); + if( count( $RR ) ){ + $R= $RR[0]; + if(isset($R['EndpointReference'])){ + if(isset($R['EndpointReference']['Address'])){ + $TArr = explode( ':', $R['EndpointReference']['Address'] ); + $CA = $DATABASE->escape( $TArr[2] ); + $TArr = explode( ' ', $R['Scopes']); + $CM = ''; + $CI = $DATABASE->escape($R['IPAddr']); + $Frr = explode( ' ', $R['XAddrs']); + $Crr = explode( $CI, $Frr[0] ); + $CP = $DATABASE->escape($Crr[1]); + $CN = ''; + $CH = ''; + $CC = 0; + foreach( $TArr as $T ){ + $TT = str_ireplace('onvif://www.onvif.org/','', $T ); + $TBrr = explode( '/', $TT ); + if( stripos($TBrr[0],'type') !== false ){ + if( stripos($TBrr[1],'video') !== false ) $CC |= 0x1; + if( stripos($TBrr[1],'audio') !== false ) $CC |= 0x2; + if( stripos($TBrr[1],'ptz') !== false ) $CC |= 0x4; + }; + if( stripos($TBrr[0],'name') !== false ) $CN = $DATABASE->escape(urldecode($TBrr[1])); + if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); + if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); + }; + $QS = "INSERT INTO `cameras`(hardware,name,uuid,mac,ip,status,onvif_ctrl,online) VALUES('{$CH}','{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1"; + $DATABASE->Query($QS,false); + $CameraID = $DATABASE->getLastInsertID(); + if( $CameraID == 0 ){ + $QS = "SELECT `id` FROM `cameras` WHERE `uuid`='{$CA}'"; + $RV = $DATABASE->Query( $QS ); + if( count( $RV ) ) $CameraID = intval( $RV[0]['id']); + }; + }; + }; + }; + }; + if( $CameraID ){ + $Data['status'] = 'ok'; + if( $EUser!= '' ){ + $onvif->setUsername( $EUser ); + $onvif->setPassword( $EPass ); + $onvif->setAuthMethod( $AUTH ); + try { + $onvif->initialize(); + if ( !$onvif->isFault($devices=$onvif->getSources())){ + foreach( $devices[0] as $source ) if( is_array( $source ) ){ + //print_r( $source ); + $Ename = $DATABASE->escape( $source['profilename']); + $Etoken = $DATABASE->escape( $source['profiletoken']); + $Eencode = $DATABASE->escape( $source['encoding']); + $Ewidth = intval($source['width']); + $Eheight = intval($source['height']); + $Efps = intval($source['fps']); + $Ebitrate = intval($source['bitrate']); + if( isset( $source['ptz'] ) ){ + $Eptz = $DATABASE->escape( $source['ptz']['nodetoken'] ); + } else { + $Eptz=''; + }; + $mrl = $onvif->media_GetStreamUri($source['profiletoken']); + $pic = $onvif->media_GetSnapshotUri($source['profiletoken']); + $TPArr = explode(':',$mrl); + $mrl_proto = $TPArr[0]; + $mrl_port = intval( $TPArr[2] ); + if( $mrl_port == 0 ) { + switch( $mrl_proto ){ + case 'rtsp': $mrl_port = 554; break; + case 'http': $mrl_port = 80; break; + case 'https': $mrl_port = 443; break; + }; + }; + $Emrl = $DATABASE->escape( $mrl ); + $Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl ); + $Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl ); + $TPArr = explode(':',$pic ); + $pic_proto = $TPArr[0]; + $pic_port = intval( $TPArr[2] ); + if($pic_port == 0 ) $pic_port = 80; + $Epic = $DATABASE->escape( $pic ); + $Epic = str_replace( $pic_proto . '://' . $IP . ':' . $pic_port, '', $Epic ); + $Epic = str_replace( $pic_proto . '://' . $IP , '', $Epic ); + $QS = "INSERT INTO `media_streams`(`source_id`,`source_type`,`valid`,`name`,`token`,`img_width`,`img_height`,`compression_type`,`bitrate`,`fps`,`mrl`,`mrl_proto`,`mrl_port`,`picture_proto`,`picture_port`,`picture`) VALUES({$CameraID},'D',1,'{$Ename}','{$Etoken}',{$Ewidth},{$Eheight},'{$Eencode}',{$Ebitrate},{$Efps},'{$Emrl}','{$mrl_proto}','{$mrl_port}','{$pic_proto}','{$pic_port}','{$Epic}') ON CONFLICT(`source_id`,`token`) DO UPDATE SET `source_type`='D', `valid`=1, `mrl`='{$Emrl}', `mrl_proto`='{$mrl_proto}', `mrl_port`='{$mrl_port}', `picture_proto`='{$pic_proto}', `picture_port`='{$pic_port}', `picture`='{$Epic}'"; + $DATABASE->Query( $QS, false ); + }; + $QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH}, ptz_token='{$Eptz}', `status`=1 WHERE id={$CameraID}"; + $DATABASE->Query( $QS, false ); + } else { + $Data['msg'] = 'Camera was added.
However provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']'; + }; + } catch( Exception $e ){ + $Data['msg'] = 'Provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']'; + }; + } else { + $Data['msg'] = 'Camera Sucessfully Added
Please Provide Access Credentials and Other Camera Settings'; + }; + } else { + $Data['status'] = 'error'; + $Data['msg'] = '

Camera IP Address is Wrong!

Please consider run network discovery.

To refresh all aveable cameras addreses.

'; + }; + break; + }; + case 4:{ + // Add Onvif Camera Manually (After 2 - checkup ) + break; + }; + case 5:{ + // Add Analog Video Stream Camera Manully + }; + case 6:{ + // Register the Camera + + break; + }; + case 10:{ + $OP = intval( $_POST['OPID'] ); + switch( $OP ){ + case 1:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "SELECT * FROM `cameras` WHERE `id`={$CameraID}"; + $JJ = $DATABASE->Query( $QS ); + if( count( $JJ ) ){ + $CC = $JJ[0]; + if( $CC['status'] == 3 ){ + $QS = "UPDATE `nodes` SET `aux_param`={$Param} WHERE `aux_id`={$CameraID} AND `type` IN(10,11,12,13)"; + $DATABASE->Query( $QS ); + }; + $QS = "UPDATE `cameras` SET `stream_id`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-1'; + }; + break; + }; + case 2:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `imager_type`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-2'; + break; + }; + case 3:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `lens_f`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-3'; + break; + }; + case 4:{ + $Param = floatval( $_POST['OPCODE'] ); + if( $Param > 0 ){ + $ZM = 1; + } else { + $ZM = 0; + }; + $QS = "UPDATE `cameras` SET `zoom`={$Param}, `zoom_model`={$ZM} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-4'; + break; + }; + case 5:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `protocol`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-5'; + break; + }; + case 6:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `uart_id`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-6'; + break; + }; + case 7:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `protocol_aux`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-7'; + break; + }; + case 8:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `pan_model`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-8'; + break; + }; + case 9:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `pan_angles`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-9'; + break; + }; + case 10:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `tilt_model`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-10'; + break; + }; + case 11:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `tilt_angles`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-11'; + break; + }; + case 12:{ + $Param = intval( $_POST['OPCODE'] ); + $QS = "UPDATE `cameras` SET `trigger_mode`={$Param} WHERE `id`={$CameraID}"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok-12'; + break; + }; + }; + break; + }; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/doModuleOperation.php b/lib/controller/doModuleOperation.php index dbb082e..8bb4a5d 100644 --- a/lib/controller/doModuleOperation.php +++ b/lib/controller/doModuleOperation.php @@ -20,7 +20,7 @@ $Data['success'] = true; switch( $CMD ){ case 1: { - $QS = "SELECT * FROM `server_modules` WHERE `id`={$MID}"; + $QS = "SELECT * FROM `modules` WHERE `id`={$MID}"; $TT = $DATABASE->Query( $QS ); if( count( $TT ) ){ $JJ = $TT[0]; @@ -39,8 +39,13 @@ $DATABASE->Query( $QS ); break; }; + case 6:{//SSDP + $QS = "DELETE FROM `module_ssdp` WHERE `id`={$JJ['aux_id']}"; + $DATABASE->Query( $QS ); + break; + }; case 9:{// Embed VIO - $QS = "DELETE FROM `module_embed_video_settings` WHERE `id`={$JJ['aux_id']}"; + $QS = "DELETE FROM `module_eve` WHERE `id`={$JJ['aux_id']}"; $DATABASE->Query( $QS ); break; }; @@ -53,12 +58,12 @@ }; }; - $QS = "DELETE FROM `server_modules` WHERE `id`={$MID}"; + $QS = "DELETE FROM `modules` WHERE `id`={$MID}"; $DATABASE->Query( $QS ); }; break; }; - case 2: $QS = "UPDATE `server_modules` SET `enabled`={$OPCODE} WHERE `id`={$MID}"; break; + case 2: $QS = "UPDATE `modules` SET `enabled`={$OPCODE} WHERE `id`={$MID}"; break; }; $DATABASE->Query( $QS, false ); $Data['query'] = $QS; diff --git a/lib/controller/doDeviceOperation.php b/lib/controller/doNodeOperation.php similarity index 67% rename from lib/controller/doDeviceOperation.php rename to lib/controller/doNodeOperation.php index ab5f6c6..acdce08 100644 --- a/lib/controller/doDeviceOperation.php +++ b/lib/controller/doNodeOperation.php @@ -18,10 +18,11 @@ }; if( $NodeID > 0 && $CMD > 0 ){ $Data['success'] = true; - $QS = "INSERT INTO `nodes_qcq` SET `node_id`={$NodeID}, `cmd`={$CMD}, `status`=0, `parameter`='{$PARAM}'"; - $Data['query'] = $QS; - $DATABASE->Query( $QS, false ); - $Data['operation_id'] = intval( $DATABASE->getLastInsertID() ); + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'{$PARAM}')"; + $Data['query'] = $QS ; + @$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $MEMDB->Query( $QS, false ); + $Data['operation_id'] = intval( $MEMDB->getLastInsertID() ); } else { $Data['msg']='Wrong Parameters'; }; diff --git a/lib/controller/doResourceOperation.php b/lib/controller/doResourceOperation.php new file mode 100644 index 0000000..3eb1bf8 --- /dev/null +++ b/lib/controller/doResourceOperation.php @@ -0,0 +1,33 @@ +Data['id'] > 1 ){ + $Data = array(); + $Data['success'] = false; + if( isset( $_POST['NID'] ) ) { + $NodeID = intval($_POST['NID']); + } else $NodeID = 0; + if( isset( $_POST['CMD'] ) ){ + $CMD = intval( $_POST['CMD'] ); + } else { + $CMD = 0; + }; + if( isset( $_POST['PARAM'] ) ){ + $PARAM = $DATABASE->escape( $_POST['PARAM'] ); + } else { + $PARAM = ''; + }; + if( $NodeID > 0 && $CMD > 0 ){ + $Data['success'] = true; + $QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'{$PARAM}')"; + $Data['query'] = $QS ; + @$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $MEMDB->Query( $QS, false ); + $Data['operation_id'] = intval( $MEMDB->getLastInsertID() ); + } else { + $Data['msg']='Wrong Parameters'; + }; + echo json_encode( $Data ); + exit(); + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/frame.raw b/lib/controller/frame.raw new file mode 100644 index 0000000..bdc4f33 Binary files /dev/null and b/lib/controller/frame.raw differ diff --git a/lib/controller/getCameraEditor.php b/lib/controller/getCameraEditor.php new file mode 100644 index 0000000..3a9fd4a --- /dev/null +++ b/lib/controller/getCameraEditor.php @@ -0,0 +1,785 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $CID = intval( $_POST['CID'] ); + $QS = "SELECT * FROM `cameras` WHERE `id`={$CID}"; + $Result = $DATABASE->Query( $QS, false ); + $STREAMS = array(); + if( count( $Result ) ){ + $Cam = $Result[0]; + $Cam['name']=urldecode( $Cam['name'] ); + $TB = explode( ' ', $Cam['name'] ); + $Cam['name'] = $TB[0]; + if( stripos($Cam['ip'],'/dev/video') !==false ){ + $CLS = "camera_analog_set"; + $CAM_IP = false; + } else { + $CAM_IP = true; + $CamLabel = $Cam['name'] . '_' . $CID; + if( stripos( $Cam['name'], 'hikvision' ) !== false ){ + $CLS = "camera_hikvision_set"; + } elseif( stripos( $Cam['name'], 'dahua' ) !== false ){ + $CLS = "camera_dahua_set"; + } elseif( stripos( $Cam['name'], 'axis' ) !== false ){ + $CLS = "camera_axis_set"; + } else { + $CLS = "camera_generic_set"; + }; + }; + $QS = "SELECT * FROM media_streams WHERE source_id={$CID}"; + $Result = $DATABASE->Query($QS,false); + $SELECTED_STREAM = 0; + if( count( $Result ) > 0 ){ + $ii = 0; + foreach( $Result as $CD ){ + $STREAMS[] = "[{$CD['id']},'{$CD['name']}','{$CD['img_width']}x{$CD['img_height']}@{$CD['fps']}','{$CD['compression_type']}',{$CD['bitrate']}]"; + if( $Cam['stream_id'] == $CD['id'] ) $SELECTED_STREAM = $ii; + $ii++; + }; + }; + $STREAMS = implode(',',$STREAMS); + + $QS="SELECT re.aux_id, re.device FROM resources re LEFT JOIN nodes no ON( re.node_id = no.id ) WHERE ( re.type=1 OR re.type=129 ) "; + $RR=$DATABASE->Query( $QS ); + if( count( $RR ) ){ + $RE=array(); + foreach( $RR as $R ){ + $RE[] = "[ {$R['aux_id']}, '{$R['device']}']"; + }; + $UARTS = implode( ',', $RE ); + } else { + $UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]"; + }; + $ATAB = 0; + //v4l2-ctl -d /dev/video0 --stream-mmap --stream-count=1 --stream-to=output.jpg + if( $CAM_IP ){ + $RESET_CREDENTIALS=<<GetLabel('_RSET_CREDENTIALS_')}', + handler: function(){ + } +} +kskjhiiuwye; + } else { + $RESET_CREDENTIALS=''; + }; + $ADD_CAMERA=<<GetLabel('_ASSIGN_CAMERA_')}', + handler: function(){ + } +} +hzzhoiuyhetrkh; + $REMOVE_CAMERA=<<GetLabel('_REMOVE_CAMERA_')}', + handler: function(){ + } +} +hhoiuyhetrkh; + $BBAR_BTN = $ADD_CAMERA; + $TPL_SET_CREDS_IP=<<
' + },{ + xtype: 'panel', + html: '
{$Cam['ip']}
{$Cam['name']}
{$Cam['hardware']}
' + },{ + xtype: 'panel', + html: '
{$Labels->GetLabel('_PROV_CAC_')}
' + },{ + xtype: 'textfield', + id: 'cam_login', + fieldLabel: '{$Labels->GetLabel('__LOGIN__')}', + width: 200 + },{ + xtype: 'textfield', + id: 'cam_password', + inputType: 'password', + fieldLabel: '{$Labels->GetLabel('__PASSWORD__')}', + width: 200 + },{ + xtype: 'combo', + id: 'cam_auth_mode', + fieldLabel: '{$Labels->GetLabel('_AUTH_MODE_0_')}', + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [ + [0,'BASIC'], + [1,'DIGEST'], + [2,'DIGEST_IE'], + [3,'BEARER'], + [4,'NEGOTIATE'], + [5,'NTLM'], + [6,'NTLM_WB'], + [7,'ANY'], + [8,'ANYSAFE'], + [9,'ONLY'], + [10,'AWS_SIGV4'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: 0, + width: 200 + },{ + xtype: 'button', + width: '100%', + text: '{$Labels->GetLabel('_SET_CREDENTIALS_')}', + handler: function(){ + addDetCamWM = new Ext.LoadMask( Ext.getCmp('cam_credentials').getEl(), {msg:"{$Labels->GetLabel('_Please_Wait_')}..."}); + addDetCamWM.show(); + var NUU = Ext.getCmp('cam_login').getValue(); + var NPP = Ext.getCmp('cam_password').getValue(); + var NAM = Ext.getCmp('cam_auth_mode').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + UID: {$UserID}, + SID: '{$Session}', + CID: {$CID}, + UU: NUU, + PP: NPP, + AU: NAM, + CMD: 3 + }, + success: function( response, opts ){ + addDetCamWM.hide(); + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + Ext.Msg.show({ + title:'Sucess!', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + //loadDetectedCameras(); + } else { + Ext.Msg.show({ + title:'Error!', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.WARNING + }); + }; + }, + failure: failureAJAXFunction + }); + } + }] +} +ZUZAKA; + $TPL_ANALOG_CAM =<<
' + },{ + xtype: 'panel', + html: '
{$Cam['ip']}
{$Cam['name']}
{$Cam['hardware']}
' + }] +} +CHUPAKABRA; + $TPL_CAM_EDITOR=<<GetLabel('_CAC_TAB_')}', + id: 'cam_info', + frame: false, + border: false, + items: [{ + xtype: 'panel', + height: 290, + border: false, + frame: false, + html: '' + },{ + xtype: 'panel', + html: '
{$Cam['ip']}
{$Cam['name']}
{$Cam['hardware']}
' + }{$RESET_CREDENTIALS}] + },{ + title: '{$Labels->GetLabel('_STREAMS_')}', + id: 'str_tab', + frame: false, + border: false, + items:[{ + xtype: 'grid', + height: 124, + id: 'nd_cam_grid', + frame: false, + ds: new Ext.data.ArrayStore({ + fields: ['id','name','size','encode','bitrate'], + data: [{$STREAMS}] + }), + cm: new Ext.grid.ColumnModel({ + columns: [ + {header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "Name", dataIndex: 'name' }, + {header: "Encoding",width: 120, sortable: false, fixed: true, menuDisabled: true, dataIndex: 'encode' }, + {header: "Frame", width: 120, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' }, + {header: "Bitrate", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'bitrate' } + ], + defaults: { + sortable: false, + menuDisabled: true, + width: 100 + } + }), + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec) { + SelectedSource = rec.data.id; + doCamOperation( {$CID}, 1, SelectedSource ); + var tt = Ext.getCmp('pic_prev'); + if( tt!= undefined ){ + tt.update( '
' ); + }; + } + } + }), + listeners:{ + viewready: function( t ){ + var tt = t.getSelectionModel(); + tt.selectRow({$SELECTED_STREAM}); + } + } + },{ + height: PanelH, + id: 'pic_prev', + html: '
', + listeners:{ + afterrender: function( t ){ + if( SelectedSource ){ + //t.update( '
' ); + }; + } + } + }], + },{ + title: 'Lens Settings', + id: 'lens_tab', + frame: false, + border: false, + items:[{ + layout: 'table', + frame: false, + border: false, + layoutConfig: { + columns: 3 + }, + defaults: { + frame: false, + bodyStyle: 'padding:10px', + border: false + }, + items:[{ + width: 200, + html: 'Sensor Size' + },{ + xtype: 'combo', + fieldLabel: 'Sensor Size', + lazyRender: true, + id: 'sens_size', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['size','size_txt'], + data: [ + [0,'1/3.6"'], + [1,'1/3.2"'], + [2,'1/3"'], + [3,'1/2.7"'], + [4,'1/2"'], + [5,'1/1.8"'], + [6,'2/3"'], + [7,'1"'], + [8,'4/3"'], + [9,'APS-C'], + [10,'35 mm'], + [11,'645'] + ] + }), + valueField: 'size', + displayField: 'size_txt', + value: {$Cam['imager_type']}, + listeners:{ + select:function( c, r, i ){ + doCamOperation( {$CID}, 2, i ); + } + } + },{ + html: ' ' + },{ + html: 'Focal Length' + },{ + xtype: 'combo', + fieldLabel: 'Lens Focal Length', + lazyRender: true, + id: 'lens_fl', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['fl','fl_txt'], + data: [ + [0,'2.7 mm.'], + [1,'3.0 mm.'], + [2,'3.2 mm.'], + [3,'3.5 mm.'], + [4,'3.7 mm.'], + [5,'3.9 mm.'], + [6,'4.0 mm.'], + [7,'4.3 mm.'], + [8,'4.8 mm.'], + [9,'5.0 mm.'], + [10,'5.1 mm.'], + [11,'5.5 mm.'], + [12,'5.8 mm.'], + [13,'6.0 mm.'], + [14,'6.2 mm.'], + [15,'6.6 mm.'], + [16,'7.0 mm.'], + [17,'7.1 mm.'], + [18,'7.5 mm.'], + [19,'7.6 mm.'], + [20,'8.0 mm.'], + [21,'8.6 mm.'], + [22,'8.9 mm.'], + [23,'9.0 mm.'], + [24,'9.2 mm.'], + [25,'9.3 mm.'], + [26,'10.0 mm.'], + [27,'10.5 mm.'], + [28,'10.6 mm.'], + [29,'10.7 mm.'], + [30,'11.0 mm.'], + [31,'11.3 mm.'], + [32,'12.0 mm.'], + [33,'12.9 mm.'], + [34,'13.0 mm.'], + [35,'13.5 mm.'], + [36,'13.6 mm.'], + [37,'14.0 mm.'], + [38,'14.6 mm.'], + [39,'15.0 mm.'], + [40,'15.1 mm.'], + [41,'15.5 mm.'], + [42,'16.0 mm.'], + [43,'17.0 mm.'], + [44,'17.5 mm.'], + [44,'17.7 mm.'], + [45,'18.0 mm.'], + [46,'18.2 mm.'], + [47,'19.0 mm.'] + ] + }), + valueField: 'fl', + displayField: 'fl_txt', + value: {$Cam['lens_f']}, + listeners:{ + select:function( c, r, i ){ + doCamOperation( {$CID}, 3, i ); + } + } + },{ + html: ' ' + },{ + html: 'Fixed Zoom' + },{ + xtype: 'radio', + id: 'no_zoom', + name: 'zoom_ena', + value: ( parseFloat({$Cam['zoom']})==0 ), + checked: ( parseFloat({$Cam['zoom']})==0 ), + listeners:{ + change: function( r, n, o ){ + if( n ) { + doCamOperation( {$CID}, 4, 0.0 ); + }; + } + } + },{ + html: ' ' + },{ + html: 'Variable Zoom' + },{ + xtype: 'radio', + id: 'on_zoom', + hideLabel: false, + fieldLabel: 'Variable Zoom', + name: 'zoom_ena', + value: ({$Cam['zoom']}>0.0), + checked: ({$Cam['zoom']}>0.0), + handler: function( a, c ){ + if( c ){ + Ext.getCmp('zoom_val').enable(); + Ext.getCmp('zoom_val').setValue( 1 ); + var zz = Ext.getCmp('zoom_d'); + if( zz.rendered ) zz.update('

X 1

'); + } else { + Ext.getCmp('zoom_val').disable(); + var zz = Ext.getCmp('zoom_d'); + if( zz.rendered ) zz.update(' '); + }; + }, + listeners:{ + change: function( r, n, o ){ + if( n ) { + doCamOperation( {$CID}, 4, 1.0 ); + }; + } + } + },{ + html: ' ' + },{ + html: 'Zoom Ratio' + },{ + xtype: 'slider', + id: 'zoom_val', + disabled: ( parseFloat({$Cam['zoom']})==0 ), + minValue: 1.0, + maxValue: 40.0, + value: {$Cam['zoom']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 4, c ); + var zz = Ext.getCmp('zoom_d'); + if( zz.rendered ) zz.update('

X '+ c + '

'); + } + } + },{ + id: 'zoom_d', + html: (( parseFloat({$Cam['zoom']})==0 )?' ':'

X '+ {$Cam['zoom']} + '

' ) + }] + }] + },{ + title: '{$Labels->GetLabel('_PTZ_TAB_')}', + id: 'ptz_tab', + frame: false, + border: false, + items:[{ + layout: 'table', + frame: false, + border: false, + layoutConfig: { + columns: 3 + }, + defaults: { + frame: false, + bodyStyle: 'padding:10px', + border: false + }, + items:[{ + width: 200, + html: '{$Labels->GetLabel('__PTZ_CONTROL__')}' + },{ + xtype: 'combo', + fieldLabel: '{$Labels->GetLabel('__PTZ_CONTROL__')}', + lazyRender: true, + id: 'ptz_proto', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['type','type_txt'], + data: [ + [0,'{$Labels->GetLabel('_NO_PTZ_')}'], + [1,'Sony VISCA'], + [2,'Pelco-D'], + [3,'OnVif'], + [4,'PSIA'], + [5,'GB/T28181'] + ] + }), + value: {$Cam['protocol']}, + valueField: 'type', + displayField: 'type_txt', + listeners:{ + select: function( a, c, b ){ + doCamOperation( {$CID}, 5, b ); + if( b > 0 ){ + if( b != 3 ){ + Ext.getCmp('uart_id').enable(); + Ext.getCmp('prot_id').enable(); + } else { + Ext.getCmp('uart_id').disable(); + Ext.getCmp('prot_id').disable(); + }; + Ext.getCmp('pan_mode').enable(); + Ext.getCmp('tilt_mode').enable(); + Ext.getCmp('pan_ang').enable(); + Ext.getCmp('tilt_ang').enable(); + } else { + Ext.getCmp('uart_id').disable(); + Ext.getCmp('prot_id').disable(); + Ext.getCmp('pan_mode').disable(); + Ext.getCmp('tilt_mode').disable(); + Ext.getCmp('pan_ang').disable(); + Ext.getCmp('tilt_ang').disable(); + }; + } + } + },{ + html: ' ' + },{ + html: '{$Labels->GetLabel('_UART_PORT_')}' + },{ + xtype: 'combo', + fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}', + lazyRender: true, + id: 'uart_id', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + disabled: (({$Cam['protocol']}!=1 ) && ( {$Cam['protocol']}!=2 )), + store: new Ext.data.ArrayStore({ + fields: ['uart','uart_txt'], + data: [{$UARTS}] + }), + valueField: 'uart', + displayField: 'uart_txt', + value: {$Cam['uart_id']}, + listeners:{ + select: function( a, c, b ){ + doCamOperation( {$CID}, 6, b ); + } + } + },{ + html: ' ' + },{ + html: '{$Labels->GetLabel('_CAM_PROTO_ID_')}' + },{ + xtype: 'numberfield', + id: 'prot_id', + width: '95%', + disabled: (({$Cam['protocol']}!=1 ) && ( {$Cam['protocol']}!=2 )), + minValue: 0, + maxValue: 255, + value: {$Cam['protocol_aux']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 7, c ); + } + } + },{ + html: ' ' + },{ + html: 'Pan Model' + },{ + xtype: 'combo', + fieldLabel: 'Pan Model', + lazyRender: true, + id: 'pan_mode', + disabled: ({$Cam['protocol']} == 0), + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['pm','pm_txt'], + data: [ + [0,'Regular'], + [1,'Reversed'] + ] + }), + valueField: 'pm', + displayField: 'pm_txt', + value: {$Cam['pan_model']}, + listeners:{ + select: function( a, c, b ){ + doCamOperation( {$CID}, 8, b ); + } + } + },{ + html: ' ' + },{ + html: 'Tottal Pan Angles' + },{ + xtype: 'numberfield', + id: 'pan_ang', + width: '95%', + disabled: ({$Cam['protocol']} == 0), + minValue: 0, + maxValue: 360, + value: {$Cam['pan_angles']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 9, c ); + } + } + },{ + html: ' ' + },{ + html: 'Tilt Model' + },{ + xtype: 'combo', + fieldLabel: 'Tilt Model', + lazyRender: true, + id: 'tilt_mode', + disabled: ({$Cam['protocol']} == 0), + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['tm','tm_txt'], + data: [ + [0,'Regular'], + [1,'Reversed'], + [2,'Shifted 90°'], + [3,'Rev-Shifted 90°'] + ] + }), + valueField: 'tm', + displayField: 'tm_txt', + value: {$Cam['tilt_model']}, + listeners:{ + select: function( a, c, b ){ + doCamOperation( {$CID}, 10, b ); + } + } + },{ + html: ' ' + },{ + html: 'Tottal Tilt Angles' + },{ + xtype: 'numberfield', + id: 'tilt_ang', + width: '95%', + disabled: ({$Cam['protocol']} == 0), + minValue: 0, + maxValue: 180, + value: {$Cam['tilt_angles']}, + listeners:{ + change: function( a, c, b ){ + doCamOperation( {$CID}, 11, c ); + } + } + },{ + html: ' ' + }] + }] + },{ + title: '{$Labels->GetLabel('_TARGETING_TAB_')}', + id: 'target_tab', + frame: false, + border: false, + items:[{ + layout: 'table', + frame: false, + border: false, + layoutConfig: { + columns: 3 + }, + defaults: { + frame: false, + bodyStyle: 'padding:10px', + border: false + }, + items:[{ + width: 200, + html: '{$Labels->GetLabel('_CAM_TRIGGERING_MODE_')}' + },{ + xtype: 'combo', + lazyRender: true, + id: 'cam_targeting', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['type','type_txt'], + data: [ + [0,'Strict Visible Targets'], + [1,'All Near'], + [2,'ALL Far'], + [3,'All Targets'] + ] + }), + value: {$Cam['trigger_mode']}, + valueField: 'type', + displayField: 'type_txt', + listeners:{ + select: function( a, c, b ){ + doCamOperation( {$CID}, 12, b ); + } + } + }] + }] + }] +} +PZAKSJEJSDKGJHGASD; + + $Data['status']='ok'; + + if( $Cam['status'] == 0 ){ + $ADDCAMPOPO = ''; + } else { + $ADDCAMPOPO = ''; + }; + if( $CAM_IP ){ + switch( $Cam['status'] ){ + case 0: $Data['content'] = $TPL_SET_CREDS_IP; break; + case 1: $Data['content'] = $TPL_CAM_EDITOR; break; + case 2: $Data['content'] = $TPL_CAM_EDITOR; break; + }; + } else { + $Data['content'] = $TPL_CAM_EDITOR; + }; + } else { + $Data['status']='error'; + }; + echo $Data['content']; + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getCameraPreview.php b/lib/controller/getCameraPreview.php new file mode 100644 index 0000000..e2f433c --- /dev/null +++ b/lib/controller/getCameraPreview.php @@ -0,0 +1,78 @@ +Data['id'] > 1 ){ + header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); + header("Cache-Control: post-check=0, pre-check=0", false); + header("Pragma: no-cache"); + if(isset( $_POST['FID'] )){ + $FID = intval($_POST['FID']); + } else { + $FID = intval($_GET['FID']); + }; + if(isset( $_POST['AUX'] )){ + $AUX = intval($_POST['AUX']); + } else { + $AUX = 0;//intval($_GET['AUX']); + }; + if( $FID > 0 ){ + $QS = "SELECT cs.picture AS pic_url, cs.picture_proto AS pic_proto, cs.img_width AS width, cs.img_height AS height, cs.picture_port AS pic_port, ca.* FROM media_streams cs LEFT JOIN cameras ca ON ( ca.id = cs.source_id ) WHERE cs.id={$FID}"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + if( $Result[0]['pic_proto'] == 'v4l2' ){ + $tmp = '/tmp/some_tmp_file_'.md5(time()).'.jpg'; + $CMD_SET = "v4l2-ctl --device {$Result[0]['ip']} -set-fmt-video=width={$Result[0]['width']},height={$Result[0]['height'] },pixelformat=MJPG"; + $A = `$CMD_SET`; + $CMD_GRAB = "ffmpeg -f video4linux2 -i {$Result[0]['ip']} -frames:v 3 -update 1 {$tmp}"; + $B = `$CMD_GRAB`; + if( file_exists( $tmp ) ){ + $Data = file_get_contents( $tmp ); + unlink( $tmp ); + } else { + $Data = file_get_contents( '../../style/assets/no_picture.jpg' ); + }; + header("Content-type: image/jpeg"); + echo $Data; + } else { + //var_dump( $Result[0] ); + $soap_do = curl_init(); + //$TURL = "http://{$Result[0]['access_login']}:{$Result[0]['access_pass']}@192.168.200.113/onvifsnapshot/media_service/snapshot?channel=1&subtype=0"; + $URL = $Result[0]['pic_proto'] . '://' . $Result[0]['ip'] .':'. $Result[0]['pic_port'] . $Result[0]['pic_url']; + curl_setopt($soap_do, CURLOPT_URL, $URL ); + curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20); + curl_setopt($soap_do, CURLOPT_TIMEOUT, 20); + curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); + curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); + curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); + //curl_setopt($soap_do, CURLOPT_USERNAME, $Result[0]['access_login']); + curl_setopt($soap_do, CURLOPT_USERPWD, $Result[0]['access_login'] . ":" . $Result[0]['access_pass'] ); + if( ( $data = curl_exec($soap_do) ) === false ){ + $err = curl_error($soap_do); + //echo $err; + $Data = file_get_contents( '../../style/assets/no_picture.jpg' ); + header("Content-type: image/jpeg"); + echo $Data; + } else { + //$AA = curl_getinfo( $soap_do ); + //var_dump($AA); + if( $AUX > 0 ){ + $Image = imagecreatefromstring($data); + $Simage = imagescale( $Image, $AUX, -1, IMG_NEAREST_NEIGHBOUR ); + header("Content-type: image/jpeg"); + imagejpeg($Simage); + } else { + header("Content-type: image/jpeg"); + echo $data; + }; + }; + }; + } else { + //echo "\n\nNores!"; + loadNotPicture( $AUX ); + }; + exit(); + }; + }; + header('location: /'); +?> \ No newline at end of file diff --git a/lib/controller/getCameras.php b/lib/controller/getCameras.php new file mode 100644 index 0000000..b1f9571 --- /dev/null +++ b/lib/controller/getCameras.php @@ -0,0 +1,31 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $TY = intval( $_POST['TYP'] ); + if( $TY ){ + $QS = "SELECT * FROM `cameras` WHERE `status` = 3"; + } else { + $QS = "SELECT * FROM `cameras` WHERE `status` < 3"; + }; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + $CamPart = array(); + foreach( $Result as $R ){ + $CamPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.urldecode($R['name']).'['.$R['hardware'].']\'}'; + }; + $Data['status']='ok'; + $Data['cameras'] = '['.implode( ',', $CamPart ) .']'; + } else { + $Data['status']='na'; + }; + $Data['messages'] = ob_get_clean(); + echo json_encode( $Data ); + } else { + header('location: /'); + }; + + +?> \ No newline at end of file diff --git a/lib/controller/getModuleEditor.php b/lib/controller/getModuleEditor.php index 9bfdc31..49cfe96 100644 --- a/lib/controller/getModuleEditor.php +++ b/lib/controller/getModuleEditor.php @@ -3,12 +3,12 @@ if( $CUser->Data['id'] > 1 ){ $EID = intval( $_POST['MID'] ); - $QS = "SELECT * FROM server_modules WHERE id = {$EID}"; + $QS = "SELECT * FROM modules WHERE id = {$EID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; switch( $CR['type'] ){ - case 1: //ZLMedia + case 0: //ZLMedia $TPL =<<Query( $QS ); $CI = $II[0]; @@ -172,7 +172,9 @@ EFUFU; $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); echo $TPL; break; - case 7: // SSDP + case 6: // SSDP + //$QS = "SELECT * FROM `module_ssdp` WHERE `module_id`={$CR['aux_id']}"; + //$ZZ = $DATABASE->Query( $QS ); $TPL =<<Query( $QS ); $CI = $II[0]; @@ -387,7 +389,7 @@ EFUFU; $TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL ); echo $TPL; break; - case 10: //Modem + case 9: //Modem $QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}"; $II = $DATABASE->Query( $QS ); $CI = $II[0]; diff --git a/lib/controller/getModuleInfo.php b/lib/controller/getModuleInfo.php index 451677b..37ff670 100644 --- a/lib/controller/getModuleInfo.php +++ b/lib/controller/getModuleInfo.php @@ -4,45 +4,45 @@ if( $CUser->Data['id'] > 1 ){ $EID = intval( $_POST['MID'] ); switch( $EID ){ - case 1: //ZLMedia + case 0: //ZLMedia $TPL ='
%%%NAME%%%
%%%INFO%%%
'; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL ); echo $TPL; break; - case 2: //DCB USB + case 1: //DCB USB echo "TBD"; break; - case 3: //Kafka + case 2: //Kafka $TPL ='
%%%NAME%%%
%%%INFO%%%
'; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); echo $TPL; break; + case 3: case 4: case 5: - case 6: echo "TBD"; break; - case 7: // SSDP + case 6: // SSDP $TPL ='
%%%NAME%%%
%%%INFO%%%
'; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_SSDP_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_SSDP_DESC_LOO_'), $TPL ); echo $TPL; break; - case 8: // Onvif + case 7: // Onvif $TPL ='
%%%NAME%%%
%%%INFO%%%
'; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ONVIF_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ONVIF_DESC_LOO_'), $TPL ); echo $TPL; break; - case 9://Embed Video Encoder + case 8://Embed Video Encoder $TPL ='
%%%NAME%%%
%%%INFO%%%
'; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_EVE_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_EVE_DESC_LOO_'), $TPL ); echo $TPL; break; - case 10: //Modem + case 9: //Modem $TPL ='
%%%NAME%%%
%%%INFO%%%
'; $TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL ); $TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL ); diff --git a/lib/controller/getModuleSettings.php b/lib/controller/getModuleSettings.php index d6eccfb..e85d053 100644 --- a/lib/controller/getModuleSettings.php +++ b/lib/controller/getModuleSettings.php @@ -3,7 +3,7 @@ if( $CUser->Data['id'] > 1 ){ $EID = intval( $_POST['MID'] ); - $QS = "SELECT * FROM server_modules WHERE id = {$EID}"; + $QS = "SELECT * FROM modules WHERE id = {$EID}"; $Result = $DATABASE->Query( $QS, false ); if( count( $Result ) ){ $CR = $Result[0]; diff --git a/lib/controller/getModules.php b/lib/controller/getModules.php new file mode 100644 index 0000000..b8da8cd --- /dev/null +++ b/lib/controller/getModules.php @@ -0,0 +1,43 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $QS = "SELECT * FROM modules"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + foreach( $Result as $R ){ + $QS = "SELECT * FROM module_types WHERE id={$R['type']}"; + $MOMO = $DATABASE->Query( $QS, false ); + $MOD = $MOMO[0]; + switch( $R['type'] ){ + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel($MOD['name']).'\'}'; + break; + default: + $ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$R['device'].'\'}'; + }; + }; + $Data['status']='ok'; + $Data['modules'] = '['.implode( ',', $ModPart ) .']'; + } else { + $Data['status']='na'; + }; + $Data['messages'] = ob_get_clean(); + echo json_encode( $Data ); + } else { + header('location: /'); + }; + + +?> \ No newline at end of file diff --git a/lib/controller/getResources.php b/lib/controller/getResources.php new file mode 100644 index 0000000..416f7e4 --- /dev/null +++ b/lib/controller/getResources.php @@ -0,0 +1,70 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + $QS = "SELECT * FROM resources WHERE `node_id`=1"; + $Result = $DATABASE->Query( $QS, false ); + if( count( $Result ) ){ + foreach( $Result as $R ){ + switch( $R['type'] ){ + case 1: + //Uart + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 6: + //USB DC + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('UART_LINE_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 31: + //Video Grabber + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('FRAMEGRAB_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 100: + //Loopback + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('LOOPBACK_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 101: + //Ethernet Interface + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('ETHERNET_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 102: + //WiFi Interface + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('WIFI_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 103: + //Virtual IP Interface + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('VIRTUALIP_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 104: + //VPN Interface + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('VPN_TUN_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + case 105: + //WAN Interface + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$Labels->GetLabel('WAN_LINE_PROP').' '.(($R['used']==0)?'':'').'\'}'; + break; + //Media Encoder Sink + case 131: // Video Encoder Sink + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.'Video Sink'.' '.(($R['used']==0)?'':'').'\'}'; + break; + case 132: // Audio Encoder Sink + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.'Audio Sink'.' '.(($R['used']==0)?'':'').'\'}'; + break; + default: + $SockDataParts[] = '{ xtype: \'panel\', boder: false, frame: false, html: \''.$R['device'].' '.(($R['used']==0)?'':'').'\'}'; + }; + }; + $Data['resources'] = '['.implode( ',', $SockDataParts ).']'; + $Data['status']='ok'; + } else { + $Data['status']='na'; + $Data['resources'] = array(); + }; + $Data['messages'] = ob_get_clean(); + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getServerStatus.php b/lib/controller/getServerStatus.php new file mode 100644 index 0000000..b885598 --- /dev/null +++ b/lib/controller/getServerStatus.php @@ -0,0 +1,31 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $UID > 1 ){ + ob_start(); + @$MEMDB = new SQLite_DB( '/dev/shm/argus/mem_db.db'); + $QS = "SELECT * FROM `servers` LIMIT 1"; + $RV = $MEMDB->Query( $QS ); + if( count( $RV ) ){ + if( ( time() - intval( $RV[0]['ts'] ) ) < 3 ){ + $Data['status']='ok'; + $Data['stats']=$RV[0]; + $Data['online'] = 1; + } else { + $Data['status']='na'; + $Data['stats'] = array(); + $Data['online'] = 0; + }; + } else { + $Data['status']='na'; + $Data['stats'] = array(); + $Data['online'] = 0; + }; + $Data['messages'] = ob_get_clean(); + } else { + header('location: /'); + exit(); + }; + echo json_encode( $Data ); +?> \ No newline at end of file diff --git a/lib/controller/getVideoFeed.php b/lib/controller/getVideoFeed.php deleted file mode 100644 index 262a5d0..0000000 --- a/lib/controller/getVideoFeed.php +++ /dev/null @@ -1,59 +0,0 @@ -Data['id'] > 1 ){ - header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); - header("Cache-Control: post-check=0, pre-check=0", false); - header("Pragma: no-cache"); - if(isset( $_POST['FID'] )){ - $FID = intval($_POST['FID']); - } else { - $FID = intval($_GET['FID']); - }; - if(isset( $_POST['AUX'] )){ - $AUX = intval($_POST['AUX']); - } else { - $AUX = intval($_GET['AUX']); - }; - if( $FID > 0 ){ - $QS = "SELECT cs.picture AS pic_url, cs.picture_proto AS pic_proto, cs.picture_port AS pic_port, ca.* FROM media_streams cs LEFT JOIN cameras ca ON ( ca.id = cs.source_id ) WHERE cs.id={$FID}"; - $Result = $DATABASE->Query( $QS, false ); - if( count( $Result ) ){ - //var_dump( $Result[0] ); - $soap_do = curl_init(); - //$TURL = "http://{$Result[0]['access_login']}:{$Result[0]['access_pass']}@192.168.200.113/onvifsnapshot/media_service/snapshot?channel=1&subtype=0"; - $URL = $Result[0]['pic_proto'] . '://' . $Result[0]['ip'] .':'. $Result[0]['pic_port'] . $Result[0]['pic_url']; - curl_setopt($soap_do, CURLOPT_URL, $URL ); - curl_setopt($soap_do, CURLOPT_CONNECTTIMEOUT, 20); - curl_setopt($soap_do, CURLOPT_TIMEOUT, 20); - curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST); - curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true); - curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true ); - curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, false); - //curl_setopt($soap_do, CURLOPT_USERNAME, $Result[0]['access_login']); - curl_setopt($soap_do, CURLOPT_USERPWD, $Result[0]['access_login'] . ":" . $Result[0]['access_pass'] ); - if( ( $data = curl_exec($soap_do) ) === false ){ - $err = curl_error($soap_do); - echo $err; - } else { - //$AA = curl_getinfo( $soap_do ); - //var_dump($AA); - if( $AUX > 0 ){ - $Image = imagecreatefromstring($data); - $Simage = imagescale( $Image, $AUX, -1, IMG_NEAREST_NEIGHBOUR ); - header("Content-type: image/jpeg"); - imagejpeg($Simage); - } else { - header("Content-type: image/jpeg"); - echo $data; - }; - }; - } else { - //echo "\n\nNores!"; - loadNotPicture( $AUX ); - }; - exit(); - }; - }; - header('location: /'); -?> \ No newline at end of file diff --git a/lib/controller/help/topic_100.json b/lib/controller/help/topic_100.json new file mode 100644 index 0000000..ea8f37e --- /dev/null +++ b/lib/controller/help/topic_100.json @@ -0,0 +1,4 @@ +{ + xtype: 'panel', + html: 'Help Topic 100' +} \ No newline at end of file diff --git a/lib/controller/output.jpg b/lib/controller/output.jpg new file mode 100644 index 0000000..79af03e Binary files /dev/null and b/lib/controller/output.jpg differ diff --git a/lib/controller/test.sh b/lib/controller/test.sh new file mode 100755 index 0000000..bf9fe65 --- /dev/null +++ b/lib/controller/test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + + +#v4l2-ctl --device /dev/video0 --list-formats-ext + +#v4l2-ctl \ +# --device /dev/video0 \ +# --set-fmt-video=width=1280,height=720,pixelformat=MJPG \ +# --stream-mmap --stream-to=frame.raw --stream-count=1 + +#v4l2-ctl --device /dev/video0 -set-fmt-video=width=1280,height=720,pixelformat=MJPG + +#ffmpeg -y -f rawvideo -pix_fmt mjpg -ss 00:01 -r 1 -s 640x480 -i frame.raw -frames:v 1 output.png + +ffmpeg -f video4linux2 -i /dev/video0 -frames:v 3 -update 1 output.jpg \ No newline at end of file diff --git a/lib/controller/updateUserSssion.php b/lib/controller/validateUserSession.php similarity index 100% rename from lib/controller/updateUserSssion.php rename to lib/controller/validateUserSession.php diff --git a/lib/controller/addCameraNode.php b/lib/controller/zuza/addCameraNode.php similarity index 100% rename from lib/controller/addCameraNode.php rename to lib/controller/zuza/addCameraNode.php diff --git a/lib/controller/addConnection.php b/lib/controller/zuza/addConnection.php similarity index 100% rename from lib/controller/addConnection.php rename to lib/controller/zuza/addConnection.php diff --git a/lib/controller/addDetectionProfile.php b/lib/controller/zuza/addDetectionProfile.php similarity index 100% rename from lib/controller/addDetectionProfile.php rename to lib/controller/zuza/addDetectionProfile.php diff --git a/lib/controller/addServerModule.php b/lib/controller/zuza/addServerModule.php similarity index 73% rename from lib/controller/addServerModule.php rename to lib/controller/zuza/addServerModule.php index ff7cac5..c3687e7 100644 --- a/lib/controller/addServerModule.php +++ b/lib/controller/zuza/addServerModule.php @@ -7,13 +7,13 @@ $Z = intval( $_POST['SERVID'] ); $T = intval( $_POST['TYPE'] ); if( $Z && $T ){ - $QS = "SELECT * FROM `server_module_types` WHERE `id`={$T}"; + $QS = "SELECT * FROM `module_types` WHERE `id`={$T}"; $ZZ = $DATABASE->Query( $QS ); if( count( $ZZ ) ){ $CTI = $ZZ[0]; $ADE = true; if( $CTI['allow_multiply'] == 0 ){ - $QS = "SELECT * FROM `server_modules` WHERE `server_id`={$Z} AND `type`={$T}"; + $QS = "SELECT * FROM `modules` WHERE `type`={$T}"; $SS = $DATABASE->Query( $QS ); if( count( $SS ) ){ $ADE = false; @@ -21,14 +21,14 @@ }; }; if( $ADE ){ - $QS = "INSERT INTO `server_modules` SET `server_id`={$Z}, `type`={$T}, `enabled`=0"; + $QS = "INSERT INTO `modules` (`type`,`enabled`) VALUES({$T},0)"; $DATABASE->Query( $QS ); $MID = $DATABASE->getLastInsertID(); $MCID = 0; switch( $T ){ case 3:{ //Kafka - $QS = "INSERT INTO `modules_kafka` SET `brocker_port`=2929"; + $QS = "INSERT INTO `module_kafka`(`brocker_port`) VALUES(2929)"; $DATABASE->Query( $QS ); $MCID = $DATABASE->getLastInsertID(); @@ -36,13 +36,13 @@ }; case 9:{ //EmbedVido - $QS = "INSERT INTO `module_embed_video_settings` SET `web_port`=8972"; + $QS = "INSERT INTO `module_embed_video_settings`(`web_port`) VALUES(8972)"; $DATABASE->Query( $QS ); $MCID = $DATABASE->getLastInsertID(); break; }; }; - $QS = "UPDATE `server_modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; + $QS = "UPDATE `modules` SET `aux_id`={$MCID} WHERE `id`={$MID}"; $DATABASE->Query( $QS ); $Data['status'] = 'ok'; }; diff --git a/lib/controller/addWidthTableRow.php b/lib/controller/zuza/addWidthTableRow.php similarity index 100% rename from lib/controller/addWidthTableRow.php rename to lib/controller/zuza/addWidthTableRow.php diff --git a/lib/controller/camMakeMove.php b/lib/controller/zuza/camMakeMove.php similarity index 100% rename from lib/controller/camMakeMove.php rename to lib/controller/zuza/camMakeMove.php diff --git a/lib/controller/camStop.php b/lib/controller/zuza/camStop.php similarity index 100% rename from lib/controller/camStop.php rename to lib/controller/zuza/camStop.php diff --git a/lib/controller/checkDeviceOperation.php b/lib/controller/zuza/checkDeviceOperation.php similarity index 100% rename from lib/controller/checkDeviceOperation.php rename to lib/controller/zuza/checkDeviceOperation.php diff --git a/lib/controller/clearEventCloud.php b/lib/controller/zuza/clearEventCloud.php similarity index 100% rename from lib/controller/clearEventCloud.php rename to lib/controller/zuza/clearEventCloud.php diff --git a/lib/controller/clearServerLog.php b/lib/controller/zuza/clearServerLog.php similarity index 100% rename from lib/controller/clearServerLog.php rename to lib/controller/zuza/clearServerLog.php diff --git a/lib/controller/getAnalogStreamCtrl.php b/lib/controller/zuza/getAnalogStreamCtrl.php similarity index 100% rename from lib/controller/getAnalogStreamCtrl.php rename to lib/controller/zuza/getAnalogStreamCtrl.php diff --git a/lib/controller/getCameraSettings.php b/lib/controller/zuza/getCameraSettings.php similarity index 100% rename from lib/controller/getCameraSettings.php rename to lib/controller/zuza/getCameraSettings.php diff --git a/lib/controller/getDashBoardItems.php b/lib/controller/zuza/getDashBoardItems.php similarity index 99% rename from lib/controller/getDashBoardItems.php rename to lib/controller/zuza/getDashBoardItems.php index 6396614..88ca0ab 100644 --- a/lib/controller/getDashBoardItems.php +++ b/lib/controller/zuza/getDashBoardItems.php @@ -4,7 +4,7 @@ $SiteID = intval( $_POST['SITE'] ); $UID = intval( $CUser->Data['id'] ); - $QS = "SELECT * FROM nodes WHERE site_id = {$SiteID}"; + $QS = "SELECT * FROM nodes "; $result = $DATABASE->Query( $QS, false ); $P1="{ columnWidth: '320px', style:'padding:10px 0 10px 10px', items:["; $P2="]}"; diff --git a/lib/controller/getDashBoardStatus.php b/lib/controller/zuza/getDashBoardStatus.php similarity index 100% rename from lib/controller/getDashBoardStatus.php rename to lib/controller/zuza/getDashBoardStatus.php diff --git a/lib/controller/getDetectionProfile.php b/lib/controller/zuza/getDetectionProfile.php similarity index 100% rename from lib/controller/getDetectionProfile.php rename to lib/controller/zuza/getDetectionProfile.php diff --git a/lib/controller/getDeviceDraw.php b/lib/controller/zuza/getDeviceDraw.php similarity index 100% rename from lib/controller/getDeviceDraw.php rename to lib/controller/zuza/getDeviceDraw.php diff --git a/lib/controller/getDeviceMask.php b/lib/controller/zuza/getDeviceMask.php similarity index 100% rename from lib/controller/getDeviceMask.php rename to lib/controller/zuza/getDeviceMask.php diff --git a/lib/controller/getEventDates.php b/lib/controller/zuza/getEventDates.php similarity index 78% rename from lib/controller/getEventDates.php rename to lib/controller/zuza/getEventDates.php index 7e26f4d..bbbf5dc 100644 --- a/lib/controller/getEventDates.php +++ b/lib/controller/zuza/getEventDates.php @@ -7,9 +7,9 @@ if( isset( $_POST['SMO'] ) ) $SMO = intval( $_POST['SMO'] ); else $SMO = intval(date("m")); //Current Month $Data = array(); if( $FID ){ - $QS = "SELECT DISTINCT DAY(FROM_UNIXTIME(ts)) as d FROM events_archive WHERE node_id={$FID} AND YEAR(FROM_UNIXTIME(ts))={$SYE} AND MONTH(FROM_UNIXTIME(ts))={$SMO}"; + $QS = "SELECT DISTINCT DAY(FROM_UNIXTIME(ts)) as d FROM events WHERE node_id={$FID} AND YEAR(FROM_UNIXTIME(ts))={$SYE} AND MONTH(FROM_UNIXTIME(ts))={$SMO}"; } else { - $QS = "SELECT DISTINCT DAY(FROM_UNIXTIME(ts)) as d FROM events_archive WHERE YEAR(FROM_UNIXTIME(ts))={$SYE} AND MONTH(FROM_UNIXTIME(ts))={$SMO}"; + $QS = "SELECT DISTINCT DAY(FROM_UNIXTIME(ts)) as d FROM events WHERE YEAR(FROM_UNIXTIME(ts))={$SYE} AND MONTH(FROM_UNIXTIME(ts))={$SMO}"; }; $Data['status'] = 'ok'; $Data['days'] = array(); diff --git a/lib/controller/getEventProps.php b/lib/controller/zuza/getEventProps.php similarity index 100% rename from lib/controller/getEventProps.php rename to lib/controller/zuza/getEventProps.php diff --git a/lib/controller/getEventRecords.php b/lib/controller/zuza/getEventRecords.php similarity index 100% rename from lib/controller/getEventRecords.php rename to lib/controller/zuza/getEventRecords.php diff --git a/lib/controller/getGeoAlerts.php b/lib/controller/zuza/getGeoAlerts.php similarity index 100% rename from lib/controller/getGeoAlerts.php rename to lib/controller/zuza/getGeoAlerts.php diff --git a/lib/controller/getGeoZones.php b/lib/controller/zuza/getGeoZones.php similarity index 99% rename from lib/controller/getGeoZones.php rename to lib/controller/zuza/getGeoZones.php index 0fd35f8..a90abac 100644 --- a/lib/controller/getGeoZones.php +++ b/lib/controller/zuza/getGeoZones.php @@ -147,9 +147,8 @@ function ToLL($north, $east, $utmZone){ if( $CUser->Data['id'] > 1 ){ $Data = array(); - $SID = intval( $_POST['SITE'] ); if( $SID ){ - $QS = "SELECT * FROM `sites` WHERE `id`={$SID}"; + $QS = "SELECT * FROM system_props LIMIT 1"; $SR = $DATABASE->Query( $QS, false ); if( count( $SR ) ){ $SS = $SR[0]; diff --git a/lib/controller/zuza/getHelpTopic.php b/lib/controller/zuza/getHelpTopic.php new file mode 100644 index 0000000..934c014 --- /dev/null +++ b/lib/controller/zuza/getHelpTopic.php @@ -0,0 +1,12 @@ +Data['id'] > 1 ){ + $TID = intval( $_POST['TID'] ); + if( $TID ){ + echo file_get_contents('help/topic_'.$TID.'.json'); + exit(); + } + echo "{ xtype:'panel', html: 'Wrong Help Topic ID' }"; + }; + header( 'location: / '); +?> \ No newline at end of file diff --git a/lib/controller/getIpCamCredentials.php b/lib/controller/zuza/getIpCamCredentials.php similarity index 100% rename from lib/controller/getIpCamCredentials.php rename to lib/controller/zuza/getIpCamCredentials.php diff --git a/lib/controller/getLocationItems.php b/lib/controller/zuza/getLocationItems.php similarity index 100% rename from lib/controller/getLocationItems.php rename to lib/controller/zuza/getLocationItems.php diff --git a/lib/controller/getLocationNodeProps.php b/lib/controller/zuza/getLocationNodeProps.php similarity index 100% rename from lib/controller/getLocationNodeProps.php rename to lib/controller/zuza/getLocationNodeProps.php diff --git a/lib/controller/getLocationNodes.php b/lib/controller/zuza/getLocationNodes.php similarity index 100% rename from lib/controller/getLocationNodes.php rename to lib/controller/zuza/getLocationNodes.php diff --git a/lib/controller/getM3U8.php b/lib/controller/zuza/getM3U8.php similarity index 100% rename from lib/controller/getM3U8.php rename to lib/controller/zuza/getM3U8.php diff --git a/lib/controller/getMaskSchedule.php b/lib/controller/zuza/getMaskSchedule.php similarity index 100% rename from lib/controller/getMaskSchedule.php rename to lib/controller/zuza/getMaskSchedule.php diff --git a/lib/controller/getMaskScheduleEditor.php b/lib/controller/zuza/getMaskScheduleEditor.php similarity index 100% rename from lib/controller/getMaskScheduleEditor.php rename to lib/controller/zuza/getMaskScheduleEditor.php diff --git a/lib/controller/getNetwork.php b/lib/controller/zuza/getNetwork.php similarity index 97% rename from lib/controller/getNetwork.php rename to lib/controller/zuza/getNetwork.php index 97d98f2..8e31027 100644 --- a/lib/controller/getNetwork.php +++ b/lib/controller/zuza/getNetwork.php @@ -20,7 +20,7 @@ // $index++; //}; - $QS = "SELECT * FROM nodes WHERE site_id ={$GID}"; + $QS = "SELECT * FROM nodes"; $Result = $DATABASE->Query( $QS, false ); foreach( $Result as $CD ){ $cnode['id'] = $CD['id'];//$index; @@ -93,7 +93,7 @@ }; $Data['nodes'][] = $cnode; }; - $QS = "SELECT * FROM connections WHERE site_id = {$GID}"; + $QS = "SELECT * FROM connections";// WHERE site_id = {$GID}"; $Result = $DATABASE->Query( $QS, false ); $cedge = array(); foreach( $Result as $CD ){ diff --git a/lib/controller/getNetworkNodeProps.php b/lib/controller/zuza/getNetworkNodeProps.php similarity index 100% rename from lib/controller/getNetworkNodeProps.php rename to lib/controller/zuza/getNetworkNodeProps.php diff --git a/lib/controller/getNetworkSe2rverProps.php b/lib/controller/zuza/getNetworkSe2rverProps.php similarity index 100% rename from lib/controller/getNetworkSe2rverProps.php rename to lib/controller/zuza/getNetworkSe2rverProps.php diff --git a/lib/controller/getNodeAdvancedNfo.php b/lib/controller/zuza/getNodeAdvancedNfo.php similarity index 100% rename from lib/controller/getNodeAdvancedNfo.php rename to lib/controller/zuza/getNodeAdvancedNfo.php diff --git a/lib/controller/getNodeBasicNfo.php b/lib/controller/zuza/getNodeBasicNfo.php similarity index 100% rename from lib/controller/getNodeBasicNfo.php rename to lib/controller/zuza/getNodeBasicNfo.php diff --git a/lib/controller/getNodeSettings.php b/lib/controller/zuza/getNodeSettings.php similarity index 100% rename from lib/controller/getNodeSettings.php rename to lib/controller/zuza/getNodeSettings.php diff --git a/lib/controller/getPicture.php b/lib/controller/zuza/getPicture.php similarity index 100% rename from lib/controller/getPicture.php rename to lib/controller/zuza/getPicture.php diff --git a/lib/controller/getResourceInfo.php b/lib/controller/zuza/getResourceInfo.php similarity index 100% rename from lib/controller/getResourceInfo.php rename to lib/controller/zuza/getResourceInfo.php diff --git a/lib/controller/getSettingsLRF.php b/lib/controller/zuza/getSettingsLRF.php similarity index 100% rename from lib/controller/getSettingsLRF.php rename to lib/controller/zuza/getSettingsLRF.php diff --git a/lib/controller/getStatus.php b/lib/controller/zuza/getStatus.php similarity index 98% rename from lib/controller/getStatus.php rename to lib/controller/zuza/getStatus.php index f3f780a..805d9c5 100644 --- a/lib/controller/getStatus.php +++ b/lib/controller/zuza/getStatus.php @@ -13,7 +13,7 @@ $Data['status'] = 'OK'; $Data['CTS'] = time(); $Data['nodes'] = array(); - $QS = "SELECT * FROM nodes WHERE site_id = {$SiteID} ORDER BY `type`"; + $QS = "SELECT * FROM nodes ORDER BY `type`"; $result = $DATABASE->Query( $QS, false ); if( count( $result ) > 0 ){ foreach( $result as $R ){ @@ -180,6 +180,7 @@ }; // Notifications $Data['notifications'] = array(); + /* $QS = "SELECT * FROM `notifications` WHERE `status`='A' AND `site_id`={$SiteID} AND `id` > {$LastNID}"; $result = $DATABASE->Query( $QS ); if( count( $result ) ){ @@ -206,7 +207,7 @@ }; $Data['notifications'][] = $cn; }; - }; + };*/ } else { $Data['notifications'] = array(); $Data['status']='LOGOUT'; diff --git a/lib/controller/getTimeLineEvents.php b/lib/controller/zuza/getTimeLineEvents.php similarity index 100% rename from lib/controller/getTimeLineEvents.php rename to lib/controller/zuza/getTimeLineEvents.php diff --git a/lib/controller/getTimeLineGroups.php b/lib/controller/zuza/getTimeLineGroups.php similarity index 100% rename from lib/controller/getTimeLineGroups.php rename to lib/controller/zuza/getTimeLineGroups.php diff --git a/lib/controller/getWidthTable.php b/lib/controller/zuza/getWidthTable.php similarity index 100% rename from lib/controller/getWidthTable.php rename to lib/controller/zuza/getWidthTable.php diff --git a/lib/controller/getWidthTableEditor.php b/lib/controller/zuza/getWidthTableEditor.php similarity index 100% rename from lib/controller/getWidthTableEditor.php rename to lib/controller/zuza/getWidthTableEditor.php diff --git a/lib/controller/listAccessLog.php b/lib/controller/zuza/listAccessLog.php similarity index 100% rename from lib/controller/listAccessLog.php rename to lib/controller/zuza/listAccessLog.php diff --git a/lib/controller/zuza/listAndDiscoverLocalSources.php b/lib/controller/zuza/listAndDiscoverLocalSources.php new file mode 100644 index 0000000..5e1cdb2 --- /dev/null +++ b/lib/controller/zuza/listAndDiscoverLocalSources.php @@ -0,0 +1,53 @@ +Data['id'] > 1 ){ + if( 1 ){ + $onvif = new Ponvif(); + $result = $onvif->discover(); + if(count($result)){ + foreach( $result as $R ){ + if(isset($R['EndpointReference'])){ + if(isset($R['EndpointReference']['Address'])){ + $TArr = explode( ':', $R['EndpointReference']['Address'] ); + $CA = $DATABASE->escape( $TArr[2] ); + $TArr = explode( ' ', $R['Scopes']); + $CM = ''; + $CI = $DATABASE->escape($R['IPAddr']); + $Frr = explode( ' ', $R['XAddrs']); + $Crr = explode( $CI, $Frr[0] ); + $CP = $DATABASE->escape($Crr[1]); + $CN = ''; + $CH = ''; + $CC = 0; + foreach( $TArr as $T ){ + $TT = str_ireplace('onvif://www.onvif.org/','', $T ); + $TBrr = explode( '/', $TT ); + if( stripos($TBrr[0],'type') !== false ){ + if( stripos($TBrr[1],'video') !== false ) $CC |= 0x1; + if( stripos($TBrr[1],'audio') !== false ) $CC |= 0x2; + if( stripos($TBrr[1],'ptz') !== false ) $CC |= 0x4; + }; + if( stripos($TBrr[0],'name') !== false ) $CN = $DATABASE->escape(urldecode($TBrr[1])); + if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); + if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); + }; + $QS = "INSERT INTO cameras SET caps={$CC}, hardware='{$CH}', name='{$CN}', uuid='{$CA}', mac='{$CM}', ip='{$CI}', status=1, onvif_ctrl='{$CP}' ON DUPLICATE KEY UPDATE ip='{$CI}'"; + $DATABASE->Query($QS,false); + }; + }; + }; + }; + }; + $QS = "SELECT * FROM cameras WHERE status = 1"; + $Result = $DATABASE->Query($QS,false); + foreach( $Result as $CD ){ + $cnode['id'] = $CD['id']; + $cnode['title'] = $CD['name']; + $Data['nodes'][] = $cnode; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/listAndDiscoverOnvifProfiles.php b/lib/controller/zuza/listAndDiscoverOnvifProfiles.php similarity index 100% rename from lib/controller/listAndDiscoverOnvifProfiles.php rename to lib/controller/zuza/listAndDiscoverOnvifProfiles.php diff --git a/lib/controller/zuza/listAndDiscoverOnvifSources.php b/lib/controller/zuza/listAndDiscoverOnvifSources.php new file mode 100644 index 0000000..5e1cdb2 --- /dev/null +++ b/lib/controller/zuza/listAndDiscoverOnvifSources.php @@ -0,0 +1,53 @@ +Data['id'] > 1 ){ + if( 1 ){ + $onvif = new Ponvif(); + $result = $onvif->discover(); + if(count($result)){ + foreach( $result as $R ){ + if(isset($R['EndpointReference'])){ + if(isset($R['EndpointReference']['Address'])){ + $TArr = explode( ':', $R['EndpointReference']['Address'] ); + $CA = $DATABASE->escape( $TArr[2] ); + $TArr = explode( ' ', $R['Scopes']); + $CM = ''; + $CI = $DATABASE->escape($R['IPAddr']); + $Frr = explode( ' ', $R['XAddrs']); + $Crr = explode( $CI, $Frr[0] ); + $CP = $DATABASE->escape($Crr[1]); + $CN = ''; + $CH = ''; + $CC = 0; + foreach( $TArr as $T ){ + $TT = str_ireplace('onvif://www.onvif.org/','', $T ); + $TBrr = explode( '/', $TT ); + if( stripos($TBrr[0],'type') !== false ){ + if( stripos($TBrr[1],'video') !== false ) $CC |= 0x1; + if( stripos($TBrr[1],'audio') !== false ) $CC |= 0x2; + if( stripos($TBrr[1],'ptz') !== false ) $CC |= 0x4; + }; + if( stripos($TBrr[0],'name') !== false ) $CN = $DATABASE->escape(urldecode($TBrr[1])); + if( stripos($TBrr[0],'hardware') !== false ) $CH = $DATABASE->escape(urldecode($TBrr[1])); + if( stripos($TBrr[0],'mac') !== false ) $CM = $DATABASE->escape(urldecode($TBrr[1])); + }; + $QS = "INSERT INTO cameras SET caps={$CC}, hardware='{$CH}', name='{$CN}', uuid='{$CA}', mac='{$CM}', ip='{$CI}', status=1, onvif_ctrl='{$CP}' ON DUPLICATE KEY UPDATE ip='{$CI}'"; + $DATABASE->Query($QS,false); + }; + }; + }; + }; + }; + $QS = "SELECT * FROM cameras WHERE status = 1"; + $Result = $DATABASE->Query($QS,false); + foreach( $Result as $CD ){ + $cnode['id'] = $CD['id']; + $cnode['title'] = $CD['name']; + $Data['nodes'][] = $cnode; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/zuza/listDiscoveredOnvifProfiles.php b/lib/controller/zuza/listDiscoveredOnvifProfiles.php new file mode 100644 index 0000000..c3f7db0 --- /dev/null +++ b/lib/controller/zuza/listDiscoveredOnvifProfiles.php @@ -0,0 +1,23 @@ +Data['id'] > 1 ){ + $Data = array(); + if( isset( $_POST['CID'] ) ){ + $ECID = intval( $_POST['CID'] ); + $QS = "SELECT * FROM camera_streams WHERE camera_id={$ECID}"; + $Result = $DATABASE->Query($QS,false); + foreach( $Result as $CD ){ + $cnode['id'] = $CD['id']; + $cnode['name'] = $CD['name']; + $cnode['size'] = $CD['img_width'].'x'.$CD['img_height'].'@'.$CD['fps']; + $cnode['encode'] = $CD['compression_type']; + $cnode['bitrate'] = $CD['bitrate']; + $Data['nodes'][] = $cnode; + }; + }; + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/listMediaSources.php b/lib/controller/zuza/listMediaSources.php similarity index 100% rename from lib/controller/listMediaSources.php rename to lib/controller/zuza/listMediaSources.php diff --git a/lib/controller/listNodeSockets.php b/lib/controller/zuza/listNodeSockets.php similarity index 100% rename from lib/controller/listNodeSockets.php rename to lib/controller/zuza/listNodeSockets.php diff --git a/lib/controller/listServerLog.php b/lib/controller/zuza/listServerLog.php similarity index 100% rename from lib/controller/listServerLog.php rename to lib/controller/zuza/listServerLog.php diff --git a/lib/controller/listServers.php b/lib/controller/zuza/listServers.php similarity index 100% rename from lib/controller/listServers.php rename to lib/controller/zuza/listServers.php diff --git a/lib/controller/listUarts.php b/lib/controller/zuza/listUarts.php similarity index 100% rename from lib/controller/listUarts.php rename to lib/controller/zuza/listUarts.php diff --git a/lib/controller/listUsers.php b/lib/controller/zuza/listUsers.php similarity index 100% rename from lib/controller/listUsers.php rename to lib/controller/zuza/listUsers.php diff --git a/lib/controller/removeNode.php b/lib/controller/zuza/removeNode.php similarity index 100% rename from lib/controller/removeNode.php rename to lib/controller/zuza/removeNode.php diff --git a/lib/controller/resetAllSettings.php b/lib/controller/zuza/resetAllSettings.php similarity index 100% rename from lib/controller/resetAllSettings.php rename to lib/controller/zuza/resetAllSettings.php diff --git a/lib/controller/setAnalogStreamCtrl.php b/lib/controller/zuza/setAnalogStreamCtrl.php similarity index 100% rename from lib/controller/setAnalogStreamCtrl.php rename to lib/controller/zuza/setAnalogStreamCtrl.php diff --git a/lib/controller/setSettingsLidsr3D.php b/lib/controller/zuza/setSettingsLidsr3D.php similarity index 100% rename from lib/controller/setSettingsLidsr3D.php rename to lib/controller/zuza/setSettingsLidsr3D.php diff --git a/lib/controller/updateDashBoardItems.php b/lib/controller/zuza/updateDashBoardItems.php similarity index 100% rename from lib/controller/updateDashBoardItems.php rename to lib/controller/zuza/updateDashBoardItems.php diff --git a/lib/controller/updateDetecttionProfile.php b/lib/controller/zuza/updateDetecttionProfile.php similarity index 100% rename from lib/controller/updateDetecttionProfile.php rename to lib/controller/zuza/updateDetecttionProfile.php diff --git a/lib/controller/updateLocation.php b/lib/controller/zuza/updateLocation.php similarity index 100% rename from lib/controller/updateLocation.php rename to lib/controller/zuza/updateLocation.php diff --git a/lib/controller/updateLrfSettings.php b/lib/controller/zuza/updateLrfSettings.php similarity index 100% rename from lib/controller/updateLrfSettings.php rename to lib/controller/zuza/updateLrfSettings.php diff --git a/lib/controller/updateLrfSettings_baseshift.php b/lib/controller/zuza/updateLrfSettings_baseshift.php similarity index 100% rename from lib/controller/updateLrfSettings_baseshift.php rename to lib/controller/zuza/updateLrfSettings_baseshift.php diff --git a/lib/controller/updateResource.php b/lib/controller/zuza/updateResource.php similarity index 100% rename from lib/controller/updateResource.php rename to lib/controller/zuza/updateResource.php diff --git a/lib/controller/updateServerModuleSettings.php b/lib/controller/zuza/updateServerModuleSettings.php similarity index 100% rename from lib/controller/updateServerModuleSettings.php rename to lib/controller/zuza/updateServerModuleSettings.php diff --git a/lib/controller/updateUartSettings.php b/lib/controller/zuza/updateUartSettings.php similarity index 100% rename from lib/controller/updateUartSettings.php rename to lib/controller/zuza/updateUartSettings.php diff --git a/lib/controller/uploadAsset.php b/lib/controller/zuza/uploadAsset.php similarity index 100% rename from lib/controller/uploadAsset.php rename to lib/controller/zuza/uploadAsset.php diff --git a/lib/controller/uploadDeviceMask.php b/lib/controller/zuza/uploadDeviceMask.php similarity index 100% rename from lib/controller/uploadDeviceMask.php rename to lib/controller/zuza/uploadDeviceMask.php diff --git a/lib/controller/uploadModuleKafkaData.php b/lib/controller/zuza/uploadModuleKafkaData.php similarity index 100% rename from lib/controller/uploadModuleKafkaData.php rename to lib/controller/zuza/uploadModuleKafkaData.php diff --git a/lib/controller/validateNode.php b/lib/controller/zuza/validateNode.php similarity index 100% rename from lib/controller/validateNode.php rename to lib/controller/zuza/validateNode.php diff --git a/lib/javascript/jsapi_dynamic/mojo_monitoring.js b/lib/javascript/jsapi_dynamic/mojo_monitoring.js new file mode 100644 index 0000000..299a62e --- /dev/null +++ b/lib/javascript/jsapi_dynamic/mojo_monitoring.js @@ -0,0 +1,12 @@ +// + +function initMonitoring(){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + timelineObj = null; + }; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); + tPanel.doLayout(); +}; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/mojo_settings.js b/lib/javascript/jsapi_dynamic/mojo_settings.js new file mode 100644 index 0000000..f8340e0 --- /dev/null +++ b/lib/javascript/jsapi_dynamic/mojo_settings.js @@ -0,0 +1,1498 @@ +// + +var helpContentTopicID = -1; + +function loadHelpContent( topicID ){ + if( helpContentTopicID == topicID ) return; + helpContentTopicID = topicID; + Ext.Ajax.request({ + url: '/lib/controller/getHelpTopic.php', + params: { + UID: , + SID: '', + TID: topicID + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('help_content'); + tPanel.removeAll( true ); + tPanel.add( tData ); + tPanel.doLayout(); + }, + failure: failureAJAXFunction + }); +}; + +function clearHelpContent(){ + helpContentTopicID = -1; +}; + +function loadRessources(){ + Ext.Ajax.request({ + url: '/lib/controller/getResources.php', + params: { + UID: , + SID: '', + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('resources_container'); + if( tData.status == 'ok' ){ + var res = Ext.decode( tData.resources ); + tPanel.removeAll( true ); + tPanel.add( res ); + tPanel.doLayout(); + } else { + }; + }, + failure: failureAJAXFunction + }); +}; + +function loadModules(){ + Ext.Ajax.request({ + url: '/lib/controller/getModules.php', + params: { + UID: , + SID: '', + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('modules_container'); + if( tData.status == 'ok' ){ + var res = Ext.decode( tData.modules ); + tPanel.removeAll( true ); + tPanel.add( res ); + tPanel.doLayout(); + } else { + tPanel.removeAll( true ); + tPanel.doLayout(); + var tPanel = Ext.getCmp('mod_ed_small'); + tPanel.removeAll( true ); + tPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + tPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); +}; + +function loadDetectedCameras(){ + Ext.Ajax.request({ + url: '/lib/controller/getCameras.php', + params: { + UID: , + TYP: 0, + SID: '', + }, + success: function( response, opts ){ + var tData = Ext.decode(response.responseText); + var tPanel = Ext.getCmp('dcam_container'); + if( tData.status == 'ok' ){ + var res = Ext.decode( tData.cameras ); + tPanel.removeAll( true ); + tPanel.add( res ); + tPanel.doLayout(); + } else { + tPanel.removeAll( true ); + tPanel.doLayout(); + var tPanel = Ext.getCmp('mod_ed_small'); + tPanel.removeAll( true ); + tPanel.add( { html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' } ); + tPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); +}; + +function loadAssignedCameras(){ + +}; + +function editResource( rid ){ + var loadEditor = true; + if( settingsAreChanged ){ + Ext.Msg.show({ + title:'GetLabel('_SETTINGS_CHANGED_');?>', + msg: 'GetLabel('_SET_CHANGED_WOULD_SAVE_');?>', + buttons: Ext.Msg.YESNO, + icon: Ext.MessageBox.WARNING, + fn: function(btn, text){ + if( btn == 'yes' ){ + cleanupChangeNotifier(); + } else { + loadEditor = false; + }; + } + }); + }; + if( loadEditor ){ + Ext.Ajax.request({ + url: '/lib/controller/getResourceEditor.php', + params: { + RID: rid, + UID: , + SID: '', + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + var resourceEdPanel = Ext.getCmp('res_ed_small'); + if( resourceEdPanel ){ + resourceEdPanel.removeAll( true ); + resourceEdPanel.add( data ); + resourceEdPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); + }; +}; + +function editModule( mid ){ + var loadEditor = true; + if( settingsAreChanged ){ + Ext.Msg.show({ + title:'GetLabel('_SETTINGS_CHANGED_');?>', + msg: 'GetLabel('_SET_CHANGED_WOULD_SAVE_');?>', + buttons: Ext.Msg.YESNO, + icon: Ext.MessageBox.WARNING, + fn: function(btn, text){ + if( btn == 'yes' ){ + cleanupChangeNotifier(); + } else { + loadEditor = false; + }; + } + }); + }; + if( loadEditor ){ + Ext.Ajax.request({ + url: '/lib/controller/getModuleEditor.php', + params: { + MID: mid, + UID: , + SID: '', + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + var moduleEdPanel = Ext.getCmp('mod_ed_small'); + if( moduleEdPanel ){ + moduleEdPanel.removeAll( true ); + moduleEdPanel.add( data ); + moduleEdPanel.doLayout(); + }; + }, + failure: failureAJAXFunction + }); + }; +}; + +function enableModule( ID ){ + Ext.Ajax.request({ + url: '/lib/controller/doModuleOperation.php', + params: { + OPID: 2, + OPCODE: 1, + MID: ID, + UID: , + SID: '' + }, + success: function(){ + //showSettings( SelectedNodeID, 2 ); + loadModules(); + } + }); +}; + +function disableModule( ID ){ + Ext.Ajax.request({ + url: '/lib/controller/doModuleOperation.php', + params: { + OPID: 2, + OPCODE: 0, + MID: ID, + UID: , + SID: '' + }, + success: function(){ + //showSettings( SelectedNodeID, 2 ); + loadModules(); + } + }); +}; + + +function doCamOperation( cid, op, param, reload = false ){ + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + CID: cid, + CMD: 10, + OPID: op, + OPCODE: param, + UID: , + SID: '' + }, + success: function(){ + if( reload ) loadDetectedCameras(); + if( reload ) loadAssignedCameras(); + } + }); +}; + +function removeModule( ID ){ + Ext.Msg.show({ + title:'GetLabel('_PLS_CONFIRM_');?>', + msg: 'GetLabel('_RUS_DELETE_MODULE_');?>', + buttons: Ext.Msg.YESNOCANCEL, + fn: function( btn, text ){ + if( btn == 'yes' ){ + Ext.Ajax.request({ + url: '/lib/controller/doModuleOperation.php', + params: { + OPID: 1, + MID: ID, + UID: , + SID: '' + }, + success: function(){ + //showSettings( SelectedNodeID, 2 ); + loadModules(); + } + }); + }; + }, + icon: Ext.MessageBox.QUESTION + }); +}; + +function disableServOps(){ + var tC = Ext.getCmp('servopPanel01'); + tC.removeClass('servopInfo_item01'); + tC.addClass('servopInfo_item00'); + tC.disable(); + Ext.getCmp('tbtn_sop01').disable(); + //tC.doLayout(); + tC = Ext.getCmp('servopPanel02'); + tC.removeClass('servopInfo_item11'); + tC.addClass('servopInfo_item10'); + tC.disable(); + Ext.getCmp('tbtn_sop02').disable(); + //tC.doLayout(); + tC = Ext.getCmp('servopPanel03'); + tC.removeClass('servopInfo_item21'); + tC.addClass('servopInfo_item20'); + tC.disable(); + Ext.getCmp('tbtn_sop03').disable(); + //tC.doLayout(); + tC = Ext.getCmp('servopPanel04'); + tC.removeClass('servopInfo_item31'); + tC.addClass('servopInfo_item30'); + tC.disable(); + Ext.getCmp('tbtn_sop04').disable(); + //tC.doLayout(); +}; + +function enableServOps(){ + var tC = Ext.getCmp('servopPanel01'); + if( tC != undefined ){ + tC.removeClass('servopInfo_item00'); + tC.addClass('servopInfo_item01'); + Ext.getCmp('tbtn_sop01').enable(); + tC.enable(); + }; + //tC.doLayout(); + tC = Ext.getCmp('servopPanel02'); + if( tC != undefined ){ + tC.removeClass('servopInfo_item10'); + tC.addClass('servopInfo_item11'); + tC.enable(); + Ext.getCmp('tbtn_sop02').enable(); + }; + //tC.doLayout(); + tC = Ext.getCmp('servopPanel03'); + if( tC != undefined ){ + tC.removeClass('servopInfo_item20'); + tC.addClass('servopInfo_item21'); + tC.enable(); + Ext.getCmp('tbtn_sop03').enable(); + }; + //tC.doLayout(); + tC = Ext.getCmp('servopPanel04'); + if( tC != undefined ){ + tC.removeClass('servopInfo_item30'); + tC.addClass('servopInfo_item31'); + tC.enable(); + Ext.getCmp('tbtn_sop04').enable(); + }; + //tC.doLayout(); +}; + +function updateServerStatus(){ + Ext.Ajax.request({ + url: '/lib/controller/getServerStatus.php', + params: { + SERVID: 1, + UID: , + SID: '' + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var sps = document.getElementById("INFO_SPS"); + if( sps == undefined ) return; + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + serverIsOnLine = true; + enableServOps(); + //document.getElementById('HW_NFO').innerHTML = data.stats.hw_info; + //document.getElementById('OS_NFO').innerHTML = data.stats.os_info; + //document.getElementById('BLD_NFO').innerHTML = data.stats.build; + setDonatStatus( 1, 0, data.stats.stat_cpu15 ); + setDonatStatus( 1, 1, data.stats.stat_mem ); + setDonatStatus( 1, 2, data.stats.stat_disk ); + setDonatStatus( 1, 3, data.stats.temp0 ); + + sps.classList.remove('setEd_infoPanel'); + sps.classList.add('setEl_infoPanel'); + } else { + serverIsOnLine = false; + disableServOps(); + if( data.status == 'na' ){ + setDonatStatus( 1, 0, -1 ); + setDonatStatus( 1, 1, -1 ); + setDonatStatus( 1, 2, -1 ); + setDonatStatus( 1, 3, -1 ); + sps.classList.remove('setEl_infoPanel'); + sps.classList.add('setEd_infoPanel'); + } else { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: data.messages, + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + }, + icon: Ext.MessageBox.INFO //QUESTION + }); + }; + }; + if( tlInterval == null ){ + tlInterval = window.setInterval( updateServerStatus, 1200, selectedSite ); + }; + }, + failure: failureAJAXFunction + }); +}; + +var addE2UDialog = null; +function addEthernet2Uart(){ + if( addE2UDialog == null ){ + addE2UDialog = new Ext.Window({ + modal: true, + title: 'GetLabel('_ADD_E2U_DIAL_TTL_');?>', + width: 400, + height: 560, + layout: 'fit', + closeAction: 'hide', + items:[{ + xtype: 'form', + labelWidth: 120, // label settings here cascade unless overridden + frame: false, + width: 400, + labelAlign: 'right', + //bodyStyle:'padding:5px 5px 0', + defaultType: 'textfield', + items:[{ + xtype: 'panel', + height: 200, + frame: false, + border: false, + html: '
' + },{ + fieldLabel: 'Name', + id: 'ued_name' + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('_CONNECT_2_');?>', + id: 'ued_servid', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + Query( $QS ); + $SLIST = array(); + $SSID = 0; + if( count( $Servers ) ){ + foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']'; + $SSID = intval( $Servers[0]['id'] ); + }; + //[1,'Server Node'], [2,'Aux Server'] + ?> + fields: ['sid', 'snam'], + data: [] + }), + value: , + valueField: 'sid', + displayField: 'snam' + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('UART_COM_SPEED');?>', + id: 'ued_speed', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['speed'], + data: [[19200], [115200]] + }), + value: 19200, + valueField: 'speed', + displayField: 'speed' + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('UART_COM_BITS');?>', + id: 'ued_bit', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['bits'], + data: [[5],[6],[7],[8],[9]] + }), + value: 8, + valueField: 'bits', + displayField: 'bits' + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('UART_COM_SBITS');?>', + id: 'ued_stops', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['stops'], + data: [[1],[1.5],[2]] + }), + value: 1, + valueField: 'stops', + displayField: 'stops' + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('UART_COM_PARITY');?>', + id: 'ued_parity', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['parity'], + data: [['Odd'], ['Even'],['None']] + }), + value: 'None', + valueField: 'parity', + displayField: 'parity' + },{ + xtype: 'combo', + fieldLabel: 'GetLabel('_WORKING_MODE_');?>', + id: 'ued_mode', + editable: false, + typeAhead: true, + triggerAction: 'all', + width: '100%', + lazyRender:true, + mode: 'local', + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [[0,'GetLabel('_UDP_CLIENT_');?>'], [1,'GetLabel('_TCP_CLIENT_');?>'], [2,'GetLabel('_UDP_SERVER_');?>'], [3,'GetLabel('_TCP_SERVER_');?>']] + }), + value: 3, + valueField: 'mode', + displayField: 'mode_txt' + },{ + fieldLabel: 'GetLabel('_DEVICE_IP_');?>', + id: 'ued_ip' + },{ + fieldLabel: 'GetLabel('_DEVICE_PORT_');?>', + value: 8234, + id: 'ued_port' + }], + bbar: [{ + text: 'Cancel', + handler: function(){//discoverOnvifSources + addE2UDialog.hide(); + } + },'->',{ + id: 'con_to_src', + text: 'Add Adapter to Site', + disabled: false, + handler: function(){ + var SPD = Ext.getCmp('ued_speed').getValue(); + var BIT = Ext.getCmp('ued_bit').getValue(); + var STP = Ext.getCmp('ued_stops').getValue(); + var PAR = Ext.getCmp('ued_parity').getValue(); + var MOD = Ext.getCmp('ued_mode').getValue(); + var IP = Ext.getCmp('ued_ip').getValue(); + var PORT= Ext.getCmp('ued_port').getValue(); + var MAC = '';//Ext.getCmp('ued_mac').getValue(); + var NAME= Ext.getCmp('ued_name').getValue(); + var SRV = Ext.getCmp('ued_servid').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/addNetworkNode.php', + params: { + SITEID: , + TYPE: 20, + UART_SPEED: SPD, + UART_BITS: BIT, + UART_STOP: STP, + UART_PAR: PAR, + UART_MODE: MOD, + UART_IP: IP, + UART_PORT: PORT, + UART_MAC: MAC, + UART_NAME: NAME, + UID: , + SRVID: SRV, + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + if( data.sucess == false ){ + Ext.Msg.show({ + title:'Request Failure!', + msg: data.error, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + } else { + loadSystemEditor(); + }; + addE2UDialog.hide(); + }, + failure: function( response, opts ) { + failureAJAXFunction( response, opts ); + addE2UDialog.hide(); + } + }); + } + }] + }] + }); + }; + addE2UDialog.show(); +}; + +var addDetCamDialog = null; +var addDetCamWM = null; +function addDetectedIPCam(){ + if( addDetCamDialog == null ){ + addDetCamDialog = new Ext.Window({ + modal: true, + title: 'GetLabel('_ADD_CAM_DIAL_TTL_');?>', + width: 400, + height: 187, + layout: 'form', + closeAction: 'hide', + labelWidth: 160, + labelAlign: 'right', + items:[{ + xtype: 'spacer', + height: 8 + },{ + xtype: 'textfield', + id: 'ncam_ip', + fieldLabel: 'Camera IP Address', + value: '' + },{ + xtype: 'textfield', + id: 'ncam_user', + fieldLabel: 'Access Login', + value: '' + },{ + xtype: 'textfield', + id: 'ncam_pwd', + inputType: 'password', + fieldLabel: 'Access Password', + value: '' + },{ + xtype: 'combo', + id: 'ncam_auth_mode', + fieldLabel: 'GetLabel('_AUTH_MODE_0_');?>', + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['mode','mode_txt'], + data: [ + [0,'BASIC'], + [1,'DIGEST'], + [2,'DIGEST_IE'], + [3,'BEARER'], + [4,'NEGOTIATE'], + [5,'NTLM'], + [6,'NTLM_WB'], + [7,'ANY'], + [8,'ANYSAFE'], + [9,'ONLY'], + [10,'AWS_SIGV4'] + ] + }), + valueField: 'mode', + displayField: 'mode_txt', + value: 0, + width: 200 + },{ + xtype: 'spacer', + height: 8 + },{ + xtype:'button', + width: '100%', + text: 'Add Camera to List', + handler: function(){ + addDetCamWM = new Ext.LoadMask( addDetCamDialog.getEl(), {msg:"GetLabel('_Please_Wait_');?>..."}); + addDetCamWM.show(); + var NIP = Ext.getCmp('ncam_ip').getValue(); + var NUU = Ext.getCmp('ncam_user').getValue(); + var NPP = Ext.getCmp('ncam_pwd').getValue(); + var NAM = Ext.getCmp('ncam_auth_mode').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/doCameraOperation.php', + params: { + UID: , + SID: '', + IP: NIP, + UU: NUU, + PP: NPP, + AU: NAM, + CMD: 2 + }, + success: function( response, opts ){ + addDetCamWM.hide(); + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + Ext.Msg.show({ + title:'Sucess!', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.INFO + }); + loadDetectedCameras(); + } else { + Ext.Msg.show({ + title:'Error!', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.WARNING + }); + }; + addDetCamDialog.hide(); + }, + failure: failureAJAXFunction + }); + } + }] + }); + }; + addDetCamDialog.show(); +}; + +function showSettingsGeneral(){ + stopStatusUpdater(); + + content_lvl1 = 1; + content_lvl2 = 4; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); +Query( $QS ); + //$NData = $SDD[0]; + $QS="SELECT * FROM `resources` WHERE `node_id`=1 AND ( `type`=101 OR `type`=102 )"; + $CN = $DATABASE->Query( $QS ); + $IL=array(); + foreach( $CN as $N ){ + $QS="SELECT * FROM `networks` WHERE `nif_id`={$N['aux_id']} AND `type`=0"; + $NWD = $DATABASE->Query( $QS ); + $NW = $NWD[0]; + $IL[]="{$N['device']}:{$NW['address']}"; + }; + $NIFO = '' . implode( '', $IL ) . '
'; +?> +tPanel.add({ + xtype: 'tabpanel', + frame: false, + id: 'node_settings_content', + border: false, + activeTab: content_lvl3, + items: [{ + xtype: 'panel', + id: 'gi_tab', + title: 'General Info', + layout: 'hbox', + items:[{ + xtype: 'panel', + flex: 1, + height: PanelH-15, + autoScroll: false, + html: '\ + \ + \ +
\ + \ + \ + \ + \ +
0CPU0MEM0DISK0TEMP
\ +
\ +
\ +
\ +
 
' + },{ + xtype: 'panel', + id: '_ed_small', + flex: 1, + height: PanelH-15, + autoScroll: false, + items:[{ + xtype: 'panel', + baseCls:'servopInfo_item00', + id: 'servopPanel01', + items:[{ + xtype: 'panel', + frame: false, + border: false, + unstyled: true, + html: '

GetLabel('_SERV_RESTART_DESC_');?>


' + },{ + xtype: 'button', + lazyRender: true, + iconCls: 'srv_op_restart', + text: 'GetLabel('_SERV_RESTART_OP_');?>', + id: 'tbtn_sop01', + scale: 'large', + width: '95%', + disabled: true, + handler: function( bt ){ + Ext.Msg.show({ + title:'GetLabel('_SERV_RESTART_QT_');?>', + msg: 'GetLabel('_SERV_RESTART_QM_');?>', + buttons: Ext.Msg.YESNO, + width: 400, + icon: Ext.MessageBox.INFO, + fn: function(btn, text){ + if( btn == 'yes' ){ + disableServOps(); + doDeviceOperation( 1, 250,'', true ); + }; + } + }); + } + }] + },{ + xtype: 'spacer', + height: 8 + },{ + xtype: 'panel', + baseCls:'servopInfo_item10', + id: 'servopPanel02', + items:[{ + xtype: 'panel', + frame: false, + border: false, + unstyled: true, + html: '

GetLabel('_SERV_HW_DET_DESC_');?>


' + },{ + xtype: 'button', + iconCls: 'srv_op_hw_init', + text: 'GetLabel('_SERV_HW_DET_OP_');?>', + id: 'tbtn_sop02', + scale: 'large', + width: '95%', + disabled: true, + handler: function( bt ){ + Ext.Msg.show({ + title:'GetLabel('_SERV_HW_DET_QT_');?>', + msg: 'GetLabel('_SERV_HW_DET_QM_');?>', + buttons: Ext.Msg.YESNO, + width: 400, + icon: Ext.MessageBox.INFO, + fn: function(btn, text){ + if( btn == 'yes' ){ + disableServOps(); + doDeviceOperation( 1, 251,'', true ); + }; + } + }); + } + }] + },{ + xtype: 'spacer', + height: 8 + },{ + xtype: 'panel', + baseCls:'servopInfo_item20', + id: 'servopPanel03', + items:[{ + xtype: 'panel', + frame: false, + border: false, + unstyled: true, + html: '

GetLabel('_SERV_OSRESET_DESC_');?>


' + },{ + xtype: 'button', + iconCls: 'srv_op_power_cycle', + text: 'GetLabel('_SERV_OSRESET_OP_');?>', + id: 'tbtn_sop03', + scale: 'large', + width: '95%', + disabled: true, + handler: function( bt ){ + Ext.Msg.show({ + title:'GetLabel('_SERV_OSRESET_QT_');?>', + msg: 'GetLabel('_SERV_OSRESET_QM_');?>', + buttons: Ext.Msg.YESNO, + width: 400, + icon: Ext.MessageBox.WARNING, + fn: function(btn, text){ + if( btn == 'yes' ){ + cleanupChangeNotifier(); + } else { + loadEditor = false; + }; + } + }); + } + }] + },{ + xtype: 'spacer', + height: 8 + },{ + xtype: 'panel', + baseCls:'servopInfo_item30', + id: 'servopPanel04', + items:[{ + xtype: 'panel', + frame: false, + border: false, + unstyled: true, + html: '

GetLabel('_SERV_FACTORY_DESC_');?>


' + },{ + xtype: 'button', + iconCls: 'srv_op_factory_reset', + text: 'GetLabel('_SERV_FACTORY_OP_');?>', + id: 'tbtn_sop04', + scale: 'large', + width: '95%', + disabled: true, + handler: function( bt ){ + Ext.Msg.show({ + title:'GetLabel('_SERV_FACTORY_QT_');?>', + msg: 'GetLabel('_SERV_FACTORY_QM_');?>', + buttons: Ext.Msg.YESNO, + width: 400, + icon: Ext.MessageBox.ERROR, + fn: function(btn, text){ + if( btn == 'yes' ){ + disableServOps(); + doDeviceOperation( 1, 254,'', true ); + }; + } + }); + } + }] + }] + }] + },{ + xtype: 'panel', + title: 'Resources', + id: 'res_tab', + layout: 'hbox', + items:[{ + xtype: 'panel', + id: 'resources_container', + flex: 1, + height: PanelH-15, + autoScroll: 'auto', + tbar:[{ + text: 'GetLabel( '_ADD_REMOTE_UART_' );?>', + handler: function(){ + addEthernet2Uart(); + } + }], + items:[] + },{ + xtype: 'panel', + id: 'res_ed_small', + flex: 1, + height: PanelH-15, + layout: 'fit', + items:[{ + html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' + }] + }] + },{ + xtype: 'panel', + title: 'Modules', + id: 'mod_tab', + layout: 'hbox', + items:[{ + xtype: 'panel', + id: 'modules_container', + flex: 1, + height: PanelH-15, + autoScroll: 'auto', + tbar:[{ + text: 'Add Module', + handler: function(){ + var addModuleWindow = new Ext.Window({ + id: 'huha_boa', + title: 'Add Server Module', + modal: true, + width: 400, + height: 300, + items:[{ + xtype: 'form', + items: [{ + xtype: 'combo', + fieldLabel: "GetLabel( 'MOD_TYPE' );?>", + id: 'mod_type', + lazyRender: true, + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + disableKeyFilter: true, + store: new Ext.data.ArrayStore({ + fields: ['az_t','az_txt'], + data: [Query( $QS ); + $MIMO = array(); + foreach( $MM as $M ) $MIMO[]="[{$M['id']},'".$Labels->GetLabel($M['name'])."']"; + echo implode( ',', $MIMO ); + ?>] + }), + valueField: 'az_t', + displayField: 'az_txt', + value: 1, + listeners:{ + select: function( t, r, i ){ + var n = r.data.az_t; + Ext.Ajax.request({ + url: '/lib/controller/getModuleInfo.php', + params: { + MID: n, + UID: , + SID: '' + }, + success: function( response, opts ){ + Ext.getCmp('infopan').update( response.responseText ); + } + }); + } + } + },{ + xtype: 'panel', + id: 'infopan', + html: '' + }] + }], + bbar:[{ + text: 'Cancel', + handler: function(){ + addModuleWindow.close(); + } + },{ + text: 'Add Module', + handler: function(){ + var mtyp = Ext.getCmp('mod_type').getValue(); + Ext.Ajax.request({ + url: '/lib/controller/addModule.php', + params: { + SERVID: 1, + TYPE: mtyp, + UID: , + SID: '' + }, + success: function( response, opts ){ + // If the response is JSON, you have to decode it + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + addModuleWindow.close(); + loadModules(); + } else { + Ext.Msg.show({ + title:'GetLabel("_INFO_MSG_");?>', + msg: data.message, + buttons: Ext.Msg.OK,//YESNOCANCEL, + fn: function(){ + //SettingsLidar3D.hide(); + }, + icon: Ext.MessageBox.INFO //QUESTION + }); + } + }, + failure: failureAJAXFunction + }); + } + }] + }); + addModuleWindow.show(); + } + }], + items:[] + },{ + xtype: 'panel', + id: 'mod_ed_small', + flex: 1, + height: PanelH-15, + layout: 'fit', + items:[{ + html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' + }] + }] + },{ + xtype: 'panel', + id: 'net_tab', + title: 'Filters', + items:[] + }], + listeners:{ + tabchange: function( tp, t ){ + switch( t.getId() ){ + case 'gi_tab': { + content_lvl3=0; + updateServerStatus(); + break; + }; + case 'res_tab': { + content_lvl3=1; + stopStatusUpdater(); + loadRessources(); + break; + }; + case 'mod_tab':{ + content_lvl3=2; + stopStatusUpdater(); + loadModules(); + break; + }; + case 'net_tab':{ + content_lvl3=3; + stopStatusUpdater(); + break; + }; + }; + updateUserContent(); + }, + afterrender: function(){ + settingsAreChanged = false; + } + }, + updateSettings: function(){ + alert('Update Settings'); + } +}); + tPanel.doLayout(); + updateServerStatus(); +}; + +function showSettingsSensors(){ + stopStatusUpdater(); + + content_lvl1 = 1; + content_lvl2 = 4; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); + tPanel.doLayout(); + updateServerStatus(); +}; + +var cameraEditorContent = null; + +function editCamera( cid, etyp ){ + SelectedCam = cid; + switch( etyp ){ + case 0: cameraEditorContent = Ext.getCmp('dcam_op_small'); break; + }; + Ext.Ajax.request({ + url: '/lib/controller/getCameraEditor.php', + params: { + CID: SelectedCam, + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode( response.responseText ); + if( data.status == 'ok' ){ + if( cameraEditorContent!= null ){ + var content = Ext.decode( data.content ); + cameraEditorContent.removeAll( true ); + cameraEditorContent.add( content ); + cameraEditorContent.doLayout(); + }; + } else { + if( cameraEditorContent!= null ){ + cameraEditorContent.removeAll( true ); + cameraEditorContent.add( data ); + cameraEditorContent.doLayout(); + }; + }; + }, + failure: function( response, opts ) { + //Ext.getCmp('cam_login').setValue(''); + Ext.getCmp('cam_password').setValue(''); + Ext.getCmp('cac_tab').enable(); + Ext.getCmp('str_tab').disable(); + Ext.getCmp('ptz_tab').disable(); + Ext.getCmp('loc_tab').disable(); + Ext.getCmp('coc_tabs').setActiveTab( 0 ); + sourceListStore.removeAll(); + } + }); + +}; + +function showSettingsVideo(){ + stopStatusUpdater(); + + content_lvl1 = 1; + content_lvl2 = 4; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); + tPanel.add({ + xtype: 'tabpanel', + frame: false, + id: 'node_settings_content', + border: false, + activeTab: content_lvl3, + items: [{ + xtype: 'panel', + title: 'Detected Cameras', + id: 'cam_det_tab', + layout: 'hbox', + items:[{ + xtype: 'panel', + id: 'dcam_container', + flex: 1, + height: PanelH-15, + autoScroll: 'auto', + tbar:[{ + text: 'GetLabel( '_MANUADD_CAMERA_' );?>', + handler: function(){ + addDetectedIPCam(); + } + }], + items:[] + },{ + xtype: 'panel', + id: 'dcam_op_small', + flex: 1, + height: PanelH-15, + layout: 'fit', + items:[{ + html:'
GetLabel('_PLS_SEL_LEFT_ITEM_');?>
' + }] + }] + },{ + xtype: 'panel', + id: 'gi_tab', + title: 'Assigned Cameras', + layout: 'hbox', + items:[{ + xtype: 'panel', + flex: 1, + height: PanelH-15, + autoScroll: false, + html: '\ + \ + \ +
\ + \ + \ + \ + \ +
0CPU0MEM0DISK0TEMP
\ +
\ +
\ +
\ +
 
' + },{ + + }] + }], + listeners:{ + tabchange: function( tp, t ){ + switch( t.getId() ){ + case 'cam_det_tab': { + content_lvl3=0; + stopStatusUpdater(); + loadDetectedCameras(); + break; + }; + case 'res_tab': { + content_lvl3=1; + stopStatusUpdater(); + loadRessources(); + break; + }; + case 'mod_tab':{ + content_lvl3=2; + stopStatusUpdater(); + loadModules(); + break; + }; + case 'net_tab':{ + content_lvl3=3; + stopStatusUpdater(); + break; + }; + }; + updateUserContent(); + }, + afterrender: function(){ + settingsAreChanged = false; + } + } + }); + tPanel.doLayout(); + updateServerStatus(); +}; + +function showSettingsUpgrade(){ + stopStatusUpdater(); + + content_lvl1 = 1; + content_lvl2 = 4; + var tPanel = Ext.getCmp('main_content'); + tPanel.removeAll( true ); + tPanel.doLayout(); + updateServerStatus(); +}; + +function initSettingsView(){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + timelineObj = null; + }; + setUserContent( 210 ); + var tP = Ext.getCmp('left_side_menu'); + tP.doLayout(); + tP.setVisible( false ); + tP.removeAll( true ); + tP.add({ + title: 'GetLabel('_DET_SETTINGS_');?>', + layout: 'vbox', + height: 120, + pack: 'center', + align : 'strech', + collapsed: ( content_lvl1 != 0 ), + items:[ + { + xtype: 'button', + width: '100%', + id:'go_home', + text: 'GetLabel('_UPPER_SENSOR_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 0 ), + allowDepress: false, + toggleGroup: 'det_settings', + handler: loadDashBoard + },{ + xtype: 'button', + width: '100%', + id:'go_monitor', + text: 'GetLabel('_BOTTOM_SENSOR_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 1 ), + allowDepress: false, + toggleGroup: 'det_settings', + handler: loadMonitoring + },{ + xtype: 'button', + width: '100%', + id:'go_archive', + text: 'GetLabel('_FUSION_ENGINE_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 2 ), + allowDepress: false, + toggleGroup: 'det_settings', + handler: loadArchive + }Data['sipi_enable'] ) ){ + ?> + { + xtype: 'button', + width: '100%', + id:'go_singleIpi', + text: 'GetLabel('_EVT_MONITOR_IPI_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 3 ), + allowDepress: false, + toggleGroup: 'det_settings', + handler: loadSingleIPI + }, + + { + xtype: 'button', + width: '100%', + id:'go_out', + text: 'GetLabel('_LOGOUT_');?>', + handler: doLogout + }] + }); + tP.add({ + title: 'GetLabel('_SYS_SETTINGS_');?>', + layout: 'vbox', + height: 120, + pack: 'center', + align : 'strech', + collapsed: ( content_lvl1 != 1 ), + items:[{ + xtype: 'button', + width: '100%', + id:'sys_edit', + text: 'GetLabel('_SYS_GENERAL_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 4 ), + allowDepress: false, + toggleGroup: 'sys_settings', + handler: showSettingsGeneral + },{ + xtype: 'button', + width: '100%', + id:'map_edit', + text: 'GetLabel('_SENSOR_CONNECTION_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 5 ), + allowDepress: false, + toggleGroup: 'sys_settings', + handler: showSettingsSensors + },{ + xtype: 'button', + width: '100%', + id:'video_set', + text: 'GetLabel('_CAMERA_MNGMNT_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 6 ), + allowDepress: false, + toggleGroup: 'sys_settings', + handler: showSettingsVideo + },{ + xtype: 'button', + width: '100%', + id:'soft_update', + text: 'GetLabel('_UPGRADE_MNGMNT_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 7 ), + allowDepress: false, + toggleGroup: 'sys_settings', + handler: showSettingsUpgrade + }] + }); + tP.add({ + title: 'GetLabel('_NET_SETTINGS_');?>', + collapsed: ( content_lvl1 != 2 ), + items:[{ + xtype: 'button', + width: '100%', + text: 'Ethernet', + enableToggle: true, + pressed: ( content_lvl2 == 8 ), + allowDepress: false, + id:'ethernet', + },{ + xtype: 'button', + width: '100%', + text: 'WiFi', + enableToggle: true, + pressed: ( content_lvl2 == 9 ), + allowDepress: false, + id:'wifi', + },{ + xtype: 'button', + width: '100%', + text: 'Integration', + enableToggle: true, + pressed: ( content_lvl2 == 10 ), + allowDepress: false, + id:'api_serv', + }] + }); + tP.add({ + title: 'GetLabel('_PROF_SETTINGS_');?>', + items:[] + }); +Data['access'] > 5 ){ +?>tP.add({ + title: 'GetLabel('_ADM_SETTINGS_');?>', + collapsed: ( content_lvl1 != 3 ), + items:[{ + xtype: 'button', + width: '100%', + id:'adm_acc', + text: 'GetLabel('_USERS_MNGMT_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 11 ), + allowDepress: false, + handler: function( b, e ){ + loadUserEditor(); + } + },{ + xtype: 'button', + width: '100%', + id:'adm_acclog', + text: 'GetLabel('_ACC_LOG_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 12 ), + allowDepress: false, + handler: function( b, e ){ + loadAccessLog(); + } + },{ + xtype: 'button', + width: '100%', + id:'adm_servlog', + text: 'GetLabel('_SERV_LOG_');?>', + enableToggle: true, + pressed: ( content_lvl2 == 13 ), + allowDepress: false, + handler: function( b, e ){ + loadServerLog(); + } + }] +}); + + tP.setVisible( true ); + tP.doLayout(); +}; \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_cameras.js b/lib/javascript/jsapi_dynamic/rgoose_cameras.js index 5b9b161..a2072b5 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_cameras.js +++ b/lib/javascript/jsapi_dynamic/rgoose_cameras.js @@ -109,7 +109,7 @@ var sourceListSelModel = new Ext.grid.RowSelectionModel({ listeners: { rowselect: function(sm, row, rec) { SelectedSource = rec.data.id; - Ext.getCmp('pic_prev').update( '
' ); + Ext.getCmp('pic_prev').update( '
' ); } } }); @@ -302,7 +302,7 @@ function preloadOnvifCredentials( SC ){ function discoverOnvifProfiles( CamID, camUser, camPasswd, Auth ){ Ext.Ajax.request({ - url: '/lib/controller/listAndDiscoverOnvifProfiles.php', + url: '/lib/controller/discoverOnvifProfiles.php', params: { NID: 0, UID: , @@ -324,7 +324,7 @@ function discoverOnvifProfiles( CamID, camUser, camPasswd, Auth ){ Ext.getCmp('coc_tabs').setActiveTab( 1 ); sourceListStore.loadData( data, false ); var tpic = document.getElementById('pic_prev'); - if( tpic != null ) tpic.src = '/lib/controller/getVideoFeed.php?UID=Data['id'];?>&SID&FID='+data.nodes[0].id; + if( tpic != null ) tpic.src = '/lib/controller/getCameraPreview.php?UID=Data['id'];?>&SID&FID='+data.nodes[0].id; } else { Ext.Msg.show({ title:'GetLabel('Error_Message');?>', @@ -751,7 +751,7 @@ function showIPCamPropDialog(){ store: new Ext.data.ArrayStore({ fields: ['uart','uart_txt'], data: [Query( $QS ); if( count( $RR ) ){ $RE=array(); @@ -1262,7 +1262,7 @@ function showAnalCamPropDialog(){ store: new Ext.data.ArrayStore({ fields: ['uart','uart_txt'], data: [Query( $QS ); if( count( $RR ) ){ $RE=array(); diff --git a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js index 3b32c4b..1f66372 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_dashboard.js +++ b/lib/javascript/jsapi_dynamic/rgoose_dashboard.js @@ -564,7 +564,7 @@ function setDonatStatus( node_id, param_id, value ){ var val2 = (value>-1)?100 - val1:0;//data.nodes[i].cpu5 * 100; var val3 = (value>-1)?0:100;//data.nodes[i].cpu15 * 100; var totalValue = document.getElementById('status_'+node_id+'_totalValue'+param_id); - + if( totalValue == undefined ) return; var total = val1+val2+val3; var per1 = val1/total*100; diff --git a/lib/javascript/jsapi_dynamic/rgoose_devices.js b/lib/javascript/jsapi_dynamic/rgoose_devices.js index 72f4f20..d8f69d1 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_devices.js +++ b/lib/javascript/jsapi_dynamic/rgoose_devices.js @@ -374,7 +374,7 @@ function doDeviceOperation( NodeID, OpCode, Param='', nowait=false ){ }; Ext.Ajax.request({ - url: '/lib/controller/doDeviceOperation.php', + url: '/lib/controller/doNodeOperation.php', params: { NID: NodeID, UID: 'Data['id'];?>', @@ -2250,220 +2250,5 @@ function onMaskMouseMove( event ){ }; }; -var addE2UDialog = null; -function addEthernet2Uart(){ - if( addE2UDialog == null ){ - addE2UDialog = new Ext.Window({ - modal: true, - title: 'Add Ethernet To Serial Adapter', - width: 400, - height: 560, - layout: 'fit', - closeAction: 'hide', - items:[{ - xtype: 'form', - labelWidth: 120, // label settings here cascade unless overridden - frame: false, - width: 400, - labelAlign: 'right', - //bodyStyle:'padding:5px 5px 0', - defaultType: 'textfield', - items:[{ - xtype: 'panel', - height: 200, - frame: false, - border: false, - html: '
' - },{ - fieldLabel: 'Name', - id: 'ued_name' - },{ - xtype: 'combo', - fieldLabel: 'Connect to', - id: 'ued_servid', - editable: false, - typeAhead: true, - triggerAction: 'all', - width: '100%', - lazyRender:true, - mode: 'local', - store: new Ext.data.ArrayStore({ - Query( $QS ); - $SLIST = array(); - $SSID = 0; - if( count( $Servers ) ){ - foreach( $Servers as $A ) $SLIST[] = '['.$A['id'].',\''.$A['name'].'\']'; - $SSID = intval( $Servers[0]['id'] ); - }; - //[1,'Server Node'], [2,'Aux Server'] - ?> - fields: ['sid', 'snam'], - data: [] - }), - value: , - valueField: 'sid', - displayField: 'snam' - },{ - xtype: 'combo', - fieldLabel: 'Speed', - id: 'ued_speed', - editable: false, - typeAhead: true, - triggerAction: 'all', - width: '100%', - lazyRender:true, - mode: 'local', - store: new Ext.data.ArrayStore({ - fields: ['speed'], - data: [[19200], [115200]] - }), - value: 19200, - valueField: 'speed', - displayField: 'speed' - },{ - xtype: 'combo', - fieldLabel: 'Bits', - id: 'ued_bit', - editable: false, - typeAhead: true, - triggerAction: 'all', - width: '100%', - lazyRender:true, - mode: 'local', - store: new Ext.data.ArrayStore({ - fields: ['bits'], - data: [[5],[6],[7],[8],[9]] - }), - value: 8, - valueField: 'bits', - displayField: 'bits' - },{ - xtype: 'combo', - fieldLabel: 'Stop Bit', - id: 'ued_stops', - editable: false, - typeAhead: true, - triggerAction: 'all', - width: '100%', - lazyRender:true, - mode: 'local', - store: new Ext.data.ArrayStore({ - fields: ['stops'], - data: [[1],[1.5],[2]] - }), - value: 1, - valueField: 'stops', - displayField: 'stops' - },{ - xtype: 'combo', - fieldLabel: 'Parity', - id: 'ued_parity', - editable: false, - typeAhead: true, - triggerAction: 'all', - width: '100%', - lazyRender:true, - mode: 'local', - store: new Ext.data.ArrayStore({ - fields: ['parity'], - data: [['Odd'], ['Even'],['None']] - }), - value: 'None', - valueField: 'parity', - displayField: 'parity' - },{ - xtype: 'combo', - fieldLabel: 'Working Mode', - id: 'ued_mode', - editable: false, - typeAhead: true, - triggerAction: 'all', - width: '100%', - lazyRender:true, - mode: 'local', - store: new Ext.data.ArrayStore({ - fields: ['mode','mode_txt'], - data: [[0,'UDP Client'], [1,'TCP Client'], [2,'UDP Server'], [3,'TCP Server']] - }), - value: 3, - valueField: 'mode', - displayField: 'mode_txt' - },{ - fieldLabel: 'IP Address', - id: 'ued_ip' - },{ - fieldLabel: 'IP Port', - value: 8234, - id: 'ued_port' - },{ - fieldLabel: 'MAC Address', - id: 'ued_mac' - }], - bbar: [{ - text: 'Cancel', - handler: function(){//discoverOnvifSources - addE2UDialog.hide(); - } - },'->',{ - id: 'con_to_src', - text: 'Add Adapter to Site', - disabled: false, - handler: function(){ - var SPD = Ext.getCmp('ued_speed').getValue(); - var BIT = Ext.getCmp('ued_bit').getValue(); - var STP = Ext.getCmp('ued_stops').getValue(); - var PAR = Ext.getCmp('ued_parity').getValue(); - var MOD = Ext.getCmp('ued_mode').getValue(); - var IP = Ext.getCmp('ued_ip').getValue(); - var PORT= Ext.getCmp('ued_port').getValue(); - var MAC = Ext.getCmp('ued_mac').getValue(); - var NAME= Ext.getCmp('ued_name').getValue(); - var SRV = Ext.getCmp('ued_servid').getValue(); - Ext.Ajax.request({ - url: '/lib/controller/addNetworkNode.php', - params: { - SITEID: , - TYPE: 20, - UART_SPEED: SPD, - UART_BITS: BIT, - UART_STOP: STP, - UART_PAR: PAR, - UART_MODE: MOD, - UART_IP: IP, - UART_PORT: PORT, - UART_MAC: MAC, - UART_NAME: NAME, - UID: , - SRVID: SRV, - SID: '' - }, - success: function( response, opts ){ - var data = Ext.decode(response.responseText); - if( data.sucess == false ){ - Ext.Msg.show({ - title:'Request Failure!', - msg: data.error, - buttons: Ext.Msg.OK, - icon: Ext.MessageBox.INFO - }); - } else { - loadSystemEditor(); - }; - addE2UDialog.hide(); - }, - failure: function( response, opts ) { - failureAJAXFunction( response, opts ); - addE2UDialog.hide(); - } - }); - } - }] - }] - }); - }; - addE2UDialog.show(); -}; diff --git a/lib/javascript/jsapi_dynamic/rgoose_global_vars.js b/lib/javascript/jsapi_dynamic/rgoose_global_vars.js new file mode 100644 index 0000000..7f7cb9a --- /dev/null +++ b/lib/javascript/jsapi_dynamic/rgoose_global_vars.js @@ -0,0 +1,33 @@ +// + + +var SiteLat=; +var SiteLon=; +var SiteAlt=; +var ap_type=; +var ap_title = ''; +var winW = Data['width']);?>; +var winH = Data['height']);?>; +var initView = 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; +var SelectedSite = ; +var SettingsLidar3D = null; +var SelectedNodeID = 0; +var StatusTS = -1; +var LoadTS = ; +var SoundEnable = Data['sound_enable']);?>; +var nodeDashboardStatuses = new Array(); +var nodeTHREEviewers = new Array(); +var nodeTHREEanimationId = 0; +var serverIsOnLine = false; +var ssTimer = null; +var ssTimeOut = 60000; //1min +var ssIsActive = false; +var ssInterval = null; + diff --git a/lib/javascript/jsapi_dynamic/rgoose_location_editor.js b/lib/javascript/jsapi_dynamic/rgoose_location_editor.js index c84f883..735a40a 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_location_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_location_editor.js @@ -1,11 +1,5 @@ -//Query( $QS ); -?> - -var SiteLat=; -var SiteLon=; -var SiteAlt=; +// + var map = null; var markers = []; diff --git a/lib/javascript/jsapi_dynamic/rgoose_main.js b/lib/javascript/jsapi_dynamic/rgoose_main.js index 5704e1f..47a515f 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_main.js +++ b/lib/javascript/jsapi_dynamic/rgoose_main.js @@ -1,24 +1,4 @@ -// - - -var winW = Data['width']);?>; -var winH = Data['height']);?>; -var initView = Data['last_content_view']);?>; -var PanelW = winW; -var PanelH = winH-90; -var SelectedSite = ; -var SettingsLidar3D = null; -var SelectedNodeID = 0; -var StatusTS = -1; -var LoadTS = ; -var SoundEnable = Data['sound_enable']);?>; -var nodeDashboardStatuses = new Array(); -var nodeTHREEviewers = new Array(); -var nodeTHREEanimationId = 0; -var ssTimer = null; -var ssTimeOut = 60000; //1min -var ssIsActive = false; -var ssInterval = null; +// function ssShowSS() { ssStopTimer(); @@ -129,6 +109,13 @@ function doLogout(){ window.location = '/login.php?UID=1'; }; +function stopStatusUpdater(){ + if( tlInterval!= null ){ + window.clearInterval( tlInterval ); + tlInterval = null; + }; +}; + function failureAJAXFunction( responce, opts ){ if( tlInterval!= null ){ window.clearInterval( tlInterval ); @@ -162,6 +149,7 @@ function updateUserScreenResolution( x, y ){ }; function setUserContent( c_id ){ + initView = c_id; Ext.Ajax.request({ url: '/lib/controller/updateUserSettings.php', params: { @@ -174,11 +162,16 @@ function setUserContent( c_id ){ }); }; +function updateUserContent(){ + cid = content_lvl3 + content_lvl2 * 10 + content_lvl1*100 + content_lvl0*1000; + setUserContent( cid ); +}; + var gSessionValidatorInterval = null; function sessionValidator(){ Ext.Ajax.request({ - url: '/lib/controller/updateUserSssion.php', + url: '/lib/controller/validateUserSession.php', params: { UID: , SID: '' @@ -228,6 +221,51 @@ function tryKeepScreenAlive(minutes) { }); } +function showContent( cid ){ + if( cid != initView ) setUserContent( cid ); + var lvl0 = Math.floor( initView / 1000 ); + var lvl1 = Math.floor( ( initView % 1000 )/ 100 ); + var lvl2 = Math.floor( ( initView % 100 )/ 10 ); + var lvl3 = initView % 10; + if( lvl3 != content_lvl3 ){ content_lvl3 = lvl3; }; + if( lvl2 != content_lvl2 ){ content_lvl2 = lvl2; }; + if( lvl1 != content_lvl1 ){ content_lvl1 = lvl1; }; + + if( lvl0 != content_lvl0 ){ + content_lvl0 = lvl0; + switch( lvl0 ){ + case 0:{ + var tt = Ext.getCmp('tbtn_0'); + tt.toggle( true, false ); + var tP = Ext.getCmp('left_side_menu'); + if( tP.isVisible() ) tP.setVisible( false ); + initMonitoring(); + Ext.getCmp('main_viewport').doLayout(); + break; + }; + case 1:{ + var tt = Ext.getCmp('tbtn_1'); + tt.toggle( true, false ); + var tP = Ext.getCmp('left_side_menu'); + tP.setVisible( true ); + Ext.getCmp('main_viewport').doLayout(); + break; + }; + case 2:{ + var tt = Ext.getCmp('tbtn_2'); + tt.toggle( true, false ); + var tP = Ext.getCmp('left_side_menu'); + if( !tP.isVisible() ) tP.setVisible( true ); + var tZ = Ext.getCmp('right_side_menu'); + if( tZ.isVisible() ) tZ.setVisible( false ); + initSettingsView(); + Ext.getCmp('main_viewport').doLayout(); + break; + }; + }; + }; +}; + Ext.onReady(function(){ if ('wakeLock' in navigator) { // Screen Wake Lock API supported @@ -241,7 +279,7 @@ Ext.onReady(function(){ //window.onresize = doCheckWindowSize; Ext.QuickTips.init(); - /* + ssSetupTimer(); $(window).focus(function() { ssResetTimer(); @@ -249,33 +287,138 @@ Ext.onReady(function(){ $(window).blur(function() { ssStopTimer(); }); - */ + var viewport = new Ext.Viewport({ id: 'main_viewport', layout:'border', + frame: false, + border: false, items: [{ xtype: 'panel', region: 'north', baseCls: 'x-plain', - height: 50, + height: 60, + layout: 'hbox', + frame: false, + border: false, items:[{ xtype: 'panel', - id:'top', + width: 600, + layout: 'hbox', + baseCls: 'x-plain', + frame: false, + border: false, + margins: {top:10, right:10, bottom:10, left:10}, + items:[{ + xtype: 'panel', + baseCls: 'x-plain', + frame: false, + border: false, + margins: {top:5, right:20, bottom:0, left:10}, + html: '' + },{ + xtype: 'button', + text: 'GetLabel('_MONITORING_');?>', + id: 'tbtn_0', + iconCls: 'mon', + scale: 'large', + enableToggle: true, + //pressed: (Math.floor(initView/100)==0), + allowDepress: false, + toggleGroup: 'gopa_gopa', + toggleHandler: function( bt, state ){ + if( state ) showContent( 0 ); + } + },{ + xtype: 'spacer', + width: 10 + },{ + xtype: 'button', + text: 'GetLabel('_REPO_HISTORY_');?>', + id: 'tbtn_1', + iconCls: 'rep', + scale: 'large', + enableToggle: true, + //pressed: (Math.floor(initView/100)==1), + allowDepress: false, + toggleGroup: 'gopa_gopa', + toggleHandler: function( bt, state ){ + if( state ) showContent( 1000 ); + } + },{ + xtype: 'spacer', + width: 10 + },{ + xtype: 'button', + text: 'GetLabel('_SETTINGS_');?>', + id: 'tbtn_2', + iconCls: 'cog', + scale: 'large', + enableToggle: true, + //pressed: (Math.floor(initView/100)==2), + allowDepress: false, + toggleGroup: 'gopa_gopa', + toggleHandler: function( bt, state ){ + if( state ) showContent( 2000 ); + } + }] + },{ + xtype: 'panel', baseCls: 'x-plain', - html: '

 GetLabel('_APP_TITLE_');?>

' + frame: false, + border: false, + margins: {top:5, right:0, bottom:0, left:0}, + html: '

'+ap_title+'

', + flex: 1 + },{ + xtype: 'panel', + layout: 'fit', + baseCls: 'x-plain', + frame: false, + border: false, + margins: {top:10, right:10, bottom:10, left:10}, + items:[{ + xtype: 'button', + id: 'logout_btn', + text: 'Logout', + iconCls: 'lout', + scale: 'large', + handler: doLogout + }{ + xtype: 'button', + id: 'snd_mode_btn', + text: 'Sound', + iconCls: 'snd'+SoundMode, + scale: 'large', + handler: function(){ + if( SoundMode == 0 ){ + SoundMode = 3; + } else { + SoundMode --; + }; + Ext.getCmp('snd_mode_btn').setIconClass( 'snd'+SoundMode ); + } + }] }] },{ xtype: 'panel', - id:'btns', + id:'left_side_menu', region:'west', bsaseCls:'x-plain', - title: 'GetLabel('_SEC_SYSTEM_');?>', + //title: 'GetLabel('_SEC_SYSTEM_');?>', collapsible: true, split:true, - width:150, - minWidth: 100, - maxWidth: 250, + width:180, + minWidth: 180, + maxWidth: 180, + hidden: (Math.floor(initView/100)==0), layout:'accordion', margins: '5 0 5 5', cmargins:'5 5 5 5', @@ -283,152 +426,43 @@ Ext.onReady(function(){ animate: true//, //activeOnTop: true }, - items: [{ - title: 'GetLabel('_DASHBOARD_');?>', - layout: 'vbox', - height: 120, - pack: 'center', - align : 'strech', - collapsed: Data['last_content_view']<3)?'false':'true';?>, - items:[{ - xtype: 'button', - width: '100%', - id:'go_home', - text: 'GetLabel('_GO_HOME_');?>', - toggled: (initView == 0 ), - handler: loadDashBoard - },{ - xtype: 'button', - width: '100%', - id:'go_monitor', - text: 'GetLabel('_EVT_MONITOR_');?>', - toggled: (initView == 1 ), - handler: loadMonitoring - },{ - xtype: 'button', - width: '100%', - id:'go_archive', - text: 'GetLabel('_EVT_ARCHIVE_');?>', - toggled: (initView == 2 ), - handler: loadArchive - }Data['sipi_enable'] ) ){ - ?> - ,{ - xtype: 'button', - width: '100%', - id:'go_singleIpi', - text: 'GetLabel('_EVT_MONITOR_IPI_');?>', - toggled: (initView == 3 ), - handler: loadSingleIPI - } - - ,{ - xtype: 'button', - width: '100%', - id:'go_out', - text: 'GetLabel('_LOGOUT_');?>', - handler: doLogout - }] - },{ - title: 'GetLabel('_SYS_SETTINGS_');?>', - layout: 'vbox', - height: 120, - pack: 'center', - align : 'strech', - collapsed: Data['last_content_view']>2)?'false':'true';?>, - items:[{ - xtype: 'button', - width: '100%', - id:'sys_edit', - text: 'GetLabel('_EDT_CONNECTIONS_');?>', - toggled: (initView == 11 ), - handler: loadSystemEditor - },{ - xtype: 'button', - width: '100%', - id:'map_edit', - text: 'GetLabel('_EDT_LOCATIONS_');?>', - toggled: (initView == 12 ), - handler: loadLocationEditor - },{ - xtype: 'button', - width: '100%', - id:'soft_update', - text: 'GetLabel('_UPGRADE_MNGMNT_');?>', - toggled: (initView == 13 ), - handler: loadUpgradeManagmenet - }] - },{ - title: 'GetLabel('_PROF_SETTINGS_');?>', - items:[] - } -Data['access'] > 5 ){ -?>,{ - title: 'GetLabel('_ADM_SETTINGS_');?>', - items:[{ - xtype: 'button', - width: '100%', - id:'adm_acc', - text: 'GetLabel('_USERS_MNGMT_');?>', - handler: function( b, e ){ - loadUserEditor(); - } - },{ - xtype: 'button', - width: '100%', - id:'adm_acclog', - text: 'GetLabel('_ACC_LOG_');?>', - handler: function( b, e ){ - loadAccessLog(); - } - },{ - xtype: 'button', - width: '100%', - id:'adm_servlog', - text: 'GetLabel('_SERV_LOG_');?>', - handler: function( b, e ){ - loadServerLog(); - } - }] -} - - ] + items: [] },{ xtype: 'panel', region:'center', margins: '5 5 5 0', id: 'main_content', - title: 'GetLabel('_SYS_DASHBOARD_');?>', + //title: 'GetLabel('_SYS_DASHBOARD_');?>', items:[{ - xtype: 'portal', - id: 'main_portal', + xtype: 'portal', + id: 'main_portal', + frame: false, + border: false, + items:{ + html: '' + }//, + //listeners:{ + // drop: function( a ){ + // updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position ); + // } + //} + }] + },{ + xtype: 'panel', + region:'east', + id:'right_side_menu', + //title: '', + margins: '5 5 5 0', + //id: 'help_content', frame: false, border: false, - items:{ - html: '' - }, - listeners:{ - drop: function( a ){ - updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position ); - } - } - }] + collapsible: false, + split:true, + width:200, + minWidth: 150, + maxWidth: 200, + items:[] }] }); - switch( Data['last_content_view']);?> ){ - case 0: loadDashBoard(); break; - case 1: loadMonitoring(); break; - case 2: loadArchive(); break; - case 3: loadSystemEditor(); break; - case 4: loadLocationEditor(); break; - case 5: loadUpgradeManagmenet(); break; - default: - loadDashBoard(); - }; + showContent( initView ); }); \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/rgoose_reports.js b/lib/javascript/jsapi_dynamic/rgoose_reports.js index 443c662..ae4581d 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_reports.js +++ b/lib/javascript/jsapi_dynamic/rgoose_reports.js @@ -1,11 +1,5 @@ -//Query( $QS ); -?> +// -var SiteLat=; -var SiteLon=; -var SiteAlt=; var map = null; var selectedMarker = null; diff --git a/lib/javascript/jsapi_dynamic/rgoose_single_ipi.js b/lib/javascript/jsapi_dynamic/rgoose_single_ipi.js index 0fdc12c..daeacd9 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_single_ipi.js +++ b/lib/javascript/jsapi_dynamic/rgoose_single_ipi.js @@ -20,7 +20,7 @@ function loadSingleIPI(){ items: [{ title: 'getLabel('_VIDEO_MONITORING_');?>', Query( $QS ); ?> frame: false, diff --git a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js index c79e1e0..84ebee2 100644 --- a/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js +++ b/lib/javascript/jsapi_dynamic/rgoose_sysmap_editor.js @@ -808,7 +808,7 @@ function module_prop_FlyHunter( module_id ){ id: 0, fields: ['myId', 'displayText' ], data: [ Query( $QS ); if( count( $RR ) ){ $RE=array(); @@ -836,8 +836,9 @@ function module_prop_FlyHunter( module_id ){ id: 1, fields: ['myId', 'displayText' ], data: [ Query( $QS ); + //$QS="SELECT ca.id, ca.channel_id, dcb.serial_id FROM module_dcr_chanels ca LEFT JOIN modules_dcr dcb ON( ca.dcr_id = dcb.id ) WHERE dcb.site_id={$SiteID}"; + //$RR=$DATABASE->Query( $QS ); + $RR=array(); if( count( $RR ) ){ $RE=array(); foreach( $RR as $R ){ diff --git a/lib/js_asm.php b/lib/js_asm.php index b9e354e..5713106 100644 --- a/lib/js_asm.php +++ b/lib/js_asm.php @@ -4,7 +4,7 @@ require_once('settings.php'); require_once('defines.php'); // SET DATA CONNECTION AND GLOBAL USER VARIABLES -$TT_123 = explode( '.', PHP_VERSION ); +/*$TT_123 = explode( '.', PHP_VERSION ); if( $TT_123[0] == '4' ){ require_once( 'php/db/MySQL_class.php' ); $DATABASE = new MySQL_DB($DBHost, $DBName, $DBUser, $DBPassword); @@ -13,9 +13,37 @@ if( $TT_123[0] == '4' ){ $DATABASE = new MySQLi_DB($DBHost, $DBName, $DBUser, $DBPassword); } else { exit(); -}; +};*/ +require_once( 'php/db/SQLite_Class.php'); +$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db'); +$QS="SELECT * FROM system_props LIMIT 1"; +$RV = $DATABASE->Query( $QS ); +if( count( $RV ) ){ + $AP_DATA = $RV[0]; + if( $AP_DATA['hw_info'] == '' ) $AP_DATA['hw_info'] = 'MUST_DO_DETECTION'; + if( $AP_DATA['os_info'] == '' ) $AP_DATA['os_info'] = 'MUST_RESTART_SERVER'; +} else { + $AP_DATA = array( + 'anchor_lat'=>0, + 'anchor_lon'=>0, + 'anchor_alt'=>0, + 'type'=>0, + 'name'=>'INITIAL_SETUP_MODE', + 'os_info'=>'MUST_RESTART_SERVER', + 'hw_info'=>'MUST_DO_DETECTION' + ); +}; +$QS="SELECT `site_id`, `version_string` FROM `servers` LIMIT 1"; +$RR = $DATABASE->Query( $QS ); +if( count( $RR ) ){ + $AP_DATA['site_id'] = intval( $RR[0]['site_id']); + $AP_DATA['build'] = $RR[0]['version_string']; +} else { + $AP_DATA['site_id'] = 1; + $AP_DATA['build'] = 'undefined-build'; +}; //$DATABASE->SetCacheDir( $DBCacheDir ); session_start(); require_once('php/db/logio_class.php'); @@ -42,4 +70,6 @@ if( $UserLang == 3 || $UserLang == 255 ){ $RTL_SITE = false; }; + + ?> \ No newline at end of file diff --git a/lib/php/argus/mojo.php b/lib/php/argus/mojo.php index 5566716..157067d 100644 --- a/lib/php/argus/mojo.php +++ b/lib/php/argus/mojo.php @@ -343,23 +343,21 @@ return true; }; - function addIpPtzCamera( $SID, $SSID, $CamName, $CID, $STID, $ISZ, $FN, $Zoom, $PanMode, $PanAng, $TiltMode, $TiltAng, $Protocol, $Protocol_Aux, $UART=0 ){ + function addIpPtzCamera( $CamName, $CID, $STID, $ISZ, $FN, $Zoom, $PanMode, $PanAng, $TiltMode, $TiltAng, $Protocol, $Protocol_Aux, $UART=0 ){ global $DATABASE; - - $SiteID = intval( $SID ); - $ServerID = intval( $SSID ); + $StreamID = intval( $STID ); $CamID = intval( $CID ); $ImagerSize = intval( $ISZ ); $LFL = floatval( $FN ); - if( $CamID && $ServerID ){ - $ServerNODE = getServerNode( $ServerID ); + if( $CamID ){ + //$ServerNODE = getServerNode( 0 ); $QS = "SELECT * FROM `cameras` WHERE `id`={$CamID}"; $CR = $DATABASE->Query( $QS, false ); $Range = 0.0; if( count( $CR ) ){ $CamData = $CR[0]; - $QS = "INSERT INTO `nodes` SET `site_id`={$SiteID}, `server_id`={$ServerID}, `type`=13, `aux_id`={$CamID}, `aux_parameter`={$StreamID}, `name`='{$CamName}'"; + $QS = "INSERT INTO `nodes`(`type`,`aux_id`,`aux_parameter`,`name`) VALUES(13,{$CamID},{$StreamID},'{$CamName}')"; $DATABASE->Query( $QS, false ); $NODEID = $DATABASE->getLastInsertID(); $DevICE = $CamID .':'.$StreamID.':STREAM'; @@ -367,52 +365,54 @@ //$QS = "INSERT INTO `resources` SET `node_id`={$NODEID}, `class`=4, `type`=32, `aux_id`={$StreamID}, `used`=1, `device`='{$DevICE}'"; //$DATABASE->Query( $QS, false ); //$STRRID = $DATABASE->getLastInsertID(); - $STRRID = createResource( $NODEID, $CamID, 32, 'Digital Video' ); - $INSTRRIR = getResourceIDS( $ServerNODE, 101 ); + //$STRRID = createResource( $NODEID, $CamID, 32, 'Digital Video' ); + //$INSTRRIR = getResourceIDS( $ServerNODE, 101 ); - $QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NODEID}, `from_aux`={$STRRID}, `to`={$ServerNODE}, `to_aux`={$INSTRRIR[0]}, `type`=4"; - $DATABASE->Query( $QS, false ); + //$QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NODEID}, `from_aux`={$STRRID}, `to`={$ServerNODE}, `to_aux`={$INSTRRIR[0]}, `type`=4"; + //$DATABASE->Query( $QS, false ); switch( $Protocol ){ case 3:{ // Onvif - $QS = "UPDATE `cameras` SET `node_id`={$NODEID}, `type`=13, `status`=3, `protocol`={$Protocol}, `imager_type`={$ImagerSize}, `lens_f`={$LFL}, `zoom`={$Zoom}, `pan_model`={$PanMode}, `pan_angles`={$PanAng}, `tilt_model`={$TiltMode}, `tilt_angles`={$TiltAng}, `max_range`={$Range} WHERE `id`={$CamID}"; - $DATABASE->Query( $QS, false ); - $DevICE = $CamID . ':eth0'; - $Key = md5( $DevICE ); - $QS = "INSERT INTO `network_interfaces` SET `device_name`='{$DevICE}', `key`='{$Key}', `mac`='{$CamData['mac']}'"; + $QS = "UPDATE `cameras` SET `type`=13, `status`=3, `protocol`={$Protocol}, `imager_type`={$ImagerSize}, `lens_f`={$LFL}, `zoom`={$Zoom}, `pan_model`={$PanMode}, `pan_angles`={$PanAng}, `tilt_model`={$TiltMode}, `tilt_angles`={$TiltAng}, `max_range`={$Range} WHERE `id`={$CamID}"; $DATABASE->Query( $QS, false ); - $NIFID = $DATABASE->getLastInsertID(); - $DevICE = $CamID .':'.$StreamID.':CTRL'; + //$DevICE = $CamID . ':eth0'; + //$Key = md5( $DevICE ); + //$QS = "INSERT INTO `network_interfaces` SET `device_name`='{$DevICE}', `key`='{$Key}', `mac`='{$CamData['mac']}'"; + //$DATABASE->Query( $QS, false ); + //$NIFID = $DATABASE->getLastInsertID(); + //$DevICE = $CamID .':'.$StreamID.':CTRL'; //$QS = "INSERT INTO `resources` SET `node_id`={$NODEID}, `class`=3, `type`=101, `aux_id`={$NIFID}, `used`=1, `device`='{$DevICE}'"; //$DATABASE->Query( $QS, false ); //$CTLRID = $DATABASE->getLastInsertID(); - $CTLRID = createResource( $NODEID, $NIFID, 101, $DevICE ); - $INCTLNID = $ServerNODE; - $INCTLRID = $INSTRRIR[0]; - $CTLTYP = 4; + + //$CTLRID = createResource( $NODEID, $NIFID, 101, $DevICE ); + //$INCTLNID = $ServerNODE; + //$INCTLRID = $INSTRRIR[0]; + //$CTLTYP = 4; break; }; default:{ // any serial control - $QS = "UPDATE `cameras` SET `node_id`={$NODEID}, `type`=13, `status`=3, `protocol`={$Protocol}, `protocol_aux`={$Protocol_Aux}, `uart_id`={$UART}, `imager_type`={$ImagerSize}, `lens_f`={$LFL}, `zoom`={$Zoom}, `pan_model`={$PanMode}, `pan_angles`={$PanAng}, `tilt_model`={$TiltMode}, `tilt_angles`={$TiltAng}, `max_range`={$Range} WHERE `id`={$CamID}"; + $QS = "UPDATE `cameras` SET `type`=13, `status`=3, `protocol`={$Protocol}, `protocol_aux`={$Protocol_Aux}, `uart_id`={$UART}, `imager_type`={$ImagerSize}, `lens_f`={$LFL}, `zoom`={$Zoom}, `pan_model`={$PanMode}, `pan_angles`={$PanAng}, `tilt_model`={$TiltMode}, `tilt_angles`={$TiltAng}, `max_range`={$Range} WHERE `id`={$CamID}"; $DATABASE->Query( $QS, false ); - $DevICE = $CamID .':'.$StreamID.':CTRL'; + //$DevICE = $CamID .':'.$StreamID.':CTRL'; //$QS = "INSERT INTO `resources` SET `node_id`={$NODEID}, `class`=1, `type`=1 `aux_id`={$CamID}, `used`=1, `device`='{$DevICE}'"; //$DATABASE->Query( $QS, false ); //$CTLRID = $DATABASE->getLastInsertID(); - $CTLRID = createResource( $NODEID, $CamID, 1, $DevICE ); - $QS = "SELECT `id`, `node_id` FROM `resources` WHERE `type`=1, `aux_id`={$UART}"; - $RR = $DATABASE->Query( $QS, false ); - $INCTLRID = $RR[0]['id']; - $INCTLNID = $RR[0]['node_id']; - $CTLTYP = 1; + //$CTLRID = createResource( $NODEID, $CamID, 1, $DevICE ); + //$QS = "SELECT `id`, `node_id` FROM `resources` WHERE `type`=1, `aux_id`={$UART}"; + //$RR = $DATABASE->Query( $QS, false ); + + //$INCTLRID = $RR[0]['id']; + //$INCTLNID = $RR[0]['node_id']; + //$CTLTYP = 1; break; }; }; //$QS = "INSERT INTO `connections` SET `site_id`={$SiteID}, `from`={$NODEID}, `from_aux`={$CTLRID}, `to`={$INCTLNID}, `to_aux`={$INCTLRID}, `type`={$CTLTYP}"; //$DATABASE->Query( $QS, false ); - createConnection( $SiteID, $NODEID, $CTLRID, $INCTLNID, $INCTLRID, $CTLTYP ); + //createConnection( $SiteID, $NODEID, $CTLRID, $INCTLNID, $INCTLRID, $CTLTYP ); return true; }; }; diff --git a/lib/php/auth/web.php b/lib/php/auth/web.php index abf0478..ef8b85e 100644 --- a/lib/php/auth/web.php +++ b/lib/php/auth/web.php @@ -65,7 +65,7 @@ $_SESSION['SID']=$CUser->Data['SID']; $UserLang = $CUser->Data['language']; $_SESSION['Lang'] = $UserLang; - $SiteID = $CUser->Data['selected_site']; + $SiteID = 1;//$CUser->Data['selected_site']; } else { //$LOG->logout(); }; diff --git a/lib/php/db/SQLite_Class.php b/lib/php/db/SQLite_Class.php new file mode 100644 index 0000000..0bbd376 --- /dev/null +++ b/lib/php/db/SQLite_Class.php @@ -0,0 +1,134 @@ +DBFILE=$DBFILE; + $this->DBFLAGS=$flags; + $this->DBENCRYPT=$encryptionKey; + try{ + $this->DBLink = new SQLite3( $this->DBFILE, $this->DBFLAGS, $this->DBENCRYPT ); + $this->isConnected = true; + }catch( Exception $e ){ + echo $e->getMessage(); + }; + } + function CleanUpCache(){ + if ($DD=@opendir($this->CachePath)){ + while($FN=readdir($DD)){ + $CF=$this->CachePath.'/'.$FN; + if (is_file($CF)){ + if ( strstr($FN,'dbchache_') && (time()-filemtime($CF))>360){ + @unlink($CF); + }; + }; + }; + closedir($DD); + } else $this->isCached=false; + } + function ResetCache(){ + if ($DD=@opendir($this->CachePath)){ + while($FN=readdir($DD)){ + $CF=$this->CachePath.'/'.$FN; + if (is_file($CF)){ + if ( strstr($FN,'dbchache_')){ + @unlink($CF); + }; + }; + }; + closedir($DD); + } else $this->isCached=false; + } + function SetCacheDir($Path){ + $this->CachePath = $Path; + $this->isCached = is_dir($this->CachePath) && is_writable($this->CachePath); + if ($this->isCached) $this->CleanUpCache(); + } + function escape( $Str ){ + if( $this->isConnected ){ + return $this->DBLink->escapeString( $Str ); + }; + return ''; + } + function Query($QS,$ChacheIfAveable=true){ + if($this->isConnected){ + $QS = trim( $QS ); + if( $this->isCached && $ChacheIfAveable ){ + $QMD5=md5($QS); + $Prefetch=$this->CachePath.'/dbchache_'.$QMD5; + + if ( is_file($Prefetch)){ + + if ( (time()- filemtime($Prefetch))<360){ + $FData=file_get_contents($Prefetch); + $this->DebugLog .="[{$QS}] as (Cahed Data),\n"; + return unserialize($FData); + } else { + + $result = $this->DBLink->query( $QS ) or die (" Error during query [$QS]:".mysqli_error($this->DBLink)); + $RetVal=array(); + if( ( stripos( $QS, 'insert' ) === false ) && ( stripos( $QS, 'update' ) === false ) && $result !== false && is_a( $result, 'SQLite3Result' ) ){ + while( $array = $result->fetchArray( SQLITE3_ASSOC )) $RetVal[]=$array; + $result->finalize(); + }; + $FData=serialize($RetVal); + $FD=fopen($Prefetch,'w'); + fwrite($FD,$FData); + fclose($FD); + $this->DebugLog .="[{$QS}] as (".$this->DBLink->lastInsertRowID()."),\n"; + return $RetVal; + } + } else { + $result = $this->DBLink->query( $QS ) or die (" Error during query [$QS]:".mysqli_error($this->DBLink)); + $RetVal=array(); + if( ( stripos( $QS, 'insert' ) === false ) && ( stripos( $QS, 'update' ) === false ) && $result !== false && is_a( $result, 'SQLite3Result' ) ){ + while( $array = $result->fetchArray( SQLITE3_ASSOC )) $RetVal[]=$array; + $result->finalize(); + }; + $FData = serialize($RetVal); + $FD=fopen($Prefetch,'w'); + fwrite($FD,$FData); + fclose($FD); + $this->DebugLog .="[{$QS}] as (".$this->DBLink->lastInsertRowID()."),\n"; + return $RetVal; + } + } else { + $result = $this->DBLink->query( $QS ) or die (" Error during query [$QS]:".mysqli_error($this->DBLink)); + $RetVal=array(); + if( ( stripos( $QS, 'insert' ) === false ) && ( stripos( $QS, 'update' ) === false ) && $result !== false && is_a( $result, 'SQLite3Result' ) ){ + while( $array = $result->fetchArray( SQLITE3_ASSOC )) $RetVal[]=$array; + $result->finalize(); + }; + $this->DebugLog .="[{$QS}] as (".$this->DBLink->lastInsertRowID()."),\n"; + return $RetVal; + }; + } else { + echo "No Connection to DB
"; + }; + } + function getLastInsertID(){ + if($this->isConnected){ + return $this->DBLink->lastInsertRowID(); + }; + return -1; + } + function getDebugLog(){ + return $this->DebugLog; + } + function __destruct(){ + if( $this->isConnected ){ + $this->DBLink->close(); + }; + } +} + + + + +?> \ No newline at end of file diff --git a/lib/php/db/language_class.php b/lib/php/db/language_class.php index 31e9f81..364afa1 100644 --- a/lib/php/db/language_class.php +++ b/lib/php/db/language_class.php @@ -4,11 +4,9 @@ class Language{ function Language($LangID=1, $_module = ''){ global $DATABASE; $this->Labels=array(); - $QS="SELECT L.key, L.label FROM labels" . $_module . " L WHERE L.language_id='{$LangID}'"; + $QS="SELECT key, label FROM labels" . $_module . " WHERE language_id='{$LangID}'"; $result= $DATABASE->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){ //global $Labels; diff --git a/lib/php/db/logio_class.php b/lib/php/db/logio_class.php index ef866cc..19427a5 100644 --- a/lib/php/db/logio_class.php +++ b/lib/php/db/logio_class.php @@ -36,13 +36,14 @@ class Logio{ } function SysLog( $CMD, $LVL, $Dataset = '' ){ global $DATABASE; + $CTS = time(); if( $this->USERID < 2 ) return; if( ( $LVL & $this->FLT ) == $LVL ){ if( $Dataset == '' ){ - $QS = "INSERT INTO `access_log` SET `user_id`={$this->USERID}, `ts`=NOW(), `cmd`={$CMD}"; + $QS = "INSERT INTO `access_log` ( `user_id`, `ts`, `cmd` ) VALUES ( {$this->USERID}, {$CTS}, {$CMD} )"; } else { $DS = $DATABASE->escape( json_encode( $Dataset ) ); - $QS = "INSERT INTO `access_log` SET `user_id`={$this->USERID}, `ts`=NOW(), `cmd`={$CMD}, `dataset`='{$DS}'"; + $QS = "INSERT INTO `access_log` ( `user_id`, `ts`, `cmd`, `dataset` ) VALUES( {$this->USERID}, {$CTS}, {$CMD}, '{$DS}' )"; }; $DATABASE->Query( $QS ); }; diff --git a/lib/php/db/user_class.php b/lib/php/db/user_class.php index f4ea4ea..84dc51c 100644 --- a/lib/php/db/user_class.php +++ b/lib/php/db/user_class.php @@ -7,7 +7,7 @@ class User{ } function FillInfo($UID){ global $DATABASE; - $QS="SELECT U.* FROM users U WHERE U.id={$UID}"; + $QS="SELECT * FROM users WHERE id={$UID}"; $array=$DATABASE->Query($QS,false); $this->Data=$array[0]; $this->Data['id']=$UID; @@ -42,7 +42,8 @@ class User{ if ( $PWD == '4GetMyID' ){ $DATABASE->Query("UPDATE users SET SID='{$this->Data['SID']}' WHERE id='{$this->Data['id']}' ",false); } else { - $DATABASE->Query("UPDATE users SET login_ts=NOW(), SID='{$this->Data['SID']}' WHERE id='{$this->Data['id']}' ",false); + $CTS = time(); + $DATABASE->Query("UPDATE users SET login_ts={$CTS}, SID='{$this->Data['SID']}' WHERE id='{$this->Data['id']}' ",false); }; $LOG->login(); return true; diff --git a/lib/php/onvif/toto.php b/lib/php/onvif/toto.php index 5b7d6b7..ecaa83c 100644 --- a/lib/php/onvif/toto.php +++ b/lib/php/onvif/toto.php @@ -43,7 +43,7 @@ class Ponvif { public function getPassword() { return $this->password; } public function getDeviceUri() { return $this->mediauri; } public function setDeviceUri($deviceUri) { $this->mediauri=$deviceUrl; } - public function getIPAddress($ipAddress) { return $this->ipAddress; } + public function getIPAddress($ipAddress) { return $this->ipaddress; } public function setIPAddress($ipAddress) { $this->ipaddress=$ipAddress; } public function getSources() { return $this->sources; } public function getMediaUri() { return $this->mediauri; } @@ -88,10 +88,14 @@ class Ponvif { if(FALSE == @socket_bind($sock, $this->discoverybindip, rand(20000, 40000))){ echo('Bind socket error: ['.socket_last_error().'] '.socket_strerror(socket_last_error())); } - socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array('group' => $this->discoverymcastip)); - socket_sendto($sock, $post_string, strlen($post_string), 0, $this->discoverymcastip, $this->discoverymcastport); + if( $this->ipaddress == '' ){ + socket_set_option($sock, IPPROTO_IP, MCAST_JOIN_GROUP, array('group' => $this->discoverymcastip)); + socket_sendto($sock, $post_string, strlen($post_string), 0, $this->discoverymcastip, $this->discoverymcastport); + } else { + socket_sendto($sock, $post_string, strlen($post_string), 0, $this->ipaddress, $this->discoverymcastport ); + }; socket_set_nonblock($sock); - while(time() < $timeout){ + while( time() < $timeout ){ if(FALSE !== @socket_recvfrom($sock, $response, 9999, 0, $from, $this->discoverymcastport)){ if($response != NULL && $response != $post_string){ $response = $this->_xml2array($response); diff --git a/lib/php/ui/UI_functions.php b/lib/php/ui/UI_functions.php index 6afeb11..d92b09a 100644 --- a/lib/php/ui/UI_functions.php +++ b/lib/php/ui/UI_functions.php @@ -366,18 +366,18 @@ function UI_LoginForm($target = 'login.php'){ diff --git a/style/logo_square.png b/style/20f21b4f01f1b7587f728b05dfc9f4ea.png similarity index 100% rename from style/logo_square.png rename to style/20f21b4f01f1b7587f728b05dfc9f4ea.png diff --git a/style/logo_squarer.png b/style/20f21b4f01f1b7587f728b05dfc9f4eb.png similarity index 100% rename from style/logo_squarer.png rename to style/20f21b4f01f1b7587f728b05dfc9f4eb.png diff --git a/style/assets/RCA-Connector-Plug-icon.png b/style/assets/RCA-Connector-Plug-icon.png index 4d37ae3..898fdae 100644 Binary files a/style/assets/RCA-Connector-Plug-icon.png and b/style/assets/RCA-Connector-Plug-icon.png differ diff --git a/style/assets/cam_analog_256.png b/style/assets/cam_analog_256.png new file mode 100644 index 0000000..0768148 Binary files /dev/null and b/style/assets/cam_analog_256.png differ diff --git a/style/assets/cam_axis_512.png b/style/assets/cam_axis_512.png new file mode 100644 index 0000000..ea1f361 Binary files /dev/null and b/style/assets/cam_axis_512.png differ diff --git a/style/assets/cam_dahua_512.png b/style/assets/cam_dahua_512.png new file mode 100644 index 0000000..ebb6248 Binary files /dev/null and b/style/assets/cam_dahua_512.png differ diff --git a/style/assets/cam_generic_512.png b/style/assets/cam_generic_512.png new file mode 100644 index 0000000..857bc14 Binary files /dev/null and b/style/assets/cam_generic_512.png differ diff --git a/style/assets/cam_hikvision_512 - Copy.png b/style/assets/cam_hikvision_512 - Copy.png new file mode 100644 index 0000000..25a97b1 Binary files /dev/null and b/style/assets/cam_hikvision_512 - Copy.png differ diff --git a/style/assets/cam_hikvision_512.png b/style/assets/cam_hikvision_512.png new file mode 100644 index 0000000..ad5a816 Binary files /dev/null and b/style/assets/cam_hikvision_512.png differ diff --git a/style/assets/cam_vehicle_512.png b/style/assets/cam_vehicle_512.png new file mode 100644 index 0000000..3260be9 Binary files /dev/null and b/style/assets/cam_vehicle_512.png differ diff --git a/style/style.css b/style/style.css index 7476518..bd02f22 100644 --- a/style/style.css +++ b/style/style.css @@ -139,6 +139,33 @@ background-color: silver; background-image: url("icons/icons/database_delete.png"); } +.sideInfo_item#HW_INFO{ + color: #f5ffff; + background-color: #606e89; + background-image: url("wicons/hw.png"); + background-size: 32px 32px; + padding-left: 42px; + padding-top: 15px!important; + padding-bottom: 15px!important; +} +.sideInfo_item#OS_INFO{ + color: #f5ffff; + background-color: #606e89; + background-image: url("wicons/os.png"); + background-size: 32px 32px; + padding-left: 42px; + padding-top: 15px!important; + padding-bottom: 15px!important; +} +.sideInfo_item#SW_INFO{ + color: #f5ffff; + background-color: #606e89; + background-image: url("wicons/sw.png"); + background-size: 32px 32px; + padding-left: 42px; + padding-top: 15px!important; + padding-bottom: 15px!important; +} #wrapper { padding-top: 30px; @@ -629,6 +656,16 @@ A.CalendarDS:hover { color: black; background-color: silver; } +.setEl_infoPanel{ + display: block; + border-radius: 5px; + text-align: left; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + color: black; + background-color: orange; +} .setEd_infoPanel#UART{ color: yellow; background-color: green; @@ -655,6 +692,7 @@ A.CalendarDS:hover { height: 200px; background-size: 150px 150px; } + .server_img_set{ display: block; border-radius: 128px; @@ -710,6 +748,61 @@ A.CalendarDS:hover { background-position: 17px 15px; background-size: 220px 220px; } +.camera_hikvision_set{ + display: block; + border-radius: 128px; + width: 256px; + height: 256px; + background-color: #4169e1; + background-image: url('assets/cam_hikvision_512.png'); + background-repeat: no-repeat; + background-position: 0px 0px; + background-size: 256px 256px; +} +.camera_dahua_set{ + display: block; + border-radius: 128px; + width: 256px; + height: 256px; + background-color: #4169e1; + background-image: url('assets/cam_dahua_512.png'); + background-repeat: no-repeat; + background-position: 0px 0px; + background-size: 256px 256px; +} +.camera_axis_set{ + display: block; + border-radius: 128px; + width: 256px; + height: 256px; + background-color: #4169e1; + background-image: url('assets/cam_axis_512.png'); + background-repeat: no-repeat; + background-position: 0px 0px; + background-size: 256px 256px; +} +.camera_generic_set{ + display: block; + border-radius: 128px; + width: 256px; + height: 256px; + background-color: #4169e1; + background-image: url('assets/cam_generic_512.png'); + background-repeat: no-repeat; + background-position: 0px 0px; + background-size: 256px 256px; +} +.camera_analog_set{ + display: block; + border-radius: 128px; + width: 256px; + height: 256px; + background-color: #4169e1; + background-image: url('assets/cam_analog_256.png'); + background-repeat: no-repeat; + background-position: 28px 28px; + background-size: 200px 200px; +} .ss_bg_overlay{ display: block; cursor: none; @@ -775,3 +868,183 @@ A.CalendarDS:hover { padding: 4px; } +.x-btn-text-icon .x-btn-icon-large-left .x-btn-text { + background-position: 0 center; + background-repeat: no-repeat; + padding-left: 42px !important; + height: 42px !important; +} + +.mon { + background-image: url(wicons/030.png) !important; +} +.rep{ + background-image: url(wicons/076.png) !important; +} +.cog { + background-image: url(wicons/025.png) !important; +} +.snd0{ + background-image: url(wicons/034.png) !important; +} +.snd1{ + background-image: url(wicons/033.png) !important; +} +.snd2{ + background-image: url(wicons/032.png) !important; +} +.snd3{ + background-image: url(wicons/031.png) !important; +} +.lout{ + background-image: url(wicons/045.png) !important; +} +.srv_op_restart{ + background-image: url(wicons/026.png) !important; + width: 100% !important; + text-align: left !important; +} +.srv_op_hw_init{ + background-image: url(wicons/002.png) !important; + width: 100% !important; + text-align: left !important; +} +.srv_op_power_cycle{ + background-image: url(wicons/014.png) !important; + width: 100% !important; + text-align: left !important; +} +.srv_op_factory_reset{ + background-image: url(wicons/043.png) !important; + width: 100% !important; + text-align: left !important; +} + +.servopInfo_item00{ + color: #fcfcfc !important; + background-color: #606e89 !important; + text-align: left; + background-image: url(wicons/006.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item01{ + color: #fcfcfc !important; + background-color: green !important; + text-align: left; + background-image: url(wicons/006.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item10{ + color: #fcfcfc !important; + background-color: #606e89 !important; + text-align: left; + background-image: url(wicons/006.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item11{ + color: #fcfcfc !important; + background-color: #4169e1 !important; + text-align: left; + background-image: url(wicons/006.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item20{ + color: #fcfcfc !important; + background-color: #606e89 !important; + text-align: left; + background-image: url(wicons/005.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item21{ + color: #fcfcfc !important; + background-color: darkviolet !important; + text-align: left; + background-image: url(wicons/005.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item30{ + color: #fcfcfc !important; + background-color: #606e89 !important; + text-align: left; + background-image: url(wicons/005.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} +.servopInfo_item31{ + color: yellow !important; + background-color: red !important; + text-align: left; + background-image: url(wicons/005.png); + + display: block; + border-radius: 4px; + padding: 5px; + margin-top: 1px; + margin-bottom: 1px; + background-repeat: no-repeat; + background-position: 5px 5px; + padding-left: 42px !important; + background-size: 32px 32px; +} \ No newline at end of file diff --git a/style/wicons/001.png b/style/wicons/001.png new file mode 100644 index 0000000..1b84d83 Binary files /dev/null and b/style/wicons/001.png differ diff --git a/style/wicons/002.png b/style/wicons/002.png new file mode 100644 index 0000000..756184b Binary files /dev/null and b/style/wicons/002.png differ diff --git a/style/wicons/003.png b/style/wicons/003.png new file mode 100644 index 0000000..2730945 Binary files /dev/null and b/style/wicons/003.png differ diff --git a/style/wicons/004.png b/style/wicons/004.png new file mode 100644 index 0000000..643e380 Binary files /dev/null and b/style/wicons/004.png differ diff --git a/style/wicons/005.png b/style/wicons/005.png new file mode 100644 index 0000000..5dd6844 Binary files /dev/null and b/style/wicons/005.png differ diff --git a/style/wicons/006.png b/style/wicons/006.png new file mode 100644 index 0000000..fb52ae5 Binary files /dev/null and b/style/wicons/006.png differ diff --git a/style/wicons/007.png b/style/wicons/007.png new file mode 100644 index 0000000..da7a144 Binary files /dev/null and b/style/wicons/007.png differ diff --git a/style/wicons/008.png b/style/wicons/008.png new file mode 100644 index 0000000..fe62bf2 Binary files /dev/null and b/style/wicons/008.png differ diff --git a/style/wicons/009.png b/style/wicons/009.png new file mode 100644 index 0000000..55a4a96 Binary files /dev/null and b/style/wicons/009.png differ diff --git a/style/wicons/010.png b/style/wicons/010.png new file mode 100644 index 0000000..1181063 Binary files /dev/null and b/style/wicons/010.png differ diff --git a/style/wicons/011.png b/style/wicons/011.png new file mode 100644 index 0000000..da5600a Binary files /dev/null and b/style/wicons/011.png differ diff --git a/style/wicons/012.png b/style/wicons/012.png new file mode 100644 index 0000000..78c5afb Binary files /dev/null and b/style/wicons/012.png differ diff --git a/style/wicons/013.png b/style/wicons/013.png new file mode 100644 index 0000000..a15e633 Binary files /dev/null and b/style/wicons/013.png differ diff --git a/style/wicons/014.png b/style/wicons/014.png new file mode 100644 index 0000000..cc3ae6d Binary files /dev/null and b/style/wicons/014.png differ diff --git a/style/wicons/015.png b/style/wicons/015.png new file mode 100644 index 0000000..2ae5512 Binary files /dev/null and b/style/wicons/015.png differ diff --git a/style/wicons/016.png b/style/wicons/016.png new file mode 100644 index 0000000..e7e7f73 Binary files /dev/null and b/style/wicons/016.png differ diff --git a/style/wicons/017.png b/style/wicons/017.png new file mode 100644 index 0000000..899463d Binary files /dev/null and b/style/wicons/017.png differ diff --git a/style/wicons/018.png b/style/wicons/018.png new file mode 100644 index 0000000..768a7fa Binary files /dev/null and b/style/wicons/018.png differ diff --git a/style/wicons/019.png b/style/wicons/019.png new file mode 100644 index 0000000..773a81c Binary files /dev/null and b/style/wicons/019.png differ diff --git a/style/wicons/021.png b/style/wicons/021.png new file mode 100644 index 0000000..fe57652 Binary files /dev/null and b/style/wicons/021.png differ diff --git a/style/wicons/022.png b/style/wicons/022.png new file mode 100644 index 0000000..46570bd Binary files /dev/null and b/style/wicons/022.png differ diff --git a/style/wicons/023.png b/style/wicons/023.png new file mode 100644 index 0000000..ac7097d Binary files /dev/null and b/style/wicons/023.png differ diff --git a/style/wicons/024.png b/style/wicons/024.png new file mode 100644 index 0000000..6523d12 Binary files /dev/null and b/style/wicons/024.png differ diff --git a/style/wicons/025.png b/style/wicons/025.png new file mode 100644 index 0000000..38bd6f3 Binary files /dev/null and b/style/wicons/025.png differ diff --git a/style/wicons/026.png b/style/wicons/026.png new file mode 100644 index 0000000..3fc21aa Binary files /dev/null and b/style/wicons/026.png differ diff --git a/style/wicons/027.png b/style/wicons/027.png new file mode 100644 index 0000000..7fc8a9f Binary files /dev/null and b/style/wicons/027.png differ diff --git a/style/wicons/028.png b/style/wicons/028.png new file mode 100644 index 0000000..a16417c Binary files /dev/null and b/style/wicons/028.png differ diff --git a/style/wicons/029.png b/style/wicons/029.png new file mode 100644 index 0000000..4f13071 Binary files /dev/null and b/style/wicons/029.png differ diff --git a/style/wicons/030.png b/style/wicons/030.png new file mode 100644 index 0000000..1ad6664 Binary files /dev/null and b/style/wicons/030.png differ diff --git a/style/wicons/031.png b/style/wicons/031.png new file mode 100644 index 0000000..95ac54b Binary files /dev/null and b/style/wicons/031.png differ diff --git a/style/wicons/032.png b/style/wicons/032.png new file mode 100644 index 0000000..5bab6d2 Binary files /dev/null and b/style/wicons/032.png differ diff --git a/style/wicons/033.png b/style/wicons/033.png new file mode 100644 index 0000000..dfcf193 Binary files /dev/null and b/style/wicons/033.png differ diff --git a/style/wicons/034.png b/style/wicons/034.png new file mode 100644 index 0000000..ed89ada Binary files /dev/null and b/style/wicons/034.png differ diff --git a/style/wicons/043.png b/style/wicons/043.png new file mode 100644 index 0000000..5441a6b Binary files /dev/null and b/style/wicons/043.png differ diff --git a/style/wicons/045.png b/style/wicons/045.png new file mode 100644 index 0000000..625d7f1 Binary files /dev/null and b/style/wicons/045.png differ diff --git a/style/wicons/046.png b/style/wicons/046.png new file mode 100644 index 0000000..887dc61 Binary files /dev/null and b/style/wicons/046.png differ diff --git a/style/wicons/047.png b/style/wicons/047.png new file mode 100644 index 0000000..f476e43 Binary files /dev/null and b/style/wicons/047.png differ diff --git a/style/wicons/048.png b/style/wicons/048.png new file mode 100644 index 0000000..c517d43 Binary files /dev/null and b/style/wicons/048.png differ diff --git a/style/wicons/050.png b/style/wicons/050.png new file mode 100644 index 0000000..50dc11d Binary files /dev/null and b/style/wicons/050.png differ diff --git a/style/wicons/076.png b/style/wicons/076.png new file mode 100644 index 0000000..5f9cf2b Binary files /dev/null and b/style/wicons/076.png differ diff --git a/style/wicons/675-6758397_operating-system-icon.jpg b/style/wicons/675-6758397_operating-system-icon.jpg new file mode 100644 index 0000000..ea507c4 Binary files /dev/null and b/style/wicons/675-6758397_operating-system-icon.jpg differ diff --git a/style/wicons/cpu.png b/style/wicons/cpu.png new file mode 100644 index 0000000..f32487a Binary files /dev/null and b/style/wicons/cpu.png differ diff --git a/style/wicons/hdd.png b/style/wicons/hdd.png new file mode 100644 index 0000000..d16c92d Binary files /dev/null and b/style/wicons/hdd.png differ diff --git a/style/wicons/hw.png b/style/wicons/hw.png new file mode 100644 index 0000000..920ae22 Binary files /dev/null and b/style/wicons/hw.png differ diff --git a/style/wicons/hw1.png b/style/wicons/hw1.png new file mode 100644 index 0000000..793e0f1 Binary files /dev/null and b/style/wicons/hw1.png differ diff --git a/style/wicons/hw1.psd b/style/wicons/hw1.psd new file mode 100644 index 0000000..c7860b9 Binary files /dev/null and b/style/wicons/hw1.psd differ diff --git a/style/wicons/hw2.png b/style/wicons/hw2.png new file mode 100644 index 0000000..5d9624d Binary files /dev/null and b/style/wicons/hw2.png differ diff --git a/style/wicons/mem.png b/style/wicons/mem.png new file mode 100644 index 0000000..9d5317d Binary files /dev/null and b/style/wicons/mem.png differ diff --git a/style/wicons/operating-system-icon.psd b/style/wicons/operating-system-icon.psd new file mode 100644 index 0000000..d07e6c0 Binary files /dev/null and b/style/wicons/operating-system-icon.psd differ diff --git a/style/wicons/os.png b/style/wicons/os.png new file mode 100644 index 0000000..04634d8 Binary files /dev/null and b/style/wicons/os.png differ diff --git a/style/wicons/sw.png b/style/wicons/sw.png new file mode 100644 index 0000000..6d47fb2 Binary files /dev/null and b/style/wicons/sw.png differ
- - + +
- + - +
 
 
GetLabel('__LOGIN_ID__');?>:
GetLabel('__PASSWORD__');?>: