Skip to content

Commit

Permalink
PMA_getHtmlForDropDatabaseLink function implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
thilinaa committed Jul 21, 2012
1 parent 1021227 commit 85b8aff
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 31 deletions.
32 changes: 1 addition & 31 deletions db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,37 +437,7 @@
&& ! $db_is_information_schema
&& (PMA_DRIZZLE || $db != 'mysql')
) {
?>
<div class="operations_half_width">
<fieldset class="caution">
<legend><?php
if ($cfg['PropertiesIconic']) {
echo $common_functions->getImage('b_deltbl.png');
}
echo __('Remove database');
?></legend>

<ul>
<?php
$this_sql_query = 'DROP DATABASE ' . $common_functions->backquote($GLOBALS['db']);
$this_url_params = array(
'sql_query' => $this_sql_query,
'back' => 'db_operations.php',
'goto' => 'main.php',
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(__('Database %s has been dropped.'), htmlspecialchars($common_functions->backquote($db))),
'db' => null,
);
?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? 'id="drop_db_anchor"' : ''); ?>>
<?php echo __('Drop the database (DROP)'); ?></a>
<?php echo $common_functions->showMySQLDocu('SQL-Syntax', 'DROP_DATABASE'); ?>
</li>
</ul>
</fieldset>
</div>
<?php
echo PMA_getHtmlForDropDatabaseLink();
}
/**
* Copy database
Expand Down
45 changes: 45 additions & 0 deletions libraries/db_operations.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,49 @@ function PMA_getHtmlForRenameDatabase()
return $html_output;
}

/**
* Get HTML for database drop link
*
* @return string $html_output
*/
function PMA_getHtmlForDropDatabaseLink()
{
$common_functions = PMA_CommonFunctions::getInstance();

$this_sql_query = 'DROP DATABASE ' . $common_functions->backquote($GLOBALS['db']);
$this_url_params = array(
'sql_query' => $this_sql_query,
'back' => 'db_operations.php',
'goto' => 'main.php',
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(
__('Database %s has been dropped.')
, htmlspecialchars($common_functions->backquote($GLOBALS['db']))
),
'db' => null,
);

$html_output = '<div class="operations_half_width">'
. '<fieldset class="caution">';
$html_output .= '<legend>';
if ($GLOBALS['cfg']['PropertiesIconic']) {
$html_output .= $common_functions->getImage('b_deltbl.png');
}
$html_output .= __('Remove database')
. '</legend>';
$html_output .= '<ul>';
$html_output .= '<li>'
. '<a href="sql.php' . PMA_generate_common_url($this_url_params) . '"'
. ($GLOBALS['cfg']['AjaxEnable'] ? 'id="drop_db_anchor"' : '') . '>'
. __('Drop the database (DROP)')
. '</a>'
. $common_functions->showMySQLDocu('SQL-Syntax', 'DROP_DATABASE')
. '</li>'
. '</ul></fieldset>'
. '</div>';

return $html_output;
}

?>

0 comments on commit 85b8aff

Please sign in to comment.