Browse Source

BINAT updates

master
Evgeny Gagua 2 years ago
parent
commit
efe1552be2
  1. 2
      lib/1.json
  2. 126
      lib/controller/addMap.php
  3. 4
      lib/controller/addPhoneBookRecord.php
  4. 42
      lib/controller/delPhoneBookRecord.php
  5. 147
      lib/controller/doCameraOperation.php
  6. 9
      lib/controller/doModuleOperation.php
  7. 5
      lib/controller/downloadVideo.php
  8. 109
      lib/controller/getCameraEditor.php
  9. 50
      lib/controller/getModuleSettings.php
  10. 2
      lib/controller/getPhoneBook.php
  11. 5
      lib/controller/getStatus.php
  12. 4
      lib/javascript/jsapi_dynamic/mojo_reports.js
  13. 25
      lib/javascript/jsapi_dynamic/mojo_settings.js

2
lib/1.json
File diff suppressed because it is too large
View File

126
lib/controller/addMap.php

@ -38,71 +38,75 @@
copy( $_FILES['map_image']['tmp_name'], $filePath . '/' . $FNAME );
@unlink( $_FILES['map_image']['tmp_name'] );
list( $width, $height, $type, $attr ) = getimagesize( $filePath . '/' . $FNAME );
$ENAME = $DATABASE->escape($_POST['map_name']);
$EDESC = $DATABASE->escape($_POST['map_desc']);
$EATTR = $DATABASE->escape($_POST['map_attr']);
$TB = intval( $_POST['map_tpb'] );
$LB = intval( $_POST['map_lpb'] );
$RB = intval( $_POST['map_rpb'] );
$BB = intval( $_POST['map_bpb'] );
$CSYS = 2 + intval( $_POST['map_corsys'] );
if( $CSYS == 2 ){
$INZOOM = intval( $_POST['map_maxnz'] );
$IZOOM = intval( $_POST['map_maxz'] );
$MA_WI = floatval( $_POST['map_width'] );
$MA_HE = floatval( $_POST['map_height'] );
$BM = intval( $_POST['bounds_mode'] );
$K_X = $MA_WI / ( $width - $LB - $RB );
$K_Y = $MA_HE / ( $height - $TB - $BB );
if( $BM ){
$THW = (($width + $RB + $LB) * $K_X ) / 2.0;
$THH = (($height + $BB + $TB) * $K_Y ) / 2.0;
$IBLX = -$THW;
$IBLY = -$THH;
$IBRX = $THW;
$IBRY = $THH;
if( $width > 1000 && $height > 1000 ){
$ENAME = $DATABASE->escape($_POST['map_name']);
$EDESC = $DATABASE->escape($_POST['map_desc']);
$EATTR = $DATABASE->escape($_POST['map_attr']);
$TB = intval( $_POST['map_tpb'] );
$LB = intval( $_POST['map_lpb'] );
$RB = intval( $_POST['map_rpb'] );
$BB = intval( $_POST['map_bpb'] );
$CSYS = 2 + intval( $_POST['map_corsys'] );
if( $CSYS == 2 ){
$INZOOM = intval( $_POST['map_maxnz'] );
$IZOOM = intval( $_POST['map_maxz'] );
$MA_WI = floatval( $_POST['map_width'] );
$MA_HE = floatval( $_POST['map_height'] );
$BM = intval( $_POST['bounds_mode'] );
$K_X = $MA_WI / ( $width - $LB - $RB );
$K_Y = $MA_HE / ( $height - $TB - $BB );
if( $BM ){
$THW = (($width + $RB + $LB) * $K_X ) / 2.0;
$THH = (($height + $BB + $TB) * $K_Y ) / 2.0;
$IBLX = -$THW;
$IBLY = -$THH;
$IBRX = $THW;
$IBRY = $THH;
} else {
$IBLX = (-$LB)*$K_X;
$IBLY = (-$TB)*$K_Y;
$IBRX = ( $width + $RB ) * $K_X;
$IBRY = ( $height + $BB ) * $K_Y;
};
} else {
$IBLX = (-$LB)*$K_X;
$IBLY = (-$TB)*$K_Y;
$IBRX = ( $width + $RB ) * $K_X;
$IBRY = ( $height + $BB ) * $K_Y;
};
} else {
$BM = 0;
$LTLAT = floatval( $_POST['map_lcclat'] );
$LTLON = floatval( $_POST['map_lcclon'] );
$RBLAT = floatval( $_POST['map_rcclat'] );
$RBLON = floatval( $_POST['map_rcclon'] );
if( $TB+$LB+$RB+$BB ){
$KX = ( $RBLON - $LTLON )/( $width - $LB - $RB );
$KY = ( $RBLAT - $LTLAT )/( $height - $TB - $BB );
$LTLON = $LTLON - $KX * $LB;
$LTLAT = $LTLAT + $KY * $TB;
$RBLON = $RBLON + $KX * $RB;
$RBLAT = $RBLAT - $KY * $BB;
};
$INZOOM = intval( $_POST['map_maxnz'] );
$IZOOM = intval( $_POST['map_maxz'] );
$IBLX = $LTLON;
$IBLY = $LTLAT;
$IBRX = $RBLON;
$IBRY = $RBLAT;
$MA_WI = $IBRX - $IBLX;
$MA_HE = $IBLY - $IBRY;
// zoom 180.0 --> 0
$SANV = 360.0;
for( $i = 0; $i< 32; $i++ ){
$CANV = $SANV /(1<< $i);
if( $CANV < $MA_WI ){
$INZOOM = $i+5;
$IZOOM = $INZOOM;
break;
$BM = 0;
$LTLAT = floatval( $_POST['map_lcclat'] );
$LTLON = floatval( $_POST['map_lcclon'] );
$RBLAT = floatval( $_POST['map_rcclat'] );
$RBLON = floatval( $_POST['map_rcclon'] );
if( $TB+$LB+$RB+$BB ){
$KX = ( $RBLON - $LTLON )/( $width - $LB - $RB );
$KY = ( $RBLAT - $LTLAT )/( $height - $TB - $BB );
$LTLON = $LTLON - $KX * $LB;
$LTLAT = $LTLAT + $KY * $TB;
$RBLON = $RBLON + $KX * $RB;
$RBLAT = $RBLAT - $KY * $BB;
};
$INZOOM = intval( $_POST['map_maxnz'] );
$IZOOM = intval( $_POST['map_maxz'] );
$IBLX = $LTLON;
$IBLY = $LTLAT;
$IBRX = $RBLON;
$IBRY = $RBLAT;
$MA_WI = $IBRX - $IBLX;
$MA_HE = $IBLY - $IBRY;
// zoom 180.0 --> 0
$SANV = 360.0;
for( $i = 0; $i< 32; $i++ ){
$CANV = $SANV /(1<< $i);
if( $CANV < $MA_WI ){
$INZOOM = $i+5;
$IZOOM = $INZOOM;
break;
};
};
};
$QS = "INSERT INTO `location_maps`(`type`,`name`,`layer_url`,`desc`,`maxNativeZoom`,`maxZoom`,`attribution`,`bounds_lx`,`bounds_ly`,`bounds_rx`,`bounds_ry`,`bounds_mode`,`img_w`,`img_h`,`img_map_w`,`img_map_h`,`img_lb`,`img_tb`,`img_rb`,`img_bb`) values({$CSYS},'{$ENAME}','{$FNAME}','{$EDESC}',{$INZOOM},{$IZOOM},'{$EATTR}',{$IBLX},{$IBLY},{$IBRX},{$IBRY},{$BM},{$width},{$height},{$MA_WI},{$MA_HE},{$LB},{$TB},{$RB},{$BB})";
$DATABASE->Query( $QS );
verbose( 1, "ALL IS OK" );
} else {
verbose( 0, 'Image is too Small!' );
};
$QS = "INSERT INTO `location_maps`(`type`,`name`,`layer_url`,`desc`,`maxNativeZoom`,`maxZoom`,`attribution`,`bounds_lx`,`bounds_ly`,`bounds_rx`,`bounds_ry`,`bounds_mode`,`img_w`,`img_h`,`img_map_w`,`img_map_h`,`img_lb`,`img_tb`,`img_rb`,`img_bb`) values({$CSYS},'{$ENAME}','{$FNAME}','{$EDESC}',{$INZOOM},{$IZOOM},'{$EATTR}',{$IBLX},{$IBLY},{$IBRX},{$IBRY},{$BM},{$width},{$height},{$MA_WI},{$MA_HE},{$LB},{$TB},{$RB},{$BB})";
$DATABASE->Query( $QS );
verbose( 1, "ALL IS OK" );
};
};
} else {

4
lib/controller/addPhoneBookRecord.php

@ -23,9 +23,9 @@
$NL = 'New Number';
};
if( $CO ){
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`) VALUES('{$NN}',1,'{$NL}')";
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`mode`,`label`) VALUES('{$NN}',1,'{$NL}')";
} else {
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`label`,`custom_msg`) VALUES('{$NN}', 0,'{$NL}','{$CMS}')";
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`mode`,`label`,`custom_msg`) VALUES('{$NN}', 0,'{$NL}','{$CMS}')";
};
$DATABASE->Query( $QS );
$Data['success'] = true;

42
lib/controller/delPhoneBookRecord.php

@ -0,0 +1,42 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data['success'] = false;
if( $CUser->Data['access'] > 5 ){
$NL = trim( $_POST['PNAM'] );
$NN = str_ireplace('+','',
str_ireplace('-','',
str_ireplace( ' ', '', $_POST['PNUM']
)
)
);
$CO = intval( $_POST['PCAL'] );
if( $CO == 0 ){
$CMS = $DATABASE->escape( $_POST['PMSG'] );
};
if( strlen( $NN ) > 7 ) {
if( substr( $NN, 1 ) == '0' ){
} else {
};
if( strlen( $NL ) == 0 ){
$NL = 'New Number';
};
if( $CO ){
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`mode`,`label`) VALUES('{$NN}',1,'{$NL}')";
} else {
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`mode`,`label`,`custom_msg`) VALUES('{$NN}', 0,'{$NL}','{$CMS}')";
};
$DATABASE->Query( $QS );
$Data['success'] = true;
} else {
$Data['msg'] = 'Number is Invalid!';
};
} else {
$Data['msg'] = 'Access Denied!';
};
echo json_encode( $Data );
exit();
};
header( 'location: /');
?>

147
lib/controller/doCameraOperation.php

@ -16,7 +16,8 @@
break;
};
case 1:{
// List Registered Cameras
//
break;
};
case 2:{
@ -104,7 +105,7 @@
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,manual) VALUES('{$CH}','{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1,1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1";
$QS = "INSERT INTO `cameras`(hardware,type,name,uuid,mac,ip,status,onvif_ctrl,online,manual) VALUES('{$CH}',13,'{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1,1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1";
$DATABASE->Query($QS,false);
$CameraID = $DATABASE->getLastInsertID();
if( $CameraID == 0 ){
@ -119,58 +120,76 @@
$onvif->setUsername( $EUser );
$onvif->setPassword( $EPass );
$onvif->setAuthMethod( $AUTH );
$CI = $IP;
$CameraID = 0;
try {
$onvif->initialize();
if ( !$onvif->isFault($devices=$onvif->getSources())){
$Data['ss'] .='No Fault';
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;
if ( !$onvif->isFault($info=$onvif->core_GetDeviceInformation())){
//Adding Camera
$CH = $info['Manufacturer'].'_'.$info['Model'];
$CN = $info['Manufacturer'].'_CAM'.$info['HardwareId'];
$CA = $info['SerialNumber'];
$CM = $info['SerialNumber'];
$CP = $onvif->getDeviceUri();
$QS = "INSERT INTO `cameras`(hardware,type,name,uuid,mac,ip,status,onvif_ctrl,online,manual) VALUES('{$CH}',13,'{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1,1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=1";
$DATABASE->Query($QS,false);
$CameraID = $DATABASE->getLastInsertID();
};
if( $CameraID ){
if ( !$onvif->isFault($devices=$onvif->getSources()) ){
$Data['ss'] .='No Fault';
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];
if( count( $TPArr[0] ) > 2 ){
$pic_port = intval( $TPArr[2] );
if($pic_port == 0 ) $pic_port = 80;
} else $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}'";
$Data['ss'] .='Added';
$Data['QS'] = $QS;
$DATABASE->Query( $QS, false );
$Data['ss'] .='After DBQ';
};
$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];
if( count( $TPArr[0] ) > 2 ){
$pic_port = intval( $TPArr[2] );
if($pic_port == 0 ) $pic_port = 80;
} else $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}'";
$Data['ss'] .='Added';
$Data['QS'] = $QS;
$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 );
$Data['ss'] .='After DBQ';
$Data['status'] = 'ok';
} else {
$Data['msg'] = 'Camera was added.<br/>However provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']';
};
$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.<br/>However provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']';
} else {
$Data['msg'] = 'No Camera was added.<br/>';
};
} catch( Exception $e ){
$Data['msg'] = 'Provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']';
@ -244,7 +263,35 @@
break;
};
case 4:{
// Add Onvif Camera Manually (After 2 - checkup )
// change IP/Credentials
if( $CameraID ){
$QS ="SELECT * FROM `cameras` WHERE `id`={$CameraID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$CC = $JJ[0];
$PA = explode( '/', $CC['onvif_ctrl'] );
$EUser = $DATABASE->escape( $_POST['UU'] );
$EPass = $DATABASE->escape( $_POST['PP'] );
$EIP = $DATABASE->escape( $_POST['UI'] );
$PA[2] = $EIP;
$OVC = implode('/',$PA);
$AUTH = intval( $_POST['AU'] );
$TAr = explode( ':', $EIP );
if( count( $TAr ) > 1 ){
$EIP = $TAr[0];
$POR = intval($TAr[1]);
$QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH},`ip`='{$EIP}',port={$POR}, onvif_ctrl='{$OVC}' WHERE id={$CameraID}";
} else {
$QS = "UPDATE cameras SET access_login='$EUser', access_pass='$EPass', auth_mode={$AUTH},`ip`='{$EIP}', port=NULL, onvif_ctrl='{$OVC}' WHERE id={$CameraID}";
};
$DATABASE->Query( $QS, false );
$Data['status'] = 'ok';
} else {
$Data['msg'] = '<p align="center">Wrong Camera</p><p align="center">Please consider run network discovery.</p><p align="center">To refresh all aveable cameras.</p>';
};
} else {
$Data['msg'] = '<p align="center">Wrong Camera</p><p align="center">Please consider run network discovery.</p><p align="center">To refresh all aveable cameras.</p>';
};
break;
};
case 5:{
@ -416,7 +463,7 @@
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,14,15)";
$QS = "UPDATE `nodes` SET `aux_parameter`={$Param} WHERE `aux_id`={$CameraID} AND `type` IN(10,11,12,13,14,15)";
$DATABASE->Query( $QS );
};
$QS = "UPDATE `cameras` SET `stream_id`={$Param} WHERE `id`={$CameraID}";

9
lib/controller/doModuleOperation.php

@ -65,6 +65,15 @@
case 2: $QS = "UPDATE `modules` SET `enabled`={$OPCODE} WHERE `id`={$MID}"; break;
case 3: if( $OPCODE ) $QS = "UPDATE `module_eve` SET `output_mode`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 4: $QS = "UPDATE `module_modem` SET `modem_id`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 5: {
if( $OPCODE == 2 ){
$QS = "UPDATE `module_modem` SET `call_enabled`=1, `sms_enabled`=0 WHERE `id`={$JJ['aux_id']}";
} else {
$QS = "UPDATE `module_modem` SET `call_enabled`=0, `sms_enabled`=1 WHERE `id`={$JJ['aux_id']}";
};
break;
};
case 6: $QS = "UPDATE `module_modem` SET `call_hangup_wait`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
};
};
if( $QS != '' ) $DATABASE->Query( $QS );

5
lib/controller/downloadVideo.php

@ -18,7 +18,7 @@
$SRC = 'data/reports/' . date("Y/m/d", $DTS ) . '/'. $MD5. '.mjpeg';
$FPS = intval( $_POST['FPS'] );
if( file_exists( $SRC ) ){
//$DST = '../tmp/' . md5_file( $SRC ) . '.mp4';
//$DST = '../tmp/' . $MD5 . '.mp4';
$DST = '../tmp/' . $MD5 . '.avi';
//echo $SRC . "->" . $DST . "\n\n"; exit();
//$COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -pix_fmt yuvj420p -b:v 4000k -c:v libx264 {$DST} 2>&1";
@ -27,7 +27,8 @@
$JUJA = `$COM`;
if( file_exists( $DST ) ){
//header( 'location: /lib/tmp/' . $MD5 . '.mp4' );
echo '/lib/tmp/' . $MD5 . '.mp4';
echo '/lib/tmp/' . $MD5 . '.avi';
//echo '/lib/tmp/' . $MD5 . '.mp4';
//output_dummy( $DST );
//unlink( $DST );
} else //output_dummy( '../../style/assets/nosignal.mp4' );

109
lib/controller/getCameraEditor.php

@ -35,6 +35,7 @@
$CLS = "camera_generic_set";
};
};
if( intval($Cam['port'] ) ) $Cam['ip'] = $Cam['ip'] . ':' . $Cam['port'];
$QS = "SELECT * FROM media_streams WHERE source_id={$CID}";
$Result = $DATABASE->Query($QS,false);
$SELECTED_STREAM = 0;
@ -90,8 +91,112 @@
,{
xtype: 'button',
width: '100%',
text: '{$Labels->GetLabel('_RSET_CREDENTIALS_')}',
text: '{$Labels->GetLabel('_CHANGE_CREDENTIALS_')}/{$Labels->GetLabel('_CONNECTION_')}',
handler: function(){
var RCC_Window = new Ext.Window({
title: '{$Labels->GetLabel('_CHANGE_CREDENTIALS_')}/{$Labels->GetLabel('_CONNECTION_')}',
width: 500,
height: 400,
modal: true,
layout: 'form',
labelWidth: 150,
labelAlign: 'right',
items:[{
xtype: 'textfield',
id: 'am_ip_addr',
fieldLabel: '{$Labels->GetLabel('_CAM_IP_ADDRESS_')}',
width: '100%',
value: '{$Cam['ip']}'
},{
xtype: 'textfield',
id: 'am_login',
fieldLabel: '{$Labels->GetLabel('_ACCESS_LOGIN_')}',
width: '100%',
value: '{$Cam['access_login']}'
},{
xtype: 'textfield',
id: 'am_password',
fieldLabel: '{$Labels->GetLabel('_ACCESS_PASSWORD_')}',
width: '100%',
value: '{$Cam['access_pass']}'
},{
xtype: 'combo',
id: 'am_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: '{$Cam['auth_mode']}',
width: 200
},{
xtype: 'button',
text: 'Apply',
width: '100%',
handler: function(){
var NIP = Ext.getCmp('am_ip_addr').getValue();
var NUU = Ext.getCmp('am_login').getValue();
var NPP = Ext.getCmp('am_password').getValue();
var NAM = Ext.getCmp('am_auth_mode').getValue();
Ext.Ajax.request({
url: '/lib/controller/doCameraOperation.php',
params: {
UID: {$UserID},
SID: '{$Session}',
CID: {$CID},
UI: NIP,
UU: NUU,
PP: NPP,
AU: NAM,
CMD: 4
},
success: function( response, opts ){
RCC_Window.destroy();
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
loadDetectedCameras();
} else {
Ext.Msg.show({
title:'Error!',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.WARNING
});
};
},
failure: failureAJAXFunction
});
}
},{
xtype: 'button',
text: 'Cancel',
width: '100%',
handler: function(){
RCC_Window.destroy();
}
}]
});
RCC_Window.show();
}
}
kskjhiiuwye;
@ -132,7 +237,7 @@ kskjhiiuwye;
}
hzzhoiuyhetrkh;
} else {
$RESET_CREDENTIALS='';
//$RESET_CREDENTIALS='';
$ADD_CAMERA=<<<hhoiuyhetrkh
{
xtype: 'button',

50
lib/controller/getModuleSettings.php

@ -577,7 +577,7 @@ EFUFU;
},
valueField: 'moId',
displayField: 'moText',
value: {$CI['output_mode']},
value: '{$CI['output_mode']}',
listeners:{
select: function( t, r, i ){
doModuleOperation( {$EID}, 3, r.data.moId, false );
@ -920,7 +920,7 @@ $TPL =<<<EFUFU
xtype: 'form',
labelAlign: 'right',
autoScroll: 'auto',
labelWidth: 200,
labelWidth: 250,
items:[{
border: false,
frame: false,
@ -956,24 +956,45 @@ $TPL =<<<EFUFU
xtype: 'spacer',
height: 5
},{
xtype: 'numberfield',
id: 'trig_window',
name: 'trig_window',
fieldLabel: 'Trigger Time (seconds)',
xtype: 'combo',
fieldLabel: 'Working Mode',
id: 'mod_mode',
width: 220,
value: '{$CI['trigger_window']}'
lazyRender:true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['wm_id','wm_txt'],
data: [[1,'Sending SMS'],[2,'Making Call']]
}),
value: ('{$CI['sms_enabled']}' =='1')?'1':'2',
valueField: 'wm_id',
displayField: 'wm_txt',
listeners:{
select: function( t, r, i ){
doModuleOperation( {$EID}, 5, r.data.wm_id, false );
}
}
},{
xtype: 'spacer',
xtype: 'spacer',
height: 5
},{
xtype: 'numberfield',
id: 'alarm_window',
name: 'alarm_window',
fieldLabel: 'Alarm Time (seconds)',
id: 'trig_window',
name: 'trig_window',
fieldLabel: 'Call Hangup Dalay (seconds)',
width: 220,
value: '{$CI['alarm_window']}'
value: '{$CI['call_hangup_wait']}',
listeners:{
change: function( t, n, o ){
doModuleOperation( {$EID}, 6, n, false );
}
}
},{
xtype: 'spacer',
xtype: 'spacer',
height: 5
},{
xtype: 'grid',
@ -989,7 +1010,8 @@ $TPL =<<<EFUFU
},{
text: 'Delete',
id: 'ph_bo_de_bu',
disabled: true
disabled: true,
handler: deletePhoneNumber
}],
height: 420,
ds: modem_pb_store,

2
lib/controller/getPhoneBook.php

@ -6,7 +6,7 @@
$QS = "SELECT * FROM `module_modem_phonebook`";
$RV = $DATABASE->Query( $QS );
if( count( $RV ) ){
$DATA = $RV;
$Data = $RV;
};
echo json_encode( $Data );
exit();

5
lib/controller/getStatus.php

@ -48,7 +48,10 @@
$Data['log'][] = $CR;
};
};
}
} else {
echo json_encode( $Data );
exit();
};
//$QS = "SELECT * FROM nodes ORDER BY `type`";
$QS = "SELECT * FROM nodes WHERE `type` > 0 AND `type` < 16";
$result = $DATABASE->Query( $QS, false );

4
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -1530,7 +1530,7 @@ function showVideos(){
function downloadCurrentVideo( stid ){
var d = new Date( videoNfo[stid][0] * 1000 );
var videoFileDownloadTarget = d.getFullYear()+'_'+(d.getMonth()+1)+'_'+d.getDate()+'_'+d.getHours()+'-'+d.getMinutes()+'-'+d.getSeconds()+'.mp4';
var videoFileDownloadTarget = d.getFullYear()+'_'+(d.getMonth()+1)+'_'+d.getDate()+'_'+d.getHours()+'-'+d.getMinutes()+'-'+d.getSeconds();//+'.mp4';
// TS, MD5, FPS
downloadVideoFile( videoNfo[stid][0], videoNfo[stid][1], videoNfo[stid][2], videoFileDownloadTarget );
};
@ -1618,7 +1618,7 @@ function downloadVideoFile( a, b, c, d ){
const a = document.createElement('a');
a.style.display = 'none';
a.href = response.responseText;
a.download = d;
a.download = d + response.responseText.substring( response.responseText.lastIndexOf('.'), response.responseText.length );
document.body.appendChild(a);
a.click();
ReportMask.hide();

25
lib/javascript/jsapi_dynamic/mojo_settings.js

@ -344,7 +344,7 @@ function loadFilters(){
});
};
var modem_pb_store = new Ext.data.ArrayStore({
var modem_pb_store = new Ext.data.JsonStore({
autoDestroy: false,
storeId: 'pb_store',
idIndex: 0,
@ -352,17 +352,17 @@ var modem_pb_store = new Ext.data.ArrayStore({
{name: 'id', type: 'int' },
{name: 'number', type: 'string'},
{name: 'mode', type: 'int'},
{name: 'trigg', type: 'int'},
{name: 'trig_special', type: 'int'},
{name: 'label', type: 'string'},
{name: 'custom_msg', type: 'string'}
]
});
var modem_pb_ColModel_ops = {
columns: [
{header: "id", width: 60, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "<?=$Labels->GetLabel('_SOURCE_');?>", width: 100, renderer: log_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'number' },
{header: "<?=$Labels->GetLabel('_TYPE_');?>", width: 180, renderer: log_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'mode' },
{header: "<?=$Labels->GetLabel('_RANGE_');?>", width: 100, dataIndex: 'label', renderer: no_target_filter }
{header: "<?=$Labels->GetLabel('_MODE_');?>", width: 100, dataIndex: 'mode' },
{header: "<?=$Labels->GetLabel('_PHONE_NUM_');?>", width: 200, align: 'left', css: 'vertical-align: middle;', dataIndex: 'number' },
{header: "<?=$Labels->GetLabel('_LABEL_');?>", width: 200, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'label' },
{header: "<?=$Labels->GetLabel('_CUSTOM_MSG_');?>", dataIndex: 'custom_msg' }
],
defaults: {
sortable: false,
@ -379,6 +379,7 @@ var modem_pb_SelModel_ops = {
//alert( rec.data.id );
//loadEventProperties( rec.data );
selected_pb_id = rec.data.id;
Ext.getCmp( 'ph_bo_de_bu' ).enable();
//alert( SelectedEvent );
//var CB = Ext.getCmp('con_to_src');
//CB.enable();
@ -401,7 +402,9 @@ function loadPhoneBook(){
success: function( response, opts ){
var data = Ext.decode(response.responseText);
modem_pb_store.Load( data );
modem_pb_store.loadData( data );
Ext.getCmp( 'ph_bo_de_bu' ).disable();
selected_pb_id = 0;
//var tPanel = Ext.getCmp('main_portal');
//tPanel.removeAll(true);
//for( i=0; i < data.length; i++) tPanel.add( data[i] );
@ -482,6 +485,8 @@ function addNewPhoneNumber(){
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.success ){
loadPhoneBook();
addNPNWindow.hide();
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_ERROR_');?>',
@ -516,6 +521,12 @@ function addNewPhoneNumber(){
addNPNWindow.show();
};
function deletePhoneNumber(){
if( selected_pb_id ){
};
};
function loadDetectedCameras(){
Ext.Ajax.request({
url: '/lib/controller/getCameras.php',

Loading…
Cancel
Save