bug #3100780 Designer export can be confusing
This commit is contained in:
107
pmd_pdf.php
107
pmd_pdf.php
@@ -15,24 +15,38 @@ if (! isset($scale)) {
|
|||||||
include_once 'pmd_save_pos.php';
|
include_once 'pmd_save_pos.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($scale) && ! isset($createpage)) {
|
if (isset($mode)) {
|
||||||
if (empty($pdf_page_number)) {
|
if ('create_export' != $mode && empty($pdf_page_number)) {
|
||||||
die("<script>alert('Pages not found!');history.go(-2);</script>");
|
die("<script>alert('Pages not found!');history.go(-2);</script>");
|
||||||
}
|
}
|
||||||
|
|
||||||
$pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
|
$pmd_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($GLOBALS['cfgRelation']['designer_coords']);
|
||||||
$pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
|
$pma_table = PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']);
|
||||||
$scale_q = PMA_sqlAddslashes($scale);
|
$scale_q = PMA_sqlAddslashes($scale);
|
||||||
|
|
||||||
|
if ('create_export' == $mode) {
|
||||||
|
/*
|
||||||
|
* @see pdf_pages.php
|
||||||
|
*/
|
||||||
|
$query_default_option = PMA_DBI_QUERY_STORE;
|
||||||
|
$pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
|
||||||
|
if ($pdf_page_number > 0) {
|
||||||
|
$message = PMA_Message::success(__('Page has been created'));
|
||||||
|
$mode = 'export';
|
||||||
|
} else {
|
||||||
|
$message = PMA_Message::error(__('Page creation failed'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$pdf_page_number_q = PMA_sqlAddslashes($pdf_page_number);
|
$pdf_page_number_q = PMA_sqlAddslashes($pdf_page_number);
|
||||||
|
|
||||||
if (isset($exp)) {
|
if ('export' == $mode) {
|
||||||
|
|
||||||
$sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . PMA_sqlAddslashes($db) . "'";
|
$sql = "REPLACE INTO " . $pma_table . " (db_name, table_name, pdf_page_number, x, y) SELECT db_name, table_name, " . $pdf_page_number_q . ", ROUND(x/" . $scale_q . ") , ROUND(y/" . $scale_q . ") y FROM " . $pmd_table . " WHERE db_name = '" . PMA_sqlAddslashes($db) . "'";
|
||||||
|
|
||||||
PMA_query_as_controluser($sql,TRUE,PMA_DBI_QUERY_STORE);
|
PMA_query_as_controluser($sql,TRUE,PMA_DBI_QUERY_STORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($imp)) {
|
if ('import' == $mode) {
|
||||||
PMA_query_as_controluser(
|
PMA_query_as_controluser(
|
||||||
'UPDATE ' . $pma_table . ',' . $pmd_table .
|
'UPDATE ' . $pma_table . ',' . $pmd_table .
|
||||||
' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
|
' SET ' . $pmd_table . '.`x`= ' . $pma_table . '.`x` * '. $scale_q . ',
|
||||||
@@ -45,22 +59,6 @@ if (isset($scale) && ! isset($createpage)) {
|
|||||||
' . $pmd_table . '.`db_name`=\''. PMA_sqlAddslashes($db) .'\'
|
' . $pmd_table . '.`db_name`=\''. PMA_sqlAddslashes($db) .'\'
|
||||||
AND pdf_page_number = ' . $pdf_page_number_q . ';', TRUE, PMA_DBI_QUERY_STORE);
|
AND pdf_page_number = ' . $pdf_page_number_q . ';', TRUE, PMA_DBI_QUERY_STORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
die("<script>alert('__('Modifications have been saved')');history.go(-2);</script>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($createpage)) {
|
|
||||||
/*
|
|
||||||
* @see pdf_pages.php
|
|
||||||
*/
|
|
||||||
$query_default_option = PMA_DBI_QUERY_STORE;
|
|
||||||
|
|
||||||
$pdf_page_number = PMA_REL_create_page($newpage, $cfgRelation, $db, $query_default_option);
|
|
||||||
if ($pdf_page_number > 0) {
|
|
||||||
$message = PMA_Message::success(__('Page has been created'));
|
|
||||||
} else {
|
|
||||||
$message = PMA_Message::error(__('Page creation failed'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no need to use pmd/styles
|
// no need to use pmd/styles
|
||||||
@@ -76,10 +74,45 @@ require_once './libraries/header_meta_style.inc.php';
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<form name="form1" method="post" action="pmd_pdf.php">
|
<form name="form1" method="post" action="pmd_pdf.php">
|
||||||
<?php echo PMA_generate_common_hidden_inputs($db); ?>
|
<?php
|
||||||
<div>
|
echo PMA_generate_common_hidden_inputs($db);
|
||||||
<fieldset><legend><?php echo __('Export') . '/' . __('Import'); ?></legend>
|
echo '<div>';
|
||||||
<p><?php echo __('Export/Import to scale'); ?>:
|
echo '<fieldset><legend>' . __('Import/Export coordinates for PDF schema') . '</legend>';
|
||||||
|
|
||||||
|
$choices = array();
|
||||||
|
|
||||||
|
$table_info_result = PMA_query_as_controluser('SELECT * FROM '
|
||||||
|
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
||||||
|
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
||||||
|
|
||||||
|
if (PMA_DBI_num_rows($table_info_result) > 0) {
|
||||||
|
echo '<p>' . __('Page') . ':';
|
||||||
|
echo '<select name="pdf_page_number">';
|
||||||
|
|
||||||
|
while($page = PMA_DBI_fetch_assoc($table_info_result)) {
|
||||||
|
echo '<option value="' . $page['page_nr'] . '">';
|
||||||
|
echo htmlspecialchars($page['page_descr']);
|
||||||
|
echo '</option>';
|
||||||
|
}
|
||||||
|
echo '</select>';
|
||||||
|
echo '</p>';
|
||||||
|
$choices['import'] = __('Import from selected page');
|
||||||
|
$choices['export'] = __('Export to selected page');
|
||||||
|
}
|
||||||
|
$choices['create_export'] = __('Create a page and export to it');
|
||||||
|
|
||||||
|
if (1 == count($choices)) {
|
||||||
|
echo $choices['create_export'];
|
||||||
|
echo '<input type="hidden" name="mode" value="create_export" />';
|
||||||
|
} else {
|
||||||
|
PMA_display_html_radio('mode', $choices, $checked_choice = '', $line_break = true, $escape_label = false, $class='');
|
||||||
|
}
|
||||||
|
echo '<br />';
|
||||||
|
echo '<label for="newpage">' . __('New page name: ') . '</label>';
|
||||||
|
echo '<input id="newpage" type="text" name="newpage" />';
|
||||||
|
|
||||||
|
echo '<p>' . __('Export/Import to scale') . ':';
|
||||||
|
?>
|
||||||
<select name="scale">
|
<select name="scale">
|
||||||
<option value="1">1:1</option>
|
<option value="1">1:1</option>
|
||||||
<option value="2">1:2</option>
|
<option value="2">1:2</option>
|
||||||
@@ -88,29 +121,7 @@ require_once './libraries/header_meta_style.inc.php';
|
|||||||
<option value="5">1:5</option>
|
<option value="5">1:5</option>
|
||||||
</select>
|
</select>
|
||||||
</p>
|
</p>
|
||||||
<p><?php echo __('to/from page'); ?>:
|
<input type="submit" value="<?php echo __('Go'); ?>">
|
||||||
|
|
||||||
<select name="pdf_page_number">
|
|
||||||
<?php
|
|
||||||
$table_info_result = PMA_query_as_controluser('SELECT * FROM '
|
|
||||||
. PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
|
||||||
. ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'');
|
|
||||||
while($page = PMA_DBI_fetch_assoc($table_info_result))
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<option value="<?php echo $page['page_nr'] ?>"><?php echo htmlspecialchars($page['page_descr']) ?></option>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
<input type="submit" name="exp" value="<?php echo __('Export'); ?>">
|
|
||||||
<input type="submit" name="imp" value="<?php echo __('Import'); ?>">
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<fieldset><legend><?php echo __('Create a page'); ?></legend>
|
|
||||||
<input type="text" name="newpage" />
|
|
||||||
<input type="submit" name="createpage" value="<?php echo __('Go'); ?>">
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user