From f7564c68ef944e8fc584199c997208488031db7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Tue, 24 Jan 2017 21:18:23 +0100 Subject: [PATCH 1/8] remove management of daemon --- plugin_info/configuration.php | 55 ----------------------------------- 1 file changed, 55 deletions(-) diff --git a/plugin_info/configuration.php b/plugin_info/configuration.php index 14a44ed..9cc4af9 100644 --- a/plugin_info/configuration.php +++ b/plugin_info/configuration.php @@ -85,60 +85,5 @@ -
- -
- -
-
- - - \ No newline at end of file From c8f314b37c38849ecd291eec9dd937aaef7b8215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Tue, 24 Jan 2017 22:03:04 +0100 Subject: [PATCH 2/8] remove slave and use core daemon --- core/class/teleinfo.class.php | 224 +++------------------------------- 1 file changed, 20 insertions(+), 204 deletions(-) diff --git a/core/class/teleinfo.class.php b/core/class/teleinfo.class.php index ea9034b..29bfbdc 100644 --- a/core/class/teleinfo.class.php +++ b/core/class/teleinfo.class.php @@ -20,27 +20,16 @@ require_once dirname(__FILE__) . '/../../../../core/php/core.inc.php'; class teleinfo extends eqLogic { - /* * *************************Attributs****************************** */ - /* * ***********************Methode static*************************** */ public static function getTeleinfoInfo($_url){ return 1; } - public static function cron() { - if (config::byKey('jeeNetwork::mode') == 'slave') { //Je suis l'esclave - if (!self::deamonRunning()) { - self::runExternalDeamon(); - } - } - else{ // Je suis le jeedom master + public static function cron() { self::Calculate_PAPP(); - } - } + } public static function cronHourly() { - if (config::byKey('jeeNetwork::mode') == 'master') { self::Moy_Last_Hour(); - } } @@ -116,104 +105,14 @@ public static function createCmdFromDef($_oADCO, $_oKey, $_oValue) { return $cmd; } } - - public static function runExternalDeamon($_debug = false) { - log::add('teleinfo', 'info', 'Démarrage du service en mode satellite'); - $teleinfo_path = realpath(dirname(__FILE__) . '/../../ressources'); - $modem_serie_addr = config::byKey('port', 'teleinfo'); - $_debug = config::byKey('debug', 'teleinfo'); - $_2cpt_cartelectronic = config::byKey('2cpt_cartelectronic', 'teleinfo'); - - if(config::byKey('modem_vitesse', 'teleinfo') == ""){ - $modem_vitesse = '1200'; - }else{ - $modem_vitesse = config::byKey('modem_vitesse', 'teleinfo'); - } - - if($modem_serie_addr == "serie"){ - $port = config::byKey('modem_serie_addr', 'teleinfo'); - goto lancement; - } - $port = jeedom::getUsbMapping(config::byKey('port', 'teleinfo')); - if($_2cpt_cartelectronic == 1){ - $port = '/dev/ttyUSB1'; - goto lancement; - } - if (!file_exists($port)) { - log::add('teleinfo', 'error', 'Le port n\'existe pas'); - goto end; - } - lancement: - exec('sudo chmod 777 ' . $port . ' > /dev/null 2>&1'); - $parsed_url = parse_url(config::byKey('jeeNetwork::master::ip')); - - log::add('teleinfo', 'info', '--------- Informations sur le master --------'); - log::add('teleinfo', 'info', 'Adresse : ' . config::byKey('jeeNetwork::master::ip')); - log::add('teleinfo', 'info', 'Host / Port : ' . $parsed_url['host'] . ':' . $parsed_url['port']); - log::add('teleinfo', 'info', 'Path complémentaire : ' . $parsed_url['path']); - $ip_externe = $parsed_url['scheme'] . '://' . $parsed_url['host'] . ':' . $parsed_url['port'] . $parsed_url['path']; - log::add('teleinfo', 'info', 'Mise en forme pour le service : ' . $ip_externe); - log::add('teleinfo', 'info', 'Port modem : ' . $port); - log::add('teleinfo', 'info', '---------------------------------------------'); - if($parsed_url['host'] == ""){ - $ip_externe = config::byKey('jeeNetwork::master::ip'); - log::add('teleinfo', 'error', 'Attention, vérifiez que l\'ip est bien renseignée dans la partie Configuration Réseau.'); - } - - $cle_api = config::byKey('jeeNetwork::master::apikey'); - if($cle_api == ''){ - log::add('teleinfo', 'error', 'Erreur de clé api, veuillez la vérifier.'); - goto end; - } - if($_debug){ - $_debug = "1"; - } - else{ - $_debug = "0"; - } - if($_2cpt_cartelectronic == 1){ - log::add('teleinfo', 'info', 'Fonctionnement en mode 2 compteurs'); - //exec('sudo chmod 777 /dev/bus/usb/* > /dev/null 2>&1'); - $teleinfo_path = $teleinfo_path . '/teleinfo_2_cpt.py'; - $cmd = 'sudo nice -n 19 /usr/bin/python ' . $teleinfo_path . ' -d '.$_debug.' -p ' . $port . ' -v ' . $modem_vitesse . ' -e ' . $ip_externe . ' -c ' . config::byKey('jeeNetwork::master::apikey') . ' -r ' . realpath(dirname(__FILE__)); - } - else{ - log::add('teleinfo', 'info', 'Fonctionnement en mode 1 compteur'); - $teleinfo_path = $teleinfo_path . '/teleinfo.py'; - $cmd = 'nice -n 19 /usr/bin/python ' . $teleinfo_path . ' -d '.$_debug.' -p ' . $port . ' -v ' . $modem_vitesse . ' -e ' . $ip_externe . ' -c ' . config::byKey('jeeNetwork::master::apikey') . ' -r ' . realpath(dirname(__FILE__)); - } - - log::add('teleinfo', 'info', 'Exécution du service : ' . $cmd); - $result = exec('nohup ' . $cmd . ' >> ' . log::getPathToLog('teleinfo') . ' 2>&1 &'); - if (strpos(strtolower($result), 'error') !== false || strpos(strtolower($result), 'traceback') !== false) { - log::add('teleinfo', 'error', $result); - return false; - } - sleep(2); - if (!self::deamonRunning()) { - sleep(10); - if (!self::deamonRunning()) { - log::add('teleinfo', 'error', 'Impossible de lancer le démon téléinfo, vérifiez l\'ip', 'unableStartDeamon'); - return false; - } - } - message::removeAll('teleinfo', 'unableStartDeamon'); - log::add('teleinfo', 'info', 'Service OK'); - log::add('teleinfo', 'info', '---------------------------------------------'); - end: - } - public static function runDeamon($_debug = false) { - log::add('teleinfo', 'info', 'Mode local'); + public static function deamon_start() { + log::add('teleinfo', 'info', 'Mode local'); $teleinfo_path = realpath(dirname(__FILE__) . '/../../ressources'); $modem_serie_addr = config::byKey('port', 'teleinfo'); - $_debug = config::byKey('debug', 'teleinfo'); + $_debug = log::convertLogLevel(log::getLogLevel('teleinfo')); $_2cpt_cartelectronic = config::byKey('2cpt_cartelectronic', 'teleinfo'); - if(config::byKey('modem_vitesse', 'teleinfo') == ""){ - $modem_vitesse = '1200'; - }else{ - $modem_vitesse = config::byKey('modem_vitesse', 'teleinfo'); - } + $modem_vitesse = config::byKey('modem_vitesse', 'teleinfo', '1200'); if($modem_serie_addr == "serie"){ $port = config::byKey('modem_serie_addr', 'teleinfo'); goto lancement; @@ -245,7 +144,7 @@ public static function runDeamon($_debug = false) { log::add('teleinfo', 'info', 'Debug : ' . $_debug); log::add('teleinfo', 'info', 'Port modem : ' . $port); - if($_debug){ + if($_debug == 'debug'){ $_debug = "1"; } else{ @@ -272,40 +171,25 @@ public static function runDeamon($_debug = false) { log::add('teleinfo', 'error', $result); return false; } - sleep(2); - if (!self::deamonRunning()) { - sleep(10); - if (!self::deamonRunning()) { - log::add('teleinfo', 'error', 'Impossible de lancer le démon téléinfo, vérifiez l\'ip', 'unableStartDeamon'); - return false; - } - } + $i = 0; + while ($i < 30) { + $deamon_info = self::deamon_info(); + if ($deamon_info['state'] == 'ok') { + break; + } + sleep(1); + $i++; + } + if ($i >= 30) { + log::add('teleinfo', 'error', 'Impossible de lancer le démon rflink, vérifiez le port', 'unableStartDeamon'); + return false; + } message::removeAll('teleinfo', 'unableStartDeamon'); log::add('teleinfo', 'info', 'Service OK'); log::add('teleinfo', 'info', '---------------------------------------------'); end: } - public static function deamonRunning() { - $_2cpt_cartelectronic = config::byKey('2cpt_cartelectronic', 'teleinfo'); - if($_2cpt_cartelectronic == 1){ - $result = exec("ps aux | grep teleinfo_2_cpt.py | grep -v grep | awk '{print $2}'"); - if($result != ""){ - //log::add('teleinfo', 'info', 'Vérification de l\'état du service : OK '); - return true; - } - log::add('teleinfo', 'info', 'Vérification de l\'état du service : NOK '); - return false; - }else{ - $result = exec("ps aux | grep teleinfo.py | grep -v grep | awk '{print $2}'"); - if($result != ""){ - //log::add('teleinfo', 'info', 'Vérification de l\'état du service : OK '); - return true; - } - log::add('teleinfo', 'info', 'Vérification de l\'état du service : NOK '); - return false; - } - } public static function deamon_info() { $return = array(); @@ -326,26 +210,6 @@ public static function deamon_info() { return $return; } - public static function deamon_start($_debug = false) { - - if (config::byKey('jeeNetwork::mode') == 'slave') { //Je suis l'esclave - if (!self::deamonRunning()) { - self::runExternalDeamon($_debug); - } - } - else{ // Je suis le jeedom master - if(config::byKey('port', 'teleinfo') != ""){ // Si un port est sélectionné - if (!self::deamonRunning()) { - self::runDeamon($_debug); - } - message::removeAll('teleinfo', 'noTeleinfoPort'); - } - else{ - log::add('teleinfo', 'info', 'Pas d\'informations sur le port USB (Modem série ?)'); - } - } - } - public static function deamon_stop() { log::add('teleinfo', 'info', '[deamon_stop] Arret du service'); $deamon_info = self::deamon_info(); @@ -379,54 +243,6 @@ public static function deamon_stop() { } } } - - public static function stopDeamon() { - if (!self::deamonRunning()) { - return true; - } - - log::add('teleinfo', 'info', 'Tentative d\'arrêt du service'); - - $_2cpt_cartelectronic = config::byKey('2cpt_cartelectronic', 'teleinfo'); - if($_2cpt_cartelectronic == 1){ - $result = exec("ps aux | grep teleinfo_2_cpt.py | grep -v grep | awk '{print $2}'"); - } - else{ - $result = exec("ps aux | grep teleinfo.py | grep -v grep | awk '{print $2}'"); - } - //foreach ($result as $pid) { - exec('kill ' . $result); - //} - $check = self::deamonRunning(); - $retry = 0; - while ($check) { - $check = self::deamonRunning(); - $retry++; - if ($retry > 10) { - $check = false; - } else { - posix_kill($result, 9); - sleep(1); - } - } - try { - exec('sudo kill 9 ' . $result . ' > /dev/null 2&1'); - } catch (Exception $e) { - log::add('teleinfo', 'error', 'Impossible d\'arrêter le service'); - } - $check = self::deamonRunning(); - $retry = 0; - while ($check) { - $check = self::deamonRunning(); - $retry++; - if ($retry > 10) { - $check = false; - } else { - sleep(1); - } - } - return true; - } public static function CalculateTodayStats(){ $STAT_TODAY_HP = 0; From 4597a515d56046dc380e7f95fc248d6c082834f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Tue, 24 Jan 2017 22:06:55 +0100 Subject: [PATCH 3/8] purge daemon & slave --- core/ajax/teleinfo.ajax.php | 92 +------------------------------------ 1 file changed, 1 insertion(+), 91 deletions(-) diff --git a/core/ajax/teleinfo.ajax.php b/core/ajax/teleinfo.ajax.php index 4f76da3..2ae0702 100644 --- a/core/ajax/teleinfo.ajax.php +++ b/core/ajax/teleinfo.ajax.php @@ -23,51 +23,6 @@ if (!isConnect('admin')) { throw new Exception('401 Unauthorized'); } - - if (init('action') == 'stopDeamon') { - teleinfo::stopDeamon(); - ajax::success(); - } - - if (init('action') == 'restartDeamon') { - $port = config::byKey('port', 'teleinfo', 'none'); - $_2cpt_cartelectronic = config::byKey('2cpt_cartelectronic', 'teleinfo'); - if($_2cpt_cartelectronic == 1){ - - } - if ($port == 'none') { - ajax::success(); - } - teleinfo::stopDeamon(); - if (teleinfo::deamonRunning()) { - throw new Exception(__('Impossible d\'arrêter le démon', __FILE__)); - } - log::clear('teleinfocmd'); - teleinfo::cron(); - ajax::success(); - } - - if (init('action') == 'restartSlaveDeamon') { - if (config::byKey('jeeNetwork::mode') == 'master') { - $jeeNetwork = jeeNetwork::byId(init('id')); - if (!is_object($jeeNetwork)) { - throw new Exception(__('Impossible de trouver l\'esclave : ', __FILE__) . init('id')); - } - $jeeNetwork->sendRawRequest('restartDeamon', array('plugin' => 'teleinfo')); - } - ajax::success(); - } - - if (init('action') == 'stopSlaveDeamon') { - if (config::byKey('jeeNetwork::mode') == 'master') { - $jeeNetwork = jeeNetwork::byId(init('id')); - if (!is_object($jeeNetwork)) { - throw new Exception(__('Impossible de trouver l\'esclave : ', __FILE__) . init('id')); - } - $jeeNetwork->sendRawRequest('stopDeamon', array('plugin' => 'teleinfo')); - } - ajax::success(); - } if (init('action') == 'getTeleinfo') { if (init('object_id') == '') { @@ -78,7 +33,7 @@ $object = object::rootObject(); } if (!is_object($object)) { - throw new Exception('{{Aucun objet racine trouvé}}'); + throw new Exception('{{Aucun objet racine trouvé}}'); } $return = array('object' => utils::o2a($object)); @@ -150,52 +105,7 @@ ajax::error("", ""); } - if (init('action') == 'getInfoDaemon') { - $return = array(); - $_nbLines = 1000; - $replace = array( - '>' => '>', - ''' => '', - ); - $page = array(); - - $path = realpath(dirname(__FILE__) . '/../../ressources/teleinfo.log'); - //log::add('teleinfo', 'info', $path); - if (!file_exists($path)) { - $return['result'] = array('Deamon non lancé'); - ajax::success($return); - }else{ - $log = new SplFileObject($path); - if ($log) { - $log->seek(0); //Seek to the begening of lines - $linesRead = 0; - while ($log->valid() && $linesRead != $_nbLines) { - $line = trim($log->current()); //get current line - if ($line != '') { - array_unshift($page, $line); - } - $log->next(); //go to next line - $linesRead++; - } - } - //return $page; - $return['result'] = $page; - ajax::success($return); - } - } - - if (init('action') == 'getInfoExternalDaemon') { - $jeeNetwork = jeeNetwork::byPlugin('enocean'); - - $return['result'] = $jeeNetwork; - ajax::success($return); - //$jeeNetwork = jeeNetwork::byId(init('id')); - // //if (!is_object($jeeNetwork)) { - // throw new Exception(__('Impossible de trouver l\'esclave : ', __FILE__) . init('id')); - // } - // $jeeNetwork->sendRawRequest('getInfoDaemon', array('plugin' => 'teleinfo')); - } if (init('action') == 'getHistory') { $return = array(); /*$data = array(); From b93af43395e77b7fb0d9212a0fb138950c14fa63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Tue, 24 Jan 2017 22:14:14 +0100 Subject: [PATCH 4/8] Delete info_daemon.php --- desktop/modal/info_daemon.php | 45 ----------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 desktop/modal/info_daemon.php diff --git a/desktop/modal/info_daemon.php b/desktop/modal/info_daemon.php deleted file mode 100644 index 93e7597..0000000 --- a/desktop/modal/info_daemon.php +++ /dev/null @@ -1,45 +0,0 @@ -deamon_info(); -} else { - $jeeNetwork = jeeNetwork::byId(init('slave_id')); - //$deamon_info = $jeeNetwork->sendRawRequest('plugin::deamonInfo', array('plugin_id' => init('plugin_id'))); -} - -sendVarToJs('logfile', init('plugin_id')); -sendVarToJs('slave_id', init('slave_id')); -?> - - - - {{Pause}} - -


-

-
-
\ No newline at end of file

From 3ed5c7fafc3bd4e44c89a4e71b9963311d40f1eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Dupont?= 
Date: Tue, 24 Jan 2017 22:15:50 +0100
Subject: [PATCH 5/8] remove bootstrap

---
 plugin_info/configuration.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugin_info/configuration.php b/plugin_info/configuration.php
index 9cc4af9..311ee9c 100644
--- a/plugin_info/configuration.php
+++ b/plugin_info/configuration.php
@@ -81,7 +81,7 @@
 		
- +
From 7289f01c83bd67bfb51f2579c8ab5a6bf4084db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Tue, 24 Jan 2017 22:54:00 +0100 Subject: [PATCH 6/8] inittab obsolete with systemd --- ressources/install.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ressources/install.sh b/ressources/install.sh index 68587b0..3915c13 100644 --- a/ressources/install.sh +++ b/ressources/install.sh @@ -6,12 +6,6 @@ echo 10 > /tmp/teleinfo_in_progress sudo apt-get -y install python-ftdi sudo apt-get -y install python-serial echo 50 > /tmp/teleinfo_in_progress -if [ -e /dev/ttyAMA0 ]; then - sudo sed -i 's/console=ttyAMA0,115200//; s/kgdboc=ttyAMA0,115200//' /boot/cmdline.txt - sudo sed -i 's|[^:]*:[^:]*:respawn:/sbin/getty[^:]*ttyAMA0[^:]*||' /etc/inittab - sudo systemctl stop serial-getty@ttyAMA0.service - sudo systemctl disable serial-getty@ttyAMA0.service -fi echo 100 > /tmp/teleinfo_in_progress echo "Everything is successfully installed!" rm /tmp/teleinfo_in_progress From c420a115d13a9d3a6bd948e00e50aba46a4e8a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Tue, 24 Jan 2017 22:56:13 +0100 Subject: [PATCH 7/8] remove slave --- desktop/php/teleinfo.php | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/desktop/php/teleinfo.php b/desktop/php/teleinfo.php index a19af98..4942d54 100644 --- a/desktop/php/teleinfo.php +++ b/desktop/php/teleinfo.php @@ -43,21 +43,7 @@
{{Info Modem}}
- - - getId() . '" style="background-color : #ffffff; height : 140px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" > -
- -
-
{{Info Modem ' . $jeeNetwork->getName() . ' }}
- - '; - } - ?> - +
@@ -262,4 +248,4 @@
- \ No newline at end of file + From be421a057ba6d0563aeed1534335c1312310bf39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Dupont?= Date: Wed, 25 Jan 2017 17:13:29 +0100 Subject: [PATCH 8/8] purge jeenetwork and bootstrap --- core/ajax/desktop.ini | 5 ---- core/api/desktop.ini | 5 ---- core/class/desktop.ini | 5 ---- core/config/desktop.ini | 5 ---- core/desktop.ini | 5 ---- core/php/desktop.ini | 5 ---- core/template/desktop.ini | 5 ---- desktop/desktop.ini | 5 ---- desktop/js/desktop.ini | 5 ---- desktop/js/info_daemon.js | 41 --------------------------------- desktop/js/teleinfo.js | 43 ++++++++++++----------------------- desktop/modal/desktop.ini | 5 ---- desktop/php/desktop.ini | 5 ---- desktop/php/teleinfo.php | 48 +++++++++++++++++++-------------------- doc/desktop.ini | 5 ---- ressources/desktop.ini | 5 ---- 16 files changed, 39 insertions(+), 158 deletions(-) delete mode 100644 core/ajax/desktop.ini delete mode 100644 core/api/desktop.ini delete mode 100644 core/class/desktop.ini delete mode 100644 core/config/desktop.ini delete mode 100644 core/desktop.ini delete mode 100644 core/php/desktop.ini delete mode 100644 core/template/desktop.ini delete mode 100644 desktop/desktop.ini delete mode 100644 desktop/js/desktop.ini delete mode 100644 desktop/js/info_daemon.js delete mode 100644 desktop/modal/desktop.ini delete mode 100644 desktop/php/desktop.ini delete mode 100644 doc/desktop.ini delete mode 100644 ressources/desktop.ini diff --git a/core/ajax/desktop.ini b/core/ajax/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/ajax/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/core/api/desktop.ini b/core/api/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/api/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/core/class/desktop.ini b/core/class/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/class/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/core/config/desktop.ini b/core/config/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/config/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/core/desktop.ini b/core/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/core/php/desktop.ini b/core/php/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/php/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/core/template/desktop.ini b/core/template/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/core/template/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/desktop/desktop.ini b/desktop/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/desktop/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/desktop/js/desktop.ini b/desktop/js/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/desktop/js/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/desktop/js/info_daemon.js b/desktop/js/info_daemon.js deleted file mode 100644 index 4dfafb0..0000000 --- a/desktop/js/info_daemon.js +++ /dev/null @@ -1,41 +0,0 @@ -var tmp_debug; -var app_console = { - updater: false, - init: function(){ - clearInterval(app_console.updater); - $('#pre_consolelog').html(); - }, - show: function(){ - app_console.updater = setInterval(app_console.refresh,1000); - }, - refresh: function(){ - $.ajax({ - async:true, - global : false, - url: 'plugins/teleinfo/core/ajax/teleinfo.ajax.php', - data: { - action:'getInfoDaemon' - }, - dataType: 'json', - error: function (request, status, error) { - console.log("pointeur_debug"); - console.log(request); - handleAjaxError(request, status, error,$('#div_InfoDaemonAlert')); - }, - success: function (data) { - console.log(data); - tmp_debug = data.result; - var log = ''; - if($.isArray(data.result.result)){ - for (var i in data.result.result.reverse()) { - log += $.trim(data.result.result[i])+"\n"; - } - } - $('#pre_consolelog').html(log); - var h = parseInt($('#log')[0].scrollHeight); - $('#log').scrollTop(h); - } - }); - - } -} \ No newline at end of file diff --git a/desktop/js/teleinfo.js b/desktop/js/teleinfo.js index b873603..ceb7d49 100644 --- a/desktop/js/teleinfo.js +++ b/desktop/js/teleinfo.js @@ -50,24 +50,12 @@ $('#bt_cout').on('click', function() { $('#md_modal').load('index.php?v=d&plugin=teleinfo&modal=cout').dialog('open'); }); -$('#bt_info_daemon').on('click', function() { - $('#md_modal').dialog({title: "{{Informations du modem}}"}); - $('#md_modal').load('index.php?v=d&plugin=teleinfo&modal=info_daemon&plugin_id=teleinfo_deamon&slave_id=0').dialog('open'); -}); - -$('.bt_info_external_daemon').on('click', function() { - var slave_id_tmp = $(this).attr('slave_id'); - $('#md_modal').dialog({title: "{{Informations du modem}}"}); - $('#md_modal').load('index.php?v=d&plugin=teleinfo&modal=info_daemon&plugin_id=teleinfo_deamon&slave_id=' + slave_id_tmp).dialog('open'); -}); - - $('#bt_config').on('click', function() { $('#md_modal').dialog({title: "{{Configuration}}"}); $('#md_modal').load('index.php?v=d&p=plugin&ajax=1&id=rfxcom').dialog('open'); }); -$('#bt_teleinfoHealth').on('click', function() { +$('#bt_teleinfoHealth').on('click', function() { $('#md_modal').dialog({title: "{{Santé Téléinformation}}"}); $('#md_modal').load('index.php?v=d&plugin=teleinfo&modal=health').dialog('open'); }); @@ -163,7 +151,7 @@ function addCmdToTable(_cmd) { selRequestType += ''; selRequestType += ''; } - + if(init(_cmd.configuration['type']) == 'panel'){ var tr = ''; }else if(init(_cmd.configuration['type']) == 'health'){ @@ -172,7 +160,7 @@ function addCmdToTable(_cmd) { else{ var tr = ''; } - if(init(_cmd.configuration['type']) != 'health'){ + if(init(_cmd.configuration['type']) != 'health'){ tr += ''; tr += ''; tr += ''; @@ -190,26 +178,25 @@ function addCmdToTable(_cmd) { tr += ''; tr += ''; tr += ''; - tr += ' '; - tr += ' '; - tr += ''; - + tr += ' '; + tr += ' '; + if(init(_cmd.configuration['info_conso']) == 'TENDANCE_DAY'){ tr += ' {{Journée entière}}
'; - } - + } + tr += ''; - + tr += ''; tr += ' '; tr += ''; - + if(init(_cmd.configuration['info_conso']) == 'ADPS' || init(_cmd.configuration['info_conso']) == 'ADIR1' || init(_cmd.configuration['info_conso']) == 'ADIR2' || init(_cmd.configuration['info_conso']) == 'ADIR3'){ //tr += ''; tr += ''; tr += ''; } - + tr += ''; tr += ''; if (is_numeric(_cmd.id)) { @@ -218,24 +205,24 @@ function addCmdToTable(_cmd) { } tr += ''; tr += ''; - + if (isset(_cmd.configuration.info_conso)) { //$('#table_cmd tbody tr:last .cmdAttr[data-l1key=configuration][data-l2key=info_conso]').value(init(_cmd.configuration.info_conso)); //$('#table_cmd tbody tr:last .cmdAttr[data-l1key=configuration][data-l2key=info_conso]').trigger('change'); } - + $('#table_cmd tbody').append(tr); $('#table_cmd tbody tr:last').setValues(_cmd, '.cmdAttr'); var tr = $('#table_cmd tbody tr:last'); if(init(_cmd.unite) == ''){ if(init(_cmd.configuration['info_conso']) == 'ADPS'){ - tr.find('.cmdAttr[data-l1key=unite]').append("A"); + tr.find('.cmdAttr[data-l1key=unite]').append("A"); tr.setValues(_cmd, '.cmdAttr'); } } else{ - } + } } } diff --git a/desktop/modal/desktop.ini b/desktop/modal/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/desktop/modal/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/desktop/php/desktop.ini b/desktop/php/desktop.ini deleted file mode 100644 index 8c02904..0000000 --- a/desktop/php/desktop.ini +++ /dev/null @@ -1,5 +0,0 @@ -[.ShellClassInfo] -InfoTip=Ce dossier est partagé en ligne. -IconFile=C:\Program Files (x86)\Google\Drive\googledrivesync.exe -IconIndex=16 - \ No newline at end of file diff --git a/desktop/php/teleinfo.php b/desktop/php/teleinfo.php index 4942d54..1b2cc2b 100644 --- a/desktop/php/teleinfo.php +++ b/desktop/php/teleinfo.php @@ -6,14 +6,14 @@ $eqLogics = eqLogic::byType('teleinfo'); $controlerState = teleinfo::getTeleinfoInfo(''); if($controlerState === ''){ - echo '
{{Impossible de contacter le serveur teleinfo. Avez vous bien renseigné l\'IP ?}}
'; + echo '
{{Impossible de contacter le serveur teleinfo. Avez vous bien renseigné l\'IP ?}}
'; } //$deamonRunning = false; //$deamonRunning = teleinfo::deamonRunning(); ?>
- +
- +
{{Gestion}}
@@ -37,24 +37,24 @@
{{Coût}}
--> - +
{{Info Modem}}
-
- +
+
Configuration
- - + +
- + {{Mes Modules de Téléinformation}}
- +
Ajouter
- + getId() . '" style="background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >'; @@ -83,20 +83,20 @@
- - - + + +