Patch #736999 (Fixes bug #728789, #624712) from Maxime Delorme.

This commit is contained in:
Garvin Hicking
2003-05-14 11:00:51 +00:00
parent 281a31d2dc
commit 8a19549509
2 changed files with 51 additions and 59 deletions

View File

@@ -7,6 +7,8 @@ $Source$
2003-05-14 Garvin Hicking <me@supergarv.de> 2003-05-14 Garvin Hicking <me@supergarv.de>
* lang/german*: Translations. * lang/german*: Translations.
* pdf_schema.php3: Merged patch #736999 (fixes Bug #728789 and
better fix for #624712), by Maxime Delorme. Thanks!
2003-05-13 Marc Delisle <lem9@users.sourceforge.net> 2003-05-13 Marc Delisle <lem9@users.sourceforge.net>
* libraries/sqlparser.data.php3: bug 736793, new reserved * libraries/sqlparser.data.php3: bug 736793, new reserved

View File

@@ -634,14 +634,10 @@ class PMA_RT_Table
* *
* @see PMA_PDF * @see PMA_PDF
*/ */
function PMA_RT_Table_draw($show_info, $ff, $same_wide = 0, $same_wide_width = 0) function PMA_RT_Table_draw($show_info, $ff)
{ {
global $pdf, $with_doc; global $pdf, $with_doc;
if ($same_wide == 1 && $same_wide_width > 0) {
$this->width = $same_wide_width;
}
$pdf->PMA_PDF_setXyScale($this->x, $this->y); $pdf->PMA_PDF_setXyScale($this->x, $this->y);
$pdf->SetFont($ff, 'B'); $pdf->SetFont($ff, 'B');
$pdf->SetTextColor(200); $pdf->SetTextColor(200);
@@ -785,18 +781,11 @@ class PMA_RT_Relation
* *
* @access private * @access private
*/ */
function PMA_RT_Relation_getXy($table, $column, $same_wide, $tablewidth) function PMA_RT_Relation_getXy($table, $column)
{ {
$pos = array_search($column, $table->fields); $pos = array_search($column, $table->fields);
if($same_wide) {
$width = $tablewidth;
} else {
$width = $table->width;
}
// x_left, x_right, y // x_left, x_right, y
return array($table->x, $table->x + $width, $table->y + ($pos + 1.5) * $table->height_cell); return array($table->x, $table->x + + $table->width, $table->y + ($pos + 1.5) * $table->height_cell);
} // end of the "PMA_RT_Relation_getXy()" method } // end of the "PMA_RT_Relation_getXy()" method
@@ -866,10 +855,10 @@ class PMA_RT_Relation
* *
* @see PMA_RT_Relation::PMA_RT_Relation_getXy * @see PMA_RT_Relation::PMA_RT_Relation_getXy
*/ */
function PMA_RT_Relation($master_table, $master_field, $foreign_table, $foreign_field, $same_wide, $tablewidth) function PMA_RT_Relation($master_table, $master_field, $foreign_table, $foreign_field)
{ {
$src_pos = $this->PMA_RT_Relation_getXy($master_table , $master_field, $same_wide, $tablewidth); $src_pos = $this->PMA_RT_Relation_getXy($master_table , $master_field);
$dest_pos = $this->PMA_RT_Relation_getXy($foreign_table, $foreign_field, $same_wide, $tablewidth); $dest_pos = $this->PMA_RT_Relation_getXy($foreign_table, $foreign_field);
$src_left = $src_pos[0] - $this->w_tick; $src_left = $src_pos[0] - $this->w_tick;
$src_right = $src_pos[1] + $this->w_tick; $src_right = $src_pos[1] + $this->w_tick;
$dest_left = $dest_pos[0] - $this->w_tick; $dest_left = $dest_pos[0] - $this->w_tick;
@@ -974,7 +963,7 @@ class PMA_RT
$this->tables[$foreign_table] = new PMA_RT_Table($foreign_table, $this->ff, $this->tablewidth); $this->tables[$foreign_table] = new PMA_RT_Table($foreign_table, $this->ff, $this->tablewidth);
$this->PMA_RT_setMinMax($this->tables[$foreign_table]); $this->PMA_RT_setMinMax($this->tables[$foreign_table]);
} }
$this->relations[] = new PMA_RT_Relation($this->tables[$master_table], $master_field, $this->tables[$foreign_table], $foreign_field, $this->same_wide, $this->tablewidth); $this->relations[] = new PMA_RT_Relation($this->tables[$master_table], $master_field, $this->tables[$foreign_table], $foreign_field);
} // end of the "PMA_RT_addRelation()" method } // end of the "PMA_RT_addRelation()" method
@@ -1048,7 +1037,7 @@ class PMA_RT
{ {
reset($this->tables); reset($this->tables);
while (list(, $table) = each($this->tables)) { while (list(, $table) = each($this->tables)) {
$table->PMA_RT_Table_draw($show_info, $this->ff, $this->same_wide, $this->tablewidth); $table->PMA_RT_Table_draw($show_info, $this->ff);
} }
} // end of the "PMA_RT_drawTables()" method } // end of the "PMA_RT_drawTables()" method
@@ -1108,7 +1097,7 @@ class PMA_RT
* *
* @see PMA_PDF * @see PMA_PDF
*/ */
function PMA_RT($scale, $which_rel, $show_info = 0, $change_color = 0 , $show_grid = 0, $all_tab_same_wide = 0, $orientation = 'L') function PMA_RT( $which_rel, $show_info = 0, $change_color = 0 , $show_grid = 0, $all_tab_same_wide = 0, $orientation = 'L')
{ {
global $pdf, $db, $cfgRelation, $with_doc; global $pdf, $db, $cfgRelation, $with_doc;
@@ -1168,24 +1157,25 @@ class PMA_RT
$this->b_marg = 18; $this->b_marg = 18;
} }
/* snip */ /* snip */
reset ($alltables); reset ($alltables);
while (list(, $table) = each ($alltables)) { while (list(, $table) = each ($alltables)) {
if (!isset($this->tables[$table])) { if (!isset($this->tables[$table])) {
$this->tables[$table] = new PMA_RT_Table($table, $this->ff, $this->tablewidth); $this->tables[$table] = new PMA_RT_Table($table, $this->ff, $this->tablewidth);
$this->PMA_RT_setMinMax($this->tables[$table]);
} }
} // while } // while
reset($alltables);
while (list(, $table) = each ($alltables)) {
if($this->same_wide){
$this->tables[$table]->width = $this->tablewidth;
}
$this->PMA_RT_setMinMax($this->tables[$table]);
}
// Defines the scale factor // Defines the scale factor
if ($scale == 'auto') { $this->scale = ceil(max(($this->x_max - $this->x_min) / (297 - $this->r_marg - $this->l_marg), ($this->y_max - $this->y_min) / (210 - $this->t_marg - $this->b_marg)) * 100) / 100;
$this->scale = ceil(max(($this->x_max - $this->x_min) / (297 - $this->r_marg - $this->l_marg), ($this->y_max - $this->y_min) / (210 - $this->t_marg - $this->b_marg)) * 100) / 100; $pdf->PMA_PDF_setScale($this->scale, $this->x_min, $this->y_min, $this->l_marg, $this->t_marg);
$pdf->PMA_PDF_setScale($this->scale, $this->x_min, $this->y_min, $this->l_marg, $this->t_marg);
} else {
$this->scale = $scale;
$pdf->PMA_PDF_setScale($scale);
} // end if... else...
// Builds and save the PDF document // Builds and save the PDF document
$pdf->PMA_PDF_setLineWidthScale(0.1); $pdf->PMA_PDF_setLineWidthScale(0.1);
@@ -1196,9 +1186,8 @@ class PMA_RT
} }
$pdf->PMA_PDF_setFontSizeScale(14); $pdf->PMA_PDF_setFontSizeScale(14);
$this->PMA_RT_drawTables($show_info);
/* start snip */ /* start snip */
$sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation']) $sql = 'SELECT * FROM ' . PMA_backquote($cfgRelation['relation'])
. ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' ' . ' WHERE master_db = \'' . PMA_sqlAddslashes($db) . '\' '
@@ -1216,11 +1205,12 @@ class PMA_RT
} }
} }
/* end snip */ /* end snip */
if ($norelations == FALSE) { if ($norelations == FALSE) {
$this->PMA_RT_drawRelations($change_color); $this->PMA_RT_drawRelations($change_color);
} }
$this->PMA_RT_drawTables($show_info);
$this->PMA_RT_showRt(); $this->PMA_RT_showRt();
} // end of the "PMA_RT()" method } // end of the "PMA_RT()" method
@@ -1539,5 +1529,5 @@ $with_doc = (isset($with_doc) && $with_doc == 'on') ? 1 : 0;
$orientation = (isset($orientation) && $orientation == 'P') ? 'P' : 'L'; $orientation = (isset($orientation) && $orientation == 'P') ? 'P' : 'L';
PMA_mysql_select_db($db); PMA_mysql_select_db($db);
$rt = new PMA_RT('auto', $pdf_page_number, $show_table_dimension, $show_color, $show_grid, $all_tab_same_wide, $orientation); $rt = new PMA_RT($pdf_page_number, $show_table_dimension, $show_color, $show_grid, $all_tab_same_wide, $orientation);
?> ?>