implementation of PMA_getHtmlForSomeLinks()

This commit is contained in:
thilinaa 2012-08-12 13:36:41 +05:30
parent 7dad8df8cd
commit ceb7ed98b8
2 changed files with 64 additions and 38 deletions

View File

@ -1455,5 +1455,66 @@ function PMA_getHtmlForEditView($url_params)
return $html_output;
}
/**
* Get HTML links for 'Print view', 'Relation view', 'Propose table structure',
* 'Track table' and 'Move columns'
*
* @param string $url_query url query
* @param boolean $tbl_is_view whether table is view or not
* @param boolean $db_is_information_schema whether db is information schema or not
* @param string $tbl_storage_engine table storage engine
* @param array $cfgRelation current relation parameters
*
* @return string $html_output
*/
function PMA_getHtmlForSomeLinks($url_query, $tbl_is_view,
$db_is_information_schema, $tbl_storage_engine, $cfgRelation
) {
$common_functions = PMA_CommonFunctions::getInstance();
$html_output = '<a href="tbl_printview.php?' . $url_query . '">'
. $common_functions->getIcon('b_print.png', __('Print view'), true)
. '</a>';
if (! $tbl_is_view && ! $db_is_information_schema) {
// if internal relations are available, or foreign keys are supported
// ($tbl_storage_engine comes from libraries/tbl_info.inc.php
if ($cfgRelation['relwork']
|| $common_functions->isForeignKeySupported($tbl_storage_engine)
) {
$html_output .= '<a href="tbl_relation.php?' . $url_query . '">'
. $common_functions->getIcon('b_relations.png', __('Relation view'), true)
. '</a>';
}
if (!PMA_DRIZZLE) {
$html_output .= '<a href="sql.php?' . $url_query
. '&amp;session_max_rows=all&amp;sql_query=' . urlencode(
'SELECT * FROM ' . $common_functions->backquote($GLOBALS['table'])
. ' PROCEDURE ANALYSE()'
) . '">'
. $common_functions->getIcon(
'b_tblanalyse.png',
__('Propose table structure'),
true
)
. '</a>';
$html_output .= $common_functions->showMySQLDocu(
'Extending_MySQL', 'procedure_analyse'
) . "\n";
}
if (PMA_Tracker::isActive()) {
$html_output .= '<a href="tbl_tracking.php?' . $url_query . '">'
. $common_functions->getIcon('eye.png', __('Track table'), true)
. '</a>';
}
$html_output .= '<a href="#" id="move_columns_anchor">'
. $common_functions->getIcon('b_move.png', __('Move columns'), true)
. '</a>';
}
return $html_output;
}
?>

View File

@ -531,46 +531,11 @@ echo PMA_getHtmlDivForMoveColumnsDialog();
if ($tbl_is_view) {
echo PMA_getHtmlForEditView($url_params);
}
?>
echo PMA_getHtmlForSomeLinks($url_query, $tbl_is_view,
$db_is_information_schema, $tbl_storage_engine, $cfgRelation);
<a href="tbl_printview.php?<?php echo $url_query; ?>"><?php
echo $common_functions->getIcon('b_print.png', __('Print view'), true);
?></a>
<?php
if (! $tbl_is_view && ! $db_is_information_schema) {
// if internal relations are available, or foreign keys are supported
// ($tbl_storage_engine comes from libraries/tbl_info.inc.php)
if ($cfgRelation['relwork']
|| $common_functions->isForeignKeySupported($tbl_storage_engine)
) {
?>
<a href="tbl_relation.php?<?php echo $url_query; ?>"><?php
echo $common_functions->getIcon('b_relations.png', __('Relation view'), true);
?></a>
<?php
}
if (!PMA_DRIZZLE) {
?>
<a href="sql.php?<?php echo $url_query; ?>&amp;session_max_rows=all&amp;sql_query=<?php echo urlencode('SELECT * FROM ' . $common_functions->backquote($table) . ' PROCEDURE ANALYSE()'); ?>"><?php
echo $common_functions->getIcon('b_tblanalyse.png', __('Propose table structure'), true);
?></a><?php
echo $common_functions->showMySQLDocu('Extending_MySQL', 'procedure_analyse') . "\n";
}
if (PMA_Tracker::isActive()) {
echo '<a href="tbl_tracking.php?' . $url_query . '">';
echo $common_functions->getIcon('eye.png', __('Track table'), true);
echo '</a>';
}
?>
<a href="#" id="move_columns_anchor"><?php
echo $common_functions->getIcon('b_move.png', __('Move columns'), true);
?></a>
?>
<br />
<form method="post" action="tbl_addfield.php" id="addColumns" name="addColumns" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax"' : '');?>
onsubmit="return checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)">