From 013198cdf73913ae9cb42c45403d23166666964c Mon Sep 17 00:00:00 2001 From: nachoparker Date: Tue, 8 Jan 2019 18:55:36 -0700 Subject: ncp-config: allow empty values --- changelog.md | 6 +++++- etc/library.sh | 1 + ncp-web/elements.php | 18 ++++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/changelog.md b/changelog.md index a871a112..b1b55f78 100644 --- a/changelog.md +++ b/changelog.md @@ -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) diff --git a/etc/library.sh b/etc/library.sh index e8ab7305..1b41fe2c 100644 --- a/etc/library.sh +++ b/etc/library.sh @@ -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 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 .= ""; $ret .= ""; + $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 .= " path exists"; else $ret .= " path doesn't exist"; @@ -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 .= " path exists"; else $ret .= " path doesn't exist"; @@ -76,12 +78,12 @@ HTML; else if ($param['type'] == 'bool') { $checked = ""; - if ($param['value'] == 'yes') + if ($value == 'yes') $checked = 'checked'; $ret .= " "; } @@ -93,7 +95,7 @@ HTML; $ret .= ""; $ret .= " "; $ret .= ""; -- cgit v1.2.3