From 6ec8bb013b8f36b8b8cbcba539616dc6146c2727 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 1 Aug 2011 15:38:10 +0200 Subject: [PATCH 1/5] extend PMA_DBI_get_definition to support views Signed-off-by: Sven Strickroth --- libraries/database_interface.lib.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libraries/database_interface.lib.php b/libraries/database_interface.lib.php index 288743ec5f..d576a36388 100644 --- a/libraries/database_interface.lib.php +++ b/libraries/database_interface.lib.php @@ -1264,11 +1264,11 @@ function PMA_DBI_get_procedures_or_functions($db, $which, $link = null) } /** - * returns the definition of a specific PROCEDURE, FUNCTION or EVENT + * returns the definition of a specific PROCEDURE, FUNCTION, EVENT or VIEW * * @param string $db db name - * @param string $which PROCEDURE | FUNCTION | EVENT - * @param string $name the procedure|function|event name + * @param string $which PROCEDURE | FUNCTION | EVENT | VIEW + * @param string $name the procedure|function|event|view name * @param resource $link mysql link * * @return string the definition @@ -1278,7 +1278,8 @@ function PMA_DBI_get_definition($db, $which, $name, $link = null) $returned_field = array( 'PROCEDURE' => 'Create Procedure', 'FUNCTION' => 'Create Function', - 'EVENT' => 'Create Event' + 'EVENT' => 'Create Event', + 'VIEW' => 'Create View' ); $query = 'SHOW CREATE ' . $which . ' ' . PMA_backquote($db) . '.' . PMA_backquote($name); return(PMA_DBI_fetch_value($query, 0, $returned_field[$which])); From c9434d11c79d3a9047127e6b6e98829d009159e0 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 1 Aug 2011 15:38:41 +0200 Subject: [PATCH 2/5] add "edit view" link to table structure view Signed-off-by: Sven Strickroth --- tbl_structure.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tbl_structure.php b/tbl_structure.php index a4e9692311..751bf1ade6 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -622,7 +622,20 @@ if (! $tbl_is_view && ! $db_is_information_schema) { /** * Work on the table */ + +if ($tbl_is_view) { + $create_view = PMA_DBI_get_definition($db, 'VIEW', $table); ?> + '; + } + echo __('Edit view'); +?> + + '; From f9a713dea195f8b9dc0cac9bedfd5e490fd7a440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 8 Aug 2011 09:56:43 +0200 Subject: [PATCH 3/5] Use PMA_linkOrButton here as the query can be quite long --- tbl_structure.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tbl_structure.php b/tbl_structure.php index 42bd2411fb..cab54846a9 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -592,14 +592,16 @@ if (! $tbl_is_view && ! $db_is_information_schema) { if ($tbl_is_view) { $create_view = PMA_DBI_get_definition($db, 'VIEW', $table); -?> - '; - } - echo __('Edit view'); -?> - $create_view, + 'show_query' => '1', + ) + ), + sprintf('%1$s %1$s', __('Edit view')) + ); } ?> From 51dc70d35a1167431b031e88180a4bf3691af729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 8 Aug 2011 09:57:47 +0200 Subject: [PATCH 4/5] Wrap long line --- tbl_structure.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tbl_structure.php b/tbl_structure.php index cab54846a9..9aaeb129ba 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -600,7 +600,10 @@ if ($tbl_is_view) { 'show_query' => '1', ) ), - sprintf('%1$s %1$s', __('Edit view')) + sprintf( + '%1$s %1$s', + __('Edit view') + ) ); } ?> From 38d99b4e17a5c0cee966ddb4de13a9987c5ae6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 8 Aug 2011 10:00:21 +0200 Subject: [PATCH 5/5] Use PMA_getIcon instead of duplicating logic --- sql.php | 3 +-- tbl_structure.php | 33 +++++++-------------------------- 2 files changed, 8 insertions(+), 28 deletions(-) diff --git a/sql.php b/sql.php index 07d54de880..2ce10ea0db 100644 --- a/sql.php +++ b/sql.php @@ -1013,8 +1013,7 @@ $(document).ready(makeProfilingChart);
' : '') - . __('Bookmark this SQL query'); + echo PMA_getIcon('b_bookmark.png', __('Bookmark this SQL query')); ?> diff --git a/tbl_structure.php b/tbl_structure.php index 9aaeb129ba..25787e3646 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -600,19 +600,13 @@ if ($tbl_is_view) { 'show_query' => '1', ) ), - sprintf( - '%1$s %1$s', - __('Edit view') - ) + PMA_getIcon('b_edit.png', __('Edit view')) ); } ?> '; -} -echo __('Print view'); +echo PMA_getIcon('b_print.png', __('Print view')); ?> '; - } - echo __('Relation view'); + echo PMA_getIcon('b_relations.png', __('Relation view')); ?> '; - } - echo __('Propose table structure'); + echo PMA_getIcon('b_tblanalyse.png', __('Propose table structure')); ?>'; - - if ($cfg['PropertiesIconic']) - { - echo '' . __('Track table') . ' '; - } - echo __('Track table') . ''; + echo PMA_getIcon('eye.png', __('Track table')); + echo ''; } ?> @@ -823,10 +807,7 @@ if ($cfg['ShowStats']) { '; - } - echo __('Optimize table'); + echo PMA_getIcon('b_tbloptimize.png', __('Optimize table')); ?>