Browse Source

Reload Web UI each 10 minutes

master
Evgeny Gagua 2 years ago
parent
commit
18f2ddbd27
  1. 1
      .gitignore
  2. 2
      lib/1.json
  3. 42
      lib/controller/addPhoneBookRecord.php
  4. 42
      lib/controller/delPhoneBookRecord.php
  5. 8
      lib/controller/doModuleOperation.php
  6. 50
      lib/controller/doPhonebookOperation.php
  7. 14
      lib/controller/getModuleSettings.php
  8. 82
      lib/controller/report/node_12.js
  9. 83
      lib/javascript/jsapi_dynamic/mojo_settings.js
  10. 2
      lib/php/auth/web.php

1
.gitignore

@ -1,3 +1,4 @@
error.log
lib/controller/data/*
lib/tmp/*

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

42
lib/controller/addPhoneBookRecord.php

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

42
lib/controller/delPhoneBookRecord.php

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

8
lib/controller/doModuleOperation.php

@ -66,10 +66,10 @@
case 3: if( $OPCODE ) $QS = "UPDATE `module_eve` SET `output_mode`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 4: $QS = "UPDATE `module_modem` SET `modem_id`={$OPCODE} WHERE `id`={$JJ['aux_id']}"; break;
case 5: {
if( $OPCODE == 2 ){
$QS = "UPDATE `module_modem` SET `call_enabled`=1, `sms_enabled`=0 WHERE `id`={$JJ['aux_id']}";
} else {
$QS = "UPDATE `module_modem` SET `call_enabled`=0, `sms_enabled`=1 WHERE `id`={$JJ['aux_id']}";
switch( $OPCODE ){
case 2: $QS = "UPDATE `module_modem` SET `call_enabled`=1, `sms_enabled`=0 WHERE `id`={$JJ['aux_id']}"; break;
case 1: $QS = "UPDATE `module_modem` SET `call_enabled`=0, `sms_enabled`=1 WHERE `id`={$JJ['aux_id']}"; break;
case 3: $QS = "UPDATE `module_modem` SET `call_enabled`=1, `sms_enabled`=1 WHERE `id`={$JJ['aux_id']}"; break;
};
break;
};

50
lib/controller/doPhonebookOperation.php

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

14
lib/controller/getModuleSettings.php

@ -931,7 +931,7 @@ $TPL =<<<EFUFU
height: 5
},{
xtype: 'combo',
fieldLabel: 'Selected Modem',
fieldLabel: '{$Labels->GetLabel('_SELD_MODEM_')}',
id: 'mod_dev',
width: 220,
lazyRender:true,
@ -957,7 +957,7 @@ $TPL =<<<EFUFU
height: 5
},{
xtype: 'combo',
fieldLabel: 'Working Mode',
fieldLabel: '{$Labels->GetLabel('_WORKING_MODE_')}',
id: 'mod_mode',
width: 220,
lazyRender:true,
@ -968,9 +968,9 @@ $TPL =<<<EFUFU
disableKeyFilter: true,
store: new Ext.data.ArrayStore({
fields: ['wm_id','wm_txt'],
data: [[1,'Sending SMS'],[2,'Making Call']]
data: [[1,'Sending SMS'],[2,'Making Call'],[3,'Uppon Phonebook Record']]
}),
value: ('{$CI['sms_enabled']}' =='1')?'1':'2',
value: ('{$CI['sms_enabled']}' =='1'&&'{$CI['call_enabled']}' =='1')?'3':(('{$CI['sms_enabled']}' =='1')?'1':'2'),
valueField: 'wm_id',
displayField: 'wm_txt',
listeners:{
@ -985,7 +985,7 @@ $TPL =<<<EFUFU
xtype: 'numberfield',
id: 'trig_window',
name: 'trig_window',
fieldLabel: 'Call Hangup Dalay (seconds)',
fieldLabel: '{$Labels->GetLabel('_CALL_HU_DELAY_')}',
width: 220,
value: '{$CI['call_hangup_wait']}',
listeners:{
@ -1005,10 +1005,10 @@ $TPL =<<<EFUFU
//width: '100%',
lazyRender: true,
tbar:[{
text: 'Add',
text: '{$Labels->GetLabel('__ADD__')}',
handler: addNewPhoneNumber
},{
text: 'Delete',
text: '{$Labels->GetLabel('_DEL_SELECTED_')}',
id: 'ph_bo_de_bu',
disabled: true,
handler: deletePhoneNumber

82
lib/controller/report/node_12.js

@ -1,18 +1,80 @@
{
id: 'db_node_%%%NODEID%%%',
xtype: 'portlet',
width: 258,
height: %%%HEIGHT%%%+40,
layout:'vbox',
tools: [{
id:'gear',
handler: function(){
editAnalogStream( %%%STREAMID%%%, 1 );
}
}],
id:'gear',
handler: function(){
}
}],
frame: true,
draggable: false,
collapsible: false,
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
items:[{
html: '<img data-enlargeable000 ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" id="img-%%%NODEID%%%" src="%%%SELURL%%%" width="%%%WIDTH%%%" height="%%%HEIGHT%%%"/>',
}]
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
html: '<div id="video-%%%STREAMID%%%" style="display: flex;align-items: center;" ><img id="video-img-%%%STREAMID%%%" ondblclick="fullScreen(\'video-%%%STREAMID%%%\');" style="cursor: zoom-in" src="/style/assets/no-signal.png" width="100%" /><div id="video-ctl-%%%STREAMID%%%" style="float: left; position: absolute; left: 30px; bottom: 30px; z-index: 1000;"></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 = document.getElementById( 'video-%%%STREAMID%%%' );
z.height = XX;
};
};
},
afterrender: function( p ){
var xx = p.getWidth() * ( %%%HEIGHT%%% / %%%WIDTH%%% );
p.setHeight( xx + 32 );
videoElements[videoElements.length] = %%%STREAMID%%%;
var xx = new Ext.Panel({
id: 'video-ctl-panel-%%%STREAMID%%%',
renderTo: 'video-ctl-%%%STREAMID%%%',
border: false,
hidden: true,
frame: false,
width: 400,
height: 42,
layout: 'hbox',
items:[{
xtype: 'button',
width: 32,
iconCls: 'download',
scale: 'medium',
id: 'video-btn-download-%%%STREAMID%%%',
handler: function(){
downloadCurrentVideo( %%%STREAMID%%% );
}
},{
xtype: 'spacer',
width: 20
},{
xtype: 'slider',
width: 250,
id: 'video-slider-%%%STREAMID%%%',
value: 0,
minValue: 0,
maxValue: 100,
listeners:{
change: function( t, b, o ){
setVideoSource( %%%STREAMID%%%, b );
}
}
}]
});
},
beforedestroy: function(){
var oldPlayer = document.getElementById( 'video-%%%STREAMID%%%' );
/*
videojs( oldPlayer ).dispose();
*/
}
}
}

83
lib/javascript/jsapi_dynamic/mojo_settings.js

@ -357,11 +357,20 @@ var modem_pb_store = new Ext.data.JsonStore({
{name: 'custom_msg', type: 'string'}
]
});
function pb_mode_renderer( value ){
switch( value ){
case 0: return '<?=$Labels->GetLabel('_AUTOMATIC_');?>';
case 1: return '<?=$Labels->GetLabel('_CALL_ONLY_');?>';
case 2: return '<?=$Labels->GetLabel('_SMS_ONLY_');?>';
};
return '';
};
var modem_pb_ColModel_ops = {
columns: [
{header: "<?=$Labels->GetLabel('_MODE_');?>", width: 100, dataIndex: 'mode' },
{header: "<?=$Labels->GetLabel('_PHONE_NUM_');?>", width: 200, align: 'left', css: 'vertical-align: middle;', dataIndex: 'number' },
{header: "<?=$Labels->GetLabel('_LABEL_');?>", width: 200, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'label' },
{header: "<?=$Labels->GetLabel('__MODE__');?>", width: 100, dataIndex: 'mode', renderer: pb_mode_renderer },
{header: "<?=$Labels->GetLabel('_PHONE_NUMBER_');?>", width: 200, align: 'left', css: 'vertical-align: middle;', dataIndex: 'number' },
{header: "<?=$Labels->GetLabel('_NAME_LABEL_');?>", width: 200, fixed: false, align: 'center', css: 'vertical-align: middle;', dataIndex: 'label' },
{header: "<?=$Labels->GetLabel('_CUSTOM_MSG_');?>", dataIndex: 'custom_msg' }
],
defaults: {
@ -376,19 +385,8 @@ var modem_pb_SelModel_ops = {
singleSelect: true,
listeners: {
rowselect: function(sm, row, rec ) {
//alert( rec.data.id );
//loadEventProperties( rec.data );
selected_pb_id = rec.data.id;
Ext.getCmp( 'ph_bo_de_bu' ).enable();
//alert( SelectedEvent );
//var CB = Ext.getCmp('con_to_src');
//CB.enable();
//selectedArchiveRecord = rec;
//if( rec.data.bk_type!=3 ){
//
//} else {
//
//};
}
}
};
@ -413,7 +411,6 @@ function loadPhoneBook(){
failure: failureAJAXFunction
});
};
var addNPNWindow = null;
function addNewPhoneNumber(){
if( addNPNWindow == null ){
@ -423,7 +420,7 @@ function addNewPhoneNumber(){
closeAction: 'hide',
resizable: false,
width: 400,
height: 300,
height: 332,
items:[{
xtype: 'form',
labelWidth: 120,
@ -443,19 +440,25 @@ function addNewPhoneNumber(){
return true;
},
value: ''
},{
xtype: 'radio',
id: 'r_ph_auto',
fieldLabel: '<?=$Labels->GetLabel('_AUTOMATIC_');?>',
name: 'ph_cam',
checked: true,
value: '0'
},{
xtype: 'radio',
id: 'r_ph_call',
fieldLabel: '<?=$Labels->GetLabel('_CALL_ONLY_');?>',
name: 'ph_cam',
checked: true,
value: '1'
},{
xtype: 'radio',
id: 'r_ph_msg',
id: 'r_ph_sms',
fieldLabel: '<?=$Labels->GetLabel('_SMS_ONLY_');?>',
name: 'ph_cam',
value: '0'
value: '2'
},{
xtype: 'textarea',
fieldLabel: '<?=$Labels->GetLabel('_CUSTOM_MSG_');?>',
@ -470,13 +473,14 @@ function addNewPhoneNumber(){
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 con = Ext.getCmp( 'r_ph_auto' ).getValue()?'0':(Ext.getCmp( 'r_ph_call' ).getValue()?1:2);
var cust = Ext.getCmp( 'cus_sms' ).getValue();
Ext.Ajax.request({
url: '/lib/controller/addPhoneBookRecord.php',
url: '/lib/controller/doPhonebookOperation.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
OPID: 1,
PNUM: num,
PNAM: lbl,
PCAL: con,
@ -492,20 +496,9 @@ function addNewPhoneNumber(){
title:'<?=$Labels->GetLabel('_ERROR_');?>',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR//,
//fn: function(btn, text){
// if( btn == 'yes' ){
// cleanupChangeNotifier();
// } else {
// loadEditor = false;
// };
//}
icon: Ext.MessageBox.ERROR
});
};
//var tPanel = Ext.getCmp('main_portal');
//tPanel.removeAll(true);
//for( i=0; i < data.length; i++) tPanel.add( data[i] );
//tPanel.doLayout();
},
failure: failureAJAXFunction
});
@ -523,7 +516,29 @@ function addNewPhoneNumber(){
function deletePhoneNumber(){
if( selected_pb_id ){
Ext.Ajax.request({
url: '/lib/controller/doPhonebookOperation.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
OPID: 2,
PBID: selected_pb_id
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.success ){
loadPhoneBook();
} else {
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_ERROR_');?>',
msg: data.msg,
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
};
},
failure: failureAJAXFunction
});
};
};

2
lib/php/auth/web.php

@ -44,6 +44,8 @@
if( isset($_POST['password']) ){
$Password=$_POST['password'];
} elseif ( isset($_GET['pwd']) ){
$Password=$_GET['pwd'];
} else $Password="";
//$LOG->setUID( $UserID );

Loading…
Cancel
Save