Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2014-03-15 15:52:27 +01:00
commit 1250c451a4
7 changed files with 109 additions and 101 deletions

View File

@ -59,5 +59,5 @@ $response->addHTML(
. '<br class="clearfloat" />'
);
$response->addHTML($db_search->getSelectionForm($url_params));
$response->addHTML($db_search->_getResultDivs());
$response->addHTML($db_search->getResultDivs());
?>

View File

@ -531,7 +531,8 @@ PMA_printJsValue("$.datepicker.regional['']['weekHeader']", __('Wk'));
PMA_printJsValue(
"$.datepicker.regional['']['showMonthAfterYear']",
/* l10n: Month-year order for calendar, use either "calendar-month-year"
* or "calendar-year-month". */
* or "calendar-year-month".
*/
(__('calendar-month-year') == 'calendar-year-month')
);
/* l10n: Year suffix for calendar, "none" is empty. */

View File

@ -1176,8 +1176,8 @@ class PMA_DbQbe
list($candidate_columns, $needsort)
= $this->_getLeftJoinColumnCandidatesBest(
$all_tables, $where_clause_columns, $unique_columns, $index_columns
);
$all_tables, $where_clause_columns, $unique_columns, $index_columns
);
// If we came up with $unique_columns (very good) or $index_columns (still
// good) as $candidate_columns we want to check if we have any 'Y' there

View File

