diff --git a/ChangeLog b/ChangeLog index 39086e627f..38cfe699ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -59,6 +59,7 @@ phpMyAdmin - ChangeLog + rfe #3406797 [navi] Stick table tools to top of page on scroll + rfe #1632106 [interface] Improved error handling + patch #3432835 [interface] Add useful intermediate pages to pageselector ++ [interface] Improved index editor 3.4.8.0 (not yet released) - bug #3425230 [interface] enum data split at space char (more space to edit) diff --git a/js/functions.js b/js/functions.js index 4377a1dcda..d96f15ed5b 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3079,7 +3079,7 @@ function PMA_init_slider() } $this.addClass('slider_init_done'); - var $wrapper = $('
', {'class': 'slide-wrapper'}).css('height', $this.outerHeight(true)); + var $wrapper = $('
', {'class': 'slide-wrapper'}); $wrapper.toggle($this.is(':visible')); $('', {href: '#'+this.id}) .text(this.title) diff --git a/js/messages.php b/js/messages.php index 5b6257b180..5a75ece7bc 100644 --- a/js/messages.php +++ b/js/messages.php @@ -45,6 +45,9 @@ $js_messages['strBLOBRepositoryDisableAreYouSure'] = sprintf(__('Are you sure yo /* For indexes */ $js_messages['strFormEmpty'] = __('Missing value in the form!'); $js_messages['strNotNumber'] = __('This is not a number!'); +$js_messages['strAddIndex'] = __('Add Index'); +$js_messages['strEditIndex'] = __('Edit Index'); +$js_messages['strAddToIndex'] = __('Add %d column(s) to index'); /* Charts */ /* l10n: Default description for the y-Axis of Charts */ diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 8bbd8bb493..f02572f8ad 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -18,7 +18,6 @@ * */ $(document).ready(function() { - /** * Attach Event Handler for 'Drop Column' * @@ -56,7 +55,7 @@ $(document).ready(function() { $(curr_row).hide("medium").remove(); } else { - PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error); + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false); } }) // end $.get() }); // end $.PMA_confirm() @@ -98,7 +97,7 @@ $(document).ready(function() { } } else { - PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error); + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false); } }) // end $.get() }) // end $.PMA_confirm() @@ -137,17 +136,30 @@ $(document).ready(function() { $.get(url, {'is_js_confirmed': 1, 'ajax_request': true}, function(data) { if(data.success == true) { PMA_ajaxShowMessage(data.message); - $rows_to_hide.hide("medium").remove(); + var $table_ref = $rows_to_hide.closest('table'); + if ($rows_to_hide.length == $table_ref.find('tbody > tr').length) { + // We are about to remove all rows from the table + $table_ref.hide('medium', function() { + $('.no_indexes_defined').show('medium'); + $rows_to_hide.remove(); + }); + $table_ref.siblings('div.notice').hide('medium'); + } else { + // We are removing some of the rows only + $rows_to_hide.hide("medium", function () { + $(this).remove(); + }); + } } else { - PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error); + PMA_ajaxShowMessage(PMA_messages['strErrorProcessingRequest'] + " : " + data.error, false); } }) // end $.get() }) // end $.PMA_confirm() }) //end Drop Primary Key/Index /** - *Ajax event handler for muti column change + *Ajax event handler for multi column change **/ $("#fieldsForm.ajax .mult_submit[value=change]").live('click', function(event){ event.preventDefault(); @@ -184,13 +196,29 @@ $(document).ready(function() { /** *Ajax event handler for index edit **/ - $("#table_index tbody tr td.edit_index.ajax").live('click', function(event){ + $("#table_index tbody tr td.edit_index.ajax, #indexes .add_index.ajax").live('click', function(event){ event.preventDefault(); - var url = $(this).find("a").attr("href"); - if (url.substring(0, 16) == "tbl_indexes.php?") { - url = url.substring(16, url.length ); + if ($(this).find("a").length == 0) { + // Add index + var valid = checkFormElementInRange( + $(this).closest('form')[0], + 'added_fields', + 'Column count has to be larger than zero.' + ); + if (! valid) { + return; + } + var url = $(this).closest('form').serialize(); + var title = PMA_messages['strAddIndex']; + } else { + // Edit index + var url = $(this).find("a").attr("href"); + if (url.substring(0, 16) == "tbl_indexes.php?") { + url = url.substring(16, url.length ); + } + var title = PMA_messages['strEditIndex']; } - url = url + "&ajax_request=true"; + url += "&ajax_request=true"; /*Remove the hidden dialogs if there are*/ if ($('#edit_index_dialog').length != 0) { @@ -199,142 +227,111 @@ $(document).ready(function() { var $div = $('
'); /** - * @var button_options Object that stores the options passed to jQueryUI - * dialog + * @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(); - - $.get( "tbl_indexes.php" , 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['strEdit'], - height: 230, - width: 900, - open: PMA_verifyColumnsProperties, - modal: true, - buttons : button_options_error - })// end dialog options - } else { - $div - .append(data) - .dialog({ - title: PMA_messages['strEdit'], - height: 600, - width: 900, - open: PMA_verifyColumnsProperties, - modal: true, - buttons : button_options - }) - //Remove the top menu container from the dialog - .find("#topmenucontainer").hide() - ; // end dialog options - checkIndexType(); - checkIndexName("index_frm"); - } - PMA_ajaxRemoveMessage($msgbox); - }) // end $.get() - }); - - /** - *Ajax action for submiting the index form - **/ - $("#index_frm.ajax input[name=do_save_data]").live('click', function(event) { - event.preventDefault(); - /** - * @var the_form object referring to the export form - */ - var $form = $("#index_frm"); - - PMA_prepareForAjaxRequest($form); - //User wants to submit the form - $.post($form.attr('action'), $form.serialize()+"&do_save_data=Save", function(data) { - if ($("#sqlqueryresults").length != 0) { - $("#sqlqueryresults").remove(); - } - if (data.success == true) { - PMA_ajaxShowMessage(data.message); - $("
").insertAfter("#floating_menubar"); - $("#sqlqueryresults").html(data.sql_query); - $("#result_query .notice").remove(); - $("#result_query").prepend((data.message)); - - /*Reload the field form*/ - $("#table_index").remove(); - var $temp_div = $("
").append(data.index_table); - $temp_div.find("#table_index").insertAfter("#index_header"); - if ($("#edit_index_dialog").length > 0) { - $("#edit_index_dialog").dialog("close").remove(); + button_options[PMA_messages['strGo']] = function() { + /** + * @var the_form object referring to the export form + */ + var $form = $("#index_frm"); + PMA_prepareForAjaxRequest($form); + //User wants to submit the form + $.post($form.attr('action'), $form.serialize()+"&do_save_data=1", function(data) { + if ($("#sqlqueryresults").length != 0) { + $("#sqlqueryresults").remove(); } + if (data.success == true) { + PMA_ajaxShowMessage(data.message); + $("
").insertAfter("#floating_menubar"); + $("#sqlqueryresults").html(data.sql_query); + $("#result_query .notice").remove(); + $("#result_query").prepend(data.message); - } else { - if(data.error != undefined) { + /*Reload the field form*/ + $("#table_index").remove(); + var $temp_div = $("
").append(data.index_table); + $temp_div.find("#table_index").insertAfter("#index_header"); + if ($("#edit_index_dialog").length > 0) { + $("#edit_index_dialog").dialog("close"); + } + } else if (data.error != undefined) { var $temp_div = $("
").append(data.error); if ($temp_div.find(".error code").length != 0) { var $error = $temp_div.find(".error code").addClass("error"); } else { var $error = $temp_div; } + PMA_ajaxShowMessage($error, false); } - PMA_ajaxShowMessage($error); + }) // end $.post() + } + button_options[PMA_messages['strCancel']] = function() { + $(this).dialog('close'); + } + var $msgbox = PMA_ajaxShowMessage(); + $.get("tbl_indexes.php", url, function(data) { + if (data.error) { + //in the case of an error, show the error message returned. + PMA_ajaxShowMessage(data.error, false); + } else { + PMA_ajaxRemoveMessage($msgbox); + // Show dialog if the request was successful + $div + .append(data) + .dialog({ + title: title, + width: 450, + open: PMA_verifyColumnsProperties, + modal: true, + buttons: button_options, + close: function () { + $(this).remove(); + } + }); + checkIndexType(); + checkIndexName("index_frm"); + PMA_convertFootnotesToTooltips($div); + // Add a slider for selecting how many columns to add to the index + $div.find('.slider').slider({ + animate: true, + value: 1, + min: 1, + max: 16, + slide: function( event, ui ) { + $(this).closest('fieldset').find('input[type=submit]').val( + PMA_messages['strAddToIndex'].replace(/%d/, ui.value) + ); + } + }); + // Focus the slider, otherwise it looks nearly transparent + $('.ui-slider-handle').addClass('ui-state-focus'); } - - }) // end $.post() - }) // end insert table button "do_save_data" + }) // end $.get() + }); /** - *Ajax action for submiting the index form for add more columns - **/ - $("#index_frm.ajax input[name=add_fields]").live('click', function(event) { + * Handler for adding more columns to an index in the editor + */ + $('#index_frm input[type=submit]').live('click', function(event) { event.preventDefault(); - /** - * @var the_form object referring to the export form - */ - var $form = $("#index_frm"); - - PMA_prepareForAjaxRequest($form); - //User wants to submit the form - $.post($form.attr('action'), $form.serialize()+"&add_fields=Go", function(data) { - $("#index_columns").remove(); - var $temp_div = $("
").append(data); - $temp_div.find("#index_columns").appendTo("#index_edit_fields"); - }) // end $.post() - }) // end insert table button "Go" - - /**Add the show/hide index table option if the index is available*/ - if ($("#index_div.ajax").find("#table_index").length != 0) { - /** - *Prepare a div containing a link for toggle the index table - */ - $('
') - .insertAfter('#index_div') - /** don't show it until we have index table on-screen */ - .show(); - - /** Changing the displayed text according to the hide/show criteria in table index*/ - - $('#toggletableindexlink') - .html(PMA_messages['strHideIndexes']) - .bind('click', function() { - var $link = $(this); - $('#index_div').slideToggle(); - if ($link.text() == PMA_messages['strHideIndexes']) { - $link.text(PMA_messages['strShowIndexes']); - } else { - $link.text(PMA_messages['strHideIndexes']); - } - /** avoid default click action */ - return false; - }); - } //end show/hide table index + var rows_to_add = $(this) + .closest('fieldset') + .find('.slider') + .slider('value'); + while (rows_to_add--) { + var $newrow = $('#index_columns') + .find('tbody > tr:first') + .clone() + .appendTo( + $('#index_columns').find('tbody') + ); + $newrow.find(':input').each(function() { + $(this).val(''); + }); + } + }); /** *Ajax event handler for Add column(s) @@ -385,10 +382,7 @@ $(document).ready(function() { open: PMA_verifyColumnsProperties, modal: true, buttons : button_options - }) - //Remove the top menu container from the dialog - .find("#topmenucontainer").hide() - ; // end dialog options + }); // end dialog options $div = $("#add_columns"); /*changed the z-index of the enum editor to allow the edit*/ @@ -454,10 +448,7 @@ function changeColumns(action,url) modal: true, open: PMA_verifyColumnsProperties, buttons : button_options - }) - //Remove the top menu container from the dialog - .find("#topmenucontainer").hide() - ; // end dialog options + }); // end dialog options $("#append_fields_form input[name=do_save_data]").addClass("ajax"); /*changed the z-index of the enum editor to allow the edit*/ $("#enum_editor").css("z-index", "1100"); diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js index ce3de9daae..4fad9c8b79 100644 --- a/js/tbl_zoom_plot.js +++ b/js/tbl_zoom_plot.js @@ -248,23 +248,11 @@ $(document).ready(function() { /** ** Set dialog properties for the data display form **/ - $("#dataDisplay").dialog({ - autoOpen: false, - title: 'Data point content', - modal: false, //false otherwise other dialogues like timepicker may not function properly - height: $('#dataDisplay').height() + 80, - width: $('#dataDisplay').width() + 80 - }); - + var buttonOptions = {}; /* - * Handle submit of zoom_display_form + * Handle saving of a row in the editor */ - - $("#submitForm").click(function(event) { - - //Prevent default submission of form - event.preventDefault(); - + buttonOptions[PMA_messages['strSave']] = function () { //Find changed values by comparing form values with selectedRow Object var newValues = new Object();//Stores the values changed from original var sqlTypes = new Object(); @@ -461,8 +449,35 @@ $(document).ready(function() { } }); //End $.post }//End database update - $("#dataDisplay").dialog("close"); - });//End submit handler + $("#dataDisplay").dialog('close'); + }; + buttonOptions[PMA_messages['strCancel']] = function () { + $(this).dialog('close'); + }; + $("#dataDisplay").dialog({ + autoOpen: false, + title: 'Data point content', + modal: true, + buttons: buttonOptions, + width: $('#dataDisplay').width() + 24, + open: function () { + $(this).find('input[type=checkbox]').css('margin', '0.5em'); + } + }); + /** + * Attach Ajax event handlers for input fields + * in the dialog. Used to submit the Ajax + * request when the ENTER key is pressed. + */ + $("#dataDisplay").find(':input').live('keydown', function (e) { + if (e.which === 13) { // 13 is the ENTER key + e.preventDefault(); + if (typeof buttonOptions[PMA_messages['strSave']] === 'function') { + buttonOptions[PMA_messages['strSave']].call(); + } + } + }); + /* * Generate plot using Highcharts diff --git a/libraries/Index.class.php b/libraries/Index.class.php index d790df9136..6c6f8ba7da 100644 --- a/libraries/Index.class.php +++ b/libraries/Index.class.php @@ -414,15 +414,23 @@ class PMA_Index { $indexes = PMA_Index::getFromTable($table, $schema); - if (count($indexes) < 1) { - return PMA_Message::error(__('No index defined!'))->getDisplay(); - } + $no_indexes_class = count($indexes) > 0 ? ' hide' : ''; + $no_indexes = "
"; + $no_indexes .= PMA_Message::notice(__('No index defined!'))->getDisplay(); + $no_indexes .= '
'; - $r = ''; - - $r .= '

