diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-09-10 14:51:20 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-09-10 14:51:20 +0300 |
commit | 70aac8e5f51c8044fb670874ac1004d92a516f4f (patch) | |
tree | ecea17e782e0114461df9a4b9db1d826fd7d5de8 | |
parent | 1f055f89332a7595da7a6ea3cc7c700a57b6a1c9 (diff) |
ncp-web: display info for each optionv0.26.23
-rw-r--r-- | ncp-web/index.php | 33 | ||||
-rw-r--r-- | ncp-web/ncp.css | 6 | ||||
-rw-r--r-- | ncp-web/ncp.js | 5 |
3 files changed, 27 insertions, 17 deletions
diff --git a/ncp-web/index.php b/ncp-web/index.php index 05fa694a..988f64e1 100644 --- a/ncp-web/index.php +++ b/ncp-web/index.php @@ -88,21 +88,25 @@ foreach($files as $file) { $script = pathinfo( $file , PATHINFO_FILENAME ); - $fh = fopen( $path . $file ,'r'); + $txt = file_get_contents( $path . $file ); + $active = ""; - while ($line = fgets($fh)) - { - if ( $line == "ACTIVE_=yes\n" ) - $active = " ✓"; - if ( preg_match('/^DESCRIPTION="(.*)"$/', $line, $matches) ) - { - echo "<li id=\"$script\" class=\"nav-recent\">"; - echo "<a href=\"#\"> $script$active </a>"; - echo "<input type=\"hidden\" value=\"$matches[1]\" />"; - echo "</li>"; - } - } - fclose($fh); + if ( preg_match('/^ACTIVE_=yes$/m', $txt, $matches) ) + $active = " ✓"; + + echo "<li id=\"$script\" class=\"nav-recent\">"; + echo "<a href=\"#\"> $script$active </a>"; + + if ( preg_match('/^DESCRIPTION="(.*)"$/m', $txt, $matches) ) + echo "<input id=\"$script-desc\" type=\"hidden\" value=\"$matches[1]\" />"; + + if ( preg_match('/^INFO="(.*)"/msU', $txt, $matches) ) + echo "<input id=\"$script-info\" type=\"hidden\" value=\"$matches[1]\" />"; + + if ( preg_match('/^INFOTITLE="(.*)"/msU', $txt, $matches) ) + echo "<input id=\"$script-infotitle\" type=\"hidden\" value=\"$matches[1]\" />"; + + echo "</li>"; } ?> </ul> @@ -110,6 +114,7 @@ <div id="app-content"> <h2 id="config-box-title">Configure NextCloudPi features</h2> + <div id="config-box-info"></div> <br/> <div id="config-box-wrapper" class="hidden"> <form> diff --git a/ncp-web/ncp.css b/ncp-web/ncp.css index b829eea7..284a7d89 100644 --- a/ncp-web/ncp.css +++ b/ncp-web/ncp.css @@ -1075,6 +1075,11 @@ select { text-align: center; } +#config-box-info { + white-space: pre; + text-align: center; +} + #config-button-wrapper { display: flex; align-items: center; @@ -1124,7 +1129,6 @@ select { padding: 8px; } - #expand #expandDisplayName { padding: 8px; opacity: 0.6; diff --git a/ncp-web/ncp.js b/ncp-web/ncp.js index 707c2f6d..a41d5cde 100644 --- a/ncp-web/ncp.js +++ b/ncp-web/ncp.js @@ -58,8 +58,9 @@ $(function() if ( ret.token ) $('#csrf-token').set( { value: ret.token } ); $('#circle-retstatus').hide(); - $('#config-box').ht( ret.output ); - $('#config-box-title').fill( $( 'input' , '#' + selectedID ).get( '.value' ) ); + $('#config-box').ht( ret.output ); + $('#config-box-title').fill( $( '#' + selectedID + '-desc' ).get( '.value' ) ); + $('#config-box-info' ).fill( $( '#' + selectedID + '-info' ).get( '.value' ) ); $('#config-box-wrapper').show(); confLock = false; }).error( errorMsg ); |