Merge remote branch 'origin/master'
This commit is contained in:
@@ -343,6 +343,7 @@ if (!$is_information_schema) {
|
||||
/**
|
||||
* rename database
|
||||
*/
|
||||
if ($db != 'mysql') {
|
||||
?>
|
||||
<form id="rename_db_form" method="post" action="db_operations.php"
|
||||
onsubmit="return emptyFormElements(this, 'newname')">
|
||||
@@ -383,9 +384,11 @@ if (!$is_information_schema) {
|
||||
</fieldset>
|
||||
</form>
|
||||
<?php
|
||||
} // end if
|
||||
|
||||
// Drop link if allowed
|
||||
// Don't even try to drop information_schema. You won't be able to. Believe me. You won't.
|
||||
// Don't allow to easilly drop mysql database, RFE #1327514.
|
||||
// Don't allow to easily drop mysql database, RFE #1327514.
|
||||
if (($is_superuser || $GLOBALS['cfg']['AllowUserDropDatabase']) && ! $db_is_information_schema && ($db != 'mysql')) {
|
||||
?>
|
||||
<fieldset class="caution">
|
||||
|
@@ -70,47 +70,7 @@ $db_collation = PMA_getDbCollation($db);
|
||||
|
||||
// in a separate file to avoid redeclaration of functions in some code paths
|
||||
require_once './libraries/db_structure.lib.php';
|
||||
|
||||
$titles = array();
|
||||
if (true == $cfg['PropertiesIconic']) {
|
||||
$titles['Browse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_browse.png" alt="' . __('Browse') . '" title="' . __('Browse') . '" />';
|
||||
$titles['NoBrowse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . __('Browse') . '" title="' . __('Browse') . '" />';
|
||||
$titles['Search'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_select.png" alt="' . __('Search') . '" title="' . __('Search') . '" />';
|
||||
$titles['NoSearch'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . __('Search') . '" title="' . __('Search') . '" />';
|
||||
$titles['Insert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . __('Insert') . '" title="' . __('Insert') . '" />';
|
||||
$titles['NoInsert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_insrow.png" alt="' . __('Insert') . '" title="' . __('Insert') . '" />';
|
||||
$titles['Structure'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . __('Structure') . '" title="' . __('Structure') . '" />';
|
||||
$titles['Drop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . __('Drop') . '" title="' . __('Drop') . '" />';
|
||||
$titles['NoDrop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_drop.png" alt="' . __('Drop') . '" title="' . __('Drop') . '" />';
|
||||
$titles['Empty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_empty.png" alt="' . __('Empty') . '" title="' . __('Empty') . '" />';
|
||||
$titles['NoEmpty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . __('Empty') . '" title="' . __('Empty') . '" />';
|
||||
|
||||
if ('both' === $cfg['PropertiesIconic']) {
|
||||
$titles['Browse'] .= __('Browse');
|
||||
$titles['Search'] .= __('Search');
|
||||
$titles['NoBrowse'] .= __('Browse');
|
||||
$titles['NoSearch'] .= __('Search');
|
||||
$titles['Insert'] .= __('Insert');
|
||||
$titles['NoInsert'] .= __('Insert');
|
||||
$titles['Structure'] .= __('Structure');
|
||||
$titles['Drop'] .= __('Drop');
|
||||
$titles['NoDrop'] .= __('Drop');
|
||||
$titles['Empty'] .= __('Empty');
|
||||
$titles['NoEmpty'] .= __('Empty');
|
||||
}
|
||||
} else {
|
||||
$titles['Browse'] = __('Browse');
|
||||
$titles['Search'] = __('Search');
|
||||
$titles['NoBrowse'] = __('Browse');
|
||||
$titles['NoSearch'] = __('Search');
|
||||
$titles['Insert'] = __('Insert');
|
||||
$titles['NoInsert'] = __('Insert');
|
||||
$titles['Structure'] = __('Structure');
|
||||
$titles['Drop'] = __('Drop');
|
||||
$titles['NoDrop'] = __('Drop');
|
||||
$titles['Empty'] = __('Empty');
|
||||
$titles['NoEmpty'] = __('Empty');
|
||||
}
|
||||
require_once './libraries/build_action_titles.inc.php';
|
||||
|
||||
/**
|
||||
* Displays the tables list
|
||||
|
140
js/functions.js
140
js/functions.js
@@ -2035,17 +2035,85 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Attach event handler for submission of create table form
|
||||
* Attach event handler for submission of create table form (save)
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses $.PMA_sort_table()
|
||||
* @uses window.parent.refreshNavigation()
|
||||
*
|
||||
* The create_table_form whose action is tbl_create.php is the
|
||||
* one which is ajaxified; in this form the action could be
|
||||
* tbl_addfield.php but it's not ajaxified yet.
|
||||
*/
|
||||
$("#create_table_form").attr('action').is('tbl_create.php').find("input[name=submit_num_fields], input[name=do_save_data]").live('click', function(event) {
|
||||
// .live() must be called after a selector, see http://api.jquery.com/live
|
||||
$("#create_table_form input[name=do_save_data]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
/**
|
||||
* @var the_form object referring to the create table form
|
||||
*/
|
||||
var the_form = $("#create_table_form");
|
||||
|
||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$(the_form).append('<input type="hidden" name="ajax_request" value="true" />');
|
||||
//User wants to submit the form
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&do_save_data=" + $(this).val(), function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("#create_table_dialog").dialog("close").remove();
|
||||
|
||||
/**
|
||||
* @var tables_table Object referring to the <tbody> element that holds the list of tables
|
||||
*/
|
||||
var tables_table = $("#tablesForm").find("tbody").not("#tbl_summary_row");
|
||||
|
||||
/**
|
||||
* @var curr_last_row Object referring to the last <tr> element in {@link tables_table}
|
||||
*/
|
||||
var curr_last_row = $(tables_table).find('tr:last');
|
||||
/**
|
||||
* @var curr_last_row_index_string String containing the index of {@link curr_last_row}
|
||||
*/
|
||||
var curr_last_row_index_string = $(curr_last_row).find('input:checkbox').attr('id').match(/\d+/)[0];
|
||||
/**
|
||||
* @var curr_last_row_index Index of {@link curr_last_row}
|
||||
*/
|
||||
var curr_last_row_index = parseFloat(curr_last_row_index_string);
|
||||
/**
|
||||
* @var new_last_row_index Index of the new row to be appended to {@link tables_table}
|
||||
*/
|
||||
var new_last_row_index = curr_last_row_index + 1;
|
||||
/**
|
||||
* @var new_last_row_id String containing the id of the row to be appended to {@link tables_table}
|
||||
*/
|
||||
var new_last_row_id = 'checkbox_tbl_' + new_last_row_index;
|
||||
|
||||
//append to table
|
||||
$(data.new_table_string)
|
||||
.find('input:checkbox')
|
||||
.val(new_last_row_id)
|
||||
.end()
|
||||
.appendTo(tables_table);
|
||||
|
||||
//Sort the table
|
||||
$(tables_table).PMA_sort_table('th');
|
||||
|
||||
//Refresh navigation frame as a new table has been added
|
||||
window.parent.refreshNavigation();
|
||||
}
|
||||
else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}) // end $.post()
|
||||
}) // end create table form (save)
|
||||
|
||||
/**
|
||||
* Attach event handler for create table form (add fields)
|
||||
*
|
||||
* @uses PMA_ajaxShowMessage()
|
||||
* @uses $.PMA_sort_table()
|
||||
* @uses window.parent.refreshNavigation()
|
||||
*
|
||||
*/
|
||||
// .live() must be called after a selector, see http://api.jquery.com/live
|
||||
$("#create_table_form input[name=submit_num_fields]").live('click', function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
/**
|
||||
@@ -2056,64 +2124,12 @@ $(document).ready(function() {
|
||||
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
|
||||
$(the_form).append('<input type="hidden" name="ajax_request" value="true" />');
|
||||
|
||||
if($(this).attr('name') == 'submit_num_fields') {
|
||||
//User wants to add more fields to the table
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
|
||||
$("#create_table_dialog").html(data);
|
||||
}) //end $.post()
|
||||
}
|
||||
else if($(this).attr('name') == 'do_save_data') {
|
||||
//User wants to submit the form
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&do_save_data=" + $(this).val(), function(data) {
|
||||
if(data.success == true) {
|
||||
PMA_ajaxShowMessage(data.message);
|
||||
$("#create_table_dialog").dialog("close").remove();
|
||||
//User wants to add more fields to the table
|
||||
$.post($(the_form).attr('action'), $(the_form).serialize() + "&submit_num_fields=" + $(this).val(), function(data) {
|
||||
$("#create_table_dialog").html(data);
|
||||
}) //end $.post()
|
||||
|
||||
/**
|
||||
* @var tables_table Object referring to the <tbody> element that holds the list of tables
|
||||
*/
|
||||
var tables_table = $("#tablesForm").find("tbody").not("#tbl_summary_row");
|
||||
|
||||
/**
|
||||
* @var curr_last_row Object referring to the last <tr> element in {@link tables_table}
|
||||
*/
|
||||
var curr_last_row = $(tables_table).find('tr:last');
|
||||
/**
|
||||
* @var curr_last_row_index_string String containing the index of {@link curr_last_row}
|
||||
*/
|
||||
var curr_last_row_index_string = $(curr_last_row).find('input:checkbox').attr('id').match(/\d+/)[0];
|
||||
/**
|
||||
* @var curr_last_row_index Index of {@link curr_last_row}
|
||||
*/
|
||||
var curr_last_row_index = parseFloat(curr_last_row_index_string);
|
||||
/**
|
||||
* @var new_last_row_index Index of the new row to be appended to {@link tables_table}
|
||||
*/
|
||||
var new_last_row_index = curr_last_row_index + 1;
|
||||
/**
|
||||
* @var new_last_row_id String containing the id of the row to be appended to {@link tables_table}
|
||||
*/
|
||||
var new_last_row_id = 'checkbox_tbl_' + new_last_row_index;
|
||||
|
||||
//append to table
|
||||
$(data.new_table_string)
|
||||
.find('input:checkbox')
|
||||
.val(new_last_row_id)
|
||||
.end()
|
||||
.appendTo(tables_table);
|
||||
|
||||
//Sort the table
|
||||
$(tables_table).PMA_sort_table('th');
|
||||
|
||||
//Refresh navigation frame as a new table has been added
|
||||
window.parent.refreshNavigation();
|
||||
}
|
||||
else {
|
||||
PMA_ajaxShowMessage(data.error);
|
||||
}
|
||||
}) // end $.post()
|
||||
} // end elseif()
|
||||
}) // end create table form submit button actions
|
||||
}) // end create table form (add fields)
|
||||
|
||||
}, 'top.frame_content'); //end $(document).ready for 'Create Table'
|
||||
|
||||
|
51
libraries/build_action_titles.inc.php
Normal file
51
libraries/build_action_titles.inc.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package phpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$titles = array();
|
||||
if (true == $cfg['PropertiesIconic']) {
|
||||
$titles['Browse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_browse.png" alt="' . __('Browse') . '" title="' . __('Browse') . '" />';
|
||||
$titles['NoBrowse'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . __('Browse') . '" title="' . __('Browse') . '" />';
|
||||
$titles['Search'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_select.png" alt="' . __('Search') . '" title="' . __('Search') . '" />';
|
||||
$titles['NoSearch'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . __('Search') . '" title="' . __('Search') . '" />';
|
||||
$titles['Insert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . __('Insert') . '" title="' . __('Insert') . '" />';
|
||||
$titles['NoInsert'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_insrow.png" alt="' . __('Insert') . '" title="' . __('Insert') . '" />';
|
||||
$titles['Structure'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . __('Structure') . '" title="' . __('Structure') . '" />';
|
||||
$titles['Drop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . __('Drop') . '" title="' . __('Drop') . '" />';
|
||||
$titles['NoDrop'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_drop.png" alt="' . __('Drop') . '" title="' . __('Drop') . '" />';
|
||||
$titles['Empty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_empty.png" alt="' . __('Empty') . '" title="' . __('Empty') . '" />';
|
||||
$titles['NoEmpty'] = '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . __('Empty') . '" title="' . __('Empty') . '" />';
|
||||
|
||||
if ('both' === $cfg['PropertiesIconic']) {
|
||||
$titles['Browse'] .= __('Browse');
|
||||
$titles['Search'] .= __('Search');
|
||||
$titles['NoBrowse'] .= __('Browse');
|
||||
$titles['NoSearch'] .= __('Search');
|
||||
$titles['Insert'] .= __('Insert');
|
||||
$titles['NoInsert'] .= __('Insert');
|
||||
$titles['Structure'] .= __('Structure');
|
||||
$titles['Drop'] .= __('Drop');
|
||||
$titles['NoDrop'] .= __('Drop');
|
||||
$titles['Empty'] .= __('Empty');
|
||||
$titles['NoEmpty'] .= __('Empty');
|
||||
}
|
||||
} else {
|
||||
$titles['Browse'] = __('Browse');
|
||||
$titles['Search'] = __('Search');
|
||||
$titles['NoBrowse'] = __('Browse');
|
||||
$titles['NoSearch'] = __('Search');
|
||||
$titles['Insert'] = __('Insert');
|
||||
$titles['NoInsert'] = __('Insert');
|
||||
$titles['Structure'] = __('Structure');
|
||||
$titles['Drop'] = __('Drop');
|
||||
$titles['NoDrop'] = __('Drop');
|
||||
$titles['Empty'] = __('Empty');
|
||||
$titles['NoEmpty'] = __('Empty');
|
||||
}
|
||||
?>
|
@@ -369,7 +369,7 @@ for ($i = 0; $i < $num_fields; $i++) {
|
||||
. ' class="textfield" />'
|
||||
. '<p class="enum_notice" id="enum_notice_' . $i . '_' . ($ci - $ci_offset) . '">';
|
||||
$content_cells[$i][$ci] .= __('ENUM or SET data too long?')
|
||||
. '<a onclick="return false;" href="enum_editor.php?' . PMA_generate_common_url() . '&values=' . urlencode($length_to_display) . '&field=' . (isset($row['Field']) ? urlencode($row['Field']) : "") . '" class="open_enum_editor" target="_blank"> '
|
||||
. '<a onclick="return false;" href="enum_editor.php?' . PMA_generate_common_url() . '&values=' . urlencode($length_to_display) . '&field=' . (isset($row['Field']) ? urlencode($row['Field']) : "") . '" class="open_enum_editor" target="_blank"> '
|
||||
. __('Get more editing space') . '</a></p>';
|
||||
$ci++;
|
||||
|
||||
@@ -610,7 +610,7 @@ document.onkeydown = onKeyDownArrowsHandler;
|
||||
}
|
||||
?>
|
||||
|
||||
<form id="create_table_form" method="post" action="<?php echo $action; ?>">
|
||||
<form id="<?php echo ($action == 'tbl_create.php' ? 'create_table' : 'append_fields'); ?>_form" method="post" action="<?php echo $action; ?>">
|
||||
<?php
|
||||
echo PMA_generate_common_hidden_inputs($_form_params);
|
||||
unset($_form_params);
|
||||
|
@@ -38,6 +38,7 @@ require_once './libraries/common.inc.php';
|
||||
$action = 'tbl_create.php';
|
||||
|
||||
require_once './libraries/header.inc.php';
|
||||
require_once './libraries/build_action_titles.inc.php';
|
||||
|
||||
// Check parameters
|
||||
PMA_checkParameters(array('db'));
|
||||
@@ -299,25 +300,21 @@ if (isset($_REQUEST['do_save_data'])) {
|
||||
}
|
||||
$new_table_string .= '</th>' . "\n";
|
||||
|
||||
$new_table_string .= '<td> <img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . __('Browse') . '" title="' . __('Browse') . '" /> </td>' . "\n";
|
||||
$new_table_string .= '<td>' . $titles['NoBrowse'] . '</td>' . "\n";
|
||||
|
||||
$new_table_string .= '<td> <a href="tbl_structure.php' . PMA_generate_common_url($tbl_url_params) . '"> ';
|
||||
$new_table_string .= '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . __('Structure') . '" title="' . __('Structure') . '" />';
|
||||
$new_table_string .= '</a> </td>' . "\n";
|
||||
$new_table_string .= '<td><a href="tbl_structure.php' . PMA_generate_common_url($tbl_url_params) . '">' . $titles['Structure'] . '</a></td>' . "\n";
|
||||
|
||||
$new_table_string .= '<td> <img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . __('Search') . '" title="' . __('Search') . '" /> </td>' . "\n";
|
||||
$new_table_string .= '<td>' . $titles['NoSearch'] . '</td>' . "\n";
|
||||
|
||||
$new_table_string .= '<td> <a href="tbl_change.php' . PMA_generate_common_url($tbl_url_params) . '"> ';
|
||||
$new_table_string .= '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . __('Insert') . '" title="' . __('Insert') . '" />';
|
||||
$new_table_string .= '</a> </td>' . "\n";
|
||||
$new_table_string .= '<td><a href="tbl_change.php' . PMA_generate_common_url($tbl_url_params) . '">' . $titles['Insert'] . '</a></td>' . "\n";
|
||||
|
||||
$new_table_string .= '<td> <img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . __('Empty') . '" title="' . __('Empty') . '" /> </td>' . "\n";
|
||||
$new_table_string .= '<td>' . $titles['NoEmpty'] . '</td>' . "\n";
|
||||
|
||||
$new_table_string .= '<td> <a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&sql_query=';
|
||||
$new_table_string .= '<td><a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&sql_query=';
|
||||
$new_table_string .= urlencode('DROP TABLE ' . PMA_backquote($table));
|
||||
$new_table_string .= '">';
|
||||
$new_table_string .= '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . __('Drop') . '" title="' . __('Drop') . '" />';
|
||||
$new_table_string .= '</a> </td>' . "\n";
|
||||
$new_table_string .= $titles['Drop'];
|
||||
$new_table_string .= '</a></td>' . "\n";
|
||||
|
||||
$new_table_string .= '<td class="value">' . $tbl_stats['Rows'] . '</td>' . "\n";
|
||||
|
||||
|
Reference in New Issue
Block a user