ncp-config: allow empty values

This commit is contained in:
nachoparker 2019-01-08 18:55:36 -07:00
parent 8e34bd1da5
commit 013198cdf7
3 changed files with 16 additions and 9 deletions

View File

@ -1,5 +1,9 @@
[v0.67.12](https://github.com/nextcloud/nextcloudpi/commit/d04ae7b) (2018-12-29) curl installer: add provisioning step
[v1.0.0](https://github.com/nextcloud/nextcloudpi/commit/5eb44b1) (2019-01-08) ncp-config: allow empty values
[v0.67.13](https://github.com/nextcloud/nextcloudpi/commit/21fee19) (2018-12-31) ncp-web: new chinese translate and update chinese translate. (#721)
[v0.67.12](https://github.com/nextcloud/nextcloudpi/commit/a38be5e) (2018-12-29) curl installer: add provisioning step
[v0.67.11](https://github.com/nextcloud/nextcloudpi/commit/4307b14) (2018-12-27) dynDNS: pdate cron execution interval (#754)

View File

@ -33,6 +33,7 @@ function configure_app()
local vars+=("$var")
local vals+=("$val")
local idx=$((i+1))
[[ "$val" == "" ]] && val=_
local parameters+="$var $idx 1 $val $idx 15 60 120 "
done

View File

@ -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 .= "&nbsp;<span class=\"ok-field\">path exists</span>";
else
$ret .= "&nbsp;<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 .= "&nbsp;<span class=\"ok-field\">path exists</span>";
else
$ret .= "&nbsp;<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 .= "&nbsp;<img class=\"pwd-btn\" title=\"show password\" src=\"../img/toggle.svg\">";
$ret .= "</td>";