Commit a9d697f9 authored by Franco Fichtner's avatar Franco Fichtner

config manager: merge most improvements from master

Leave out the submenu changes for now.

Discussed with: ad@
parent 4aa65e19
......@@ -10,6 +10,10 @@
<CertificateAuthority VisibleName="Certificate Authority" url="/system_camanager.php*"/>
<CertificationRevocation VisibleName="Certification Revocation" url="/system_crlmanager.php*"/>
</Certificates>
<ConfigManager VisibleName="Config Manager" url="/diag_confbak.php">
<History url="/diag_confbak.php*"/>
<Backups url="/diag_backup.php"/>
</ConfigManager>
<CrashReporter VisibleName="Crash Reporter" url="/crash_reporter.php"/>
<Firmware url="/ui/core/firmware/"/>
<HighAvailSync VisibleName="High Availability" url="/system_hasync.php"/>
......@@ -240,9 +244,6 @@
<Diagnostics order="7" cssClass="glyphicon glyphicon-stats">
<ARPTable VisibleName="ARP Table" url="/diag_arp.php"/>
<Authentication url="/diag_authentication.php"/>
<BackupRestore VisibleName="Backup &amp; Restore" url="/diag_backup.php">
<History url="/diag_confbak.php"/>
</BackupRestore>
<DNSLookup VisibleName="DNS Lookup" url="/diag_dns.php"/>
<FactoryDefaults VisibleName="Factory Defaults" url="/diag_defaults.php"/>
<HaltSystem VisibleName="Halt System" url="/diag_halt.php"/>
......
......@@ -534,7 +534,7 @@ $id = rand() . '.' . time();
$mth = ini_get('upload_progress_meter.store_method');
$dir = ini_get('upload_progress_meter.file.filename_template');
$pgtitle = array(gettext("Diagnostics"),gettext("Backup/restore"));
$pgtitle = array(gettext('System'), gettext('Config Backups'));
include("head.inc");
......@@ -594,8 +594,8 @@ function backuparea_change(obj) {
<?php
$tab_array = array();
$tab_array[0] = array(gettext("Config History"), false, "diag_confbak.php");
$tab_array[1] = array(gettext("Backup/Restore"), true, "diag_backup.php");
$tab_array[0] = array(gettext("History"), false, "diag_confbak.php");
$tab_array[1] = array(gettext("Backups"), true, "diag_backup.php");
display_top_tabs($tab_array);
?>
......@@ -610,7 +610,7 @@ function backuparea_change(obj) {
<div class="content-box">
<header class="content-box-head container-fluid">
<h3>Backup configuration</h3>
<h3><?=gettext('Download')?></h3>
</header>
<div class="content-box-main ">
......@@ -680,7 +680,7 @@ function backuparea_change(obj) {
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Restore configuration"); ?></h3>
<h3><?=gettext("Restore"); ?></h3>
</header>
<div class="content-box-main ">
......@@ -742,7 +742,7 @@ function backuparea_change(obj) {
<section class="__mb">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Remote backup (using Google drive)"); ?></h3>
<h3><?=gettext("Google Drive"); ?></h3>
</header>
<div class="content-box-main ">
......@@ -799,7 +799,6 @@ decrypt_change();
<?php
if (is_subsystem_dirty('restore'))
if (is_subsystem_dirty('restore')) {
system_reboot();
?>
}
......@@ -92,26 +92,40 @@ if($_GET['getcfg'] != "") {
}
}
$newcheck = 'current';
$oldcheck = '';
foreach ($confvers as $revision) {
/* grab first entry if any */
$oldcheck = $revision['time'];
break;
}
if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime'])
&& is_numeric($_GET['oldtime']) && (is_numeric($_GET['newtime']) || ($_GET['newtime'] == 'current'))) {
$oldfile = "";
$newfile = "" ;
$oldfile = '';
$newfile = '';
// search filenames to compare
foreach ($confvers as $filename => $revision) {
if ($revision['time'] == $_GET['oldtime']) {
$oldfile = $filename;
} elseif ($revision['time'] == $_GET['oldtime']) {
}
if ($revision['time'] == $_GET['newtime']) {
$newfile = $filename;
}
}
$diff = "";
$diff = '';
$oldtime = $_GET['oldtime'];
$oldcheck = $oldtime;
if ($_GET['newtime'] == 'current') {
$newfile = '/conf/config.xml';
$newtime = $config['revision']['time'];
$newcheck = 'current';
} else {
$newtime = $_GET['newtime'];
$newcheck = $newtime;
}
if (file_exists($oldfile) && file_exists($newfile)) {
......@@ -119,8 +133,7 @@ if (($_GET['diff'] == 'Diff') && isset($_GET['oldtime']) && isset($_GET['newtime
}
}
$pgtitle = array(gettext("Diagnostics"),gettext("Configuration History"));
$pgtitle = array(gettext('System'), gettext('Config History'));
include("head.inc");
?>
......@@ -140,8 +153,8 @@ include("head.inc");
<?php
$tab_array = array();
$tab_array[0] = array(gettext("Config History"), true, "diag_confbak.php");
$tab_array[1] = array(gettext("Backup/Restore"), false, "diag_backup.php");
$tab_array[0] = array(gettext("History"), true, "diag_confbak.php");
$tab_array[1] = array(gettext("Backups"), false, "diag_backup.php");
display_top_tabs($tab_array);
?>
......@@ -151,48 +164,6 @@ include("head.inc");
<div class="container-fluid tab-content">
<div class="tab-pane active" id="system">
<?php if ($diff): ?>
<section class="__mb">
<div classs="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Configuration diff from");?> <?php echo date(gettext("n/j/y H:i:s"), $oldtime); ?> <?=gettext("to");?> <?php echo date(gettext("n/j/y H:i:s"), $newtime); ?></h3>
</header>
<div class="content-box-main">
<div class="table-responsive">
<table summary="diag confbak">
<tr><td></td></tr>
<?php foreach ($diff as $line) {
switch (substr($line, 0, 1)) {
case "+":
$color = "#caffd3";
break;
case "-":
$color = "#ffe8e8";
break;
case "@":
$color = "#a0a0a0";
break;
default:
$color = "#ffffff";
}
?>
<tr>
<td valign="middle" bgcolor="<?php echo $color; ?>" style="white-space: pre-wrap;"><?php echo htmlentities($line);?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</section>
<?php endif; ?>
<?PHP if ($_GET["newver"] || $_GET["rmver"]): ?>
<form action="<?=explode("?", $_SERVER['REQUEST_URI'])[0];?>" method="post">
<section>
......@@ -232,7 +203,7 @@ include("head.inc");
<div class="content-box">
<header class="content-box-head container-fluid">
<h3>Config history</h3>
<h3><?=gettext('Settings');?></h3>
</header>
<div class="content-box-main">
......@@ -258,14 +229,58 @@ include("head.inc");
</section>
</form>
<?php if ($diff): ?>
<section style="margin-bottom:15px;">
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext("Configuration diff from");?> <?php echo date(gettext("n/j/y H:i:s"), $oldtime); ?> <?=gettext("to");?> <?php echo date(gettext("n/j/y H:i:s"), $newtime); ?></h3>
</header>
<div class="content-box-main">
<div class="container-fluid __mb">
<div class="table-responsive">
<table summary="Differences">
<tr><td></td></tr>
<?php foreach ($diff as $line) {
switch (substr($line, 0, 1)) {
case '+':
$color = '#3bbb33';
break;
case '-':
$color = '#c13928';
break;
case '@':
$color = '#3bb9c3';
break;
default:
$color = '#000000';
}
?>
<tr>
<td valign="middle" style="color: <?=$color;?>; white-space: pre-wrap; font-family: monospace;"><?php echo htmlentities($line);?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
</div>
</div>
</section>
<?php endif; ?>
<?php if (is_array($confvers)): ?>
<form action="<?=$_SERVER['REQUEST_URI'];?>" method="get">
<section>
<div class="content-box">
<header class="content-box-head container-fluid">
<h3><?=gettext('History');?></h3>
</header>
<div class="content-box-main">
<div class="container-fluid __mb">
<button type="submit" name="diff" class="btn btn-primary pull-left" style="margin-right: 8px;" value="Diff"><?=gettext('View differences');?></button>
<?= gettext("To view the differences between an older configuration and a newer configuration, select the older configuration using the left column of radio options and select the newer configuration in the right column, then press the Diff button."); ?>
</div>
......@@ -286,38 +301,34 @@ include("head.inc");
<tr valign="top">
<td valign="middle" class="list nowrap"></td>
<td class="list">
<input type="radio" name="newtime" value="current" />
<input type="radio" name="newtime" value="current" <?= $newcheck == 'current' ? 'checked="checked"' : '' ?>/>
</td>
<td class="listlr"> <?= date(gettext("n/j/y H:i:s"), $config['revision']['time']) ?></td>
<td class="listr"> <?= $config['version'] ?></td>
<td class="listr"> <?= format_bytes(filesize("/conf/config.xml")) ?></td>
<td class="listr"> <?= $config['revision']['description'] ?></td>
<td class="listr"> <?= "{$config['revision']['username']}: {$config['revision']['description']}" ?></td>
<td valign="middle" class="list nowrap"><b><?=gettext("Current");?></b></td>
</tr>
<?php
$c = 0;
foreach($confvers as $version):
if($version['time'] != 0)
$date = date(gettext("n/j/y H:i:s"), $version['time']);
else
$date = gettext("Unknown");
?>
<tr valign="top">
<td class="list">
<input type="radio" name="oldtime" value="<?php echo $version['time'];?>" />
<input type="radio" name="oldtime" value="<?php echo $version['time'];?>" <?= $oldcheck == $version['time'] ? 'checked="checked"' : '' ?>/>
</td>
<td class="list">
<?php if ($c < (count($confvers) - 1)) { ?>
<input type="radio" name="newtime" value="<?php echo $version['time'];?>" />
<input type="radio" name="newtime" value="<?php echo $version['time'];?>" <?= $newcheck == $version['time'] ? 'checked="checked"' : ''?>/>
<?php } else { ?>
&nbsp;
<?php }
$c++; ?>
</td>
<td class="listlr"> <?= $date ?></td>
<td class="listlr"> <?= date(gettext("n/j/y H:i:s"), $version['time']) ?></td>
<td class="listr"> <?= $version['version'] ?></td>
<td class="listr"> <?= format_bytes($version['filesize']) ?></td>
<td class="listr"> <?= substr($version['description'],0,50) ?></td>
<td class="listr"> <?= "{$version['username']}: {$version['description']}" ?></td>
<td class="btn-group-table">
<a href="diag_confbak.php?newver=<?=$version['time'];?>" class="btn btn-default btn-xs" title="<?=gettext("Revert to this configuration");?>"><span class="glyphicon glyphicon-log-in"></span></a>
......@@ -329,11 +340,6 @@ include("head.inc");
<?php endforeach; ?>
</tbody>
</table>
<div class="container-fluid">
<input type="submit" name="diff" class="btn btn-primary" value="<?=gettext("Diff"); ?>" />
</div>
</div>
</section>
</form>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment