[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_1RC1-2044-g0b5f441

The branch, master has been updated via 0b5f4410cd653b2ce132e5f7537e03949cef59f9 (commit) via 293a7d6244264ce92165ba88dc61498f6ed9dc66 (commit) via 948b13f02b38dfdf67e50c1081b64dc7743f50ee (commit) via 07f553f3f28e92467b2dce98a25324dd5008eb4f (commit) via f0c56fd49a133c659e0c625b4fa8f0a3807f9582 (commit) via 42c36b1fb82af8fb60afd7861a4c217cc3cbabb8 (commit) via 0598d99925efdda3983656a6b9497e159f9d7e82 (commit) from 434d233e5b710dc6d3ac82b6825cf726aac22cb3 (commit) - Log ----------------------------------------------------------------- commit 0b5f4410cd653b2ce132e5f7537e03949cef59f9 Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Fri May 27 15:56:15 2011 +0530 Changed the add columns fieldset to top of the create table form commit 293a7d6244264ce92165ba88dc61498f6ed9dc66 Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Fri May 27 15:55:02 2011 +0530 Changed the number of columns in the create table dialog in to defalut value 2 commit 948b13f02b38dfdf67e50c1081b64dc7743f50ee Merge: 07f553f3f28e92467b2dce98a25324dd5008eb4f 434d233e5b710dc6d3ac82b6825cf726aac22cb3 Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Fri May 27 15:46:12 2011 +0530 Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin commit 07f553f3f28e92467b2dce98a25324dd5008eb4f Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Wed May 25 23:32:43 2011 +0530 Added the PMA_createTableDialog function in functions js file commit f0c56fd49a133c659e0c625b4fa8f0a3807f9582 Merge: 76194fd122690cbe3947bfa25ae5d40de82d1d35 42c36b1fb82af8fb60afd7861a4c217cc3cbabb8 Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Wed May 25 22:29:17 2011 +0530 merged chages in navigation.js commit 42c36b1fb82af8fb60afd7861a4c217cc3cbabb8 Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Wed May 25 21:03:13 2011 +0530 Bug fixed the create table option in navigation panel commit 0598d99925efdda3983656a6b9497e159f9d7e82 Author: Thilanka Kaushalya <lgtkaushalya@gmail.com> Date: Sat May 21 16:45:51 2011 +0530 Ajaxify the create table option in navigation panel - have bugs ----------------------------------------------------------------------- Summary of changes: js/functions.js | 98 +++++++++++++++++++++----------------- js/navigation.js | 20 +++++++- libraries/common.inc.php | 1 + libraries/tbl_properties.inc.php | 29 +++++------ navigation.php | 6 ++- 5 files changed, 94 insertions(+), 60 deletions(-) diff --git a/js/functions.js b/js/functions.js index c9f6112..be5a8bb 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1310,6 +1310,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(''); diff --git a/js/navigation.js b/js/navigation.js index 52d13cf..7f9a013 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -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 + diff --git a/libraries/common.inc.php b/libraries/common.inc.php index d75084b..70b70fe 100644 --- a/libraries/common.inc.php +++ b/libraries/common.inc.php @@ -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'; /** diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 395fa7b..501e243 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -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> diff --git a/navigation.php b/navigation.php index ac12807..dc68489 100644 --- a/navigation.php +++ b/navigation.php @@ -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>'; } hooks/post-receive -- phpMyAdmin
participants (1)
-
Marc Delisle