Browse Source

Jay Version 2

master
root 4 years ago
parent
commit
85320c328c
  1. 119
      index.php
  2. 4
      lib/assembler.php
  3. 54
      lib/controller/addFilter.php
  4. 9
      lib/controller/addModule.php
  5. 42
      lib/controller/addPhoneBookRecord.php
  6. 0
      lib/controller/checkDeviceOperation.php
  7. 123
      lib/controller/dash/node_11.js
  8. 3
      lib/controller/dash/node_13.js
  9. 229
      lib/controller/dash/node_3.js
  10. BIN
      lib/controller/data/factory.db
  11. BIN
      lib/controller/data/mysqlitedb.db
  12. BIN
      lib/controller/data/reports.db
  13. 2
      lib/controller/data/server.log
  14. 12
      lib/controller/doApplicationOperation.php
  15. 130
      lib/controller/doCameraOperation.php
  16. 98
      lib/controller/doFilterOperation.php
  17. 114
      lib/controller/doMaskOperation.php
  18. 136
      lib/controller/doSensorOperation.php
  19. 168
      lib/controller/getCameraEditor.php
  20. 8
      lib/controller/getCameraPreview.php
  21. 154
      lib/controller/getDashBoardItems.php
  22. 5
      lib/controller/getDetectionProfile.php
  23. 6
      lib/controller/getDeviceDraw.php
  24. 25
      lib/controller/getDeviceFiles.php
  25. 3
      lib/controller/getDeviceMask.php
  26. 21
      lib/controller/getDeviceUploadStatus.php
  27. 204
      lib/controller/getFilterEditor.php
  28. 17
      lib/controller/getFilterInfo.php
  29. 43
      lib/controller/getFilters.php
  30. 16
      lib/controller/getHistoryDates.php
  31. 38
      lib/controller/getHistoryDay.php
  32. 33
      lib/controller/getHistoryEvents.php
  33. 0
      lib/controller/getMaskSchedule.php
  34. 0
      lib/controller/getMaskScheduleEditor.php
  35. 145
      lib/controller/getMetroBottomSensorEditor.php
  36. 126
      lib/controller/getMetroFusionEditor.php
  37. 145
      lib/controller/getMetroUpperSensorEditor.php
  38. 7
      lib/controller/getModuleEditor.php
  39. 6
      lib/controller/getModuleInfo.php
  40. 251
      lib/controller/getModuleSettings.php
  41. 10
      lib/controller/getPhoneBook.php
  42. 206
      lib/controller/getReportLayout.php
  43. 10
      lib/controller/getResourceEditor.php
  44. 729
      lib/controller/getSensorEditor.php
  45. 2
      lib/controller/getServerStatus.php
  46. 59
      lib/controller/getStatus.php
  47. 34
      lib/controller/getSystemDevices.php
  48. 17
      lib/controller/getVideoInfo.php
  49. 0
      lib/controller/getWidthTable.php
  50. 0
      lib/controller/getWidthTableEditor.php
  51. 24
      lib/controller/listAccessLog.php
  52. 0
      lib/controller/listServerLog.php
  53. 22
      lib/controller/listUarts.php
  54. 27
      lib/controller/listUsers.php
  55. 75
      lib/controller/medeminfo 1.txt
  56. 28
      lib/controller/report/node_0.js
  57. 96
      lib/controller/report/node_1.js
  58. 39
      lib/controller/report/node_10.js
  59. 61
      lib/controller/report/node_11.js
  60. 18
      lib/controller/report/node_12.js
  61. 72
      lib/controller/report/node_13 - Copy.js
  62. 91
      lib/controller/report/node_13.js
  63. 19
      lib/controller/report/node_13.js.bk2
  64. 88
      lib/controller/report/node_2.js
  65. 95
      lib/controller/report/node_3 - Copy.js
  66. 95
      lib/controller/report/node_3.js
  67. 95
      lib/controller/report/node_4.js
  68. 164
      lib/controller/report/node_5.js
  69. 16
      lib/controller/report/tpl.js
  70. 124
      lib/controller/updateUser.php
  71. 125
      lib/controller/uploadDeviceMask.php
  72. 63
      lib/controller/uploadToDevice.php
  73. 1
      lib/controller/vfd.txt
  74. 15
      lib/defines.php
  75. 2
      lib/error.log
  76. 346
      lib/javascript/jsapi_dynamic/loaders.html
  77. 828
      lib/javascript/jsapi_dynamic/mojo_dashboard.js
  78. 1
      lib/javascript/jsapi_dynamic/mojo_global_vars.js
  79. 6
      lib/javascript/jsapi_dynamic/mojo_logs.js
  80. 15
      lib/javascript/jsapi_dynamic/mojo_main.js
  81. 94
      lib/javascript/jsapi_dynamic/mojo_metro.js
  82. 309
      lib/javascript/jsapi_dynamic/mojo_reports.js
  83. 807
      lib/javascript/jsapi_dynamic/mojo_settings.js
  84. 649
      lib/javascript/jsapi_dynamic/mojo_users.js
  85. 162
      lib/javascript/jsapi_dynamic/rgoose_devices.js
  86. 67
      lib/javascript/jsapi_dynamic/rgoose_swupgrade.js
  87. 171
      lib/javascript/jsapi_dynamic/rgoose_users.js
  88. BIN
      lib/javascript/jsapi_dynamic/vatican_308px-100m.jpg
  89. 13
      lib/javascript/jsapi_static/mojo_general.js
  90. 2
      lib/php/argus/argus.php
  91. 16
      lib/php/db/user_class.php
  92. 71
      lib/php/ui/UI_functions.php
  93. BIN
      style/assets/and.png
  94. BIN
      style/assets/bul_blue.png
  95. BIN
      style/assets/bul_blue_rst.png
  96. BIN
      style/assets/bul_gray.png
  97. BIN
      style/assets/bul_green.png
  98. BIN
      style/assets/bul_green_rst.png
  99. BIN
      style/assets/ios.png
  100. BIN
      style/assets/load_bullets.psd

119
index.php

@ -1,42 +1,95 @@
<?php
require_once('lib/assembler.php');
if( $CUser->Data['id'] > 1 ){
if( $CUser->Data['access'] > 5 ){
UI_PageHeaderExt(
'mojo_general.js',
array(
'rgoose_global_vars.js',
'rgoose_swupgrade.js',
'rgoose_map.js',
'mojo_reports.js',
'rgoose_devices.js',
'rgoose_cameras.js',
'rgoose_modules.js',
'mojo_monitoring.js',
'rgoose_location_editor.js',
'mojo_dashboard.js',
'rgoose_users.js',
'rgoose_logs.js',
//'rgoose_single_ipi.js',
'mojo_settings.js',
'mojo_main.js'
)
);
if( $SSL_INSTALLLED || 1 ){
if( $CUser->Data['id'] > 1 ){
if( $CUser->Data['access'] > 5 ){
UI_PageHeaderExt(
'mojo_general.js',
array(
'mojo_global_vars.js',
'rgoose_map.js',
'mojo_reports.js',
'rgoose_devices.js',
'rgoose_cameras.js',
'rgoose_modules.js',
'mojo_monitoring.js',
'rgoose_location_editor.js',
'mojo_dashboard.js',
'mojo_users.js',
'mojo_logs.js',
'mojo_metro.js',
'mojo_settings.js',
'mojo_main.js'
)
);
} else {
UI_PageHeaderExt(
'mojo_general.js',
array(
'mojo_global_vars.js',
'rgoose_map.js',
'mojo_reports.js',
'rgoose_devices.js',
'rgoose_cameras.js',
'rgoose_modules.js',
'mojo_monitoring.js',
'mojo_dashboard.js',
'mojo_settings.js',
'mojo_main.js'
)
);
};
UI_PageBottomExt();
} else {
UI_PageHeaderExt(
'mojo_general.js',
array(
'rgoose_map.js',
'rgoose_reports.js',
'rgoose_dashboard.js',
'rgoose_main.js'
)
);
UI_PageHeader();
UI_LoginForm();
UI_PageBottom();
};
UI_PageBottomExt();
} else {
$UPLOAD = false;
$VALID = false;
if( isset( $_FILES ) ){
$UPLOAD = true;
$Z = '/srv/www/web/lib/tmp/'.basename($_FILES["fcert"]["name"]);
$JUJA = $_FILES["fcert"]["tmp_name"];
$CMD = 'openssl verify -verbose -CAfile /srv/www/web/style/assets/rootCA.crt ' . $_FILES["fcert"]["tmp_name"];
$DATA = `{$CMD}`;
if( stripos( $DATA, ': OK')!== false ){
$CMD = 'openssl x509 -ext subjectAltName -noout -in ' . $_FILES["fcert"]["tmp_name"];
$DATA = `{$CMD}`;
$TArr = explode( "\n", $DATA );
if( count( $TArr ) > 1 ){
$IPS = array();
foreach( $TArr as $T ){
$CL = explode( ',', trim( $T ) );
foreach( $CL as $C ){
$PArr = explode( ':', $C );
if( stripos( $PArr[0], 'IP Address' )!== false ) $IPS[] = $PArr[1];
};
};
if( count( $IPS ) ){
foreach( $IPS as $IP ) if ( $IP == $_SERVER['HTTP_HOST'] ) $VALID = true;
if( $VALID ){
// Setup SSL
@unlink($_FILES['fcert']['tmp_name']);
} else {
$ERR = $Labels->GetLabel('_SSL_CERT_IP_NO_');
};
} else {
// No IP defined in Cert
$ERR = $Labels->GetLabel('_SSL_NO_IP_CERT_');
};
} else {
// No Extension
$ERR = $Labels->GetLabel('_SSL_NO_EXT_CERT_');
};
} else {
// CERT is invalid
$ERR = $Labels->GetLabel('_SSL_CERT_INVALID__');
};
};
UI_PageHeader();
UI_LoginForm();
UI_SSLDialog();
UI_PageBottom();
};
?>

4
lib/assembler.php

@ -17,8 +17,10 @@ if( $TT_123[0] == '4' ){
};
*/
require_once( 'php/db/SQLite_Class.php');
$DATABASE = new SQLite_DB( '/srv/samba/Mojo_Web/lib/controller/data/mysqlitedb.db');
$DATABASE = new SQLite_DB( 'lib/controller/data/mysqlitedb.db');
$str = @file_get_contents('/proc/uptime');
$num = floatval($str);

54
lib/controller/addFilter.php

@ -0,0 +1,54 @@
<?php
require_once('../ajax_asm.php');
$UID = intval($CUser->Data['id'] );
$ACCESS = intval($CUser->Data['access'] );
if( $UID > 1 && $ACCESS > 4 ){
$Data['status'] = 'nok';
$T = intval( $_POST['TYPE'] );
if( $T ){
$QS = "SELECT * FROM `target_filter_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 `target_filters` WHERE `type`={$T}";
$SS = $DATABASE->Query( $QS );
if( count( $SS ) ){
$ADE = false;
$Data['msg'] = 'This type of Target Fiter can be added only Once!';
};
};
if( $ADE ){
$QAS = "INSERT INTO `target_filters`(`type`,`aux_id`,`enabled`) VALUES({$T},0,0);";
$DATABASE->Query( $QAS );
$MID = $DATABASE->getLastInsertID();
$MCID = 0;
switch( $T ){
case 1:{
//TRAIN
$QS = "INSERT INTO `target_filter_train`(`TRAIN_DETECT`,`TRAIN_WIDTH`,`DECISION_TIME`,`SUSPECT_TIME`) VALUES(1,60000,10,20)";
$DATABASE->Query( $QS );
$MCID = $DATABASE->getLastInsertID();
$QS = "UPDATE `target_filters` 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 Target Filter Type is supplied!';
};
} else {
$Data['msg'] = 'No Target Filter Type is supplied!';
};
echo json_encode( $Data );
exit();
};
header('location: /');
?>

9
lib/controller/addModule.php

@ -52,6 +52,15 @@
$DATABASE->Query( $QS );
break;
};
case 9:{
//Modem
$QS = "INSERT INTO `module_modem`(`alarm_window`) VALUES(300)";
$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+" );

42
lib/controller/addPhoneBookRecord.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`,`call_only`,`label`) VALUES('{$NN}',1,'{$NL}')";
} else {
$QS = "INSERT INTO `module_modem_phonebook`(`number`,`call_only`,`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: /');
?>

lib/controller/zuza/checkDeviceOperation.php → lib/controller/checkDeviceOperation.php

123
lib/controller/dash/node_11.js

@ -1,96 +1,61 @@
{
id: 'db_node_%%%NODEID%%%',
//xxtype: 'panel',
xtype: 'portlet',
//columnWidth:.33,
//layout: 'fit',
width: 258,
height: %%%HEIGHT%%%+68,
layout:'vbox',
tools: [{
id:'gear',
handler: function(){
editAnalogStream( %%%STREAMID%%%, 1 );
}
}/*,{
id:'close',
handler: function(e, target, panel){
panel.ownerCt.remove(panel, true);
}
}*/],
}],
frame: true,
draggable: false,
collapsible: false,
bodyStyle: 'padding: 0px;',
plr: null,
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
items:[{
html: '<img onmouseover="ptzCtrl(\'img-%%%NODEID%%%\');" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" id="img-%%%NODEID%%%" src="%%%SELURL%%%" width="%%%WIDTH%%%" height="%%%HEIGHT%%%"/>',
},{
xtype: 'spacer',
height: 5
},{
xtype: 'button',
id: 'ptz_btn_%%%NODEID%%%',
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
text: 'PTZ Control',
enableToggle: true,
handler: function(){
var t = Ext.getCmp('db_node_%%%NODEID%%%');
if( Ext.getCmp('ptz_btn_%%%NODEID%%%').pressed ){
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop );
} else {
t.setSize( 258, %%%HEIGHT%%%+68 );
//Ext.Msg.alert('Message', 'The 270 tool was clicked.');
};
t.doLayout();
}
},{
xtype: 'spacer',
height: 3
},{
html: '<table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table>',
height: 90
html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div style="float: left; position: absolute; left: 30px; bottom: 50px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
}],
listeners:{
afterrender: function( t ){
/*
t.plr = videojs.getPlayer('hls-%%%NODEID%%%');
if( t.plr == null ){
t.plr = videojs('hls-%%%NODEID%%%',{
autoplay: 'muted',
controls: true,
controlBar: {
volumePanel: false,
playToggle: false,
pictureInPictureToggle: false
}
});
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
if( p.sukaMineWidth != adjWidth ){
p.sukaMineWidth = adjWidth;
var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX + 32 );
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.setHeight( XX );
};
};
t.plr.src({type: 'application/x-mpegURL', src: '%%%SELURL%%%'});
*/
return true;
},
destroy: function( t ){
if( t.plr != null ) t.plr.dispose();
t.plr = null;
},
afterrender: function( p ){
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx + 32 );
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.setHeight( xx );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop );
}
}
}

3
lib/controller/dash/node_13.js

@ -16,7 +16,7 @@
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div style="float: left; position: absolute; left: 30px; bottom: 50px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div style="float: left; position: absolute; left: 30px; bottom: 50px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>%%%HBTN%%%</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
}],
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
@ -56,6 +56,7 @@
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop );
%%%CAM_CTRL_HOME_BTN_BIND%%%
}
}
}

229
lib/controller/dash/node_3.js

@ -4,30 +4,46 @@
draggable: false,
collapsible: false,
tools: [{
id:'gear',
handler: function(){
//Ext.Msg.alert('Message', 'The Settings tool was clicked.');
//showSensorToolBox( %%%NODEID%%% );
id:'toggle',
handler: function( a, b, p ){
fsDrawID = %%%NODEID%%%;
fullScreen( 'div_radar_%%%NODEID%%%' );
var el = document.getElementById('draw_svg_'+fsDrawID );
var nW = Math.floor( ( window.screen.height/window.screen.width ) * 100 );
el.removeAttribute("width");
el.setAttribute( "width", nW+'%' );
}
}],
listeners:{
afterrender: function(p){
masks_statuses[%%%NODEID%%%] = 0;
masks_exist[%%%NODEID%%%] = 0;
var W=p.getWidth();
var H=9*(W/16);
p.setHeight( H + 32 );
Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 );
document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 );
Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 );
//document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 );
set2DZoomLevel( %%%NODEID%%%, 100 );
var el = document.getElementById('div_radar_%%%NODEID%%%');
el.addEventListener( "fullscreenchange", ( evt )=>{
if( document.fullscreenElement ){
} else {
if( fsDrawID ){
var el = document.getElementById('draw_svg_'+fsDrawID );
el.removeAttribute("width");
el.setAttribute( "width", '86%' );
fsDrawID = 0;
};
};
});
window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%% );
}
},
layout: 'hbox',
items:[{
id: 'cp_radar_%%%NODEID%%%',
//html: '<center><img id="draw_img_%%%NODEID%%%" src="/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100" style="cursor: crosshair;"><canvas id="targ_canvas_%%%NODEID%%%" style="display: none; cursor: crosshair;" onclick="DrawClicker( %%%NODEID%%%, event );" width="200" height="210"></canvas></center>',
//html: '<center><img id="draw_svg_%%%NODEID%%%" width="86%" src="/style/assets/draw100.svg" style="cursor: crosshair;"></center>',
//html: '<center><img id="draw_svg_%%%NODEID%%%" width="86%" src=\'data:image/svg+xml;utf8,<svg id="layer_0_%%%NODEID%%%" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="1024px" height="1024px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><circle fill="%2300A859" stroke="%23373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><line fill="none" stroke="%23FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="%23FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="%23373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="%23FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><circle id="r25_%%%NODEID%%%" fill="none" stroke="%23FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><circle id="r12_%%%NODEID%%%" fill="none" stroke="%23FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/></svg>\' style="cursor: crosshair;"/></center>',
//html: '<center><object id="draw_svg_%%%NODEID%%%" type="image/svg+xml" width="86%" data=\'data:image/svg+xml;utf8,<svg id="layer_0_%%%NODEID%%%" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="1024px" height="1024px" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><circle fill="%2300A859" stroke="%23373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><line fill="none" stroke="%23FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="%23FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="%23373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="%23FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><circle id="r25_%%%NODEID%%%" fill="none" stroke="%23FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><circle id="r12_%%%NODEID%%%" fill="none" stroke="%23FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/></svg>\' style="cursor: crosshair;"></object></center>',
html: '<center><svg id="draw_svg_%%%NODEID%%%" opacity="0.3" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="86%" height="86%" version="1.1" onclick="select2DROI( %%%NODEID%%%, event );" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd; cursor: crosshair;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><text id="g_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(0,35,35)" x="35" y="35" fill="#FFF212" style="font: 30px sans-serif">100 m.</text><circle fill="#00A859" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,245,245)" x="245" y="245" fill="#FFF212" style="font: 10px sans-serif">12.5</text><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/></svg></center>',
html: '<div id="div_radar_%%%NODEID%%%" style="display: block; padding: 5px; width: \'100%\'; height: \'100%\';"><center><svg id="draw_svg_%%%NODEID%%%" opacity="0.3" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="86%" version="1.1" onclick="select2DROI( %%%NODEID%%%, event );" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd; cursor: crosshair;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><text id="g_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(0,35,35)" x="35" y="35" fill="#FFF212" style="font: 30px sans-serif">100 m.</text><circle fill="#00A859" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,245,245)" x="245" y="245" fill="#FFF212" style="font: 10px sans-serif">12.5</text><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/></svg></center></div>',
width: '56%'
},{
frame: false,
@ -37,32 +53,215 @@
xtype: 'button',
id: 'cp_clear_btn_%%%NODEID%%%',
width: '100%',
text: 'Clear Allerts'
disabled: true,
text: 'Clear Alarm',
iconCls: 'ctrl_panel_clean_sm',
iconAlign: 'left',
handler: function(){
doDeviceOperation( %%%NODEID%%%, 125,'', true );
}
},{
xtype: 'spacer',
height: 6
height: 3
},{
xtype: 'button',
id: 'cp_draw_btn_%%%NODEID%%%',
width: '100%',
text: 'Draw Background',
iconCls: 'ctrl_panel_drawscan_sm',
iconAlign: 'left',
disabled: true,
handler: function(){
doDeviceOperation( %%%NODEID%%%, 3,'', true );
}
},{
xtype: 'spacer',
height: 6
height: 3
},{
xtype: 'button',
id: 'cp_study_btn_%%%NODEID%%%',
width: '100%',
text: 'Study Background',
iconCls: 'ctrl_panel_study_sm',
iconAlign: 'left',
disabled: true,
handler: function(){
doDeviceOperation( %%%NODEID%%%, 2,'', true );
}
}]
},{
xtype: 'spacer',
height: 3
},{
xtype: 'panel',
title: 'Masking Management',
height: 145,
frame: true,
flex: 1,
layout: 'vbox',
items:[{
xtype: 'button',
text: 'Mask Editor',
id: 'DMED_%%%NODEID%%%',
width: '100%',
disabled: true,
handler: function(){
showMaskEditor( false, 0, %%%NODEID%%% );
}
},{
xtype: 'spacer',
height: 3
},{
xtype: 'panel',
id: 'DMEBB_%%%NODEID%%%',
frame: true,
border: false,
flex: 1,
width: '100%',
height: 53,
layout: 'hbox',
items:[{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',//scale: 'small',
id: 'mz_btn_%%%NODEID%%%_0',
iconCls: 'mask_zone1_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_0').pressed){
doMaskOperation( %%%NODEID%%%, 1, 0 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 0 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',
id: 'mz_btn_%%%NODEID%%%_1',
iconCls: 'mask_zone2_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_1').pressed){
doMaskOperation( %%%NODEID%%%, 1, 1 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 1 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '19%',
scale: 'medium',//scale: 'large',
id: 'mz_btn_%%%NODEID%%%_2',
iconCls: 'mask_zone3_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_2').pressed){
doMaskOperation( %%%NODEID%%%, 1, 2 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 2 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',//scale: 'large',
id: 'mz_btn_%%%NODEID%%%_3',
iconCls: 'mask_zone4_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_3').pressed){
doMaskOperation( %%%NODEID%%%, 1, 3 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 3 );
};
}
},{
xtype: 'button',
enableToggle: true,
width: '20%',
scale: 'medium',//scale: 'large',
id: 'mz_btn_%%%NODEID%%%_4',
iconCls: 'mask_zone5_btn',
iconAlign: 'top',
pressed: false,
disabled: true,
handler: function(){
if( Ext.getCmp('mz_btn_%%%NODEID%%%_4').pressed){
doMaskOperation( %%%NODEID%%%, 1, 4 );
} else {
doMaskOperation( %%%NODEID%%%, 0, 4 );
};
}
}]
}]
},{
xtype: 'spacer',
height: 3
}/*,{
xtype: 'panel',
title: 'Detection Sensitivity',
height: 95,
frame: true,
flex: 1,
layout: 'hbox',
items:[{
xtype: 'button',
text: 'Factory',
id: 'DDSPBTN0',
width: 80,
iconCls: 'detection_btn_factory',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
},{
xtype: 'button',
text: 'Low',
id: 'DDSPBTN1',
width: 80,
iconCls: 'detection_btn_low',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
},{
xtype: 'button',
text: 'Meduim',
id: 'DDSPBTN2',
width: 80,
iconCls: 'detection_btn_medium',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
},{
xtype: 'button',
text: 'High',
id: 'DDSPBTN3',
width: 80,
iconCls: 'detection_btn_high',
enableToggle: true,
toggleGroup: 'det_sens_btn_grp',
disabled: true,
scale: 'large',
iconAlign: 'top'
}]
}*/]
}],
bbar:[{
xtype: 'button',

BIN
lib/controller/data/factory.db

Binary file not shown.

BIN
lib/controller/data/mysqlitedb.db

Binary file not shown.

BIN
lib/controller/data/reports.db

Binary file not shown.

2
lib/controller/data/server.log

@ -1 +1 @@
/srv/samba/dr_frucht/Projects/argus/Debug/server.log
/srv/mojo/server.log

12
lib/controller/doApplicationOperation.php

@ -12,7 +12,7 @@
switch( $CMD ){
case 1:{//Debug Mode
$PARAM = intval( $_POST['OPCODE'] );
$QS = "UPDATE `system_props` SET `working_mode`={$PARAM}";
$QS = "UPDATE `system_props` SET `work_mode`={$PARAM} WHERE `id`=1";
$DATABASE->Query( $QS );
$Data['q'] = $QS;
$Data['success'] = true;
@ -20,12 +20,20 @@
};
case 2:{//Layout
$PARAM = intval( $_POST['OPCODE'] );
$QS = "UPDATE `system_props` SET `app_layout`={$PARAM}";
$QS = "UPDATE `system_props` SET `app_layout`={$PARAM} WHERE `id`=1";
$DATABASE->Query( $QS );
$Data['q'] = $QS;
$Data['success'] = true;
break;
};
case 3:{
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
$PARAM = md5( time() );
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES(1,249,0,'{$PARAM}')";
$RBASE->Query( $QS, false );
$Data['q'] = $QS;
$Data['success'] = true;
};
};
} else {
$Data['msg']='Wrong Parameters!';

130
lib/controller/doCameraOperation.php

@ -52,21 +52,26 @@
break;
};
case 3:{
// Checkup Onvif Camera By IP
// Checkup Onvif Camera Credentials
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}";
if( $CameraID ){ // Cam From DB
$QS ="SELECT `ip`,`port` FROM `cameras` WHERE `id`={$CameraID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$IP = $JJ[0]['ip'];
$onvif->setIPAddress( $IP );
$PORT = intval($JJ[0]['port']);
if( $PORT ){
$onvif->setIPAddress( $IP.':'.$PORT );
} else {
$onvif->setIPAddress( $IP );
};
} else $CameraID = 0;
} else {
} else { // Direct IP
$IP = $DATABASE->escape( $_POST['IP'] );
$onvif->setIPAddress( $IP );
$RR = $onvif->discover();
@ -75,7 +80,7 @@
if(isset($R['EndpointReference'])){
if(isset($R['EndpointReference']['Address'])){
$TArr = explode( ':', $R['EndpointReference']['Address'] );
$CA = $DATABASE->escape( $TArr[2] );
$CA = $DATABASE->escape( $TArr[1] );
$TArr = explode( ' ', $R['Scopes']);
$CM = '';
$CI = $DATABASE->escape($R['IPAddr']);
@ -97,7 +102,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) VALUES('{$CH}','{$CN}','{$CA}','{$CM}','{$CI}',0,'{$CP}',1) ON CONFLICT( uuid ) DO UPDATE SET ip='{$CI}', online=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";
$DATABASE->Query($QS,false);
$CameraID = $DATABASE->getLastInsertID();
if( $CameraID == 0 ){
@ -139,12 +144,12 @@
$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;
case 'rtsp': $mrl_port = 554; break;
case 'http': $mrl_port = 80; break;
case 'https': $mrl_port = 443; break;
};
};
$Emrl = $DATABASE->escape( $mrl );
$Emrl = $DATABASE->escape( $mrl );
$Emrl = str_replace( $mrl_proto . '://' . $IP . ':' . $mrl_port, '', $Emrl );
$Emrl = str_replace( $mrl_proto . '://' . $IP, '', $Emrl );
$TPArr = explode(':',$pic );
@ -237,6 +242,58 @@
};
break;
};
case 9:{
// Checkup Onvif Camera Credentials
require_once('../php/onvif/toto.php');
$onvif = new Ponvif();
$QS ="SELECT `ip`,`port`, `access_login`, `access_pass`, `auth_mode`, `ptz_token`, `home_token` FROM `cameras` WHERE `id`={$CameraID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$IP = $JJ[0]['ip'];
$PORT = intval($JJ[0]['port']);
$EUser = $JJ[0]['access_login'];
$EPass = $JJ[0]['access_pass'];
$AUTH = intval($JJ[0]['auth_mode']);
try {
$Data['status'] = 'try';
if( $PORT ){
$onvif->setIPAddress( $IP.':'.$PORT );
} else {
$onvif->setIPAddress( $IP );
};
$onvif->setUsername( $EUser );
$onvif->setPassword( $EPass );
$onvif->setAuthMethod( $AUTH );
$onvif->initialize();
if ( !$onvif->isFault( $devices = $onvif->getSources())){
$TK = '';
$Data['status'] = 'notoken';
foreach( $devices[0] as $source ) if( is_array( $source ) ){
$TK = $source['profiletoken'];
break;
};
if( $TK == '' ) break;
$Data['token'] = $TK;
$HTK = $JJ[0]['home_token'];
if( $HTK!='' ){
$onvif->ptz_RemovePreset( $TK, $HTK );
};
$HTK = '26';//md5(time());
$onvif->ptz_SetPreset( $TK, $HTK );
$QS = "UPDATE `cameras` SET `home_token` = '{$HTK}' WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok';
} else {
$Data['msg'] = 'OnVif Query Device Fault!';
}
} catch( Exception $e ){
$Data['msg'] = 'Provided Credentials are Wrong! ['.$EUser.']:['.$EPass.']';
};
} else {
$Data['status'] = 'nocam';
};
break;
};
case 10:{
$OP = intval( $_POST['OPID'] );
switch( $OP ){
@ -290,8 +347,11 @@
break;
};
case 6:{
$QS = "SELECT `id` FROM `uart_settings`";
$JUJA = $DATABASE->Query( $QS );
$Param = intval( $_POST['OPCODE'] );
$QS = "UPDATE `cameras` SET `uart_id`={$Param} WHERE `id`={$CameraID}";
$RID = intval($JUJA[$Param]['id']);
$QS = "UPDATE `cameras` SET `uart_id`={$RID} WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok-6';
break;
@ -345,6 +405,52 @@
$Data['status'] = 'ok-13';
break;
};
case 14:{
$Param = floatval( $_POST['OPCODE'] );
$QS = "UPDATE `cameras` SET `x_rot`={$Param} WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok-14';
break;
};
case 15:{
$Param = floatval( $_POST['OPCODE'] );
$QS = "UPDATE `cameras` SET `y_rot`={$Param} WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok-15';
break;
};
case 16:{
$Param = floatval( $_POST['OPCODE'] );
$QS = "UPDATE `cameras` SET `z_rot`={$Param} WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok-16';
break;
};
case 17:{
$Param = intval( $_POST['OPCODE'] );
$QS = "UPDATE `cameras` SET `manual`={$Param} WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok-17';
break;
};
case 18:{
$Param = intval( $_POST['OPCODE'] );
if( $Param ){
$QS = "UPDATE `cameras` SET `homing_enable`=1 WHERE `id`={$CameraID}";
} else {
$QS = "UPDATE `cameras` SET `homing_enable`=0 WHERE `id`={$CameraID}";
};
$DATABASE->Query( $QS );
$Data['status'] = 'ok-18';
break;
};
case 19:{
$Param = intval( $_POST['OPCODE'] );
$QS = "UPDATE `cameras` SET `homing_to`={$Param} WHERE `id`={$CameraID}";
$DATABASE->Query( $QS );
$Data['status'] = 'ok-19';
break;
};
};
break;
};

98
lib/controller/doFilterOperation.php

