diff --git a/front/php/server/util.php b/front/php/server/util.php
index fb23a070..ed5e17a9 100755
--- a/front/php/server/util.php
+++ b/front/php/server/util.php
@@ -229,7 +229,7 @@ function saveSettings()
{
global $SETTINGS, $FUNCTION, $config_file, $fullConfPath, $configFolderPath, $timestamp;
- // save in the file
+ // save to the file
$new_name = $config_file.'_'.$timestamp.'.backup';
$new_location = $configFolderPath.$new_name;
@@ -265,15 +265,64 @@ function saveSettings()
}
}
+ echo "--SETTINGS
";
+ echo count($SETTINGS);
+ echo "--SETTINGS session
";
+ echo count($_SESSION['pia_settingsArray']); //pia_settingsArray
+ echo "--SETTINGS session
";
+ echo $_SESSION['pia_settingsArray']; //pia_settingsArray
+
+ $index = 0;
+ foreach($SETTINGS as $setting)
+ {
+ if(count($setting) < 3)
+ {
+ echo "--PREV
";
+ echo json_encode($SETTINGS[$index -1]);
+ echo "--
";
+ echo json_encode($setting);
+ echo "--
";
+ echo count($setting);
+ echo "--NEXT
";
+ echo json_encode($SETTINGS[$index +1]);
+ echo "--
";
+ }
+
+ $index = $index +1;
+ }
+
+
// go thru the groups and prepare settings to write to file
foreach($groups as $group)
{
$txt = $txt."\n\n# ".$group;
$txt = $txt."\n#---------------------------\n" ;
+
+ $index = 0;
foreach($SETTINGS as $setting)
{
+ $index = $index +1;
if($group == $setting[0])
{
+ // if (count($setting) < 3)
+ if ($index == 248)
+ {
+ echo json_encode($index-1);
+ echo json_encode($setting[0]);
+ echo json_encode($setting[1]);
+ }
+
+ if (count($setting) < 3)
+ // if ($index == 248)
+ {
+ echo "
----------------
";
+ echo json_encode($index-1);
+ echo json_encode($setting[0]);
+ echo json_encode($setting[1]);
+ }
+
+
+
if($setting[2] == 'text' or $setting[2] == 'password' or $setting[2] == 'readonly' or $setting[2] == 'text.select')
{
$val = encode_single_quotes($setting[3]);
@@ -304,6 +353,9 @@ function saveSettings()
$temp = $temp.']'; // close brackets
$txt = $txt.$setting[1]."=".$temp."\n" ;
+ } elseif($setting[2] == 'json')
+ {
+ $txt = $txt.$setting[1]."=".$setting[3]."\n" ;
}
}
}
diff --git a/front/settings.php b/front/settings.php
index 65c6f62f..45dbbc3a 100755
--- a/front/settings.php
+++ b/front/settings.php
@@ -425,12 +425,12 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
var settingsArray = [];
// generate javascript to collect values
- const noConversion = ['text', 'integer', 'password', 'readonly', 'text.select', 'integer.select', 'text.multiselect'];
+ const noConversion = ['text', 'integer', 'string', 'password', 'readonly', 'text.select', 'integer.select', 'text.multiselect'];
settingsJSON["data"].forEach(set => {
if (noConversion.includes(set['Type'])) {
- console.log($(set["Code_Name"]).val())
+ console.log($('#'+set["Code_Name"]).val())
console.log(set["Code_Name"])
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], $('#'+set["Code_Name"]).val()]);
@@ -455,13 +455,18 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
}
});
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], JSON.stringify(temps)]);
- } else if (set['Type'] === 'json') {
- // todo: fix jquery value collection
- const temps = $('#'+set["Code_Name"]).val();
+ } else if (set['Type'] === 'json') {
+ const temps = $('#'+set["Code_Name"]).val();
settingsArray.push([set["Group"], set["Code_Name"], set["Type"], temps]);
}
});
+
+ // todo fix passing values between front end and server
+ console.log("settingsArray");
console.log(settingsArray);
+
+ sessionStorage.setItem('pia_settingsArray', settingsArray);
+
return settingsArray;
}
diff --git a/pialert/plugin.py b/pialert/plugin.py
index c0e2147e..a47be964 100755
--- a/pialert/plugin.py
+++ b/pialert/plugin.py
@@ -281,7 +281,7 @@ def plugin_param_from_glob_set(globalSetting):
setTyp = globalSetting[3] # setting type
- noConversion = ['text', 'integer', 'boolean', 'password', 'readonly', 'integer.select', 'text.select', 'integer.checkbox' ]
+ noConversion = ['text', 'string', 'integer', 'boolean', 'password', 'readonly', 'integer.select', 'text.select', 'integer.checkbox' ]
arrayConversion = ['text.multiselect', 'list']
if setTyp in noConversion: