save scroll position

This commit is contained in:
Roland Gruber 2013-07-24 19:58:49 +00:00
parent 0c226abdc5
commit 47f37858cc
3 changed files with 36 additions and 6 deletions

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2004 - 2012 Roland Gruber
Copyright (C) 2004 - 2013 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -145,7 +145,7 @@ foreach ($jsFiles as $jsEntry) {
// print error messages
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
echo ("<form action=\"confmodules.php\" method=\"post\">\n");
echo ("<form id=\"inputForm\" action=\"confmodules.php\" method=\"post\" onSubmit=\"saveScrollPosition('inputForm')\">\n");
// hidden submit buttons which are clicked by tabs
echo "<div style=\"display: none;\">\n";
@ -230,6 +230,16 @@ $buttonContainer->addElement($cancelButton, true);
$buttonContainer->addElement(new htmlSpacer(null, '10px'), true);
parseHtml(null, $buttonContainer, array(), false, $tabindex, 'user');
if ((sizeof($errorsToDisplay) == 0) && isset($_POST['scrollPositionTop']) && isset($_POST['scrollPositionLeft'])) {
// scroll to last position
echo '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(window).scrollTop(' . $_POST['scrollPositionTop'] . ');
jQuery(window).scrollLeft('. $_POST['scrollPositionLeft'] . ');
});
</script>';
}
echo "</form>\n";
echo "</body>\n";
echo "</html>\n";

View File

@ -3,7 +3,7 @@
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2009 - 2012 Roland Gruber
Copyright (C) 2009 - 2013 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -144,7 +144,7 @@ foreach ($jsFiles as $jsEntry) {
// print error messages
for ($i = 0; $i < sizeof($errorsToDisplay); $i++) call_user_func_array('StatusMessage', $errorsToDisplay[$i]);
echo ("<form action=\"moduleSettings.php\" method=\"post\" autocomplete=\"off\">\n");
echo ("<form id=\"inputForm\" action=\"moduleSettings.php\" method=\"post\" autocomplete=\"off\" onSubmit=\"saveScrollPosition('inputForm')\">\n");
// hidden submit buttons which are clicked by tabs
echo "<div style=\"display: none;\">\n";
@ -241,6 +241,16 @@ $buttonContainer->addElement($cancelButton, true);
$buttonContainer->addElement(new htmlSpacer(null, '10px'), true);
parseHtml(null, $buttonContainer, array(), false, $tabindex, 'user');
if ((sizeof($errorsToDisplay) == 0) && isset($_POST['scrollPositionTop']) && isset($_POST['scrollPositionLeft'])) {
// scroll to last position
echo '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(window).scrollTop(' . $_POST['scrollPositionTop'] . ');
jQuery(window).scrollLeft('. $_POST['scrollPositionLeft'] . ');
});
</script>';
}
echo "</form>\n";
echo "</body>\n";
echo "</html>\n";

View File

@ -88,7 +88,7 @@ if ((isset($_GET['headline'])) && ($_GET['logoFile'] != $_SESSION['currentPageDe
if ((isset($_GET['headline'])) && ($_GET['headline'] != $_SESSION['currentPageDefinitions']['headline'])) {
$_SESSION['currentPageDefinitions']['headline'] = str_replace('<','',str_replace('>','',$_GET['headline']));
}
if ((isset($_GET['foldingmarks'])) && ($_GET['foldingmarks'] != $_SESSION['currentPageDefinitions']['foldingmarks'])) {
if ((isset($_GET['foldingmarks'])) && (!isset($_SESSION['currentPageDefinitions']['foldingmarks']) || ($_GET['foldingmarks'] != $_SESSION['currentPageDefinitions']['foldingmarks']))) {
$_SESSION['currentPageDefinitions']['foldingmarks'] = $_GET['foldingmarks'];
}
@ -439,7 +439,7 @@ if (isset($_SESSION['currentPageDefinitions']['filename'])) {
}
?>
<form action="pdfpage.php" method="post">
<form id="inputForm" action="pdfpage.php" method="post" onSubmit="saveScrollPosition('inputForm')">
<?php
$sectionElements = array(_('Beginning') => 0);
$nonTextSectionElements = array();
@ -612,6 +612,16 @@ $container->addElement($buttonContainer, true);
$tabindex = 1;
parseHtml(null, $container, array(), false, $tabindex, $_GET['type']);
if ((sizeof($saveErrors) == 0) && isset($_POST['scrollPositionTop']) && isset($_POST['scrollPositionLeft'])) {
// scroll to last position
echo '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(window).scrollTop(' . $_POST['scrollPositionTop'] . ');
jQuery(window).scrollLeft('. $_POST['scrollPositionLeft'] . ');
});
</script>';
}
echo '</form>';
include '../main_footer.php';