' . __('Indexes') . ': '; + $r = '
'; + $r .= '' . __('Indexes'); $r .= PMA_showMySQLDocu('optimization', 'optimizing-database-structure'); - $r .= '

'; + $r .= ''; + $r .= $no_indexes; + if (count($indexes) < 1) { + $r .= ''; + return $r; + } + if (! $print_mode) { + $r .= PMA_Index::findDuplicates($table, $schema); + } $r .= ''; $r .= ''; $r .= ''; @@ -512,10 +520,7 @@ class PMA_Index } // end while $r .= ''; $r .= '
'; - - if (! $print_mode) { - $r .= PMA_Index::findDuplicates($table, $schema); - } + $r .= ''; return $r; } @@ -565,7 +570,7 @@ class PMA_Index // did not find any difference // so it makes no sense to have this two equal indexes - $message = PMA_Message::error(__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.')); + $message = PMA_Message::notice(__('The indexes %1$s and %2$s seem to be equal and one of them could possibly be removed.')); $message->addParam($each_index->getName()); $message->addParam($while_index->getName()); $output .= $message->getDisplay(); diff --git a/tbl_alter.php b/tbl_alter.php index aace3169db..8efee90bc8 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -156,7 +156,9 @@ if (isset($_REQUEST['do_save_data'])) { * $selected comes from multi_submits.inc.php */ if ($abort == false) { - include_once './libraries/tbl_links.inc.php'; + if ($_REQUEST['ajax_request'] != true) { + include_once './libraries/tbl_links.inc.php'; + } if (! isset($selected)) { PMA_checkParameters(array('field')); diff --git a/tbl_indexes.php b/tbl_indexes.php index f06a751b04..3a1a8635a3 100644 --- a/tbl_indexes.php +++ b/tbl_indexes.php @@ -123,9 +123,10 @@ if (isset($_REQUEST['do_save_data'])) { // Displays headers (if needed) $GLOBALS['js_include'][] = 'indexes.js'; - require_once './libraries/tbl_info.inc.php'; -require_once './libraries/tbl_links.inc.php'; +if ($GLOBALS['is_ajax_request'] != true) { + require_once './libraries/tbl_links.inc.php'; +} if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) { // coming already from form @@ -163,34 +164,43 @@ if (isset($_REQUEST['create_index'])) { echo PMA_generate_common_hidden_inputs($form_params); ?>
+ must be the name of and only of a primary key!)'))->display(); +} ?> -
+
+ +
+ + +must be the name of and only of a primary key!)'))); ?> + - - -
+
+ + + + - +
-

- @@ -206,7 +216,7 @@ $spatial_types = array( ); foreach ($index->getColumns() as $column) { ?> - + +
-
+ ') . "\n"; -echo '' . "\n"; +printf( + __('Add to index  %s column(s)') . "\n", + '' +); +echo '' . "\n"; ?> +
'; + echo '
'; + echo ''; + echo '
'; + } +?> 20) { */ if (! $tbl_is_view && ! $db_is_information_schema && 'ARCHIVE' != $tbl_type) { + PMA_generate_slider_effect('indexes', __('Indexes')); /** * Display indexes */ echo PMA_Index::getView($table, $db); ?> +
+
+ '); + ?> + + +
+
+
-
-
- '); - ?> - -
-
-
+
+ @@ -933,7 +934,7 @@ if ($cfg['ShowStats']) { ?>
- +
diff --git a/tbl_zoom_select.php b/tbl_zoom_select.php index 739a509633..52293b178c 100644 --- a/tbl_zoom_select.php +++ b/tbl_zoom_select.php @@ -426,9 +426,8 @@ if (isset($zoom_submit) && $inputs[0] != 'pma_null' && $inputs[1] != 'pma_null' } ?> - - +
/* end topmenu */ +/* zoom search */ +div#dataDisplay input, div#dataDisplay select { + margin: 0; + margin-: 0.5em; +} +div#dataDisplay th { + line-height: 2em; +} /* Calendar */ table.calendar { @@ -1736,6 +1744,48 @@ td.more_opts { white-space: nowrap; } +/** + * Indexes + */ +#index_frm .index_info input, +#index_frm .index_info select { + width: 100%; + box-sizing: border-box; + -ms-box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; +} + +#index_frm .slider { + width: 10em; + margin: 0.6em; + float: ; +} + +#index_frm .add_fields { + float: ; +} + +#index_frm .add_fields input { + margin-: 1em; +} + +#index_frm input { + margin: 0; +} + +#index_frm td { + vertical-align: middle; +} + +table#index_columns { + width: 100%; +} + +table#index_columns select { + width: 100%; +} + iframe.IE_hack { z-index: 1; position: absolute; diff --git a/themes/pmahomme/css/theme_right.css.php b/themes/pmahomme/css/theme_right.css.php index a2b594be96..db300f32d6 100644 --- a/themes/pmahomme/css/theme_right.css.php +++ b/themes/pmahomme/css/theme_right.css.php @@ -1020,6 +1020,14 @@ a.error { /* end topmenu */ +/* zoom search */ +div#dataDisplay input, div#dataDisplay select { + margin: 0; + margin-: 0.5em; +} +div#dataDisplay th { + line-height: 2em; +} /* Calendar */ table.calendar { @@ -2119,6 +2127,48 @@ td.more_opts { white-space: nowrap; } +/** + * Indexes + */ +#index_frm .index_info input, +#index_frm .index_info select { + width: 100%; + box-sizing: border-box; + -ms-box-sizing: border-box; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; +} + +#index_frm .slider { + width: 10em; + margin: 0.6em; + float: ; +} + +#index_frm .add_fields { + float: ; +} + +#index_frm .add_fields input { + margin-: 1em; +} + +#index_frm input { + margin: 0; +} + +#index_frm td { + vertical-align: middle; +} + +table#index_columns { + width: 100%; +} + +table#index_columns select { + width: 100%; +} + iframe.IE_hack { z-index: 1; position: absolute;