Unify print button code and factor it out to function

This commit is contained in:
Michal Čihař 2011-10-24 14:13:47 +02:00
parent 848f057c49
commit 3dc06f4f70
4 changed files with 15 additions and 39 deletions

View File

@ -269,22 +269,7 @@ foreach ($tables as $table) {
/**
* Displays the footer
*/
?>
<script type="text/javascript">
//<![CDATA[
function printPage()
{
document.getElementById('print').style.visibility = 'hidden';
// Do print the page
if (typeof(window.print) != 'undefined') {
window.print();
}
document.getElementById('print').style.visibility = '';
}
//]]>
</script>
<?php
echo '<br /><br /><input type="button" id="print" value="' . __('Print') . '" onclick="printPage()" />';
PMA_printButton();
require './libraries/footer.inc.php';
?>

View File

@ -244,24 +244,7 @@ if ($num_tables == 0) {
/**
* Displays the footer
*/
?>
PMA_printButton();
<script type="text/javascript">
//<![CDATA[
function printPage()
{
// Do print the page
if (typeof(window.print) != 'undefined') {
window.print();
}
}
//]]>
</script>
<br /><br />
<input type="button" class="print_ignore"
id="print" value="<?php echo __('Print'); ?>" onclick="printPage()" />
<?php
require './libraries/footer.inc.php';
?>

View File

@ -3780,4 +3780,16 @@ function PMA_analyzeLimitClause($limit_clause)
'length' => trim($start_and_length[1])
);
}
/**
* Outputs HTML code for print button.
*
* @return nothing
*/
function PMA_printButton()
{
echo '<p class="print_ignore">';
echo '<input type="button" id="print" value="' . __('Print') . '" />';
echo '</p>';
}
?>

View File

@ -443,11 +443,7 @@ foreach ($the_tables as $key => $table) {
/**
* Displays the footer
*/
?>
PMA_printButton();
<p class="print_ignore">
<input type="button" id="print" value="<?php echo __('Print'); ?>" /></p>
<?php
require './libraries/footer.inc.php';
?>