return to tab on LogManagement page which was previously selected

after removing a log file and returning to the LogManagement page,
the same tab is selected as before (fixes Bug #30)
This commit is contained in:
Uwe Steinmann 2013-04-11 09:02:24 +02:00
parent 7af915166b
commit 35aa1b995d
5 changed files with 28 additions and 11 deletions

View File

@ -51,9 +51,15 @@ foreach($lognames as $file) {
}
}
if(isset($_POST["mode"])) {
$mode = $_POST["mode"];
} else {
$mode = 'web';
}
add_log_line("?logname=".implode(",", $_POST["lognames"]));
header("Location:../out/out.LogManagement.php");
header("Location:../out/out.LogManagement.php?mode=".$mode);
?>

View File

@ -30,8 +30,11 @@ if (!$user->isAdmin()) {
if (isset($_GET["logname"])) $logname=$_GET["logname"];
else $logname=NULL;
if (isset($_GET["mode"])) $mode=$_GET["mode"];
else $mode='web';
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'logname'=>$logname, 'contentdir'=>$settings->_contentDir));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'logname'=>$logname, 'mode'=>$mode, 'contentdir'=>$settings->_contentDir));
if($view) {
$view->show();
exit;

View File

@ -30,6 +30,11 @@ if (!isset($_GET["logname"])) {
UI::exitError(getMLText("admin_tools"),getMLText("unknown_id"));
}
if(isset($_GET["mode"]))
$mode = $_GET["mode"];
else
$mode = 'web';
/* $_GET["logname"] can be a single file name or an array of file names */
if(!is_array($_GET["logname"]))
$lognames = array($_GET["logname"]);
@ -42,7 +47,7 @@ foreach($lognames as $file) {
}
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'lognames'=>$lognames));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'lognames'=>$lognames, 'mode'=>$mode));
if($view) {
$view->show();
exit;

View File

@ -31,7 +31,7 @@ require_once("class.Bootstrap.php");
*/
class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
function filelist($entries) { /* {{{ */
function filelist($entries, $mode) { /* {{{ */
$print_header = true;
foreach ($entries as $entry){
@ -56,7 +56,7 @@ class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
print "<td>".SeedDMS_Core_File::format_filesize(filesize($this->contentdir.$entry))."</td>\n";
print "<td>";
print "<a href=\"out.RemoveLog.php?logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("rm_file")."</a>";
print "<a href=\"out.RemoveLog.php?mode=".$mode."&logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-remove\"></i> ".getMLText("rm_file")."</a>";
print "&nbsp;";
print "<a href=\"../op/op.Download.php?logname=".$entry."\" class=\"btn btn-mini\"><i class=\"icon-download\"></i> ".getMLText("download")."</a>";
print "&nbsp;";
@ -74,6 +74,7 @@ class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
$user = $this->params['user'];
$this->contentdir = $this->params['contentdir'];
$logname = $this->params['logname'];
$mode = $this->params['mode'];
if(!$logname) {
$this->htmlStartPage(getMLText("log_management"));
@ -106,21 +107,21 @@ class SeedDMS_View_LogManagement extends SeedDMS_Bootstrap_Style {
}
?>
<ul class="nav nav-tabs" id="logtab">
<li class="active"><a data-target="#regular" data-toggle="tab">web</a></li>
<li><a data-target="#webdav" data-toggle="tab">webdav</a></li>
<li <?php echo ($mode == 'web') ? 'class="active"' : ''; ?>><a data-target="#web" data-toggle="tab">web</a></li>
<li <?php echo ($mode == 'webdav') ? 'class="active"' : ''; ?>><a data-target="#webdav" data-toggle="tab">webdav</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="regular">
<div class="tab-pane <?php echo ($mode == 'web') ? 'active' : ''; ?>" id="web">
<?php
$this->contentContainerStart();
$this->filelist($entries);
$this->filelist($entries, 'web');
$this->contentContainerEnd();
?>
</div>
<div class="tab-pane" id="webdav">
<div class="tab-pane <?php echo ($mode == 'webdav') ? 'active' : ''; ?>" id="webdav">
<?php
$this->contentContainerStart();
$this->filelist($wentries);
$this->filelist($wentries, 'webdav');
$this->contentContainerEnd();
?>
</div>

View File

@ -35,6 +35,7 @@ class SeedDMS_View_RemoveLog extends SeedDMS_Bootstrap_Style {
$dms = $this->params['dms'];
$user = $this->params['user'];
$lognames = $this->params['lognames'];
$mode = $this->params['mode'];
$this->htmlStartPage(getMLText("backup_tools"));
$this->globalNavigation();
@ -45,6 +46,7 @@ class SeedDMS_View_RemoveLog extends SeedDMS_Bootstrap_Style {
?>
<form action="../op/op.RemoveLog.php" name="form1" method="post">
<?php echo createHiddenFieldWithKey('removelog'); ?>
<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
<?php
foreach($lognames as $logname) {
echo "<input type=\"hidden\" name=\"lognames[]\" value=\"".$logname."\">\n";