Skip to content

Commit

Permalink
ncp-web: make config.php into a table
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Apr 4, 2018
1 parent e0e9455 commit 1618b2f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 22 deletions.
6 changes: 5 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

[v0.53.19](https://github.com/nextcloud/nextcloudpi/commit/18d1dd4) (2018-04-04) ncp-web: check for updates upon first run
[v0.53.21](https://github.com/nextcloud/nextcloudpi/commit/89f2b3e) (2018-04-05) ncp-web: make config.php into a table

[v0.53.20](https://github.com/nextcloud/nextcloudpi/commit/e0e9455) (2018-04-04) ncp-web: check for updates upon first run

[v0.53.19](https://github.com/nextcloud/nextcloudpi/commit/88e965c) (2018-04-04) ncp-web: replace textarea with div for output

[v0.53.18](https://github.com/nextcloud/nextcloudpi/commit/e7b76b6) (2018-04-04) ncp-web: refresh sidebar after launching actions

Expand Down
33 changes: 25 additions & 8 deletions ncp-web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@
<div class="icon-dashboard"></div>
</div>
</div>
<div id="config-btn">
<div id="expand">
<div class="icon-config"></div>
</div>
</div>
<?php
if ( file_exists( 'wizard' ) )
echo <<<HTML
Expand All @@ -137,11 +142,6 @@
</a>
HTML;
?>
<div id="config-btn">
<div id="expand">
<div class="icon-config"></div>
</div>
</div>
<a href="https://github.com/nextcloud/nextcloudpi/wiki" target="_blank" tabindex="1">
<div id="nc-button">
<div id="expand">
Expand Down Expand Up @@ -200,9 +200,26 @@
<h2 class="text-title"><?php echo $l->__("Nextcloud configuration"); ?></h2>
<div id="nc-config-box" class="table-wrapper">
<?php
$config = file_get_contents( '/var/www/nextcloud/config/config.php' );
$config = str_replace( "\n", "<br>", $config );
echo "$config";
// print Nextcloud config table
include( '/var/www/nextcloud/config/config.php' );

echo '<table class="dashtable">';
foreach ( $CONFIG as $key => $val )
{
echo '<tr>';
if ( gettype( $val ) == "array" )
{
echo "<td>$key</td>";
echo "<td><table>";
foreach ( $val as $k => $v )
echo "<tr><td>$k</td><td class=\"val-field\">$v</td></tr>";
echo '</table></td>';
}
else
echo "<td>$key</td><td class=\"val-field\">$val</td>";
echo '</tr>';
}
echo '</table>';
?>
</div>
</div>
Expand Down
12 changes: 6 additions & 6 deletions ncp-web/ncp-launcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,23 @@
exec( 'bash /usr/local/bin/ncp-diag', $output, $ret );

// info table
$table = '<table id="dashtable">';
$table = '<table class="dashtable">';
foreach( $output as $line )
{
$table .= "<tr>";
$fields = explode( "|", $line );
$table .= "<td>$fields[0]</td>";

$class = "";
$class = 'val-field';
if ( strpos( $fields[1], "up" ) !== false
|| strpos( $fields[1], "ok" ) !== false
|| strpos( $fields[1], "open" ) !== false )
$class = 'class="ok-field"';
$class = 'ok-field';
if ( strpos( $fields[1], "down" ) !== false
|| strpos( $fields[1], "error" ) !== false )
$class = 'class="error-field"';
$class = 'error-field';

$table .= "<td $class>$fields[1]</td>";
$table .= "<td class=\"$class\">$fields[1]</td>";
$table .= "</tr>";
}
$table .= "</table>";
Expand All @@ -185,7 +185,7 @@
exec( "bash /usr/local/bin/ncp-suggestions \"" . implode( "\n", $output ) . '"', $out, $ret );
foreach( $out as $line )
if ( $line != "" )
$suggestions .= "<p class=\"warn-field\">‣ $line</p>";
$suggestions .= "<p class=\"val-field\">‣ $line</p>";
}

// return JSON
Expand Down
10 changes: 3 additions & 7 deletions ncp-web/ncp.css
Original file line number Diff line number Diff line change
Expand Up @@ -1275,27 +1275,23 @@ a#versionlink:hover {
color: red;
}

.warn-field{
.val-field{
color: gray;
}

#dashtable tr {
.dashtable tr {
height: 25px;
border-bottom: 1px solid #ebebeb;
}

#dashtable td {
.dashtable td {
border-bottom: 1px solid #ebebeb;
}

#dashboard-suggestions {
margin-bottom: 1em;
}

#nc-config-box {
color: gray;
}

.hidden {
display:none
}
Expand Down

0 comments on commit 1618b2f

Please sign in to comment.