From b11fdc36cf55a09f349e150f972b3ee4d20fe71b Mon Sep 17 00:00:00 2001 From: talkabout Date: Sat, 21 Nov 2015 12:03:23 +0000 Subject: [PATCH] 95_Dashboard: the fhem root url is not hardcoded any more but read from the variable. Fixed a problem that causes drag&drop being still activated when the dashboard was locked. (resize/move) git-svn-id: https://svn.fhem.de/fhem/trunk@9952 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/CHANGED | 4 ++++ fhem/FHEM/95_Dashboard.pm | 7 +++++-- fhem/www/pgm2/dashboard.js | 27 +++++++++------------------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/fhem/CHANGED b/fhem/CHANGED index 002e37598..113c73b79 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,9 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix: 95_Dashboard: the fhem root url is not hardcoded any more + but read from the $FW_ME variable. + Fixed a problem that causes drag&drop being still activated + when the dashboard was locked. (resize/move) - bugfix: 14_SD_WS07 - corrected syntax error and raised loglevels - bugfix: 55_GDS.pm - correct wrong cumulation in alerts (1st try) - feature: new module 10_DUOFERNSTICK and 30_DUOFERN added diff --git a/fhem/FHEM/95_Dashboard.pm b/fhem/FHEM/95_Dashboard.pm index 6b3b3b357..9ad3ed1ce 100644 --- a/fhem/FHEM/95_Dashboard.pm +++ b/fhem/FHEM/95_Dashboard.pm @@ -477,6 +477,9 @@ sub Dashboard_SummaryFN($$$$) ################################ ################################ + + ############################ Set FHEM url to avoid hardcoding it in javascript ############################ + $ret .= ""; $ret .= "
\n"; $ret .= "
\n"; @@ -509,7 +512,7 @@ sub Dashboard_SummaryFN($$$$) $ret .= "\n"; $ret .= "
\n"; $ret .= "
\n"; - + ########################### Dashboard Tab-Liste ############################################## $ret .= "
    \n"; for (my $i=0;$i<$tabcount;$i++){$ret .= "
  • ".trim($tabnames[$i])."
  • ";} @@ -817,7 +820,7 @@ sub BuildGroup $row++; - $extPage{group} = $groupname; + $extPage{group} = $groupname; my ($allSets, $cmdlist, $txt) = FW_devState($d, $rf, \%extPage); $allSets = FW_widgetOverride($d, $allSets); diff --git a/fhem/www/pgm2/dashboard.js b/fhem/www/pgm2/dashboard.js index 9fc426a40..04d069141 100644 --- a/fhem/www/pgm2/dashboard.js +++ b/fhem/www/pgm2/dashboard.js @@ -25,7 +25,6 @@ var DashboardConfigHash = {}; var dashboard_buttonbar = "top"; var DashboardDraggable = true; -var fhemUrl = '/fhem'; /* evol.colorpicker 2.2 (c) 2014 Olivier Giulieri @@ -318,27 +317,19 @@ function dashboard_get_params() { return dashboard_get_params.dashboard_params; } -function dashboard_setlock(){ +function dashboard_setlock(iTabIndex){ if(is_dashboard_flexible()) { - $( ".dashboard_widget" ).draggable( "option", "disabled", true ); + $( "#dashboard_tab" + iTabIndex + " .dashboard_column" ).draggable( "destroy"); } else { - $( ".dashboard_column" ).sortable( "option", "disabled", true ); + $( "#dashboard_tab" + iTabIndex + " .dashboard_column" ).sortable( "destroy"); } $( ".dashboard_widget" ).removeClass("dashboard_widgethelper"); - if ($( ".dashboard_widget" ).hasClass("ui-resizable")) { - $( ".dashboard_widget" ).resizable("destroy"); - }; + $( "#dashboard_tab" + iTabIndex + " .dashboard_widget" ).resizable("destroy"); $( ".dashboard_column" ).removeClass("dashboard_columnhelper"); } -function dashboard_unsetlock(){ - if(is_dashboard_flexible()) { - $( ".dashboard_widget" ).draggable( "option", "disabled", false ); - } - else { - $( ".dashboard_column" ).sortable( "option", "disabled", false ); - } +function dashboard_unsetlock(iTabIndex){ if (DashboardConfigHash['lockstate'] == "unlock") { $( ".dashboard_widget" ).addClass("dashboard_widgethelper"); } else { $( ".dashboard_widget" ).removeClass("dashboard_widgethelper"); }//Show Widget-Helper Frame if (DashboardConfigHash['lockstate'] == "unlock") { $( ".dashboard_column" ).addClass("dashboard_columnhelper"); } else { $( ".dashboard_column" ).removeClass("dashboard_columnhelper"); }//Show Widget-Helper Frame dashboard_modifyWidget(); @@ -542,15 +533,15 @@ function dashboard_init_tab(tabIndex) { stop: function() { saveOrder(); } }); } - makeResizable('.dashboard_widget'); + makeResizable('#dashboard_tab' + tabIndex + ' .dashboard_widget'); // call the initialization of reading groups FW_readingsGroupReadyFn($('#dashboard_tab' + tabIndex)); if ((DashboardConfigHash['lockstate'] == "lock") || (dashboard_buttonbar == "hidden")) { - dashboard_setlock(); + dashboard_setlock(tabIndex); } else { - dashboard_unsetlock(); + dashboard_unsetlock(tabIndex); } restoreGroupVisibility(tabIndex); } @@ -677,7 +668,7 @@ function dashboard_buildDashboard(){ dashboard_modifyWidget(); if (dashboard_buttonbar != "hidden") dashboard_buildButtons(); - if ((DashboardConfigHash['lockstate'] == "lock") || (dashboard_buttonbar == "hidden")) {dashboard_setlock();} else {dashboard_unsetlock();} + if ((DashboardConfigHash['lockstate'] == "lock") || (dashboard_buttonbar == "hidden")) {dashboard_setlock(iActiveTab);} else {dashboard_unsetlock(iActiveTab);} if (DashboardConfigHash['dashboard_customcss']) {$('').appendTo($('head')); } }