@ -0,0 +1,98 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
$Data['success'] = false;
if( isset( $_POST['FID'] ) ) {
$FID = intval($_POST['FID']);
} else $FID = 0;
if( isset( $_POST['OPID'] ) ){
$CMD = intval( $_POST['OPID'] );
} else {
$CMD = 0;
};
if( isset( $_POST['OPCODE'] ) ){
$OPCODE = intval( $_POST['OPCODE'] );
} else {
$OPCODE = 0;
};
if( $FID > 0 && $CMD > 0 ){
$QS = "SELECT * FROM `target_filters` WHERE `id`={$FID}";
$TT = $DATABASE->Query( $QS );
$Data['success'] = true;
if( count( $TT ) ){
$JJ = $TT[0];
switch( $JJ['type'] ){
case 1:{//Train
switch( $CMD ){
case 1: {
$QS = "UPDATE `lrf_sensors` SET `filter_id` = 0 WHERE `filter_id` = {$FID}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `target_filter_train` WHERE `id`={$JJ['aux_id']}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `target_filters` WHERE `id`={$FID}";
break;
};
case 2: $QS = "UPDATE `target_filters` SET `enabled`={$OPCODE} WHERE `id`={$FID}"; break;
case 3:{
if( $OPCODE ){
$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$OPCODE}";
$R = $DATABASE->Query( $QS );
$SID = $R[0]['aux_id'];
$QS = "UPDATE `lrf_sensors` SET `filter_id`={$FID} WHERE `id`={$SID}";
$DATABASE->Query( $QS );
};
$QS = "UPDATE `target_filter_train` SET `UPPER_SENSOR`={$OPCODE} WHERE `id`={$JJ['aux_id']}";
break;
};
case 4:{
if( $OPCODE ){
$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$OPCODE}";
$R = $DATABASE->Query( $QS );
$SID = $R[0]['aux_id'];
$QS = "UPDATE `lrf_sensors` SET `filter_id`={$FID} WHERE `id`={$SID}";
$DATABASE->Query( $QS );
};
$QS = "UPDATE `target_filter_train` SET `LOWER_SENSOR`={$OPCODE} WHERE `id`={$JJ['aux_id']}";
break;
};
case 5: $QS = "UPDATE `target_filter_train` SET `TRAIN_DETECT`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 6: $QS = "UPDATE `target_filter_train` SET `TRAIN_WIDTH`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 7: $QS = "UPDATE `target_filter_train` SET `DECISION_TIME`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 8: $QS = "UPDATE `target_filter_train` SET `SUSPECT_TIME`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 9:{
if( isset( $_POST['DTR'] ) ) $DTR=intval( $_POST['DTR'] ); else $DTR = 0;
if( isset( $_POST['DTM'] ) ) $DTM=intval( $_POST['DTM'] ); else $DTM = 0;
if( isset( $_POST['STM'] ) ) $STM=intval( $_POST['STM'] ); else $STM = 0;
if( isset( $_POST['TTR'] ) ) $TTR=intval( $_POST['TTR'] ); else $TTR = 0;
if( isset( $_POST['WIZ'] ) ) $WIZ=intval( $_POST['WIZ'] ); else $WIZ = 0;
if( isset( $_POST['DBG'] ) ) $DBG=intval( $_POST['DBG'] ); else $DBG = 0;
$QS = "UPDATE `target_filter_train` SET `TRAIN_DETECT`={$DTR},`TRAIN_WIDTH`={$WIZ},`DECISION_TIME`={$DTM},`SUSPECT_TIME`={$STM},`TRACK_TRAIN`={$TTR},`DEBUG`={$DBG} WHERE `id`={$JJ['aux_id']}";
break;
};
};
break;
};
case 2:{//AFP
switch( $CMD ){
case 1: {
$QS = "UPDATE `lrf_sensors` SET `filter_id` = 0 WHERE `filter_id` = {$FID}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `target_filters` WHERE `id`={$FID}";
break;
};
};
break;
};
};
$DATABASE->Query( $QS, false );
$Data['query'] = $QS;
};
} else {
$Data['msg']='Wrong Parameters';
};
echo json_encode( $Data );
exit();
};
header('location: /');
?>

114
lib/controller/doMaskOperation.php

@ -0,0 +1,114 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
$Data['status'] = 'na';
if( isset( $_POST['CMD'] ) ){
$CMD = intval( $_POST['CMD'] );
} else $CMD = 0;
if( isset( $_POST['NID'] ) ) {
$NodeID = intval($_POST['NID']);
} else $NodeID = 0;
if( $NodeID ){
$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$NodeID}";
$JJ = $DATABASE->Query( $QS );
$SenID = $JJ[0]['aux_id'];
switch( $CMD ){
case 0:{
if( isset( $_POST['MID'] ) ){
$MID = intval( $_POST['MID'] );
} else {
$MID = 0;
};
if( isset( $_POST['LID'] ) ){
$LID = intval( $_POST['LID'] );
} else {
$LID = 0;
};
$QS = "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`={$SenID} AND `lrf_id`={$LID} AND `layer`={$MID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$CID = $JJ[0]['id'];
$QS = "UPDATE `lrf_masks` SET `status`='D' WHERE `id`={$CID}";
$DATABASE->Query( $QS );
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
$Data['success'] = true;
$Data['status'] = 'ok';
$CMD = 70+$MID;
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'')";
$Data['query'] = $QS;
$RBASE->Query( $QS, false );
$Data['operation_id'] = intval( $RBASE->getLastInsertID() );
};
break;
};
case 1:{
if( isset( $_POST['MID'] ) ){
$MID = intval( $_POST['MID'] );
} else {
$MID = 0;
};
if( isset( $_POST['LID'] ) ){
$LID = intval( $_POST['LID'] );
} else {
$LID = 0;
};
$QS = "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`={$SenID} AND `lrf_id`={$LID} AND `layer`={$MID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$CID = $JJ[0]['id'];
$QS = "UPDATE `lrf_masks` SET `status`='E' WHERE `id`={$CID}";
$DATABASE->Query( $QS );
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
$Data['success'] = true;
$Data['status'] = 'ok';
$CMD = 65+$MID;
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'')";
$Data['query'] = $QS;
$RBASE->Query( $QS, false );
$Data['operation_id'] = intval( $RBASE->getLastInsertID() );
};
break;
};
case 3:{
if( isset( $_POST['MID'] ) ){
$MID = intval( $_POST['MID'] );
} else {
$MID = 0;
};
if( isset( $_POST['LID'] ) ){
$LID = intval( $_POST['LID'] );
} else {
$LID = 0;
};
$QS = "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`={$SenID} AND `lrf_id`={$LID} AND `layer`={$MID}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ){
$CID = $JJ[0]['id'];
$QS = "SELECT `id` FROM `lrf_mask_vertexes` WHERE `mask_id`={$CID}";
$JJ = $DATABASE->Query( $QS );
foreach( $JJ as $J ){
$QS = "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$J['id']}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `lrf_mask_vertexes` WHERE `id`={$J['id']}";
$DATABASE->Query( $QS );
};
$QS = "DELETE FROM `lrf_masks` WHERE `id`={$CID}";
$DATABASE->Query( $QS );
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
$Data['success'] = true;
$Data['status'] = 'ok';
$CMD = 75+$MID;
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$NodeID},{$CMD},0,'')";
$Data['query'] = $QS;
$RBASE->Query( $QS, false );
$Data['operation_id'] = intval( $RBASE->getLastInsertID() );
};
};
};
};
echo json_encode( $Data );
} else {
header('location: /');
};
?>

136
lib/controller/doSensorOperation.php

@ -67,6 +67,142 @@
};
break;
};
case 7:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 2 ){
$QS = "UPDATE `lrf_ini_settings` SET `AUTORESET_ENABLE`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 8:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 65535 ){
$QS = "UPDATE `lrf_ini_settings` SET `AUTORESET_INTERLEAVE`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 9:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 65535 ){
$QS = "UPDATE `lrf_ini_settings` SET `AUTORESET_TIMEOUT`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 10:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 6001 ){
$QS = "UPDATE `lrf_ini_settings` SET `BOARD_ZEROSHIFT`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 11:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 65535 ){
$QS = "UPDATE `lrf_ini_settings` SET `BOARD_TEMPERATURE`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 12:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 13 ){
$SPEEDS = array( 2, 4, 6, 8, 10, 12 );
$VAL = $SPEEDS[$OPCODE] / 1;
$QS = "UPDATE `lrf_ini_settings` SET `BOARD_SPEED`={$VAL} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 13:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 65535 ){
$QS = "UPDATE `lrf_ini_settings` SET `NO_BLACK_TARGETS`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 14:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 65535 ){
$QS = "UPDATE `lrf_ini_settings` SET `JUST_MOVING_TARGETS`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 15:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 2 ){
$QS = "UPDATE `lrf_ini_settings` SET `JUST_MOVING_RADIAL`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 16:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 2 ){
$QS = "UPDATE `lrf_ini_settings` SET `JUST_MOVING_DISTANCE`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 17:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 2 ){
$QS = "UPDATE `lrf_ini_settings` SET `FREEZ_FIRST_TH`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 18:{
$OPCODE = intval( $_POST['OPCODE'] );
if( $OPCODE < 2 ){
$QS = "UPDATE `lrf_ini_settings` SET `SAVE_FIRST_TH`={$OPCODE} WHERE `sensor_id`={$SNID}";
$Data['success'] = true;
};
break;
};
case 19:{
if( isset( $_POST['LRF'] ) ) $LRF = intval( $_POST['LRF'] ); else $LRF = 0;
if( isset( $_POST['PID'] ) ) $PID = intval( $_POST['PID'] ); else $PID = 0;
$ORD = intval( $_POST['ORD'] );
$OFF = intval( $_POST['OFF'] );
$SST = intval( $_POST['SST'] );
$FLI = intval( $_POST['FLI'] );
$SUN = intval( $_POST['SUN'] );
$WIZ = intval( $_POST['WIZ'] );
$DEL = intval( $_POST['DEL'] );
$QS = "UPDATE `lrf_detection_profiles` SET `order`={$ORD},`offset`={$OFF},`delta`={$DEL},`flip`={$FLI},`width`={$WIZ},`sst`={$SST},`sun`={$SUN} WHERE `aux_id`={$SNID} AND `profile_id`={$PID} AND `lrf_id`={$LRF} AND `master`=1";
$DATABASE->Query( $QS, false );
//Parameter Send to device
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$CN['id']},131,0,'')";
$RBASE->Query( $QS, false );
$QS='';
break;
};
case 20:{
$RBASE = new SQLite_DB( '/dev/shm/argus/mem_db.db');
$QS = "INSERT INTO `nodes_qcq`(`node_id`,`cmd`,`status`,`parameter`) VALUES({$CN['id']},130,0,'')";
$RBASE->Query( $QS, false );
$QS ='';
break;
};
case 255:{
// Delete Sensor
$NID = $CN['id'];
$QS = "DELETE FROM `nodes` WHERE `id`={$NID}";
$DATABASE->Query( $QS, false );
$QS = "DELETE FROM `resources` WHERE `node_id`={$NID}";
$DATABASE->Query( $QS, false );
$QS = "DELETE FROM `lrf_sensors` WHERE `id`={$SNID}";
$DATABASE->Query( $QS, false );
$QS = "";
$Data['success'] = true;
};
};
if( $QS != '' ) $DATABASE->Query( $QS, false );
$Data['query'] = $QS;

168
lib/controller/getCameraEditor.php

@ -1,4 +1,4 @@
<?php
<?php
require_once('../ajax_asm.php');
ob_start();
$UID = intval( $CUser->Data['id'] );
@ -25,7 +25,7 @@
$CLS = "camera_dahua_set";
} elseif( stripos( $Cam['name'], 'axis' ) !== false ){
$CLS = "camera_axis_set";
} elseif( stripos( $Cam['name'], 'GF0' ) !== false ){
} elseif( stripos( $Cam['name'], 'General' ) !== false ){
$CLS = "cam_vehicle_set";
} else {
$CLS = "camera_generic_set";
@ -259,13 +259,14 @@ ZUZAKA;
}]
}
CHUPAKABRA;
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$MODULE_DATA = $S[0];
//$QS="SELECT * FROM `module_eve` WHERE `id`=1";
//$S=$DATABASE->Query( $QS );
//$MODULE_DATA = $S[0];
if( $Cam['status'] < 3 ){
$FU = "/lib/controller/getCameraPreview.php?UID={$CUser->Data['id']}&SID={$Session}&FID=";
} else {
$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id=';
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id=';
$FU = '/video_feed/stream?id=';
};
$TPL_CAM_EDITOR=<<<PZAKSJEJSDKGJHGASD
{
@ -287,6 +288,28 @@ CHUPAKABRA;
},{
xtype: 'panel',
html: '<div class="sideInfo_item" id="INFO_ON"><b>{$Cam['ip']}</b><br/>{$Cam['name']}<br/>{$Cam['hardware']}</div>'
},{
xtype: 'form',
labelWidth: 200,
border: false,
frame: false,
labelAlign: 'right',
items:[{
xtype: 'checkbox',
id: 'cam_manassign',
fieldLabel: 'Static Connection',
width: 200,
checked: {$Cam['manual']},
listeners:{
check: function( a, c ){
if( c ){
doCamOperation( {$CID}, 17, 1 );
} else {
doCamOperation( {$CID}, 17, 0 );
};
}
}
}]
}{$RESET_CREDENTIALS}]
},{
title: '{$Labels->GetLabel('_STREAMS_')}',
@ -767,9 +790,9 @@ CHUPAKABRA;
xtype: 'checkbox',
id: 'ptz_axel_c',
disabled: ({$Cam['protocol']} == 0),
checked: ({$Cam['ptz_axel']} < 5 ),
checked: ({$Cam['ptz_axel']} < 6 ),
listeners:{
change: function( a, c, b ){
check: function( a, c ){
if( c ){
doCamOperation( {$CID}, 13, 0 );
var zz = Ext.getCmp('ptz_axel');
@ -796,7 +819,7 @@ CHUPAKABRA;
},{
xtype: 'slider',
id: 'ptz_axel',
disabled: (({$Cam['protocol']} == 0)||({$Cam['ptz_axel']} < 5)),
disabled: (({$Cam['protocol']} == 0)||({$Cam['ptz_axel']} < 6)),
minValue: 5,
maxValue: 20,
value: {$Cam['ptz_axel']},
@ -810,6 +833,84 @@ CHUPAKABRA;
},{
id: 'ptz_axel_d',
html: '<p>X&nbsp;'+ {$Cam['ptz_axel']} + '</p>'
},{
html: '<table ><tr><td>Axis Rotation</td><td><img width="32" src="/style/wicons/rotate-axis-x-512.png"></td></tr></table>'
},{
xtype: 'numberfield',
decimalPrecision: 3,
value: {$Cam['x_rot']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 14, c );
}
}
},{
html: '&nbsp;'
},{
html: '<table ><tr><td>Axis Rotation</td><td><img width="32" src="/style/wicons/rotate-axis-y-512.png"></td></tr></table>'
},{
xtype: 'numberfield',
decimalPrecision: 3,
value: {$Cam['y_rot']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 15, c );
}
}
},{
html: '&nbsp;'
},{
html: '<table ><tr><td>Axis Rotation</td><td><img width="32" src="/style/wicons/rotate-axis-z-512.png"></td></tr></table>'
},{
xtype: 'numberfield',
decimalPrecision: 3,
value: {$Cam['z_rot']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 16, c );
}
}
},{
html: '&nbsp;'
},{
html: '<table ><tr><td>Δ from Anchor</td><td><img width="32" src="/style/wicons/rotate-position-x-512.png"></td></tr></table>'
},{
xtype: 'numberfield',
decimalPrecision: 3,
value: {$Cam['x']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 17, c );
}
}
},{
html: '&nbsp;'
},{
html: '<table ><tr><td>Δ from Anchor</td><td><img width="32" src="/style/wicons/rotate-position-y-512.png"></td></tr></table>'
},{
xtype: 'numberfield',
decimalPrecision: 3,
value: {$Cam['y']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 18, c );
}
}
},{
html: '&nbsp;'
},{
html: '<table ><tr><td>Δ from Anchor</td><td><img width="32" src="/style/wicons/rotate-position-z-512.png"></td></tr></table>'
},{
xtype: 'numberfield',
decimalPrecision: 3,
value: {$Cam['z']},
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 19, c );
}
}
},{
html: '&nbsp;'
}]
}]
},{
@ -858,6 +959,55 @@ CHUPAKABRA;
doCamOperation( {$CID}, 12, b );
}
}
},{
xtype: 'spacer'
},{
width: 200,
html: 'Enable Automatic Home Return'
},{
xtype: 'checkbox',
id: 'cam_horeten',
fieldLabel: '',
width: 200,
checked: {$Cam['homing_enable']},
listeners:{
check: function( a, c ){
if( c ){
doCamOperation( {$CID}, 18, 1 );
} else {
doCamOperation( {$CID}, 18, 0 );
};
}
}
},{
xtype: 'spacer'
},{
width: 200,
html: 'Time After Alarm'
},{
xtype: 'numberfield',
id: 'cam_horetto',
width: 200,
value: '{$Cam['homing_to']}',
listeners:{
change: function( a, c, b ){
doCamOperation( {$CID}, 19, c );
}
}
},{
xtype: 'spacer'
},{
width: 200,
html: 'Home Preset Token'
},{
xtype: 'textfield',
id: 'cam_horettk',
fieldLabel: '',
width: 200,
value: '{$Cam['home_token']}',
readOnly: true
},{
xtype: 'spacer'
}]
}]
}]

8
lib/controller/getCameraPreview.php

@ -37,10 +37,12 @@
$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'];
//$URL = $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_HTTPAUTH, CURLAUTH_DIGEST );
curl_setopt($soap_do, CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
curl_setopt($soap_do, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($soap_do, CURLOPT_RETURNTRANSFER, true );
curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, false);
@ -68,8 +70,8 @@
};
};
} else {
//echo "\n\nNores!";
loadNotPicture( $AUX );
//echo "\n\nNores!";
loadNotPicture( $AUX );
};
exit();
};

154
lib/controller/getDashBoardItems.php

@ -53,11 +53,45 @@
}
}
jodjhowierewt;
$LOGIO=<<<kahkjahskfgkgkh
{
xtype: 'grid',
id: 'log_grid',
border: false,
frame: false,
autoScroll: true,
//width: '100%',
lazyRender: true,
height: 210,
ds: log_store,
cm: new Ext.grid.ColumnModel( log_ColModel_ops ),
sm: new Ext.grid.RowSelectionModel( log_SelModel_ops ),
viewConfig: {
forceFit: true,
getRowClass: function( record, rowIndex, rowParams, store){
switch( record.get('node_id')%5 ){
case 0: return 'row-level01';
case 1: return 'row-level02';
case 2: return 'row-level03';
case 3: return 'row-level04';
case 4: return 'row-level05';
};
return '';
}
},
listeners:{
afterrender : function( t ){
var papa = Ext.getCmp('main_portal');
var jj = papa.getComponent( 0 ).getHeight();
t.setHeight( PanelH - jj - 20 );
}
}
}
kahkjahskfgkgkh;
$DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
$DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
$DUMMY['log']="{xtype:'panel', title: 'Log Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO LOG'}";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Event Log', frame: true, /*height: 200,*/ border: true, draggable: false, items:[{$LOGIO}] }";
} else {
$DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
@ -87,6 +121,8 @@ jodjhowierewt;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''. urldecode( $DD['name'] ), $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$OUT[]= $STA[$idx] . $TPL . $END;
} else break;
$idx++;
@ -112,18 +148,38 @@ jodjhowierewt;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode( $DD['name'] ) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
$Z=$DATABASE->Query( $QS );
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$MODULE_DATA = $S[0];
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
if( $DD['type'] == 13 || $DD['type'] == 11 ){
$QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
$JUA = $DATABASE->Query( $QS );
$CAMDATA = $JUA[0];
if( $CAMDATA['homing_enable'] ){
if( $CUser->Data['access'] > 5 ){
$TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
};
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
$W = 244;
@ -177,6 +233,8 @@ jodjhowierewt;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$OUT[]= $STA[$idx] . $TPL . $END;
} else break;
$idx++;
@ -201,19 +259,39 @@ jodjhowierewt;
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.$DD['name'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
$Z=$DATABASE->Query( $QS );
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$MODULE_DATA = $S[0];
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
if( $DD['type'] == 13 || $DD['type'] == 11 ){
$QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
$JUA = $DATABASE->Query( $QS );
$CAMDATA = $JUA[0];
if( $CAMDATA['homing_enable'] ){
if( $CUser->Data['access'] > 5 ){
$TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
};
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
$W = 244;
@ -225,8 +303,8 @@ jodjhowierewt;
} else break;
$idx++;
};
if( $idx < 2 ){
for( ;$idx<2;$idx++ ){
if( $idx < 1 ){
for( ;$idx<1;$idx++ ){
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
$OUT[]= $STA[2+$idx] . $T . $END;
};
@ -268,6 +346,8 @@ jodjhowierewt;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$OUT[]= $STA[$idx] . $TPL . $END;
} else break;
$idx++;
@ -292,19 +372,39 @@ jodjhowierewt;
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.$DD['name'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
$Z=$DATABASE->Query( $QS );
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$MODULE_DATA = $S[0];
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
if( $DD['type'] == 13 || $DD['type'] == 11 ){
$QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
$JUA = $DATABASE->Query( $QS );
$CAMDATA = $JUA[0];
if( $CAMDATA['homing_enable'] ){
if( $CUser->Data['access'] > 5 ){
$TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
};
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
$W = 244;
@ -347,6 +447,8 @@ jodjhowierewt;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$OUT[]= $STA[$idx] . $TPL . $END;
} else break;
$idx++;
@ -366,19 +468,39 @@ jodjhowierewt;
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.$DD['name'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
$TPL = str_replace('%%%USERID%%%', $UserID, $TPL );
$TPL = str_replace('%%%SESSION%%%', $Session, $TPL );
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
$Z=$DATABASE->Query( $QS );
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$MODULE_DATA = $S[0];
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $R['aux_parameter'], $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
if( $DD['type'] == 13 || $DD['type'] == 11 ){
$QS = "SELECT `homing_enable` FROM `cameras` WHERE `id`={$DD['aux_id']}";
$JUA = $DATABASE->Query( $QS );
$CAMDATA = $JUA[0];
if( $CAMDATA['homing_enable'] ){
if( $CUser->Data['access'] > 5 ){
$TPL = str_replace( '%%%HBTN%%%', '<img id="img_btn_0ZZ_'.$DD['aux_id'].'" class="ptz_ctrl_btn" src="/style/png/building/038.png">', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', 'document.getElementById(\'img_btn_0ZZ_'.$DD['aux_id'].'\').addEventListener( \'mousedown\', makePtzHome );', $TPL );
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
} else {
$TPL = str_replace('%%%HBTN%%%', '&nbsp;', $TPL );
$TPL = str_replace('%%%CAM_CTRL_HOME_BTN_BIND%%%', '', $TPL );
};
};
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
$W = 244;
@ -396,7 +518,7 @@ jodjhowierewt;
$OUT[]= $STA[1+$idx] . $T . $END;
};
};
$OUT[]= $STA[2] . $DUMMY['log'] .','. $DUMMY['map'] . $END;
$OUT[]= $STA[2] . $DUMMY['log'] . /*','. $DUMMY['map'].*/ $END;
break;
};
case 4:

lib/controller/zuza/getDetectionProfile.php → lib/controller/getDetectionProfile.php

6
lib/controller/getDeviceDraw.php

@ -7,9 +7,9 @@
if( $NID ){
$QS="SELECT `data` FROM `lrf_draw` WHERE `node_id`={$NID} AND `type`=0 ORDER BY `ts` DESC LIMIT 1";
$SS = $DATABASE->Query( $QS );
$Data['count'] = 0;
if( count( $SS ) ){
$DUDU= $SS[0]['data'];
$Data['count'] = 0;
$FD = fopen( 'data/device_draws/' . $DUDU.'.raw', "r" );
if( $FD ){
$C = fread( $FD, 4 );
@ -29,9 +29,9 @@
};
fclose( $FD );
};
echo json_encode( $Data );
exit();
};
echo json_encode( $Data );
exit();
};
};
};

25
lib/controller/getDeviceFiles.php

@ -0,0 +1,25 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$AID = intval($_POST['DID']);
$Data['files']=array();
$QS = "SELECT * FROM `lrf_uploads` WHERE `sensor_id`={$AID} ORDER BY `ts` DESC";
$result = $DATABASE->Query( $QS, false );
if( count($result) ){
foreach( $result as $R ){
$CN = array();
$CN['id'] = intval( $R['id'] );
$CN['file_name'] = $R['file'];
$CN['size'] = intval( filesize( 'data/uploads/'.$R['md5'] ) );
$CN['status'] = intval($R['status']) + (($R['issue_reset'])?512:0);
$CN['ts'] = date( "Y-m-d H:i:s", $R['ts'] );
$CN['memo'] = ($R['memo']?$R['memo']:'');
$Data['files'][] = array( intval( $R['id'] ), $R['file'], $CN['size'], (intval($R['status']) + (($R['issue_reset'])?512:0)), date( "Y-m-d H:i:s", $R['ts'] ), ($R['memo']?$R['memo']:'') );
};
};
echo json_encode( $Data );
exit();
};
header('location: /');
?>

3
lib/controller/getDeviceMask.php

@ -2,7 +2,6 @@
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$NodeID = intval($_POST['NID']);
$SiteID = intval($_POST['SITE']);
$LayerID = intval($_POST['MID']);
$LRFID = intval($_POST['LID']);
$QS = "SELECT * FROM nodes WHERE id={$NodeID} ";
@ -20,7 +19,7 @@
$CV = array();
if( count( $ZA ) ){
foreach( $ZA as $VV ){
$CV['colour']="rgba({$VV['r']},{$VV['g']},{$VV['b']},255)";
$CV['colour']="rgba(".intval($VV['r']).",".intval($VV['g']).",".intval($VV['b']).",255)";
$QS = "SELECT * FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$VV['id']}";
$PP = $DATABASE->Query( $QS );
$CV['points'] = array();

21
lib/controller/getDeviceUploadStatus.php

@ -0,0 +1,21 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$AID = intval($_POST['DID']);
$QS = "SELECT * FROM `lrf_uploads` WHERE `sensor_id`={$AID} AND `status` < 101";
$result = $DATABASE->Query( $QS, false );
$Data['count'] = count($result);
if( count($result) ){
foreach( $result as $R ){
if( $R['status'] > -1 && $R['status'] < 101 ){
$Data['current']=$R['file'];
$Data['progress']=$R['status']/100.0;
break;
};
};
};
echo json_encode( $Data );
exit();
};
header('location: /');
?>

204
lib/controller/getFilterEditor.php

@ -0,0 +1,204 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['FID'] );
$QS = "SELECT * FROM `target_filters` WHERE `id`={$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];
switch( $CR['type'] ){
case 1: //Train
$QS = "SELECT * FROM `target_filter_train` WHERE `id`={$CR['aux_id']}";
$JKA = $DATABASE->Query( $QS );
$FD = $JKA[0];
$TPL =<<<EFUFU
{
xtype: 'form',
labelAlign: 'right',
autoScroll: 'auto',
labelWidth: 120,
items:[{
border: false,
frame: false,
xtype: 'panel',
html: '<table width="100%" border=0 class="setEd_infoPanel" id="TRAIN"><tr><td width="65px"><img width="64px" src="/style/assets/train.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
border: false,
frame: false,
xtype: 'panel',
html: '<table width="100%" border=0 class="setEd_infoPanel" id="TRAIN"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
xtype: 'combo',
fieldLabel: 'Filter Status',
id: 'flt_ena',
lazyRender:true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['status_val','status_txt'],
data: [[0,'Disabled'],[1,'Enabled']]
}),
value: %%%ENA_VAL%%%,
valueField: 'status_val',
displayField: 'status_txt',
listeners:{
select: function( t, r, i ){
Ext.Ajax.request({
url: '/lib/controller/doFilterOperation.php',
params: {
OPID: 2,
OPCODE: r.data.status_val,
FID: {$EID},
UID: {$UserID},
SID: '{$Session}'
},
success: function(){
loadFilters();
}
});
}
}
},{
xtype: 'spacer',
height: 5
},{
xtype: 'combo',
fieldLabel: 'Upper Sensor',
id: 'flt_uper',
lazyRender:true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['node_id','node_name'],
data: %%%UPSENS%%%
}),
value: {$FD['UPPER_SENSOR']},
valueField: 'node_id',
displayField: 'node_name',
listeners:{
select: function( t, r, i ){
Ext.Ajax.request({
url: '/lib/controller/doFilterOperation.php',
params: {
OPID: 3,
OPCODE: r.data.node_id,
FID: {$EID},
UID: {$UserID},
SID: '{$Session}'
},
success: function(){
loadFilters();
}
});
}
}
},{
xtype: 'combo',
fieldLabel: 'Bottom Sensor',
id: 'flt_bottom',
lazyRender:true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['node_id','node_name'],
data: %%%LOSENS%%%
}),
value: {$FD['LOWER_SENSOR']},
valueField: 'node_id',
displayField: 'node_name',
listeners:{
select: function( t, r, i ){
Ext.Ajax.request({
url: '/lib/controller/doFilterOperation.php',
params: {
OPID: 4,
OPCODE: r.data.node_id,
FID: {$EID},
UID: {$UserID},
SID: '{$Session}'
},
success: function(){
loadFilters();
}
});
}
}
},{
xtype: 'spacer',
height: 5
},{
xtype: 'button',
disabled: false,
width: '100%',
text: 'Remove Target Filter',
handler: function(){
Ext.Ajax.request({
url: '/lib/controller/doFilterOperation.php',
params: {
OPID: 1,
OPCODE: 0,
FID: {$EID},
UID: {$UserID},
SID: '{$Session}'
},
success: function(){
loadFilters();
}
});
}
}]
}
EFUFU;
$QS = "SELECT * FROM `target_filter_train` WHERE `id`={$CR['aux_id']}";
$Zult = $DATABASE->Query( $QS, false );
if( count( $Zult ) ){
$UID = intval($Zult[0]['UPPER_SENSOR']);
$LID = intval($Zult[0]['LOWER_SENSOR']);
} else {
$UID = 0;
$LID = 0;
};
$UPSENS = array( array( 0,'Not Set' ) );
$LOSENS = array( array( 0,'Not Set' ) );
$QS = "SELECT * FROM `nodes` WHERE `type`=3";
$Mult = $DATABASE->Query( $QS, false );
if( count( $Mult ) ){
foreach( $Mult as $M ){
if( $M['id'] != $LID ) $UPSENS[] = array( $M['id'], $M['name'] );
if( $M['id'] != $UID ) $LOSENS[] = array( $M['id'], $M['name'] );
};
};
$TPL = str_ireplace( '%%%UPSENS%%%', json_encode( $UPSENS ), $TPL );
$TPL = str_ireplace( '%%%LOSENS%%%', json_encode( $LOSENS ), $TPL );
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL );
$TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL );
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
};
} else {
echo '{ xtype: \'panel\', html: \'Node '.$_POST['NODE'].' Loadded\'}';
};
} else {
header('location: /');
};
?>

17
lib/controller/getFilterInfo.php

@ -0,0 +1,17 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['FID'] );
switch( $EID ){
case 1: //Train
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="TRAIN"><tr><td width="65px"><img width="64px" src="/style/assets/train.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%','Train Presence Filter' , $TPL );
$TPL = str_ireplace( '%%%INFO%%%','Disables Detection of Large Objects', $TPL );
echo $TPL;
break;
};
} else {
header('location: /');
};
?>

43
lib/controller/getFilters.php

@ -0,0 +1,43 @@
<?php
require_once('../ajax_asm.php');
ob_start();
$UID = intval( $CUser->Data['id'] );
$ACCESS = intval( $CUser->Data['access'] );
if( $UID > 1 ){
$QS = "SELECT * FROM `target_filters`";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
foreach( $Result as $R ){
$QS = "SELECT * FROM `target_filter_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: \'<a class="sideInfo_item" id="UART_'.(($R['enabled']==0)?'N':'O').'" onclick="editFilter('.$R['id'].');">'.$Labels->GetLabel($MOD['name']).'</a>\'}';
break;
default:
$ModPart[] = '{ xtype: \'panel\', boder: false, frame: false, html: \'<a align="center" style="padding: 5px; color: black; background-color: grey;">'.$R['device'].'</a>\'}';
};
};
$Data['status']='ok';
$Data['modules'] = '['.implode( ',', $ModPart ) .']';
} else {
$Data['status']='na';
};
$Data['messages'] = ob_get_clean();
echo json_encode( $Data );
} else {
header('location: /');
};
?>

16
lib/controller/getHistoryDates.php

