Drop another ocurence of inline js

This commit is contained in:
Michal Čihař 2011-08-08 13:53:41 +02:00
parent 8f618e6f01
commit b57e186331
3 changed files with 24 additions and 21 deletions

View File

@ -3127,4 +3127,20 @@ $(document).ready(function() {
$('.autosubmit').change(function(e) {
e.target.form.submit();
});
/**
* Theme changer.
*/
$('.take_theme').live('click', function(e) {
alert(e.target.nodeName);
var evt = $(e);
var what = evt.target.id;
if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
window.opener.document.forms['setTheme'].submit();
window.close();
return false;
}
return true;
});
});

View File

@ -321,12 +321,13 @@ class PMA_Theme
{
echo '<div class="theme_preview">';
echo '<h2>' . htmlspecialchars($this->getName())
.' (' . htmlspecialchars($this->getVersion()) . ')</h2>'
.'<p>'
.'<a target="_top" href="index.php'
.PMA_generate_common_url(array('set_theme' => $this->getId())) . '"'
.' onclick="takeThis(\'' . addslashes($this->getId()) . '\');'
.' return false;">';
.' (' . htmlspecialchars($this->getVersion()) . ')</h2>';
echo '<p>';
echo '<a target="_top" class="take_theme" '
.'id="' . htmlspecialchars($this->getId()) . '" '
. 'href="index.php'.PMA_generate_common_url(array(
'set_theme' => $this->getId()
)) . '">';
if (@file_exists($this->getPath() . '/screen.png')) {
// if screen exists then output

View File

@ -19,22 +19,8 @@ require './libraries/header_http.inc.php';
/* HTML header */
$page_title = 'phpMyAdmin - ' . __('Theme');
require './libraries/header_meta_style.inc.php';
require './libraries/header_scripts.inc.php';
?>
<script type="text/javascript" language="javascript">
// <![CDATA[
function takeThis(what)
{
if (window.opener && window.opener.document.forms['setTheme'].elements['set_theme']) {
window.opener.document.forms['setTheme'].elements['set_theme'].value = what;
window.opener.document.forms['setTheme'].submit();
self.close();
} else {
alert('<?php echo sprintf(__('No themes support; please check your configuration and/or your themes in directory %s.'), $cfg['ThemePath']); ?>');
self.close();
}
}
// ]]>
</script>
</head>
<body id="bodythemes">