Skip to content

Commit

Permalink
Drop the target attrbute from links and forms
Browse files Browse the repository at this point in the history
  • Loading branch information
roccivic committed Oct 30, 2012
1 parent 797fbf4 commit 1b69d0b
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 59 deletions.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -140,7 +140,7 @@
}
} // 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"
Expand Down
34 changes: 17 additions & 17 deletions js/functions.js
Expand Up @@ -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);
}
});
}
});

/**
Expand Down
12 changes: 12 additions & 0 deletions js/navigation.js
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion libraries/Config.class.php
Expand Up @@ -1545,7 +1545,7 @@ static protected function getFontsizeSelection()
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>';
Expand Down
1 change: 1 addition & 0 deletions libraries/Header.class.php
Expand Up @@ -170,6 +170,7 @@ private function _addDefaultScripts()
. urlencode($_SESSION['PMA_Theme']->getId())
);
$this->_scripts->addFile('functions.js');
$this->_scripts->addFile('navigation.js');
$this->_scripts->addCode(
PMA_Util::getReloadNavigationScript(true)
);
Expand Down
10 changes: 5 additions & 5 deletions libraries/NavigationHeader.class.php
Expand Up @@ -56,7 +56,7 @@ private function logo()
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"';
}
Expand Down Expand Up @@ -95,8 +95,8 @@ private function links()
// 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 {
Expand Down Expand Up @@ -140,7 +140,7 @@ private function links()
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') . '"';
Expand Down Expand Up @@ -185,7 +185,7 @@ private function recent()
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>';
Expand Down
2 changes: 1 addition & 1 deletion libraries/Theme.class.php
Expand Up @@ -445,7 +445,7 @@ public function getPrintPreview()
$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')) {
Expand Down
3 changes: 1 addition & 2 deletions libraries/Theme_Manager.class.php
Expand Up @@ -353,8 +353,7 @@ public function getHtmlSelectBox($form = true)
$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();
}

Expand Down
45 changes: 19 additions & 26 deletions libraries/Util.class.php
Expand Up @@ -2427,7 +2427,7 @@ public static function pageselector(
$pageNowMinusRange = ($pageNow - $range);
$pageNowPlusRange = ($pageNow + $range);

$gotopage = $prompt . ' <select id="pageselector" ';
$gotopage = $prompt . ' <select class="pageselector" ';
if ($GLOBALS['cfg']['AjaxEnable']) {
$gotopage .= ' class="ajax"';
}
Expand Down Expand Up @@ -2554,17 +2554,18 @@ public static function pageselector(
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 .= __('Page number:');
$list_navigator_html .= '<div class="pageselector">';

$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) {
Expand All @@ -2583,18 +2584,16 @@ public static function getListNavigator(
} // 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(
Expand All @@ -2618,24 +2617,18 @@ public static function getListNavigator(
} // 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;
Expand Down
2 changes: 1 addition & 1 deletion libraries/build_html_for_db.lib.php
Expand Up @@ -94,7 +94,7 @@ function PMA_buildHtmlForDb(
__('Jump to database'),
htmlspecialchars($current['SCHEMA_NAME'])
)
. '" target="_parent">'
. '">'
. ' ' . htmlspecialchars($current['SCHEMA_NAME'])
. '</a>'
. '</td>';
Expand Down
2 changes: 1 addition & 1 deletion libraries/plugins/auth/AuthenticationCookie.class.php
Expand Up @@ -169,7 +169,7 @@ public function auth()
<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');
Expand Down
2 changes: 1 addition & 1 deletion themes/original/css/navigation.css.php
Expand Up @@ -84,7 +84,7 @@
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']; ?>;
Expand Down
6 changes: 3 additions & 3 deletions themes/pmahomme/css/navigation.css.php
Expand Up @@ -94,13 +94,13 @@
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;
}
Expand Down

0 comments on commit 1b69d0b

Please sign in to comment.