@ -1,7 +1,21 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]';
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
$QS = "SELECT count(`id`) as `cnt`, `ts`/86400 as `ts` FROM `events` GROUP BY `ts`/86400";
$RR = $ZIZI->Query( $QS );
if( count( $RR ) ){
$DD = array();
foreach( $RR as $R ){
$CC = intval( $R['cnt'] );
if( $CC > 100 ) $CC = 100;
$DD[] = '{"t": '.($R['ts']*86400000).',"v":'.$CC.'}';
//echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]';
};
echo "[" . implode(",", $DD ) . "]";
} else {
echo "[]";
};
} else {
header('location: /');
};

38
lib/controller/getHistoryDay.php

@ -1,7 +1,43 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
echo "{expanded: true, children: [{ text: 'Menu Option 1', leaf: false, expanded: true, children:[{ text: '14:53', leaf: true }] },{ text: 'Menu Option 2', leaf: true },{ text: 'Menu Option 3', leaf: true}]}";
$DTS = intval( $_POST['DTS'] );
if( $DTS ){
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
$DS = $DTS;
$DE = $DS + 86400; // -> 1 Day
$QS ="SELECT DISTINCT `node_id` FROM `events` WHERE `ts` >= {$DS} AND `ts` <= {$DE}";
$NDD = $ZIZI->Query( $QS );
$lulu = true;
$E = "]}";
$NONO = array();
foreach( $NDD as $NID ){
$id = intval( $NID['node_id'] );
$QS = "SELECT `name` FROM `nodes` WHERE `id`={$id}";
$R = $DATABASE->Query( $QS );
$Name = $R[0]['name'];
if( $lulu ) {
$S = "{ text: '{$Name}', leaf: false, expanded: true, children:[";
$lulu = false;
} else {
$S = "{ text: '{$Name}', leaf: false, expanded: false, children:[";
};
$QS = "SELECT `ts`, `id` FROM `events` WHERE `node_id`={$id} AND `ts` >= {$DS} AND `ts` <= {$DE} AND ( `evt_type`=52 ) ORDER BY `ts`, `ts_ms`";
//echo $QS;
//exit();
$JJJ = $ZIZI->Query( $QS );
$JIGA = array();
foreach( $JJJ as $J ){
$TM = date( "H:i:s", $J['ts'] );
$JIGA[] = "{ text: '{$TM}', leaf: true, ts: {$J['ts']}, nid: {$id} }";
};
$NONO[] = $S . implode( ",", $JIGA ) . $E;
//echo "{expanded: true, children: [{ text: 'Menu Option 1', leaf: false, expanded: true, children:[{ text: '14:53', leaf: true }] },{ text: 'Menu Option 2', leaf: true },{ text: 'Menu Option 3', leaf: true}]}";
};
echo "{expanded: true, children: [".implode(",", $NONO )."]}";
} else {
echo "[]";
};
} else {
header('location: /');
};

33
lib/controller/getHistoryEvents.php

@ -1,8 +1,35 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
echo '[{"t": 1285891200000,"v": 20},{"t": 1285804800000,"v": 100},{"t": 1672249854000,"v": 50},{"t": 1672279854000,"v": 80}]';
} else {
header('location: /');
$CTS = intval( $_POST['DTS'] );
if( $CTS ){
$QS = "SELECT * FROM nodes";
$result = $DATABASE->Query( $QS, false );
$NodeNames = array();
foreach( $result as $R ) $NodeNames[$R['id']] = $R['name'];
$QS = "SELECT `events`.*, `events_2_videos`.* FROM `events` LEFT JOIN `events_2_videos` ON( `events`.`id` = `events_2_videos`.`evt_id` ) WHERE `ts` >= {$CTS} ORDER BY `ts` DESC, `ts_ms` DESC LIMIT 32";
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
$LREC = $ZIZI->Query( $QS );
$Data['log'] = array();
foreach( $LREC as $REC ){
$CR['id'] = intval( $REC['id'] );
$CR['node_id'] = intval( $REC['node_id'] );
$CR['node_name'] = $NodeNames[$CR['node_id']];
$CR['ts'] = intval( $REC['ts'] );
$CR['ms'] = sprintf( "%03d", intval( $REC['ts_ms'] ));
$CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] );
$CR['type'] = intval( $REC['evt_type'] );
$CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] ));
$CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] ));
$CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));
$CR['r'] = intval( $REC['range_digital'] );
$CR['width'] = intval( $REC['area'] );
$CR['video_id'] = intval( $REC['video_id'] );
$Data['log'][] = $CR;
};
echo json_encode( $Data );
exit();
};
};
header('location: /');
?>

lib/controller/zuza/getMaskSchedule.php → lib/controller/getMaskSchedule.php

lib/controller/zuza/getMaskScheduleEditor.php → lib/controller/getMaskScheduleEditor.php

145
lib/controller/getMetroBottomSensorEditor.php

@ -0,0 +1,145 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$QS = "SELECT * FROM `target_filters` WHERE `type`=1";
$RZ = $DATABASE->Query( $QS, false );
$SOK = false;
$FOK = false;
if( count( $RZ ) ){
$FL = $RZ[0];
$FOK = true;
$QS = "SELECT * FROM `target_filter_train` WHERE `id`={$FL['aux_id']}";
$RK = $DATABASE->Query( $QS, false );
$FD = $RK[0];
if( $FD['LOWER_SENSOR'] ){
$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$FD['LOWER_SENSOR']}";
$JJR = $DATABASE->Query( $QS, false );
$SI = $JJR[0]['aux_id'];
$QS = "SELECT * FROM `lrf_detection_profiles` WHERE `aux_id`={$SI} AND `profile_id`=0 AND `lrf_id`=0 AND `master`=1";
$JJR = $DATABASE->Query( $QS, false );
$SD = $JJR[0];
$SOK = true;
} else {
$MSG = 'Bottom Sensor is not defined in the Train Filter';
};
} else {
$MSG = 'The Train Filter is not defined in the System';
};
$LILI=<<<lskdjflsdsdf
,listeners:{
afterrender: function(){
Ext.Msg.show({
title: 'Information',
msg: '{$MSG}',
buttons: Ext.Msg.OK,
fn: function(){
var tt = Ext.getCmp('up_se_popanel');
tt.removeAll( true );
tt.doLayout();
},
icon: Ext.MessageBox.INFO
});
}
}
lskdjflsdsdf;
$TPL=<<<JOJOKA
{
xtype: 'panel',
id: 'up_se_popanel',
border: true,
title: 'Bottom Sensor Detection Settings',
frame: true,
labelWidth: 150,
labelAlign: 'right',
layout: 'form',
height: PanelH,
bbar:[{
text: 'Apply Detection Settings',
handler: function(){
var oder = Ext.getCmp('ups_order').getValue();
var oset = Ext.getCmp('ups_offset').getValue();
var odel = Ext.getCmp('ups_delta').getValue();
var ofli = Ext.getCmp('ups_flip').getValue();
var owid = Ext.getCmp('ups_width').getValue();
var osst = Ext.getCmp('ups_sst').getValue();
var osun = Ext.getCmp('ups_sun').getValue();
Ext.Ajax.request({
url: '/lib/controller/doSensorOperation.php',
params: {
UID: {$UserID},
SID: '{$Session}',
SNID: '{$SI}',
OPID: 19,
OFF: oset,
ORD: oder,
DEL: odel,
FLI: ofli,
WIZ: owid,
SST: osst,
SUN: osun
},
success: function( response, opts ){
Ext.Msg.show({
title: 'Information',
msg: 'Settings are Saved',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
},
failure: failureAJAXFunction
});
}
}],
items:[{
xtype: 'numberfield',
id: 'ups_order',
fieldLabel: 'Order',
value: '{$SD['order']}'
},{
xtype: 'numberfield',
id: 'ups_offset',
fieldLabel: 'Offset',
value: '{$SD['offset']}'
},{
xtype: 'numberfield',
id: 'ups_delta',
fieldLabel: 'Delta',
value: '{$SD['delta']}'
},{
xtype: 'numberfield',
id: 'ups_flip',
fieldLabel: 'Flip',
value: '{$SD['flip']}'
},{
xtype: 'numberfield',
id: 'ups_width',
fieldLabel: 'Width',
value: '{$SD['width']}'
},{
xtype: 'numberfield',
id: 'ups_sst',
fieldLabel: 'SST',
value: '{$SD['sst']}'
},{
xtype: 'numberfield',
id: 'ups_sun',
fieldLabel: 'Sun',
value: '{$SD['sun']}'
}]
%%%JUMPAPA%%%
}
JOJOKA;
if( $FOK && $SOK ){
$TPL = str_replace('%%%JUMPAPA%%%', '', $TPL );
} else {
$TPL = str_replace('%%%JUMPAPA%%%', $LILI, $TPL );
};
echo $TPL;
} else {
header('location: /');
};
?>

126
lib/controller/getMetroFusionEditor.php

@ -0,0 +1,126 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$QS = "SELECT * FROM `target_filters` WHERE `type`=1";
$RZ = $DATABASE->Query( $QS, false );
$FOK = false;
if( count( $RZ ) ){
$FL = $RZ[0];
$FOK = true;
$QS = "SELECT * FROM `target_filter_train` WHERE `id`={$FL['aux_id']}";
$RK = $DATABASE->Query( $QS, false );
$SD = $RK[0];
} else {
$MSG = 'The Train Filter is not defined in the System';
};
$LILI=<<<lskdjflsdsdf
,listeners:{
afterrender: function(){
Ext.Msg.show({
title: 'Information',
msg: '{$MSG}',
buttons: Ext.Msg.OK,
fn: function(){
var tt = Ext.getCmp('up_se_popanel');
tt.removeAll( true );
tt.doLayout();
},
icon: Ext.MessageBox.INFO
});
}
}
lskdjflsdsdf;
$TPL=<<<JOJOKA
{
xtype: 'panel',
id: 'up_se_popanel',
border: true,
title: 'Train Filter Fusion Engine Settings',
frame: true,
labelWidth: 150,
labelAlign: 'right',
layout: 'form',
height: PanelH,
bbar:[{
text: 'Apply Filter Settings',
handler: function(){
var odtr = (Ext.getCmp('ups_tdetect').getValue())?1:0;
var odtm = Ext.getCmp('ups_dtime').getValue();
var ostm = Ext.getCmp('ups_stime').getValue();
var ottr = (Ext.getCmp('ups_ttrain').getValue())?1:0;
var owid = Ext.getCmp('ups_width').getValue();
var odbg = (Ext.getCmp('ups_dbg').getValue())?1:0;
Ext.Ajax.request({
url: '/lib/controller/doFilterOperation.php',
params: {
UID: {$UserID},
SID: '{$Session}',
FID: {$FL['id']},
OPID: 9,
DTR: odtr,
DTM: odtm,
STM: ostm,
TTR: ottr,
WIZ: owid,
DBG: odbg
},
success: function( response, opts ){
Ext.Msg.show({
title: 'Information',
msg: 'Settings are Saved',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
},
failure: failureAJAXFunction
});
}
}],
items:[{
xtype: 'numberfield',
id: 'ups_width',
fieldLabel: 'Train Width',
value: '{$SD['TRAIN_WIDTH']}'
},{
xtype: 'checkbox',
id: 'ups_tdetect',
fieldLabel: 'Detect Train',
checked: parseInt('{$SD['TRAIN_DETECT']}')
},{
xtype: 'numberfield',
id: 'ups_dtime',
fieldLabel: 'Decision Time',
value: '{$SD['DECISION_TIME']}'
},{
xtype: 'numberfield',
id: 'ups_stime',
fieldLabel: 'Suspect Train Time',
value: '{$SD['SUSPECT_TIME']}'
},{
xtype: 'checkbox',
id: 'ups_ttrain',
fieldLabel: 'Track Train',
checked: parseInt('{$SD['TRACK_TRAIN']}')
},{
xtype: 'checkbox',
id: 'ups_dbg',
fieldLabel: 'Debugging Mode',
checked: parseInt('{$SD['DEBUG']}')
}]
%%%JUMPAPA%%%
}
JOJOKA;
if( $FOK ){
$TPL = str_replace('%%%JUMPAPA%%%', '', $TPL );
} else {
$TPL = str_replace('%%%JUMPAPA%%%', $LILI, $TPL );
};
echo $TPL;
} else {
header('location: /');
};
?>

145
lib/controller/getMetroUpperSensorEditor.php

@ -0,0 +1,145 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$QS = "SELECT * FROM `target_filters` WHERE `type`=1";
$RZ = $DATABASE->Query( $QS, false );
$SOK = false;
$FOK = false;
if( count( $RZ ) ){
$FL = $RZ[0];
$FOK = true;
$QS = "SELECT * FROM `target_filter_train` WHERE `id`={$FL['aux_id']}";
$RK = $DATABASE->Query( $QS, false );
$FD = $RK[0];
if( $FD['UPPER_SENSOR'] ){
$QS = "SELECT `aux_id` FROM `nodes` WHERE `id`={$FD['UPPER_SENSOR']}";
$JJR = $DATABASE->Query( $QS, false );
$SI = $JJR[0]['aux_id'];
$QS = "SELECT * FROM `lrf_detection_profiles` WHERE `aux_id`={$SI} AND `profile_id`=0 AND `lrf_id`=0 AND `master`=1";
$JJR = $DATABASE->Query( $QS, false );
$SD = $JJR[0];
$SOK = true;
} else {
$MSG = 'Upper Sensor is not defined in the Train Filter';
};
} else {
$MSG = 'The Train Filter is not defined in the System';
};
$LILI=<<<lskdjflsdsdf
,listeners:{
afterrender: function(){
Ext.Msg.show({
title: 'Information',
msg: '{$MSG}',
buttons: Ext.Msg.OK,
fn: function(){
var tt = Ext.getCmp('up_se_popanel');
tt.removeAll( true );
tt.doLayout();
},
icon: Ext.MessageBox.INFO
});
}
}
lskdjflsdsdf;
$TPL=<<<JOJOKA
{
xtype: 'panel',
id: 'up_se_popanel',
border: true,
title: 'Upper Sensor Detection Settings',
frame: true,
labelWidth: 150,
labelAlign: 'right',
layout: 'form',
height: PanelH,
bbar:[{
text: 'Apply Detection Settings',
handler: function(){
var oder = Ext.getCmp('ups_order').getValue();
var oset = Ext.getCmp('ups_offset').getValue();
var odel = Ext.getCmp('ups_delta').getValue();
var ofli = Ext.getCmp('ups_flip').getValue();
var owid = Ext.getCmp('ups_width').getValue();
var osst = Ext.getCmp('ups_sst').getValue();
var osun = Ext.getCmp('ups_sun').getValue();
Ext.Ajax.request({
url: '/lib/controller/doSensorOperation.php',
params: {
UID: {$UserID},
SID: '{$Session}',
SNID: '{$SI}',
OPID: 19,
OFF: oset,
ORD: oder,
DEL: odel,
FLI: ofli,
WIZ: owid,
SST: osst,
SUN: osun
},
success: function( response, opts ){
Ext.Msg.show({
title: 'Information',
msg: 'Settings are Saved',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
},
failure: failureAJAXFunction
});
}
}],
items:[{
xtype: 'numberfield',
id: 'ups_order',
fieldLabel: 'Order',
value: '{$SD['order']}'
},{
xtype: 'numberfield',
id: 'ups_offset',
fieldLabel: 'Offset',
value: '{$SD['offset']}'
},{
xtype: 'numberfield',
id: 'ups_delta',
fieldLabel: 'Delta',
value: '{$SD['delta']}'
},{
xtype: 'numberfield',
id: 'ups_flip',
fieldLabel: 'Flip',
value: '{$SD['flip']}'
},{
xtype: 'numberfield',
id: 'ups_width',
fieldLabel: 'Width',
value: '{$SD['width']}'
},{
xtype: 'numberfield',
id: 'ups_sst',
fieldLabel: 'SST',
value: '{$SD['sst']}'
},{
xtype: 'numberfield',
id: 'ups_sun',
fieldLabel: 'Sun',
value: '{$SD['sun']}'
}]
%%%JUMPAPA%%%
}
JOJOKA;
if( $FOK && $SOK ){
$TPL = str_replace('%%%JUMPAPA%%%', '', $TPL );
} else {
$TPL = str_replace('%%%JUMPAPA%%%', $LILI, $TPL );
};
echo $TPL;
} else {
header('location: /');
};
?>

7
lib/controller/getModuleEditor.php

@ -391,7 +391,7 @@ EFUFU;
break;
case 9: //Modem
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
//$II = $DATABASE->Query( $QS );
$CI = $II[0];
$R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'<img title="SSL Encription" src="/style/icons/icons/rosette.png">':'<img title="NO Encription" src="/style/icons/icons/flag_green.png">');
$TPL =<<<EFUFU
@ -448,6 +448,7 @@ $TPL =<<<EFUFU
width: '100%',
text: 'Edit Module Config',
handler: function(){
showModuleSettingsEditor({$EID});
}
},{
xtype: 'spacer',
@ -465,8 +466,8 @@ $TPL =<<<EFUFU
}
EFUFU;
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL );
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL );
$TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL );
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;

6
lib/controller/getModuleInfo.php

@ -43,9 +43,9 @@
echo $TPL;
break;
case 9: //Modem
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td width="65px"><img width="64px" src="/style/assets/modem.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL );
$TPL ='<table width="100%" border=0 class="setEd_infoPanel" id="MODEM"><tr><td width="65px"><img width="64px" src="/style/assets/modem.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>';
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL );
echo $TPL;
break;
};

251
lib/controller/getModuleSettings.php

@ -7,88 +7,10 @@
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];
switch( $CR['type'] ){
case 1: //ZLMedia
$TPL =<<<EFUFU
{
xtype: 'form',
labelAlign: 'right',
autoScroll: 'auto',
labelWidth: 120,
items:[{
border: false,
frame: false,
xtype: 'panel',
html: '<table width="100%" border=0 class="setEd_infoPanel" id="UART"><tr><td width="65px"><img width="64px" src="/style/assets/ZL_logo.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
border: false,
frame: false,
xtype: 'panel',
html: '<table width="100%" border=0 class="setEd_infoPanel" id="UART"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
xtype: 'combo',
fieldLabel: 'Module Status',
id: 'mod_ena',
lazyRender:true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['status_val','status_txt'],
data: [[0,'Disabled'],[1,'Enabled']]
}),
value: %%%ENA_VAL%%%,
valueField: 'status_val',
displayField: 'status_txt',
listeners:{
select: function( t, r, i ){
if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID});
}
}
},{
xtype: 'spacer',
height: 5
},{
xtype: 'button',
id: 'mo_edit_btn',
disabled: false,
width: '100%',
text: 'Edit Module Config',
handler: function(){
}
},{
xtype: 'spacer',
height: 5
},{
xtype: 'button',
id: 'mo_del_btn',
disabled: false,
width: '100%',
text: 'Remove Module',
handler: function(){
removeModule({$EID});
}
}]
}
EFUFU;
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_ZL_MEDIA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_ZL_MEDIA_DESC_LOO_'), $TPL );
$TPL = str_ireplace( '%%%LOINFO%%%','' , $TPL );
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
switch( $CR['type'] ){
case 1: //DCB USB
break;
case 2: //DCB USB
break;
case 3: //Kafka
case 2: //Kafka
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
$CI = $II[0];
@ -400,7 +322,7 @@ EFUFU;
$TPL = str_replace( '%%%VALIDATION%%%', $ValidationOutput, $TPL );
echo $TPL;
break;
case 7: // SSDP
case 6: // SSDP
$TPL =<<<EFUFU
{
xtype: 'form',
@ -467,7 +389,7 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 8: // Onvif
case 7: // Onvif
$TPL =<<<EFUFU
{
xtype: 'form',
@ -534,8 +456,8 @@ EFUFU;
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;
break;
case 9://Embed Video Encoder
$QS="SELECT * FROM `module_embed_video_settings` WHERE `id`={$CR['aux_id']}";
case 8://Embed Video Encoder
$QS="SELECT * FROM `module_eve` WHERE `id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
$CI = $II[0];
$TS = array( '320x240', '640x480', '800x600', '1280x720', '1024x768', '1920x1080' );
@ -949,85 +871,138 @@ EFUFU;
$Data['content'] = json_decode( $TPL );
echo $TPL; //json_encode($Data);
break;
case 10: //Modem
$QS="SELECT * FROM `modules_kafka` WHERE `module_id`={$CR['aux_id']}";
case 9: //Modem
$QS="SELECT * FROM `module_modem` WHERE `id`={$CR['aux_id']}";
$II = $DATABASE->Query( $QS );
$CI = $II[0];
$R_nfo = 'Broker Node:'. $CI['brocker_address'].':'.$CI['brocker_port'].((intval($CI['use_ssl'])>0)?'<img title="SSL Encription" src="/style/icons/icons/rosette.png">':'<img title="NO Encription" src="/style/icons/icons/flag_green.png">');
$CI = $II[0];
$TPL =<<<EFUFU
{
xtype: 'form',
labelAlign: 'right',
autoScroll: 'auto',
labelWidth: 120,
labelWidth: 200,
items:[{
border: false,
frame: false,
xtype: 'panel',
html: '<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td width="65px"><img width="64px" src="/style/assets/modem.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
html: '<table width="100%" border=0 class="setEd_infoPanel" id="MODEM"><tr><td width="65px"><img width="64px" src="/style/assets/modem.png"></td><td valign="middle">%%%NAME%%%</td></tr><tr><td colspan=2>%%%INFO%%%</td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
border: false,
frame: false,
xtype: 'panel',
html: '<table width="100%" border=0 class="setEd_infoPanel" id="KAFKA"><tr><td valign="middle">%%%LOINFO%%%</td></tr></table>'
},{
xtype: 'spacer',
height: 5
},{
xtype: 'combo',
fieldLabel: 'Module Status',
id: 'mod_ena',
lazyRender:true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: {
xtype: 'arraystore',
fields: ['status_val','status_txt'],
data: [[0,'Disabled'],[1,'Enabled']]
},
value: %%%ENA_VAL%%%,
valueField: 'status_val',
displayField: 'status_txt',
listeners:{
select: function( t, r, i ){
if( r.data.status_val ) enableModule({$EID}); else disableModule({$EID});
}
}
xtype: 'textfield',
id: 'num_prefix',
name: 'num_prefix',
fieldLabel: 'Default Prefix',
value: '{$CI['default_prefix']}'
},{
xtype: 'spacer',
xtype: 'spacer',
height: 5
},{
xtype: 'button',
id: 'mo_edit_btn',
disabled: false,
width: '100%',
text: 'Edit Module Config',
handler: function(){
}
xtype: 'slider',
id: 'trig_window',
name: 'trig_window',
fieldLabel: 'Trigger Time (seconds)',
maxValue: 15,
width: '80%',
minValue: 0,
increment: 3,
value: {$CI['trigger_window']}
},{
xtype: 'spacer',
height: 5
},{
xtype: 'slider',
id: 'alarm_window',
name: 'alarm_window',
fieldLabel: 'Alarm Time (seconds)',
width: '80%',
increment: 60,
maxValue: 3600,
minValue: 180,
value: {$CI['alarm_window']}
},{
xtype: 'spacer',
height: 5
},{
xtype: 'button',
id: 'mo_del_btn',
disabled: false,
width: '100%',
text: 'Remove Module',
handler: function(){
removeModule({$EID});
}
}]
xtype: 'grid',
id: 'phone_book_grid',
border: false,
frame: false,
autoScroll: true,
//width: '100%',
lazyRender: true,
tbar:[{
text: 'Add',
handler: addNewPhoneNumber
},{
text: 'Delete',
id: 'ph_bo_de_bu',
disabled: true
}],
height: 225,
ds: archives_store,
cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
viewConfig: {
// forceFit: true
},
},{
xtype: 'spacer',
height: 5,
html: '<hr>'
},{
xype: 'panel',
layout: 'vbox',
frame: false,
height: 120,
items:[{
xtype: 'panel',
layout: 'table',
width: '100%',
defaults: {
// applied to each contained panel
bodyStyle:'padding:20px'
},
layoytConfig:{
columns: 4
},
items: [{
xtype: 'spacer',
html: '<p>New Phone Number:</p>'
},{
xtype: 'textfield',
id: 'n_ph_n',
name: 'n_ph_n'
},{
xtype: 'spacer',
html: '<p>Custom Message:</p>'
},{
xtype: 'textarea',
id: 'n_ph_l',
name: 'n_ph_l',
fieldLabel: 'Custom Message',
}]
},{
xtype: 'button',
width: '100%',
text: 'Add Phone Number',
handler: function(){
}
}]
}],
listeners:{
afterrender: loadPhoneBook
}
}
EFUFU;
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_KAFKA_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_KAFKA_DESC_LOO_'), $TPL );
$TPL = str_ireplace( '%%%NAME%%%',$Labels->GetLabel('_MODEM_DESC_SHO_') , $TPL );
$TPL = str_ireplace( '%%%INFO%%%', $Labels->GetLabel('_MODEM_DESC_LOO_'), $TPL );
$TPL = str_ireplace( '%%%LOINFO%%%',$R_nfo , $TPL );
$TPL = str_ireplace( '%%%ENA_VAL%%%',$CR['enabled'], $TPL );
echo $TPL;

10
lib/controller/getPhoneBook.php

@ -0,0 +1,10 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
echo json_encode( $Data );
exit();
};
header( 'location: /' );
?>

206
lib/controller/getReportLayout.php

@ -0,0 +1,206 @@
<?php
require_once('../ajax_asm.php');
$UID = intval( $CUser->Data['id'] );
$Data = '';
if( $UID > 1 ){
$QS = "SELECT * FROM `system_props` LIMIT 1";
$SPD = $DATABASE->Query( $QS );
if( count( $SPD ) ){
$SP = $SPD[0];
$DUMMY = array();
if( $CUser->Data['access'] > 5 ){
$TABA =<<<jodjhowierewt
{
xtype: 'panel',
html: '<table id="tbl_ph_ccc_%%ID%%" style="color: black; background-image: url(\'/style/assets/16-9-nocam.png\');" width="100%" border=0><tr><td colspan=3>&nbsp;</td></tr><tr><td>&nbsp;</td><td align="center"><div id="btn_ph_ccc_%%ID%%"></div></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>',
listeners:{
afterrender : function( ){
var tb = document.getElementById('tbl_ph_ccc_%%ID%%');
var W = tb.offsetWidth;
var H = (W/16)*9;
tb.setAttribute("height", H );
tb.style.backgroundSize=W+"px "+H+"px";
var p = Ext.getCmp('pan_ph_ccc_%%ID%%');
p.setHeight( H+40 );
var jaja = Ext.create({
xtype: 'panel',
title: 'Camera is Not Assigned to the System',
frame: true,
renderTo: 'btn_ph_ccc_%%ID%%',
layout: 'vbox',
width: 500,
height: 120,
items:[{
xtype: 'spacer',
height: 10
},{
width: '100%',
html: '<center>Proceed to Cameras Settings to Assign One</center>'
},{
xtype: 'spacer',
height: 20
},{
xtype: 'button',
width: '100%',
text: 'Open Camera Settings',
handler: function(){
showContent( 2020 );
}
}]
});
jaja.doLayout();
}
}
}
jodjhowierewt;
$LOGIO=<<<kahkjahskfgkgkh
{
xtype: 'grid',
id: 'rep_grid',
border: false,
frame: false,
autoScroll: true,
//width: '100%',
lazyRender: true,
height: 210,
ds: rep_store,
cm: new Ext.grid.ColumnModel( rep_ColModel_ops ),
sm: new Ext.grid.RowSelectionModel( rep_SelModel_ops ),
viewConfig: {
forceFit: true,
getRowClass: function( record, rowIndex, rowParams, store){
switch( record.get('node_id')%5 ){
case 0: return 'row-level01';
case 1: return 'row-level02';
case 2: return 'row-level03';
case 3: return 'row-level04';
case 4: return 'row-level05';
};
return '';
}
},
listeners:{
afterrender : function( t ){
var papa = Ext.getCmp('segment_portal');
var jj = papa.getComponent( 0 ).getHeight();
t.setHeight( PanelH - jj - 20 );
}
}
}
kahkjahskfgkgkh;
$DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
$DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, /*height: 200,*/ border: true, draggable: false, items:[{$LOGIO}] }";
} else {
$DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
$DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
};
$STA = array();
$END="]}";
$OUT = array();
{
$STA[0]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
$STA[1]="{ columnWidth: .25, stylse:'padding:10px 0 10px 10px', items:[";
$STA[2]="{ columnWidth: .50, stylse:'padding:10px 0 10px 10px', items:[";
$STA[3]="{ columnWidth: 1.0, stylse:'padding:10px 0 10px 10px', items:[";
$QS = "SELECT * FROM `nodes` WHERE `type`>0 AND `type`< 10 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;
if( count( $R ) ){
foreach( $R as $DD ){
if( $idx < 2 ){
$TFN = 'report/node_' . $DD['type'] . '.js';
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.html_entity_decode( $DD['name'] ) , $TPL );
$OUT[]= $STA[$idx] . $TPL . $END;
} else break;
$idx++;
};
if( $idx < 2 ){
for( ;$idx<2;$idx++ ){
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
};
};
} else {
for( ;$idx<2;$idx++ ){
$OUT[]= $STA[$idx] . $DUMMY['sensor'] . $END;
};
};
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;
if( count( $R ) ){
foreach( $R as $DD ){
if( $idx < 1 ){
$TFN = 'report/node_' . $DD['type'] . '.js';
if(!file_exists( $TFN )) continue;
$TPL = file_get_contents( $TFN );
$TPL = str_replace('%%%NODEID%%%', ''.$DD['id'] , $TPL );
$TPL = str_replace('%%%NODENAME%%%', ''.urldecode($DD['name']) , $TPL );
$QS="SELECT * FROM `nodes` WHERE `id`={$DD['id']}";
$Z=$DATABASE->Query( $QS );
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$MODULE_DATA = $S[0];
$TPL = str_replace( '%%%NODENAME%%%', urldecode( $Z[0]['name'] ) , $TPL );
//$FU = 'http://' . $_SERVER['SERVER_ADDR'].':' . $MODULE_DATA['web_port'] .'/stream?id='. $Z[0]['aux_parameter'];
$FU = '/video_feed/stream?id='. $Z[0]['aux_parameter'];
$CS[] = '[' . $Z[0]['aux_parameter'] . ',\'[ 120x120] Video\',\''. $FU .'\']';
$TPL = str_replace( '%%%URLS%%%', '[' . implode( ',', $CS ) . ']' , $TPL );
$TPL = str_replace( '%%%SELID%%%', 'value: '. $Z[0]['aux_parameter'] .',', $TPL );
$TPL = str_replace( '%%%SELURL%%%', $FU, $TPL );
$TPL = str_replace( '%%%STREAMID%%%', $DD['aux_parameter'], $TPL );
$FK = $MODULE_DATA['height'] /$MODULE_DATA['width'];
$W = 244;
$H = $W * $FK;
$TPL = str_replace( '%%%WIDTH%%%', $W, $TPL );
$TPL = str_replace( '%%%HEIGHT%%%', $H, $TPL );
$OUT[]= $STA[2+$idx] . $TPL . $END;
} else break;
$idx++;
};
if( $idx < 1 ){
for( ;$idx<1;$idx++ ){
$T = str_replace( '%%ID%%', 2+$idx , $DUMMY['camera'] );
$OUT[]= $STA[2+$idx] . $T . $END;
};
};
} else {
for( ;$idx<1;$idx++ ){
$T = str_replace( '%%ID%%', 4+$idx , $DUMMY['camera'] );
$OUT[]= $STA[2+$idx] . $T . $END;
};
};
switch( 1 ){
case 1:{
// LA Metro
$OUT[]= $STA[3] . $DUMMY['log'] . $END;
break;
};
case 2:{
//Togo
$OUT[]= $STA[3] . $DUMMY['map'] . $END;
break;
};
}
};
$Data = '[' . implode( ',' , $OUT ) . ']';
} else {
$Data = '[{columnWidth: 1, items:{html:"NO SYSTEM PROPS"}} ]';
};
};
if( $Data != '' ) {
echo $Data;
} else {
echo '[]';
};
?>

