PMA_getHtmlForCopyDatabase funtion implementation and remove addHtml usgae for testing,
This commit is contained in:
parent
bf3c8899e4
commit
a80dfa751a
@ -416,7 +416,7 @@ if (!$is_information_schema) {
|
||||
/**
|
||||
* database comment
|
||||
*/
|
||||
$response->addHTML(PMA_getHtmlForDatabaseComment());
|
||||
echo PMA_getHtmlForDatabaseComment();
|
||||
}
|
||||
?>
|
||||
<div class="operations_half_width">
|
||||
@ -427,7 +427,7 @@ if (!$is_information_schema) {
|
||||
* rename database
|
||||
*/
|
||||
if ($db != 'mysql') {
|
||||
$response->addHTML(PMA_getHtmlForRenameDatabase());
|
||||
echo PMA_getHtmlForRenameDatabase();
|
||||
}
|
||||
|
||||
// Drop link if allowed
|
||||
@ -437,82 +437,12 @@ if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase'])
|
||||
&& ! $db_is_information_schema
|
||||
&& (PMA_DRIZZLE || $db != 'mysql')
|
||||
) {
|
||||
$response->addHTML(PMA_getHtmlForDropDatabaseLink());
|
||||
echo PMA_getHtmlForDropDatabaseLink();
|
||||
}
|
||||
/**
|
||||
* Copy database
|
||||
*/
|
||||
?>
|
||||
<div class="operations_half_width clearfloat">
|
||||
<form id="copy_db_form" <?php echo ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : ''); ?>method="post" action="db_operations.php"
|
||||
onsubmit="return emptyFormElements(this, 'newname')">
|
||||
<?php
|
||||
if (isset($db_collation)) {
|
||||
echo '<input type="hidden" name="db_collation" value="' . $db_collation
|
||||
.'" />' . "\n";
|
||||
}
|
||||
echo '<input type="hidden" name="db_copy" value="true" />' . "\n";
|
||||
echo PMA_generate_common_hidden_inputs($db);
|
||||
?>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<?php
|
||||
if ($cfg['PropertiesIconic']) {
|
||||
echo $common_functions->getImage('b_edit.png');
|
||||
}
|
||||
echo __('Copy database to') . ':';
|
||||
$drop_clause = 'DROP TABLE / DROP VIEW';
|
||||
?>
|
||||
</legend>
|
||||
<input type="text" name="newname" size="30" class="textfield" value="" /><br />
|
||||
<?php
|
||||
$choices = array(
|
||||
'structure' => __('Structure only'),
|
||||
'data' => __('Structure and data'),
|
||||
'dataonly' => __('Data only'));
|
||||
echo $common_functions->getRadioFields(
|
||||
'what', $choices, 'data', true
|
||||
);
|
||||
unset($choices);
|
||||
?>
|
||||
<input type="checkbox" name="create_database_before_copying" value="1"
|
||||
id="checkbox_create_database_before_copying"
|
||||
checked="checked" />
|
||||
<label for="checkbox_create_database_before_copying">
|
||||
<?php echo __('CREATE DATABASE before copying'); ?></label><br />
|
||||
<input type="checkbox" name="drop_if_exists" value="true"
|
||||
id="checkbox_drop" />
|
||||
<label for="checkbox_drop"><?php echo sprintf(__('Add %s'), $drop_clause); ?></label><br />
|
||||
<input type="checkbox" name="sql_auto_increment" value="1" checked="checked"
|
||||
id="checkbox_auto_increment" />
|
||||
<label for="checkbox_auto_increment">
|
||||
<?php echo __('Add AUTO_INCREMENT value'); ?></label><br />
|
||||
<input type="checkbox" name="add_constraints" value="1"
|
||||
id="checkbox_constraints" />
|
||||
<label for="checkbox_constraints">
|
||||
<?php echo __('Add constraints'); ?></label><br />
|
||||
<?php
|
||||
unset($drop_clause);
|
||||
|
||||
if (isset($_COOKIE)
|
||||
&& isset($_COOKIE['pma_switch_to_new'])
|
||||
&& $_COOKIE['pma_switch_to_new'] == 'true'
|
||||
) {
|
||||
$pma_switch_to_new = 'true';
|
||||
}
|
||||
?>
|
||||
<input type="checkbox" name="switch_to_new" value="true"
|
||||
id="checkbox_switch"
|
||||
<?php echo ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true') ? ' checked="checked"' : ''); ?>
|
||||
/>
|
||||
<label for="checkbox_switch"><?php echo __('Switch to copied database'); ?></label>
|
||||
</fieldset>
|
||||
<fieldset class="tblFooters">
|
||||
<input type="submit" name="submit_copy" value="<?php echo __('Go'); ?>" />
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
echo PMA_getHtmlForCopyDatabase();
|
||||
|
||||
/**
|
||||
* Change database charset
|
||||
|
||||
@ -124,4 +124,84 @@ function PMA_getHtmlForDropDatabaseLink()
|
||||
return $html_output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML snippet for copy database
|
||||
*
|
||||
* @return string $html_output
|
||||
*/
|
||||
function PMA_getHtmlForCopyDatabase()
|
||||
{
|
||||
$drop_clause = 'DROP TABLE / DROP VIEW';
|
||||
$choices = array(
|
||||
'structure' => __('Structure only'),
|
||||
'data' => __('Structure and data'),
|
||||
'dataonly' => __('Data only')
|
||||
);
|
||||
|
||||
if (isset($_COOKIE)
|
||||
&& isset($_COOKIE['pma_switch_to_new'])
|
||||
&& $_COOKIE['pma_switch_to_new'] == 'true'
|
||||
) {
|
||||
$pma_switch_to_new = 'true';
|
||||
}
|
||||
|
||||
$html_output = '<div class="operations_half_width clearfloat">';
|
||||
$html_output .= '<form id="copy_db_form" '
|
||||
. ($GLOBALS['cfg']['AjaxEnable'] ? ' class="ajax" ' : '')
|
||||
. 'method="post" action="db_operations.php"'
|
||||
. 'onsubmit="return emptyFormElements(this' . "'newname'" . ')">';
|
||||
|
||||
if (isset($_REQUEST['db_collation'])) {
|
||||
$html_output .= '<input type="hidden" name="db_collation" '
|
||||
. 'value="' . $_REQUEST['db_collation'] .'" />' . "\n";
|
||||
}
|
||||
$html_output .= '<input type="hidden" name="db_copy" value="true" />' . "\n"
|
||||
. PMA_generate_common_hidden_inputs($GLOBALS['db']);
|
||||
$html_output .= '<fieldset>'
|
||||
. '<legend>';
|
||||
|
||||
if ($GLOBALS['cfg']['PropertiesIconic']) {
|
||||
$html_output .= PMA_CommonFunctions::getInstance()->getImage('b_edit.png');
|
||||
}
|
||||
$html_output .= __('Copy database to') . ':'
|
||||
. '</legend>'
|
||||
. '<input type="text" name="newname" size="30" class="textfield" value="" /><br />'
|
||||
. PMA_CommonFunctions::getInstance()->getRadioFields(
|
||||
'what', $choices, 'data', true
|
||||
);
|
||||
$html_output .= '<input type="checkbox" name="create_database_before_copying" '
|
||||
. 'value="1" id="checkbox_create_database_before_copying"'
|
||||
. 'checked="checked" />';
|
||||
$html_output .= '<label for="checkbox_create_database_before_copying">'
|
||||
. __('CREATE DATABASE before copying') . '</label><br />';
|
||||
$html_output .= '<input type="checkbox" name="drop_if_exists" value="true"'
|
||||
. 'id="checkbox_drop" />';
|
||||
$html_output .= '<label for="checkbox_drop">'
|
||||
. sprintf(__('Add %s'), $drop_clause)
|
||||
. '</label><br />';
|
||||
$html_output .= '<input type="checkbox" name="sql_auto_increment" value="1" '
|
||||
. 'checked="checked" id="checkbox_auto_increment" />';
|
||||
$html_output .= '<label for="checkbox_auto_increment">'
|
||||
. __('Add AUTO_INCREMENT value') . '</label><br />';
|
||||
$html_output .= '<input type="checkbox" name="add_constraints" value="1"'
|
||||
. 'id="checkbox_constraints" />';
|
||||
$html_output .= '<label for="checkbox_constraints">'
|
||||
. __('Add constraints') . '</label><br />';
|
||||
$html_output .= '<input type="checkbox" name="switch_to_new" value="true"'
|
||||
. 'id="checkbox_switch"'
|
||||
. ((isset($pma_switch_to_new) && $pma_switch_to_new == 'true')
|
||||
? ' checked="checked"'
|
||||
: '')
|
||||
. '/>';
|
||||
$html_output .= '<label for="checkbox_switch">'
|
||||
. ('Switch to copied database') . '</label>'
|
||||
. '</fieldset>';
|
||||
$html_output .= '<fieldset class="tblFooters">'
|
||||
. '<input type="submit" name="submit_copy" value="' . __('Go') . '" />'
|
||||
. '</fieldset>'
|
||||
. '</form>'
|
||||
. '</div>';
|
||||
|
||||
return $html_output;
|
||||
}
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user