diff --git a/db_printview.php b/db_printview.php deleted file mode 100644 index 652cf3ffee..0000000000 --- a/db_printview.php +++ /dev/null @@ -1,174 +0,0 @@ -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 '
'; - -// 1. No table -if ($num_tables == 0) { - echo __('No tables found in database.'); -} else { - // 2. Shows table information - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - if ($cfg['ShowStats']) { - echo ''; - } - echo ''; - echo ''; - echo ''; - echo ''; - $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 ''; - echo ''; - - if (isset($sts_data['TABLE_ROWS'])) { - echo ''; - echo ''; - 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 ''; - } // end if - } else { - echo ''; - } - echo ''; - echo ''; - } - echo ''; - echo ''; - echo ''; - echo ''; - if ($cfg['ShowStats']) { - list($sum_formated, $unit) - = PMA_Util::formatByteDown($sum_size, 3, 1); - echo ''; - } - echo ''; - echo ''; - echo ''; - echo '
' . __('Table') . '' . __('Rows') . '' . __('Type') . '' . __('Size') . '' . __('Comments') . '
'; - echo htmlspecialchars($sts_data['TABLE_NAME']); - echo ''; - if ($merged_size) { - echo ''; - echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0); - echo ''; - } else { - echo PMA_Util::formatNumber($sts_data['TABLE_ROWS'], 0); - } - echo ''; - echo $sts_data['ENGINE']; - echo ''; - echo $formated_size . ' ' . $unit; - echo ''; - if (! PMA_Table::isView($db, $sts_data['TABLE_NAME'])) { - echo __('in use'); - } - echo ''; - if (! empty($sts_data['Comment'])) { - echo htmlspecialchars($sts_data['Comment']); - $needs_break = '
'; - } else { - $needs_break = ''; - } - - if (! empty($sts_data['Create_time']) - || ! empty($sts_data['Update_time']) - || ! empty($sts_data['Check_time']) - ) { - echo $needs_break; - echo ''; - - 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 '
'; - } - echo '
'; - printf( - _ngettext('%s table', '%s tables', $num_tables), - PMA_Util::formatNumber($num_tables, 0) - ); - echo ''; - echo PMA_Util::formatNumber($sum_entries, 0); - echo ''; - echo '--'; - echo ''; - echo $sum_formated . ' ' . $unit; - echo '
'; -} - -/** - * Displays the footer - */ -echo PMA_Util::getButton(); - -echo "
\n"; diff --git a/db_structure.php b/db_structure.php index 4c2a9ee2aa..41ec4140ef 100644 --- a/db_structure.php +++ b/db_structure.php @@ -343,7 +343,7 @@ $response->addHTML('
'); /* DATABASE WORK */ /* Printable view of a table */ $response->addHTML( - PMA_getHtmlForTablePrintViewLink($url_query) + PMA_getHtmlForTablePrintViewLink() . PMA_getHtmlForDataDictionaryLink($url_query) ); diff --git a/js/db_structure.js b/js/db_structure.js index e80d9e1df6..ab611bece4 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -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 diff --git a/js/sql.js b/js/sql.js index d2258eaa83..a9f5412d24 100644 --- a/js/sql.js +++ b/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 diff --git a/js/tbl_structure.js b/js/tbl_structure.js index f110c59587..0cfe005635 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -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 */ diff --git a/libraries/DisplayResults.class.php b/libraries/DisplayResults.class.php index 780bb0d27c..a3c9477c5a 100644 --- a/libraries/DisplayResults.class.php +++ b/libraries/DisplayResults.class.php @@ -807,7 +807,7 @@ class PMA_DisplayResults $html_sql_query = htmlspecialchars($this->__get('sql_query')); // Navigation bar - $table_navigation_html .= '' + $table_navigation_html .= '' . '' . ''; @@ -1427,7 +1427,7 @@ class PMA_DisplayResults $drop_down_html = ''; - $drop_down_html .= '' . "\n" + $drop_down_html .= '' . "\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 .= '' . '' . ''; @@ -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 .= ''; } elseif ((($GLOBALS['cfg']['RowActionLinks'] == self::POSITION_LEFT) @@ -1706,7 +1706,7 @@ class PMA_DisplayResults $options_html .= '__get('url_query'); $delete_text = ($del_link == self::DELETE_ROW) ? __('Delete') : __('Kill'); @@ -4885,7 +4885,7 @@ class PMA_DisplayResults ); } - $links_html .= "\n"; + $links_html .= "\n"; $links_html .= '' @@ -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 = '
' . __('Query results operations') + $header = '
'; $r .= ''; if (! $print_mode) { - $r .= ''; + $r .= ''; } $r .= ''; $r .= ''; @@ -714,7 +714,7 @@ class PMA_Index if (! $print_mode) { $this_params = $GLOBALS['url_params']; $this_params['index'] = $index->getName(); - $r .= '' - . '' - . ''; - return $html; -} -?> diff --git a/libraries/display_structure.inc.php b/libraries/display_structure.inc.php index 7b02af0e53..a23f487644 100644 --- a/libraries/display_structure.inc.php +++ b/libraries/display_structure.inc.php @@ -209,7 +209,7 @@ $response->addHTML( ); $response->addHTML( - '
' + '' ); $response->addHTML( PMA_getHtmlDivForMoveColumnsDialog() diff --git a/libraries/index.lib.php b/libraries/index.lib.php index 4fc1b379a8..3be6ac6482 100644 --- a/libraries/index.lib.php +++ b/libraries/index.lib.php @@ -25,7 +25,7 @@ function PMA_getHtmlForDisplayIndexes() 'indexes', __('Indexes') ); $html_output .= PMA_Index::getHtmlForIndexes($GLOBALS['table'], $GLOBALS['db']); - $html_output .= '
' + $html_output .= '
' - . ''; + . ''; $html_output .= ''; @@ -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 = '
'; + $html_output = '
'; @@ -528,16 +524,16 @@ function PMA_getHtmlForStructureTableRow( } //Favorite table anchor. if ($GLOBALS['cfg']['NumFavoriteTables'] > 0) { - $html_output .= ''; } - $html_output .= ''; - $html_output .= ''; + $html_output .= ''; - $html_output .= ''; + $html_output .= ''; 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 = ''; - $html_output .= ''; - $html_output .= ''; + $html_output .= '' . "\n" + . '' . "\n" . '' . "\n"; @@ -869,7 +865,7 @@ function PMA_tableHeader($db_is_system_schema = false, $replication = false) . ' ' . __('Replication') . "\n" . ''; } - $html_output .= '' // larger values are more interesting so default sort order is DESC @@ -1339,7 +1335,7 @@ function PMA_getHtmlForTableStructureHeader( ) { $html_output = ''; $html_output .= ''; - $html_output .= '' + $html_output .= '' . '' . '' . '' @@ -1359,7 +1355,7 @@ function PMA_getHtmlForTableStructureHeader( $colspan--; } $html_output .= ''; + . 'class="action print_ignore">' . __('Action') . ''; } $html_output .= '' . ''; @@ -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 = ''; - $html_output .= ' - - - - - - - - - - - - - - - - - - - - diff --git a/templates/printview/footer.phtml b/templates/printview/footer.phtml deleted file mode 100644 index d70d8e6f3f..0000000000 --- a/templates/printview/footer.phtml +++ /dev/null @@ -1,2 +0,0 @@ - -
diff --git a/templates/printview/row_statistics.phtml b/templates/printview/row_statistics.phtml deleted file mode 100644 index 7eaa706c2e..0000000000 --- a/templates/printview/row_statistics.phtml +++ /dev/null @@ -1,92 +0,0 @@ -
- - - - - diff --git a/templates/printview/tables_detail.phtml b/templates/printview/tables_detail.phtml deleted file mode 100644 index 521126595c..0000000000 --- a/templates/printview/tables_detail.phtml +++ /dev/null @@ -1,20 +0,0 @@ -
> -