10
lib/controller/getResourceEditor.php

@ -220,8 +220,8 @@ $TPL =<<<EFUFU
valueField: 'speed',
displayField: 'speed',
listeners:{
select: function(){
select: function( c, r, n ){
doResourceOperation({$EID}, 2, 1, n );
}
},
value: %%%SPD_VAL%%%
@ -481,6 +481,12 @@ $TPL =<<<EFUFU
frame: false,
border: false,
html:'<center><a href="http://{$Z['path']}/" target="_blank">Link to a Control page</a></center>'
}],
bbar:[{
text: 'Remove Remote UART',
handler: function(){
doResourceOperation({$EID}, 2, 255 );
}
}]
}

729
lib/controller/getSensorEditor.php

@ -3,7 +3,7 @@
if( $CUser->Data['id'] > 1 ){
$EID = intval( $_POST['CID'] );
$QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`) WHERE `sen`.`id`={$EID}";
$QS = "SELECT `sen`.*, `no`.`enable`, `no`.`name`, `no`.`id` as `node_id` FROM `lrf_sensors` `sen` LEFT JOIN `nodes` `no` ON( `no`.`aux_id`=`sen`.`id` AND `no`.`type`=`sen`.`type`) WHERE `sen`.`id`={$EID}";
$Result = $DATABASE->Query( $QS, false );
if( count( $Result ) ){
$CR = $Result[0];
@ -18,7 +18,7 @@ JOJOKA;
$ITEMS = array();
switch( $CR['type'] ){
case 1: $NAME = '<b>'.$CR['name'].'</b><br/>ALS ' . $Labels->getLabel('SENSOR'); break;
case 2: $NAME = '<b>'.$CR['name'].'</b><br/>LGS ' . $Labels->getLabel('SENSOR'); break;
case 2: $NAME = '<b>'.$CR['name'].'</b><br/>LFS ' . $Labels->getLabel('SENSOR'); break;
case 3: $NAME = '<b>'.$CR['name'].'</b><br/>PLS200 ' . $Labels->getLabel('SENSOR'); break;
case 4: $NAME = '<b>'.$CR['name'].'</b><br/>PLS360 ' . $Labels->getLabel('SENSOR'); break;
default: $NAME = '<b>'.$CR['name'].'</b><br/>Unknown Sensor';
@ -36,146 +36,613 @@ JOJOKA;
} else {
$UARTS = "[0, \"".$Labels->GetLabel('_NO_UARTS_DEF_')."\"]";
};
$QS = "SELECT * FROM `lrf_ini_settings` WHERE `sensor_id`={$EID}";
$RRR = $DATABASE->Query( $QS );
if( count( $RRR ) ){
$INI_S = $RRR[0];
} else {
$INI_S = array();
$INI_S['AUTORESET_ENABLE'] = 0;
$INI_S['AUTORESET_INTERLEAVE'] = 0;
$INI_S['AUTORESET_TIMEOUT'] = 0;
$INI_S['BOARD_TEMPERATURE'] = 0;
$INI_S['BOARD_ZEROSHIFT'] = 0;
$INI_S['BOARD_SPEED'] = 4;
$INI_S['RUN_DIR'] = 2;
$INI_S['NO_BLACK_TARGETS'] = 0;
$INI_S['JUST_MOVING_TARGETS'] = 0;
$INI_S['JUST_MOVING_RADIAL'] = 0;
$INI_S['JUST_MOVING_DISTANCE'] = 0;
$INI_S['FREEZ_FIRST_TH'] = 0;
$INI_S['SAVE_FIRST_TH'] = 0;
$QS = "INSERT INTO `lrf_ini_settings`(`sensor_id`,`AUTORESET_ENABLE`,`AUTORESET_INTERLEAVE`,`AUTORESET_TIMEOUT`,`BOARD_TEMPERATURE`,`BOARD_ZEROSHIFT`,`BOARD_SPEED`,`RUN_DIR`,`NO_BLACK_TARGETS`,`JUST_MOVING_TARGETS`,`JUST_MOVING_RADIAL`,`JUST_MOVING_DISTANCE`,`FREEZ_FIRST_TH`,`SAVE_FIRST_TH`) VALUES({$EID},0,0,0,0,0,4,2,0,0,0,0,0,0)";
$DATABASE->Query( $QS );
};
$ED =<<<kokakskhkajhskr
{
xtype: 'form',
labelWidth: 160,
border: false,
frame: false,
labelAlign: 'right',
xtype: 'tabpanel',
activeTab: 0,
items:[{
xtype: 'combo',
id: 'sens_se',
fieldLabel: "{$Labels->GetLabel('_SENS_STATUS_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'{$Labels->GetLabel('___ENABLED__')}']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: {$CR['enable']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 1, b, true );
xtype: 'form',
title: 'General',
labelWidth: 200,
border: false,
frame: false,
labelAlign: 'right',
height: PanelH - 283,
items:[{
xtype: 'combo',
id: 'sens_se',
fieldLabel: "{$Labels->GetLabel('_SENS_STATUS_')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['mode','mode_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[1,'{$Labels->GetLabel('___ENABLED__')}']
]
}),
valueField: 'mode',
displayField: 'mode_txt',
value: {$CR['enable']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 1, b, true );
}
}
}
},{
xtype: 'combo',
id: 'sens_range',
fieldLabel: "{$Labels->GetLabel('SENS_RANGE')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['range','range_txt'],
data: [
[15,'15 Meters'],
[35,'35 Meters'],
[45,'45 Meters'],
[65,'65 Meters'],
[75,'75 Meters'],
[150,'150 Meters'],
[200,'200 Meters'],
[300,'300 Meters']
]
}),
valueField: 'range',
displayField: 'range_txt',
value: {$CR['max_range']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 2, b, true );
},{
xtype: 'combo',
id: 'sens_range',
fieldLabel: "{$Labels->GetLabel('SENS_RANGE')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['range','range_txt'],
data: [
[15,'15 Meters'],
[35,'35 Meters'],
[45,'45 Meters'],
[65,'65 Meters'],
[75,'75 Meters'],
[150,'150 Meters'],
[200,'200 Meters'],
[300,'300 Meters']
]
}),
valueField: 'range',
displayField: 'range_txt',
value: {$CR['max_range']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 2, b, true );
}
}
}
},{
xtype: 'numberfield',
id: 'sens_id',
fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}',
width: 200,
value: {$CR['device_id']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 3, c, true );
},{
xtype: 'numberfield',
id: 'sens_id',
fieldLabel: '{$Labels->GetLabel('_PROTO_DEVICE_ID_')}',
width: 200,
value: {$CR['device_id']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 3, c, true );
}
}
}
},{
xtype: 'combo',
fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}',
lazyRender: true,
id: 'uart_id',
mode: 'local',
disabled: false,
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['uart','uart_txt'],
data: [{$UARTS}]
}),
valueField: 'uart',
displayField: 'uart_txt',
value: {$CR['uart_id']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 4, c.data.uart, true );
},{
xtype: 'combo',
fieldLabel: '{$Labels->GetLabel('_UART_PORT_')}',
lazyRender: true,
id: 'uart_id',
mode: 'local',
disabled: false,
forceSelection: true, triggerAction: 'all', editable: false, disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['uart','uart_txt'],
data: [{$UARTS}]
}),
valueField: 'uart',
displayField: 'uart_txt',
value: {$CR['uart_id']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 4, c.data.uart, true );
}
}
}
},{
xtype: 'combo',
id: 'ad_se',
fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['ad','ad_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[10,'Each 10 Flips'],
[20,'Each 20 Flips'],
[30,'Each 30 Flips'],
[40,'Each 40 Flips'],
[50,'Each 50 Flips'],
[100,'Each 100 Flips'],
[200,'Each 200 Flips']
]
}),
valueField: 'ad',
displayField: 'ad_txt',
value: {$CR['auto_draw']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 5, b, true );
}
}
},{
xtype: 'numberfield',
id: 'basesh_id',
fieldLabel: 'Background {$Labels->GetLabel('__ZERO_SHIFT__')}',
width: 200,
value: {$CR['base_shift']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 6, c, true );
}
}
}]
},{
xtype: 'combo',
id: 'ad_se',
fieldLabel: "{$Labels->GetLabel('AUTO_DRAW')}",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['ad','ad_txt'],
data: [
[0,'{$Labels->GetLabel('__DISABLED__')}'],
[10,'Each 10 Flips'],
[20,'Each 20 Flips'],
[30,'Each 30 Flips'],
[40,'Each 40 Flips'],
[50,'Each 50 Flips'],
[100,'Each 100 Flips'],
[200,'Each 200 Flips']
]
}),
valueField: 'ad',
displayField: 'ad_txt',
value: {$CR['auto_draw']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 5, b, true );
xtype: 'form',
title: 'Hardware',
labelWidth: 200,
border: false,
frame: false,
labelAlign: 'right',
height: PanelH - 283,
items:[{
xtype: 'checkbox',
id: 'autores_ena',
fieldLabel: 'Auto Reset Enabled',
width: 200,
checked: {$INI_S['AUTORESET_ENABLE']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 7, 1, false );
} else {
doSensorOperation( {$CR['id']}, 7, 0, false );
};
}
}
}
},{
xtype: 'numberfield',
id: 'autores_il',
fieldLabel: 'Auto Reset Interleave',
width: 200,
value: {$INI_S['AUTORESET_INTERLEAVE']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 8, c, false );
}
}
},{
xtype: 'numberfield',
id: 'autores_to',
fieldLabel: 'Auto Timeout',
width: 200,
value: {$INI_S['AUTORESET_TIMEOUT']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 9, c, false );
}
}
},{
xtype: 'numberfield',
id: 'board_zsh',
fieldLabel: 'Board Zero Shift',
width: 200,
value: {$INI_S['BOARD_ZEROSHIFT']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 10, c, false );
}
}
},{
xtype: 'numberfield',
id: 'board_temp',
fieldLabel: 'Heater Temperature',
width: 200,
value: {$INI_S['BOARD_TEMPERATURE']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 11, c, false );
}
}
},{
xtype: 'combo',
id: 'board_spd',
fieldLabel: "Scan Speed",
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['sd','sd_txt'],
data: [
[2,'2 Scans per second'],
[4,'4 Scans per second'],
[6,'6 Scans per second'],
[8,'8 Scans per second'],
[10,'10 Scans per second'],
[12,'12 Scans per second']
]
}),
valueField: 'sd',
displayField: 'sd_txt',
value: {$INI_S['BOARD_SPEED']},
width: 200,
listeners:{
select: function( a, c, b ){
doSensorOperation( {$CR['id']}, 12, b, false );
}
}
},{
xtype: 'checkbox',
id: 'nbt_ena',
fieldLabel: 'No Black Targets',
width: 200,
checked: {$INI_S['NO_BLACK_TARGETS']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 13, 1, false );
} else {
doSensorOperation( {$CR['id']}, 13, 0, false );
};
}
}
},{
xtype: 'checkbox',
id: 'jmt_ena',
fieldLabel: 'Just Moving Targets',
width: 200,
checked: {$INI_S['JUST_MOVING_TARGETS']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 14, 1, false );
} else {
doSensorOperation( {$CR['id']}, 14, 0, false );
};
}
}
},{
xtype: 'checkbox',
id: 'jmt_rad',
fieldLabel: 'Just Moving Radial',
width: 200,
checked: {$INI_S['JUST_MOVING_RADIAL']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 15, 1, false );
} else {
doSensorOperation( {$CR['id']}, 15, 0, false );
};
}
}
},{
xtype: 'checkbox',
id: 'jmt_range',
fieldLabel: 'Just Moving Distance',
width: 200,
checked: {$INI_S['JUST_MOVING_DISTANCE']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 16, 1, false );
} else {
doSensorOperation( {$CR['id']}, 16, 0, false );
};
}
}
},{
xtype: 'checkbox',
id: 'fth_freeze',
fieldLabel: 'Freeze First Threshold',
width: 200,
checked: {$INI_S['FREEZ_FIRST_TH']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 17, 1, false );
} else {
doSensorOperation( {$CR['id']}, 17, 0, false );
};
}
}
},{
xtype: 'checkbox',
id: 'fth_save',
fieldLabel: 'Save First Threshold',
width: 200,
checked: {$INI_S['SAVE_FIRST_TH']},
listeners:{
check: function( a, c ){
if( c ){
doSensorOperation( {$CR['id']}, 18, 1, false );
} else {
doSensorOperation( {$CR['id']}, 18, 0, false );
};
}
}
},{
xtype: 'button',
text: 'Apply To Device and Reset',
width: '100%',
iconCls: 'srv_op_download',
scale: 'large',
handler: function(){
doSensorOperation( {$CR['id']}, 20, 0, true );
}
},{
xtype: 'button',
text: 'Issue Sensor Full Reset',
width: '100%',
iconCls: 'srv_op_restart',
scale: 'large',
handler: function(){
doDeviceOperation( {$CR['node_id']}, 1,'', true );
}
}]
},{
xtype: 'numberfield',
id: 'basesh_id',
fieldLabel: '{$Labels->GetLabel('__ZERO_SHIFT__')}',
width: 200,
value: {$CR['base_shift']},
listeners:{
change: function( a, c, b ){
doSensorOperation( {$CR['id']}, 6, c, true );
xtype: 'panel',
title: 'Position',
height: PanelH - 283,
items:[]
},{
xtype: 'panel',
title: 'Maintenence',
height: PanelH - 283,
items:[{
xtype: 'button',
text: 'Issue Sensor Full Reset',
width: '100%',
iconCls: 'srv_op_restart',
scale: 'large',
handler: function(){
doDeviceOperation( {$CR['node_id']}, 1,'', true );
}
},{
xtype: 'button',
text: 'Read All Settings from Sensor',
width: '100%',
iconCls: 'srv_op_upload',
scale: 'large',
handler: function(){
doDeviceOperation( {$CR['node_id']}, 128,'', true );
}
},{
xtype: 'button',
text: 'Save All Settings to Sensor',
width: '100%',
iconCls: 'srv_op_download',
scale: 'large',
handler: function(){
doDeviceOperation( {$CR['node_id']}, 129,'', true );
}
}]
},{
xtype: 'panel',
title: '{$Labels->getLabel('_SND_FILES2_DEV__')}',
height: PanelH - 283,
items:[{
title: '{$Labels->getLabel('_UPLOAD_PACKAGE_')}',
xtype: 'panel',
//height: 300,
//flex: 1,
frame: true,
border: false,
//layout: 'vbox',
items:[{
xtype:'button',
id: 'pickfiles_3',
width: '100%',
text: 'Choose File',
listeners:{
afterrender: function(){
muploader = new plupload.Uploader({
runtimes : 'html5,html4',
browse_button : Ext.getDom('pickfiles_3'),
max_file_size : '1000mb',
chunk_size: '200kb',
max_retries: 3,
multi_selection: false,
max_file_count: 1,
url: '/lib/controller/uploadToDevice.php?DID={$EID}',
init: {
PostInit: function() {
},
FilesAdded: function( up, files ) {
Ext.getCmp('upload_files_btn').enable();
Ext.getCmp('uploads_clr_btn').enable();
plupload.each( files, function(file) {
uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
uploads_store_id++;
Ext.getCmp('upload_grid').doLayout();
});
},
UploadProgress: function(up, file) {
var pb = Ext.getCmp( 'progress_'+file.id );
if( file.percent < 100 ){
pb.updateProgress( file.percent / 100, file.percent + '%', false );
} else {
pb.updateProgress( 1.0, 'Uploaded', false );
uploads_store.removeAll();
loadModuleFiles( {$EID} );
};
},
Error: function(up, err) {
Ext.Msg.show({
title:'Upload Status',
msg: "Error #" + err.code + ": " + err.message,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
}
}
});
muploader.init();
//Ext.getCmp('uploaded_grid').hide();
//Ext.getCmp('upload_progres_panel').show();
devUploadID = {$CR['id']};
fetchDeviceUploadStatus();
//loadModuleFiles( {$EID} );
}
}
},{
height: 200,
xtype: 'grid',
id: 'upload_grid',
border: false,
frame: false,
mode: 'local',
lazyRender: true,
width: '100%',
autoScroll: true,
ds: uploads_store,
cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
viewConfig: {
forceFit: true
},
bbar: [{
text: 'Clear',
id: 'uploads_clr_btn',
disabled: true,
handler: function(){
muploader.splice();
uploads_store.removeAll();
uploads_store_id = 0;
Ext.getCmp('uploads_clr_btn').disable();
Ext.getCmp('upload_files_btn').disable();
}
},{
xtype:'button',
id: 'upload_files_btn',
disabled: true,
text: 'Upload to Module',
handler: function(){
if( muploader!= null ){
muploader.start();
Ext.getCmp('upload_files_btn').disable();
};
}
}]
},{
xtype: 'panel',
height: 20
},{
title: 'Files Saved on Module',
height: 200,
xtype: 'grid',
id: 'uploaded_grid',
border: false,
hidden: true,
frame: false,
mode: 'local',
lazyRender: true,
width: '100%',
autoScroll: true,
ds: uploaded_store,
cm: new Ext.grid.ColumnModel( fileModuleColModel_ops ),
sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
viewConfig: {
forceFit: true
},
bbar: [{
text: 'Clear',
id: 'oploaded_clr_btn',
disabled: false,
handler: function(){
//muploader.splice();
uploaded_store.removeAll();
uploaded_store_id = 0;
}
},{
text: 'Reset Status',
id: 'oploaded_rst_btn',
disabled: true,
handler: function(){
//muploader.splice();
//uploaded_store.removeAll();
//uploaded_store_id = 0;
}
},{
text: 'Issue Reset',
id: 'oploaded_sres_btn',
disabled: true,
handler: function(){
//muploader.splice();
//uploaded_store.removeAll();
//uploaded_store_id = 0;
}
},{
xtype:'button',
//disabled: true,
id: 'oploaded_snd_btn',
text: 'Send to Sensor',
handler: function(){
doDeviceOperation( {$CR['node_id']}, 120,'', true );
Ext.getCmp('uploaded_grid').hide();
Ext.getCmp('upload_progres_panel').show();
devUploadID = {$CR['id']};
fetchDeviceUploadStatus();
}
}]
},{
xtype: 'panel',
id: 'upload_progres_panel',
hidden: false,
items:[{
id: 'upp_ttext',
html: 'Sending 3 file(s) to the device'
},{
id: 'upp_ctext_',
html: '<table width="100%" height="50" border=0><tr><td width="100">&nbsp;</td><td width="50" align="right" height="50"><svg version="1.1" id="L3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve"><circle fill="none" stroke="#fff" stroke-width="4" cx="50" cy="50" r="44" style="opacity:0.5;"/><circle fill="#fff" stroke="#e74c3c" stroke-width="3" cx="8" cy="54" r="6" ><animateTransform attributeName="transform" dur="2s" type="rotate" from="0 50 48" to="360 50 52" repeatCount="indefinite" /></circle></svg></td><td align="left" id="upp_ctext"></td></tr></table>'
},{
xtype: 'progress',
id: 'upp_pbar',
width: '100%',
value: 0.0
}]
}]
}]
}],
bbar:[{
text: 'Remove Sensor',
handler: function(){
doSensorOperation( {$CR['id']}, 255,'', true );
}
}]
}

2
lib/controller/getServerStatus.php

@ -13,7 +13,7 @@
$Data['stats']=$RV[0];
$Data['online'] = 1;
} else {
$Data['status']='na';
$Data['status'] ='na';
$Data['stats'] = array();
$Data['online'] = 0;
};

59
lib/controller/getStatus.php

@ -6,18 +6,45 @@
$SiteID = intval( $_POST['SITE'] );
$LastNID = intval( $_POST['LNID'] );
$LastTS = intval( $_POST['SPID'] );
$FirstTS = intval( $_POST['LOAT'] );
$LLID = intval( $_POST['LSID'] );
$Data = array();
$ServerWasHuped = false;
$ServerIsOnLine = true;
$Data['status'] = 'OK';
$Data['CTS'] = time();
$Data['nodes'] = array();
$Data['log'] = array();
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
$QS = "SELECT `id` FROM `events` WHERE `id` > {$LLID} LIMIT 1";
$CH = $ZIZI->Query( $QS );
if( count( $CH ) ){
$QS = "SELECT * FROM nodes";
$result = $DATABASE->Query( $QS, false );
$NodeNames = array();
foreach( $result as $R ) $NodeNames[$R['id']] = $R['name'];
$QS = "SELECT `id`,`node_id`, `evt_type`, `ts`, `ts_ms`, `range_digital`, `azimuth`, `elevation`, `range`, `area` FROM `events` WHERE `id` > {$LLID} ORDER BY `ts` DESC, `ts_ms` DESC LIMIT 32";
$LREC = $ZIZI->Query( $QS );
foreach( $LREC as $REC ){
$CR['id'] = intval( $REC['id'] );
$CR['node_id'] = intval( $REC['node_id'] );
$CR['node_name'] = $NodeNames[$CR['node_id']];
$CR['ts'] = intval( $REC['ts'] );
$CR['ms'] = sprintf( "%03d", intval( $REC['ts_ms'] ));
$CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] );
$CR['type'] = intval( $REC['evt_type'] );
$CR['range'] = sprintf( "%0.2f", floatval( $REC['range'] ));
$CR['az'] = sprintf( "%0.2f", floatval( $REC['azimuth'] ));
$CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));
$CR['r'] = intval( $REC['range_digital'] );
$CR['width'] = intval( $REC['area'] );
$Data['log'][] = $CR;
};
};
//$QS = "SELECT * FROM nodes ORDER BY `type`";
$QS = "SELECT * FROM nodes WHERE `type` > 0 AND `type` < 14";
$result = $DATABASE->Query( $QS, false );
if( count( $result ) > 0 ){
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
foreach( $result as $R ){
$CN = array();
$CN['id'] = $R['id'];
@ -60,6 +87,14 @@
$JJ = $DATABASE->Query( $QS );
$CS = $JJ[0];
$CN['status'] = $CS['data_status'];
$CN['masks_status'] = 0;
$CN['masks_exist'] = 0;
$QS = "SELECT * FROM `lrf_masks` WHERE `sensor_id`={$R['aux_id']}";
$JJ = $DATABASE->Query( $QS );
if( count( $JJ ) ) foreach( $JJ as $J ) {
$CN['masks_exist'] |= (1<<intval($J['layer']));
if( $J['status'] == 'E' ) $CN['masks_status'] |= (1<<intval($J['layer']));
};
// check draw
if( $LastTS > 0 ){
$QS = "SELECT `id` FROM `lrf_draw` WHERE `node_id`={$R['id']} AND `ts` > {$LastTS}";
@ -75,7 +110,7 @@
if( $CN['status'] == 5 ){
// check Targets
$CN['targets'] = array();
$QS="SELECT * FROM events WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY id DESC LIMIT 32";
$QS="SELECT * FROM events WHERE node_id={$CN['id']} ORDER BY ts DESC, ts_ms DESC LIMIT 32";
//$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) AND (UNIX_TIMESTAMP(NOW())-ts)<60 ORDER BY id DESC LIMIT 32";
//$QS="SELECT * FROM events_cloud WHERE node_id={$CN['id']} AND ( evt_type=13 OR evt_type=14) ORDER BY ts, ts_ms DESC LIMIT 32";
//echo $QS . "\n\n";
@ -83,10 +118,17 @@
if( count( $zult ) ){
$CT = array();
foreach( $zult as $Z ){
$CT['digital'] = $Z['range_digital'];
$CT['az'] = $Z['azimuth'];
$TT = intval( $Z['evt_type'] );
if( $TT > 52 && $TT < 56 ) break;
if( !( $TT == 10 || $TT == 11 ||$TT == 12 ||$TT == 13 || $TT == 14 || $TT == 36 ) ) continue;
//$CT['type'] = $TT;
$CT['digital'] = intval( $Z['range_digital']);
$CT['lat'] = floatval( $Z['lon'] );
$CT['lon'] = floatval( $Z['lat'] );
$CT['az'] = floatval( $Z['azimuth'] );
$CN['targets'][] = $CT;
};
//if( count( $CN['targets'] ) ) $CN['status'] = 5;
};
};
break;
@ -167,7 +209,12 @@
$CN['valid'] = true;
$QS="SELECT * FROM `module_eve` WHERE `id`=1";
$S=$DATABASE->Query( $QS );
$CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].':' . $S[0]['web_port'] .'/stream?id='. $R['aux_parameter'];
//$CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].':' . $S[0]['web_port'] .'/stream?id='. $R['aux_parameter'];
if( $SSL_INSTALLLED ){
$CN['src'] = 'https://' . $_SERVER['SERVER_ADDR'].'/video_feed/stream?id='. $R['aux_parameter'];
} else {
$CN['src'] = 'http://' . $_SERVER['SERVER_ADDR'].'/video_feed/stream?id='. $R['aux_parameter'];
};
break;
};
};

34
lib/controller/getSystemDevices.php

@ -0,0 +1,34 @@
<?php
//await new Promise(r => setTimeout(r, 2000));
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array( 'sensors'=>array(), 'cameras'=>array() );
$QS = "SELECT * FROM `nodes` WHERE `type` > 0 AND `type` < 14";
$RR = $DATABASE->Query( $QS );
foreach( $RR AS $R ){
$CD = array();
$CD['node_id']=$R['id'];
if( $R['type'] < 10 ){
$QS = "SELECT * FROM `lrf_sensors` WHERE `id`={$R['aux_id']}";
$DD = $DATABASE->Query( $QS );
$D = $DD[0];
$CD['id']=$D['id'];
$CD['type']=intval( $D['type'] );
$CD['max_range']=floatval( $D['max_range'] );
$CD['base_shift']=intval( $D['base_shift'] );
$Data['sensors'][] = $CD;
} else {
$CD = array();
$QS = "SELECT * FROM `cameras` WHERE `id`={$R['aux_id']}";
$DD = $DATABASE->Query( $QS );
$D = $DD[0];
$CD['id']=$D['id'];
$CD['type']=intval( $D['type'] );
$Data['cameras'][] = $CD;
};
};
echo json_encode( $Data );
exit();
};
header( 'location: /' );
?>

17
lib/controller/getVideoInfo.php

@ -0,0 +1,17 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$VID = intval( $_POST['VID'] );
if( $VID ){
$QS = "SELECT * FROM `videos` WHERE `id` = {$VID}";
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports.db');
$LREC = $ZIZI->Query( $QS );
if( count( $LREC ) ){
$Data = $LREC[0];
echo json_encode( $Data );
exit();
};
};
};
header('location: /');
?>

lib/controller/zuza/getWidthTable.php → lib/controller/getWidthTable.php

lib/controller/zuza/getWidthTableEditor.php → lib/controller/getWidthTableEditor.php

24
lib/controller/listAccessLog.php

@ -0,0 +1,24 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/onvif/toto.php');
if( $CUser->Data['id'] > 1 ){
if( $CUser->Data['access'] > 5 ){
$QS = "SELECT al.*, ur.login FROM access_log al LEFT JOIN users ur ON (al.user_id = ur.id ) ORDER BY id DESC";
$Result = $DATABASE->Query($QS,false);
foreach( $Result as $CD ){
$cnode['id'] = intval( $CD['id'] );
$cnode['user'] = $CD['login'];
$cnode['ts']= $CD['ts'];
$cnode['cmd'] = intval( $CD['cmd'] );
$cnode['data_line'] = $CD['dataset'];
$Data['records'][] = $cnode;
};
} else {
$Data['records'] = array();
};
$Data['totalCount']= count($Data['records']);
echo json_encode( $Data );
} else {
header('location: /');
};
?>

lib/controller/zuza/listServerLog.php → lib/controller/listServerLog.php

22
lib/controller/listUarts.php

@ -0,0 +1,22 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$Data = array();
$Data['success'] = false;
if( isset( $_POST['SITE'] ) ){
$SiteID = intval( $_POST['SITE'] );
$QS = "SELECT re.aux_id as id, re.device as name FROM resources re LEFT JOIN nodes no ON( re.node_id = no.id ) WHERE ( re.type=1 OR re.type=129 ) AND no.site_id={$SiteID}";
$Result = $DATABASE->Query($QS,false);
$Data['ports'] = array();
foreach( $Result as $CD ){
$cnode['uart_id'] = $CD['id'];
$cnode['uart_name'] = $CD['name'];
$Data['ports'][] = $cnode;
};
$Data['success'] = true;
};
echo json_encode( $Data );
} else {
header('location: /');
};
?>

27
lib/controller/listUsers.php

@ -0,0 +1,27 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/onvif/toto.php');
if( $CUser->Data['id'] > 1 ){
if( $CUser->Data['access'] > 5 ){
$QS = "SELECT * FROM users";
$Result = $DATABASE->Query($QS,false);
foreach( $Result as $CD ){
$cnode['id'] = intval( $CD['id'] );
$cnode['status'] = $CD['status'];
$cnode['access'] = intval( $CD['access'] );
$cnode['login'] = $CD['login'];
$cnode['created']= $CD['create_ts'];
$cnode['last'] = $CD['login_ts'];
$cnode['lang'] = intval( $CD['language'] );
$cnode['site'] = $CD['selected_site'];
$Data['users'][] = $cnode;
};
} else {
$Data['users'] = array();
};
$Data['totalCount']= count($Data['users']);
echo json_encode( $Data );
} else {
header('location: /');
};
?>

75
lib/controller/medeminfo 1.txt

@ -0,0 +1,75 @@
{
"modem":{
"3gpp":{
"enabled-locks":[],
"eps":{
"initial-bearer":{
"dbus-path":"--",
"settings":{
"apn":"--",
"ip-type":"--",
"password":"--",
"user":"--"
}
},
"ue-mode-operation":"csps-1"
},
"imei":"860147051348496",
"operator-code":"--",
"operator-name":"--",
"pco":"--",
"registration-state":"--"
},
"cdma":{
"activation-state":"--",
"cdma1x-registration-state":"--",
"esn":"--",
"evdo-registration-state":"--",
"meid":"--",
"nid":"--",
"sid":"--"
},
"dbus-path":"/org/freedesktop/ModemManager1/Modem/2",
"generic":{
"access-technologies":[],
"bearers":[],
"carrier-configuration":"ROW_Gen_VoLTE",
"carrier-configuration-revision":"05010822",
"current-bands":["egsm","dcs","utran-1","utran-5","utran-8","eutran-1","eutran-3","eutran-5","eutran-7","eutran-8","eutran-20","eutran-38","eutran-40","eutran-41"],
"current-capabilities":["gsm-umts, lte"],
"current-modes":"allowed: 2g, 3g, 4g; preferred: 4g",
"device":"/sys/devices/pci0000:00/0000:00:14.0/usb1/1-4",
"device-identifier":"370583bd437ad3b0629ff381ca0c81fc37647d4a",
"drivers":["qmi_wwan","option1"],
"equipment-identifier":"860147051348496",
"hardware-revision":"10000",
"manufacturer":"QUALCOMM INCORPORATED",
"model":"SIMCOM_SIM7600E-H",
"own-numbers":[],
"plugin":"simtech","ports":[
"cdc-wdm0 (qmi)",
"ttyUSB1 (qcdm)",
"ttyUSB2 (gps)",
"ttyUSB3 (at)",
"ttyUSB4 (at)",
"ttyUSB5 (audio)",
"wwan0 (net)"],
"power-state":"on",
"primary-port":"cdc-wdm0",
"revision":"LE20B04SIM7600M22_210318",
"signal-quality":{
"recent":"no",
"value":"0"
},
"sim":"/org/freedesktop/ModemManager1/SIM/2",
"state":"disabled",
"state-failed-reason":"--",
"supported-bands":["egsm","dcs","utran-1","utran-5","utran-8","eutran-1","eutran-3","eutran-5","eutran-7","eutran-8","eutran-20","eutran-38","eutran-40","eutran-41"],
"supported-capabilities":["gsm-umts, lte"],
"supported-ip-families":["ipv4","ipv6","ipv4v6"],
"supported-modes":["allowed: 2g; preferred: none","allowed: 3g; preferred: none","allowed: 4g; preferred: none","allowed: 2g, 3g; preferred: 3g","allowed: 2g, 3g; preferred: 2g","allowed: 2g, 4g; preferred: 4g","allowed: 2g, 4g; preferred: 2g","allowed: 3g, 4g; preferred: 4g","allowed: 3g, 4g; preferred: 3g","allowed: 2g, 3g, 4g; preferred: 4g","allowed: 2g, 3g, 4g; preferred: 3g","allowed: 2g, 3g, 4g; preferred: 2g"],
"unlock-required":"sim-pin2",
"unlock-retries":["sim-pin (3)","sim-puk (10)","sim-pin2 (3)","sim-puk2 (10)"]
}
}
}

28
lib/controller/report/node_0.js

@ -0,0 +1,28 @@
{
id: 'db_node_%%%NODEID%%%',
tools: [{
id:'gear',
handler: function(){
showServerToolBox(%%%NODEID%%%);
}
}],
frame: true,
width: 258,
height: 240,
border: false,
title: '%%%SYSSERVERNAME%%%',
items: [{
xtype: 'panel',
html: '<table width="100%"><tr><td><p id="status_%%%NODEID%%%_txt">%%%SERVERSTATUS%%%</p></td><td width="16px"><img id="status_%%%NODEID%%%_img" src="/style/icons/icons/%%%SERVERSTATUSIMG%%%"></td></tr></table>'
},{
xtype: 'panel',
html: '<table width="100%" border=0><tr><td><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_%%%NODEID%%%_donut0_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_%%%NODEID%%%_donut0_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_%%%NODEID%%%_donut0_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_%%%NODEID%%%_totalValue0">0</text><text x="50%" y="50%" class="chart-label">CPU</text></g></svg></td><td><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_%%%NODEID%%%_donut1_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_%%%NODEID%%%_donut1_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_%%%NODEID%%%_donut1_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_%%%NODEID%%%_totalValue1">0</text><text x="50%" y="50%" class="chart-label">MEM</text></g></svg></td><td><svg class="donut" width="80" height="100%" viewBox="0 0 42 42"><circle id="status_%%%NODEID%%%_donut2_segment2" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#b1c94e" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_%%%NODEID%%%_donut2_segment3" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#aaddff" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><circle id="status_%%%NODEID%%%_donut2_segment1" cx="21" cy="21" r="15.91549430918954" fill="transparent" stroke="#ce4b99" stroke-width="3" stroke-dasharray="0 100" stroke-dashoffset="25"></circle><g class="chart-text"><text x="50%" y="50%" class="chart-number" id="status_%%%NODEID%%%_totalValue2">0</text><text x="50%" y="50%" class="chart-label">DISK</text></g></svg></td></tr></table>'
},{
xtype: 'panel',
height: 80,
frame: true,
border: false,
autoScroll: true,
items: %%%MODULES%%%
}]
}

96
lib/controller/report/node_1.js

@ -0,0 +1,96 @@
{
id: 'db_node_%%%NODEID%%%',
width: 258,
height: 320,
title: '%%%NODENAME%%%',
tools: [{
id:'gear',
handler: function(){
//Ext.Msg.alert('Message', 'The Settings tool was clicked.');
showSensorToolBox( %%%NODEID%%% );
}
}],
listeners:{
afterrender: function(){
cleanup2DDraw( %%%NODEID%%% );
drawZoomLevels[%%%NODEID%%%]=100;
//Deffer
}
},
items:[{
html: '<center><img id="draw_img_%%%NODEID%%%" src="/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100"><canvas id="targ_canvas_%%%NODEID%%%" style="display: none;" onclick="DrawClicker( %%%NODEID%%%, event );" width="200" height="210"></canvas></center>',
height: '260px'
},{
id: 'status_%%%NODEID%%%',
border: true,
frame: true,
height: 36,
html: ''
}],
bbar:[{
xtype: 'button',
text: '12.5%',
enableToggle: true,
id: 'zoom_bt12_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=12;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '25%',
enableToggle: true,
id: 'zoom_bt25_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=25;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '50%',
enableToggle: true,
id: 'zoom_bt50_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=50;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '100%',
pressed: true,
enableToggle: true,
id: 'zoom_bt100_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=100;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
}]
}

39
lib/controller/report/node_10.js

@ -0,0 +1,39 @@
{
id: 'db_node_%%%NODEID%%%',
//xtype: 'portlet',
layout:'fit',
//width: 258,
//height: %%%HEIGHT%%%+40,
tools: [{
id:'gear',
handler: function(){
//editAnalogStream( %%%STREAMID%%%, 1 );
}
}],
frame: true,
draggable: false,
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
items:[{
id: 'db_node_%%%NODEID%%%_pic',
html: '',
}],
sukaMineWidth: -1,
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
if( p.sukaMineWidth != adjWidth ){
p.sukaMineWidth = adjWidth;
var XX = 32 + p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX );
};
};
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.update('<img data-enlargeable000 ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" id="img-%%%NODEID%%%" src="%%%SELURL%%%" width="100%" />');
},
afterrender: function( p ){
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx+32 );
}
}
}

61
lib/controller/report/node_11.js

@ -0,0 +1,61 @@
{
id: 'db_node_%%%NODEID%%%',
layout:'vbox',
tools: [{
id:'gear',
handler: function(){
}
}],
frame: true,
draggable: false,
collapsible: false,
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
items:[{
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div style="float: left; position: absolute; left: 30px; bottom: 50px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
}],
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
if( p.sukaMineWidth != adjWidth ){
p.sukaMineWidth = adjWidth;
var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX + 32 );
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.setHeight( XX );
};
};
},
afterrender: function( p ){
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx + 32 );
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.setHeight( xx );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop );
}
}
}

18
lib/controller/report/node_12.js

@ -0,0 +1,18 @@
{
id: 'db_node_%%%NODEID%%%',
xtype: 'portlet',
width: 258,
height: %%%HEIGHT%%%+40,
tools: [{
id:'gear',
handler: function(){
editAnalogStream( %%%STREAMID%%%, 1 );
}
}],
frame: true,
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
items:[{
html: '<img data-enlargeable000 ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" id="img-%%%NODEID%%%" src="%%%SELURL%%%" width="%%%WIDTH%%%" height="%%%HEIGHT%%%"/>',
}]
}

72
lib/controller/report/node_13 - Copy.js

@ -0,0 +1,72 @@
{
id: 'db_node_%%%NODEID%%%',
layout:'vbox',
tools: [{
id:'gear',
handler: function(){
}
}],
frame: true,
bodyStyle: 'padding: 0px;',
plr: null,
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
items:[{
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
html: ''
},{
xtype: 'spacer',
height: 3
},{
html: '<table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table>',
height: 90
}],
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
if( p.sukaMineWidth != adjWidth ){
p.sukaMineWidth = adjWidth;
var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX + 120 );
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.setHeight( XX );
};
};
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.update('<img onmouseover="ptzCtrl(\'img-%%%NODEID%%%\');" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" id="img-%%%NODEID%%%" src="%%%SELURL%%%" width="100%" />');
},
afterrender: function( p ){
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx + 120 );
var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
z.setHeight( xx );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop );
},
destroy: function( t ){
if( t.plr != null ) t.plr.dispose();
t.plr = null;
}
}
}

91
lib/controller/report/node_13.js

@ -0,0 +1,91 @@
{
id: 'db_node_%%%NODEID%%%',
layout:'vbox',
tools: [{
id:'gear',
handler: function(){
}
}],
frame: true,
draggable: false,
collapsible: false,
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
/*
{
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
//html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div style="float: left; position: absolute; left: 30px; bottom: 50px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>%%%HBTN%%%</td><td><img id="img_btn_030_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
//html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="/style/assets/no-signal.png" width="100%" /></div>'
//html: '<video id="video-%%%NODEID%%%" class="video-js" controls preload="auto" width="640" height="264" data-setup="{}"><source src="/lib/controller/data/videos/e4e18614af6059501d88ca39e76db15b.mp4" type="video/mp4"></video>'
html:''
},
*/
items:[{
xtype: 'button',
id: 'db_download_video',
scale: 'large',
enableToggle: true,
disabled: true,
text: 'Download Video File',
width: '100%',
handler: function(){
if( DownloadVideoLink!= '' ){
var link = document.createElement("a");
// If you don't know the name or want to use
// the webserver default set name = ''
//link.setAttribute('download', name );
link.setAttribute('download', '' );
link.href = DownloadVideoLink;
document.body.appendChild(link);
link.click();
link.remove();
}
}
}],
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
if( p.sukaMineWidth != adjWidth ){
p.sukaMineWidth = adjWidth;
var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX + 32 );
var z = Ext.getCmp('db_download_video');
z.setHeight( XX );
};
};
},
afterrender: function( p ){
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx + 32 );
//var z = Ext.getCmp('db_node_%%%NODEID%%%_pic');
//z.setHeight( xx - 132 );
/*
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_010_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_011_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_027_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_028_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_029_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_030_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_031_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_032_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_033_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%%NODEID%%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%%NODEID%%%').addEventListener( 'mousedown', makePtzStop );
*/
}
}
}

19
lib/controller/report/node_13.js.bk2

@ -0,0 +1,19 @@
{
id: 'db_node_%%%NODEID%%%',
xtype: 'panel',
width: 400,
height: 400,
frame: true,
title: 'Camera %%%NODEID%%%',
items:[{
html: '<video id="hls-example" class="video-js vjs-default-skin" width="400" height="300"><source type="application/x-mpegURL" src="http://192.168.0.116:8081/d7d823703f68ba05c04efdb7474c2de5/7/hls.m3u8"></video>',
}],
listeners:{
afterrender: function(){
var player = videojs('hls-example',{
autoplay: 'muted'
});
return true;
},
}
}

88
lib/controller/report/node_2.js

@ -0,0 +1,88 @@
{
id: 'db_node_%%%NODEID%%%',
width: 258,
height: 320,
title: '%%%NODENAME%%%',
listeners:{
afterrender: function(){
cleanup2DDraw( %%%NODEID%%% );
drawZoomLevels[%%%NODEID%%%]=100;
}
},
items:[{
html: '<center><img id="draw_img_%%%NODEID%%%" src="/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%"><canvas id="targ_canvas_%%%NODEID%%%" style="display: none;" width="200" height="210"></canvas></center>',
height: '260px'
},{
id: 'status_%%%NODEID%%%',
border: true,
frame: true,
height: 36,
html: ''
}],
bbar:[{
xtype: 'button',
text: '12.5%',
enableToggle: true,
id: 'zoom_bt12_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=12;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '25%',
enableToggle: true,
id: 'zoom_bt25_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=25;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '50%',
enableToggle: true,
id: 'zoom_bt50_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=50;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '100%',
pressed: true,
enableToggle: true,
id: 'zoom_bt100_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=100;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
}]
}

95
lib/controller/report/node_3 - Copy.js

@ -0,0 +1,95 @@
{
id: 'db_node_%%%NODEID%%%',
width: 258,
height: 320,
title: '%%%NODENAME%%%',
tools: [{
id:'gear',
handler: function(){
//Ext.Msg.alert('Message', 'The Settings tool was clicked.');
showSensorToolBox( %%%NODEID%%% );
}
}],
listeners:{
afterrender: function(){
cleanup2DDraw( %%%NODEID%%% );
drawZoomLevels[%%%NODEID%%%]=100;
}
},
items:[{
html: '<center><img id="draw_img_%%%NODEID%%%" src="/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100" style="cursor: crosshair;"><canvas id="targ_canvas_%%%NODEID%%%" style="display: none; cursor: crosshair;" onclick="DrawClicker( %%%NODEID%%%, event );" width="200" height="210"></canvas></center>',
height: '260px'
},{
id: 'status_%%%NODEID%%%',
border: true,
frame: true,
height: 36,
html: ''
}],
bbar:[{
xtype: 'button',
text: '12.5%',
enableToggle: true,
id: 'zoom_bt12_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=12;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '25%',
enableToggle: true,
id: 'zoom_bt25_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=25;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '50%',
enableToggle: true,
id: 'zoom_bt50_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=50;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '100%',
pressed: true,
enableToggle: true,
id: 'zoom_bt100_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=100;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
}]
}

95
lib/controller/report/node_3.js

@ -0,0 +1,95 @@
{
id: 'db_node_%%%NODEID%%%',
title: '%%%NODENAME%%%',
draggable: false,
collapsible: false,
tools: [{
id:'toggle',
handler: function( a, b, p ){
fsDrawID = %%%NODEID%%%;
fullScreen( 'div_radar_%%%NODEID%%%' );
var el = document.getElementById('draw_svgr_'+fsDrawID );
var nW = Math.floor( ( window.screen.height/window.screen.width ) * 100 );
el.removeAttribute("width");
el.setAttribute( "width", nW+'%' );
}
}],
listeners:{
afterrender: function(p){
masks_statuses[%%%NODEID%%%] = 0;
masks_exist[%%%NODEID%%%] = 0;
var W=p.getWidth();
var H=9*(W/8);
p.setHeight( H + 32 );
Ext.getCmp( 'cp_radar_%%%NODEID%%%' ).setHeight( H - 18 );
//document.getElementById('draw_svg_%%%NODEID%%%').setAttribute("width", H-45 );
set2DZoomLevel( %%%NODEID%%%, 100 );
var el = document.getElementById('div_radar_%%%NODEID%%%');
el.addEventListener( "fullscreenchange", ( evt )=>{
if( document.fullscreenElement ){
} else {
if( fsDrawID ){
var el = document.getElementById('draw_svgr_'+fsDrawID );
el.removeAttribute("width");
el.setAttribute( "width", '86%' );
fsDrawID = 0;
};
};
});
window.setTimeout( load2DDraw, 10*%%%NODEID%%%, %%%NODEID%%%, 'draw_svgr_' );
}
},
layout: 'hbox',
items:[{
id: 'cp_radar_%%%NODEID%%%',
html: '<div id="div_radar_%%%NODEID%%%" style="display: block; padding: 5px; width: \'100%\'; height: \'100%\';"><center><svg id="draw_svgr_%%%NODEID%%%" opacity="1.0" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="86%" version="1.1" onclick="select2DROI( %%%NODEID%%%, event );" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd; cursor: crosshair;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><text id="g_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(0,35,35)" x="35" y="35" fill="#FFF212" style="font: 30px sans-serif">100 m.</text><circle fill="#00A859" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,245,245)" x="245" y="245" fill="#FFF212" style="font: 10px sans-serif">12.5</text><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/></svg></center></div>',
width: '100%'
}],
bbar:[{
xtype: 'button',
text: '12.5%',
enableToggle: true,
id: 'zoom_bt12_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
set2DZoomLevel( %%%NODEID%%%, 12 );
};
}
},{
xtype: 'button',
text: '25%',
enableToggle: true,
id: 'zoom_bt25_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
set2DZoomLevel( %%%NODEID%%%, 25 );
};
}
},{
xtype: 'button',
text: '50%',
enableToggle: true,
id: 'zoom_bt50_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
set2DZoomLevel( %%%NODEID%%%, 50 );
};
}
},{
xtype: 'button',
text: '100%',
pressed: true,
enableToggle: true,
id: 'zoom_bt100_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
set2DZoomLevel( %%%NODEID%%%, 100 );
};
}
}]
}

95
lib/controller/report/node_4.js

@ -0,0 +1,95 @@
{
id: 'db_node_%%%NODEID%%%',
width: 258,
height: 320,
title: '%%%NODENAME%%%',
tools: [{
id:'gear',
handler: function(){
//Ext.Msg.alert('Message', 'The Settings tool was clicked.');
showSensorToolBox( %%%NODEID%%% );
}
}],
listeners:{
afterrender: function(){
cleanup2DDraw( %%%NODEID%%% );
drawZoomLevels[%%%NODEID%%%]=100;
}
},
items:[{
html: '<center><img id="draw_img_%%%NODEID%%%" src="/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%"><canvas id="targ_canvas_%%%NODEID%%%" style="display: none;" width="200" height="210"></canvas></center>',
height: '260px'
},{
id: 'status_%%%NODEID%%%',
border: true,
frame: true,
height: 36,
html: ''
}],
bbar:[{
xtype: 'button',
text: '12.5%',
enableToggle: true,
id: 'zoom_bt12_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=12;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=12";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '25%',
enableToggle: true,
id: 'zoom_bt25_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=25;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=25";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '50%',
enableToggle: true,
id: 'zoom_bt50_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=50;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=50";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
},{
xtype: 'button',
text: '100%',
pressed: true,
enableToggle: true,
id: 'zoom_bt100_%%%NODEID%%%',
toggleGroup: 'zoom_tg_%%%NODEID%%%',
toggleHandler: function( bt, st ){
if( st ){
drawZoomLevels[%%%NODEID%%%]=100;
var img = document.getElementById('draw_img_%%%NODEID%%%');
img.src = "/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%&AUX=100";
img.onload = function(){
cleanup2DDraw( %%%NODEID%%% );
};
};
}
}]
}

164
lib/controller/report/node_5.js

@ -0,0 +1,164 @@
{
id: 'db_node_%%%NODEID%%%',
width: 258,
height: 336,
title: '%%%NODENAME%%%',
tools: [{
id:'gear',
handler: function(){
//Ext.Msg.alert('Message', 'The Settings tool was clicked.');
showSensorToolBox( %%%NODEID%%% );
}
}],
listeners:{
beforedestroy: function(){
if( typeof nodeTHREEviewers[%%%NODEID%%%] !== 'undefined' ){
//nodeTHREEviewers[%%%NODEID%%%].container
// object.geometry.dispose(); object.material.dispose(); scene.remove( object );
stopAnimation();
nodeTHREEviewers[%%%NODEID%%%].renderer.renderLists.dispose();
delete nodeTHREEviewers[%%%NODEID%%%].renderer;
delete nodeTHREEviewers[%%%NODEID%%%].scene;
delete nodeTHREEviewers[%%%NODEID%%%].mesh;
delete nodeTHREEviewers[%%%NODEID%%%].geometry;
delete nodeTHREEviewers[%%%NODEID%%%].material;
delete nodeTHREEviewers[%%%NODEID%%%].texture;
delete nodeTHREEviewers[%%%NODEID%%%].camera;
delete nodeTHREEviewers[%%%NODEID%%%];
};
return true;
},
afterrender: function(){
//cleanupDraw( %%%NODEID%%% );
//drawZoomLevels[%%%NODEID%%%]=100;
//const panorama = new PANOLENS.ImagePanorama( '/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%' );
//const viewer = new PANOLENS.Viewer({container: 'targ_canvas_%%%NODEID%%%' });
//viewer.add( panorama );
nodeTHREEviewers[%%%NODEID%%%] = {};
nodeTHREEviewers[%%%NODEID%%%].container = document.getElementById( 'container_%%%NODEID%%%' );
nodeTHREEviewers[%%%NODEID%%%].camera = new THREE.PerspectiveCamera( 75, 1, 1, 1100 );
nodeTHREEviewers[%%%NODEID%%%].scene = new THREE.Scene();
nodeTHREEviewers[%%%NODEID%%%].geometry = new THREE.SphereGeometry( 500, 60, 40 );
// invert the geometry on the x-axis so that all of the faces point inward
nodeTHREEviewers[%%%NODEID%%%].geometry.scale( -1, 1, 1 );
nodeTHREEviewers[%%%NODEID%%%].texture = new THREE.TextureLoader().load( '/lib/controller/getDeviceDraw.php?NID=%%%NODEID%%%' );
nodeTHREEviewers[%%%NODEID%%%].material = new THREE.MeshBasicMaterial( { map: nodeTHREEviewers[%%%NODEID%%%].texture } );
nodeTHREEviewers[%%%NODEID%%%].mesh = new THREE.Mesh( nodeTHREEviewers[%%%NODEID%%%].geometry, nodeTHREEviewers[%%%NODEID%%%].material );
nodeTHREEviewers[%%%NODEID%%%].scene.add( nodeTHREEviewers[%%%NODEID%%%].mesh );
nodeTHREEviewers[%%%NODEID%%%].scene.add( l3dMapOverlayMesh );
nodeTHREEviewers[%%%NODEID%%%].renderer = new THREE.WebGLRenderer();
nodeTHREEviewers[%%%NODEID%%%].renderer.setPixelRatio( 1 );
nodeTHREEviewers[%%%NODEID%%%].renderer.setSize( nodeTHREEviewers[%%%NODEID%%%].container.clientWidth, 200 );
nodeTHREEviewers[%%%NODEID%%%].container.appendChild( nodeTHREEviewers[%%%NODEID%%%].renderer.domElement );
nodeTHREEviewers[%%%NODEID%%%].container.style.touchAction = 'none';
nodeTHREEviewers[%%%NODEID%%%].container.myVID = %%%NODEID%%%;
nodeTHREEviewers[%%%NODEID%%%].container.addEventListener( 'pointerdown', onPointerDown );
nodeTHREEviewers[%%%NODEID%%%].container.addEventListener( 'wheel', onDocumentMouseWheel );
nodeTHREEviewers[%%%NODEID%%%].targets = new Array();
nodeTHREEviewers[%%%NODEID%%%].targetShowCopunter = 0;
nodeTHREEviewers[%%%NODEID%%%].targetIndex = 0;
//addl3dTarget( %%%NODEID%%%, 200, Math.PI/4, Math.PI/4 );
//addl3dTarget( %%%NODEID%%%, 150, 0, 0 );
//document.addEventListener( 'wheel', onDocumentMouseWheel );
/*
container.addEventListener( 'dragover', function ( event ) {
event.preventDefault();
event.dataTransfer.dropEffect = 'copy';
} );
container.addEventListener('dragenter', function () {
document.body.style.opacity = 0.5;
} );
container.addEventListener('dragleave', function () {
document.body.style.opacity = 1;
} );
container.addEventListener('drop', function ( event ) {
event.preventDefault();
const reader = new FileReader();
reader.addEventListener( 'load', function ( event ) {
material.map.image.src = event.target.result;
material.map.needsUpdate = true;
} );
reader.readAsDataURL( event.dataTransfer.files[ 0 ] );
document.body.style.opacity = 1;
} );
*/
/*
document.addEventListener( 'dragover', function ( event ) {
event.preventDefault();
event.dataTransfer.dropEffect = 'copy';
} );
document.addEventListener( 'dragenter', function () {
document.body.style.opacity = 0.5;
} );
document.addEventListener( 'dragleave', function () {
document.body.style.opacity = 1;
} );
document.addEventListener( 'drop', function ( event ) {
event.preventDefault();
const reader = new FileReader();
reader.addEventListener( 'load', function ( event ) {
material.map.image.src = event.target.result;
material.map.needsUpdate = true;
} );
reader.readAsDataURL( event.dataTransfer.files[ 0 ] );
document.body.style.opacity = 1;
} );
*/
//animateTargets();
animate();
//
//window.addEventListener( 'resize', onWindowResize );
}
},
items:[{
html: '<center><div id="container_%%%NODEID%%%"></div></center>',
height: 210
},{
id: 'status_%%%NODEID%%%',
border: true,
frame: true,
height: 36,
html: ''
},{ xtype: 'spacer', height: 3 },{
id: 'det_status_%%%NODEID%%%',
border: true,
frame: true,
height: 46,
html: '<canvas id="status_canvas_%%%NODEID%%%" style="display: none;" width="240" height="43"></canvas>'
}]
}

16
lib/controller/report/tpl.js

@ -0,0 +1,16 @@
[{
columnWidth: '320px',
style:'padding:10px 0 10px 10px',
items:[
%%%ITEMS%%%
]
},{
columnWidth: '320px',
style:'padding:10px 0 10px 10px'
},{
columnWidth: '320px',
style:'padding:10px 0 10px 10px'
},{
columnWidth: '320px',
style:'padding:10px 0 10px 10px'
}]

124
lib/controller/updateUser.php

@ -0,0 +1,124 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$DATA = array();
$DATA['success'] = false;
if( $CUser->Data['access'] > 4 ){
$COP = intval( $_POST['OP'] );
switch( $COP ){
case 0:{
//add new
$NLO = $DATABASE->escape( $_POST['NLO'] );
$PWD = $_POST['PW1'];
$RWD = $_POST['PW2'];
$ACC = intval($_POST['ACC']);
if( $PWD == '' ){
$DATA['msg'] = 'No Password defined!';
} else {
if( $_POST['NLO'] == '' ){
$DATA['msg'] = 'No Login defined!';
} else {
if( $PWD == $RWD ){
$M5 = md5( $PWD );
$CTS = time();
$QS="INSERT INTO `users`(`create_ts`,`login`,`pwdMD5`,`status`,`access`) VALUES ( {$CTS},'{$NLO}','{$M5}','A',{$ACC})";
$DATABASE->Query( $QS );
$DATA['success'] = true;
} else {
$DATA['msg'] = 'Passwords does not match!';
};
};
};
break;
};
case 1:{
//change old
$UID = intval($_POST['SUID']);
if( $UID ){
$OLO = $DATABASE->escape( $_POST['OLO'] );
$NLO = $DATABASE->escape( $_POST['NLO'] );
$PWD = $_POST['PW1'];
$RWD = $_POST['PW2'];
$ACC = intval($_POST['ACC']);
if( $PWD == '' ){
$QS="UPDATE `users` SET `login`='{$NLO}', `access`={$ACC} WHERE id={$UID}";
$DATABASE->Query( $QS );
$DATA['success'] = true;
} else {
if( $PWD == $RWD ){
$M5 = md5( $PWD );
$QS="UPDATE `users` SET `login`='{$NLO}', `pwdMD5`='{$M5}', `access`={$ACC} WHERE id={$UID}";
$DATABASE->Query( $QS );
$DATA['success'] = true;
} else {
$DATA['msg'] = 'Passwords does not match!';
};
};
} else {
$DATA['msg'] = 'Wrong User ID!';
};
break;
};
case 2:{
$UID = intval($_POST['SUID']);
if( $UID ){
if( $UID != $CUser->Data['id'] ){
if( $UID > 1 ){
$QS="UPDATE `users` SET `status`='D' WHERE id={$UID}";
$DATABASE->Query( $QS );
$DATA['success'] = true;
} else {
$DATA['msg'] = 'You Can not change Guest account!';
};
} else {
$DATA['msg'] = 'You Can not block yoreself account!';
};
} else {
$DATA['msg'] = 'Wrong User ID!';
};
break;
};
case 3:{
$UID = intval($_POST['SUID']);
if( $UID ){
if( $UID > 1 ){
$QS="UPDATE `users` SET `status`='A' WHERE id={$UID}";
$DATABASE->Query( $QS );
$DATA['success'] = true;
} else {
$DATA['msg'] = 'You Can not change Guest account!';
};
} else {
$DATA['msg'] = 'Wrong User ID!';
};
break;
};
case 4:{
$UID = intval($_POST['SUID']);
if( $UID ){
if( $UID != $CUser->Data['id'] ){
if( $UID > 1 ){
$QS="DELETE FROM `users` WHERE id={$UID}";
$DATABASE->Query( $QS );
$DATA['success'] = true;
} else {
$DATA['msg'] = 'You Can not remove Guest account!';
};
} else {
$DATA['msg'] = 'You Can not remove yoreself account!';
};
} else {
$DATA['msg'] = 'Wrong User ID!';
};
break;
};
default: $DATA['msg'] = 'Wrong Operation!'; break;
};
} else {
$DATA['msg'] = 'Access Permition Denied!';
};
echo json_encode( $DATA );
exit();
};
header('location: /');
?>

125
lib/controller/uploadDeviceMask.php

@ -0,0 +1,125 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$NodeID = intval($_POST['NID']);
//$SiteID = intval($_POST['SITE']);
$LayerID = intval($_POST['MID']);
$LRFID = intval($_POST['LID']);
$SERIAL = json_decode( $_POST['MDTA'] );
$MHEI = intval($_POST['MIH']);
$MWID = intval($_POST['MIW']);
$SHX = intval($_POST['MSHX']);
$SHY = intval($_POST['MSHY']);
if( isset( $_POST['DSTD'] ) ) $DSTS = intval( $_POST['DSTD'] ); else $DSTS = 1;
$QS = "SELECT * FROM nodes WHERE id={$NodeID} ";
$Data = array();
$NPC = 0;
$SCHEDULE_JOB = 0; // NOJOB
$result = $DATABASE->Query( $QS, false );
if( $SHX == $SHY ) $Process = 0; else $Process = 1;
if( count( $result ) && $MHEI ){
if( $Process == 1 ){
$SCALE = 288.0 / floatval( $MHEI );
} else {
$SCALE = 4096.0 / floatval( $MHEI );
};
$T = $result[0];
$AID = $T['aux_id'];
$QS = "SELECT id FROM `lrf_masks` WHERE `sensor_id`={$AID} AND `lrf_id`={$LRFID} AND `layer`={$LayerID}";
$result = $DATABASE->Query( $QS, false );
$CV = array();
$MID = 0;
if( count($result) == 0 ){ // No Masks Where Defined
$QS = "INSERT INTO `lrf_masks` (`sensor_id`,`lrf_id`,`layer`) VALUES ({$AID},{$LRFID},{$LayerID})";
$DATABASE->Query( $QS, false );
$MID = $DATABASE->getLastInsertID();
} else {
$MID = $result[0]['id'];
$QS = "SELECT * FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}";
$ZA = $DATABASE->Query( $QS );
foreach( $ZA as $A ){
$QS = "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$A['id']}";
$DATABASE->Query( $QS );
};
$QS = "DELETE FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}";
$DATABASE->Query( $QS );
};
$SCHEDULE_JOB = 1; // Clear Mask
foreach( $SERIAL[0][1]->children as $CCC ){
$R = $CCC[1]->fillColor[0] * 255;
$G = $CCC[1]->fillColor[1] * 255;
$B = $CCC[1]->fillColor[2] * 255;
$QS = "INSERT INTO `lrf_mask_vertexes` (`mask_id`,`r`,`g`,`b`) VALUES ({$MID},{$R},{$G},{$B})";
$DATABASE->Query( $QS, false );
$VID = $DATABASE->getLastInsertID();
foreach( $CCC[1]->segments as $SS ){
if( $Process == 1 ){
if( count( $SS ) == 2 ){
$X = intval( $SCALE * floatval( intval( $SS[0] ) - $SHX ) );
$Y = intval( $SCALE * floatval( intval( $SS[1] ) - $SHY ) );
} else {
$X = intval( $SCALE * floatval( intval( $SS[0][0] ) - $SHX ) );
$Y = intval( $SCALE * floatval( intval( $SS[0][1] ) - $SHY ) );
};
if( $X < 0 ) $X = 0;
if( $X > 2304 ) $X = 2304;
if( $Y < 0 ) $Y = 0;
if( $Y > 288 ) $Y = 288;
} else {
if( count( $SS ) == 2 ){
$X = intval( $SCALE * floatval( intval( $SS[0] ) - $SHX ) ) - 2047;
$Y = intval( $SCALE * floatval( intval( $SS[1] ) - $SHY ) ) - 2047;
} else {
$X = intval( $SCALE * floatval( intval( $SS[0][0] ) - $SHX ) ) - 2047;
$Y = intval( $SCALE * floatval( intval( $SS[0][1] ) - $SHY ) ) - 2047;
};
if( $X < -2047 ) $X = -2047;
if( $X > 2047 ) $X = 2047;
if( $Y < -2047 ) $Y = -2047;
if( $Y > 2047 ) $Y = 2047;
};
$QS = "INSERT INTO `lrf_mask_vertex_points` (`vertex_id`,`x`,`y`) VALUES ({$VID},{$X},{$Y}) ";
$DATABASE->Query( $QS, false );
$NPC++;
$SCHEDULE_JOB = 2; // Update - Set Mask
};
};
switch( $SCHEDULE_JOB ){
case 1:{
// Clear Mask No Points.
$QS = "SELECT * FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}";
$ZA = $DATABASE->Query( $QS );
foreach( $ZA as $A ){
$QS = "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id`={$A['id']}";
$DATABASE->Query( $QS );
};
$QS = "DELETE FROM `lrf_mask_vertexes` WHERE `mask_id`={$MID}";
$DATABASE->Query( $QS );
$QS = "DELETE FROM `lrf_masks` WHERE `id`={$MID}";
$DATABASE->Query( $QS );
break;
};
case 2:{
// Don't Send To Device
if( $DSTS == 0 ){
$CMD = 67;//60+$LayerID;
$QS = "INSERT INTO `nodes_qcq` (`node_id`,`cmd`,`parameter`) VALUES ({$NodeID},{$CMD},'{$LRFID}')";
//echo $QS;
$DATABASE->Query( $QS, false );
};
break;
};
};
$Data[] = $CV;
};
if( $NPC > 2 ){
// Need to shcedule Rasterisation and send to device
};
echo json_encode( $Data );
exit();
};
header('location: /');
?>

63
lib/controller/uploadToDevice.php

@ -0,0 +1,63 @@
<?php
require_once('../ajax_asm.php');
// the response function
function verbose( $ok=1,$info=""){
// failure to upload throws 400 error
if( $ok==0 ){
http_response_code(400);
};
die(json_encode(["ok"=>$ok, "info"=>$info]));
};
if( isset( $_GET['DID'] ) ) {
$DID = intval( $_GET['DID'] );
} else {
verbose( 0,"No Device ID Supplied!");
};
// invalid upload
if( empty( $_FILES ) || $_FILES['file']['error'] ){
verbose( 0, "Failed to move uploaded file.[" . $_FILES['file']['error'] . "]" );
};
// upload destination
//$filePath = __DIR__ . DIRECTORY_SEPARATOR . "../../vault/working_dir/uploads";
$filePath = $SYSPath . 'lib/controller/data/uploads';
if( !file_exists($filePath) ){
if (!mkdir($filePath, 0777, true)) {
verbose(0, "Failed to create $filePath");
};
};
$rfn = isset($_REQUEST["name"]) ? $_REQUEST["name"] : $_FILES["file"]["name"];
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : $_FILES["file"]["name"];
$filePath = $filePath . DIRECTORY_SEPARATOR . $fileName;
// dealing with the chunks
$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;
$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 0;
$out = @fopen("{$filePath}.part", $chunk == 0 ? "wb" : "ab");
if( $out ) {
$in = @fopen($_FILES['file']['tmp_name'], "rb");
if( $in ){
while( $buff = fread( $in, 4096 ) ){
fwrite($out, $buff);
};
} else {
verbose(0, "Failed to open input stream");
};
@fclose($in);
@fclose($out);
@unlink($_FILES['file']['tmp_name']);
} else {
verbose(0, "Failed to open output stream");
};
// check if file was uploaded
if (!$chunks || $chunk == $chunks - 1) {
$MD5 = md5_file( "{$filePath}.part" );
$Dest = $SYSPath . 'lib/controller/data/uploads/'.$MD5;
rename("{$filePath}.part", $Dest );
$QS = "INSERT INTO `lrf_uploads`( `sensor_id`, `ts`, `status`, `md5`, `file`, `issue_reset`) VALUES({$DID}, strftime('%s'), -1, '{$MD5}', '{$rfn}', 0 ) ON CONFLICT(`md5`) DO UPDATE SET `status`=-1, `ts`=strftime('%s'), `issue_reset`=0";
$DATABASE->Query( $QS );
//if( createNewTask( 3, $fileName, 'Handle Upload File' ) == 0 ){
// unlink( $filePath );
// verbose(0, "Failed to create new Task");
//};
};
verbose(1, "Upload OK");
?>

