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 | |
parent | 8e34bd1da5655f659aa6294b4ddd335b8e70b7d2 (diff) |
ncp-config: allow empty valuesv1.0.0
-rw-r--r-- | changelog.md | 6 | ||||
-rw-r--r-- | etc/library.sh | 1 | ||||
-rw-r--r-- | 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 .= "<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>"; |