Skip to content

Commit

Permalink
Refactor PMA_getHtmlForDisplayTableStats and move template calls into…
Browse files Browse the repository at this point in the history
… db_structure.php and tbl_structure.php

Signed-off-by: Jason <jason.daurus@gmail.com>
  • Loading branch information
gzzhanghao committed Jul 26, 2015
1 parent f90c332 commit 8ac6c15
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 499 deletions.
36 changes: 26 additions & 10 deletions db_structure.php
Expand Up @@ -311,19 +311,34 @@
// Show Summary
$response->addHTML('</tbody>');
$response->addHTML(
PMA_getHtmlBodyForTableSummary(
$num_tables, $GLOBALS['replication_info']['slave']['status'],
$db_is_system_schema, $sum_entries, $db_collation, $is_show_stats, $sum_size,
$overhead_size, $create_time_all, $update_time_all, $check_time_all,
$overall_approx_rows
PMA\Template::get('structure/body_for_table_summary')->render(
array(
'num_tables' => $num_tables,
'server_slave_status' => $GLOBALS['replication_info']['slave']['status'],
'db_is_system_schema' => $db_is_system_schema,
'sum_entries' => $sum_entries,
'db_collation' => $db_collation,
'is_show_stats' => $is_show_stats,
'sum_size' => $sum_size,
'overhead_size' => $overhead_size,
'create_time_all' => $create_time_all,
'update_time_all' => $update_time_all,
'check_time_all' => $check_time_all,
'approx_rows' => $overall_approx_rows
)
)
);
$response->addHTML('</table>');
//check all
$response->addHTML(
PMA_getHtmlForCheckAllTables(
$pmaThemeImage, $text_dir, $overhead_check,
$db_is_system_schema, $hidden_fields
PMA\Template::get('structure/check_all_tables')->render(
array(
'pmaThemeImage' => $pmaThemeImage,
'text_dir' => $text_dir,
'overhead_check' => $overhead_check,
'db_is_system_schema' => $db_is_system_schema,
'hidden_fields' => $hidden_fields
)
)
);
$response->addHTML('</form>'); //end of form
Expand All @@ -344,8 +359,9 @@
/* DATABASE WORK */
/* Printable view of a table */
$response->addHTML(
PMA_getHtmlForTablePrintViewLink()
. PMA_getHtmlForDataDictionaryLink($url_query)
PMA\Template::get('structure/print_view_data_dictionary_link')->render(
array('url_query' => $url_query)
)
);

PMA_possiblyShowCreateTableDialog($db, $db_is_system_schema, $response);
75 changes: 55 additions & 20 deletions libraries/display_structure.inc.php
Expand Up @@ -8,6 +8,7 @@

require_once 'libraries/common.inc.php';
require_once 'libraries/mysql_charsets.inc.php';
require_once 'libraries/Template.class.php';
require_once 'libraries/structure.lib.php';
require_once 'libraries/index.lib.php';
require_once 'libraries/tbl_info.inc.php';
Expand Down Expand Up @@ -44,11 +45,12 @@
$tablestructure = '<table id="tablestructure" class="data topmargin">';
$response->addHTML($tablestructure);


$response->addHTML(
PMA_getHtmlForTableStructureHeader(
$db_is_system_schema,
$tbl_is_view
PMA\Template::get('structure/table_structure_header')->render(
array(
'db_is_system_schema' => $db_is_system_schema,
'tbl_is_view' => $tbl_is_view
)
)
);

Expand Down Expand Up @@ -172,21 +174,41 @@
$odd_row = !$odd_row;
$isInCentralColumns = in_array($row['Field'], $central_list) ? true : false;
$response->addHTML(
PMA_getHtmlTableStructureRow(
$row, $rownum, $displayed_field_name,
$class_for_type, $extracted_columnspec, $type_mime,
$field_charset, $attribute, $tbl_is_view,
$db_is_system_schema, $url_query, $field_encoded, $titles, $table
PMA\Template::get('structure/table_structure_row')->render(
array(
'row' => $row,
'rownum' => $rownum,
'displayed_field_name' => $displayed_field_name,
'type_nowrap' => $type_nowrap,
'extracted_columnspec' => $extracted_columnspec,
'type_mime' => $type_mime,
'field_charset' => $field_charset,
'attribute' => $attribute,
'tbl_is_view' => $tbl_is_view,
'db_is_system_schema' => $db_is_system_schema,
'url_query' => $url_query,
'field_encoded' => $field_encoded,
'titles' => $titles,
'table' => $table
)
)
);

if (! $tbl_is_view && ! $db_is_system_schema) {
$response->addHTML(
PMA_getHtmlForActionsInTableStructure(
$type, $tbl_storage_engine, $primary,
$field_name, $url_query, $titles, $row, $rownum,
$columns_with_unique_index,
$isInCentralColumns
PMA\Template::get('structure/actions_in_table_structure')->render(
array(
'type' => $type,
'tbl_storage_engine' => $tbl_storage_engine,
'primary' => $primary,
'field_name' => $field_name,
'url_query' => $url_query,
'titles' => $titles,
'row' => $row,
'rownum' => $rownum,
'columns_with_unique_index' => $columns_with_unique_index,
'isInCentralColumns' => $isInCentralColumns
)
)
);
} // end if (! $tbl_is_view && ! $db_is_system_schema)
Expand All @@ -199,9 +221,14 @@
$response->addHTML('</tbody></table>');

$response->addHTML(
PMA_getHtmlForCheckAllTableColumn(
$pmaThemeImage, $text_dir, $tbl_is_view,
$db_is_system_schema, $tbl_storage_engine
PMA\Template::get('structure/check_all_table_column')->render(
array(
'pmaThemeImage' => $pmaThemeImage,
'text_dir' => $text_dir,
'tbl_is_view' => $tbl_is_view,
'db_is_system_schema' => $db_is_system_schema,
'tbl_storage_engine' => $tbl_storage_engine
)
)
);

Expand All @@ -222,16 +249,24 @@
$response->addHTML(PMA_getHtmlForEditView($url_params));
}
$response->addHTML(
PMA_getHtmlForOptionalActionLinks(
$url_query, $tbl_is_view, $db_is_system_schema
PMA\Template::get('structure/optional_action_links')->render(
array(
'url_query' => $url_query,
'tbl_is_view' => $tbl_is_view,
'db_is_system_schema' => $db_is_system_schema
)
)
);

$response->addHTML('</div>');

if (! $tbl_is_view && ! $db_is_system_schema) {
$response->addHTML('<br />');
$response->addHTML(PMA_getHtmlForAddColumn($columns_list));
$response->addHTML(PMA\Template::get('structure/add_column')->render(
array(
'columns_list' => $columns_list
)
));
}

/**
Expand Down

0 comments on commit 8ac6c15

Please sign in to comment.