1
lib/controller/vfd.txt

@ -0,0 +1 @@
'<center><svg id="me_svg_'+id+'" opacity="0.3" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" height="100%" version="1.1" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd; cursor: crosshair;" viewBox="0 0 574 574" xmlns:xlink="http://www.w3.org/1999/xlink"><text id="g_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(0,35,35)" x="35" y="35" fill="#FFF212" style="font: 30px sans-serif">100 m.</text><circle fill="#00A859" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/><circle id="r50_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="3.94741" cx="287" cy="287" r="142"/><text id="50_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,140,140)" x="140" y="140" fill="#FFF212" style="font: 25px sans-serif">50</text><circle id="r25_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="2.96042" cx="287" cy="287" r="71"/><text id="25_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,210,210)" x="210" y="210" fill="#FFF212" style="font: 15px sans-serif">25</text><circle id="r12_%%%NODEID%%%" fill="none" stroke="#FFF212" stroke-width="1.47993" cx="287" cy="287" r="34"/><text id="12_txt_%%%NODEID%%%" text-anchor="left" transform="rotate(45,245,245)" x="245" y="245" fill="#FFF212" style="font: 10px sans-serif">12.5</text><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="287" y1="3" x2="287" y2="571"/><line fill="none" stroke="#FFF212" stroke-width="3.94741" x1="3" y1="287" x2="571" y2="287"/><circle fill="none" stroke="#373435" stroke-width="5.92139" cx="287" cy="287" r="284"/></svg></center>'

15
lib/defines.php

@ -2,14 +2,25 @@
$ARGUS_WEB_VERSION = trim( file_get_contents( '/srv/www/web/lib/version.var' ) );
$SSL_INSTALLLED = false;
if( $_SERVER['SERVER_PORT'] == 80 ){
$WEBPath='http://' . $_SERVER['HTTP_HOST'] . '/';//$_SERVER['SERVER_NAME'] . '/';
if( $SSL_INSTALLLED ){
header( 'location: https://'.$_SERVER['SERVER_ADDR'].'/'.$_SERVER['QUERY_STRING'] );
exit();
};
} else {
$WEBPath='https://' . $_SERVER['HTTP_HOST'] . '/';//$_SERVER['SERVER_NAME'] . '/';
};
$SYSPath = '/srv/www/web/';
$ShowImagesLocal=false;
$ShowThumbnailsLocal=true;
$ShowAdw=true;
$SaveLocal=false;
$MailAgent='SENDMAIL';
$CGP_SubmitPath='../Submitted/';
$WEBPath='http://' . $_SERVER['HTTP_HOST'] . '/';//$_SERVER['SERVER_NAME'] . '/';
$DBCacheDir=$SYSPath . 'cache';
$MinimalSize=640000;

2
lib/error.log

@ -1 +1 @@
/var/log/apache2/error.log
/var/log/nginx/error.log

346
lib/javascript/jsapi_dynamic/loaders.html

@ -0,0 +1,346 @@
<!-- Loader1 -->
<svg version="1.1" id="L1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<circle fill="none" stroke="#fff" stroke-width="6" stroke-miterlimit="15" stroke-dasharray="14.2472,14.2472" cx="50" cy="50" r="47" >
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="5s"
from="0 50 50"
to="360 50 50"
repeatCount="indefinite" />
</circle>
<circle fill="none" stroke="#fff" stroke-width="1" stroke-miterlimit="10" stroke-dasharray="10,10" cx="50" cy="50" r="39">
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="5s"
from="0 50 50"
to="-360 50 50"
repeatCount="indefinite" />
</circle>
<g fill="#fff">
<rect x="30" y="35" width="5" height="30">
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 5 ; 0 -5; 0 5"
repeatCount="indefinite"
begin="0.1"/>
</rect>
<rect x="40" y="35" width="5" height="30" >
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 5 ; 0 -5; 0 5"
repeatCount="indefinite"
begin="0.2"/>
</rect>
<rect x="50" y="35" width="5" height="30" >
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 5 ; 0 -5; 0 5"
repeatCount="indefinite"
begin="0.3"/>
</rect>
<rect x="60" y="35" width="5" height="30" >
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 5 ; 0 -5; 0 5"
repeatCount="indefinite"
begin="0.4"/>
</rect>
<rect x="70" y="35" width="5" height="30" >
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 5 ; 0 -5; 0 5"
repeatCount="indefinite"
begin="0.5"/>
</rect>
</g>
</svg>
<!-- Loader 2 -->
<svg version="1.1" id="L2" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<circle fill="none" stroke="#fff" stroke-width="4" stroke-miterlimit="10" cx="50" cy="50" r="48"/>
<line fill="none" stroke-linecap="round" stroke="#fff" stroke-width="4" stroke-miterlimit="10" x1="50" y1="50" x2="85" y2="50.5">
<animateTransform
attributeName="transform"
dur="2s"
type="rotate"
from="0 50 50"
to="360 50 50"
repeatCount="indefinite" />
</line>
<line fill="none" stroke-linecap="round" stroke="#fff" stroke-width="4" stroke-miterlimit="10" x1="50" y1="50" x2="49.5" y2="74">
<animateTransform
attributeName="transform"
dur="15s"
type="rotate"
from="0 50 50"
to="360 50 50"
repeatCount="indefinite" />
</line>
</svg>
<!-- Loader 3 -->
<svg version="1.1" id="L3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
<circle fill="none" stroke="#fff" stroke-width="4" cx="50" cy="50" r="44" style="opacity:0.5;"/>
<circle fill="#fff" stroke="#e74c3c" stroke-width="3" cx="8" cy="54" r="6" >
<animateTransform
attributeName="transform"
dur="2s"
type="rotate"
from="0 50 48"
to="360 50 52"
repeatCount="indefinite" />
</circle>
</svg>
<!-- Loader 4 -->
<svg version="1.1" id="L4" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
<circle fill="#fff" stroke="none" cx="6" cy="50" r="6">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.1"/>
</circle>
<circle fill="#fff" stroke="none" cx="26" cy="50" r="6">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.2"/>
</circle>
<circle fill="#fff" stroke="none" cx="46" cy="50" r="6">
<animate
attributeName="opacity"
dur="1s"
values="0;1;0"
repeatCount="indefinite"
begin="0.3"/>
</circle>
</svg>
<!-- Loader 5 -->
<svg version="1.1" id="L5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
<circle fill="#fff" stroke="none" cx="6" cy="50" r="6">
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 15 ; 0 -15; 0 15"
repeatCount="indefinite"
begin="0.1"/>
</circle>
<circle fill="#fff" stroke="none" cx="30" cy="50" r="6">
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 10 ; 0 -10; 0 10"
repeatCount="indefinite"
begin="0.2"/>
</circle>
<circle fill="#fff" stroke="none" cx="54" cy="50" r="6">
<animateTransform
attributeName="transform"
dur="1s"
type="translate"
values="0 5 ; 0 -5; 0 5"
repeatCount="indefinite"
begin="0.3"/>
</circle>
</svg>
<!-- Loader 6 -->
<svg version="1.1" id="L6" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<rect fill="none" stroke="#fff" stroke-width="4" x="25" y="25" width="50" height="50">
<animateTransform
attributeName="transform"
dur="0.5s"
from="0 50 50"
to="180 50 50"
type="rotate"
id="strokeBox"
attributeType="XML"
begin="rectBox.end"/>
</rect>
<rect x="27" y="27" fill="#fff" width="46" height="50">
<animate
attributeName="height"
dur="1.3s"
attributeType="XML"
from="50"
to="0"
id="rectBox"
fill="freeze"
begin="0s;strokeBox.end"/>
</rect>
</svg>
<!-- Loader 7 -->
<svg version="1.1" id="L7" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<path fill="#fff" d="M31.6,3.5C5.9,13.6-6.6,42.7,3.5,68.4c10.1,25.7,39.2,38.3,64.9,28.1l-3.1-7.9c-21.3,8.4-45.4-2-53.8-23.3
c-8.4-21.3,2-45.4,23.3-53.8L31.6,3.5z">
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="2s"
from="0 50 50"
to="360 50 50"
repeatCount="indefinite" />
</path>
<path fill="#fff" d="M42.3,39.6c5.7-4.3,13.9-3.1,18.1,2.7c4.3,5.7,3.1,13.9-2.7,18.1l4.1,5.5c8.8-6.5,10.6-19,4.1-27.7
c-6.5-8.8-19-10.6-27.7-4.1L42.3,39.6z">
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="1s"
from="0 50 50"
to="-360 50 50"
repeatCount="indefinite" />
</path>
<path fill="#fff" d="M82,35.7C74.1,18,53.4,10.1,35.7,18S10.1,46.6,18,64.3l7.6-3.4c-6-13.5,0-29.3,13.5-35.3s29.3,0,35.3,13.5
L82,35.7z">
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="2s"
from="0 50 50"
to="360 50 50"
repeatCount="indefinite" />
</path>
</svg>
<!-- Loader 8 -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<rect fill="#fff" width="3" height="100" transform="translate(0) rotate(180 3 50)">
<animate
attributeName="height"
attributeType="XML"
dur="1s"
values="30; 100; 30"
repeatCount="indefinite"/>
</rect>
<rect x="17" fill="#fff" width="3" height="100" transform="translate(0) rotate(180 20 50)">
<animate
attributeName="height"
attributeType="XML"
dur="1s"
values="30; 100; 30"
repeatCount="indefinite"
begin="0.1s"/>
</rect>
<rect x="40" fill="#fff" width="3" height="100" transform="translate(0) rotate(180 40 50)">
<animate
attributeName="height"
attributeType="XML"
dur="1s"
values="30; 100; 30"
repeatCount="indefinite"
begin="0.3s"/>
</rect>
<rect x="60" fill="#fff" width="3" height="100" transform="translate(0) rotate(180 58 50)">
<animate
attributeName="height"
attributeType="XML"
dur="1s"
values="30; 100; 30"
repeatCount="indefinite"
begin="0.5s"/>
</rect>
<rect x="80" fill="#fff" width="3" height="100" transform="translate(0) rotate(180 76 50)">
<animate
attributeName="height"
attributeType="XML"
dur="1s"
values="30; 100; 30"
repeatCount="indefinite"
begin="0.1s"/>
</rect>
</svg>
<!-- Loader 9 -->
<svg version="1.1" id="L9" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
<rect x="20" y="50" width="4" height="10" fill="#fff">
<animateTransform attributeType="xml"
attributeName="transform" type="translate"
values="0 0; 0 20; 0 0"
begin="0" dur="0.6s" repeatCount="indefinite" />
</rect>
<rect x="30" y="50" width="4" height="10" fill="#fff">
<animateTransform attributeType="xml"
attributeName="transform" type="translate"
values="0 0; 0 20; 0 0"
begin="0.2s" dur="0.6s" repeatCount="indefinite" />
</rect>
<rect x="40" y="50" width="4" height="10" fill="#fff">
<animateTransform attributeType="xml"
attributeName="transform" type="translate"
values="0 0; 0 20; 0 0"
begin="0.4s" dur="0.6s" repeatCount="indefinite" />
</rect>
</svg>
<!-- Loader 10 -->
<svg version="1.1" id="L9" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" enable-background="new 0 0 0 0" xml:space="preserve">
<path fill="#fff" d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50">
<animateTransform
attributeName="transform"
attributeType="XML"
type="rotate"
dur="1s"
from="0 50 50"
to="360 50 50"
repeatCount="indefinite" />
</path>
</svg>
<!-- follow me template -->
<div class="made-with-love">
Made with
<i>?</i> by
<a target="_blank" href="https://codepen.io/nikhil8krishnan">Nikhil Krishnan</a>
</div>

828
lib/javascript/jsapi_dynamic/mojo_dashboard.js
File diff suppressed because it is too large
View File

lib/javascript/jsapi_dynamic/rgoose_global_vars.js → lib/javascript/jsapi_dynamic/mojo_global_vars.js

lib/javascript/jsapi_dynamic/rgoose_logs.js → lib/javascript/jsapi_dynamic/mojo_logs.js

15
lib/javascript/jsapi_dynamic/mojo_main.js

@ -122,12 +122,12 @@ function failureAJAXFunction( responce, opts ){
tlInterval = null;
};
playSound();
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
//Ext.Msg.show({
// title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
// msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
// buttons: Ext.Msg.OK,
// icon: Ext.MessageBox.INFO
//});
doLogout();
};
@ -301,6 +301,7 @@ Ext.onReady(function(){
doCheckWindowSize();
loadSystemDevices();
gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 );
NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25});
//window.onresize = doCheckWindowSize;
@ -406,7 +407,7 @@ Ext.onReady(function(){
border: false,
margins: {top:5, right:0, bottom:0, left:0},
width: PanelW-700,
html: '<p style="font-family: \'Ubuntu\';font-size: 24px;">'+ap_title+'</p>'
html: '<p style="font-family: \'Ubuntu\', \'Arial\';font-size: 24px;">'+ap_title+'</p>'
},{
xtype: 'spacer',
width: 10

94
lib/javascript/jsapi_dynamic/mojo_metro.js

@ -0,0 +1,94 @@
//<?php require_once('../../js_asm.php'); ?>
function loadMetroControlUpper(){
Ext.Ajax.request({
url: '/lib/controller/getMetroUpperSensorEditor.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
var tComp = Ext.getCmp('main_content');
if( data.status == 'ok' ){
if( tComp!= null ){
var content = Ext.decode( data.content );
tComp.removeAll( true );
tComp.add( content );
tComp.doLayout();
};
} else {
if( tComp!= null ){
tComp.removeAll( true );
tComp.add( data );
tComp.doLayout();
};
};
},
failure: function(){
}
});
};
function loadMetroControlBottom(){
Ext.Ajax.request({
url: '/lib/controller/getMetroBottomSensorEditor.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
var tComp = Ext.getCmp('main_content');
if( data.status == 'ok' ){
if( tComp!= null ){
var content = Ext.decode( data.content );
tComp.removeAll( true );
tComp.add( content );
tComp.doLayout();
};
} else {
if( tComp!= null ){
tComp.removeAll( true );
tComp.add( data );
tComp.doLayout();
};
};
},
failure: function(){
}
});
};
function loadMetroControlFusion(){
Ext.Ajax.request({
url: '/lib/controller/getMetroFusionEditor.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
var tComp = Ext.getCmp('main_content');
if( data.status == 'ok' ){
if( tComp!= null ){
var content = Ext.decode( data.content );
tComp.removeAll( true );
tComp.add( content );
tComp.doLayout();
};
} else {
if( tComp!= null ){
tComp.removeAll( true );
tComp.add( data );
tComp.doLayout();
};
};
},
failure: function(){
}
});
};