@ -476,7 +476,7 @@ class PMA_DbSearch
*
* @return string div tags
*/
public function _getResultDivs()
public function getResultDivs()
{
$html_output = '<!-- These two table-image and table-link elements display'
. ' the table name in browse search results -->';

View File

@ -142,13 +142,15 @@ class PMA_Footer
$params['viewing_mode'] = $_REQUEST['viewing_mode'];
}
if (isset($_REQUEST['checkprivsdb'])
//TODO: coming from server_privileges.php, here $db is not set, uncomment below line when that is fixed
//TODO: coming from server_privileges.php, here $db is not set,
//uncomment below line when that is fixed
//&& $_REQUEST['checkprivsdb'] == $db
) {
$params['checkprivsdb'] = $_REQUEST['checkprivsdb'];
}
if (isset($_REQUEST['checkprivstable'])
//TODO: coming from server_privileges.php, here $table is not set, uncomment below line when that is fixed
//TODO: coming from server_privileges.php, here $table is not set,
//uncomment below line when that is fixed
//&& $_REQUEST['checkprivstable'] == $table
) {
$params['checkprivstable'] = $_REQUEST['checkprivstable'];
@ -157,7 +159,7 @@ class PMA_Footer
&& in_array($_REQUEST['single_table'], array(true, false))
) {
$params['single_table'] = $_REQUEST['single_table'];
}
}
return basename(PMA_getenv('SCRIPT_NAME')) . PMA_URL_getCommon(
$params,
$encoding

View File

@ -206,104 +206,107 @@ class ImportOds extends ImportPlugin
/* Iterate over rows */
foreach ($sheet as $row) {
$type = $row->getName();
if (! strcmp('table-row', $type)) {
/* Iterate over columns */
foreach ($row as $cell) {
$text = $cell->children('text', true);
$cell_attrs = $cell->attributes('office', true);
if (strcmp('table-row', $type)) {
continue;
}
/* Iterate over columns */
foreach ($row as $cell) {
$text = $cell->children('text', true);
$cell_attrs = $cell->attributes('office', true);
if (count($text) != 0) {
$attr = $cell->attributes('table', true);
$num_repeat = (int) $attr['number-columns-repeated'];
$num_iterations = $num_repeat ? $num_repeat : 1;
if (count($text) != 0) {
$attr = $cell->attributes('table', true);
$num_repeat = (int) $attr['number-columns-repeated'];
$num_iterations = $num_repeat ? $num_repeat : 1;
for ($k = 0; $k < $num_iterations; $k++) {
if ($_REQUEST['ods_recognize_percentages']
&& ! strcmp(
'percentage',
$cell_attrs['value-type']
)
) {
$value = (double)$cell_attrs['value'];
} elseif ($_REQUEST['ods_recognize_currency']
&& !strcmp('currency', $cell_attrs['value-type'])
) {
$value = (double)$cell_attrs['value'];
} else {
/* We need to concatenate all paragraphs */
$values = array();
foreach ($text as $paragraph) {
$values[] = (string)$paragraph;
}
$value = implode("\n", $values);
}
if (! $col_names_in_first_row) {
$tempRow[] = $value;
} else {
$col_names[] = $value;
for ($k = 0; $k < $num_iterations; $k++) {
if ($_REQUEST['ods_recognize_percentages']
&& ! strcmp(
'percentage',
$cell_attrs['value-type']
)
) {
$value = (double)$cell_attrs['value'];
} elseif ($_REQUEST['ods_recognize_currency']
&& !strcmp('currency', $cell_attrs['value-type'])
) {
$value = (double)$cell_attrs['value'];
} else {
/* We need to concatenate all paragraphs */
$values = array();
foreach ($text as $paragraph) {
$values[] = (string)$paragraph;
}
$value = implode("\n", $values);
}
if (! $col_names_in_first_row) {
$tempRow[] = $value;
} else {
$col_names[] = $value;
}
++$col_count;
}
continue;
}
/* Number of blank columns repeated */
if ($col_count >= count($row->children('table', true)) - 1) {
continue;
}
$attr = $cell->attributes('table', true);
$num_null = (int)$attr['number-columns-repeated'];
if ($num_null) {
if (! $col_names_in_first_row) {
for ($i = 0; $i < $num_null; ++$i) {
$tempRow[] = 'NULL';
++$col_count;
}
} else {
/* Number of blank columns repeated */
if ($col_count < count($row->children('table', true)) - 1
) {
$attr = $cell->attributes('table', true);
$num_null = (int)$attr['number-columns-repeated'];
if ($num_null) {
if (! $col_names_in_first_row) {
for ($i = 0; $i < $num_null; ++$i) {
$tempRow[] = 'NULL';
++$col_count;
}
} else {
for ($i = 0; $i < $num_null; ++$i) {
$col_names[] = PMA_getColumnAlphaName(
$col_count + 1
);
++$col_count;
}
}
} else {
if (! $col_names_in_first_row) {
$tempRow[] = 'NULL';
} else {
$col_names[] = PMA_getColumnAlphaName(
$col_count + 1
);
}
++$col_count;
}
for ($i = 0; $i < $num_null; ++$i) {
$col_names[] = PMA_getColumnAlphaName(
$col_count + 1
);
++$col_count;
}
}
}
/* Find the widest row */
if ($col_count > $max_cols) {
$max_cols = $col_count;
}
/* Don't include a row that is full of NULL values */
if (! $col_names_in_first_row) {
if ($_REQUEST['ods_empty_rows']) {
foreach ($tempRow as $cell) {
if (strcmp('NULL', $cell)) {
$tempRows[] = $tempRow;
break;
}
}
} else {
if (! $col_names_in_first_row) {
$tempRow[] = 'NULL';
} else {
$tempRows[] = $tempRow;
$col_names[] = PMA_getColumnAlphaName(
$col_count + 1
);
}
}
$col_count = 0;
$col_names_in_first_row = false;
$tempRow = array();
++$col_count;
}
} //Endforeach
/* Find the widest row */
if ($col_count > $max_cols) {
$max_cols = $col_count;
}
/* Don't include a row that is full of NULL values */
if (! $col_names_in_first_row) {
if ($_REQUEST['ods_empty_rows']) {
foreach ($tempRow as $cell) {
if (strcmp('NULL', $cell)) {
$tempRows[] = $tempRow;
break;
}
}
} else {
$tempRows[] = $tempRow;
}
}
$col_count = 0;
$col_names_in_first_row = false;
$tempRow = array();
}
/* Skip over empty sheets */
@ -356,13 +359,15 @@ class ImportOds extends ImportPlugin
$num_tbls = count($tables);
for ($i = 0; $i < $num_tbls; ++$i) {
for ($j = 0; $j < count($rows); ++$j) {
if (! strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) {
if (! isset($tables[$i][COL_NAMES])) {
$tables[$i][] = $rows[$j][COL_NAMES];
}
$tables[$i][ROWS] = $rows[$j][ROWS];
if (strcmp($tables[$i][TBL_NAME], $rows[$j][TBL_NAME])) {
continue;
}
if (! isset($tables[$i][COL_NAMES])) {
$tables[$i][] = $rows[$j][COL_NAMES];
}
$tables[$i][ROWS] = $rows[$j][ROWS];
}
}

View File

@ -234,7 +234,7 @@ class PMA_DbSearch_Test extends PHPUnit_Framework_TestCase
}
/**
* Test for _getResultDivs
* Test for getResultDivs
*
* @return void
*/
@ -250,7 +250,7 @@ class PMA_DbSearch_Test extends PHPUnit_Framework_TestCase
. ' delete form in the db search --></div><!-- toggle query box link-->'
. '<a id="togglequerybox"></a>',
$this->_callProtectedFunction(
'_getResultDivs',
'getResultDivs',
array()
)
);