set current tab to last one selected when submitting data

This commit is contained in:
Uwe Steinmann 2015-03-11 18:24:14 +01:00
parent dee7f03931
commit ed9fbe93e1
3 changed files with 8 additions and 6 deletions

View File

@ -177,6 +177,6 @@ if ($action == "saveSettings")
$session->setSplashMsg(array('type'=>'success', 'msg'=>getMLText('splash_settings_saved')));
header("Location:../out/out.Settings.php");
header("Location:../out/out.Settings.php?currenttab=".$_POST['currenttab']);
?>

View File

@ -31,7 +31,7 @@ if(!trim($settings->_encryptionKey))
$settings->_encryptionKey = md5(uniqid());
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings, 'currenttab'=>(isset($_GET['currenttab']) ? $_GET['currenttab'] : '')));
if($view) {
$view->show();
exit;

View File

@ -35,6 +35,7 @@ class SeedDMS_View_Settings extends SeedDMS_Bootstrap_Style {
$dms = $this->params['dms'];
$user = $this->params['user'];
$settings = $this->params['settings'];
$currenttab = $this->params['currenttab'];
$this->htmlStartPage(getMLText("admin_tools"));
$this->globalNavigation();
@ -47,10 +48,11 @@ class SeedDMS_View_Settings extends SeedDMS_Bootstrap_Style {
<script language="JavaScript">
$(document).ready( function() {
$('#settingstab li a').click(function(event) {
$('#currenttab').val($(event.currentTarget).data('target'));
$('#currenttab').val($(event.currentTarget).data('target').substring(1));
});
});
</script>
<form action="../op/op.Settings.php" method="post" enctype="multipart/form-data" name="form0" >
<input type="hidden" name="action" value="saveSettings" />
<input type="hidden" id="currenttab" name="currenttab" value="<?php echo (isset($_POST['currenttab']) ? $_POST['currenttab'] : 'site' ); ?>" />
@ -63,9 +65,9 @@ if(!is_writeable($settings->_configFilePath)) {
?>
<ul class="nav nav-tabs" id="settingstab">
<li class="<?php if(!isset($_POST['currenttab']) || $_POST['currenttab'] == 'site') echo 'active'; ?>"><a data-target="#site" data-toggle="tab"><?php printMLText('settings_Site'); ?></a></li>
<li class="<?php if($_POST['currenttab'] == 'system') echo 'active'; ?>"><a data-target="#system" data-toggle="tab"><?php printMLText('settings_System'); ?></a></li>
<li class="<?php if($_POST['currenttab'] == 'advanced') echo 'active'; ?>"><a data-target="#advanced" data-toggle="tab"><?php printMLText('settings_Advanced'); ?></a></li>
<li class="<?php if(!$currenttab || $currenttab == 'site') echo 'active'; ?>"><a data-target="#site" data-toggle="tab"><?php printMLText('settings_Site'); ?></a></li>
<li class="<?php if($currenttab == 'system') echo 'active'; ?>"><a data-target="#system" data-toggle="tab"><?php printMLText('settings_System'); ?></a></li>
<li class="<?php if($currenttab == 'advanced') echo 'active'; ?>"><a data-target="#advanced" data-toggle="tab"><?php printMLText('settings_Advanced'); ?></a></li>
</ul>
<div class="tab-content">