Permalink
Browse files

Merge pull request #13 from lanket/Ver2

Исправил косяки с сохранением параметров boolian,
  • Loading branch information...
lanket committed Jan 6, 2019
2 parents a6a306e + ab75e07 commit 92c7ef494378d957b6b7fbfc7c5644021feed3ee
@@ -17,7 +17,7 @@ class mdmPiTerminal extends module {
* @access private
*/
function mdmPiTerminal() {
$this->debug = 0;
$this->debug = 1;
$this->name="mdmPiTerminal";
$this->title="MDM VoiceAssistant";
$this->module_category="<#LANG_SECTION_DEVICES#>";
@@ -314,26 +314,26 @@ function dbInstall($data) {
$data = <<<EOD
mpt: ID int(10) unsigned NOT NULL auto_increment
mpt: ID_TERMINAL varchar(255) NOT NULL DEFAULT ''
mpt: SETTINGS_ALARMKWACTIVATED BOOLEAN NOT NULL DEFAULT TRUE
mpt: SETTINGS_ALARMTTS BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_ALARMSTT BOOLEAN NOT NULL DEFAULT TRUE
mpt: SETTINGS_ALARMKWACTIVATED BOOLEAN NOT NULL DEFAULT 1
mpt: SETTINGS_ALARMTTS BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_ALARMSTT BOOLEAN NOT NULL DEFAULT 1
mpt: SETTINGS_ASK_ME_AGAIN TINYINT NOT NULL DEFAULT 0
mpt: SETTINGS_QUIET BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_NO_HELLO BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_QUIET BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_NO_HELLO BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_PHRASE_TIME_LIMIT TINYINT NOT NULL DEFAULT 15
mpt: SETTINGS_CHROME_MODE TINYINT NOT NULL DEFAULT 2
mpt: SETTINGS_CHROME_CHOKE BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_CHROME_ALARMSTT BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_CHROME_CHOKE BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_CHROME_ALARMSTT BOOLEAN NOT NULL DEFAULT 0
mpt: SNOWBOY_TOKEN varchar(100) NOT NULL DEFAULT 'd4977cf8ff6ede6efb8d2277c1608c7dbebf18a7'
mpt: SETTINGS_SENSITIVITY varchar(3) NOT NULL DEFAULT '0.7'
mpt: SETTINGS_PROVIDERTTS varchar(20) NOT NULL DEFAULT 'google'
mpt: SETTINGS_PROVIDERSTT varchar(20) NOT NULL DEFAULT 'google'
mpt: MAJORDOMO_HEARTBEAT_TIMEOUT INT(4) NOT NULL DEFAULT 0
mpt: MPD_CONTROL BOOLEAN NOT NULL DEFAULT TRUE
mpt: MPD_CONTROL BOOLEAN NOT NULL DEFAULT 1
mpt: MPD_IP varchar(15) NOT NULL DEFAULT '127.0.0.1'
mpt: MPD_PORT varchar(5) NOT NULL DEFAULT '6600'
mpt: MPD_PAUSE BOOLEAN NOT NULL DEFAULT TRUE
mpt: MPD_SMOOTHLY BOOLEAN NOT NULL DEFAULT FALSE
mpt: MPD_PAUSE BOOLEAN NOT NULL DEFAULT 1
mpt: MPD_SMOOTHLY BOOLEAN NOT NULL DEFAULT 0
mpt: MPD_QUIETER TINYINT NOT NULL DEFAULT 0
mpt: MPD_WAIT_RESUME TINYINT NOT NULL DEFAULT 5
mpt: YANDEX_APIKEYTTS varchar(100) NOT NULL DEFAULT ''
@@ -344,7 +344,7 @@ function dbInstall($data) {
mpt: AWS_ACCESS_KEY_ID varchar(100) NOT NULL DEFAULT ''
mpt: AWS_SECRET_ACCESS_KEY varchar(100) NOT NULL DEFAULT ''
mpt: AWS_REGION varchar(15) NOT NULL DEFAULT 'eu-central-1'
mpt: AWS_BOTO3 BOOLEAN NOT NULL DEFAULT FALSE
mpt: AWS_BOTO3 BOOLEAN NOT NULL DEFAULT 0
mpt: RHVOICE0REST_SERVER varchar(100) NOT NULL DEFAULT 'http:\/\/127.0.0.1:8080'
mpt: RHVOICE0REST_SPEAKER varchar(15) NOT NULL DEFAULT 'anna'
mpt: RHVOICE0REST_RATE TINYINT NOT NULL DEFAULT 50
@@ -353,15 +353,15 @@ function dbInstall($data) {
mpt: RHVOICE_SPEAKER varchar(15) NOT NULL DEFAULT 'anna'
mpt: POCKETSPHINX0REST_SERVER varchar(100) NOT NULL DEFAULT 'http:\/\/127.0.0.1:8085'
mpt: CACHE_TTS_PRIORITY varchar(20) NOT NULL DEFAULT 'google'
mpt: PROXY_ENABLE BOOLEAN NOT NULL DEFAULT FALSE
mpt: PROXY_MONKEY_PATCHING BOOLEAN NOT NULL DEFAULT TRUE
mpt: PROXY_ENABLE BOOLEAN NOT NULL DEFAULT 0
mpt: PROXY_MONKEY_PATCHING BOOLEAN NOT NULL DEFAULT 1
mpt: PROXY_PROXY varchar(100) NOT NULL DEFAULT 'socks5h:\/\/127.0.0.1:9050'
mpt: UPDATE_INTERVAL TINYINT NOT NULL DEFAULT 0
mpt: UPDATE_TURNOFF TINYINT NOT NULL DEFAULT -1
mpt: UPDATE_FALLBACK BOOLEAN NOT NULL DEFAULT TRUE
mpt: UPDATE_FALLBACK BOOLEAN NOT NULL DEFAULT 1
mpt: CACHE_TTS_SIZE INT(3) NOT NULL DEFAULT '100'
mpt: UPDATE_PIP BOOLEAN NOT NULL DEFAULT TRUE
mpt: UPDATE_APT BOOLEAN NOT NULL DEFAULT FALSE
mpt: UPDATE_PIP BOOLEAN NOT NULL DEFAULT 1
mpt: UPDATE_APT BOOLEAN NOT NULL DEFAULT 0
mpt: MAJORDOMO_OBJECT_METHOD varchar(100) NOT NULL DEFAULT ''
mpt: MAJORDOMO_OBJECT_NAME varchar(100) NOT NULL DEFAULT ''
EOD;
@@ -377,26 +377,26 @@ function validate($param)
$param=strtoupper($param);
$db = <<<EOD
mpt: ID_TERMINAL varchar(255) NOT NULL DEFAULT ''
mpt: SETTINGS_ALARMKWACTIVATED BOOLEAN NOT NULL DEFAULT TRUE
mpt: SETTINGS_ALARMTTS BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_ALARMSTT BOOLEAN NOT NULL DEFAULT TRUE
mpt: SETTINGS_ALARMKWACTIVATED BOOLEAN NOT NULL DEFAULT 1
mpt: SETTINGS_ALARMTTS BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_ALARMSTT BOOLEAN NOT NULL DEFAULT 1
mpt: SETTINGS_ASK_ME_AGAIN TINYINT NOT NULL DEFAULT 0
mpt: SETTINGS_QUIET BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_NO_HELLO BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_QUIET BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_NO_HELLO BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_PHRASE_TIME_LIMIT TINYINT NOT NULL DEFAULT 15
mpt: SETTINGS_CHROME_MODE TINYINT NOT NULL DEFAULT 2
mpt: SETTINGS_CHROME_CHOKE BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_CHROME_ALARMSTT BOOLEAN NOT NULL DEFAULT FALSE
mpt: SETTINGS_CHROME_CHOKE BOOLEAN NOT NULL DEFAULT 0
mpt: SETTINGS_CHROME_ALARMSTT BOOLEAN NOT NULL DEFAULT 0
mpt: SNOWBOY_TOKEN varchar(100) NOT NULL DEFAULT 'd4977cf8ff6ede6efb8d2277c1608c7dbebf18a7'
mpt: SETTINGS_SENSITIVITY varchar(3) NOT NULL DEFAULT '0.7'
mpt: SETTINGS_PROVIDERTTS varchar(20) NOT NULL DEFAULT 'google'
mpt: SETTINGS_PROVIDERSTT varchar(20) NOT NULL DEFAULT 'google'
mpt: MAJORDOMO_HEARTBEAT_TIMEOUT INT(4) NOT NULL DEFAULT 0
mpt: MPD_CONTROL BOOLEAN NOT NULL DEFAULT TRUE
mpt: MPD_CONTROL BOOLEAN NOT NULL DEFAULT 1
mpt: MPD_IP varchar(15) NOT NULL DEFAULT '127.0.0.1'
mpt: MPD_PORT varchar(5) NOT NULL DEFAULT '6600'
mpt: MPD_PAUSE BOOLEAN NOT NULL DEFAULT TRUE
mpt: MPD_SMOOTHLY BOOLEAN NOT NULL DEFAULT FALSE
mpt: MPD_PAUSE BOOLEAN NOT NULL DEFAULT 1
mpt: MPD_SMOOTHLY BOOLEAN NOT NULL DEFAULT 0
mpt: MPD_QUIETER TINYINT NOT NULL DEFAULT 0
mpt: MPD_WAIT_RESUME TINYINT NOT NULL DEFAULT 5
mpt: YANDEX_APIKEYTTS varchar(100) NOT NULL DEFAULT ''
@@ -407,7 +407,7 @@ function validate($param)
mpt: AWS_ACCESS_KEY_ID varchar(100) NOT NULL DEFAULT ''
mpt: AWS_SECRET_ACCESS_KEY varchar(100) NOT NULL DEFAULT ''
mpt: AWS_REGION varchar(15) NOT NULL DEFAULT 'eu-central-1'
mpt: AWS_BOTO3 BOOLEAN NOT NULL DEFAULT FALSE
mpt: AWS_BOTO3 BOOLEAN NOT NULL DEFAULT 0
mpt: RHVOICE0REST_SERVER varchar(100) NOT NULL DEFAULT 'http://127.0.0.1:8080'
mpt: RHVOICE0REST_SPEAKER varchar(15) NOT NULL DEFAULT 'anna'
mpt: RHVOICE0REST_RATE TINYINT NOT NULL DEFAULT 50
@@ -416,15 +416,15 @@ function validate($param)
mpt: RHVOICE_SPEAKER varchar(15) NOT NULL DEFAULT 'anna'
mpt: POCKETSPHINX0REST_SERVER varchar(100) NOT NULL DEFAULT 'http://127.0.0.1:8085'
mpt: CACHE_TTS_PRIORITY varchar(20) NOT NULL DEFAULT 'google'
mpt: PROXY_ENABLE BOOLEAN NOT NULL DEFAULT FALSE
mpt: PROXY_MONKEY_PATCHING BOOLEAN NOT NULL DEFAULT TRUE
mpt: PROXY_ENABLE BOOLEAN NOT NULL DEFAULT 0
mpt: PROXY_MONKEY_PATCHING BOOLEAN NOT NULL DEFAULT 1
mpt: PROXY_PROXY varchar(100) NOT NULL DEFAULT 'socks5h://127.0.0.1:9050'
mpt: UPDATE_INTERVAL TINYINT NOT NULL DEFAULT 0
mpt: UPDATE_TURNOFF TINYINT NOT NULL DEFAULT -1
mpt: UPDATE_FALLBACK BOOLEAN NOT NULL DEFAULT TRUE
mpt: CACHE_TTS_SIZE INT(3) NOT NULL DEFAULT '100'
mpt: UPDATE_PIP BOOLEAN NOT NULL DEFAULT TRUE
mpt: UPDATE_APT BOOLEAN NOT NULL DEFAULT FALSE
mpt: UPDATE_FALLBACK BOOLEAN NOT NULL DEFAULT 1
mpt: CACHE_TTS_SIZE INT(3) NOT NULL DEFAULT 100
mpt: UPDATE_PIP BOOLEAN NOT NULL DEFAULT 1
mpt: UPDATE_APT BOOLEAN NOT NULL DEFAULT 0
mpt: MAJORDOMO_OBJECT_METHOD varchar(100) NOT NULL DEFAULT ''
mpt: MAJORDOMO_OBJECT_NAME varchar(100) NOT NULL DEFAULT ''
EOD;
@@ -434,7 +434,7 @@ function validate($param)
$curarray = explode(" ", $cur);
if ($curarray[9] == $param)
{
if($curarray[10] == 'TINYINT' or substr($curarray[2],0,3) == 'INT')
if($curarray[10] == 'TINYINT' or substr($curarray[2],0,3) == 'INT' or $curarray[10] == 'BOOLEAN')
{
if($this->debug == 1) debmes(">mpt edit validate int : $param = $oldvalue > $value ! isset = $setParam xxx " . isset($value));
// if(isset($value))
@@ -9,7 +9,7 @@
$rec=SQLSelectOne("SELECT * FROM $table_name WHERE ID='$id'");
if($rec['ID_TERMINAL'])
{
$tmp = SQLSelectOne('SELECT HOST FROM terminals where ID = ' . $rec['ID_TERMINAL']);
$tmp = SQLSelectOne('SELECT HOST , NAME FROM terminals where ID = ' . $rec['ID_TERMINAL']);
$out['IP_TERMINAL'] = $tmp['HOST'];
}
@@ -22,7 +22,7 @@
if($rec['ID']) $qry = " and ID <> " . $rec['ID'];
$findduble=SQLSelectOne("SELECT * FROM $table_name WHERE ID_TERMINAL='$id_terminal' $qry");
// chech not empy terminal and mast no dubles
if(($rec['ID_TERMINAL'] == '' or $findduble['ID']) and !$_POST['panel_voice'])
if(($rec['ID_TERMINAL'] == '' or $findduble['ID']) and !$_POST['panel_voice'] and !$_POST['panel_admin'])
{
$out['ERR_ID_TERMINAL']=1;
$ok=0;
@@ -147,13 +147,21 @@
if($this->debug == 1) debmes('mpt edit befour ok');
if ($ok) {
if($this->debug == 1) debmes('mpt edit after ok');
$nmTerm = $tmp['NAME'];
if ($rec['ID']) {
if($this->debug == 1) debmes("mpt edit update : $nmTerm ! ip: " . $tmp['HOST']);
if ($this->config['CREATE_CLASS'] == 1)
{
if($this->debug == 1) debmes("mpt edit update CreateClass=True : $nmTerm ! ip: " . $tmp['HOST']);
$rec['MAJORDOMO_OBJECT_METHOD'] = 'TerminalDataProcessing';
$rec['MAJORDOMO_OBJECT_NAME'] = $nmTerm;
$postdata['MAJORDOMO_OBJECT_METHOD'] = 'TerminalDataProcessing';
$postdata['MAJORDOMO_OBJECT_NAME'] = $nmTerm;
}
SQLUpdate($table_name, $rec); // update sql
if($this->debug == 1) debmes('mpt: ' . $tmp['HOST']);
} else {
if($this->debug == 1) debmes('mpt edit no recid insert');
$new_rec=1;
$nmTerm = $tmp['NAME'];
if($this->debug == 1) debmes('mpt edit add object: ' . $nmTerm);
if ($this->config['CREATE_CLASS'] == 1)
{
@@ -12,7 +12,7 @@
Создавать класс 'Terminals', объекты и методы автоматически
</label>
<div class="col-lg-4">
<input type="checkbox" name="create_class" value="true"[#if CREATE_CLASS="true"#] checked[#endif#]>
<input type="checkbox" name="create_class" value="1"[#if CREATE_CLASS="1"#] checked[#endif#]>
</div>
</div>
<div class="form-actions">
Oops, something went wrong.

0 comments on commit 92c7ef4

Please sign in to comment.