1/* vim: set expandtab sw=4 ts=4 sts=4: */ 2/** 3 * @fileoverview function used for index manipulation pages 4 * @name Table Structure 5 * 6 * @requires jQuery 7 * @requires jQueryUI 8 * @required js/functions.js 9 */ 10 11/** 12 * Returns the array of indexes based on the index choice 13 * 14 * @param index_choice index choice 15 */ 16function PMA_getIndexArray (index_choice) { 17 var source_array = null; 18 19 switch (index_choice.toLowerCase()) { 20 case 'primary': 21 source_array = primary_indexes; 22 break; 23 case 'unique': 24 source_array = unique_indexes; 25 break; 26 case 'index': 27 source_array = indexes; 28 break; 29 case 'fulltext': 30 source_array = fulltext_indexes; 31 break; 32 case 'spatial': 33 source_array = spatial_indexes; 34 break; 35 default: 36 return null; 37 } 38 return source_array; 39} 40 41/** 42 * Hides/shows the inputs and submits appropriately depending 43 * on whether the index type chosen is 'SPATIAL' or not. 44 */ 45function checkIndexType () { 46 /** 47 * @var Object Dropdown to select the index choice. 48 */ 49 var $select_index_choice = $('#select_index_choice'); 50 /** 51 * @var Object Dropdown to select the index type. 52 */ 53 var $select_index_type = $('#select_index_type'); 54 /** 55 * @var Object Table header for the size column. 56 */ 57 var $size_header = $('#index_columns').find('thead tr th:nth-child(2)'); 58 /** 59 * @var Object Inputs to specify the columns for the index. 60 */ 61 var $column_inputs = $('select[name="index[columns][names][]"]'); 62 /** 63 * @var Object Inputs to specify sizes for columns of the index. 64 */ 65 var $size_inputs = $('input[name="index[columns][sub_parts][]"]'); 66 /** 67 * @var Object Footer containg the controllers to add more columns 68 */ 69 var $add_more = $('#index_frm').find('.add_more'); 70 71 if ($select_index_choice.val() === 'SPATIAL') { 72 // Disable and hide the size column 73 $size_header.hide(); 74 $size_inputs.each(function () { 75 $(this) 76 .prop('disabled', true) 77 .parent('td').hide(); 78 }); 79 80 // Disable and hide the columns of the index other than the first one 81 var initial = true; 82 $column_inputs.each(function () { 83 $column_input = $(this); 84 if (! initial) { 85 $column_input 86 .prop('disabled', true) 87 .parent('td').hide(); 88 } else { 89 initial = false; 90 } 91 }); 92 93 // Hide controllers to add more columns 94 $add_more.hide(); 95 } else { 96 // Enable and show the size column 97 $size_header.show(); 98 $size_inputs.each(function () { 99 $(this) 100 .prop('disabled', false) 101 .parent('td').show(); 102 }); 103 104 // Enable and show the columns of the index 105 $column_inputs.each(function () { 106 $(this) 107 .prop('disabled', false) 108 .parent('td').show(); 109 }); 110 111 // Show controllers to add more columns 112 $add_more.show(); 113 } 114 115 if ($select_index_choice.val() === 'SPATIAL' || 116 $select_index_choice.val() === 'FULLTEXT') { 117 $select_index_type.val('').prop('disabled', true); 118 } else { 119 $select_index_type.prop('disabled', false); 120 } 121} 122 123/** 124 * Sets current index information into form parameters. 125 * 126 * @param array source_array Array containing index columns 127 * @param string index_choice Choice of index 128 * 129 * @return void 130 */ 131function PMA_setIndexFormParameters (source_array, index_choice) { 132 if (index_choice === 'index') { 133 $('input[name="indexes"]').val(JSON.stringify(source_array)); 134 } else { 135 $('input[name="' + index_choice + '_indexes"]').val(JSON.stringify(source_array)); 136 } 137} 138 139/** 140 * Removes a column from an Index. 141 * 142 * @param string col_index Index of column in form 143 * 144 * @return void 145 */ 146function PMA_removeColumnFromIndex (col_index) { 147 // Get previous index details. 148 var previous_index = $('select[name="field_key[' + col_index + ']"]') 149 .attr('data-index'); 150 if (previous_index.length) { 151 previous_index = previous_index.split(','); 152 var source_array = PMA_getIndexArray(previous_index[0]); 153 if (source_array === null) { 154 return; 155 } 156
157 // Remove column from index array. 158 var source_length = source_array[previous_index[1]].columns.length; 159 for (var i = 0; i < source_length; i++) { 160 if (source_array[previous_index[1]].columns[i].col_index === col_index) { 161 source_array[previous_index[1]].columns.splice(i, 1); 162 } 163 } 164 165 // Remove index completely if no columns left. 166 if (source_array[previous_index[1]].columns.length === 0) { 167 source_array.splice(previous_index[1], 1); 168 } 169 170 // Update current index details. 171 $('select[name="field_key[' + col_index + ']"]').attr('data-index', ''); 172 // Update form index parameters. 173 PMA_setIndexFormParameters(source_array, previous_index[0].toLowerCase()); 174 } 175} 176 177/** 178 * Adds a column to an Index. 179 * 180 * @param array source_array Array holding corresponding indexes 181 * @param string array_index Index of an INDEX in array 182 * @param string index_choice Choice of Index 183 * @param string col_index Index of column on form 184 * 185 * @return void 186 */ 187function PMA_addColumnToIndex (source_array, array_index, index_choice, col_index) { 188 if (col_index >= 0) { 189 // Remove column from other indexes (if any). 190 PMA_removeColumnFromIndex(col_index); 191 } 192 var index_name = $('input[name="index[Key_name]"]').val(); 193 var index_comment = $('input[name="index[Index_comment]"]').val(); 194 var key_block_size = $('input[name="index[Key_block_size]"]').val(); 195 var parser = $('input[name="index[Parser]"]').val(); 196 var index_type = $('select[name="index[Index_type]"]').val(); 197 var columns = []; 198 $('#index_columns').find('tbody').find('tr').each(function () { 199 // Get columns in particular order. 200 var col_index = $(this).find('select[name="index[columns][names][]"]').val(); 201 var size = $(this).find('input[name="index[columns][sub_parts][]"]').val(); 202 columns.push({ 203 'col_index': col_index, 204 'size': size 205 }); 206 }); 207 208 // Update or create an index. 209 source_array[array_index] = { 210 'Key_name': index_name, 211 'Index_comment': index_comment, 212 'Index_choice': index_choice.toUpperCase(), 213 'Key_block_size': key_block_size, 214 'Parser': parser, 215 'Index_type': index_type, 216 'columns': columns 217 }; 218 219 // Display index name (or column list) 220 var displayName = index_name; 221 if (displayName === '') { 222 var columnNames = []; 223 $.each(columns, function () { 224 columnNames.push($('input[name="field_name[' + this.col_index + ']"]').val()); 225 }); 226 displayName = '[' + columnNames.join(', ') + ']'; 227 } 228 $.each(columns, function () { 229 var id = 'index_name_' + this.col_index + '_8'; 230 var $name = $('#' + id); 231 if ($name.length === 0) { 232 $name = $('<a id="' + id + '" href="#" class="ajax show_index_dialog"></a>'); 233 $name.insertAfter($('select[name="field_key[' + this.col_index + ']"]')); 234 } 235 var $text = $('<small>').text(displayName); 236 $name.html($text); 237 }); 238 239 if (col_index >= 0) { 240 // Update index details on form. 241 $('select[name="field_key[' + col_index + ']"]') 242 .attr('data-index', index_choice + ',' + array_index); 243 } 244 PMA_setIndexFormParameters(source_array, index_choice.toLowerCase()); 245} 246 247/** 248 * Get choices list for a column to create a composite index with. 249 * 250 * @param string index_choice Choice of index 251 * @param array source_array Array hodling columns for particular index 252 * 253 * @return jQuery Object 254 */ 255function PMA_getCompositeIndexList (source_array, col_index) { 256 // Remove any previous list. 257 if ($('#composite_index_list').length) { 258 $('#composite_index_list').remove(); 259 } 260 261 // Html list. 262 var $composite_index_list = $( 263 '<ul id="composite_index_list">' + 264 '<div>' + PMA_messages.strCompositeWith + '</div>' + 265 '</ul>' 266 ); 267 268 // Add each column to list available for composite index. 269 var source_length = source_array.length; 270 var already_present = false;
271 for (var i = 0; i < source_length; i++) { 272 var sub_array_len = source_array[i].columns.length; 273 var column_names = []; 274 for (var j = 0; j < sub_array_len; j++) { 275 column_names.push( 276 $('input[name="field_name[' + source_array[i].columns[j].col_index + ']"]').val() 277 ); 278 279 if (col_index === source_array[i].columns[j].col_index) { 280 already_present = true; 281 } 282 } 283 284 $composite_index_list.append( 285 '<li>' + 286 '<input type="radio" name="composite_with" ' + 287 (already_present ? 'checked="checked"' : '') + 288 ' id="composite_index_' + i + '" value="' + i + '">' + 289 '<label for="composite_index_' + i + '">' + column_names.join(', ') + 290 '</lablel>' + 291 '</li>' 292 ); 293 } 294 295 return $composite_index_list; 296} 297 298/** 299 * Shows 'Add Index' dialog. 300 * 301 * @param array source_array Array holding particluar index 302 * @param string array_index Index of an INDEX in array 303 * @param array target_columns Columns for an INDEX 304 * @param string col_index Index of column on form 305 * @param object index Index detail object 306 * 307 * @return void 308 */ 309function PMA_showAddIndexDialog (source_array, array_index, target_columns, col_index, index) { 310 // Prepare post-data. 311 var $table = $('input[name="table"]'); 312 var table = $table.length > 0 ? $table.val() : ''; 313 var post_data = { 314 server: PMA_commonParams.get('server'), 315 db: $('input[name="db"]').val(), 316 table: table, 317 ajax_request: 1, 318 create_edit_table: 1, 319 index: index 320 }; 321 322 var columns = {}; 323 for (var i = 0; i < target_columns.length; i++) { 324 var column_name = $('input[name="field_name[' + target_columns[i] + ']"]').val(); 325 var column_type = $('select[name="field_type[' + target_columns[i] + ']"]').val().toLowerCase(); 326 columns[column_name] = [column_type, target_columns[i]]; 327 } 328 post_data.columns = JSON.stringify(columns); 329 330 var button_options = {}; 331 button_options[PMA_messages.strGo] = function () { 332 var is_missing_value = false; 333 $('select[name="index[columns][names][]"]').each(function () { 334 if ($(this).val() === '') { 335 is_missing_value = true; 336 } 337 }); 338 339 if (! is_missing_value) { 340 PMA_addColumnToIndex( 341 source_array, 342 array_index, 343 index.Index_choice, 344 col_index 345 ); 346 } else { 347 PMA_ajaxShowMessage( 348 '<div class="error"><img src="themes/dot.gif" title="" alt=""' + 349 ' class="icon ic_s_error" /> ' + PMA_messages.strMissingColumn + 350 ' </div>', false 351 ); 352 353 return false; 354 } 355 356 $(this).dialog('close'); 357 }; 358 button_options[PMA_messages.strCancel] = function () { 359 if (col_index >= 0) { 360 // Handle state on 'Cancel'. 361 var $select_list = $('select[name="field_key[' + col_index + ']"]'); 362 if (! $select_list.attr('data-index').length) { 363 $select_list.find('option[value*="none"]').attr('selected', 'selected'); 364 } else { 365 var previous_index = $select_list.attr('data-index').split(','); 366 $select_list.find('option[value*="' + previous_index[0].toLowerCase() + '"]') 367 .attr('selected', 'selected'); 368 } 369 } 370 $(this).dialog('close'); 371 }; 372 var $msgbox = PMA_ajaxShowMessage(); 373 $.post('tbl_indexes.php', post_data, function (data) { 374 if (data.success === false) { 375 // in the case of an error, show the error message returned. 376 PMA_ajaxShowMessage(data.error, false); 377 } else { 378 PMA_ajaxRemoveMessage($msgbox); 379 // Show dialog if the request was successful 380 var $div = $('<div/>'); 381 $div 382 .append(data.message) 383 .dialog({ 384 title: PMA_messages.strAddIndex, 385 width: 450, 386 minHeight: 250, 387 open: function () { 388 checkIndexName('index_frm'); 389 PMA_showHints($div); 390 PMA_init_slider(); 391 $('#index_columns').find('td').each(function () { 392 $(this).css('width', $(this).width() + 'px'); 393 }); 394 $('#index_columns').find('tbody').sortable({ 395 axis: 'y', 396 containment: $('#index_columns').find('tbody'), 397 tolerance: 'pointer' 398 }); 399 // We dont need the slider at this moment. 400 $(this).find('fieldset.tblFooters').remove(); 401 }, 402 modal: true, 403 buttons: button_options, 404 close: function () { 405 $(this).remove(); 406 } 407 }); 408 } 409 }); 410} 411 412/** 413 * Creates a advanced index type selection dialog. 414 * 415 * @param array source_array Array holding a particular type of indexes 416 * @param string index_choice Choice of index 417 * @param string col_index Index of new column on form 418 * 419 * @return void 420 */ 421function PMA_indexTypeSelectionDialog (source_array, index_choice, col_index) { 422 var $single_column_radio = $('<input type="radio" id="single_column" name="index_choice"' + 423 ' checked="checked">' + 424 '<label for="single_column">' + PMA_messages.strCreateSingleColumnIndex + '</label>'); 425 var $composite_index_radio = $('<input type="radio" id="composite_index"' + 426 ' name="index_choice">' + 427 '<label for="composite_index">' + PMA_messages.strCreateCompositeIndex + '</label>'); 428 var $dialog_content = $('<fieldset id="advance_index_creator"></fieldset>'); 429 $dialog_content.append('<legend>' + index_choice.toUpperCase() + '</legend>'); 430 431
432 // For UNIQUE/INDEX type, show choice for single-column and composite index. 433 $dialog_content.append($single_column_radio); 434 $dialog_content.append($composite_index_radio); 435 436 var button_options = {}; 437 // 'OK' operation. 438 button_options[PMA_messages.strGo] = function () { 439 if ($('#single_column').is(':checked')) { 440 var index = { 441 'Key_name': (index_choice === 'primary' ? 'PRIMARY' : ''), 442 'Index_choice': index_choice.toUpperCase() 443 }; 444 PMA_showAddIndexDialog(source_array, (source_array.length), [col_index], col_index, index); 445 } 446 447 if ($('#composite_index').is(':checked')) { 448 if ($('input[name="composite_with"]').length !== 0 && $('input[name="composite_with"]:checked').length === 0 449 ) { 450 PMA_ajaxShowMessage( 451 '<div class="error"><img src="themes/dot.gif" title=""' + 452 ' alt="" class="icon ic_s_error" /> ' + 453 PMA_messages.strFormEmpty + 454 ' </div>', 455 false 456 ); 457 return false; 458 } 459 460 var array_index = $('input[name="composite_with"]:checked').val(); 461 var source_length = source_array[array_index].columns.length; 462 var target_columns = []; 463 for (var i = 0; i < source_length; i++) { 464 target_columns.push(source_array[array_index].columns[i].col_index); 465 } 466 target_columns.push(col_index); 467 468 PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index, 469 source_array[array_index]); 470 } 471 472 $(this).remove(); 473 }; 474 button_options[PMA_messages.strCancel] = function () { 475 // Handle state on 'Cancel'. 476 var $select_list = $('select[name="field_key[' + col_index + ']"]'); 477 if (! $select_list.attr('data-index').length) { 478 $select_list.find('option[value*="none"]').attr('selected', 'selected'); 479 } else { 480 var previous_index = $select_list.attr('data-index').split(','); 481 $select_list.find('option[value*="' + previous_index[0].toLowerCase() + '"]') 482 .attr('selected', 'selected'); 483 } 484 $(this).remove(); 485 }; 486 var $dialog = $('<div/>').append($dialog_content).dialog({ 487 minWidth: 525, 488 minHeight: 200, 489 modal: true, 490 title: PMA_messages.strAddIndex, 491 resizable: false, 492 buttons: button_options, 493 open: function () { 494 $('#composite_index').on('change', function () { 495 if ($(this).is(':checked')) { 496 $dialog_content.append(PMA_getCompositeIndexList(source_array, col_index)); 497 } 498 }); 499 $('#single_column').on('change', function () { 500 if ($(this).is(':checked')) { 501 if ($('#composite_index_list').length) { 502 $('#composite_index_list').remove(); 503 } 504 } 505 }); 506 }, 507 close: function () { 508 $('#composite_index').off('change'); 509 $('#single_column').off('change'); 510 $(this).remove(); 511 } 512 }); 513} 514 515/** 516 * Unbind all event handlers before tearing down a page 517 */ 518AJAX.registerTeardown('indexes.js', function () { 519 $(document).off('click', '#save_index_frm'); 520 $(document).off('click', '#preview_index_frm'); 521 $(document).off('change', '#select_index_choice'); 522 $(document).off('click', 'a.drop_primary_key_index_anchor.ajax'); 523 $(document).off('click', '#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax'); 524 $(document).off('click', '#index_frm input[type=submit]'); 525 $('body').off('change', 'select[name*="field_key"]'); 526 $(document).off('click', '.show_index_dialog'); 527}); 528 529/** 530 * @description <p>Ajax scripts for table index page</p> 531 * 532 * Actions ajaxified here: 533 * <ul> 534 * <li>Showing/hiding inputs depending on the index type chosen</li> 535 * <li>create/edit/drop indexes</li> 536 * </ul> 537 */ 538AJAX.registerOnload('indexes.js', function () { 539 // Re-initialize variables. 540 primary_indexes = []; 541 unique_indexes = []; 542 indexes = []; 543 fulltext_indexes = []; 544 spatial_indexes = []; 545 546 // for table creation form 547 var $engine_selector = $('.create_table_form select[name=tbl_storage_engine]'); 548 if ($engine_selector.length) { 549 PMA_hideShowConnection($engine_selector); 550 } 551
552 var $form = $('#index_frm'); 553 if ($form.length > 0) { 554 showIndexEditDialog($form); 555 } 556 557 $(document).on('click', '#save_index_frm', function (event) { 558 event.preventDefault(); 559 var $form = $('#index_frm'); 560 var argsep = PMA_commonParams.get('arg_separator'); 561 var submitData = $form.serialize() + argsep + 'do_save_data=1' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true'; 562 var $msgbox = PMA_ajaxShowMessage(PMA_messages.strProcessingRequest); 563 AJAX.source = $form; 564 $.post($form.attr('action'), submitData, AJAX.responseHandler); 565 }); 566 567 $(document).on('click', '#preview_index_frm', function (event) { 568 event.preventDefault(); 569 PMA_previewSQL($('#index_frm')); 570 }); 571 572 $(document).on('change', '#select_index_choice', function (event) { 573 event.preventDefault(); 574 checkIndexType(); 575 checkIndexName('index_frm'); 576 }); 577 578 /** 579 * Ajax Event handler for 'Drop Index' 580 */ 581 $(document).on('click', 'a.drop_primary_key_index_anchor.ajax', function (event) { 582 event.preventDefault(); 583 var $anchor = $(this); 584 /** 585 * @var $curr_row Object containing reference to the current field's row 586 */ 587 var $curr_row = $anchor.parents('tr'); 588 /** @var Number of columns in the key */ 589 var rows = $anchor.parents('td').attr('rowspan') || 1; 590 /** @var Rows that should be hidden */ 591 var $rows_to_hide = $curr_row;
592 for (var i = 1, $last_row = $curr_row.next(); i < rows; i++, $last_row = $last_row.next()) { 593 $rows_to_hide = $rows_to_hide.add($last_row); 594 } 595 596 var question = escapeHtml( 597 $curr_row.children('td') 598 .children('.drop_primary_key_index_msg') 599 .val() 600 ); 601 602 $anchor.PMA_confirm(question, $anchor.attr('href'), function (url) { 603 var $msg = PMA_ajaxShowMessage(PMA_messages.strDroppingPrimaryKeyIndex, false); 604 var params = { 605 'is_js_confirmed': 1, 606 'ajax_request': true 607 }; 608 $.post(url, params, function (data) { 609 if (typeof data !== 'undefined' && data.success === true) { 610 PMA_ajaxRemoveMessage($msg); 611 var $table_ref = $rows_to_hide.closest('table'); 612 if ($rows_to_hide.length === $table_ref.find('tbody > tr').length) { 613 // We are about to remove all rows from the table 614 $table_ref.hide('medium', function () { 615 $('div.no_indexes_defined').show('medium'); 616 $rows_to_hide.remove(); 617 });
618 $table_ref.siblings('div.notice').hide('medium'); 619 } else { 620 // We are removing some of the rows only 621 $rows_to_hide.hide('medium', function () { 622 $(this).remove(); 623 }); 624 } 625 if ($('.result_query').length) { 626 $('.result_query').remove(); 627 } 628 if (data.sql_query) { 629 $('<div class="result_query"></div>') 630 .html(data.sql_query) 631 .prependTo('#structure_content'); 632 PMA_highlightSQL($('#page_content')); 633 } 634 PMA_commonActions.refreshMain(false, function () { 635 $('a.ajax[href^=#indexes]').click(); 636 }); 637 PMA_reloadNavigation(); 638 } else { 639 PMA_ajaxShowMessage(PMA_messages.strErrorProcessingRequest + ' : ' + data.error, false); 640 } 641 }); // end $.post() 642 }); // end $.PMA_confirm() 643 }); // end Drop Primary Key/Index 644 645 /** 646 *Ajax event handler for index edit 647 **/ 648 $(document).on('click', '#table_index tbody tr td.edit_index.ajax, #index_div .add_index.ajax', function (event) { 649 event.preventDefault(); 650 var url; 651 var title; 652 if ($(this).find('a').length === 0) { 653 // Add index 654 var valid = checkFormElementInRange( 655 $(this).closest('form')[0], 656 'added_fields', 657 'Column count has to be larger than zero.' 658 ); 659 if (! valid) { 660 return; 661 } 662 url = $(this).closest('form').serialize(); 663 title = PMA_messages.strAddIndex; 664 } else { 665 // Edit index 666 url = $(this).find('a').attr('href'); 667 if (url.substring(0, 16) === 'tbl_indexes.php?') { 668 url = url.substring(16, url.length); 669 } 670 title = PMA_messages.strEditIndex; 671 } 672 url += PMA_commonParams.get('arg_separator') + 'ajax_request=true'; 673 indexEditorDialog(url, title, function () { 674 // refresh the page using ajax 675 PMA_commonActions.refreshMain(false, function () { 676 $('a.ajax[href^=#indexes]').click(); 677 }); 678 }); 679 }); 680 681 /** 682 * Ajax event handler for advanced index creation during table creation 683 * and column addition. 684 */ 685 $('body').on('change', 'select[name*="field_key"]', function () { 686 // Index of column on Table edit and create page. 687 var col_index = /\d+/.exec($(this).attr('name')); 688 col_index = col_index[0]; 689 // Choice of selected index. 690 var index_choice = /[a-z]+/.exec($(this).val()); 691 index_choice = index_choice[0]; 692 // Array containing corresponding indexes. 693 var source_array = null; 694 695 if (index_choice === 'none') { 696 PMA_removeColumnFromIndex(col_index); 697 return false; 698 } 699 700 // Select a source array. 701 source_array = PMA_getIndexArray(index_choice); 702 if (source_array === null) { 703 return; 704 } 705 706 if (source_array.length === 0) { 707 var index = { 708 'Key_name': (index_choice === 'primary' ? 'PRIMARY' : ''), 709 'Index_choice': index_choice.toUpperCase() 710 }; 711 PMA_showAddIndexDialog(source_array, 0, [col_index], col_index, index); 712 } else { 713 if (index_choice === 'primary') { 714 var array_index = 0; 715 var source_length = source_array[array_index].columns.length; 716 var target_columns = []; 717 for (var i = 0; i < source_length; i++) { 718 target_columns.push(source_array[array_index].columns[i].col_index); 719 } 720 target_columns.push(col_index); 721 722 PMA_showAddIndexDialog(source_array, array_index, target_columns, col_index, 723 source_array[array_index]); 724 } else { 725 // If there are multiple columns selected for an index, show advanced dialog. 726 PMA_indexTypeSelectionDialog(source_array, index_choice, col_index); 727 } 728 } 729 }); 730 731 $(document).on('click', '.show_index_dialog', function (e) { 732 e.preventDefault(); 733 734 // Get index details. 735 var previous_index = $(this).prev('select') 736 .attr('data-index') 737 .split(','); 738 739 var index_choice = previous_index[0]; 740 var array_index = previous_index[1]; 741 742 var source_array = PMA_getIndexArray(index_choice); 743 var source_length = source_array[array_index].columns.length; 744 745 var target_columns = []; 746 for (var i = 0; i < source_length; i++) { 747 target_columns.push(source_array[array_index].columns[i].col_index); 748 } 749 750 PMA_showAddIndexDialog(source_array, array_index, target_columns, -1, source_array[array_index]); 751 }); 752 753 $('#index_frm').on('submit', function () { 754 if (typeof(this.elements['index[Key_name]'].disabled) !== 'undefined') { 755 this.elements['index[Key_name]'].disabled = false;
756 } 757 }); 758});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.