diff --git a/core/ajax/plan.ajax.php b/core/ajax/plan.ajax.php index c4d7b97b30..870737bddc 100644 --- a/core/ajax/plan.ajax.php +++ b/core/ajax/plan.ajax.php @@ -254,16 +254,17 @@ mkdir($uploaddir, 0777); } shell_exec('rm -rf ' . $uploaddir . '/*'); - $name = sha512(base64_encode(file_get_contents($_FILES['file']['tmp_name']))) . $extension; + $fileName = sha512(base64_encode(file_get_contents($_FILES['file']['tmp_name']))) . $extension; + $filePath = $uploaddir . '/' . $fileName; $img_size = getimagesize($_FILES['file']['tmp_name']); - if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $name)) { - throw new Exception(__('Impossible de déplacer le fichier temporaire dans : ', __FILE__) . $uploaddir . '/' . $name); + if (!move_uploaded_file($_FILES['file']['tmp_name'], $filePath)) { + throw new Exception(__('Impossible de déplacer le fichier temporaire dans : ', __FILE__) . $uploaddir . '/' . $fileName); } $plan->setDisplay('width', $img_size[0]); $plan->setDisplay('height', $img_size[1]); - $plan->setDisplay('path', 'data/plan/plan_' . $plan->getId() . '/' . $name); + $plan->setDisplay('path', 'data/plan/plan_' . $plan->getId() . '/' . $fileName); $plan->save(); - ajax::success(); + ajax::success(array('filepath' => $filePath)); } throw new Exception(__('Aucune méthode correspondante à : ', __FILE__) . init('action')); diff --git a/core/class/config.class.php b/core/class/config.class.php index db7781e032..a0baf7a3d3 100644 --- a/core/class/config.class.php +++ b/core/class/config.class.php @@ -152,7 +152,7 @@ public static function byKey($_key, $_plugin = 'core', $_default = '', $_forceFr WHERE `key`=:key AND plugin=:plugin'; $value = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW); - if (($value['value'] === '' || $value['value'] === null)) { + if (!is_array($value) || !isset($value['value']) || $value['value'] === '' || $value['value'] === null) { $defaultConfiguration = self::getDefaultConfiguration($_plugin); if (isset($defaultConfiguration[$_plugin][$_key])) { self::$cache[$_plugin . '::' . $_key] = $defaultConfiguration[$_plugin][$_key]; diff --git a/core/class/plan.class.php b/core/class/plan.class.php index ba2b8929bf..8527f53ed2 100644 --- a/core/class/plan.class.php +++ b/core/class/plan.class.php @@ -146,6 +146,14 @@ public function save() { } public function remove() { + $link_type = $this->getLink_type(); + if ($this->getLink_type() == 'image') { + $imgPath = $this->getDisplay('path', ''); + if ($imgPath != '') { + @unlink(str_replace('data/plan/', __DIR__ . '/../../data/plan/', $imgPath)); + @rmdir(__DIR__ . '/../../data/plan/plan_'.$this->getId()); + } + } DB::remove($this); } diff --git a/core/config/version b/core/config/version index 73274fd69d..60623b5c5f 100644 --- a/core/config/version +++ b/core/config/version @@ -1 +1 @@ -4.1.17 +4.1.18 diff --git a/desktop/common/js/utils.js b/desktop/common/js/utils.js index 9d94dc399e..cbceae506a 100644 --- a/desktop/common/js/utils.js +++ b/desktop/common/js/utils.js @@ -653,9 +653,14 @@ function setJeedomGlobalUI() { $('#md_modal').dialog({title: "{{Erreur Javascript}}"}).load('index.php?v=d&modal=js.error').dialog('open') }) - $('body').on('click', '.objectSummaryParent',function() { + $('body').on('click', '.objectSummaryParent', function() { if ($('body').attr('data-page') == "overview" && $(this).parents('.objectSummaryglobal').length == 0) return false - loadPage('index.php?v=d&p=dashboard&summary='+$(this).data('summary')+'&object_id='+$(this).data('object_id')) + + var url = 'index.php?v=d&p=dashboard&summary=' + $(this).data('summary') + '&object_id=' + $(this).data('object_id') + if (window.location.href.includes('&btover=1')) { + url += '&btover=1' + } + loadPage(url) }) $('body').off('click','.jeeHelper[data-helper=cron]').on('click','.jeeHelper[data-helper=cron]',function() { @@ -848,7 +853,12 @@ function datePickerInit() { //General functions__ function normTextLower(_text) { - return _text.normalize('NFD').replace(/[\u0300-\u036f]/g, "").toLowerCase() + try { + var result = _text.normalize('NFD').replace(/[\u0300-\u036f]/g, "").toLowerCase() + } catch(error) { + var result = '' + } + return result } function linkify(inputText) { diff --git a/desktop/css/desktop.main.css b/desktop/css/desktop.main.css index e65d1546d8..3e79d3f2da 100644 --- a/desktop/css/desktop.main.css +++ b/desktop/css/desktop.main.css @@ -891,6 +891,10 @@ Theme Core 2021 @Jeedom } /* ____________________OVERVIEW */ + #objectOverviewContainer .objectPreview, + #dashOverviewPrev .objectPreview { + background-position: center !important; + } #objectOverviewContainer { text-align: center !important; margin:15px; @@ -975,7 +979,6 @@ Theme Core 2021 @Jeedom .objectPreview .objectSummaryParent, .objectPreview .objectSummaryParent i { font-size: 16px !important; - color: var(--link-color) !important; } .objectPreview .topPreview .objectSummaryParent { position: absolute; @@ -1085,6 +1088,10 @@ Theme Core 2021 @Jeedom [data-page="dashboard"] #dashOverviewPrev.dashboard .li_object span { cursor: pointer !important; } + [data-page="dashboard"] #dashOverviewPrev.dashboard .li_object > span { + margin-left: 30px; + } + [data-page="dashboard"] #dashOverviewPrev .objectSummaryglobal { padding-left: 25px; } @@ -2035,7 +2042,7 @@ Theme Core 2021 @Jeedom right: 10px; padding: 5px; height: 40px !important; - z-index: 10; + z-index: 15; background: rgba(var(--panel-bg-color), var(--opacity)); } @@ -4144,6 +4151,7 @@ Theme Core 2021 @Jeedom } #pre_globallog, #pre_scenariolog, + #pre_eventlog, #pre_commandResult, #div_commandResult { font-family: "CamingoCode", monospace; diff --git a/desktop/js/editor.js b/desktop/js/editor.js index 458c5cc42d..9905fa7170 100644 --- a/desktop/js/editor.js +++ b/desktop/js/editor.js @@ -236,8 +236,15 @@ $('#bt_createFile').off('click').on('click', function() { if (editorType == 'widget') { $('#md_widgetCreate').dialog({title: "{{Options}}"}).dialog('open') $('#sel_widgetType').trigger('change') + + $("#md_widgetCreate").keydown(function (event) { + if (event.keyCode == $.ui.keyCode.ENTER) { + $('#bt_widgetCreate').trigger('click') + return false + } + }) } else { - bootbox.prompt("Nom du fichier ?", function(result) { + bootbox.prompt("{{Nom du fichier ?}}", function(result) { if (result !== null) { jeedom.createFile({ path : CURRENT_FOLDER, @@ -254,4 +261,4 @@ $('#bt_createFile').off('click').on('click', function() { } }) } -}) \ No newline at end of file +}) diff --git a/desktop/js/history.js b/desktop/js/history.js index f21398abee..2f965f183c 100644 --- a/desktop/js/history.js +++ b/desktop/js/history.js @@ -141,13 +141,35 @@ $(".li_history .remove").on('click', function() { }) }) +//search filter opening: +$('body').on({ + 'keyup': function(event) { + if ($(this).value() == '') { + $('.cmdList').hide() + $('.displayObject').find('i.fas').removeClass('fa-arrow-circle-down').addClass('fa-arrow-circle-right') + } else { + $('.cmdList').show() + //let filtering job gone: + setTimeout(function() { + $('.cmdList').each(function() { + if ($(this).find('.li_history:visible').length > 0) { + $('.displayObject[data-object_id=' + $(this).attr('data-object_id') + ']').find('i.fas').removeClass('fa-arrow-circle-right').addClass('fa-arrow-circle-down') + } else { + $('.displayObject[data-object_id=' + $(this).attr('data-object_id') + ']').find('i.fas').removeClass('fa-arrow-circle-down').addClass('fa-arrow-circle-right') + } + }) + }, 250) + } + } +}, 'ul li input.filter') + $('.displayObject').on('click', function() { var list = $('.cmdList[data-object_id=' + $(this).attr('data-object_id') + ']') if (list.is(':visible')) { - $(this).find('i.fa').removeClass('fa-arrow-circle-down').addClass('fa-arrow-circle-right') + $(this).find('i.fas').removeClass('fa-arrow-circle-down').addClass('fa-arrow-circle-right') list.hide() } else { - $(this).find('i.fa').removeClass('fa-arrow-circle-right').addClass('fa-arrow-circle-down') + $(this).find('i.fas').removeClass('fa-arrow-circle-right').addClass('fa-arrow-circle-down') list.show() } }) @@ -364,4 +386,4 @@ function setChartExtremes() { chart.yAxis[0].setExtremes(min, max, true, true) } catch(error) {} -} \ No newline at end of file +} diff --git a/desktop/js/plan.js b/desktop/js/plan.js index 4d6827ba87..bc10c05b86 100644 --- a/desktop/js/plan.js +++ b/desktop/js/plan.js @@ -621,22 +621,6 @@ $('.div_displayObject').off('resize', '.graph-widget').on('resize', '.graph-widg } }) -$pageContainer.off('click','.eqLogic-widget .history').on('click','.eqLogic-widget .history', function(event) { - if (planEditOption.state == true) return false - event.stopImmediatePropagation() - event.stopPropagation() - if (event.ctrlKey || event.metaKey) { - var cmdIds = [] - $(this).closest('.eqLogic.eqLogic-widget').find('.history[data-cmd_id]').each(function () { - cmdIds.push($(this).data('cmd_id')) - }) - cmdIds = cmdIds.join('-') - } else { - var cmdIds = $(this).closest('.history[data-cmd_id]').data('cmd_id') - } - $('#md_modal2').dialog({title: "{{Historique}}"}).load('index.php?v=d&modal=cmd.history&id=' + cmdIds).dialog('open') -}) - /***********************************************************************************/ function createNewDesign() { bootbox.prompt("{{Nom du design ?}}", function(result) { @@ -1274,8 +1258,11 @@ function displayObject(_plan, _html, _noRender) { initEditOption(planEditOption.state) } -//back to mobile home with three fingers on mobile: $(function() { + jeedomUI.setEqSignals() + jeedomUI.setHistoryModalHandler() + + //back to mobile home with three fingers on mobile: if ($('body').attr('data-device') == 'mobile') { $('body').on('touchstart', function(event) { if (event.touches.length == 3) { diff --git a/desktop/js/scenario.js b/desktop/js/scenario.js index cb690d7b4b..79222b1360 100644 --- a/desktop/js/scenario.js +++ b/desktop/js/scenario.js @@ -768,6 +768,9 @@ $divScenario.on('click', '.bt_collapse', function(event) { } else { //comment txt = _el.find('.expression textarea').val() + if (typeof txt === 'object') { + txt = JSON.stringify(expression.expression) + } txt = '' + txt.split('\n')[0] + '' + txt.replace(txt.split('\n')[0], '') if (!txt) txt = _el.find('.expression input.form-control').val() } @@ -1845,9 +1848,9 @@ function addSubElement(_subElement) { retour += '