diff options
author | nachoparker <nacho@ownyourbits.com> | 2019-01-09 04:55:36 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-01-09 05:20:27 +0300 |
commit | 013198cdf73913ae9cb42c45403d23166666964c (patch) | |
tree | ea7674f305e7a846022e3b2d5cad869d55b809b7 /ncp-web | |
parent | 8e34bd1da5655f659aa6294b4ddd335b8e70b7d2 (diff) |
ncp-config: allow empty valuesv1.0.0
Diffstat (limited to 'ncp-web')
-rw-r--r-- | ncp-web/elements.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ncp-web/elements.php b/ncp-web/elements.php index ab475784..7e7b176d 100644 --- a/ncp-web/elements.php +++ b/ncp-web/elements.php @@ -23,6 +23,10 @@ HTML; $ret .= "<tr>"; $ret .= "<td><label for=\"$ncp_app-$param[id]\">$param[name]</label></td>"; + $value = $param['value']; + if ( $value == '_') + $value = ''; + // default to text input if (!array_key_exists('type', $param) || $param['type'] == 'directory' || $param['type'] == 'file') { @@ -43,7 +47,7 @@ HTML; id=\"$ncp_app-$param[id]\" name=\"$param[name]\" class=\"$class\" - value=\"$param[value]\" + value=\"$value\" default=\"$default\" placeholder=\"$suggest\" size=\"40\">"; @@ -53,7 +57,7 @@ HTML; if (array_key_exists('type', $param) && $param['type'] == 'directory') { - if (file_exists($param['value'])) + if (file_exists($value)) $ret .= " <span class=\"ok-field\">path exists</span>"; else $ret .= " <span class=\"error-field\">path doesn't exist</span>"; @@ -61,9 +65,7 @@ HTML; if (array_key_exists('type', $param) && $param['type'] == 'file') { - error_log($param['value']); - error_log(dirname($param['value'])); - if (file_exists(dirname($param['value']))) + if (file_exists(dirname($value))) $ret .= " <span class=\"ok-field\">path exists</span>"; else $ret .= " <span class=\"error-field\">path doesn't exist</span>"; @@ -76,12 +78,12 @@ HTML; else if ($param['type'] == 'bool') { $checked = ""; - if ($param['value'] == 'yes') + if ($value == 'yes') $checked = 'checked'; $ret .= "<td><input type=\"checkbox\" id=\"$ncp_app-$param[id]\" name=\"$param[name]\" - value=\"$param[value]\" + value=\"$value\" $checked> </td>"; } @@ -93,7 +95,7 @@ HTML; $ret .= "<input type=\"password\" name=\"$param[name]\" id=\"$ncp_app-$param[id]\" - value=\"$param[value]\" + value=\"$value\" size=\"40\">"; $ret .= " <img class=\"pwd-btn\" title=\"show password\" src=\"../img/toggle.svg\">"; $ret .= "</td>"; |