Drop the target attrbute from links and forms

This commit is contained in:
Rouslan Placella 2012-06-24 18:18:15 +01:00
parent 797fbf4a98
commit 1b69d0bf55
13 changed files with 64 additions and 59 deletions

View File

@ -140,7 +140,7 @@ if ($server > 0
}
} // end if
echo ' <li id="li_select_mysql_collation">';
echo ' <form method="post" action="index.php" target="_parent">' . "\n"
echo ' <form method="post" action="index.php">' . "\n"
. PMA_generate_common_hidden_inputs(null, null, 4, 'collation_connection')
. ' <label for="select_collation_connection">' . "\n"
. ' ' . __('Server connection collation') . "\n"

View File

@ -3182,24 +3182,24 @@ AJAX.registerOnload('functions.js', function() {
});
/**
* Page selector in db Structure (non-AJAX)
* Autosubmit page selector
*/
$('#tableslistcontainer').find('#pageselector').live('change', function() {
$(this).parent("form").submit();
});
/**
* Page selector in navi panel (non-AJAX)
*/
$('#navidbpageselector').find('#pageselector').live('change', function() {
$(this).parent("form").submit();
});
/**
* Page selector in browse_foreigners windows (non-AJAX)
*/
$('#body_browse_foreigners').find('#pageselector').live('change', function() {
$(this).closest("form").submit();
$('select.pageselector').live('change', function() {
// Check where to load the new content
// For the main page we don't need to do anything,
// but for the navigation we need to manually replace the content
if ($(this).closest("div#pma_navigation").length == 0) {
$(this).closest("form").submit();
} else {
var $msgbox = PMA_ajaxShowMessage();
var params = $(this).closest("form").serialize() + '&ajax_request=true';
$.get('navigation.php', params, function (data) {
PMA_ajaxRemoveMessage($msgbox);
if (data.success) {
$('#pma_navigation_tree').html(data.message);
}
});
}
});
/**

View File

@ -254,6 +254,18 @@ function PMA_reloadRecentTable()
/* Performed on load */
AJAX.registerOnload('navigation.js', function(){
$('#pma_navigation_tree div.pageselector a.ajax').live('click', function (e) {
e.preventDefault();
var $msgbox = PMA_ajaxShowMessage();
$.get($(this).attr('href'), {ajax_request: true}, function (data) {
PMA_ajaxRemoveMessage($msgbox);
if (data.success) {
$('#pma_navigation_tree').html(data.message);
}
});
});
/* Display filter */
$('#NavFilter').css('display', 'inline');
var txt = $('#fast_filter').val();

View File

@ -1545,7 +1545,7 @@ class PMA_Config
static public function getFontsizeForm()
{
return '<form name="form_fontsize_selection" id="form_fontsize_selection"'
. ' method="post" action="index.php" target="_parent">' . "\n"
. ' method="post" action="index.php">' . "\n"
. PMA_generate_common_hidden_inputs() . "\n"
. PMA_Config::getFontsizeSelection() . "\n"
. '</form>';

View File

@ -170,6 +170,7 @@ class PMA_Header
. urlencode($_SESSION['PMA_Theme']->getId())
);
$this->_scripts->addFile('functions.js');
$this->_scripts->addFile('navigation.js');
$this->_scripts->addCode(
PMA_Util::getReloadNavigationScript(true)
);

View File

@ -56,7 +56,7 @@ class PMA_NavigationHeader
case 'main':
// do not add our parameters for an external link
if (substr(strtolower($GLOBALS['cfg']['LeftLogoLink']), 0, 4) !== '://') {
$retval .= '?' . $GLOBALS['url_query'] . '" target="frame_content"';
$retval .= '?' . $GLOBALS['url_query'] . '"';
} else {
$retval .= '" target="_blank"';
}
@ -95,8 +95,8 @@ class PMA_NavigationHeader
// Logout for advanced authentication
if ($GLOBALS['cfg']['Server']['auth_type'] != 'config') {
$retval .= ' <a href="index.php?' . $GLOBALS['url_query'] . '&amp;old_usr=';
$retval .= urlencode($GLOBALS['PHP_AUTH_USER']) . '" target="_parent"';
$retval .= ' title="' . __('Log out') . '" >';
$retval .= urlencode($GLOBALS['PHP_AUTH_USER']) . '"';
$retval .= ' title="' . __('Log out') . '" class="disableAjax">';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$retval .= '<img class="icon ic_s_loggoff" src="themes/dot.gif" alt="' . __('Log out') . '" /></a>';
} else {
@ -140,7 +140,7 @@ class PMA_NavigationHeader
if (!empty($GLOBALS['db'])) {
$params['db'] = $GLOBALS['db'];
}
$retval .= ' <a href="navigation.php?' . PMA_generate_common_url($params) . '" target="frame_navigation">';
$retval .= ' <a href="#" id="reloadNavigation">';
if ($GLOBALS['cfg']['NavigationBarIconic']) {
$retval .= '<img class="icon ic_s_reload" src="themes/dot.gif"';
$retval .= ' title="' . __('Reload navigation frame') . '"';
@ -185,7 +185,7 @@ class PMA_NavigationHeader
if ($GLOBALS['cfg']['LeftRecentTable'] > 0) {
$retval .= '<!-- RECENT START -->';
$retval .= '<div id="recentTableList">';
$retval .= ' <form method="post" action="index.php" target="_parent">';
$retval .= ' <form method="post" action="index.php">';
$retval .= ' ' . PMA_generate_common_hidden_inputs();
$retval .= PMA_RecentTable::getInstance()->getHtmlSelect();
$retval .= ' </form>';

View File

@ -445,7 +445,7 @@ class PMA_Theme
$retval .= ' (' . htmlspecialchars($this->getVersion()) . ') ';
$retval .= '</h2>';
$retval .= '<p>';
$retval .= '<a target="_top" class="take_theme" ';
$retval .= '<a class="take_theme" ';
$retval .= 'name="' . htmlspecialchars($this->getId()) . '" ';
$retval .= 'href="' . $url . '">';
if (@file_exists($this->getPath() . '/screen.png')) {

View File

@ -353,8 +353,7 @@ class PMA_Theme_Manager
$select_box = '';
if ($form) {
$select_box .= '<form name="setTheme" method="post" action="index.php"'
.' target="_parent">';
$select_box .= '<form name="setTheme" method="post" action="index.php">';
$select_box .= PMA_generate_common_hidden_inputs();
}

View File

@ -2427,7 +2427,7 @@ class PMA_Util
$pageNowMinusRange = ($pageNow - $range);
$pageNowPlusRange = ($pageNow + $range);
$gotopage = $prompt . ' <select id="pageselector" ';
$gotopage = $prompt . ' <select class="pageselector" ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$gotopage .= ' class="ajax"';
}
@ -2554,17 +2554,18 @@ class PMA_Util
public static function getListNavigator(
$count, $pos, $_url_params, $script, $frame, $max_count
) {
$class = $frame == 'frame_navigation' ? ' class="ajax"' : '';
$list_navigator_html = '';
if ($max_count < $count) {
$list_navigator_html .= ($frame == 'frame_navigation')
? '<div id="navidbpageselector">' . "\n"
: '';
$list_navigator_html .= '<div class="pageselector">';
$list_navigator_html .= __('Page number:');
$list_navigator_html .= ($frame == 'frame_navigation') ? '<br />' : ' ';
if ($frame != 'frame_navigation') {
$list_navigator_html .= __('Page number:');
}
// Move to the beginning or to the previous page
if ($pos > 0) {
@ -2583,18 +2584,16 @@ class PMA_Util
} // end if... else...
$_url_params['pos'] = 0;
$list_navigator_html .= '<a' . $title1 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="'
. $frame . '">' . $caption1 . '</a>';
$list_navigator_html .= '<a' . $class . $title1 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '">' . $caption1 . '</a>';
$_url_params['pos'] = $pos - $max_count;
$list_navigator_html .= '<a' . $title2 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="'
. $frame . '">' . $caption2 . '</a>';
$list_navigator_html .= '<a' . $class . $title2 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '">' . $caption2 . '</a>';
}
$list_navigator_html .= "\n" . '<form action="' . basename($script).
'" method="post" target="' . $frame . '">' . "\n";
$list_navigator_html .= '<form action="' . basename($script).
'" method="post">';
$list_navigator_html .= PMA_generate_common_hidden_inputs($_url_params);
$list_navigator_html .= self::pageselector(
@ -2618,24 +2617,18 @@ class PMA_Util
} // end if... else...
$_url_params['pos'] = $pos + $max_count;
$list_navigator_html .= '<a' . $title3 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="'
. $frame . '">' . $caption3 . '</a>';
$list_navigator_html .= '<a' . $class . $title3 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" >' . $caption3 . '</a>';
$_url_params['pos'] = floor($count / $max_count) * $max_count;
if ($_url_params['pos'] == $count) {
$_url_params['pos'] = $count - $max_count;
}
$list_navigator_html .= '<a' . $title4 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" target="'
. $frame . '">' . $caption4 . '</a>';
}
$list_navigator_html .= "\n";
if ('frame_navigation' == $frame) {
$list_navigator_html .= '</div>' . "\n";
$list_navigator_html .= '<a' . $class . $title4 . ' href="' . $script
. PMA_generate_common_url($_url_params) . '" >' . $caption4 . '</a>';
}
$list_navigator_html .= '</div>' . "\n";
}
return $list_navigator_html;

View File

@ -94,7 +94,7 @@ function PMA_buildHtmlForDb(
__('Jump to database'),
htmlspecialchars($current['SCHEMA_NAME'])
)
. '" target="_parent">'
. '">'
. ' ' . htmlspecialchars($current['SCHEMA_NAME'])
. '</a>'
. '</td>';

View File

@ -169,7 +169,7 @@ class AuthenticationCookie extends AuthenticationPlugin
<br />
<!-- Login form -->
<form method="post" action="index.php" name="login_form"' . $autocomplete .
' target="_top" class="login hide js-show">
' class="disableAjax login hide js-show">
<fieldset>
<legend>';
echo __('Log in');

View File

@ -84,7 +84,7 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) {
font-style: normal;
}
#pma_navigation div#navidbpageselector a,
#pma_navigation div.pageselector a,
#pma_navigation ul#databaseList a {
background: <?php echo $GLOBALS['cfg']['NaviBackground']; ?>;
color: <?php echo $GLOBALS['cfg']['NaviColor']; ?>;

View File

@ -94,13 +94,13 @@ if (! defined('PMA_MINIMUM_COMMON') && ! defined('TESTSUITE')) {
border-<?php echo $right; ?>: 1px solid #aaa;
}
#pma_navigation div#navidbpageselector {
#pma_navigation div.pageselector {
margin: .1em;
text-align: center;
}
#pma_navigation div#navidbpageselector a,
#pma_navigation div#navidbpageselector select{
#pma_navigation div.pageselector a,
#pma_navigation div.pageselector select{
color: #333;
margin: .2em;
}