diff --git a/js/functions.js b/js/functions.js index ef1a1a1e93..0ae1deb2dc 100644 --- a/js/functions.js +++ b/js/functions.js @@ -2742,9 +2742,7 @@ AJAX.registerTeardown('functions.js', function () { $(document).off('submit', "form.create_table_form.ajax"); $(document).off('click', "form.create_table_form.ajax input[name=submit_num_fields]"); $(document).off('keyup', "form.create_table_form.ajax input"); - $(document).off('change', "form.create_table_form.ajax input[name=partition_count]," + - "form.create_table_form.ajax input[name=subpartition_count]," + - "form.create_table_form.ajax select[name=partition_by]"); + $(document).off('change', "input[name=partition_count],input[name=subpartition_count],select[name=partition_by]"); }); /** @@ -2913,10 +2911,14 @@ AJAX.registerOnload('functions.js', function () { /** * Attach event handler to manage changes in number of partitions and subpartitions */ - $(document).on('change', "form.create_table_form.ajax input[name=partition_count]," + - "form.create_table_form.ajax input[name=subpartition_count]," + - "form.create_table_form.ajax select[name=partition_by]", function (event) { - submitChangesInCreateTableForm('submit_partition_change=1'); + $(document).on('change', "input[name=partition_count],input[name=subpartition_count],select[name=partition_by]", function (event) { + $this = $(this); + $form = $this.parents('form'); + if ($form.is(".create_table_form.ajax")) { + submitChangesInCreateTableForm('submit_partition_change=1'); + } else { + $form.submit(); + } }); $("input[value=AUTO_INCREMENT]").change(function(){ diff --git a/js/messages.php b/js/messages.php index 61f72654b4..2e6a049219 100644 --- a/js/messages.php +++ b/js/messages.php @@ -63,6 +63,7 @@ $js_messages['strDeleteCentralColumnWarning'] = __('Do you really want to delete $js_messages['strDropRTEitems'] = __('Do you really want to delete the selected items?'); $js_messages['strDropPartitionWarning'] = __('Do you really want to DROP the selected partition(s)? This will also DELETE the data related to the selected partition(s)!'); $js_messages['strTruncatePartitionWarning'] = __('Do you really want to TRUNCATE the selected partition(s)?'); +$js_messages['strRemovePartitioningWarning'] = __('Do you really want to remove partitioning?'); $js_messages['strChangeColumnCollation'] = __( 'This operation will attempt to convert your data to the new collation. In ' . 'rare cases, especially where a character doesn\'t exist in the new ' diff --git a/js/tbl_structure.js b/js/tbl_structure.js index f8d1b952ca..c593298e0d 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -86,6 +86,7 @@ AJAX.registerTeardown('tbl_structure.js', function () { $(document).off('submit', ".append_fields_form.ajax"); $('body').off('click', '#fieldsForm.ajax button[name="submit_mult"], #fieldsForm.ajax input[name="submit_mult"]'); $(document).off('click', 'a[name^=partition_action].ajax'); + $(document).off('click', '#remove_partitioning.ajax'); }); AJAX.registerOnload('tbl_structure.js', function () { @@ -462,6 +463,21 @@ AJAX.registerOnload('tbl_structure.js', function () { submitPartitionAction($link.attr('href')); } }); + + /** + * Handles remove partitioning + */ + $(document).on('click', '#remove_partitioning.ajax', function (e) { + e.preventDefault(); + var $link = $(this); + var question = PMA_messages.strRemovePartitioningWarning; + $link.PMA_confirm(question, $link.attr('href'), function (url) { + var submitData = '&ajax_request=true&ajax_page_request=true'; + PMA_ajaxShowMessage(); + AJAX.source = $link; + $.post(url, submitData, AJAX.responseHandler); + }); + }); }); /** Handler for "More" dropdown in structure table rows */ diff --git a/libraries/controllers/TableStructureController.class.php b/libraries/controllers/TableStructureController.class.php index d8e71dfe8a..5c8682cf44 100644 --- a/libraries/controllers/TableStructureController.class.php +++ b/libraries/controllers/TableStructureController.class.php @@ -180,6 +180,16 @@ class TableStructureController extends TableController return; } + /** + * Adding or editing partitioning of the table + */ + if (isset($_REQUEST['edit_partitioning']) + && ! isset($_REQUEST['save_partitioning']) + ) { + $this->displayHtmlForPartitionChange(); + return; + } + /** * handle multiple field commands if required * @@ -271,6 +281,13 @@ class TableStructureController extends TableController } } + /** + * Modifications to the partitioning have been submitted -> updates the table + */ + if (isset($_REQUEST['save_partitioning'])) { + $this->updatePartitioning(); + } + /** * Adding indexes */ @@ -516,6 +533,224 @@ class TableStructureController extends TableController include 'libraries/tbl_columns_definition_form.inc.php'; } + /** + * Displays HTML for partition change + * + * @return string HTML for partition change + */ + protected function displayHtmlForPartitionChange() + { + $partitionDetails = null; + if (! isset($_REQUEST['partition_by'])) { + $partitionDetails = $this->_extractPartitionDetails(); + } + + include_once 'libraries/StorageEngine.class.php'; + $this->response->addHTML( + \PMA\Template::get('table/structure/partition_definition_form') + ->render( + array( + 'db' => $this->db, + 'table' => $this->table, + 'partitionDetails' => $partitionDetails + ) + ) + ); + } + + /** + * Extracts partition details from CREATE TABLE statement + * + * @return array[] array of partition details + */ + private function _extractPartitionDetails() + { + $createTable = (new \PMA_Table($this->table, $this->db))->showCreate(); + if (! $createTable) { + return null; + } + + $parser = new SqlParser\Parser($createTable); + /** + * @var $stmt SqlParser\Statements\CreateStatement + */ + $stmt = $parser->statements[0]; + + $partitionDetails = array(); + + $partitionDetails['partition_by'] = ''; + $partitionDetails['partition_expr'] = ''; + $partitionDetails['partition_count'] = ''; + + if (! empty($stmt->partitionBy)) { + $openPos = strpos($stmt->partitionBy, "("); + $closePos = strrpos($stmt->partitionBy, ")"); + + $partitionDetails['partition_by'] + = trim(substr($stmt->partitionBy, 0, $openPos)); + $partitionDetails['partition_expr'] + = trim(substr($stmt->partitionBy, $openPos + 1, $closePos - ($openPos + 1))); + if (isset($stmt->partitionsNum)) { + $count = $stmt->partitionsNum; + } else { + $count = count($stmt->partitions); + } + $partitionDetails['partition_count'] = $count; + } + + $partitionDetails['subpartition_by'] = ''; + $partitionDetails['subpartition_expr'] = ''; + $partitionDetails['subpartition_count'] = ''; + + if (! empty($stmt->subpartitionBy)) { + $openPos = strpos($stmt->subpartitionBy, "("); + $closePos = strrpos($stmt->subpartitionBy, ")"); + + $partitionDetails['subpartition_by'] + = trim(substr($stmt->subpartitionBy, 0, $openPos)); + $partitionDetails['subpartition_expr'] + = trim(substr($stmt->subpartitionBy, $openPos + 1, $closePos - ($openPos + 1))); + if (isset($stmt->subpartitionsNum)) { + $count = $stmt->subpartitionsNum; + } else { + $count = count($stmt->partitions[0]->subpartitions); + } + $partitionDetails['subpartition_count'] = $count; + } + + // Only LIST and RANGE type parameters allow subpartitioning + $partitionDetails['can_have_subpartitions'] + = $partitionDetails['partition_count'] > 1 + && ($partitionDetails['partition_by'] == 'RANGE' + || $partitionDetails['partition_by'] == 'LIST'); + + $partitionDetails['partitions'] = array(); + + for ($i = 0; $i < intval($partitionDetails['partition_count']); $i++) { + + if (! isset($stmt->partitions[$i])) { + $partitionDetails['partitions'][$i] = array( + 'value_type' => '', + 'value' => '', + 'engine' => '', + 'comment' => '', + 'data_directory' => '', + 'index_directory' => '', + 'max_rows' => '', + 'min_rows' => '', + 'tablespace' => '', + 'node_group' => '', + ); + } else { + $p = $stmt->partitions[$i]; + $type = $p->type; + $expr = trim($p->expr, '()'); + if ($expr == 'MAXVALUE') { + $type .= ' MAXVALUE'; + $expr = ''; + } + $partitionDetails['partitions'][$i] = array( + 'value_type' => $type, + 'value' => $expr, + 'engine' => $p->options->has('ENGINE', true), + 'comment' => trim($p->options->has('COMMENT', true), "'"), + 'data_directory' => trim($p->options->has('DATA DIRECTORY', true), "'"), + 'index_directory' => trim($p->options->has('INDEX_DIRECTORY', true), "'"), + 'max_rows' => $p->options->has('MAX_ROWS', true), + 'min_rows' => $p->options->has('MIN_ROWS', true), + 'tablespace' => $p->options->has('TABLESPACE', true), + 'node_group' => $p->options->has('NODEGROUP', true), + ); + } + + $partition =& $partitionDetails['partitions'][$i]; + $partition['name'] = 'p' . $i; + $partition['prefix'] = 'partitions[' . $i . ']'; + + // Values are specified only for LIST and RANGE type partitions + $partition['value_enabled'] = isset($partitionDetails['partition_by']) + && ($partitionDetails['partition_by'] == 'RANGE' + || $partitionDetails['partition_by'] == 'LIST'); + if (! $partition['value_enabled']) { + $partition['value_type'] = ''; + $partition['value'] = ''; + } + + if ($partitionDetails['subpartition_count'] > 1) { + $partition['subpartition_count'] = $partitionDetails['subpartition_count']; + $partition['subpartitions'] = array(); + + for ($j = 0; $j < intval($partitionDetails['subpartition_count']); $j++) { + if (! isset($stmt->partitions[$i]->subpartitions[$j])) { + $partition['subpartitions'][$j] = array( + 'engine' => '', + 'comment' => '', + 'data_directory' => '', + 'index_directory' => '', + 'max_rows' => '', + 'min_rows' => '', + 'tablespace' => '', + 'node_group' => '', + ); + } else { + $sp = $stmt->partitions[$i]->subpartitions[$j]; + $partition['subpartitions'][$j] = array( + 'engine' => $sp->options->has('ENGINE', true), + 'comment' => trim($sp->options->has('COMMENT', true), "'"), + 'data_directory' => trim($sp->options->has('DATA DIRECTORY', true), "'"), + 'index_directory' => trim($sp->options->has('INDEX_DIRECTORY', true), "'"), + 'max_rows' => $sp->options->has('MAX_ROWS', true), + 'min_rows' => $sp->options->has('MIN_ROWS', true), + 'tablespace' => $sp->options->has('TABLESPACE', true), + 'node_group' => $sp->options->has('NODEGROUP', true), + ); + } + + $subpartition =& $partition['subpartitions'][$j]; + $subpartition['name'] = 'p' . $i . 's' . $j; + $subpartition['prefix'] = 'partitions[' . $i . ']' + . '[subpartitions][' . $j . ']'; + } + } + } + + return $partitionDetails; + } + + /** + * Update the table's partitioning based on $_REQUEST + * + * @return void + */ + protected function updatePartitioning() + { + require_once 'libraries/create_addfield.lib.php'; + + $sql_query = "ALTER TABLE " . \PMA_Util::backquote($this->table) . " " + . PMA_getPartitionsDefinition(); + + // Execute alter query + $result = $this->dbi->tryQuery($sql_query); + + if ($result !== false) { + $message = PMA_Message::success( + __('Table %1$s has been altered successfully.') + ); + $message->addParam($this->table); + $this->response->addHTML( + PMA_Util::getMessage($message, $sql_query, 'success') + ); + } else { + $this->response->isSuccess(false); + $this->response->addJSON( + 'message', + PMA_Message::rawError( + __('Query error') . ':
' . $this->dbi->getError() + ) + ); + } + } + /** * Function to get the type of command for multiple field handling * diff --git a/libraries/tbl_columns_definition_form.inc.php b/libraries/tbl_columns_definition_form.inc.php index fcd33d0987..c65847b5d1 100644 --- a/libraries/tbl_columns_definition_form.inc.php +++ b/libraries/tbl_columns_definition_form.inc.php @@ -409,7 +409,6 @@ $html = PMA\Template::get('columns_definitions/column_definitions_form')->render 'action' => $action, 'form_params' => $form_params, 'content_cells' => $content_cells, - 'partitionDetails' => isset($partitionDetails) ? $partitionDetails : array() ) ); diff --git a/libraries/tbl_partition_definition.inc.php b/libraries/tbl_partition_definition.inc.php new file mode 100644 index 0000000000..ef8be4df16 --- /dev/null +++ b/libraries/tbl_partition_definition.inc.php @@ -0,0 +1,105 @@ + 1 + && isset($_REQUEST['partition_by']) + && ($_REQUEST['partition_by'] == 'RANGE' || $_REQUEST['partition_by'] == 'LIST'); + + if (PMA_isValid($_REQUEST['partition_count'], 'numeric') + && $_REQUEST['partition_count'] > 1 + ) { // Has partitions + $partitions = isset($_REQUEST['partitions']) ? $_REQUEST['partitions'] : array(); + + // Remove details of the additional partitions + // when number of partitions have been reduced + array_splice($partitions, $_REQUEST['partition_count']); + + for ($i = 0; $i < $_REQUEST['partition_count']; $i++) { + if (! isset($partitions[$i])) { // Newly added partition + $partitions[$i] = array( + 'value_type' => '', + 'value' => '', + 'engine' => '', + 'comment' => '', + 'data_directory' => '', + 'index_directory' => '', + 'max_rows' => '', + 'min_rows' => '', + 'tablespace' => '', + 'node_group' => '', + ); + } + + $partition =& $partitions[$i]; + $partition['name'] = 'p' . $i; + $partition['prefix'] = 'partitions[' . $i . ']'; + + // Values are specified only for LIST and RANGE type partitions + $partition['value_enabled'] = isset($_REQUEST['partition_by']) + && ($_REQUEST['partition_by'] == 'RANGE' + || $_REQUEST['partition_by'] == 'LIST'); + if (! $partition['value_enabled']) { + $partition['value_type'] = ''; + $partition['value'] = ''; + } + + if (PMA_isValid($_REQUEST['subpartition_count'], 'numeric') + && $_REQUEST['subpartition_count'] > 1 + && $partitionDetails['can_have_subpartitions'] == true + ) { // Has subpartitions + $partition['subpartition_count'] = $_REQUEST['subpartition_count']; + + if (! isset($partition['subpartitions'])) { + $partition['subpartitions'] = array(); + } + $subpartitions =& $partition['subpartitions']; + + // Remove details of the additional subpartitions + // when number of subpartitions have been reduced + array_splice($subpartitions, $_REQUEST['subpartition_count']); + + for ($j = 0; $j < $_REQUEST['subpartition_count']; $j++) { + if (! isset($subpartitions[$j])) { // Newly added subpartition + $subpartitions[$j] = array( + 'engine' => '', + 'comment' => '', + 'data_directory' => '', + 'index_directory' => '', + 'max_rows' => '', + 'min_rows' => '', + 'tablespace' => '', + 'node_group' => '', + ); + } + + $subpartition =& $subpartitions[$j]; + $subpartition['name'] = 'p' . $i . 's' . $j; + $subpartition['prefix'] = 'partitions[' . $i . ']' + . '[subpartitions][' . $j . ']'; + } + } else { // No subpartitions + unset($partition['subpartitions']); + unset($partition['subpartition_count']); + } + } + $partitionDetails['partitions'] = $partitions; + } +} + +echo PMA\Template::get('columns_definitions/partitions') + ->render(array('partitionDetails' => $partitionDetails)); diff --git a/tbl_create.php b/tbl_create.php index c13649f619..3993baeaa4 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -100,104 +100,6 @@ if (isset($_REQUEST['do_save_data'])) { //This global variable needs to be reset for the headerclass to function properly $GLOBAL['table'] = ''; -$partitionDetails = array(); - -// Extract some partitioning and subpartitioning parameters from the request -$partitionParams = array( - 'partition_by', 'partition_expr', 'partition_count', - 'subpartition_by', 'subpartition_expr', 'subpartition_count' -); -foreach ($partitionParams as $partitionParam) { - $partitionDetails[$partitionParam] = isset($_REQUEST[$partitionParam]) - ? $_REQUEST[$partitionParam] : ''; -} - -// Only LIST and RANGE type parameters allow subpartitioning -$partitionDetails['can_have_subpartitions'] = isset($_REQUEST['partition_count']) - && $_REQUEST['partition_count'] > 1 - && isset($_REQUEST['partition_by']) - && ($_REQUEST['partition_by'] == 'RANGE' || $_REQUEST['partition_by'] == 'LIST'); - -if (PMA_isValid($_REQUEST['partition_count'], 'numeric') - && $_REQUEST['partition_count'] > 1 -) { // Has partitions - $partitions = isset($_REQUEST['partitions']) ? $_REQUEST['partitions'] : array(); - - // Remove details of the additional partitions - // when number of partitions have been reduced - array_splice($partitions, $_REQUEST['partition_count']); - - for ($i = 0; $i < $_REQUEST['partition_count']; $i++) { - if (! isset($partitions[$i])) { // Newly added partition - $partitions[$i] = array( - 'value_type' => '', - 'value' => '', - 'engine' => '', - 'comment' => '', - 'data_directory' => '', - 'index_directory' => '', - 'max_rows' => '', - 'min_rows' => '', - 'tablespace' => '', - 'node_group' => '', - ); - } - - $partition =& $partitions[$i]; - $partition['name'] = 'p' . $i; - $partition['prefix'] = 'partitions[' . $i . ']'; - - // Values are specified only for LIST and RANGE type partitions - $partition['value_enabled'] = isset($_REQUEST['partition_by']) - && ($_REQUEST['partition_by'] == 'RANGE' - || $_REQUEST['partition_by'] == 'LIST'); - if (! $partition['value_enabled']) { - $partition['value_type'] = ''; - $partition['value'] = ''; - } - - if (PMA_isValid($_REQUEST['subpartition_count'], 'numeric') - && $_REQUEST['subpartition_count'] > 1 - && $partitionDetails['can_have_subpartitions'] == true - ) { // Has subpartitions - $partition['subpartition_count'] = $_REQUEST['subpartition_count']; - - if (! isset($partition['subpartitions'])) { - $partition['subpartitions'] = array(); - } - $subpartitions =& $partition['subpartitions']; - - // Remove details of the additional subpartitions - // when number of subpartitions have been reduced - array_splice($subpartitions, $_REQUEST['subpartition_count']); - - for ($j = 0; $j < $_REQUEST['subpartition_count']; $j++) { - if (! isset($subpartitions[$j])) { // Newly added subpartition - $subpartitions[$j] = array( - 'engine' => '', - 'comment' => '', - 'data_directory' => '', - 'index_directory' => '', - 'max_rows' => '', - 'min_rows' => '', - 'tablespace' => '', - 'node_group' => '', - ); - } - - $subpartition =& $subpartitions[$j]; - $subpartition['name'] = 'p' . $i . 's' . $j; - $subpartition['prefix'] = 'partitions[' . $i . ']' - . '[subpartitions][' . $j . ']'; - } - } else { // No subpartitions - unset($partition['subpartitions']); - unset($partition['subpartition_count']); - } - } - $partitionDetails['partitions'] = $partitions; -} - /** * Displays the form used to define the structure of the table */ diff --git a/templates/columns_definitions/column_definitions_form.phtml b/templates/columns_definitions/column_definitions_form.phtml index 8ee9365af7..354995f4ee 100644 --- a/templates/columns_definitions/column_definitions_form.phtml +++ b/templates/columns_definitions/column_definitions_form.phtml @@ -141,8 +141,7 @@ - render(array('partitionDetails' => $partitionDetails)); ?> + diff --git a/templates/columns_definitions/partitions_form.phtml b/templates/columns_definitions/partitions.phtml similarity index 100% rename from templates/columns_definitions/partitions_form.phtml rename to templates/columns_definitions/partitions.phtml diff --git a/templates/table/structure/display_partitions.phtml b/templates/table/structure/display_partitions.phtml index fe3ced64d8..aa2a40489c 100644 --- a/templates/table/structure/display_partitions.phtml +++ b/templates/table/structure/display_partitions.phtml @@ -3,123 +3,139 @@ -

- - -

- + + getDisplay(); ?> +

- - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $icon): ?> - - - - - getSubPartitions() as $subParition): ?> - - - - - - - - - + + + + + + + + + + + + + + + + + + +
# - -
getOrdinal(); ?>getOrdinal(); ?>getName()); ?> - - getExpression()) - . ($partition->getMethod() == 'LIST' ? ' IN (' : ' < ') - . htmlspecialchars($partition->getDescription()) - . ($partition->getMethod() == 'LIST' ? ')' : ''); - ?> - - getRows(); ?>getDataLength(), 3, 1 - ); - ?> - - - getIndexLength(), 3, 1 - ); - ?> - - - getComment(); ?> - getName() - ) ?>" - id="partition_action_" - name="partition_action_" - class="ajax" - > - - -
getOrdinal(); ?>getName()); ?>getRows(); ?>getDataLength(), 3, 1 - ); + + +