- - - - - -

- - - - - -
- -
diff --git a/templates/printview/tables_info.phtml b/templates/printview/tables_info.phtml deleted file mode 100644 index 90f6f04adf..0000000000 --- a/templates/printview/tables_info.phtml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - -
-
diff --git a/templates/printview/tables_structure.phtml b/templates/printview/tables_structure.phtml deleted file mode 100644 index f286190952..0000000000 --- a/templates/printview/tables_structure.phtml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - -
MIME
-isSystemSchema($db)): ?> - - - - - - - \ No newline at end of file diff --git a/test/classes/PMA_DisplayResults_test.php b/test/classes/PMA_DisplayResults_test.php index 78aa366879..d4cde9043a 100644 --- a/test/classes/PMA_DisplayResults_test.php +++ b/test/classes/PMA_DisplayResults_test.php @@ -499,7 +499,7 @@ class PMA_DisplayResults_Test extends PHPUnit_Framework_TestCase array('`new`.`id`' => '= 1'), '[%_PMA_CHECKBOX_DIR_%]', 'odd', - ' Edit', '`customer`.`id` = 1', '%60customer%60.%60id%60+%3D+1', - '' + '' . '' . "\n" . '
' . "\n" . ' Delete', 'DELETE FROM `Data`.`customer` WHERE `customer`.`id` = 1', 'odd', - '' . "\n" + '' . "\n" . ' Delete', 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', - ' ' . "\n" . ' Edit' . "\n" . '' . "\n" . 'Copy Copy' . "\n" . '' . "\n" + . '%60+%3D+1" />' . "\n" . ' Delete', 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', - '' . "\n" + '' . "\n" . 'Delete Delete' . "\n" . '
DELETE FROM `data`.`new` WHERE `new`.' - . '`id` = 1
' + . '`id` = 1' . "\n" . 'Copy Copy' . "\n" . '' + . '%60+%3D+1" />' . '' . "\n" . 'Edit Edit' . "\n" . ' Delete', 'DELETE FROM `data`.`new` WHERE `new`.`id` = 1', - ' Delete', null, - ' '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( - '', - $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 - ); - } -} - -?> diff --git a/themes/original/css/printview.css b/themes/original/css/printview.css new file mode 100644 index 0000000000..4710039e0b --- /dev/null +++ b/themes/original/css/printview.css @@ -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; + } + +} \ No newline at end of file diff --git a/themes/pmahomme/css/printview.css b/themes/pmahomme/css/printview.css new file mode 100644 index 0000000000..4710039e0b --- /dev/null +++ b/themes/pmahomme/css/printview.css @@ -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; + } + +} \ No newline at end of file