309
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -10,6 +10,107 @@ var tlItems = new vis.DataSet();
var selecredActiveSourceFilter = 0;
var ActiveZones = null;
var rep_store_id = 0;
var rep_array = new Array();
var rep_store = new Ext.data.JsonStore({
autoDestroy: false,
storeId: 'log_store',
//idIndex: 0,
idProperty: 'id',
fields: [
{name: 'id', type: 'int' },
{name: 'node_id', type: 'int' },
{name: 'node_name', type: 'string' },
{name: 'dts', type: 'string'},
{name: 'ts', type: 'int'},
{name: 'ms', type: 'string'},
{name: 'type', type: 'int'},
{name: 'range', type: 'string'},
{name: 'az', type: 'string'},
{name: 'el', type: 'string'},
{name: 'r', type: 'int'},
{name: 'width', type: 'int'},
{name: 'video_id',type: 'int'}
//{name: 'lat', type: 'float'},
//{name: 'lon', type: 'float'},
//{name: 'alt', type: 'float'},
//{name: 'area', type: 'float'},
//{name: 'video', type: 'string'},
//{name: 'v_cpoint', type: 'int'}
]
});
function rep_sn_Renderer( value, meta, record ){
//Must be set according to events
var kaka = record.data.node_id % 3;
return '<div class="log_line_' + kaka + '">'+value+'</div>';
};
function rep_et_Renderer( value, meta, record ){
var kaka = record.data.node_id % 3;
switch( value ){
case 6: ov = 'Device Enters Into Study Mode'; break;
case 7: ov = 'Device Is BUSY'; break;
case 8: ov = 'Flip Complete'; break;
case 9: ov = 'Scan Complete'; break;
case 12: ov = 'Black 2D Target'; break;
case 13: ov = 'White 2D Target'; break;
case 36: ov = 'Region Of Interest'; break;
case 39: ov = '[Train Filter] Check Target'; break;
case 40: ov = '[Train Filter] Upper Sensor Detection'; break;
case 41: ov = '[Train Filter] Bottom Sensor Detection'; break;
case 42: ov = '[Train Filter] Train Detected'; break;
case 43: ov = '[Train Filter] Train Updated'; break;
case 44: ov = '[Train Filter] Suspicious Activity'; break;
case 45: ov = '[Train Filter] Suspicious NACK'; break;
case 46: ov = '[Train Filter] Regular Detection'; break;
case 47: ov = '[Train Filter] Detection Disabled'; break;
case 48: ov = '[Train Filter] Suspicious Detection'; break;
case 49: ov = '[Train Filter] Differential Detection'; break;
case 52: ov = 'Event Started'; break;
case 53: ov = 'Event Ended'; break;
case 54: ov = 'Event Closed Manual'; break;
default: ov = 'Event ['+value+']';
};
return '<div class="log_line_' + kaka + '">'+ov+'</div>';
};
var rep_ColModel_ops = {
columns: [
{header: "Time", width: 100, fixed: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'dts' },
{header: "Source", width: 100, renderer: rep_sn_Renderer, align: 'left', css: 'vertical-align: middle;', dataIndex: 'node_name' },
{header: "Type", width: 180, renderer: rep_et_Renderer, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'type' },
{header: "Range", width: 100, dataIndex: 'range' },
{header: "Azimuth", width: 100, dataIndex: 'az' },
{header: "Width", width: 100, dataIndex: 'width' },
],
defaults: {
sortable: false,
fixed: true,
menuDisabled: true,
width: 100
}
};
var rep_SelModel_ops = {
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec ) {
loadEventData( rec.data );
//alert( rec.data.id );
//loadEventProperties( rec.data );
//SelectedEvent = rec.data.id;
//alert( SelectedEvent );
//var CB = Ext.getCmp('con_to_src');
//CB.enable();
//selectedArchiveRecord = rec;
//if( rec.data.bk_type!=3 ){
//
//} else {
//
//};
}
}
};
var selectedMarkerIcon = L.icon({
iconUrl: '/style/assets/cursor.png',
iconSize: [32, 32],
@ -188,13 +289,14 @@ function BuildCalendar( ){
};
function loadCalendarDates(){
function loadCalendarDates(){
Ext.MessageBox.wait("<?=$Labels->GetLabel('_Loading_Calo_');?>","<?=$Labels->GetLabel('_Please_Wait_');?>",{
width: '100%',
hidden: true,
progress: true,
closable: false
});
ReportLayoutLoadded = false;
Ext.Ajax.request({
url: '/lib/controller/getEventDates.php',
params: {
@ -715,6 +817,75 @@ function loadEventProperties( EventRec ){
tPanel.doLayout();
};
var DownloadVideoLink = '';
function loadEventData( record ){
markEventOnRadar( record.node_id, record.az, record.r );
if( record.video_id > 0 ){
Ext.Ajax.request({
url: '/lib/controller/getVideoInfo.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
VID: record.video_id
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var t = Ext.getCmp('db_download_video');
DownloadVideoLink = '/lib/controller/data/videos/'+data.md5+'.'+data.ext;
if( t != undefined ){
t.toggle( true, true );
t.enable();
}
}
});
} else {
var t = Ext.getCmp('db_download_video');
if( t != undefined ){
t.toggle( false, true );
t.disable();
}
};
};
function markEventOnRadar( rid, az, range ){
var csvg = document.getElementById( 'draw_svgr_' + rid );
if( csvg!= undefined ){
var roi = csvg.getElementById( "roi" );
if( roi != null ) csvg.removeChild( roi );
var bBox = csvg.getBBox();
var max = 2048;
switch( drawZoomLevels[rid] ){
case 50: max = 1024; break;
case 25: max = 512; break;
case 12: max = 256; break;
};
if( range < max ){
var ak = 2.0*Math.PI/360;
var ok = 1.0/35;
var rk = bBox.width / ( max * 2 );
var cpx = bBox.width / 2.0;
var cpy = bBox.height / 2.0;
x = cpx + rk * range * Math.cos( az*ak );
y = cpy - rk * range * Math.sin( az*ak );
var cc = document.createElementNS('http://www.w3.org/2000/svg', "circle");
var rz = bBox.width / csvg.clientWidth;
cc.setAttributeNS(null, "cx", x );
cc.setAttributeNS(null, "cy", y );
cc.setAttributeNS(null, "r", ""+(6*rz)+"" );
cc.setAttributeNS(null, "stroke", "#800000" );
cc.setAttributeNS(null, "stroke-width", ""+(2*rz)+"" );
cc.setAttributeNS(null, "stroke-opacity", ""+(1.0));
cc.setAttributeNS(null, "fill", "#ff0000" );
cc.setAttributeNS(null, "fill-opacity", ""+(1.0));
cc.setAttributeNS(null, "id", "roi" );
csvg.appendChild( cc );
};
};
};
function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){
if( tlLoadLocker ) return;
tlLoadLocker = true;
@ -1234,14 +1405,91 @@ function loadOnlineMonitoring(devID){
tPanel.doLayout();
};
function shutImg( img, a = '' ){
if( a == '' ){
img.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEAAAAALAAAAAABAAEAAAI=;';
} else {
img.src = a;
};
};
var ReportMask = null;
function loadReportSegment( juja ){
ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
ReportMask.show();
var tPanel = Ext.getCmp('main_content');
tPanel.removeAll( true );
tPanel.doLayout();
ReportMask.hide();
var ReportLayoutLoadded = false;
function loadReportSegment( nid, evt_ts ){
if( !ReportLayoutLoadded ){
ReportMask = new Ext.LoadMask(Ext.getCmp('main_content').getEl(), {msg:"Please wait..."});
ReportMask.show();
Ext.Ajax.request({
url: '/lib/controller/getReportLayout.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
NID: nid//,
//DTS: evt_ts
},
success: function(response, opts ){
var data = Ext.decode( response.responseText );
var tPanel = Ext.getCmp('main_content');
tPanel.removeAll(true);
Ext.getCmp('main_content').add({
xtype: 'portal',
id: 'segment_portal',
frame: false,
border: false,
items:{
html: ''
},
listeners:{
drop: function( a ){
updateDashBoardItemLayout( a.panel.id, a.columnIndex, a.position );
}
}
});
Ext.getCmp('main_content').doLayout();
tPanel = Ext.getCmp('segment_portal');
//nodeDashboardStatuses = new Array();
for( i=0; i < data.length; i++) tPanel.add( data[i] );
tPanel.doLayout();
ReportMask.hide();
ReportLayoutLoadded = true;
loadReportData( evt_ts );
},
error: function(){
ReportMask.hide();
}
});
} else {
loadReportData( evt_ts );
};
};
function loadReportData( ts ){
Ext.Ajax.request({
url: '/lib/controller/getHistoryEvents.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
DTS: ts
},
success: function(response, opts ){
var data = Ext.decode( response.responseText );
if( data.log != undefined ){
if( data.log.length ){
rep_store_id = data.log[0].id;
rep_array = data.log;//.concat( rep_array );
//if( log_array.length > 32 ){
// log_array = log_array.slice( 0, 31 );
//};
rep_store.removeAll();
rep_store.loadData( rep_array );
};
} else {
alert('No Log');
// clear the log
//log_store.removeAll();
};
}
});
};
function loadReportDayTree( ts ){
@ -1261,27 +1509,25 @@ function loadReportDayTree( ts ){
sPanel.add({
xtype: 'panel',
layout: 'vbox',
frame: true,
border: false,
items:[{
xtype: 'button',
text: 'Choose Another Date',
width: '100%',
handler: function(){
initReportsView();
}
},{
xtype: 'spacer',
height: 10
height: 3
},{
html: 'Zuza'+ts,
frame: true,
html: '<p class="cur_date">'+( new Date( ts * 1000)).toLocaleDateString()+'</p>',
frame: false,
width: '100%',
border: false
},{
xtype: 'spacer',
height: 5
},{
xtype: 'treepanel',
autoScroll: true,
width: '100%',
height: PanelH-130,
border: true,
frame: true,
loader: new Ext.tree.TreeLoader(),
@ -1290,11 +1536,29 @@ function loadReportDayTree( ts ){
listeners: {
click: function(n) {
if( n.attributes.leaf ){
loadReportSegment( 22 );
//Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.text + '"');
Ext.getCmp('chu_adate').show();
sPanel.doLayout();
loadReportSegment( n.attributes.nid, n.attributes.ts );
//Ext.Msg.alert('Navigation Tree Click', 'You clicked: "' + n.attributes.ts + '"');
};
}
}
},{
xtype: 'spacer',
height: 10
},{
xtype: 'button',
id: 'chu_adate',
text: 'Show Dates',
hidden: true,
width: '100%',
iconCls: 'reports_dates_btn',
scale: 'large',
handler: function(){
Ext.getCmp('chu_adate').hide();
initReportsView();
}
}]
});
sPanel.doLayout();
@ -1309,6 +1573,7 @@ function initReportsView(){
tlInterval = null;
timelineObj = null;
};
ReportLayoutLoadded = false;
var tPanel = Ext.getCmp('main_content');
var sPanel = Ext.getCmp('left_side_menu');
tPanel.removeAll( true );
@ -1355,9 +1620,9 @@ function initReportsView(){
tPanel.doLayout();
sPanel.add({
xtype: 'panel',
frame: true,
frame: false,
border: false,
html: 'Zuza'
html: '<div class="setEd_infoPanel" id="NANA"><?=$Labels->GetLabel('_PLS_SEL_CAL_DATE_');?></div>'
});
sPanel.doLayout();
};

807
lib/javascript/jsapi_dynamic/mojo_settings.js

@ -2,6 +2,113 @@
var helpContentTopicID = -1;
var muploader = null;
var uploads_store_id = 0;
var uploads_store = new Ext.data.ArrayStore({
autoDestroy: false,
storeId: 'up_store',
idIndex: 0,
fields: [
{name: 'id', type: 'int' },
{name: 'file_name', type: 'string'},
{name: 'file_id', type: 'string'},
{name: 'size', type: 'string'},
{name: 'progress', type: 'int'},
{name: 'status', type: 'string' }
]
});
var uploaded_store_id = 0;
var uploaded_store = new Ext.data.ArrayStore({
autoDestroy: false,
storeId: 'mod_store',
idIndex: 0,
fields: [
{name: 'id', type: 'int' },
{name: 'file_name', type: 'string'},
{name: 'size', type: 'int'},
{name: 'status', type: 'int'},
{name: 'ts', type: 'string' },
{name: 'memo', type: 'string' }
]
});
function progressRenderer( value, meta, record ){
Ext.defer( function( id ){
var p = new Ext.ProgressBar({
id: 'progress_'+id,
renderTo: 'div_'+id,
animate: false,
width: '100%',
value: 0,
text: 'Upload Pending',
});
}, 50, undefined, [ record.data.file_id ] );
return '<div id="div_' + record.data.file_id + '"></div>';
};
var fileUploadsColModel_ops = {
columns: [
{header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "File Name", width: 280, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
{header: "Size", width: 80, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
{header: "Progress", width: 150, renderer: progressRenderer, dataIndex: 'progress' },
{header: " ", width: 50, dataIndex: 'status3' }
],
defaults: {
sortable: false,
fixed: true,
menuDisabled: true,
width: 100
}
};
function onModuleFileRenderer( value, meta, record ){
if( value == 0 ){
rv = '<img title="Ready to Upload" alt="Ready to Upload" src="/style/assets/bul_green.png">';
} else {
if( value < 101 ){
rv = '<img title="Uploading" alt="Uploading" src="/style/assets/bul_gray.png">';
} else {
rv = '<img title="Already Uploaded" alt="Already Uploaded" src="/style/assets/bul_blue.png">';
};
};
return rv;
};
var fileModuleColModel_ops = {
columns: [
{header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "File Name", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
{header: "Size", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
{header: "Time", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
{header: "Status", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' },
{header: "Memo", dataIndex: 'memo' }
],
defaults: {
sortable: false,
fixed: true,
menuDisabled: true,
width: 100
}
};
var fileUploadsSelModel_ops = {
singleSelect: true
};
function loadModuleFiles( sensorID ){
Ext.Ajax.request({
url: '/lib/controller/getDeviceFiles.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
DID: sensorID
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
uploaded_store.removeAll();
uploaded_store.loadData( data.files );
},
failure: failureAJAXFunction
});
};
function loadHelpContent( topicID ){
if( helpContentTopicID == topicID ) return;
helpContentTopicID = topicID;
@ -77,6 +184,157 @@ function loadModules(){
});
};
function loadFilters(){
Ext.Ajax.request({
url: '/lib/controller/getFilters.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
},
success: function( response, opts ){
var tData = Ext.decode(response.responseText);
var tPanel = Ext.getCmp('filters_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('flt_ed_small');
tPanel.removeAll( true );
tPanel.add( { html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>' } );
tPanel.doLayout();
};
},
failure: failureAJAXFunction
});
};
function loadPhoneBook(){
Ext.Ajax.request({
url: '/lib/controller/getPhoneBook.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
//var tPanel = Ext.getCmp('main_portal');
//tPanel.removeAll(true);
//for( i=0; i < data.length; i++) tPanel.add( data[i] );
//tPanel.doLayout();
},
failure: failureAJAXFunction
});
};
var addNPNWindow = null;
function addNewPhoneNumber(){
if( addNPNWindow == null ){
addNPNWindow = new Ext.Window({
title: 'Add New Phone Number',
modal: true,
closeAction: 'hide',
resizable: false,
width: 400,
height: 300,
items:[{
xtype: 'form',
labelWidth: 120,
labelAlign: 'right',
items: [{
xtype: 'textfield',
fieldLabel: 'Name/Label',
id: 'ph_name',
width: 220,
value: ''
},{
xtype: 'textfield',
fieldLabel: 'Phone Number',
id: 'ph_number',
width: 220,
validator: function( a ){
return true;
},
value: ''
},{
xtype: 'radio',
id: 'r_ph_call',
fieldLabel: 'Call Only',
name: 'ph_cam',
checked: true,
value: '1'
},{
xtype: 'radio',
id: 'r_ph_msg',
fieldLabel: 'SMS Only',
name: 'ph_cam',
value: '0'
},{
xtype: 'textarea',
fieldLabel: 'Custom Message',
width: 220,
height: 130,
id: 'cus_sms',
name: 'cus_sms'
}]
}],
bbar:['->',{
text: 'Add',
handler: function(){
var num = Ext.getCmp( 'ph_number' ).getValue();
var lbl = Ext.getCmp( 'ph_name' ).getValue();
var con = (Ext.getCmp( 'r_ph_call' ).getValue())?1:0;
var cust = Ext.getCmp( 'cus_sms' ).getValue();
Ext.Ajax.request({
url: '/lib/controller/addPhoneBookRecord.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
PNUM: num,
PNAM: lbl,
PCAL: con,
PMSG: cust
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.success ){
} else {
Ext.Msg.show({
title:'Error',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR//,
//fn: function(btn, text){
// if( btn == 'yes' ){
// cleanupChangeNotifier();
// } else {
// loadEditor = false;
// };
//}
});
};
//var tPanel = Ext.getCmp('main_portal');
//tPanel.removeAll(true);
//for( i=0; i < data.length; i++) tPanel.add( data[i] );
//tPanel.doLayout();
},
failure: failureAJAXFunction
});
}
},{
text: 'Cancel',
handler: function(){
addNPNWindow.hide();
}
}]
});
};
addNPNWindow.show();
};
function loadDetectedCameras(){
Ext.Ajax.request({
url: '/lib/controller/getCameras.php',
@ -212,6 +470,45 @@ function editResource( rid ){
};
};
function editFilter( fid ){
var loadEditor = true;
if( settingsAreChanged ){
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_SETTINGS_CHANGED_');?>',
msg: '<?=$Labels->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/getFilterEditor.php',
params: {
FID: fid,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var resourceEdPanel = Ext.getCmp('flt_ed_small');
if( resourceEdPanel ){
resourceEdPanel.removeAll( true );
resourceEdPanel.add( data );
resourceEdPanel.doLayout();
};
},
failure: failureAJAXFunction
});
};
};
function editModule( mid ){
var loadEditor = true;
if( settingsAreChanged ){
@ -724,7 +1021,7 @@ function addSensor(){
xtype: 'panel',
frame: false,
border: false,
html: '<table width="100%" border=0><tr><td align="center" valign="middle"><div class="node_1_img_set"></div></td></tr></table>'
html: '<table width="100%" border=0><tr><td align="center" valign="middle"><div id="asd_img_div" class="node_1_img_set"></div></td></tr></table>'
},{
xtype: 'spacer',
height: 8
@ -750,7 +1047,13 @@ function addSensor(){
valueField: 'mode',
displayField: 'mode_txt',
value: 1,
width: 200
width: 200,
listeners:{
select: function( a, v, c ){
var ii = document.getElementById( 'asd_img_div' );
ii.className = "node_"+(c+1)+"_img_set";
}
}
},{
xtype: 'combo',
id: 'sens_range',
@ -950,7 +1253,7 @@ function addDetectedIPCam(){
UU: NUU,
PP: NPP,
AU: NAM,
CMD: 2
CMD: 3
},
success: function( response, opts ){
addDetCamWM.hide();
@ -976,6 +1279,41 @@ function addDetectedIPCam(){
addDetCamDialog.show();
};
var devUploadTimeout = null;
var devUploadID = -1;
function fetchDeviceUploadStatus(){
clearTimeout( devUploadTimeout );
if( devUploadID < 1 ) return;
Ext.Ajax.request({
url: '/lib/controller/getDeviceUploadStatus.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
DID: devUploadID
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var tT = Ext.getCmp('upp_ttext');
if( tT != undefined ){
if( data.count > 0 ){
devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
};
if( data.current != undefined ){
tT.update('<p class="UPTTEXT">Uploading '+data.count+' file(s)</p>');
document.getElementById('upp_ctext').innerHTML ='<p class="UPCTEXT">Current File: '+data.current+'</p>';
Ext.getCmp('upp_pbar').updateProgress( data.progress, Math.round( data.progress*100 )+'%', true );
devUploadTimeout = setTimeout( fetchDeviceUploadStatus, 1000 );
} else {
Ext.getCmp('upload_progres_panel').hide();
Ext.getCmp('uploaded_grid').show();
loadModuleFiles( devUploadID );
};
};
},
failure: failureAJAXFunction
});
};
function showSettingsGeneral(){
stopStatusUpdater();
@ -1333,9 +1671,136 @@ tPanel.add({
}]
},{
xtype: 'panel',
id: 'net_tab',
title: 'Filters',
items:[]
id: 'flt_tab',
layout: 'hbox',
items:[{
xtype: 'panel',
id: 'filters_container',
flex: 1,
height: PanelH-15,
autoScroll: 'auto',
tbar:[{
text: 'Add Filter',
handler: function(){
var addFilterWindow = new Ext.Window({
id: 'fulu_boa',
title: 'Add Event Filter',
modal: true,
width: 400,
height: 300,
items:[{
xtype: 'form',
items: [{
xtype: 'combo',
fieldLabel: "<?=$Labels->GetLabel( 'MOD_TYPE' );?>",
id: 'flt_type',
lazyRender: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
editable: false,
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['az_t','az_txt'],
data: [<?php
$QS="SELECT `id`,`name` FROM `target_filter_types`";
$JIJI=$DATABASE->Query( $QS );
$OOP = array();
foreach( $JIJI as $JI ) $OOP[] = "[{$JI['id']},'".$Labels->getLabel($JI['name'])."']";
echo implode(',', $OOP );
?>]
}),
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/getFilterInfo.php',
params: {
FID: n,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
Ext.getCmp('filt_infopan').update( response.responseText );
}
});
}
}
},{
xtype: 'panel',
id: 'filt_infopan',
html: ''
}]
}],
bbar:[{
text: 'Cancel',
handler: function(){
addFilterWindow.close();
}
},{
text: 'Add Filter',
handler: function(){
var mtyp = Ext.getCmp('flt_type').getValue();
Ext.Ajax.request({
url: '/lib/controller/addFilter.php',
params: {
SERVID: 1,
TYPE: mtyp,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
// If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
addFilterWindow.close();
loadFilters();
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
msg: data.message,
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
//SettingsLidar3D.hide();
},
icon: Ext.MessageBox.INFO //QUESTION
});
}
},
failure: failureAJAXFunction
});
}
}]
});
addFilterWindow.show();
Ext.Ajax.request({
url: '/lib/controller/getFilterInfo.php',
params: {
FID: 1,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
Ext.getCmp('filt_infopan').update( response.responseText );
}
});
}
}],
items:[]
},{
xtype: 'panel',
id: 'flt_ed_small',
flex: 1,
height: PanelH-15,
layout: 'fit',
items:[{
html:'<div class="setEd_infoPanel" id="NUNU"><?=$Labels->GetLabel('_PLS_SEL_LEFT_ITEM_');?></div>'
}]
}]
}],
listeners:{
tabchange: function( tp, t ){
@ -1357,9 +1822,10 @@ tPanel.add({
loadModules();
break;
};
case 'net_tab':{
case 'flt_tab':{
content_lvl3=3;
stopStatusUpdater();
loadFilters();
break;
};
};
@ -1621,6 +2087,32 @@ function showSettingsApplication(){
},{
xtype: 'spacer',
height: 10
},{
xtype: 'textfield',
fieldLabel: 'Instance Identity',
width: 300,
value: '<?php
$QS = "SELECT `identity` FROM `servers` LIMIT 1";
$TT = $DATABASE->Query( $QS );
if( count( $TT ) ){
echo $TT[0]['identity'];
} else {
echo "----No-Identity-Set---";
};
?>'
},{
xtype: 'spacer',
height: 10
},{
xtype: 'button',
text: 'Generate New Identity',
width: 500,
handler: function(){
doApplicationOperation( 3, 0 );
}
},{
xtype: 'spacer',
height: 10
},{
xtype: 'combo',
fieldLabel: '<?=$Labels->GetLabel('_DEBUGGING_MODE_');?>',
@ -1634,11 +2126,11 @@ function showSettingsApplication(){
fields: ['sid', 'snam'],
data: [[0,'<?=$Labels->GetLabel('__DISABLED__');?>'], [1,'<?=$Labels->GetLabel('___ENABLED__');?>']]
}),
value: <?=0;?>,
value: <?=$AP_DATA['work_mode'];?>,
valueField: 'sid',
displayField: 'snam',
listeners:{
select: function(t,r,i){
select: function( t, r, i ){
doApplicationOperation( 1, i );
}
}
@ -1777,8 +2269,267 @@ function showSettingsUpgrade(){
content_lvl2 = 4;
var tPanel = Ext.getCmp('main_content');
tPanel.removeAll( true );
initial_md5 = '';
tPanel.add({
columnWidth: 1.0,
frame: false,
border: false,
items: [{
frame: false,
border: false,
collapsible: false,
draggable: false,
layout: 'vbox',
//layoutConfig: {
// align : 'stretch',
// pack : 'start',
//},
height: PanelH,
items:[{
title: '<?=$Labels->getLabel('_MAP_MONITORING_');?>',
xtype: 'panel',
height: PanelH-300,
//flex: 1,
frame: true,
width: '100%',
border: false,
layout: {
type: 'table',
columns: 2,
tableAttrs: {
valign: 'top',
style: 'valign:top;width:100%;'
}
},
defaults: {
frame: true,
border: false,
height: ( PanelH-400 ) / 2,
style: 'margin: 5px;width:400px;display:block;'
},
items:[{
title: 'Current System Info',
width: '100%',
//flex: 1,
html: '<p>Current Web Version:&nbsp;<b><?=$ARGUS_WEB_VERSION;?></b></p>'
},{
title: 'Tasks',
//width: 400,
layout: 'vbox',
items:[{
xtype: 'button',
width: '100%',
text: 'Create Database Backup',
handler: function(){
createNewTask( 2 );
}
},{
xtype: 'button',
width: '100%',
text: 'Create Full Snapeshot',
handler: function(){
createNewTask( 255 );
}
}]
},{
title: 'Archives',
height: 250,
width: '100%',
tbar:[{
text: 'Restore',
id: 'ar_restore_btn',
handler: function(){
createNewTask(1, selectedArchiveRecord.data.file_name );
}
},{
text: 'Download',
id: 'ar_download_btn',
handler: function(){
if( selectedArchiveRecord!= null ){
window.open( '/lib/php/setup_toolkit/vault/'+selectedArchiveRecord.data.base_version + '/'+ selectedArchiveRecord.data.file_name );
};
}
},{
text: 'Delete',
id: 'ar_delete_btn',
handler: function(){
createNewTask(100, selectedArchiveRecord.data.file_name );
}
}],
items:[{
xtype: 'grid',
id: 'archives_grid',
border: false,
frame: false,
autoScroll: true,
//width: '100%',
lazyRender: true,
height: 210,
ds: archives_store,
cm: new Ext.grid.ColumnModel( archivesColModel_ops ),
sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
viewConfig: {
// forceFit: true
},
}]
},{
title: 'Task Status',
height: 250,
//flex: 1,
items:[{
xtype: 'spacer',
height: 4
},{
id: 'ctask_status',
border: true,
html: ''
},{
xtype: 'spacer',
height: 4
},{
xtype: 'textarea',
id: 'task_log',
height: ( PanelH-320 ) / 2 - 120,
style: 'font-size:9px;width:100%;margin-bottom:4px;',
readOnly: true,
autoScroll: true,
value: ''
},{
xtype: 'progress',
id: 'task_progress',
value: 1.0,
text: 'idle',
disabled: true
}],
tbar:[{
text: 'Cancel Task',
id: 'ch_ta_btn',
disabled: true,
handler: deleteNewTask
}]
}]
},{
title: '<?=$Labels->getLabel('_UPLOAD_PACKAGE_');?>',
xtype: 'panel',
height: 300,
//flex: 1,
frame: true,
border: false,
//layout: 'vbox',
items:[{
xtype:'button',
id: 'pickfiles',
width: '100%',
text: 'Choose File'
},{
height: 200,
xtype: 'grid',
id: 'upload_grid',
border: false,
frame: false,
mode: 'local',
lazyRender: true,
width: '100%',
autoScroll: true,
ds: uploads_store,
cm: new Ext.grid.ColumnModel( fileUploadsColModel_ops ),
sm: new Ext.grid.RowSelectionModel( fileUploadsSelModel_ops ),
viewConfig: {
forceFit: true
},
bbar: [{
text: 'Clear',
width: '100%',
handler: function(){
muploader.splice();
uploads_store.removeAll();
}
}]
},{
xtype:'button',
id: 'umpalumpa',
width: '100%',
disabled: true,
text: 'Upload',
handler: function(){
if( muploader!= null ){
muploader.start();
};
}
}],
listeners:{
afterrender: function(){
muploader = new plupload.Uploader({
runtimes : 'html5,html4',
browse_button : Ext.getDom('pickfiles'), // you can pass in id...
//container: document.getElementById('upupu'), // ... or DOM Element itself
max_file_size : '1000mb',
chunk_size: '200kb',
max_retries: 3,
multi_selection: false,
max_file_count: 1,
// Fake server response here
url: '/lib/php/setup_toolkit/upload.php',
//url: "/echo/json",
//flash_swf_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/flash/Moxie.cdn.swf',
//silverlight_xap_url : 'http://rawgithub.com/moxiecode/moxie/master/bin/silverlight/Moxie.cdn.xap',
filters : [
//{title : "Image files", extensions : "jpg,gif,png"},
{title : "Archive files", extensions : "rar,zip,gz,bz2"}
],
init: {
PostInit: function() {
//$('filelist').innerHTML = '';
//$('uploadfiles').onclick = function() {
// uploader.start();
// return false;
//};
},
FilesAdded: function( up, files ) {
Ext.getCmp('umpalumpa').enable();
plupload.each( files, function(file) {
uploads_store.loadData( [[ uploads_store_id, file.name, file.id, plupload.formatSize( file.size ), 0, 'N' ]], true );
uploads_store_id++;
Ext.getCmp('upload_grid').doLayout();
});
},
UploadProgress: function(up, file) {
var pb = Ext.getCmp( 'progress_'+file.id );
if( file.percent < 100 ){
pb.updateProgress( file.percent / 100, file.percent + '%', false );
} else {
pb.updateProgress( 1.0, 'Uploaded', false );
};
},
Error: function(up, err) {
Ext.Msg.show({
title:'Upload Status',
msg: "Error #" + err.code + ": " + err.message,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
}
}
});
muploader.init();
}
}
}]
}]
});
muploader = null;
uploads_store.removeAll();
tPanel.doLayout();
updateServerStatus();
archives_store.load();//{params:{start:0, limit:50, src: 'arch', fil: selecredActiveSourceFilter }});
updateTaskStatus();
tlInterval = window.setInterval( updateTaskStatus, 333 );
};
function initSettingsView(){
@ -1805,6 +2556,7 @@ function initSettingsView(){
});
tP.doLayout();
tP = Ext.getCmp('sme_inner');
<?php if( $CUser->Data['access'] > 3 ){ ?>
tP.add({
title: '<?=$Labels->GetLabel('_SYS_SETTINGS_');?>',
layout: 'vbox',
@ -1852,16 +2604,6 @@ function initSettingsView(){
allowDepress: false,
toggleGroup: 'sys_settings',
handler: showSettingsApplication
},{
xtype: 'button',
width: '100%',
id:'soft_update',
text: '<?=$Labels->GetLabel('_UPGRADE_MNGMNT_');?>',
enableToggle: true,
pressed: ( content_lvl2 == 4 && content_lvl1 == 0 ),
allowDepress: false,
toggleGroup: 'sys_settings',
handler: showSettingsUpgrade
}]
});
tP.add({
@ -1883,7 +2625,7 @@ function initSettingsView(){
pressed: ( content_lvl2 == 0 && content_lvl1 == 1 ),
allowDepress: false,
toggleGroup: 'det_settings',
handler: loadDashBoard
handler: loadMetroControlUpper
},{
xtype: 'button',
width: '100%',
@ -1893,7 +2635,7 @@ function initSettingsView(){
pressed: ( content_lvl2 == 1 && content_lvl1 == 1 ),
allowDepress: false,
toggleGroup: 'det_settings',
handler: loadMonitoring
handler: loadMetroControlBottom
},{
xtype: 'button',
width: '100%',
@ -1903,7 +2645,7 @@ function initSettingsView(){
pressed: ( content_lvl2 == 2 && content_lvl1 == 1 ),
allowDepress: false,
toggleGroup: 'det_settings',
handler: loadArchive
handler: loadMetroControlFusion
}<?php
} else {
@ -1930,10 +2672,10 @@ function initSettingsView(){
text: '<?=$Labels->GetLabel('_LOGOUT_');?>',
handler: doLogout
}<?php
};
};
?>]
});
tP.add({
/*tP.add({
title: '<?=$Labels->GetLabel('_NET_SETTINGS_');?>',
collapsed: ( content_lvl1 != 2 ),
items:[{
@ -1961,14 +2703,14 @@ function initSettingsView(){
allowDepress: false,
id:'api_serv',
}]
});
});*/
<?php }; ?>
tP.add({
title: '<?=$Labels->GetLabel('_PROF_SETTINGS_');?>',
items:[]
});
<?php
if( $CUser->Data['access'] > 5 ){
?>tP.add({
<?php if( $CUser->Data['access'] > 5 ){ ?>
tP.add({
title: '<?=$Labels->GetLabel('_ADM_SETTINGS_');?>',
collapsed: ( content_lvl1 != 3 ),
items:[{
@ -1979,6 +2721,7 @@ function initSettingsView(){
enableToggle: true,
pressed: ( content_lvl2 == 0 && content_lvl1 == 3 ),
allowDepress: false,
toggleGroup: 'adm_settings',
handler: function( b, e ){
loadUserEditor();
}
@ -1990,6 +2733,7 @@ function initSettingsView(){
enableToggle: true,
pressed: ( content_lvl2 == 1 && content_lvl1 == 3 ),
allowDepress: false,
toggleGroup: 'adm_settings',
handler: function( b, e ){
loadAccessLog();
}
@ -2001,6 +2745,7 @@ function initSettingsView(){
enableToggle: true,
pressed: ( content_lvl2 == 2 && content_lvl1 == 3 ),
allowDepress: false,
toggleGroup: 'adm_settings',
handler: function( b, e ){
loadServerLog();
}
@ -2027,5 +2772,11 @@ function initSettingsView(){
};
break;
};
case 3:{
switch( content_lvl2 ){
case 0: loadUserEditor(); break;
};
break;
};
};
};

649
lib/javascript/jsapi_dynamic/mojo_users.js

@ -0,0 +1,649 @@
//<?php require_once('../../js_asm.php'); ?>
var um_user_list_store = new Ext.data.JsonStore({
root: 'users',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'status',
type: 'string'
},{
name: 'login',
type: 'string'
},{
name: 'created',
type: 'string'
},{
name: 'last',
type: 'string'
},{
name: 'access',
type: 'int'
},{
name: 'lang',
type: 'int'
},{
name: 'site',
type: 'int'
}],
proxy : new Ext.data.HttpProxy({
method: 'POST',
prettyUrls: false,
url: '/lib/controller/listUsers.php',
headers: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
}
})
});
var um_selected_user_id = 0;
var um_user_locked = false;
var um_add_user_window = null;
var um_edit_user_window = null;
function um_user_access_renderer( val ){
if( val == 0 ){
return '<?=$Labels->GetLabel("_GUEST_");?>';
} else {
if( val < 6 ){
return '<?=$Labels->GetLabel("_REGULAR_");?>';
} else {
if( val == 10 ){
return '<?=$Labels->GetLabel("_FOUNDER_");?>';
} else {
return '<?=$Labels->GetLabel("_ADMIN_");?>';
};
};
};
};
function um_user_status_renderer( val ){
switch( val ){
case 'D': return '<img alt="Disabled" src="/style/icons/icons/status_busy.png">';
case 'A': return '<img alt="Active" src="/style/icons/icons/status_online.png">';
};
return '<img alt="Blocked" src="/style/icons/icons/status_offline.png">';
};
var um_user_list_col_model_opt = {
columns: [
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "<?=$Labels->GetLabel("_STATUS_");?>", width: 80, sortable: false, renderer: um_user_status_renderer, fixed: true, menuDisabled: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'status' },
{header: "<?=$Labels->GetLabel("_LOGIN_");?>", width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'login' },
{header: "<?=$Labels->GetLabel("_CREATED_");?>", width: 150, sortable: false, renderer: unix_ts_renderer, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'created' },
{header: "<?=$Labels->GetLabel("_LAST_ACCESS_");?>", width: 150, sortable: false, renderer: unix_ts_renderer, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'last' },
{header: "<?=$Labels->GetLabel("_TYPE_");?>", width: 100, sortable: false, renderer: um_user_access_renderer, dataIndex: 'access' },
{header: "<?=$Labels->GetLabel("_INFO_");?>", width: 200, sortable: false, dataindex: 'data' }
],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
//saveConfig(colIndex, hidden);
}
}
};
var um_user_list_sel_model_opt = {
singleSelect: true,
listeners: {
rowselect: function( sm, row, rec ) {
um_selected_user_id = rec.data.id;
if ( rec.data.status == 'A' ){
Ext.getCmp('um_lock_user_btn').setText('<?=$Labels->GetLabel("_LOCK_USER_");?>');
um_user_locked = false;
} else {
Ext.getCmp('um_lock_user_btn').setText('<?=$Labels->GetLabel("_UNLOCK_USER_");?>');
um_user_locked = true;
};
if( um_selected_user_id == 1 || rec.data.access == 10 ){
Ext.getCmp('um_del_user_btn').disable();
Ext.getCmp('um_lock_user_btn').disable();
} else {
Ext.getCmp('um_del_user_btn').enable();
Ext.getCmp('um_lock_user_btn').enable();
};
if( um_selected_user_id == 1 ){
Ext.getCmp('um_edit_user_btn').disable();
} else {
Ext.getCmp('um_edit_user_btn').enable();
};
}
}
};
function addNewUser(){
if( um_add_user_window == null ){
um_add_user_window = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel("_EDIT_USER_CRACCES_");?>',
width: 400,
height: 250,
layout: 'fit',
closeAction: 'hide',
listeners:{
beforehide : function(){
//Ext.getCmp('connectstarterbutton').toggle( false, false );
}
},
items:[{
layout: 'table',
border: false,
defaults: {
// applied to each contained panel
bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;'
},
layoutConfig: {
// The total column count must be specified here
columns: 2
},
items: [{
border: false,
html: 'User Login:'
},{
xtype: 'textfield',
id: 'um_ua_login',
width: 200
},{
border: false,
html: 'New Password:'
},{
xtype: 'textfield',
id: 'um_ua_pwd1',
inputType: 'password',
width: 200
},{
border: false,
html: 'Repeate Password:'
},{
xtype: 'textfield',
id: 'um_ua_pwd2',
inputType: 'password',
width: 200
},{
border: false,
html: 'Access Level:'
},{
xtype: 'combo',
id: 'um_ua_access',
editable: false,
typeAhead: true,
triggerAction: 'all',
width: 200,
lazyRender:true,
mode: 'local',
value: 2,
store: new Ext.data.ArrayStore({
id: 0,
fields: ['acc_lvl', 'displayText' ],
data: [[2,'Minimal Access'],[4,'Operator'],[6,'Admin']]
}),
valueField: 'acc_lvl',
displayField: 'displayText'
}]
}],
bbar: [ '->',{
text: '<?=$Labels->GetLabel("_CANCEL_");?>',
handler: function(){
um_add_user_window.hide();
}
},{
text: '<?=$Labels->GetLabel("_SAVE_");?>',
handler: function(){
var lo = Ext.getCmp('um_ua_login').getValue();
var pwd = Ext.getCmp('um_ua_pwd1').getValue();
var rwd = Ext.getCmp('um_ua_pwd2').getValue();
var acc = Ext.getCmp('um_ua_access').getValue();
var sbt = true;
if( acc > my_access ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'You Can not add more privileged user!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR //QUESTION
});
};
if( sbt && pwd!=''){
if( pwd != rwd ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'Passwords don\'t match!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR //QUESTION
});
};
} else {
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'You Can not Add User Without Password!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR //QUESTION
});
};
if( sbt && lo == '' ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'You Can not Add User Without Login!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR //QUESTION
});
};
if( sbt ){
Ext.Ajax.request({
url: '/lib/controller/updateUser.php',
params: {
OP: 0,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
NLO: lo,
PW1: pwd,
PW2: rwd,
ACC: acc
},
success: function( response, opts ){
// If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
if( data.success == true ) {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
msg: '<?=$Labels->GetLabel("_SETTING_SAVE_OK_");?>',
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
um_user_list_store.reload();
um_add_user_window.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.INFO //QUESTION
});
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: data['error'],
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
um_add_user_window.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
},
failure: failureAJAXFunction
});
};
}
}]
});
};
um_add_user_window.show();
Ext.getCmp('um_ua_login').setValue( '' );
Ext.getCmp('um_ua_pwd1').setValue( '' );
Ext.getCmp('um_ua_pwd2').setValue( '' );
Ext.getCmp('um_ua_access').setValue( 2 );
};
function doUserOperation( op ){
if( um_selected_user_id < 1 ) return;
Ext.Ajax.request({
url: '/lib/controller/updateUser.php',
params: {
OP: op,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
SUID: um_selected_user_id
},
success: function( response, opts ){
// If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
if( data.success == true ) {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
msg: '<?=$Labels->GetLabel("_SETTING_SAVE_OK_");?>',
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
um_user_list_store.reload();
},
//animEl: 'elId',
icon: Ext.MessageBox.INFO //QUESTION
});
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: data.msg,
buttons: Ext.Msg.OK,//YESNOCANCEL,
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
},
failure: failureAJAXFunction
});
};
function editSelectedUser(){
if( um_edit_user_window == null ){
um_edit_user_window = new Ext.Window({
modal: true,
title: '<?=$Labels->GetLabel("_EDIT_USER_CRACCES_");?>',
width: 400,
height: 250,
layout: 'fit',
closeAction: 'hide',
listeners:{
beforehide : function(){
//Ext.getCmp('connectstarterbutton').toggle( false, false );
}
},
items:[{
layout: 'table',
border: false,
defaults: {
// applied to each contained panel
bodyStyle:'padding-top:10px;padding-left:20px;padding-right:20px;padding-bottom:10px;'
},
layoutConfig: {
// The total column count must be specified here
columns: 2
},
items: [{
border: false,
html: 'User Login:'
},{
xtype: 'textfield',
id: 'um_ue_login',
width: 200
},{
border: false,
html: 'New Password:'
},{
xtype: 'textfield',
id: 'um_ue_pwd1',
inputType: 'password',
width: 200
},{
border: false,
html: 'Repeate Password:'
},{
xtype: 'textfield',
id: 'um_ue_pwd2',
inputType: 'password',
width: 200
},{
border: false,
html: 'Access Level:'
},{
xtype: 'combo',
id: 'um_ue_access',
editable: false,
typeAhead: true,
triggerAction: 'all',
width: 200,
lazyRender:true,
mode: 'local',
value: 2,
store: new Ext.data.ArrayStore({
id: 0,
fields: ['acc_lvl', 'displayText' ],
data: [[2,'Minimal Access'],[4,'Operator'],[6,'Admin'],[10,'Factory Defined']]
}),
valueField: 'acc_lvl',
displayField: 'displayText'
}]
}],
bbar: [ '->',{
text: '<?=$Labels->GetLabel("_CANCEL_");?>',
handler: function(){
um_edit_user_window.hide();
}
},{
text: '<?=$Labels->GetLabel("_SAVE_");?>',
handler: function(){
var aid = um_user_list_store.find( 'id', um_selected_user_id );
var r = um_user_list_store.getAt( aid );
var lo = Ext.getCmp('um_ue_login').getValue();
var pwd = Ext.getCmp('um_ue_pwd1').getValue();
var rwd = Ext.getCmp('um_ue_pwd2').getValue();
var acc = Ext.getCmp('um_ue_access').getValue();
var olo = r.data.login;
var oacc = r.data.access;
var sbt = true;
if( oacc > my_access ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'You Can not change settings of more privileged user!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
};
if( sbt && oacc != acc ){
if( acc > my_access ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'You Can not change access level to more privileged user then you are!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
} else {
if( acc == 10 ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'You Can not change access level to Factory Defined Master!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
};
};
};
if( sbt && pwd!=''){
if( pwd != rwd ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: 'Passwords does not match!',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
};
};
if( sbt && olo != lo ){
sbt = false;
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_QERY_MSG_");?>',
msg: 'Are you sure to change Login User Name?',
buttons: Ext.Msg.YESNOCANCEL,
fn: function( a ){
if( a == 'yes' ){
Ext.Ajax.request({
url: '/lib/controller/updateUser.php',
params: {
OP: 1,
SUID: um_selected_user_id,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
NLO: lo,
OLO: olo,
PW1: pwd,
PW2: rwd,
ACC: acc
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.success == true ) {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
msg: '<?=$Labels->GetLabel("_SETTING_SAVE_OK_");?>',
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
um_user_list_store.reload();
um_edit_user_window.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.INFO //QUESTION
});
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: data['error'],
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
um_edit_user_window.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
},
failure: failureAJAXFunction
});
};
},
icon: Ext.MessageBox.QUESTION
});
};
if( sbt ){
Ext.Ajax.request({
url: '/lib/controller/updateUser.php',
params: {
OP: 1,
SUID: um_selected_user_id,
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
NLO: lo,
OLO: olo,
PW1: pwd,
PW2: rwd,
ACC: acc
},
success: function( response, opts ){
// If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
if( data.success == true ) {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_INFO_MSG_");?>',
msg: '<?=$Labels->GetLabel("_SETTING_SAVE_OK_");?>',
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
//SettingsLidar3D.hide();
um_user_list_store.reload();
um_edit_user_window.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.INFO //QUESTION
});
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel("_ERROR_MSG_");?>',
msg: data['error'],
buttons: Ext.Msg.OK,//YESNOCANCEL,
fn: function(){
um_edit_user_window.hide();
},
//animEl: 'elId',
icon: Ext.MessageBox.ERROR //QUESTION
});
};
},
failure: failureAJAXFunction
});
};
}
}]
});
};
um_edit_user_window.show();
var aid = um_user_list_store.find( 'id', um_selected_user_id );
var r = um_user_list_store.getAt( aid );
Ext.getCmp('um_ue_login').setValue( r.data.login );
Ext.getCmp('um_ue_access').setValue( r.data.access );
if( r.data.access == 10 ){
Ext.getCmp('um_ue_access').disable();
} else {
Ext.getCmp('um_ue_access').enable();
};
};
function loadUserEditor(){
if( tlInterval!= null ){
window.clearInterval( tlInterval );
tlInterval = null;
timelineObj = null;
};
var tPanel = Ext.getCmp('main_content');
tPanel.removeAll( true );
Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel("_USERS_MNGMT_");?>' );
tPanel.add({
columnWidth: 1.0,
frame: false,
border: false,
items: [{
xtype: 'panel',
layout: 'fit',
layoutConfig: {
align : 'stretch',
pack : 'start'
},
height: PanelH-5,
flex: 1,
frame: false,
border: false,
items:{
frame: false,
height: PanelH-5,
xtype: 'grid',
ds: um_user_list_store,
cm: new Ext.grid.ColumnModel( um_user_list_col_model_opt ),
sm: new Ext.grid.RowSelectionModel( um_user_list_sel_model_opt )
},
tbar: [{
xtype: 'button',
id: 'um_add_user_btn',
text: '<?=$Labels->GetLabel("_ADD_USER_");?>',
handler: addNewUser
},{
xtype: 'button',
id: 'um_edit_user_btn',
text: '<?=$Labels->GetLabel("_EDIT_USER_");?>',
disabled: true,
handler: editSelectedUser
},{
xtype: 'button',
id: 'um_lock_user_btn',
text: '<?=$Labels->GetLabel("_LOCK_USER_");?>',
disabled: true,
handler: function(){
if( um_user_locked ){
doUserOperation( 3 );
} else {
doUserOperation( 2 );
};
}
},{
xtype: 'button',
id: 'um_del_user_btn',
text: '<?=$Labels->GetLabel("_DEL_USER_");?>',
disabled: true,
handler: function(){
doUserOperation( 4 );
}
}]
}]
});
tPanel.doLayout();
um_selected_user_id = 0;
um_user_list_store.reload();
};

