diff options
author | nacho <nacho@ownyourbits.com> | 2018-12-31 01:59:26 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2019-01-05 04:14:53 +0300 |
commit | 497edb8d9471c05ace0868e2d6c2f092dca7c030 (patch) | |
tree | 94e08ea7cc0741e40a6c60ca83b181951cf9a955 /ncp-web/elements.php | |
parent | bc0271e359749aadc9c782cab8b7dddf41220b3b (diff) |
add restore defaults btn
Diffstat (limited to 'ncp-web/elements.php')
-rw-r--r-- | ncp-web/elements.php | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/ncp-web/elements.php b/ncp-web/elements.php index aa853280..2a6c5734 100644 --- a/ncp-web/elements.php +++ b/ncp-web/elements.php @@ -25,7 +25,29 @@ HTML; // default to text input if (!array_key_exists('type', $param)) { - $ret .= "<td><input type=\"text\" name=\"$param[name]\" id=\"$ncp_app-$param[id]\" value=\"$param[value]\" size=\"40\"></td>"; + $suggest = ''; + if (array_key_exists('suggest', $param)) + $suggest = $param['suggest']; + + $default = ''; + if (array_key_exists('default', $param)) + $default = $param['default']; + + $ret .= "<td> + <input type=\"text\" + name=\"$param[name]\" + id=\"$ncp_app-$param[id]\" + value=\"$param[value]\" + default=\"$default\" + placeholder=\"$suggest\" + size=\"40\">"; + + if (array_key_exists('default', $param)) + { + $ret .= "<img class=\"default-btn\" title=\"restore defaults\" src=\"../img/info.svg\">"; + } + + $ret .= "</td>"; } // checkbox @@ -34,14 +56,23 @@ HTML; $checked = ""; if ($param['value'] == 'yes') $checked = 'checked'; - $ret .= "<td><input type=\"checkbox\" id=\"$ncp_app-$param[id]\" name=\"$param[name]\" value=\"$param[value]\" $checked></td>"; + $ret .= "<td><input type=\"checkbox\" + id=\"$ncp_app-$param[id]\" + name=\"$param[name]\" + value=\"$param[value]\" + $checked> + </td>"; } // password else if ($param['type'] == 'password') { $ret .= "<td>"; - $ret .= "<input type=\"password\" name=\"$param[name]\" id=\"$ncp_app-$param[id]\" value=\"$param[value]\" size=\"40\">"; + $ret .= "<input type=\"password\" + name=\"$param[name]\" + id=\"$ncp_app-$param[id]\" + value=\"$param[value]\" + size=\"40\">"; $ret .= "<img class=\"pwd-btn\" title=\"show password\" src=\"../img/info.svg\">"; $ret .= "</td>"; } |