Merge pull request #1708 from devenbansod/rfe701_using_css
RFE#701 - Print View using CSS - Rewrite
This commit is contained in:
commit
af658d27ee
174
db_printview.php
174
db_printview.php
@ -1,174 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Print view of a database
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/db_printview.lib.php';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
$header->enablePrintView();
|
||||
|
||||
PMA_Util::checkParameters(array('db'));
|
||||
|
||||
/**
|
||||
* Defines the url to return to in case of error in a sql statement
|
||||
*/
|
||||
$err_url = 'db_sql.php' . PMA_URL_getCommon(array('db' => $db));
|
||||
|
||||
/**
|
||||
* Settings for relations stuff
|
||||
*/
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
* If there is at least one table, displays the printer friendly view, else
|
||||
* an error message
|
||||
*/
|
||||
$tables = $GLOBALS['dbi']->getTablesFull($db);
|
||||
$num_tables = count($tables);
|
||||
|
||||
echo '<br />';
|
||||
|
||||
// 1. No table
|
||||
if ($num_tables == 0) {
|
||||
echo __('No tables found in database.');
|
||||
} else {
|
||||
// 2. Shows table information
|
||||
echo '<table>';
|
||||
echo '<thead>';
|
||||
echo '<tr>';
|
||||
echo '<th>' . __('Table') . '</th>';
|
||||
echo '<th>' . __('Rows') . '</th>';
|
||||
echo '<th>' . __('Type') . '</th>';
|
||||
if ($cfg['ShowStats']) {
|
||||
echo '<th>' . __('Size') . '</th>';
|
||||
}
|
||||
echo '<th>' . __('Comments') . '</th>';
|
||||
echo '</tr>';
|
||||
echo '</thead>';
|
||||
echo '<tbody>';
|
||||
$sum_entries = $sum_size = 0;
|
||||
$odd_row = true;
|
||||
foreach ($tables as $sts_data) {
|
||||
if (PMA_Table::isMerge($db, $sts_data['TABLE_NAME'])
|
||||
|| /*overload*/mb_strtoupper($sts_data['ENGINE']) == 'FEDERATED'
|
||||
) {
|
||||
$merged_size = true;
|
||||
} else {
|
||||
$merged_size = false;
|
||||
}
|
||||
$sum_entries += $sts_data['TABLE_ROWS'];
|
||||
echo '<tr class="' . ($odd_row ? 'odd' : 'even') . '">';
|
||||
echo '<th>';
|
||||
echo htmlspecialchars($sts_data['TABLE_NAME']);
|
||||
echo '</th>';
|
||||
|
||||
if (isset($sts_data['TABLE_ROWS'])) {
|
||||
echo '<td class="right">';
|
||||
if ($merged_size) {
|
||||
echo '<i>';
|
||||
echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0);
|
||||
echo '</i>';
|
||||
} else {
|
||||
echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0);
|
||||
}
|
||||
echo '</td>';
|
||||
echo '<td class="nowrap">';
|
||||
echo $sts_data['ENGINE'];
|
||||
echo '</td>';
|
||||
if ($cfg['ShowStats']) {
|
||||
$tblsize = $sts_data['Data_length'] + $sts_data['Index_length'];
|
||||
$sum_size += $tblsize;
|
||||
list($formated_size, $unit)
|
||||
= PMA_Util::formatByteDown($tblsize, 3, 1);
|
||||
echo '<td class="right nowrap">';
|
||||
echo $formated_size . ' ' . $unit;
|
||||
echo '</td>';
|
||||
} // end if
|
||||
} else {
|
||||
echo '<td colspan="3" class="center">';
|
||||
if (! PMA_Table::isView($db, $sts_data['TABLE_NAME'])) {
|
||||
echo __('in use');
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
echo '<td>';
|
||||
if (! empty($sts_data['Comment'])) {
|
||||
echo htmlspecialchars($sts_data['Comment']);
|
||||
$needs_break = '<br />';
|
||||
} else {
|
||||
$needs_break = '';
|
||||
}
|
||||
|
||||
if (! empty($sts_data['Create_time'])
|
||||
|| ! empty($sts_data['Update_time'])
|
||||
|| ! empty($sts_data['Check_time'])
|
||||
) {
|
||||
echo $needs_break;
|
||||
echo '<table width="100%">';
|
||||
|
||||
if (! empty($sts_data['Create_time'])) {
|
||||
echo PMA_getHtmlForOneDate(
|
||||
__('Creation:'),
|
||||
$sts_data['Create_time']
|
||||
);
|
||||
}
|
||||
|
||||
if (! empty($sts_data['Update_time'])) {
|
||||
echo PMA_getHtmlForOneDate(
|
||||
__('Last update:'),
|
||||
$sts_data['Update_time']
|
||||
);
|
||||
}
|
||||
|
||||
if (! empty($sts_data['Check_time'])) {
|
||||
echo PMA_getHtmlForOneDate(
|
||||
__('Last check:'),
|
||||
$sts_data['Check_time']
|
||||
);
|
||||
}
|
||||
echo '</table>';
|
||||
}
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '<tr>';
|
||||
echo '<th class="center">';
|
||||
printf(
|
||||
_ngettext('%s table', '%s tables', $num_tables),
|
||||
PMA_Util::formatNumber($num_tables, 0)
|
||||
);
|
||||
echo '</th>';
|
||||
echo '<th class="right nowrap">';
|
||||
echo PMA_Util::formatNumber($sum_entries, 0);
|
||||
echo '</th>';
|
||||
echo '<th class="center">';
|
||||
echo '--';
|
||||
echo '</th>';
|
||||
if ($cfg['ShowStats']) {
|
||||
list($sum_formated, $unit)
|
||||
= PMA_Util::formatByteDown($sum_size, 3, 1);
|
||||
echo '<th class="right nowrap">';
|
||||
echo $sum_formated . ' ' . $unit;
|
||||
echo '</th>';
|
||||
}
|
||||
echo '<th></th>';
|
||||
echo '</tr>';
|
||||
echo '</tbody>';
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
echo PMA_Util::getButton();
|
||||
|
||||
echo "<div id='PMA_disable_floating_menubar'></div>\n";
|
||||
@ -343,7 +343,7 @@ $response->addHTML('</div><hr />');
|
||||
/* DATABASE WORK */
|
||||
/* Printable view of a table */
|
||||
$response->addHTML(
|
||||
PMA_getHtmlForTablePrintViewLink($url_query)
|
||||
PMA_getHtmlForTablePrintViewLink()
|
||||
. PMA_getHtmlForDataDictionaryLink($url_query)
|
||||
);
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ AJAX.registerTeardown('db_structure.js', function () {
|
||||
$(document).off('click', "a.drop_table_anchor.ajax");
|
||||
$(document).off('click', '#real_end_input');
|
||||
$(document).off('click', "a.favorite_table_anchor.ajax");
|
||||
$(document).off('click', '#printView');
|
||||
$('a.real_row_count').off('click');
|
||||
$('a.row_count_sum').off('click');
|
||||
$('select[name=submit_mult]').unbind('change');
|
||||
@ -182,31 +183,6 @@ function PMA_fetchRealRowCount($target)
|
||||
}
|
||||
|
||||
AJAX.registerOnload('db_structure.js', function () {
|
||||
/**
|
||||
* Handler for the print view multisubmit.
|
||||
* All other multi submits can be handled via ajax, but this one needs
|
||||
* special treatment as the results need to open in another browser window
|
||||
*/
|
||||
$('#tablesForm').submit(function (event) {
|
||||
var $form = $(this);
|
||||
if ($form.find('select[name=submit_mult]').val() === 'print') {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
$('form#clone').remove();
|
||||
var $clone = $form
|
||||
.clone()
|
||||
.hide()
|
||||
.appendTo('body');
|
||||
$clone
|
||||
.find('select[name=submit_mult]')
|
||||
.val('print');
|
||||
$clone
|
||||
.attr('target', 'printview')
|
||||
.attr('id', 'clone')
|
||||
.submit();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* function to open the confirmation dialog for making table consistent with central list
|
||||
*
|
||||
@ -349,6 +325,16 @@ AJAX.registerOnload('db_structure.js', function () {
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end of Drop Table Ajax action
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print View'
|
||||
*/
|
||||
$(document).on('click', "#printView", function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Print the page
|
||||
printPage();
|
||||
}); //end of Print View action
|
||||
|
||||
//Calculate Real End for InnoDB
|
||||
/**
|
||||
* Ajax Event handler for calculating the real end for a InnoDB table
|
||||
|
||||
11
js/sql.js
11
js/sql.js
@ -101,6 +101,7 @@ AJAX.registerTeardown('sql.js', function () {
|
||||
$(document).off('click', 'th.column_heading.marker');
|
||||
$(window).unbind('scroll');
|
||||
$(document).off("keyup", ".filter_rows");
|
||||
$(document).off('click', "#printView");
|
||||
if (codemirror_editor) {
|
||||
codemirror_editor.off('change');
|
||||
} else {
|
||||
@ -191,6 +192,16 @@ AJAX.registerOnload('sql.js', function () {
|
||||
.toggle($(this).val().length > 0);
|
||||
}).trigger('keyup');
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print View'
|
||||
*/
|
||||
$(document).on('click', "#printView", function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Print the page
|
||||
printPage();
|
||||
}); //end of Print View action
|
||||
|
||||
/**
|
||||
* Attach the {@link makegrid} function to a custom event, which will be
|
||||
* triggered manually everytime the table of results is reloaded
|
||||
|
||||
@ -80,6 +80,7 @@ AJAX.registerTeardown('tbl_structure.js', function () {
|
||||
$(document).off('click', "a.drop_column_anchor.ajax");
|
||||
$(document).off('click', "a.add_key.ajax");
|
||||
$(document).off('click', "#move_columns_anchor");
|
||||
$(document).off('click', "#printView");
|
||||
$(document).off('submit', ".append_fields_form.ajax");
|
||||
$('body').off('click', '#fieldsForm.ajax button[name="submit_mult"], #fieldsForm.ajax input[name="submit_mult"]');
|
||||
});
|
||||
@ -243,6 +244,16 @@ AJAX.registerOnload('tbl_structure.js', function () {
|
||||
}); // end $.PMA_confirm()
|
||||
}); //end of Drop Column Anchor action
|
||||
|
||||
/**
|
||||
* Attach Event Handler for 'Print View'
|
||||
*/
|
||||
$(document).on('click', "#printView", function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Print the page
|
||||
printPage();
|
||||
}); //end of Print View action
|
||||
|
||||
/**
|
||||
* Ajax Event handler for adding keys
|
||||
*/
|
||||
|
||||
@ -807,7 +807,7 @@ class PMA_DisplayResults
|
||||
$html_sql_query = htmlspecialchars($this->__get('sql_query'));
|
||||
|
||||
// Navigation bar
|
||||
$table_navigation_html .= '<table class="navigation nospacing nopadding">'
|
||||
$table_navigation_html .= '<table class="navigation nospacing nopadding print_ignore">'
|
||||
. '<tr>'
|
||||
. '<td class="navigation_separator"></td>';
|
||||
|
||||
@ -1427,7 +1427,7 @@ class PMA_DisplayResults
|
||||
|
||||
$drop_down_html = '';
|
||||
|
||||
$drop_down_html .= '<form action="sql.php" method="post">' . "\n"
|
||||
$drop_down_html .= '<form action="sql.php" method="post" class="print_ignore">' . "\n"
|
||||
. PMA_URL_getHiddenInputs(
|
||||
$this->__get('db'), $this->__get('table')
|
||||
)
|
||||
@ -1537,7 +1537,7 @@ class PMA_DisplayResults
|
||||
= (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE)
|
||||
&& ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE)) ? 4 : 0;
|
||||
|
||||
$button_html .= '<th colspan="' . $this->__get('fields_cnt') . '">'
|
||||
$button_html .= '<th class="print_ignore" colspan="' . $this->__get('fields_cnt') . '">'
|
||||
. '</th>'
|
||||
. '</tr>'
|
||||
. '<tr>';
|
||||
@ -1553,7 +1553,7 @@ class PMA_DisplayResults
|
||||
= (($displayParts['edit_lnk'] != self::NO_EDIT_OR_DELETE)
|
||||
&& ($displayParts['del_lnk'] != self::NO_EDIT_OR_DELETE)) ? 4 : 0;
|
||||
|
||||
$button_html .= '<th class="column_action" ' . $colspan . '>'
|
||||
$button_html .= '<th class="column_action print_ignore" ' . $colspan . '>'
|
||||
. $full_or_partial_text_link . '</th>';
|
||||
|
||||
} elseif ((($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_LEFT)
|
||||
@ -1706,7 +1706,7 @@ class PMA_DisplayResults
|
||||
$options_html .= '<form method="post" action="sql.php" '
|
||||
. 'name="displayOptionsForm"';
|
||||
|
||||
$options_html .= ' class="ajax" ';
|
||||
$options_html .= ' class="ajax print_ignore" ';
|
||||
|
||||
$options_html .= '>';
|
||||
$url_params = array(
|
||||
@ -4845,7 +4845,7 @@ class PMA_DisplayResults
|
||||
&$dt_result, $analyzed_sql, $del_link
|
||||
) {
|
||||
|
||||
$links_html = '';
|
||||
$links_html = '<div class="print_ignore" >';
|
||||
$url_query = $this->__get('url_query');
|
||||
$delete_text = ($del_link == self::DELETE_ROW) ? __('Delete') : __('Kill');
|
||||
|
||||
@ -4885,7 +4885,7 @@ class PMA_DisplayResults
|
||||
);
|
||||
}
|
||||
|
||||
$links_html .= "\n";
|
||||
$links_html .= "</div>\n";
|
||||
|
||||
$links_html .= '<input type="hidden" name="sql_query"'
|
||||
. ' value="' . htmlspecialchars($this->__get('sql_query')) . '" />'
|
||||
@ -5020,42 +5020,23 @@ class PMA_DisplayResults
|
||||
/**
|
||||
* Get printview links for results operations
|
||||
*
|
||||
* @param string $url_query url query
|
||||
* @param array $_url_params url parameters
|
||||
*
|
||||
* @return string $html
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function _getPrintviewLinks($url_query, $_url_params)
|
||||
private function _getPrintviewLinks()
|
||||
{
|
||||
$html = PMA_Util::linkOrButton(
|
||||
'sql.php' . $url_query,
|
||||
'#',
|
||||
PMA_Util::getIcon(
|
||||
'b_print.png', __('Print view'), true
|
||||
),
|
||||
array('target' => 'print_view'),
|
||||
array('id' => 'printView'),
|
||||
true,
|
||||
true,
|
||||
'print_view'
|
||||
);
|
||||
|
||||
if ($_SESSION['tmpval']['pftext']) {
|
||||
$_url_params['pftext'] = self::DISPLAY_FULL_TEXT;
|
||||
|
||||
$html .= PMA_Util::linkOrButton(
|
||||
'sql.php' . PMA_URL_getCommon($_url_params),
|
||||
PMA_Util::getIcon(
|
||||
'b_print.png',
|
||||
__('Print view (with full texts)'), true
|
||||
),
|
||||
array('target' => 'print_view'),
|
||||
true,
|
||||
true,
|
||||
'print_view'
|
||||
);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
@ -5080,7 +5061,7 @@ class PMA_DisplayResults
|
||||
$results_operations_html = '';
|
||||
$fields_meta = $this->__get('fields_meta'); // To safe use in foreach
|
||||
$header_shown = false;
|
||||
$header = '<fieldset><legend>' . __('Query results operations')
|
||||
$header = '<fieldset class="print_ignore" ><legend>' . __('Query results operations')
|
||||
. '</legend>';
|
||||
|
||||
$_url_params = array(
|
||||
@ -5110,9 +5091,7 @@ class PMA_DisplayResults
|
||||
|
||||
// Displays "printable view" link if required
|
||||
if ($displayParts['pview_lnk'] == '1') {
|
||||
$results_operations_html .= $this->_getPrintviewLinks(
|
||||
$url_query, $_url_params
|
||||
);
|
||||
$results_operations_html .= $this->_getPrintviewLinks();
|
||||
} // end displays "printable view"
|
||||
|
||||
// Export link
|
||||
@ -5601,7 +5580,7 @@ class PMA_DisplayResults
|
||||
$ret .= 'class="' . $class . '"';
|
||||
}
|
||||
|
||||
$ret .= ' class="center">'
|
||||
$ret .= ' class="center print_ignore">'
|
||||
. '<input type="checkbox" id="id_rows_to_delete'
|
||||
. $row_no . $id_suffix
|
||||
. '" name="rows_to_delete[' . $row_no . ']"'
|
||||
@ -5640,7 +5619,7 @@ class PMA_DisplayResults
|
||||
$ret = '';
|
||||
if (! empty($edit_url)) {
|
||||
|
||||
$ret .= '<td class="' . $class . ' center" ' . ' ><span class="nowrap">'
|
||||
$ret .= '<td class="' . $class . ' center print_ignore" ' . ' ><span class="nowrap">'
|
||||
. PMA_Util::linkOrButton(
|
||||
$edit_url, $edit_str, array(), false
|
||||
);
|
||||
@ -5687,7 +5666,7 @@ class PMA_DisplayResults
|
||||
$ret .= $class . ' ';
|
||||
}
|
||||
|
||||
$ret .= 'center" ' . ' ><span class="nowrap">'
|
||||
$ret .= 'center print_ignore" ' . ' ><span class="nowrap">'
|
||||
. PMA_Util::linkOrButton(
|
||||
$copy_url, $copy_str, array(), false
|
||||
);
|
||||
@ -5733,7 +5712,7 @@ class PMA_DisplayResults
|
||||
$ret .= $class . ' ';
|
||||
}
|
||||
$ajax = PMA_Response::getInstance()->isAjax() ? ' ajax' : '';
|
||||
$ret .= 'center" ' . ' >'
|
||||
$ret .= 'center print_ignore" ' . ' >'
|
||||
. PMA_Util::linkOrButton(
|
||||
$del_url, $del_str, array('class' => 'delete_row requireConfirm' . $ajax), false
|
||||
)
|
||||
|
||||
@ -658,6 +658,9 @@ class PMA_Header
|
||||
$retval .= '<link rel="stylesheet" type="text/css" href="'
|
||||
. $basedir . 'phpmyadmin.css.php?'
|
||||
. 'nocache=' . $theme_id . $GLOBALS['text_dir'] . '" />';
|
||||
// load Print view's CSS last, so that it overrides all other CSS while 'printing'
|
||||
$retval .= '<link rel="stylesheet" type="text/css" href="'
|
||||
. $basedir . '/css/printview.css" />';
|
||||
}
|
||||
|
||||
return $retval;
|
||||
|
||||
@ -690,7 +690,7 @@ class PMA_Index
|
||||
$r .= '<thead>';
|
||||
$r .= '<tr>';
|
||||
if (! $print_mode) {
|
||||
$r .= '<th colspan="2">' . __('Action') . '</th>';
|
||||
$r .= '<th colspan="2" class="print_ignore">' . __('Action') . '</th>';
|
||||
}
|
||||
$r .= '<th>' . __('Keyname') . '</th>';
|
||||
$r .= '<th>' . __('Type') . '</th>';
|
||||
@ -714,7 +714,7 @@ class PMA_Index
|
||||
if (! $print_mode) {
|
||||
$this_params = $GLOBALS['url_params'];
|
||||
$this_params['index'] = $index->getName();
|
||||
$r .= '<td class="edit_index';
|
||||
$r .= '<td class="edit_index print_ignore';
|
||||
$r .= ' ajax';
|
||||
$r .= '" ' . $row_span . '>'
|
||||
. ' <a class="';
|
||||
@ -747,7 +747,7 @@ class PMA_Index
|
||||
|
||||
}
|
||||
|
||||
$r .= '<td ' . $row_span . '>';
|
||||
$r .= '<td ' . $row_span . ' class="print_ignore">';
|
||||
$r .= '<input type="hidden" class="drop_primary_key_index_msg"'
|
||||
. ' value="' . $js_msg . '" />';
|
||||
$r .= ' <a class="drop_primary_key_index_anchor';
|
||||
|
||||
@ -1259,7 +1259,7 @@ class PMA_Util
|
||||
}
|
||||
$retval .= '</div>';
|
||||
|
||||
$retval .= '<div class="tools">';
|
||||
$retval .= '<div class="tools print_ignore">';
|
||||
$retval .= '<form action="sql.php" method="post">';
|
||||
$retval .= PMA_URL_getHiddenInputs(
|
||||
$GLOBALS['db'], $GLOBALS['table']
|
||||
|
||||
@ -376,7 +376,6 @@ $goto_whitelist = array(
|
||||
'db_structure.php',
|
||||
'db_import.php',
|
||||
'db_operations.php',
|
||||
'db_printview.php',
|
||||
'db_search.php',
|
||||
'db_routines.php',
|
||||
'export.php',
|
||||
@ -408,7 +407,6 @@ $goto_whitelist = array(
|
||||
'tbl_create.php',
|
||||
'tbl_import.php',
|
||||
'tbl_indexes.php',
|
||||
'tbl_printview.php',
|
||||
'tbl_sql.php',
|
||||
'tbl_export.php',
|
||||
'tbl_operations.php',
|
||||
|
||||
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Set of functions related to db printview
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get html for one of the db dates
|
||||
*
|
||||
* @param string $title the title
|
||||
* @param string $date which date to display
|
||||
*
|
||||
* @return string html content
|
||||
*/
|
||||
function PMA_getHtmlForOneDate($title, $date)
|
||||
{
|
||||
$html = '<tr>'
|
||||
. '<td class="right">' . $title . '</td>'
|
||||
. '<td class="right">'
|
||||
. PMA_Util::localisedDate(strtotime($date))
|
||||
. '</td>'
|
||||
. '</tr>';
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
@ -209,7 +209,7 @@ $response->addHTML(
|
||||
);
|
||||
|
||||
$response->addHTML(
|
||||
'</form><hr />'
|
||||
'</form><hr class="print_ignore"/>'
|
||||
);
|
||||
$response->addHTML(
|
||||
PMA_getHtmlDivForMoveColumnsDialog()
|
||||
|
||||
@ -25,7 +25,7 @@ function PMA_getHtmlForDisplayIndexes()
|
||||
'indexes', __('Indexes')
|
||||
);
|
||||
$html_output .= PMA_Index::getHtmlForIndexes($GLOBALS['table'], $GLOBALS['db']);
|
||||
$html_output .= '<fieldset class="tblFooters" style="text-align: left;">'
|
||||
$html_output .= '<fieldset class="tblFooters print_ignore" style="text-align: left;">'
|
||||
. '<form action="tbl_indexes.php" method="post">';
|
||||
$html_output .= PMA_URL_getHiddenInputs(
|
||||
$GLOBALS['db'], $GLOBALS['table']
|
||||
|
||||
@ -57,56 +57,52 @@ if (! empty($submit_mult)
|
||||
} elseif (! empty($_POST['selected_tbl'])) {
|
||||
// coming from database structure view - do something with
|
||||
// selected tables
|
||||
if ($submit_mult == 'print') {
|
||||
include './tbl_printview.php';
|
||||
} else {
|
||||
$selected = $_POST['selected_tbl'];
|
||||
switch ($submit_mult) {
|
||||
case 'add_prefix_tbl':
|
||||
case 'replace_prefix_tbl':
|
||||
case 'copy_tbl_change_prefix':
|
||||
case 'drop_db':
|
||||
case 'drop_tbl':
|
||||
case 'empty_tbl':
|
||||
$what = $submit_mult;
|
||||
break;
|
||||
case 'check_tbl':
|
||||
case 'optimize_tbl':
|
||||
case 'repair_tbl':
|
||||
case 'analyze_tbl':
|
||||
case 'checksum_tbl':
|
||||
$query_type = $submit_mult;
|
||||
unset($submit_mult);
|
||||
$mult_btn = __('Yes');
|
||||
break;
|
||||
case 'export':
|
||||
unset($submit_mult);
|
||||
include 'db_export.php';
|
||||
exit;
|
||||
break;
|
||||
case 'show_create':
|
||||
$show_create = PMA_getHtmlShowCreate($GLOBALS['db'], $selected);
|
||||
// Send response to client.
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $show_create);
|
||||
exit;
|
||||
case 'sync_unique_columns_central_list':
|
||||
include_once 'libraries/central_columns.lib.php';
|
||||
$centralColsError = PMA_syncUniqueColumns($selected);
|
||||
break;
|
||||
case 'delete_unique_columns_central_list':
|
||||
include_once 'libraries/central_columns.lib.php';
|
||||
$centralColsError = PMA_deleteColumnsFromList($selected);
|
||||
break;
|
||||
case 'make_consistent_with_central_list':
|
||||
include_once 'libraries/central_columns.lib.php';
|
||||
$centralColsError = PMA_makeConsistentWithList(
|
||||
$GLOBALS['db'],
|
||||
$selected
|
||||
);
|
||||
break;
|
||||
} // end switch
|
||||
}
|
||||
$selected = $_POST['selected_tbl'];
|
||||
switch ($submit_mult) {
|
||||
case 'add_prefix_tbl':
|
||||
case 'replace_prefix_tbl':
|
||||
case 'copy_tbl_change_prefix':
|
||||
case 'drop_db':
|
||||
case 'drop_tbl':
|
||||
case 'empty_tbl':
|
||||
$what = $submit_mult;
|
||||
break;
|
||||
case 'check_tbl':
|
||||
case 'optimize_tbl':
|
||||
case 'repair_tbl':
|
||||
case 'analyze_tbl':
|
||||
case 'checksum_tbl':
|
||||
$query_type = $submit_mult;
|
||||
unset($submit_mult);
|
||||
$mult_btn = __('Yes');
|
||||
break;
|
||||
case 'export':
|
||||
unset($submit_mult);
|
||||
include 'db_export.php';
|
||||
exit;
|
||||
break;
|
||||
case 'show_create':
|
||||
$show_create = PMA_getHtmlShowCreate($GLOBALS['db'], $selected);
|
||||
// Send response to client.
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->addJSON('message', $show_create);
|
||||
exit;
|
||||
case 'sync_unique_columns_central_list':
|
||||
include_once 'libraries/central_columns.lib.php';
|
||||
$centralColsError = PMA_syncUniqueColumns($selected);
|
||||
break;
|
||||
case 'delete_unique_columns_central_list':
|
||||
include_once 'libraries/central_columns.lib.php';
|
||||
$centralColsError = PMA_deleteColumnsFromList($selected);
|
||||
break;
|
||||
case 'make_consistent_with_central_list':
|
||||
include_once 'libraries/central_columns.lib.php';
|
||||
$centralColsError = PMA_makeConsistentWithList(
|
||||
$GLOBALS['db'],
|
||||
$selected
|
||||
);
|
||||
break;
|
||||
} // end switch
|
||||
} elseif (isset($selected_fld) && !empty($selected_fld)) {
|
||||
// coming from table structure view - do something with
|
||||
// selected columns
|
||||
|
||||
@ -256,61 +256,6 @@ function PMA_getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_valu
|
||||
return $dropdown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML for the header of the page in print view if print view is selected.
|
||||
* Otherwise returns null.
|
||||
*
|
||||
* @param string $db current database
|
||||
* @param string $sql_query current sql query
|
||||
* @param int $num_rows the number of rows in result
|
||||
*
|
||||
* @return string $header html for the header
|
||||
*/
|
||||
function PMA_getHtmlForPrintViewHeader($db, $sql_query, $num_rows)
|
||||
{
|
||||
$response = PMA_Response::getInstance();
|
||||
$header = $response->getHeader();
|
||||
if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
|
||||
PMA_Util::checkParameters(array('db', 'sql_query'));
|
||||
$header->enablePrintView();
|
||||
if ($GLOBALS['cfg']['Server']['verbose']) {
|
||||
$hostname = $GLOBALS['cfg']['Server']['verbose'];
|
||||
} else {
|
||||
$hostname = $GLOBALS['cfg']['Server']['host'];
|
||||
if (! empty($GLOBALS['cfg']['Server']['port'])) {
|
||||
$hostname .= $GLOBALS['cfg']['Server']['port'];
|
||||
}
|
||||
}
|
||||
|
||||
$versions = "phpMyAdmin " . PMA_VERSION;
|
||||
$versions .= " / ";
|
||||
$versions .= "MySQL " . PMA_MYSQL_STR_VERSION;
|
||||
|
||||
$print_view_header = '';
|
||||
$print_view_header .= "<h1>" . __('SQL result') . "</h1>";
|
||||
$print_view_header .= "<p>";
|
||||
$print_view_header .= "<strong>" . __('Host:')
|
||||
. "</strong> $hostname<br />";
|
||||
$print_view_header .= "<strong>" . __('Database:') . "</strong> "
|
||||
. htmlspecialchars($db) . "<br />";
|
||||
$print_view_header .= "<strong>" . __('Generation Time:') . "</strong> "
|
||||
. PMA_Util::localisedDate() . "<br />";
|
||||
$print_view_header .= "<strong>" . __('Generated by:')
|
||||
. "</strong> $versions<br />";
|
||||
$print_view_header .= "<strong>" . __('SQL query:') . "</strong> "
|
||||
. htmlspecialchars($sql_query) . ";";
|
||||
if (isset($num_rows)) {
|
||||
$print_view_header .= "<br />";
|
||||
$print_view_header .= "<strong>" . __('Rows:') . "</strong> $num_rows";
|
||||
}
|
||||
$print_view_header .= "</p>";
|
||||
} else {
|
||||
$print_view_header = null;
|
||||
}
|
||||
|
||||
return $print_view_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTML for the profiling table and accompanying chart if profiling is set.
|
||||
* Otherwise returns null
|
||||
@ -619,7 +564,7 @@ function PMA_getHtmlForBookmark($displayParts, $cfgBookmark, $sql_query, $db,
|
||||
$html = '<form action="sql.php" method="post"'
|
||||
. ' onsubmit="return ! emptyCheckTheField(this,'
|
||||
. '\'bkm_fields[bkm_label]\');"'
|
||||
. ' class="bookmarkQueryForm">';
|
||||
. ' class="bookmarkQueryForm print_ignore">';
|
||||
$html .= PMA_URL_getHiddenInputs();
|
||||
$html .= '<input type="hidden" name="db"'
|
||||
. ' value="' . htmlspecialchars($db) . '" />';
|
||||
@ -1625,14 +1570,12 @@ function PMA_sendResponseForGridEdit($result)
|
||||
* @param string $indexes_problems_html html for displaying errors
|
||||
* in indexes
|
||||
* @param string $bookmark_support_html html for displaying bookmark form
|
||||
* @param string $print_button_html html for the print button
|
||||
* in printview
|
||||
*
|
||||
* @return string $html_output
|
||||
*/
|
||||
function PMA_getHtmlForSqlQueryResults($previous_update_query_html,
|
||||
$profiling_chart_html, $missing_unique_column_msg, $bookmark_created_msg,
|
||||
$table_html, $indexes_problems_html, $bookmark_support_html, $print_button_html
|
||||
$table_html, $indexes_problems_html, $bookmark_support_html
|
||||
) {
|
||||
//begin the sqlqueryresults div here. container div
|
||||
$html_output = '<div class="sqlqueryresults ajax">';
|
||||
@ -1646,7 +1589,6 @@ function PMA_getHtmlForSqlQueryResults($previous_update_query_html,
|
||||
$html_output .= $table_html;
|
||||
$html_output .= isset($indexes_problems_html) ? $indexes_problems_html : '';
|
||||
$html_output .= isset($bookmark_support_html) ? $bookmark_support_html : '';
|
||||
$html_output .= isset($print_button_html) ? $print_button_html : '';
|
||||
$html_output .= '</div>'; // end sqlqueryresults div
|
||||
|
||||
return $html_output;
|
||||
@ -1869,23 +1811,6 @@ function PMA_getHtmlForIndexesProblems($query_type, $selectedTables, $db)
|
||||
return $indexes_problems_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to get the html for the print button in printview
|
||||
*
|
||||
* @return string $print_button_html html for the print button
|
||||
*/
|
||||
function PMA_getHtmlForPrintButton()
|
||||
{
|
||||
// Do print the page if required
|
||||
if (isset($_REQUEST['printview']) && $_REQUEST['printview'] == '1') {
|
||||
$print_button_html = PMA_Util::getButton();
|
||||
} else {
|
||||
$print_button_html = null;
|
||||
}
|
||||
|
||||
return $print_button_html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to display results when the executed query returns non empty results
|
||||
*
|
||||
@ -2025,10 +1950,6 @@ function PMA_getQueryResponseForResultsReturned($result,
|
||||
$GLOBALS['buffer_message'] = false;
|
||||
}
|
||||
|
||||
$print_view_header_html = PMA_getHtmlForPrintViewHeader(
|
||||
$db, $full_sql_query, $num_rows
|
||||
);
|
||||
|
||||
$previous_update_query_html = PMA_getHtmlForPreviousUpdateQuery(
|
||||
isset($disp_query) ? $disp_query : null,
|
||||
$GLOBALS['cfg']['ShowSQL'], isset($sql_data) ? $sql_data : null,
|
||||
@ -2070,17 +1991,12 @@ function PMA_getQueryResponseForResultsReturned($result,
|
||||
$bookmark_support_html = '';
|
||||
}
|
||||
|
||||
$print_button_html = PMA_getHtmlForPrintButton();
|
||||
|
||||
$html_output = isset($table_maintenance_html) ? $table_maintenance_html : '';
|
||||
|
||||
$html_output .= isset($print_view_header_html) ? $print_view_header_html : '';
|
||||
|
||||
$html_output .= PMA_getHtmlForSqlQueryResults(
|
||||
$previous_update_query_html, $profiling_chart_html,
|
||||
$missing_unique_column_msg, $bookmark_created_msg,
|
||||
$table_html, $indexes_problems_html, $bookmark_support_html,
|
||||
$print_button_html
|
||||
$table_html, $indexes_problems_html, $bookmark_support_html
|
||||
);
|
||||
|
||||
return $html_output;
|
||||
|
||||
@ -163,7 +163,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status,
|
||||
$check_time_all, $approx_rows
|
||||
) {
|
||||
$html_output = '<tbody id="tbl_summary_row">'
|
||||
. '<tr><th></th>';
|
||||
. '<tr><th class="print_ignore"></th>';
|
||||
$html_output .= '<th class="tbl_num nowrap">';
|
||||
$html_output .= sprintf(
|
||||
_ngettext('%s table', '%s tables', $num_tables),
|
||||
@ -178,7 +178,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status,
|
||||
if ($GLOBALS['cfg']['NumFavoriteTables'] == 0) {
|
||||
$sum_colspan--;
|
||||
}
|
||||
$html_output .= '<th colspan="' . $sum_colspan . '">'
|
||||
$html_output .= '<th colspan="' . $sum_colspan . '" class="print_ignore" >'
|
||||
. __('Sum')
|
||||
. '</th>';
|
||||
|
||||
@ -294,7 +294,7 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status,
|
||||
function PMA_getHtmlForCheckAllTables($pmaThemeImage, $text_dir,
|
||||
$overhead_check, $db_is_system_schema, $hidden_fields
|
||||
) {
|
||||
$html_output = '<div class="clearfloat">';
|
||||
$html_output = '<div class="clearfloat print_ignore">';
|
||||
$html_output .= '<img class="selectallarrow" '
|
||||
. 'src="' . $pmaThemeImage . 'arrow_' . $text_dir . '.png" '
|
||||
. 'width="38" height="22" alt="' . __('With selected:') . '" />';
|
||||
@ -320,8 +320,6 @@ function PMA_getHtmlForCheckAllTables($pmaThemeImage, $text_dir,
|
||||
. __('Show create') . '</option>' . "\n";
|
||||
$html_output .= '<option value="export" >'
|
||||
. __('Export') . '</option>' . "\n";
|
||||
$html_output .= '<option value="print" >'
|
||||
. __('Print view') . '</option>' . "\n";
|
||||
|
||||
if (!$db_is_system_schema
|
||||
&& !$GLOBALS['cfg']['DisableMultiTableMaintenance']
|
||||
@ -398,14 +396,12 @@ function PMA_getHtmlForCheckTablesHavingOverheadlink($overhead_check)
|
||||
/**
|
||||
* Get HTML links for "Print view" options
|
||||
*
|
||||
* @param string $url_query url query
|
||||
*
|
||||
* @return string $html_output
|
||||
*/
|
||||
function PMA_getHtmlForTablePrintViewLink($url_query)
|
||||
function PMA_getHtmlForTablePrintViewLink()
|
||||
{
|
||||
return '<p>'
|
||||
. '<a href="db_printview.php' . $url_query . '" target="print_view">'
|
||||
return '<p class="print_ignore">'
|
||||
. '<a href="#" id="printView">'
|
||||
. PMA_Util::getIcon(
|
||||
'b_print.png',
|
||||
__('Print view'),
|
||||
@ -506,7 +502,7 @@ function PMA_getHtmlForStructureTableRow(
|
||||
$html_output .= ($table_is_view ? ' is_view' : '')
|
||||
. '" id="row_tbl_' . $curr . '">';
|
||||
|
||||
$html_output .= '<td class="center">'
|
||||
$html_output .= '<td class="center print_ignore">'
|
||||
. '<input type="checkbox" name="selected_tbl[]" class="checkall" '
|
||||
. 'value="' . htmlspecialchars($current_table['TABLE_NAME']) . '" '
|
||||
. 'id="checkbox_tbl_' . $curr . '" /></td>';
|
||||
@ -528,16 +524,16 @@ function PMA_getHtmlForStructureTableRow(
|
||||
}
|
||||
//Favorite table anchor.
|
||||
if ($GLOBALS['cfg']['NumFavoriteTables'] > 0) {
|
||||
$html_output .= '<td class="center">'
|
||||
$html_output .= '<td class="center print_ignore">'
|
||||
. PMA_getHtmlForFavoriteAnchor($db, $current_table, $titles)
|
||||
. '</td>';
|
||||
}
|
||||
|
||||
$html_output .= '<td class="center">' . $browse_table . '</td>';
|
||||
$html_output .= '<td class="center">'
|
||||
$html_output .= '<td class="center print_ignore">' . $browse_table . '</td>';
|
||||
$html_output .= '<td class="center print_ignore">'
|
||||
. '<a href="tbl_structure.php' . $tbl_url_query . '">'
|
||||
. $titles['Structure'] . '</a></td>';
|
||||
$html_output .= '<td class="center">' . $search_table . '</td>';
|
||||
$html_output .= '<td class="center print_ignore">' . $search_table . '</td>';
|
||||
|
||||
if (! $db_is_system_schema) {
|
||||
$html_output .= PMA_getHtmlForInsertEmptyDropActionLinks(
|
||||
@ -591,12 +587,12 @@ function PMA_getHtmlForStructureTableRow(
|
||||
function PMA_getHtmlForInsertEmptyDropActionLinks($tbl_url_query, $table_is_view,
|
||||
$titles, $empty_table, $current_table, $drop_query, $drop_message
|
||||
) {
|
||||
$html_output = '<td class="insert_table center">'
|
||||
$html_output = '<td class="insert_table center print_ignore">'
|
||||
. '<a href="tbl_change.php' . $tbl_url_query . '">'
|
||||
. $titles['Insert']
|
||||
. '</a></td>';
|
||||
$html_output .= '<td class="center">' . $empty_table . '</td>';
|
||||
$html_output .= '<td class="center">';
|
||||
$html_output .= '<td class="center print_ignore">' . $empty_table . '</td>';
|
||||
$html_output .= '<td class="center print_ignore">';
|
||||
$html_output .= '<a ';
|
||||
$html_output .= 'class="ajax drop_table_anchor';
|
||||
if ($table_is_view || $current_table['ENGINE'] == null) {
|
||||
@ -860,7 +856,7 @@ function PMA_tableHeader($db_is_system_schema = false, $replication = false)
|
||||
|
||||
$html_output = '<table class="data">' . "\n"
|
||||
. '<thead>' . "\n"
|
||||
. '<tr><th></th>' . "\n"
|
||||
. '<tr><th class="print_ignore"></th>' . "\n"
|
||||
. '<th>'
|
||||
. PMA_sortableTableHeader(__('Table'), 'table')
|
||||
. '</th>' . "\n";
|
||||
@ -869,7 +865,7 @@ function PMA_tableHeader($db_is_system_schema = false, $replication = false)
|
||||
. ' ' . __('Replication') . "\n"
|
||||
. '</th>';
|
||||
}
|
||||
$html_output .= '<th colspan="' . $action_colspan . '">' . "\n"
|
||||
$html_output .= '<th colspan="' . $action_colspan . '" class="print_ignore">' . "\n"
|
||||
. ' ' . __('Action') . "\n"
|
||||
. '</th>'
|
||||
// larger values are more interesting so default sort order is DESC
|
||||
@ -1339,7 +1335,7 @@ function PMA_getHtmlForTableStructureHeader(
|
||||
) {
|
||||
$html_output = '<thead>';
|
||||
$html_output .= '<tr>';
|
||||
$html_output .= '<th></th>'
|
||||
$html_output .= '<th class="print_ignore"></th>'
|
||||
. '<th>#</th>'
|
||||
. '<th>' . __('Name') . '</th>'
|
||||
. '<th>' . __('Type') . '</th>'
|
||||
@ -1359,7 +1355,7 @@ function PMA_getHtmlForTableStructureHeader(
|
||||
$colspan--;
|
||||
}
|
||||
$html_output .= '<th colspan="' . $colspan . '" '
|
||||
. 'class="action">' . __('Action') . '</th>';
|
||||
. 'class="action print_ignore">' . __('Action') . '</th>';
|
||||
}
|
||||
$html_output .= '</tr>'
|
||||
. '</thead>';
|
||||
@ -1398,7 +1394,7 @@ function PMA_getHtmlTableStructureRow($row, $rownum,
|
||||
$field_charset, $attribute, $tbl_is_view, $db_is_system_schema,
|
||||
$url_query, $field_encoded, $titles, $table
|
||||
) {
|
||||
$html_output = '<td class="center">'
|
||||
$html_output = '<td class="center print_ignore">'
|
||||
. '<input type="checkbox" class="checkall" name="selected_fld[]" '
|
||||
. 'value="' . htmlspecialchars($row['Field']) . '" '
|
||||
. 'id="checkbox_row_' . $rownum . '"/>'
|
||||
@ -1478,13 +1474,13 @@ function PMA_getHtmlForDropColumn($tbl_is_view, $db_is_system_schema,
|
||||
$html_output = '';
|
||||
|
||||
if (! $tbl_is_view && ! $db_is_system_schema) {
|
||||
$html_output .= '<td class="edit center">'
|
||||
$html_output .= '<td class="edit center print_ignore">'
|
||||
. '<a class="change_column_anchor ajax"'
|
||||
. ' href="tbl_structure.php'
|
||||
. $url_query . '&field=' . $field_encoded
|
||||
. '&change_column=1">'
|
||||
. $titles['Change'] . '</a>' . '</td>';
|
||||
$html_output .= '<td class="drop center">'
|
||||
$html_output .= '<td class="drop center print_ignore">'
|
||||
. '<a class="drop_column_anchor ajax"'
|
||||
. ' href="sql.php' . $url_query . '&sql_query='
|
||||
. urlencode(
|
||||
@ -1520,7 +1516,9 @@ function PMA_getHtmlForDropColumn($tbl_is_view, $db_is_system_schema,
|
||||
function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir,
|
||||
$tbl_is_view, $db_is_system_schema, $tbl_storage_engine
|
||||
) {
|
||||
$html_output = PMA_Util::getWithSelected(
|
||||
$html_output = '<div class="print_ignore" >';
|
||||
|
||||
$html_output .= PMA_Util::getWithSelected(
|
||||
$pmaThemeImage, $text_dir, "fieldsForm"
|
||||
);
|
||||
|
||||
@ -1584,6 +1582,8 @@ function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir,
|
||||
);
|
||||
}
|
||||
}
|
||||
$html_output .= '</div>';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
@ -1673,8 +1673,8 @@ function PMA_getHtmlForEditView($url_params)
|
||||
function PMA_getHtmlForOptionalActionLinks($url_query, $tbl_is_view,
|
||||
$db_is_system_schema
|
||||
) {
|
||||
$html_output = '<a href="tbl_printview.php' . $url_query
|
||||
. '" target="print_view">'
|
||||
$html_output = '<a href="#"'
|
||||
. ' id="printView">'
|
||||
. PMA_Util::getIcon('b_print.png', __('Print view'), true)
|
||||
. '</a>';
|
||||
|
||||
@ -2015,7 +2015,7 @@ function PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine,
|
||||
) {
|
||||
$html_output .= $titles['No' . $action];
|
||||
} else {
|
||||
$html_output .= '<a rel="samepage" class="ajax add_key';
|
||||
$html_output .= '<a rel="samepage" class="ajax add_key print_ignore';
|
||||
if ($hasLinkClass) {
|
||||
$html_output .= ' add_primary_key_anchor"';
|
||||
} else if ($action=='Index') {
|
||||
@ -2145,7 +2145,7 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine,
|
||||
$primary, $field_name, $url_query, $titles, $row, $rownum,
|
||||
$columns_with_unique_index, $isInCentralColumns
|
||||
) {
|
||||
$html_output = '<td><ul class="table-structure-actions resizable-menu">';
|
||||
$html_output = '<td class="print_ignore"><ul class="table-structure-actions resizable-menu">';
|
||||
$html_output .= PMA_getHtmlForActionRowInStructureTable(
|
||||
$type, $tbl_storage_engine,
|
||||
'primary nowrap',
|
||||
|
||||
@ -1,328 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Set of functions related to show table print view
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once 'libraries/Template.class.php';
|
||||
|
||||
/**
|
||||
* return html for tables' info
|
||||
*
|
||||
* @param array $the_tables selected tables
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForTablesInfo($the_tables)
|
||||
{
|
||||
return PMA\Template::get('printview/tables_info')
|
||||
->render(array(
|
||||
'tables' => $the_tables
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return html for print view footer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForPrintViewFooter()
|
||||
{
|
||||
return PMA\Template::get('printview/footer')->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* return html for Print View Columns
|
||||
*
|
||||
* @param bool $tbl_is_view whether table is a view
|
||||
* @param array $columns columns list
|
||||
* @param array $analyzed_sql analyzed sql
|
||||
* @param bool $have_rel have relation?
|
||||
* @param array $res_rel relations array
|
||||
* @param string $db database name
|
||||
* @param string $table table name
|
||||
* @param array $cfgRelation config from PMA_getRelationsParam
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForPrintViewColumns(
|
||||
$tbl_is_view, $columns, $analyzed_sql, $have_rel,
|
||||
$res_rel, $db, $table, $cfgRelation
|
||||
) {
|
||||
return PMA\Template::get('printview/columns')->render(array(
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'columns' => $columns,
|
||||
'analyzed_sql' => $analyzed_sql,
|
||||
'have_rel' => $have_rel,
|
||||
'res_rel' => $res_rel,
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'cfgRelation' => $cfgRelation
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* return html for Row Statistic
|
||||
*
|
||||
* @param array $showtable showing table information
|
||||
* @param int $cell_align_left cell align left
|
||||
* @param int $avg_size avg size
|
||||
* @param int $avg_unit avg unit
|
||||
* @param bool $mergetable is merge table?
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForRowStatistics(
|
||||
$showtable, $cell_align_left, $avg_size, $avg_unit, $mergetable
|
||||
) {
|
||||
return PMA\Template::get('printview/row_statistics')
|
||||
->render(array(
|
||||
'showtable' => $showtable,
|
||||
'cell_align_left' => $cell_align_left,
|
||||
'avg_size' => $avg_size,
|
||||
'avg_unit' => $avg_unit,
|
||||
'mergetable' => $mergetable
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* return html for Space Usage
|
||||
*
|
||||
* @param int $data_size data size
|
||||
* @param int $data_unit data unit
|
||||
* @param int $index_size index size
|
||||
* @param int $index_unit index unit
|
||||
* @param int $free_size free size
|
||||
* @param int $free_unit free unit
|
||||
* @param int $effect_size effect size
|
||||
* @param int $effect_unit effect unit
|
||||
* @param int $tot_size total size
|
||||
* @param int $tot_unit total unit
|
||||
* @param bool $mergetable is merge table?
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForSpaceUsage(
|
||||
$data_size, $data_unit, $index_size, $index_unit,
|
||||
$free_size, $free_unit, $effect_size, $effect_unit,
|
||||
$tot_size, $tot_unit, $mergetable
|
||||
) {
|
||||
return PMA\Template::get('printview/space_usage')
|
||||
->render(array(
|
||||
'data_size' => $data_size,
|
||||
'data_unit' => $data_unit,
|
||||
'index_size' => $index_size,
|
||||
'index_unit' => $index_unit,
|
||||
'free_size' => $free_size,
|
||||
'free_unit' => $free_unit,
|
||||
'effect_size' => $effect_size,
|
||||
'effect_unit' => $effect_unit,
|
||||
'tot_size' => $tot_size,
|
||||
'tot_unit' => $tot_unit,
|
||||
'mergetable' => $mergetable
|
||||
));
|
||||
}
|
||||
/**
|
||||
* return html for Space Usage And Row Statistic
|
||||
*
|
||||
* @param array $showtable showing table information
|
||||
* @param string $db database
|
||||
* @param string $table table
|
||||
* @param int $cell_align_left cell align left
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForSpaceUsageAndRowStatistics(
|
||||
$showtable, $db, $table, $cell_align_left
|
||||
) {
|
||||
$nonisam = false;
|
||||
if (isset($showtable['Type'])
|
||||
&& ! preg_match('@ISAM|HEAP@i', $showtable['Type'])
|
||||
) {
|
||||
$nonisam = true;
|
||||
}
|
||||
if ($nonisam == false) {
|
||||
// Gets some sizes
|
||||
|
||||
$mergetable = PMA_Table::isMerge($db, $table);
|
||||
|
||||
list($data_size, $data_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_length']
|
||||
);
|
||||
if ($mergetable == false) {
|
||||
list($index_size, $index_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Index_length']
|
||||
);
|
||||
}
|
||||
if (isset($showtable['Data_free']) && $showtable['Data_free'] > 0) {
|
||||
list($free_size, $free_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_free']
|
||||
);
|
||||
list($effect_size, $effect_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_length'] + $showtable['Index_length']
|
||||
- $showtable['Data_free']
|
||||
);
|
||||
} else {
|
||||
unset($free_size);
|
||||
unset($free_unit);
|
||||
list($effect_size, $effect_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_length'] + $showtable['Index_length']
|
||||
);
|
||||
}
|
||||
list($tot_size, $tot_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_length'] + $showtable['Index_length']
|
||||
);
|
||||
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
||||
if ($num_rows > 0) {
|
||||
list($avg_size, $avg_unit) = PMA_Util::formatByteDown(
|
||||
($showtable['Data_length'] + $showtable['Index_length'])
|
||||
/ $showtable['Rows'],
|
||||
6, 1
|
||||
);
|
||||
}
|
||||
|
||||
return PMA\Template::get(
|
||||
'printview/space_usage_and_row_statistics'
|
||||
)->render(array(
|
||||
'data_size' => $data_size,
|
||||
'data_unit' => $data_unit,
|
||||
'index_size' => $index_size,
|
||||
'index_unit' => $index_unit,
|
||||
'free_size' => $free_size,
|
||||
'free_unit' => $free_unit,
|
||||
'effect_size' => $effect_size,
|
||||
'effect_unit' => $effect_unit,
|
||||
'tot_size' => $tot_size,
|
||||
'tot_unit' => $tot_unit,
|
||||
'mergetable' => $mergetable,
|
||||
'showtable' => $showtable,
|
||||
'cell_align_left' => $cell_align_left,
|
||||
'avg_size' => $avg_size,
|
||||
'avg_unit' => $avg_unit
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return html for Table Structure
|
||||
*
|
||||
* @param bool $have_rel whether have relation
|
||||
* @param bool $tbl_is_view Is a table view?
|
||||
* @param array $columns columns list
|
||||
* @param array $analyzed_sql analyzed sql
|
||||
* @param array $res_rel relations array
|
||||
* @param string $db database
|
||||
* @param string $table table
|
||||
* @param array $cfgRelation config from PMA_getRelationsParam
|
||||
* @param array $cfg global config
|
||||
* @param array $showtable showing table information
|
||||
* @param int $cell_align_left cell align left
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForTableStructure(
|
||||
$have_rel, $tbl_is_view, $columns, $analyzed_sql,
|
||||
$res_rel, $db, $table, $cfgRelation,
|
||||
$cfg, $showtable, $cell_align_left
|
||||
) {
|
||||
return PMA\Template::get('printview/tables_structure')
|
||||
->render(array(
|
||||
'have_rel' => $have_rel,
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'columns' => $columns,
|
||||
'analyzed_sql' => $analyzed_sql,
|
||||
'res_rel' => $res_rel,
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'cfgRelation' => $cfgRelation,
|
||||
'cfg' => $cfg,
|
||||
'showtable' => $showtable,
|
||||
'cell_align_left' => $cell_align_left
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* return html for tables' detail
|
||||
*
|
||||
* @param array $the_tables tables list
|
||||
* @param string $db database name
|
||||
* @param array $cfg global config
|
||||
* @param array $cfgRelation config from PMA_getRelationsParam
|
||||
* @param int $cell_align_left cell align left
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function PMA_getHtmlForTablesDetail(
|
||||
$the_tables, $db, $cfg, $cfgRelation, $cell_align_left
|
||||
) {
|
||||
$tables_cnt = count($the_tables);
|
||||
$multi_tables = (count($the_tables) > 1);
|
||||
$counter = 0;
|
||||
$html = '';
|
||||
$template = PMA\Template::get('printview/tables_detail');
|
||||
|
||||
foreach ($the_tables as $table) {
|
||||
|
||||
/**
|
||||
* Gets table informations
|
||||
*/
|
||||
$showtable = PMA_Table::sGetStatusInfo($db, $table);
|
||||
$num_rows = (isset($showtable['Rows']) ? $showtable['Rows'] : 0);
|
||||
$show_comment = (isset($showtable['Comment']) ? $showtable['Comment'] : '');
|
||||
|
||||
$tbl_is_view = PMA_Table::isView($db, $table);
|
||||
|
||||
/**
|
||||
* Gets fields properties
|
||||
*/
|
||||
$columns = $GLOBALS['dbi']->getColumns($db, $table);
|
||||
|
||||
// We need this to correctly learn if a TIMESTAMP is NOT NULL, since
|
||||
// SHOW FULL FIELDS or INFORMATION_SCHEMA incorrectly says NULL
|
||||
// and SHOW CREATE TABLE says NOT NULL (tested
|
||||
// in MySQL 4.0.25 and 5.0.21, http://bugs.mysql.com/20910).
|
||||
|
||||
$show_create_table = $GLOBALS['dbi']->fetchValue(
|
||||
'SHOW CREATE TABLE ' . PMA_Util::backquote($db) . '.'
|
||||
. PMA_Util::backquote($table),
|
||||
0, 1
|
||||
);
|
||||
$analyzed_sql = PMA_SQP_analyze(PMA_SQP_parse($show_create_table));
|
||||
|
||||
// Check if we can use Relations
|
||||
// Find which tables are related with the current one and write it in
|
||||
// an array
|
||||
$res_rel = PMA_getForeigners($db, $table);
|
||||
$have_rel = (bool) count($res_rel);
|
||||
|
||||
$html .= $template->render(array(
|
||||
'counter' => $counter,
|
||||
'tables_cnt' => $tables_cnt,
|
||||
'table' => $table,
|
||||
'show_comment' => $show_comment,
|
||||
'have_rel' => $have_rel,
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'columns' => $columns,
|
||||
'analyzed_sql' => $analyzed_sql,
|
||||
'res_rel' => $res_rel,
|
||||
'db' => $db,
|
||||
'cfgRelation' => $cfgRelation,
|
||||
'cfg' => $cfg,
|
||||
'showtable' => $showtable,
|
||||
'cell_align_left' => $cell_align_left,
|
||||
'multi_tables' => $multi_tables
|
||||
));
|
||||
|
||||
if ($multi_tables) {
|
||||
unset($num_rows, $show_comment);
|
||||
}
|
||||
} // end while
|
||||
return $html;
|
||||
}
|
||||
?>
|
||||
@ -1,73 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Print view for table
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
/**
|
||||
* include the common file
|
||||
*/
|
||||
require_once 'libraries/common.inc.php';
|
||||
|
||||
$response = PMA_Response::getInstance();
|
||||
$response->getHeader()->enablePrintView();
|
||||
|
||||
require 'libraries/tbl_common.inc.php';
|
||||
|
||||
// Check parameters
|
||||
|
||||
if (! isset($the_tables) || ! is_array($the_tables)) {
|
||||
$the_tables = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relations settings
|
||||
*/
|
||||
require_once 'libraries/transformations.lib.php';
|
||||
require_once 'libraries/Index.class.php';
|
||||
require_once 'libraries/tbl_printview.lib.php';
|
||||
|
||||
$cfgRelation = PMA_getRelationsParam();
|
||||
|
||||
/**
|
||||
* Defines the url to return to in case of error in a sql statement
|
||||
*/
|
||||
if (/*overload*/mb_strlen($table)) {
|
||||
$err_url = 'tbl_sql.php?' . PMA_URL_getCommon(
|
||||
array('db' => $db, 'table' => $table)
|
||||
);
|
||||
} else {
|
||||
$err_url = 'db_sql.php' . PMA_URL_getCommon(array('db' => $db));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Selects the database
|
||||
*/
|
||||
$GLOBALS['dbi']->selectDb($db);
|
||||
|
||||
/**
|
||||
* Multi-tables printview
|
||||
*/
|
||||
if (isset($_POST['selected_tbl']) && is_array($_POST['selected_tbl'])) {
|
||||
$the_tables = $_POST['selected_tbl'];
|
||||
} elseif (/*overload*/mb_strlen($table)) {
|
||||
$the_tables[] = $table;
|
||||
}
|
||||
|
||||
$response->addHTML(PMA_getHtmlForTablesInfo($the_tables));
|
||||
$response->addHTML(
|
||||
PMA_getHtmlForTablesDetail(
|
||||
$the_tables, $db, $cfg, $cfgRelation,
|
||||
$cell_align_left
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Displays the footer
|
||||
*/
|
||||
$response->addHTML(PMA_getHtmlForPrintViewFooter());
|
||||
|
||||
exit;
|
||||
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
$primary = PMA_Index::getPrimary($table, $db);
|
||||
foreach ($columns as $row):
|
||||
$extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']);
|
||||
$type = $extracted_columnspec['print_type'];
|
||||
|
||||
if (! isset($row['Default'])) {
|
||||
if ($row['Null'] != '' && $row['Null'] != 'NO') {
|
||||
$row['Default'] = '<i>NULL</i>';
|
||||
}
|
||||
} else {
|
||||
$row['Default'] = htmlspecialchars($row['Default']);
|
||||
}
|
||||
$field_name = htmlspecialchars($row['Field']);
|
||||
|
||||
if (! $tbl_is_view) {
|
||||
// here, we have a TIMESTAMP that SHOW FULL COLUMNS reports as having
|
||||
// the NULL attribute, but SHOW CREATE TABLE says the contrary.
|
||||
// Believe the latter.
|
||||
/**
|
||||
* @todo merge this logic with the one in tbl_structure.php
|
||||
* or move it in a function similar to $GLOBALS['dbi']->getColumnsFull()
|
||||
* but based on SHOW CREATE TABLE because information_schema
|
||||
* cannot be trusted in this case (MySQL bug)
|
||||
*/
|
||||
$analyzed_for_field
|
||||
= $analyzed_sql[0]['create_table_fields'][$field_name];
|
||||
if (! empty($analyzed_for_field['type'])
|
||||
&& $analyzed_for_field['type'] == 'TIMESTAMP'
|
||||
&& $analyzed_for_field['timestamp_not_null']
|
||||
) {
|
||||
$row['Null'] = '';
|
||||
}
|
||||
} ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php
|
||||
echo $field_name;
|
||||
if ($primary && $primary->hasColumn($field_name)): ?>
|
||||
<em>(<?php echo __('Primary'); ?>)</em>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo htmlspecialchars($type); ?>
|
||||
<bdo dir="ltr"></bdo>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo (($row['Null'] == '' || $row['Null'] == 'NO')
|
||||
? __('No')
|
||||
: __('Yes')); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php if (isset($row['Default'])) echo $row['Default']; ?>
|
||||
</td>
|
||||
|
||||
<?php if ($have_rel): ?>
|
||||
<td>
|
||||
<?php
|
||||
$foreigner = PMA_searchColumnInForeigners($res_rel, $field_name);
|
||||
if ($foreigner) {
|
||||
echo htmlspecialchars(
|
||||
$foreigner['foreign_table'] . ' -> ' . $foreigner['foreign_field']
|
||||
);
|
||||
} ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<td>
|
||||
<?php
|
||||
$comments = PMA_getComments($db, $table);
|
||||
if (isset($comments[$field_name])) {
|
||||
echo htmlspecialchars($comments[$field_name]);
|
||||
} ?>
|
||||
</td>
|
||||
|
||||
<?php if ($cfgRelation['mimework']):
|
||||
$mime_map = PMA_getMIME($db, $table, true); ?>
|
||||
|
||||
<td>
|
||||
<?php if (isset($mime_map[$field_name])) {
|
||||
echo htmlspecialchars(
|
||||
str_replace('_', '/', $mime_map[$field_name]['mimetype'])
|
||||
);
|
||||
} ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
@ -1,2 +0,0 @@
|
||||
<?php echo PMA_Util::getButton(); ?>
|
||||
<div id='PMA_disable_floating_menubar'></div>
|
||||
@ -1,92 +0,0 @@
|
||||
<td width="20"> </td>
|
||||
|
||||
<!-- Rows Statistic -->
|
||||
<td class="vtop">
|
||||
<big><?php echo __('Row Statistics:') ?></big>
|
||||
<table width="100%">
|
||||
<?php if (isset($showtable['Row_format'])): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Format') ?></td>
|
||||
<td class="<?php echo $cell_align_left ?>">
|
||||
<?php
|
||||
if ($showtable['Row_format'] == 'Fixed')
|
||||
echo __('static');
|
||||
elseif ($showtable['Row_format'] == 'Dynamic')
|
||||
echo __('dynamic');
|
||||
else
|
||||
echo $showtable['Row_format']; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Rows'])): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Rows') ?></td>
|
||||
<td class="right">
|
||||
<?php
|
||||
echo PMA_Util::formatNumber($showtable['Rows'], 0); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Avg_row_length'])
|
||||
&& $showtable['Avg_row_length'] > 0
|
||||
): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Row length') ?> ø</td>
|
||||
<td>
|
||||
<?php echo PMA_Util::formatNumber(
|
||||
$showtable['Avg_row_length'], 0
|
||||
); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Data_length'])
|
||||
&& $showtable['Rows'] > 0
|
||||
&& $mergetable == false
|
||||
): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Row size') ?> ø</td>
|
||||
<td class="right">
|
||||
<?php echo $avg_size ?> <?php echo $avg_unit; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Auto_increment'])): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Next autoindex') ?> </td>
|
||||
<td class="right">
|
||||
<?php echo PMA_Util::formatNumber(
|
||||
$showtable['Auto_increment'], 0
|
||||
); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Create_time'])): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Creation') ?></td>
|
||||
<td class="right">
|
||||
<?php echo PMA_Util::localisedDate(
|
||||
strtotime($showtable['Create_time'])
|
||||
); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Update_time'])): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Last update') ?></td>
|
||||
<td class="right">
|
||||
<?php echo PMA_Util::localisedDate(
|
||||
strtotime($showtable['Update_time'])
|
||||
); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;
|
||||
if (isset($showtable['Check_time'])): ?>
|
||||
<tr>
|
||||
<td><?php echo __('Last check') ?></td>
|
||||
<td class="right">
|
||||
<?php echo PMA_Util::localisedDate(
|
||||
strtotime($showtable['Check_time'])
|
||||
); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
@ -1,42 +0,0 @@
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<!-- Space usage -->
|
||||
<td class="vtop">
|
||||
<big><?php echo __('Space usage:'); ?></big>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="padding-right: 10px"><?php echo __('Data'); ?></td>
|
||||
<td class="right"><?php echo $data_size; ?></td>
|
||||
<td><?php echo $data_unit; ?></td>
|
||||
</tr>
|
||||
<?php if (isset($index_size)): ?>
|
||||
<tr>
|
||||
<td style="padding-right: 10px"><?php echo __('Index'); ?></td>
|
||||
<td class="right"><?php echo $index_size; ?></td>
|
||||
<td><?php echo $index_unit; ?></td>
|
||||
</tr>
|
||||
<? endif;
|
||||
if (isset($free_size)): ?>
|
||||
<tr style="color: #bb0000">
|
||||
<td style="padding-right: 10px">
|
||||
<?php echo __('Overhead'); ?>
|
||||
</td>
|
||||
<td class="right"><?php echo $free_size; ?></td>
|
||||
<td><?php echo $free_unit; ?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-right: 10px">
|
||||
<?php echo __('Effective'); ?>
|
||||
</td>
|
||||
<td class="right"><?php echo $effect_size; ?></td>
|
||||
<td><?php echo $effect_unit; ?></td>
|
||||
</tr>
|
||||
<? endif;
|
||||
if (isset($tot_size) && $mergetable == false): ?>
|
||||
<tr>
|
||||
<td style="padding-right: 10px"><?php echo __('Total'); ?></td>
|
||||
<td class="right"><?php echo $tot_size; ?></td>
|
||||
<td><?php echo $tot_unit; ?></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
@ -1,26 +0,0 @@
|
||||
<!-- Displays them -->
|
||||
<br /><br />
|
||||
<?php echo PMA_getHtmlForSpaceUsage(
|
||||
$data_size, $data_unit,
|
||||
isset($index_size)? $index_size : null,
|
||||
isset($index_unit)? $index_unit : null,
|
||||
isset($free_size)? $free_size : null,
|
||||
isset($free_unit)? $free_unit : null,
|
||||
isset($effect_size)? $effect_size : null,
|
||||
isset($effect_unit)? $effect_unit : null,
|
||||
isset($tot_size)? $tot_size : null,
|
||||
isset($tot_unit)? $tot_unit : null,
|
||||
$mergetable
|
||||
); ?>
|
||||
|
||||
</td>
|
||||
<?php PMA_getHtmlForRowStatistics(
|
||||
$showtable, $cell_align_left,
|
||||
isset($avg_size)? $avg_size: 0,
|
||||
isset($avg_unit)? $avg_unit: 0,
|
||||
$mergetable
|
||||
); ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -1,20 +0,0 @@
|
||||
<div <?php if ($counter + 1 < $tables_cnt) echo 'style="page-break-after: always;"'; ?>>
|
||||
<h1><?php echo htmlspecialchars($table); ?></h1>
|
||||
|
||||
<!-- Displays the comments of the table if MySQL >= 3.23 -->
|
||||
<?php if (!empty($show_comment)): ?>
|
||||
<?php echo __('Table comments:'); ?>
|
||||
<?php echo htmlspecialchars($show_comment); ?>
|
||||
<br /><br />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php echo PMA_getHtmlForTableStructure(
|
||||
$have_rel, $tbl_is_view, $columns, $analyzed_sql,
|
||||
$res_rel, $db, $table, $cfgRelation,
|
||||
$cfg, $showtable, $cell_align_left
|
||||
); ?>
|
||||
|
||||
<?php if ($multi_tables): ?>
|
||||
<hr />
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
if (count($tables) <= 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
$backquoted_tables = array();
|
||||
foreach ($tables as $table) {
|
||||
array_push($backquoted_tables, PMA_Util::backquote($table));
|
||||
} ?>
|
||||
|
||||
<strong>
|
||||
<?php echo __('Showing tables:'); ?>
|
||||
<?php echo htmlspecialchars(implode(', ', $backquoted_tables)); ?>
|
||||
<hr />
|
||||
</strong>
|
||||
@ -1,33 +0,0 @@
|
||||
<table style="width: 100%;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo __('Column'); ?></th>
|
||||
<th><?php echo __('Type'); ?></th>
|
||||
<th><?php echo __('Null'); ?></th>
|
||||
<th><?php echo __('Default'); ?></th>
|
||||
<?php if ($have_rel): ?>
|
||||
<th><?php echo __('Links to'); ?></th>
|
||||
<?php endif; ?>
|
||||
<th><?php echo __('Comments'); ?></th>
|
||||
<?php if ($cfgRelation['mimework']): ?>
|
||||
<th>MIME</th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php echo PMA_getHtmlForPrintViewColumns(
|
||||
$tbl_is_view, $columns, $analyzed_sql, $have_rel,
|
||||
$res_rel, $db, $table, $cfgRelation
|
||||
); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php if (! $tbl_is_view && !$GLOBALS['dbi']->isSystemSchema($db)): ?>
|
||||
<!-- Display indexes -->
|
||||
<?php echo PMA_Index::getHtmlForIndexes($table, $db, true); ?>
|
||||
<!-- Displays Space usage and row statistics -->
|
||||
<?php if ($cfg['ShowStats']): ?>
|
||||
<?php echo PMA_getHtmlForSpaceUsageAndRowStatistics(
|
||||
$showtable, $db, $table, $cell_align_left
|
||||
); ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
@ -499,7 +499,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
array('`new`.`id`' => '= 1'),
|
||||
'[%_PMA_CHECKBOX_DIR_%]',
|
||||
'odd',
|
||||
'<td class="odd" class="center"><input type'
|
||||
'<td class="odd" class="center print_ignore"><input type'
|
||||
. '="checkbox" id="id_rows_to_delete0[%_PMA_CHECKBOX_DIR_%]" name='
|
||||
. '"rows_to_delete[0]" class="multi_checkbox checkall" value="%60'
|
||||
. 'new%60.%60id%60+%3D+1" /><input type="hidden" class="condition_'
|
||||
@ -560,7 +560,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. '"Edit" class="icon ic_b_edit" /> Edit</span>',
|
||||
'`customer`.`id` = 1',
|
||||
'%60customer%60.%60id%60+%3D+1',
|
||||
'<td class="odd edit_row_anchor center" >'
|
||||
'<td class="odd edit_row_anchor center print_ignore" >'
|
||||
. '<span class="nowrap">' . "\n"
|
||||
. '<a href="tbl_change.php?db=Data&table=customer&where_'
|
||||
. 'clause=%60customer%60.%60id%60+%3D+1&clause_is_unique=1&'
|
||||
@ -623,7 +623,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
'`customer`.`id` = 1',
|
||||
'%60customer%60.%60id%60+%3D+1',
|
||||
'odd',
|
||||
'<td class="odd center" ><span class='
|
||||
'<td class="odd center print_ignore" ><span class='
|
||||
. '"nowrap">' . "\n"
|
||||
. '<a href="tbl_change.php?db=Data&table=customer&where_'
|
||||
. 'clause=%60customer%60.%60id%60+%3D+1&clause_is_unique=1&'
|
||||
@ -688,7 +688,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. 'alt="Delete" class="icon ic_b_drop" /> Delete</span>',
|
||||
'DELETE FROM `Data`.`customer` WHERE `customer`.`id` = 1',
|
||||
'odd',
|
||||
'<td class="odd center" >' . "\n"
|
||||
'<td class="odd center print_ignore" >' . "\n"
|
||||
. '<a href="sql.php?db=Data&table=customer&sql_query=DELETE'
|
||||
. '+FROM+%60Data%60.%60customer%60+WHERE+%60customer%60.%60id%60+%3D'
|
||||
. '+1&message_to_show=The+row+has+been+deleted&goto=sql.php'
|
||||
@ -783,11 +783,11 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
'<span class="nowrap"><img src="themes/dot.gif" title="Delete" '
|
||||
. 'alt="Delete" class="icon ic_b_drop" /> Delete</span>',
|
||||
'DELETE FROM `data`.`new` WHERE `new`.`id` = 1',
|
||||
'<td class="center"><input type="checkbox" id="id_rows_to_delete0_'
|
||||
'<td class="center print_ignore"><input type="checkbox" id="id_rows_to_delete0_'
|
||||
. 'left" name="rows_to_delete[0]" class="multi_checkbox checkall" '
|
||||
. 'value="%60new%60.%60id%60+%3D+1" /><input type="hidden" class='
|
||||
. '"condition_array" value="{"`new`.`id`":"= 1"'
|
||||
. '}" /> </td><td class="edit_row_anchor center" ><span class='
|
||||
. '}" /> </td><td class="edit_row_anchor center print_ignore" ><span class='
|
||||
. '"nowrap">' . "\n"
|
||||
. '<a href="tbl_change.php?db=data&table=new&where_'
|
||||
. 'clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&'
|
||||
@ -796,7 +796,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. '<span class="nowrap"><img src="themes/dot.gif" title="Edit" '
|
||||
. 'alt="Edit" class="icon ic_b_edit" /> Edit</span></a>' . "\n"
|
||||
. '<input type="hidden" class="where_clause" value ="%60new%60.%60'
|
||||
. 'id%60+%3D+1" /></span></td><td class="center" ><span class'
|
||||
. 'id%60+%3D+1" /></span></td><td class="center print_ignore" ><span class'
|
||||
. '="nowrap">' . "\n"
|
||||
. '<a href="tbl_change.php?db=data&table=new&where_clause'
|
||||
. '=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query='
|
||||
@ -805,7 +805,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. '="nowrap"><img src="themes/dot.gif" title="Copy" alt="Copy" '
|
||||
. 'class="icon ic_b_insrow" /> Copy</span></a>' . "\n"
|
||||
. '<input type="hidden" class="where_clause" value="%60new%60.%60id'
|
||||
. '%60+%3D+1" /></span></td><td class="center" >' . "\n"
|
||||
. '%60+%3D+1" /></span></td><td class="center print_ignore" >' . "\n"
|
||||
. '<a href="sql.php?db=data&table=new&sql_query=DELETE+'
|
||||
. 'FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&'
|
||||
. 'message_to_show=The+row+has+been+deleted&goto=sql.php%3F'
|
||||
@ -859,7 +859,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
'<span class="nowrap"><img src="themes/dot.gif" title="Delete" '
|
||||
. 'alt="Delete" class="icon ic_b_drop" /> Delete</span>',
|
||||
'DELETE FROM `data`.`new` WHERE `new`.`id` = 1',
|
||||
'<td class="center" >' . "\n"
|
||||
'<td class="center print_ignore" >' . "\n"
|
||||
. '<a href="sql.php?db=data&table=new&sql_query=DELETE+'
|
||||
. 'FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&'
|
||||
. 'message_to_show=The+row+has+been+deleted&goto=sql.php%3Fdb'
|
||||
@ -870,7 +870,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. '_row requireConfirm"><span class="nowrap"><img src="themes/dot.gif" title='
|
||||
. '"Delete" alt="Delete" class="icon ic_b_drop" /> Delete</span></a>'
|
||||
. "\n" . '<div class="hide">DELETE FROM `data`.`new` WHERE `new`.'
|
||||
. '`id` = 1</div></td><td class="center" ><span class="nowrap">'
|
||||
. '`id` = 1</div></td><td class="center print_ignore" ><span class="nowrap">'
|
||||
. "\n" . '<a href="tbl_change.php?db=data&table=new&where_'
|
||||
. 'clause=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_'
|
||||
. 'query=SELECT+%2A+FROM+%60new%60&goto=sql.php&default_'
|
||||
@ -878,7 +878,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. 'class="nowrap"><img src="themes/dot.gif" title="Copy" alt="Copy" '
|
||||
. 'class="icon ic_b_insrow" /> Copy</span></a>' . "\n"
|
||||
. '<input type="hidden" class="where_clause" value="%60new%60.%60id'
|
||||
. '%60+%3D+1" /></span></td><td class="edit_row_anchor center" >'
|
||||
. '%60+%3D+1" /></span></td><td class="edit_row_anchor center print_ignore" >'
|
||||
. '<span class="nowrap">' . "\n"
|
||||
. '<a href="tbl_change.php?db=data&table=new&where_clause'
|
||||
. '=%60new%60.%60id%60+%3D+1&clause_is_unique=1&sql_query='
|
||||
@ -887,7 +887,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
. '"nowrap"><img src="themes/dot.gif" title="Edit" alt="Edit" class'
|
||||
. '="icon ic_b_edit" /> Edit</span></a>' . "\n"
|
||||
. '<input type="hidden" class="where_clause" value ="%60new%60.%60'
|
||||
. 'id%60+%3D+1" /></span></td><td class="center"><input type='
|
||||
. 'id%60+%3D+1" /></span></td><td class="center print_ignore"><input type='
|
||||
. '"checkbox" id="id_rows_to_delete0_right" name="rows_to_delete'
|
||||
. '[0]" class="multi_checkbox checkall" value="%60new%60.%60id%60'
|
||||
. '+%3D+1" /><input type="hidden" class="condition_array" value="'
|
||||
@ -933,7 +933,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
'<span class="nowrap"><img src="themes/dot.gif" title="Delete" '
|
||||
. 'alt="Delete" class="icon ic_b_drop" /> Delete</span>',
|
||||
'DELETE FROM `data`.`new` WHERE `new`.`id` = 1',
|
||||
'<td class="center"><input type="checkbox" id="id_rows_to_'
|
||||
'<td class="center print_ignore"><input type="checkbox" id="id_rows_to_'
|
||||
. 'delete0_left" name="rows_to_delete[0]" class="multi_checkbox '
|
||||
. 'checkall" value="%60new%60.%60id%60+%3D+1" /><input type='
|
||||
. '"hidden" class="condition_array" value="{"`new`.`id`":'
|
||||
@ -1033,7 +1033,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase
|
||||
'<span class="nowrap"><img src="themes/dot.gif" title="Delete" '
|
||||
. 'alt="Delete" class="icon ic_b_drop" /> Delete</span>',
|
||||
null,
|
||||
'<td class="center"><input type="checkbox" id="id_rows_to_'
|
||||
'<td class="center print_ignore"><input type="checkbox" id="id_rows_to_'
|
||||
. 'delete0_left" name="rows_to_delete[0]" class="multi_checkbox '
|
||||
. 'checkall" value="%60new%60.%60id%60+%3D+1" /><input type='
|
||||
. '"hidden" class="condition_array" value="{"`new`.`id`":'
|
||||
|
||||
@ -1,497 +0,0 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Tests for libraries/tbl_printview.lib.php
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include to test.
|
||||
*/
|
||||
require_once 'libraries/tbl_printview.lib.php';
|
||||
require_once 'libraries/Util.class.php';
|
||||
require_once 'libraries/database_interface.inc.php';
|
||||
require_once 'libraries/php-gettext/gettext.inc';
|
||||
require_once 'libraries/relation.lib.php';
|
||||
require_once 'libraries/url_generating.lib.php';
|
||||
require_once 'libraries/Tracker.class.php';
|
||||
require_once 'libraries/transformations.lib.php';
|
||||
require_once 'libraries/Message.class.php';
|
||||
require_once 'libraries/Table.class.php';
|
||||
require_once 'libraries/js_escape.lib.php';
|
||||
require_once 'libraries/sqlparser.lib.php';
|
||||
require_once 'libraries/Index.class.php';
|
||||
|
||||
/**
|
||||
* Tests for libraries/tbl_printview.lib.php
|
||||
*
|
||||
* @package PhpMyAdmin-test
|
||||
*/
|
||||
class PMA_TblPrintViewTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* Setup function for test cases
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
/**
|
||||
* SET these to avoid undefined index error
|
||||
*/
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['cfg']['TableNavigationLinksMode'] = 'icons';
|
||||
$GLOBALS['cfg']['LimitChars'] = 100;
|
||||
$_SESSION['relation'][$GLOBALS['server']] = array(
|
||||
'table_coords' => "table_name",
|
||||
'displaywork' => 'displaywork',
|
||||
'db' => "information_schema",
|
||||
'table_info' => 'table_info',
|
||||
'column_info' => 'column_info',
|
||||
'relwork' => 'relwork',
|
||||
'relation' => 'relation',
|
||||
'commwork' => 'commwork',
|
||||
'bookmarkwork' => 'bookmarkwork',
|
||||
);
|
||||
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$fetchResult = array(
|
||||
'column1' => array('mimetype' => 'value1', 'transformation'=> 'pdf'),
|
||||
'column2' => array('mimetype' => 'value2', 'transformation'=> 'xml'),
|
||||
);
|
||||
|
||||
$dbi->expects($this->any())->method('fetchResult')
|
||||
->will($this->returnValue($fetchResult));
|
||||
|
||||
$dbi->expects($this->any())->method('getTableIndexes')
|
||||
->will($this->returnValue(array()));
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for PMA_getHtmlForTablesInfo() method.
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
*/
|
||||
public function testPMAGetHtmlForTablesInfo()
|
||||
{
|
||||
$the_tables = array("PMA_table1", "PMA_table2");
|
||||
|
||||
$html = PMA_getHtmlForTablesInfo($the_tables);
|
||||
|
||||
$this->assertContains(
|
||||
__('Showing tables:'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
"`PMA_table1`, `PMA_table2`",
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for PMA_getHtmlForPrintViewFooter() method.
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
*/
|
||||
public function testPMAGetHtmlForPrintViewFooter()
|
||||
{
|
||||
$html = PMA_getHtmlForPrintViewFooter();
|
||||
|
||||
$this->assertContains(
|
||||
'<input type="button" class="button" id="print" value="Print" />',
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
"PMA_disable_floating_menubar",
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for PMA_getHtmlForRowStatistics() method.
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
*/
|
||||
public function testPMAGetHtmlForRowStatistics()
|
||||
{
|
||||
$showtable = array(
|
||||
'Row_format' => "Fixed",
|
||||
'Rows' => 10,
|
||||
'Avg_row_length' => 123,
|
||||
'Data_length' => 345,
|
||||
'Auto_increment' => 1234,
|
||||
'Create_time' => "today",
|
||||
'Update_time' => "time2",
|
||||
'Check_time' => "yesterday",
|
||||
);
|
||||
$cell_align_left = "cell_align_left";
|
||||
$avg_size = 12;
|
||||
$avg_unit = 45;
|
||||
$mergetable = false;
|
||||
|
||||
$html = PMA_getHtmlForRowStatistics(
|
||||
$showtable, $cell_align_left, $avg_size, $avg_unit, $mergetable
|
||||
);
|
||||
|
||||
$this->assertContains(
|
||||
__('Row Statistics:'),
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 1 : Row_format
|
||||
$this->assertContains(
|
||||
__('Format'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$cell_align_left,
|
||||
$html
|
||||
);
|
||||
//$showtable['Row_format'] == 'Fixed'
|
||||
$this->assertContains(
|
||||
__('static'),
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 2 : Avg_row_length
|
||||
$length = PMA_Util::formatNumber(
|
||||
$showtable['Avg_row_length'], 0
|
||||
);
|
||||
$this->assertContains(
|
||||
$length,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Row size'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$avg_size . ' ' . $avg_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 3 : Auto_increment
|
||||
$average = PMA_Util::formatNumber(
|
||||
$showtable['Auto_increment'], 0
|
||||
);
|
||||
$this->assertContains(
|
||||
$average,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Next autoindex'),
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 4 : Create_time
|
||||
$time = PMA_Util::localisedDate(
|
||||
strtotime($showtable['Create_time'])
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Creation'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$time,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 5 : Update_time
|
||||
$time = PMA_Util::localisedDate(
|
||||
strtotime($showtable['Update_time'])
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Last update'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$time,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 6 : Check_time
|
||||
$time = PMA_Util::localisedDate(
|
||||
strtotime($showtable['Check_time'])
|
||||
);
|
||||
$this->assertContains(
|
||||
__('Last check'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$time,
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for PMA_getHtmlForSpaceUsage() method.
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
*/
|
||||
public function testPMAGetHtmlForSpaceUsage()
|
||||
{
|
||||
$data_size = '10';
|
||||
$data_unit = '11';
|
||||
$index_size = '12';
|
||||
$index_unit = '13';
|
||||
$free_size = '14';
|
||||
$free_unit = '15';
|
||||
$effect_size = '16';
|
||||
$effect_unit = '17';
|
||||
$tot_size = '18';
|
||||
$tot_unit = '19';
|
||||
$mergetable = false;
|
||||
|
||||
$html = PMA_getHtmlForSpaceUsage(
|
||||
$data_size, $data_unit, $index_size, $index_unit,
|
||||
$free_size, $free_unit, $effect_size, $effect_unit,
|
||||
$tot_size, $tot_unit, $mergetable
|
||||
);
|
||||
|
||||
//validation 1 : title
|
||||
$this->assertContains(
|
||||
__('Space usage:'),
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 2 : $data_size & $data_unit
|
||||
$this->assertContains(
|
||||
$data_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$data_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 3 : $index_size & $index_unit
|
||||
$this->assertContains(
|
||||
$index_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$index_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 4 : Overhead
|
||||
$this->assertContains(
|
||||
__('Overhead'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$free_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$free_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 5 : Effective
|
||||
$this->assertContains(
|
||||
__('Effective'),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$effect_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$effect_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 6 : $tot_size & $tot_unit
|
||||
$this->assertContains(
|
||||
$tot_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$tot_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for PMA_getHtmlForSpaceUsageAndRowStatistics() method.
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
*/
|
||||
public function testPMAGetHtmlForSpaceUsageAndRowStatistics()
|
||||
{
|
||||
$showtable = array(
|
||||
'Row_format' => "Fixed",
|
||||
'Rows' => 10,
|
||||
'Avg_row_length' => 123,
|
||||
'Data_length' => 345,
|
||||
'Auto_increment' => 1234,
|
||||
'Create_time' => "today",
|
||||
'Update_time' => "time2",
|
||||
'Check_time' => "yesterday",
|
||||
'Data_length' => 10,
|
||||
'Index_length' => 12334,
|
||||
'Data_length' => 4567,
|
||||
'Data_free' => 3456,
|
||||
'Check_time' => 1234,
|
||||
);
|
||||
$db = "pma_db";
|
||||
$table = "pma_table";
|
||||
$cell_align_left = "cell_align_left";
|
||||
|
||||
$html = PMA_getHtmlForSpaceUsageAndRowStatistics(
|
||||
$showtable, $db, $table, $cell_align_left
|
||||
);
|
||||
|
||||
//validation 1 : $data_size, $data_unit
|
||||
list($data_size, $data_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_length']
|
||||
);
|
||||
$this->assertContains(
|
||||
$data_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$data_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 2 : $data_size, $data_unit
|
||||
list($index_size, $index_unit)
|
||||
= PMA_Util::formatByteDown(
|
||||
$showtable['Index_length']
|
||||
);
|
||||
$this->assertContains(
|
||||
$index_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$index_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 3 : $free_size, $free_unit
|
||||
list($free_size, $free_unit)
|
||||
= PMA_Util::formatByteDown(
|
||||
$showtable['Data_free']
|
||||
);
|
||||
$this->assertContains(
|
||||
$free_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$free_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 4 : $effect_size, $effect_unit
|
||||
list($effect_size, $effect_unit)
|
||||
= PMA_Util::formatByteDown(
|
||||
$showtable['Data_length'] + $showtable['Index_length']
|
||||
- $showtable['Data_free']
|
||||
);
|
||||
$this->assertContains(
|
||||
$effect_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$effect_unit,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 5 : $effect_size, $effect_unit
|
||||
list($tot_size, $tot_unit) = PMA_Util::formatByteDown(
|
||||
$showtable['Data_length'] + $showtable['Index_length']
|
||||
);
|
||||
$this->assertContains(
|
||||
$tot_size,
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
$tot_unit,
|
||||
$html
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests for PMA_getHtmlForPrintViewColumns() method.
|
||||
*
|
||||
* @return void
|
||||
* @test
|
||||
*/
|
||||
public function testPMAGetHtmlForPrintViewColumns()
|
||||
{
|
||||
$columns = array(
|
||||
array(
|
||||
"Type" => "Type1",
|
||||
"Default" => "Default1",
|
||||
"Null" => "Null1",
|
||||
"Field" => "Field1",
|
||||
)
|
||||
);
|
||||
$analyzed_sql = array(
|
||||
array(
|
||||
'create_table_fields' => array(
|
||||
"Field1" => array(
|
||||
"type" => "TIMESTAMP",
|
||||
"timestamp_not_null" => true
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$have_rel = false;
|
||||
$res_rel = array();
|
||||
$db = "pma_db";
|
||||
$table = "pma_table";
|
||||
$cfgRelation = array('mimework' => true);
|
||||
|
||||
$html = PMA_getHtmlForPrintViewColumns(
|
||||
false, $columns, $analyzed_sql, $have_rel,
|
||||
$res_rel, $db, $table, $cfgRelation
|
||||
);
|
||||
|
||||
//validation 1 : $row
|
||||
$row = $columns[0];
|
||||
$this->assertContains(
|
||||
htmlspecialchars($row['Default']),
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
htmlspecialchars($row['Field']),
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 2 : $field_name
|
||||
$field_name = htmlspecialchars($row['Field']);
|
||||
$comments = PMA_getComments($db, $table);
|
||||
$this->assertContains(
|
||||
$field_name,
|
||||
$html
|
||||
);
|
||||
|
||||
//validation 3 : $extracted_columnspec
|
||||
$extracted_columnspec = PMA_Util::extractColumnSpec($row['Type']);
|
||||
$type = $extracted_columnspec['print_type'];
|
||||
$attribute = $extracted_columnspec['attribute'];
|
||||
$this->assertContains(
|
||||
$type,
|
||||
$html
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
140
themes/original/css/printview.css
Normal file
140
themes/original/css/printview.css
Normal file
@ -0,0 +1,140 @@
|
||||
@media print {
|
||||
|
||||
.print_ignore {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body, table, th, td {
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color:#000;
|
||||
text-decoration:none
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: .1em solid #000;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0.2em;
|
||||
}
|
||||
|
||||
thead {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0.2em;
|
||||
border: .1em solid #000;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
thead th {
|
||||
font-weight: bold;
|
||||
background-color: #e5e5e5;
|
||||
border: .1em solid #000;
|
||||
border-right: .1em solid #000;
|
||||
}
|
||||
|
||||
th.vtop, td.vtop {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
th.vbottom, td.vbottom {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#pma_navigation, #floating_menubar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#pma_console_container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#page_nav_icons {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#page_content {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 95%;
|
||||
float: none;
|
||||
}
|
||||
|
||||
#create_table_form_minimal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#page_settings_modal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.print {
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
div.success {
|
||||
width: 80%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.sqlOuter {
|
||||
color: black;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.ic_window-new, .ic_s_cog {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sticky_columns {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#structure-action-links, #addColumns {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#topmenu2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cDrop, .cEdit, .cList, .cCpy, .cPointer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
table tr.odd th,
|
||||
table tr.odd td,
|
||||
.odd {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
table tr.even th,
|
||||
table tr.even td,
|
||||
.even {
|
||||
background: #dfdfdf;
|
||||
}
|
||||
|
||||
}
|
||||
140
themes/pmahomme/css/printview.css
Normal file
140
themes/pmahomme/css/printview.css
Normal file
@ -0,0 +1,140 @@
|
||||
@media print {
|
||||
|
||||
.print_ignore {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body, table, th, td {
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color:#000;
|
||||
text-decoration:none
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: .1em solid #000;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0.2em;
|
||||
}
|
||||
|
||||
thead {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0.2em;
|
||||
border: .1em solid #000;
|
||||
font-weight: 900;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
thead th {
|
||||
font-weight: bold;
|
||||
background-color: #e5e5e5;
|
||||
border: .1em solid #000;
|
||||
border-right: .1em solid #000;
|
||||
}
|
||||
|
||||
th.vtop, td.vtop {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
th.vbottom, td.vbottom {
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
#pma_navigation, #floating_menubar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#pma_console_container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#page_nav_icons {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#page_content {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 95%;
|
||||
float: none;
|
||||
}
|
||||
|
||||
#create_table_form_minimal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#page_settings_modal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.print {
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
div.success {
|
||||
width: 80%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.sqlOuter {
|
||||
color: black;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
.ic_window-new, .ic_s_cog {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sticky_columns {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#structure-action-links, #addColumns {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#topmenu2 {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.cDrop, .cEdit, .cList, .cCpy, .cPointer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
table tr.odd th,
|
||||
table tr.odd td,
|
||||
.odd {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
table tr.even th,
|
||||
table tr.even td,
|
||||
.even {
|
||||
background: #dfdfdf;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user