162
lib/javascript/jsapi_dynamic/rgoose_devices.js

@ -2,6 +2,49 @@
var devices = new Array();
var cameras = new Array();
var systemDevicesAreLoadded = false;
function loadSystemDevices(){
Ext.Ajax.request({
url: '/lib/controller/getSystemDevices.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
},
success: function( response, opts ){
// If the response is JSON, you have to decode it
var data = Ext.decode(response.responseText);
devices = data.sensors;
cameras = data.cameras;
systemDevicesAreLoadded = true;
},
failure: failureAJAXFunction
});
};
function getSensorByNodeId( NID ){
if( systemDevicesAreLoadded ) for( i=0; i< devices.length; i++ ) if( devices[i].node_id == NID ) return devices[i];
return null;
};
function getSensorById( SID ){
if( systemDevicesAreLoadded ) for( i=0; i< devices.length; i++) if( devices[i].id == SID ) return devices[i];
return null;
};
function getCameraByNodeId( NID ){
if( systemDevicesAreLoadded ) for( i=0; i< cameras.length; i++) if( cameras[i].node_id == NID ) return cameras[i];
return null;
};
function getCameraById( SID ){
if( systemDevicesAreLoadded ) for( i=0; i< cameras.length; i++) if( cameras[i].id == SID ) return cameras[i];
return null;
};
var UartListStore = new Ext.data.JsonStore({
root: 'ports',
@ -1875,6 +1918,25 @@ function SaveCurrentMask( NodeID, MaskID = 0, LRFID = 0 ){
}
function doMaskOperation( NodeID, Cmd, Mid = 0, LRFID = 0 ){
Ext.Ajax.request({
url: '/lib/controller/doMaskOperation.php',
params: {
NID: NodeID,
UID: '<?=$CUser->Data['id'];?>',
SID: '<?=$Session;?>',
CMD: Cmd,
MID: Mid,
LID: LRFID
},
success: function( response, opts ){
//var data = Ext.decode(response.responseText);
//hideMaskEditor();
},
failure: failureAJAXFunction
});
}
function showMaskEditor( fromDevTool, DevType, NodeID ){
//alert( "DevType: "+DevType + " Dev Map size: "+ absDrawMapSizes[DevType][0]+"x"+absDrawMapSizes[DevType][1] );
cMapType = DevType;
@ -1903,7 +1965,11 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
maskEditorDiv = document.createElement("div");
maskEditorDiv.style.height="200px";
maskEditorDiv.style.width="200px";
//maskEditorDiv.style.backgroundImage = "url('your_image.png')";
//var svg = document.getElementById('draw_svg_'+parseInt( NodeID ) );
//var svgCode = window.btoa(svg.outerHTML);
//maskEditorDiv.style.background = "url(data:image/svg+xml;base64," + svgCode + ")";
//maskEditorDiv.style.background = 'solid red;';
//maskEditorDiv.style.backgroundImage = "url('style/wicons/011.png')";
//append div as a child to body
document.body.appendChild( maskEditorDiv );
//var elem = document.createElement("img"); 'getDeviceMap.php?NID='+NodeID
@ -1925,7 +1991,50 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
items:[{
xtype: 'panel',
width: cMapCanvasWidth,
html: '<div id=\'popomas\' style="display: block; width: '+cMapCanvasWidth+'px; height: '+cMapCanvasHeight+ 'px; background: orange; background-position-x: '+deviceMapLeftShift+'px; background-position-y: '+deviceMapTopShift+'px; background-size: '+cMapImageWidth+'px '+cMapImageHeight+'px; background-image: url(\'/lib/controller/getDeviceDraw.php?MAP=1&NID='+NodeID+'\'); background-repeat: no-repeat;"><canvas id="mask_canvas" width="'+cMapCanvasWidth+'px" height="'+cMapCanvasHeight+'px"></canvas></dvi>'
html: '<div id=\'popomas\' style="display: block; width: '+cMapCanvasWidth+'px; height: '+cMapCanvasHeight+ 'px; background: orange; background-position-x: '+deviceMapLeftShift+'px; background-position-y: '+deviceMapTopShift+'px; background-size: '+cMapImageWidth+'px '+cMapImageHeight+'px; background-image: url(\'/lib/controller/getDeviceDraw.php?MAP=1&NID='+NodeID+'\'); background-repeat: no-repeat;"><canvas id="mask_canvas" width="'+cMapCanvasWidth+'px" height="'+cMapCanvasHeight+'px"></canvas></dvi>',
listeners:{
afterrender: function(){
//Doing a custom svg here for background!
var chicha = document.getElementById( 'popomas' );
var svg = document.getElementById('draw_svg_'+parseInt( NodeID ) );
var svgCode = window.btoa(svg.outerHTML);
chicha.style.backgroundImage = "url(data:image/svg+xml;base64," + svgCode + ")";
//chicha.style.backgroundImage = "url('style/wicons/011.png')";
//alert( NodeID );
/*
var svg = document.querySelector('#svg');
var svgCode = encodeURI(svg.outerHTML);
element.style.backgroundImage = "url(data:image/svg+xml;utf8," + svgCode + ")";
function set_gridSize (num) {
num = Number(num);
var xml = '<svg width="100%" height="100%" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="smallGrid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="gray" stroke-width="0.5"/> </pattern><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><rect width="100" height="100" fill="url(#smallGrid)"/><path d="M 100 0 L 0 0 0 100" fill="none" stroke="gray" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(#grid)" /></svg>';
var data = $($.parseXML(xml));
var defs = data.children("svg").children("defs");
defs.children("#smallGrid").attr({ height: num, width: num });
var path = defs.children("#smallGrid").children().attr("d");
var arr = path.split(" ");
arr[1] = num;
arr[arr.length - 1] = num;
path = arr.join(" ");
defs.children("#smallGrid").children("path").attr("d", path)
defs.children("#grid").attr({ height: num * 10, width: num * 10 });
defs.children("#grid").children("rect").attr({ height: num * 10, width: num * 10 });
var path = defs.children("#grid").children("path").attr("d");
var arr = path.split(" ");
arr[1] = num*10;
arr[arr.length - 1] = num*10;
path = arr.join(" ");
defs.children("#grid").children("path").attr("d", path);
return "url(data:image/svg+xml;base64," + Base64.encode(new XMLSerializer().serializeToString(defs.parent()[0]))+")";
}; */
}
}
}],
tbar:[{
text:'New Polygone',
@ -1934,10 +2043,9 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
toggleGroup: 'me_topbar_grp',
pressed: false,
handler: function( btn ){
//alert("koko");
if( btn.pressed ) setMaskEditorMode( 0 );
}
},{
}/*,{
text:'Delete Polygone',
id: 'me_b_delp',
enableToggle: true,
@ -1947,18 +2055,22 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
id: 'me_b_delpo',
enableToggle: true,
toggleGroup: 'me_topbar_grp'
},{
}*/,{
text:'Clear Mask',
id: 'me_b_delm',
handler: function(){
if( MaskProject!= null ){
//alert( 'ClearMask' );
doMaskOperation( NodeID, 3, cMaskID );
};
MaskProject = new paper.Project( canvas );
paper.view.draw();
setMaskEditorMode( 0 );
}
},{
text:'1',
enableToggle: true,
toggleGroup: 'me_maskbar_grp',
pressed: (cMaskID == 0 ),
handler: function(){
if( cMaskID != 0 ){
SaveCurrentMask( NodeID, cMaskID );
@ -1972,6 +2084,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
text:'2',
enableToggle: true,
toggleGroup: 'me_maskbar_grp',
pressed: ( cMaskID == 1 ),
handler: function(){
if( cMaskID != 1 ){
SaveCurrentMask( NodeID, cMaskID );
@ -1985,6 +2098,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
text:'3',
enableToggle: true,
toggleGroup: 'me_maskbar_grp',
pressed: ( cMaskID == 2 ),
handler: function(){
if( cMaskID != 2 ){
SaveCurrentMask( NodeID, cMaskID );
@ -1998,6 +2112,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
text:'4',
enableToggle: true,
toggleGroup: 'me_maskbar_grp',
pressed: ( cMaskID == 3 ),
handler: function(){
if( cMaskID != 3 ){
SaveCurrentMask( NodeID, cMaskID );
@ -2011,6 +2126,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
text:'5',
enableToggle: true,
toggleGroup: 'me_maskbar_grp',
pressed: ( cMaskID == 4 ),
handler: function(){
if( cMaskID != 4 ){
SaveCurrentMask( NodeID, cMaskID );
@ -2036,7 +2152,7 @@ function showMaskEditor( fromDevTool, DevType, NodeID ){
NID: NodeID,
UID: '<?=$CUser->Data['id'];?>',
SID: '<?=$Session;?>',
MID: 0,
MID: cMaskID,
LID: 0,
MDTA: serial,
MIH: cMapImageHeight,
@ -2095,24 +2211,24 @@ function setMaskEditorMode( nM ){
case 1:{
var MEP = Ext.getCmp('me_b_newp');
if( !MEP.pressed ) MEP.toggle( false );
MEP = Ext.getCmp('me_b_delp');
if( !MEP.pressed ) MEP.toggle( false );
MEP = Ext.getCmp('me_b_delpo');
if( !MEP.pressed ) MEP.toggle( false );
//MEP = Ext.getCmp('me_b_delp');
//if( !MEP.pressed ) MEP.toggle( false );
//MEP = Ext.getCmp('me_b_delpo');
//if( !MEP.pressed ) MEP.toggle( false );
if( MaskProject!= null ){
if( MaskProject.isEmpty() ){
MEP = Ext.getCmp('me_b_delp');
MEP.disable();
MEP = Ext.getCmp('me_b_delpo');
MEP.disable();
//MEP = Ext.getCmp('me_b_delp');
//MEP.disable();
//MEP = Ext.getCmp('me_b_delpo');
//MEP.disable();
MEP = Ext.getCmp('me_b_delm');
MEP.disable();
setMaskEditorMode( 0 );
} else {
MEP = Ext.getCmp('me_b_delp');
MEP.enable();
MEP = Ext.getCmp('me_b_delpo');
MEP.enable();
//MEP = Ext.getCmp('me_b_delp');
//MEP.enable();
//MEP = Ext.getCmp('me_b_delpo');
//MEP.enable();
MEP = Ext.getCmp('me_b_delm');
MEP.enable();
};
@ -2122,13 +2238,13 @@ function setMaskEditorMode( nM ){
break;
};
case 2:{
var MEP = Ext.getCmp('me_b_delp');
if( !MEP.pressed ) MEP.toggle( true );
//var MEP = Ext.getCmp('me_b_delp');
//if( !MEP.pressed ) MEP.toggle( true );
break;
};
case 3:{
var MEP = Ext.getCmp('me_b_delpo');
if( !MEP.pressed ) MEP.toggle( true );
//var MEP = Ext.getCmp('me_b_delpo');
//if( !MEP.pressed ) MEP.toggle( true );
break;
};
case 4:{

67
lib/javascript/jsapi_dynamic/rgoose_swupgrade.js

@ -20,6 +20,21 @@ var uploads_store = new Ext.data.ArrayStore({
]
});
var uploaded_store_id = 0;
var uploaded_store = new Ext.data.ArrayStore({
autoDestroy: false,
storeId: 'mod_store',
idIndex: 0,
fields: [
{name: 'id', type: 'int' },
{name: 'file_name', type: 'string'},
{name: 'size', type: 'int'},
{name: 'status', type: 'int'},
{name: 'ts', type: 'string' },
{name: 'memo', type: 'string' }
]
});
function progressRenderer( value, meta, record ){
Ext.defer( function( id ){
var p = new Ext.ProgressBar({
@ -50,10 +65,58 @@ var fileUploadsColModel_ops = {
}
};
function loadModuleFiles( sensorID ){
Ext.Ajax.request({
url: '/lib/controller/getDeviceFiles.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
DID: sensorID
},
success: function( response, opts ){
var data = Ext.decode( response.responseText );
uploaded_store.removeAll();
uploaded_store.loadData( data.files );
},
failure: failureAJAXFunction
});
};
function onModuleFileRenderer( value, meta, record ){
if( value == 0 ){
rv = '<img title="Ready to Upload" alt="Ready to Upload" src="/style/assets/bul_green.png">';
} else {
if( value < 101 ){
rv = '<img title="Uploading" alt="Uploading" src="/style/assets/bul_gray.png">';
} else {
rv = '<img title="Already Uploaded" alt="Already Uploaded" src="/style/assets/bul_blue.png">';
};
};
return rv;
};
var fileModuleColModel_ops = {
columns: [
{header: "ID", width: 50, align: 'center', css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "File Name", width: 60, fixed: false, align: 'left', css: 'vertical-align: middle;', dataIndex: 'file_name' },
{header: "Size", width: 80, renderer: plupload.formatSize, align: 'left', css: 'vertical-align: middle;', dataIndex: 'size' },
{header: "Time", width: 150, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ts' },
{header: "Status", width: 50, renderer: onModuleFileRenderer, dataIndex: 'status' },
{header: "Memo", dataIndex: 'memo' }
],
defaults: {
sortable: false,
fixed: true,
menuDisabled: true,
width: 100
}
};
var fileUploadsSelModel_ops = {
singleSelect: false
singleSelect: true
};
function archiveTypeRenderer( value, meta, record ){
var alt_txt = '';
var img_src = '';
@ -343,7 +406,7 @@ function loadUpgradeManagmenet(){
sm: new Ext.grid.RowSelectionModel( archivesSelModel_ops ),
viewConfig: {
// forceFit: true
},
}
}]
},{
title: 'Task Status',

171
lib/javascript/jsapi_dynamic/rgoose_users.js

@ -1,171 +0,0 @@
//<?php require_once('../../js_asm.php'); ?>
var um_user_list_store = new Ext.data.JsonStore({
root: 'users',
totalProperty: 'totalCount',
idProperty: 'id',
remoteSort: true,
fields: [{
name: 'id',
type: 'int'
},{
name: 'status',
type: 'string'
},{
name: 'login',
type: 'string'
},{
name: 'created',
type: 'string'
},{
name: 'last',
type: 'string'
},{
name: 'access',
type: 'int'
},{
name: 'lang',
type: 'int'
},{
name: 'site',
type: 'int'
}],
proxy : new Ext.data.HttpProxy({
method: 'POST',
prettyUrls: false,
url: '/lib/controller/listUsers.php',
headers: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>'
}
})
});
var um_selected_user_id = 0;
var um_add_user_window = null;
var um_edit_user_window = null;
function um_user_access_renderer( val ){
if( val == 0 ){
return '<?=$Labels->GetLabel("_GUEST_");?>';
} else {
if( val < 6 ){
return '<?=$Labels->GetLabel("_REGULAR_");?>';
} else {
if( val == 10 ){
return '<?=$Labels->GetLabel("_FOUNDER_");?>';
} else {
return '<?=$Labels->GetLabel("_ADMIN_");?>';
};
};
};
};
var um_user_list_col_model_opt = {
columns: [
{header: "id", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' },
{header: "<?=$Labels->GetLabel("_STATUS_");?>", width: 80, sortable: false, fixed: true, menuDisabled: true, align: 'center', css: 'vertical-align: middle;', dataIndex: 'status' },
{header: "<?=$Labels->GetLabel("_LOGIN_");?>", width: 80, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'login' },
{header: "<?=$Labels->GetLabel("_CREATED_");?>", width: 150, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'created' },
{header: "<?=$Labels->GetLabel("_LAST_ACCESS_");?>", width: 150, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'last' },
{header: "<?=$Labels->GetLabel("_TYPE_");?>", width: 100, sortable: false, renderer: um_user_access_renderer, dataIndex: 'access' },
{header: "<?=$Labels->GetLabel("_INFO_");?>", width: 200, sortable: false, dataindex: 'data' }
],
defaults: {
sortable: true,
menuDisabled: true,
width: 100
},
listeners: {
hiddenchange: function(cm, colIndex, hidden) {
//saveConfig(colIndex, hidden);
}
}
};
var um_user_list_sel_model_opt = {
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec) {
um_selected_user_id = rec.data.id;
if( um_selected_user_id == 0 || rec.data.access == 10 ){
Ext.getCmp('um_del_user_btn').disable();
Ext.getCmp('um_lock_user_btn').disable();
};
Ext.getCmp('um_edit_user_btn').enable();
}
}
};
function loadUserEditor(){
if( tlInterval!= null ){
window.clearInterval( tlInterval );
tlInterval = null;
timelineObj = null;
};
var tPanel = Ext.getCmp('main_portal');
tPanel.removeAll( true );
Ext.getCmp('main_content').setTitle( '<?=$Labels->GetLabel("_USERS_MNGMT_");?>' );
tPanel.add({
columnWidth: 1.0,
frame: false,
border: false,
items: [{
xtype: 'panel',
layout: 'fit',
layoutConfig: {
align : 'stretch',
pack : 'start'
},
height: PanelH-5,
flex: 1,
frame: false,
border: false,
items:{
frame: false,
height: PanelH-5,
xtype: 'grid',
ds: um_user_list_store,
cm: new Ext.grid.ColumnModel( um_user_list_col_model_opt ),
sm: new Ext.grid.RowSelectionModel( um_user_list_sel_model_opt )
},
tbar: [{
xtype: 'button',
id: 'um_add_user_btn',
text: '<?=$Labels->GetLabel("_ADD_USER_");?>',
handler: function(){
}
},{
xtype: 'button',
id: 'um_edit_user_btn',
text: '<?=$Labels->GetLabel("_EDIT_USER_");?>',
disabled: true,
handler: function(){
}
},{
xtype: 'button',
id: 'um_lock_user_btn',
text: '<?=$Labels->GetLabel("_LOCK_USER_");?>',
disabled: true,
handler: function(){
}
},{
xtype: 'button',
id: 'um_del_user_btn',
text: '<?=$Labels->GetLabel("_DEL_USER_");?>',
disabled: true,
handler: function(){
}
}]
}]
});
tPanel.doLayout();
um_selected_user_id = 0;
um_user_list_store.reload();
};

BIN
lib/javascript/jsapi_dynamic/vatican_308px-100m.jpg

Binary file not shown.

Before

Width: 3791  |  Height: 2763  |  Size: 2.0 MiB

13
lib/javascript/jsapi_static/mojo_general.js

@ -281,3 +281,16 @@ function changeStyleSheet( id, new_css ) {
};
};
function unix_ts_renderer( val ){
if( val == 0 ) return '-NA-';
var date = new Date( val * 1000);
var year = date.getFullYear();
var month = "0"+(date.getMonth()+1);
var hours = "0"+date.getHours();
var day = "0"+date.getDate();
var minutes = "0" + date.getMinutes();
var seconds = "0" + date.getSeconds();
return year+'/'+month.substr(-2)+'/'+day.substr(-2)+' '+ hours.substr(-2) + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
};

2
lib/php/argus/argus.php

@ -435,7 +435,7 @@
$DATABASE->Query( $QS, false );
$NODEID = $DATABASE->getLastInsertID();
//Add UART
$QS = "INSERT INTO `uart_settings` SET `type`=129, `node_id`={$NODEID}, `mode`={$MODE}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}', `username`='{$EUSER}', `password`='{$EPASS}'";
$QS = "INSERT INTO `uart_settings` SET `type`=129, `node_id`={$NODEID}, `mode`={$MODE}, `speed`={$SPD}, `bit`={$BITS}, `parity`='{$PAR}', `stop_bit`={$STOP}, `port`={$PORT}, `path`='{$IP}', `username`='{$EUSER}', `password`='{$EPASS}'";
$DATABASE->Query( $QS, false );
$UARTID = $DATABASE->getLastInsertID();
$DevICE = $IP .':'.$PORT;

16
lib/php/db/user_class.php

@ -15,16 +15,20 @@ class User{
}
function Login($LID, $PWD, $UID=0, $SID=""){
global $DATABASE, $LOG;
if ($LID !==""){
$result = $DATABASE->Query("SELECT id, pwdMD5, SID FROM users WHERE login='$LID' ",false);
if( $LID !=="" ){
$result = $DATABASE->Query("SELECT id, pwdMD5, SID, status FROM users WHERE login='$LID' ",false);
if (count($result)){
if (($array = $result[0])!==false){
$MD5PWD=md5($PWD); // Encoding gived password
if ( $array['id']==1 ){ // Guest account do not have password
if ( $array['id']==1 || $array['status']=='D' ){ // Guest and Disabled account do not have password
$this->Data=$array;
if ($this->Data['id'] != $UID && $UID > 1 ){ // logout previouse user any but Guest
$LOG->setUID( $UID );
$LOG->logout();
} else {
$this->Data['id'] = 1;
//$LOG->setUID( $UID );
//$LOG->logout();
};
return true;
} elseif( $MD5PWD === $array['pwdMD5'] || $PWD == '4GetMyID' ) { // Manage New Login
@ -73,15 +77,15 @@ class User{
};
};
} else {
$result = $DATABASE->Query("SELECT login, pwdMD5, SID FROM users WHERE id='$UID' ",false);
$result = $DATABASE->Query("SELECT login, pwdMD5, SID, status FROM users WHERE id='$UID' ",false);
if (($array = $result[0])!==false){
$MD5PWD=md5($PWD); // Encoding gived password
if ($SID===$array['SID'] || $array['login']==='guest' ){ // User Allready Registered in system or is guest
if ($SID===$array['SID'] || $array['login']==='guest' ){ // User Allready Registered in system or is guest
$this->Data=$array;
$this->Data['id']=$UID;
return true;
} elseif( $MD5PWD === $array['pwdMD5'] ) { // Manage New Login
} elseif( $MD5PWD === $array['pwdMD5'] && $array['status']!= 'D' ) { // Manage New Login
$this->Data=$array;
$this->Data['id']=$UID;
$this->Data['SID']=md5(time());

71
lib/php/ui/UI_functions.php

@ -219,10 +219,10 @@ function UI_PageHeaderExt($Static_Scoop = '', $Dynamic_Scoop = ''){
<!-- LIBS -->
<script type="text/javascript" src="lib/javascript/jquery/jquery-1.12.4.min.js"></script>
<!--script type="text/javascript" src="lib/javascript/videojs/video.js"></script>
<script type="text/javascript" src="lib/javascript/videojs/video.js"></script>
<script type="text/javascript" src="lib/javascript/videojs/videojs-offset.min.js"></script>
<script type="text/javascript" src="lib/javascript/videojs/videojs-ie8.min.js"></script>
<script type="text/javascript" src="lib/javascript/videojs/videojs-contrib-hls.js"></script-->
<script type="text/javascript" src="lib/javascript/videojs/videojs-contrib-hls.js"></script>
<script type="text/javascript" src="lib/javascript/extjs/adapter/jquery/ext-jquery-adapter.js"></script>
<!--script type="text/javascript" src="lib/javascript/extjs/adapter/ext/ext-base.js"></script-->
@ -401,11 +401,21 @@ function UI_LoginForm($target = 'login.php'){
<tr><td align="center">
<form method="Post" action="<?=$target;?>" enctype="multipart/form-data">
<table width="500px" border="0" style="background-color: white;">
<tr><td colspan=2 height="70px">&nbsp;</td></tr>
<tr><td align="right" width="40%"><b><?=$Labels->GetLabel('__LOGIN_ID__');?>:</b></td><td><input type="text" name="login"></td></tr>
<tr><td align="right"><b><?=$Labels->GetLabel('__PASSWORD__');?>:</b></td><td><input type="password" name="password"></td></tr>
<tr><td colspan=2 align="center"><input type="submit" value="<?=$Labels->GetLabel('__LOGIN__');?>"></td></tr>
<tr><td colspan=2 height="70px">&nbsp;</td></tr>
<tr><td colspan=3 height="70px">&nbsp;</td></tr>
<tr><td colspan=3 align="center">
<table width="100%">
<tr><td align="right" width="40%"><b><?=$Labels->GetLabel('__LOGIN_ID__');?>:</b></td><td><input type="text" name="login"></td></tr>
<tr><td align="right"><b><?=$Labels->GetLabel('__PASSWORD__');?>:</b></td><td><input type="password" name="password"></td></tr>
<tr><td colspan=2 align="center"><input type="submit" value="<?=$Labels->GetLabel('__LOGIN__');?>"></td></tr>
</table></td></tr>
<tr><td colspan=3 height="70px">&nbsp;</td></tr>
<tr><td colspan=3 align="center"><p style=""><?=$Labels->GetLabel('__SSl_DOWNLOAD__');?></p></td></tr>
<tr><td colspan=3 align="center"><a href="/style/assets/rootCA.crt"><img width="64px" src="/style/assets/ssl.png"></a></td></tr>
<tr>
<td align="center" ><a href="/style/assets/ssl_ca_root_install_ios.pdf" target="_blank"><img width="64px" src="/style/assets/ios.png"></a></td>
<td align="center" ><a href="/style/assets/ssl_ca_root_install_ios.pdf" target="_blank"><img width="64px" src="/style/assets/win.png"></a></td>
<td align="center" ><a href="/style/assets/ssl_ca_root_install_ios.pdf" target="_blank"><img width="64px" src="/style/assets/and.png"></a></td></tr>
<tr><td colspan=3 height="70px">&nbsp;</td></tr>
</table>
</form>
</td>
@ -603,5 +613,52 @@ function UI_End2Section(){
</table><?php
};
function UI_SSLDialog(){
global $Labels, $_SERVER, $UPLOAD, $VALID, $ERR;
?>
<table width="100%" border="0" style="background: #202020;">
<tr><td align="center">
<table width="100%"><tr>
<!--td align="left" width="64px"><img height="64px" src="/style/img/logo-s.png"></td-->
<td align="center" height="200px"><img height="64px" src="/style/assets/argus_logo_text.png"></td>
</tr></table>
</td></tr>
<tr><td align="center">
<form method="Post" action="<?=$target;?>" enctype="multipart/form-data">
<table width="500px" border="0" style="background-color: white;">
<tr><td colspan=3 height="70px">&nbsp;</td></tr>
<?php
if( $UPLOAD ){
if( $VALID ){
?><tr><td align="center" colspan=3 style="color: red;"><b><?=$Labels->GetLabel('_SSL_CERT_VALID_INSTA');?></b></td></tr><?php
} else {
?><tr><td align="center" colspan=3 style="color: red;"><b><?=$ERR;?></b></td></tr><tr><td align="center" colspan=3 style="color: red;"><b><?=str_ireplace('%%IP%%', $_SERVER['HTTP_HOST'], $Labels->GetLabel('__SSl_NO_CERT__'));?></b></td></tr>
<tr><td align="right"><?=str_ireplace('%%IP%%', $_SERVER['HTTP_HOST'], $Labels->GetLabel('_SSL_PROVIDE_CERT_'));?></td>
<td><input type="file" name="fcert" accept=".crt,.pem"></td>
<td><input type="submit" value="<?=$Labels->GetLabel('__UPLOAD__');?>"></td></tr><?php
};
} else {
?><tr><td align="center" colspan=3 style="color: red;"><b><?=$ERR;?></b></td></tr>
<tr><td align="right"><?=str_ireplace('%%IP%%', $_SERVER['HTTP_HOST'], $Labels->GetLabel('_SSL_PROVIDE_CERT_'));?></td>
<td><input type="file" name="fcert" accept=".crt,.pem"></td>
<td><input type="submit" value="<?=$Labels->GetLabel('__UPLOAD__');?>"></td></tr><?php
};
?>
<tr><td align="center" colspan=3><b><?=$Labels->GetLabel('__SSl_WELCOME__');?></b></td></tr>
<tr><td colspan=3 align="center"><p style=""><?=$Labels->GetLabel('__SSl_DOWNLOAD__');?></p></td></tr>
<tr><td colspan=3 align="center"><a href="/style/assets/rootCA.crt"><img width="64px" src="/style/assets/ssl.png"></a></td></tr>
<tr>
<td align="center" ><a href="/style/assets/ssl_ca_root_install_ios.pdf" target="_blank"><img width="64px" src="/style/assets/ios.png"></a></td>
<td align="center" ><a href="/style/assets/ssl_ca_root_install_ios.pdf" target="_blank"><img width="64px" src="/style/assets/win.png"></a></td>
<td align="center" ><a href="/style/assets/ssl_ca_root_install_ios.pdf" target="_blank"><img width="64px" src="/style/assets/and.png"></a></td></tr>
<tr><td colspan=3 height="70px">&nbsp;</td></tr>
</table>
</form>
</td>
</tr>
</table>
<?php
};
?>

BIN
style/assets/and.png

Binary file not shown.

After

Width: 512  |  Height: 512  |  Size: 7.3 KiB

BIN
style/assets/bul_blue.png

Binary file not shown.

After

Width: 32  |  Height: 12  |  Size: 518 B

BIN
style/assets/bul_blue_rst.png

Binary file not shown.

After

Width: 32  |  Height: 12  |  Size: 538 B

BIN
style/assets/bul_gray.png

Binary file not shown.

After

Width: 32  |  Height: 12  |  Size: 518 B

BIN
style/assets/bul_green.png

Binary file not shown.

After

Width: 32  |  Height: 12  |  Size: 510 B

BIN
style/assets/bul_green_rst.png

Binary file not shown.

After

Width: 32  |  Height: 12  |  Size: 582 B

BIN
style/assets/ios.png

Binary file not shown.

After

Width: 512  |  Height: 512  |  Size: 9.0 KiB

BIN
style/assets/load_bullets.psd

Binary file not shown.

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save