+ +

+ + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + $icon): ?> + - - - - - -
# + +
getOrdinal(); ?>getOrdinal(); ?>getName()); ?> + + getExpression()) + . ($partition->getMethod() == 'LIST' ? ' IN (' : ' < ') + . htmlspecialchars($partition->getDescription()) + . ($partition->getMethod() == 'LIST' ? ')' : ''); ?> - - - getIndexLength(), 3, 1 - ); - ?> - - - getComment(); ?>
getRows(); ?>getDataLength(), 3, 1 + ); + ?> + + + getIndexLength(), 3, 1 + ); + ?> + + + getComment(); ?> + getName() + ) ?>" + id="partition_action_" + name="partition_action_" + class="ajax" + > + + +
+ + + getSubPartitions() as $subParition): ?> +

getOrdinal(); ?>getName()); ?>getRows(); ?>getDataLength(), 3, 1 + ); + ?> + + + getIndexLength(), 3, 1 + ); + ?> + + + getComment(); ?>
+ + +

\ No newline at end of file diff --git a/templates/table/structure/display_structure.phtml b/templates/table/structure/display_structure.phtml index c0411c3376..da5ae08924 100644 --- a/templates/table/structure/display_structure.phtml +++ b/templates/table/structure/display_structure.phtml @@ -162,58 +162,72 @@ -getMethod() == 'RANGE' - || $firstPartition->getMethod() == 'LIST'; - $subParitions = $firstPartition->getSubPartitions(); - $hasSubPartitions = $firstPartition->hasSubPartitions(); - if ($hasSubPartitions) { - $firstSubPartition = $subParitions[0]; - } + // detect partitioning + if (! empty($partition_names) && ! is_null($partition_names[0])): - $actionIcons = array( - 'ANALYZE' => PMA_Util::getIcon('b_search.png', __('Analyze')), - 'CHECK' => PMA_Util::getIcon('eye.png', __('Check')), - 'OPTIMIZE' => PMA_Util::getIcon('normalize.png', __('Optimize')), - 'REBUILD' => PMA_Util::getIcon('s_tbl.png', __('Rebuild')), - 'REPAIR' => PMA_Util::getIcon('b_tblops.png', __('Repair')), - 'TRUNCATE' => PMA_Util::getIcon('b_empty.png', __('Truncate')), - ); - if ($rangeOrList) { - $actionIcons['DROP'] = PMA_Util::getIcon('b_drop.png', __('Drop')); - } + $partitions = PMA_Partition::getPartitions($db, $table); + $firstPartition = $partitions[0]; + $rangeOrList = $firstPartition->getMethod() == 'RANGE' + || $firstPartition->getMethod() == 'LIST'; + $subParitions = $firstPartition->getSubPartitions(); + $hasSubPartitions = $firstPartition->hasSubPartitions(); + if ($hasSubPartitions) { + $firstSubPartition = $subParitions[0]; + } - echo PMA_Util::getDivForSliderEffect( - 'partitions', __('Partitions') - ); + $actionIcons = array( + 'ANALYZE' => PMA_Util::getIcon('b_search.png', __('Analyze')), + 'CHECK' => PMA_Util::getIcon('eye.png', __('Check')), + 'OPTIMIZE' => PMA_Util::getIcon('normalize.png', __('Optimize')), + 'REBUILD' => PMA_Util::getIcon('s_tbl.png', __('Rebuild')), + 'REPAIR' => PMA_Util::getIcon('b_tblops.png', __('Repair')), + 'TRUNCATE' => PMA_Util::getIcon('b_empty.png', __('Truncate')), + ); + if ($rangeOrList) { + $actionIcons['DROP'] = PMA_Util::getIcon('b_drop.png', __('Drop')); + } - $tmp_partition_description = $firstPartition->getDescription(); + echo PMA_Util::getDivForSliderEffect( + 'partitions', __('Partitions') + ); - echo PMA\Template::get('table/structure/display_partitions')->render( - array( - 'table' => $table, - 'url_query' => $url_query, - 'partitions' => $partitions, - 'partitionMethod' => $firstPartition->getMethod(), - 'partitionExpression' => $firstPartition->getExpression(), - 'hasDescription' => ! empty($tmp_partition_description), - 'hasSubPartitions' => $hasSubPartitions, - 'subPartitionMethod' => $hasSubPartitions ? $firstSubPartition->getMethod() : null, - 'subPartitionExpression' => $hasSubPartitions ? $firstSubPartition->getExpression() : null, - 'actionIcons' => $actionIcons, - 'rangeOrList' => $rangeOrList, - ) - ); -?> - - - + $tmp_partition_description = $firstPartition->getDescription(); + + $removeSQL = "ALTER TABLE " . PMA_Util::backquote($table) . " REMOVE PARTITIONING"; + $removeUrl = 'sql.php' . $url_query . '&sql_query=' . urldecode($removeSQL); + + echo PMA\Template::get('table/structure/display_partitions')->render( + array( + 'db' => $db, + 'table' => $table, + 'url_query' => $url_query, + 'partitions' => $partitions, + 'partitionMethod' => $firstPartition->getMethod(), + 'partitionExpression' => $firstPartition->getExpression(), + 'hasDescription' => ! empty($tmp_partition_description), + 'hasSubPartitions' => $hasSubPartitions, + 'subPartitionMethod' => $hasSubPartitions ? $firstSubPartition->getMethod() : null, + 'subPartitionExpression' => $hasSubPartitions ? $firstSubPartition->getExpression() : null, + 'actionIcons' => $actionIcons, + 'rangeOrList' => $rangeOrList, + 'removeUrl' => $removeUrl, + ) + ); + else: + echo PMA\Template::get('table/structure/display_partitions')->render( + array( + 'db' => $db, + 'table' => $table, + ) + ); + endif; + ?> + + + diff --git a/templates/table/structure/partition_definition_form.phtml b/templates/table/structure/partition_definition_form.phtml new file mode 100644 index 0000000000..cfba73df9d --- /dev/null +++ b/templates/table/structure/partition_definition_form.phtml @@ -0,0 +1,13 @@ +
+ + + + +
+ + +
+
+ +
+
\ No newline at end of file diff --git a/themes/pmahomme/css/common.css.php b/themes/pmahomme/css/common.css.php index 07d2540e68..9baa27e718 100644 --- a/themes/pmahomme/css/common.css.php +++ b/themes/pmahomme/css/common.css.php @@ -1596,32 +1596,25 @@ div#profilingchart { #sectionlinks a, .buttonlinks a, a.button { - font-size: .88em; font-weight: bold; text-shadow: 0 1px 0 #fff; line-height: 35px; margin-: 7px; border: 1px solid #aaa; - padding: 5px 10px; - color: #111; + padding: 3px 7px; + color: #111 !important; text-decoration: none; background: #ddd; white-space: nowrap; border-radius: 20px; -webkit-border-radius: 20px; -moz-border-radius: 20px; - box-shadow: 1px 1px 2px rgba(0,0,0,.5); - /* - -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.5); - -moz-box-shadow: 1px 1px 2px rgba(0,0,0,.5); - text-shadow: #fff 0 1px 0; - */ - getCssGradient('ffffff', 'cccccc'); ?> + getCssGradient('f8f8f8', 'd8d8d8'); ?> } #sectionlinks a:hover, .buttonlinks a:hover, a.button:hover { - getCssGradient('cccccc', 'dddddd'); ?> + getCssGradient('ffffff', 'dddddd'); ?> } div#sqlquerycontainer {