Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
be1c785802
@ -1309,6 +1309,53 @@ function PMA_showNoticeForEnum(selectElement) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a dialog box to pop up the create_table form
|
||||
*/
|
||||
function PMA_createTableDialog( div, url , target){
|
||||
/**
|
||||
* @var button_options Object that stores the options passed to jQueryUI
|
||||
* dialog
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();}
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
|
||||
$.get( target , url , function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
div
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strCreateTable'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
//remove the redundant [Back] link in the error message.
|
||||
.find('fieldset').remove();
|
||||
} else {
|
||||
div
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strCreateTable'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
}); // end dialog options
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* jQuery function that uses jQueryUI's dialogs to confirm with user. Does not
|
||||
* return a jQuery object yet and hence cannot be chained
|
||||
@ -1403,7 +1450,7 @@ jQuery.fn.PMA_sort_table = function(text_selector) {
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
/**
|
||||
/**
|
||||
* Attach event handler to the submit action of the create table minimal form
|
||||
* and retrieve the full table form and display it in a dialog
|
||||
*
|
||||
@ -1412,50 +1459,15 @@ $(document).ready(function() {
|
||||
$("#create_table_form_minimal.ajax").live('submit', function(event) {
|
||||
event.preventDefault();
|
||||
$form = $(this);
|
||||
|
||||
/* @todo Validate this form! */
|
||||
|
||||
/**
|
||||
* @var button_options Object that stores the options passed to jQueryUI
|
||||
* dialog
|
||||
*/
|
||||
var button_options = {};
|
||||
// in the following function we need to use $(this)
|
||||
button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}
|
||||
|
||||
var button_options_error = {};
|
||||
button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}
|
||||
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
PMA_prepareForAjaxRequest($form);
|
||||
|
||||
$.get($form.attr('action'), $form.serialize(), function(data) {
|
||||
//in the case of an error, show the error message returned.
|
||||
if (data.success != undefined && data.success == false) {
|
||||
$('<div id="create_table_dialog"></div>')
|
||||
.append(data.error)
|
||||
.dialog({
|
||||
title: PMA_messages['strCreateTable'],
|
||||
height: 230,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options_error
|
||||
})// end dialog options
|
||||
//remove the redundant [Back] link in the error message.
|
||||
.find('fieldset').remove();
|
||||
} else {
|
||||
$('<div id="create_table_dialog"></div>')
|
||||
.append(data)
|
||||
.dialog({
|
||||
title: PMA_messages['strCreateTable'],
|
||||
height: 600,
|
||||
width: 900,
|
||||
open: PMA_verifyTypeOfAllColumns,
|
||||
buttons : button_options
|
||||
}); // end dialog options
|
||||
}
|
||||
PMA_ajaxRemoveMessage($msgbox);
|
||||
}) // end $.get()
|
||||
/*variables which stores the common attributes*/
|
||||
var url = $form.serialize();
|
||||
var action = $form.attr('action');
|
||||
var div = $('<div id="create_table_dialog"></div>');
|
||||
|
||||
/*Calling to the createTableDialog function*/
|
||||
PMA_createTableDialog(div, url, action);
|
||||
|
||||
// empty table name and number of columns from the minimal form
|
||||
$form.find('input[name=table],input[name=num_fields]').val('');
|
||||
|
||||
@ -202,4 +202,22 @@ $(document).ready(function(){
|
||||
window.parent.refreshMain($('#LeftDefaultTabTable')[0].value);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Create table */
|
||||
$('#newtable a.ajax').click(function(event){
|
||||
event.preventDefault();
|
||||
/*Getting the url */
|
||||
var url = $('#newtable a').attr("href");
|
||||
if (url.substring(0, 15) == "tbl_create.php?") {
|
||||
url = url.substring(15);
|
||||
}
|
||||
url = url +"&num_fields=&ajax_request=true";
|
||||
/*Creating a div on the frame_content frame */
|
||||
var div = parent.frame_content.$('<div id="create_table_dialog"></div>');
|
||||
var target = "tbl_create.php";
|
||||
|
||||
/*Calling to the createTableDialog function*/
|
||||
PMA_createTableDialog(div , url , target);
|
||||
});//end of create new table
|
||||
});//end of document get ready
|
||||
|
||||
|
||||
@ -540,6 +540,7 @@ $_REQUEST['js_frame'] = PMA_ifSetOr($_REQUEST['js_frame'], '');
|
||||
*/
|
||||
$GLOBALS['js_include'] = array();
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-1.6.1.js';
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
|
||||
$GLOBALS['js_include'][] = 'update-location.js';
|
||||
|
||||
/**
|
||||
|
||||
@ -613,14 +613,22 @@ unset($_form_params);
|
||||
if ($action == 'tbl_create.php') {
|
||||
?>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<th><?php echo __('Table name'); ?>: </th>
|
||||
</tr>
|
||||
<tr><td><input type="text" name="table" size="40" maxlength="80"
|
||||
<tr valign="top">
|
||||
<th><?php echo __('Table name'); ?>: </th>
|
||||
</tr>
|
||||
<tr><td><input type="text" name="table" size="40" maxlength="80"
|
||||
value="<?php echo (isset($_REQUEST['table']) ? htmlspecialchars($_REQUEST['table']) : ''); ?>"
|
||||
class="textfield" />
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?>
|
||||
<?php echo sprintf(__('Add %s column(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?>
|
||||
<input type="submit" name="submit_num_fields" value="<?php echo __('Go'); ?>"
|
||||
onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)"
|
||||
/>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
@ -775,15 +783,6 @@ if ($action == 'tbl_create.php') {
|
||||
|
||||
<fieldset class="tblFooters">
|
||||
<input type="submit" name="do_save_data" value="<?php echo __('Save'); ?>" />
|
||||
<?php if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { ?>
|
||||
<?php echo __('Or'); ?>
|
||||
<?php echo sprintf(__('Add %s column(s)'), '<input type="text" id="added_fields" name="added_fields" size="2" value="1" onfocus="this.select()" />'); ?>
|
||||
<input type="submit" name="submit_num_fields"
|
||||
value="<?php echo __('Go'); ?>"
|
||||
<?php /* onclick="if (addField()) return false;" */ ?>
|
||||
onclick="return checkFormElementInRange(this.form, 'added_fields', '<?php echo str_replace('\'', '\\\'', __('You have to add at least one column.')); ?>', 1)"
|
||||
/>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
<div id="properties_message"></div>
|
||||
</form>
|
||||
|
||||
@ -137,8 +137,10 @@ require_once './libraries/header_http.inc.php';
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&js_frame=left&nocache=<?php echo $GLOBALS['PMA_Config']->getThemeUniqueValue(); ?>" />
|
||||
<script src="./js/jquery/jquery-1.6.1.js" type="text/javascript"></script>
|
||||
<script src="./js/jquery/jquery-ui-1.8.custom.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="js/navigation.js"></script>
|
||||
<script type="text/javascript" src="js/functions.js"></script>
|
||||
<script type="text/javascript" src="js/messages.php"></script>
|
||||
<script type="text/javascript">
|
||||
// <![CDATA[
|
||||
var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
|
||||
@ -322,7 +324,9 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
|
||||
}
|
||||
unset($table_list);
|
||||
if ($db != 'information_schema') {
|
||||
echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '">'
|
||||
$class = '';
|
||||
$GLOBALS['cfg']['AjaxEnable'] ? $class="ajax" : '';
|
||||
echo '<ul id="newtable"><li><a target="frame_content" href="tbl_create.php' . PMA_generate_common_url(array('db' => $GLOBALS['db'])) . '" class="'.$class .'" >'
|
||||
.'<img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_snewtbl.png" id="icon_newtable" alt="' . _pgettext('short form', 'Create table') . '" />'
|
||||
. _pgettext('short form', 'Create table') . '</a></li></ul>';
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user