diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 8f27e1e7ef..fd54bf5215 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -674,7 +674,7 @@ function PMA_getTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, global $sql_query, $num_rows; global $vertical_display, $highlight_columns; - $table_headers_html = ""; + $table_headers_html = ''; // required to generate sort links that will remember whether the // "Show all" button has been clicked @@ -719,94 +719,10 @@ function PMA_getTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, // do we have any index? if ($indexes) { - - if ($directionCondition) { - - $span = $fields_cnt; - if ($is_display['edit_lnk'] != 'nn') { - $span++; - } - - if ($is_display['del_lnk'] != 'nn') { - $span++; - } - - if (($is_display['del_lnk'] != 'kp') - && ($is_display['del_lnk'] != 'nn') - ) { - $span++; - } - - } else { - $span = $num_rows + floor( - $num_rows / $_SESSION['tmp_user_values']['repeat_cells'] - ) + 1; - } - - $table_headers_html .= '
' . "\n"; + $table_headers_html .= PMA_getSortByKeyDropDown( + $db, $table, $indexes, $sort_expression, + $unsorted_sql_query + ); } } } @@ -819,31 +735,8 @@ function PMA_getTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, . ''; // Output data needed for column reordering and show/hide column - if (PMA_isSelect()) { - - // generate the column order, if it is set - $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']); - $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER); - - if ($col_order) { - $table_headers_html .= ''; - } - - $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB); - - if ($col_visib) { - $table_headers_html .= ''; - } - - // generate table create time - if (! PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) { - $table_headers_html .= ''; - } + if (PMA_isSelect()) { + $table_headers_html .= PMA_getDataForResettingColumnOrder(); } $vertical_display['emptypre'] = 0; @@ -851,175 +744,36 @@ function PMA_getTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $vertical_display['textbtn'] = ''; // Display options (if we are not in print view) - if (! (isset($GLOBALS['printview']) && $GLOBALS['printview'] == '1')) { + if (! (isset($GLOBALS['printview']) && ($GLOBALS['printview'] == '1'))) { - $table_headers_html .= ''; + $full_or_partial_text_link = PMA_getFullOrPartialTextButtonOrLink( + $db, $table, $sql_query, $goto + ); } // Start of form for multi-rows edit/delete/export - - if (($is_display['del_lnk'] == 'dr') || ($is_display['del_lnk'] == 'kp')) { + $table_headers_html .= PMA_getFormForMultiRowOperations( + $db, $table, $is_display['del_lnk'] + ); - $table_headers_html .= '' . "\n"; - } - - $table_headers_html .= '| name) - . '">' . $order_link . $comments . ' | '; + if ($directionCondition) { + $table_headers_html .= PMA_getDraggableClassForSortableColumns( + $col_visib, $col_visib[$j], $condition_field, + $direction, $fields_meta[$i], $order_link, $comments + ); } $vertical_display['desc'][] = 'name) . '">';
-
- if (($direction == 'horizontalflipped')
- && ($GLOBALS['cfg']['HeaderFlipType'] == 'fake')
- ) {
-
- $table_headers_html .= PMA_flipstring(
- htmlspecialchars($fields_meta[$i]->name), ' ' - ); - - } else { - $table_headers_html .= htmlspecialchars($fields_meta[$i]->name); - } - - $table_headers_html .= "\n" . $comments . ' | ';
+
+ if ($directionCondition) {
+ $table_headers_html .= PMA_getDraggableClassForNonSortableColumns(
+ $col_visib, $col_visib[$j], $condition_field,
+ $direction, $fields_meta[$i], $comments
+ );
}
$vertical_display['desc'][] = ' ' . "\n";
+
+ $used_index = false;
+ $local_order = (isset($sort_expression) ? $sort_expression : '');
+
+ foreach ($indexes as $index) {
+
+ $asc_sort = '`'
+ . implode('` ASC, `', array_keys($index->getColumns()))
+ . '` ASC';
+
+ $desc_sort = '`'
+ . implode('` DESC, `', array_keys($index->getColumns()))
+ . '` DESC';
+
+ $used_index = $used_index
+ || ($local_order == $asc_sort)
+ || ($local_order == $desc_sort);
+
+ if (preg_match(
+ '@(.*)([[:space:]](LIMIT (.*)|PROCEDURE (.*)|'
+ . 'FOR UPDATE|LOCK IN SHARE MODE))@is',
+ $unsorted_sql_query, $my_reg)
+ ) {
+ $unsorted_sql_query_first_part = $my_reg[1];
+ $unsorted_sql_query_second_part = $my_reg[2];
+ } else {
+ $unsorted_sql_query_first_part = $unsorted_sql_query;
+ $unsorted_sql_query_second_part = '';
+ }
+
+ $drop_down_html .= '';
+
+ $drop_down_html .= '';
+ }
+
+ $drop_down_html .= ''
+ . '' . "\n"
+ . '' . "\n";
+
+ return $drop_down_html;
+
+}
+
+
+/**
+ * Prepare data for column restoring and show/hide
+ *
+ * @return string $data_html html content
+ *
+ * @see PMA_getTableHeaders()
+ */
+function PMA_getDataForResettingColumnOrder()
+{
+
+ $data_html = '';
+
+ // generate the column order, if it is set
+ $pmatable = new PMA_Table($GLOBALS['table'], $GLOBALS['db']);
+ $col_order = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_ORDER);
+
+ if ($col_order) {
+ $data_html .= '';
+ }
+
+ $col_visib = $pmatable->getUiProp(PMA_Table::PROP_COLUMN_VISIB);
+
+ if ($col_visib) {
+ $data_html .= '';
+ }
+
+ // generate table create time
+ if (! PMA_Table::isView($GLOBALS['table'], $GLOBALS['db'])) {
+ $data_html .= '';
+ }
+
+ return $data_html;
+
+}
+
+
+/**
+ * Prepare option fields block
+ *
+ * @param string $db the database name
+ * @param string $table the table name
+ * @param string $sql_query the SQL query
+ * @param string $goto the URL to go back in case of errors
+ *
+ * @return string $options_html html content
+ *
+ * @see PMA_getTableHeaders()
+ */
+function PMA_getOptionsBlock($db, $table, $sql_query, $goto)
+{
+
+ $options_html = '';
+
+ $options_html .= '';
+
+ return $options_html;
+
+}
+
+
+/**
+ * Get full/partial text button or link
+ *
+ * @param string $db the database name
+ * @param string $table the table name
+ * @param string $sql_query the SQL query
+ * @param string $goto the URL to go back in case of errors
+ *
+ * @return string html content
+ *
+ * @see PMA_getTableHeaders()
+ */
+function PMA_getFullOrPartialTextButtonOrLink($db, $table, $sql_query, $goto)
+{
+
+ $url_params_full_text = array(
+ 'db' => $db,
+ 'table' => $table,
+ 'sql_query' => $sql_query,
+ 'goto' => $goto,
+ 'full_text_button' => 1
+ );
+
+ if ($_SESSION['tmp_user_values']['display_text'] == 'F') {
+ // currently in fulltext mode so show the opposite link
+ $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_partialtext.png';
+ $tmp_txt = __('Partial texts');
+ $url_params_full_text['display_text'] = 'P';
+ } else {
+ $tmp_image_file = $GLOBALS['pmaThemeImage'] . 's_fulltext.png';
+ $tmp_txt = __('Full texts');
+ $url_params_full_text['display_text'] = 'F';
+ }
+
+ $tmp_image = '
|
|---|