Bug fixed the create table option in navigation panel

This commit is contained in:
Thilanka Kaushalya 2011-05-25 21:03:13 +05:30
parent 0598d99925
commit 42c36b1fb8
3 changed files with 52 additions and 62 deletions

View File

@ -1499,7 +1499,7 @@ $(document).ready(function() {
PMA_ajaxShowMessage(data.message);
// Only if the create table dialog (distinct panel) exists
if ($("#create_table_dialog").length > 0) {
$("#create_table_dialog").parent().dialog("close").remove();
$("#create_table_dialog").dialog("close").remove();
}
/**

View File

@ -181,66 +181,55 @@ $(document).ready(function(){
$('#fast_filter').keyup(function (evt) {fast_filter(evt.target.value);});
/* Create table */
$('#newtable').click(function(event){
event.preventDefault();
cls = $('#newtable a').attr("class");
if(cls == 'ajax'){
url = $('#newtable a').attr("href");
//$div = parent.frame_content.$('<div id="create_table_dialog"></div>');
//$form = $(this);
$('#newtable a.ajax').click(function(event){
event.preventDefault();
var $url = $('#newtable a').attr("href");
if ($url.substring(0, 15) == "tbl_create.php?") {
$url = $url.substring(15);
}
var $div = parent.frame_content.$('<div id="create_table_dialog"></div>');
/* @todo Validate this form! */
/* @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["Cancel"] = function() {$(this).parent().dialog('close').remove();}
/**
* @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["OK"] = 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();
//PMA_prepareForAjaxRequest($form);
var $msgbox = PMA_ajaxShowMessage();
$.get( url , function(data) {
//in the case of an error, show the error message returned.
if (data.success != undefined && data.success == false) {
parent.frame_content.$('<div id="create_table_dialog"></div>')
//$div
.append(data.error)
.dialog({
title: 'Create Table',
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 {
parent.frame_content.$('<div id="create_table_dialog"></div>')
//$div
.append(data)
.dialog({
title: 'Create Table',
height: 600,
width: 900,
//open: PMA_verifyTypeOfAllColumns,
buttons : button_options
// buttons : {"Close" : function() {$(this).dialog('close');}}
}); // end dialog options
}
//PMA_ajaxRemoveMessage($msgbox);
}) // end $.get()
//$div.remove();
// empty table name and number of columns from the minimal form
// $form.find('input[name=table],input[name=num_fields]').val('');
//event.preventDefault();
}else{}
});//end of create new form
});//end of document get ready
$.get( "tbl_create.php" , $url+"&num_fields=1&ajax_request=true" , 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()
});//end of create new table
});//end of document get ready

View File

@ -127,9 +127,10 @@ require_once './libraries/header_http.inc.php';
<link rel="stylesheet" type="text/css"
href="phpmyadmin.css.php?<?php echo PMA_generate_common_url('', ''); ?>&amp;js_frame=left&amp;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 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 src="js/messages.php"></script>
<script type="text/javascript">
// <![CDATA[
var image_minus = '<?php echo $GLOBALS['pmaThemeImage']; ?>b_minus.png';
@ -305,9 +306,9 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
}
unset($table_list);
if ($db != 'information_schema') {
$class = '';
$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 .'">'
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>';
}