Skip to content

Commit

Permalink
Drop another ocurence of inline js
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed Aug 8, 2011
1 parent 8f618e6 commit b57e186
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
16 changes: 16 additions & 0 deletions js/functions.js
Expand Up @@ -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;
});
});
13 changes: 7 additions & 6 deletions libraries/Theme.class.php
Expand Up @@ -321,12 +321,13 @@ function printPreview()
{
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

Expand Down
16 changes: 1 addition & 15 deletions themes.php
Expand Up @@ -19,22 +19,8 @@
/* 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">
Expand Down

0 comments on commit b57e186

Please sign in to comment.