The branch, master has been updated
via c6a28b42e6a54502ec1ffc0c07d338fc47cb6105 (commit)
via 3865f1a81f12ead51eac582c8cbd0cb25c1e617e (commit)
from 81dfcbedc1ca53186cbea44246ced1d1e586bb3c (commit)
- Log -----------------------------------------------------------------
commit c6a28b42e6a54502ec1ffc0c07d338fc47cb6105
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon May 31 14:05:41 2010 +0200
Single place to define PDF schema form.
commit 3865f1a81f12ead51eac582c8cbd0cb25c1e617e
Author: Michal Čihař <mcihar(a)novell.com>
Date: Mon May 31 14:00:16 2010 +0200
Better look for PDF page creation dialog.
-----------------------------------------------------------------------
Summary of changes:
db_operations.php | 72 ++--------------------------------
libraries/display_pdf_schema.lib.php | 71 +++++++++++++++++++++++++++++++++
pdf_pages.php | 56 ++++++++------------------
3 files changed, 93 insertions(+), 106 deletions(-)
create mode 100644 libraries/display_pdf_schema.lib.php
diff --git a/db_operations.php b/db_operations.php
index 8ba13a2..44e93b2 100644
--- a/db_operations.php
+++ b/db_operations.php
@@ -121,7 +121,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy)))
{
if ($this_what != 'nocopy') {
// keep the triggers from the original db+table
- // (third param is empty because delimiters are only intended
+ // (third param is empty because delimiters are only intended
// for importing via the mysql client or our Import feature)
$triggers = PMA_DBI_get_triggers($db, $each_table, '');
@@ -141,7 +141,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy)))
{
}
unset($trigger);
}
- unset($triggers);
+ unset($triggers);
// this does not apply to a rename operation
if (isset($GLOBALS['add_constraints']) &&
!empty($GLOBALS['sql_constraints_query'])) {
@@ -631,72 +631,8 @@ if ($cfgRelation['pdfwork'] && $num_tables > 0) {
?>
WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
$test_rs = PMA_query_as_controluser($test_query, null, PMA_DBI_QUERY_STORE);
- if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) { ?>
- <!-- PDF schema -->
- <form method="post" action="pdf_schema.php">
- <fieldset>
- <legend>
- <?php
- echo PMA_generate_common_hidden_inputs($db);
- if ($cfg['PropertiesIconic']) {
- echo '<img class="icon" src="' . $pmaThemeImage .
'b_view.png"'
- .' alt="" width="16" height="16"
/>';
- }
- echo __('Display PDF schema');
- ?>:
- </legend>
- <label for="pdf_page_number_opt"><?php echo __('Page
number:'); ?></label>
- <select name="pdf_page_number"
id="pdf_page_number_opt">
- <?php
- while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
- echo ' <option value="' .
$pages['page_nr'] . '">'
- . $pages['page_nr'] . ': ' .
htmlspecialchars($pages['page_descr']) . '</option>' .
"\n";
- } // end while
- PMA_DBI_free_result($test_rs);
- unset($test_rs);
- ?>
- </select><br />
-
- <input type="checkbox" name="show_grid"
id="show_grid_opt" />
- <label for="show_grid_opt"><?php echo __('Show grid');
?></label><br />
- <input type="checkbox" name="show_color"
id="show_color_opt"
- checked="checked" />
- <label for="show_color_opt"><?php echo __('Show
color'); ?></label><br />
- <input type="checkbox" name="show_table_dimension"
id="show_table_dim_opt" />
- <label for="show_table_dim_opt"><?php echo __('Show
dimension of tables'); ?>
- </label><br />
- <input type="checkbox" name="all_tab_same_wide"
id="all_tab_same_wide" />
- <label for="all_tab_same_wide"><?php echo __('Display all
tables with the same width'); ?>
- </label><br />
- <input type="checkbox" name="with_doc"
id="with_doc" checked="checked" />
- <label for="with_doc"><?php echo __('Data
Dictionary'); ?></label><br />
- <input type="checkbox" name="show_keys" id="show_keys"
/>
- <label for="show_keys"><?php echo __('Only show
keys'); ?></label><br />
-
- <label for="orientation_opt"><?php echo __('Data
Dictionary Format'); ?></label>
- <select name="orientation" id="orientation_opt">
- <option value="L"><?php echo
__('Landscape');?></option>
- <option value="P"><?php echo
__('Portrait');?></option>
- </select><br />
-
- <label for="paper_opt"><?php echo __('Paper size');
?></label>
- <select name="paper" id="paper_opt">
- <?php
- foreach ($cfg['PDFPageSizes'] AS $key => $val) {
- echo '<option value="' . $val . '"';
- if ($val == $cfg['PDFDefaultPageSize']) {
- echo ' selected="selected"';
- }
- echo ' >' . $val . '</option>' .
"\n";
- }
- ?>
- </select>
- </fieldset>
- <fieldset class="tblFooters">
- <input type="submit" value="<?php echo __('Go');
?>" />
- </fieldset>
- </form>
- <?php
+ if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
+ include('./libraries/display_pdf_schema.lib.php');
} // end if
echo '<br /><a href="pdf_pages.php?' . $url_query .
'">';
if ($cfg['PropertiesIconic']) {
diff --git a/libraries/display_pdf_schema.lib.php b/libraries/display_pdf_schema.lib.php
new file mode 100644
index 0000000..ad12fc3
--- /dev/null
+++ b/libraries/display_pdf_schema.lib.php
@@ -0,0 +1,71 @@
+<!-- PDF schema -->
+<form method="post" action="pdf_schema.php">
+<fieldset>
+ <legend>
+ <?php
+ echo PMA_generate_common_hidden_inputs($db);
+ if ($cfg['PropertiesIconic']) {
+ echo '<img class="icon" src="' . $pmaThemeImage .
'b_view.png"'
+ .' alt="" width="16" height="16"
/>';
+ }
+ echo __('Display PDF schema');
+ ?>:
+ </legend>
+ <?php
+ if (isset($test_rs)) {
+ ?>
+ <label for="pdf_page_number_opt"><?php echo __('Page
number:'); ?></label>
+ <select name="pdf_page_number" id="pdf_page_number_opt">
+ <?php
+ while ($pages = @PMA_DBI_fetch_assoc($test_rs)) {
+ echo ' <option value="' .
$pages['page_nr'] . '">'
+ . $pages['page_nr'] . ': ' .
htmlspecialchars($pages['page_descr']) . '</option>' .
"\n";
+ } // end while
+ PMA_DBI_free_result($test_rs);
+ unset($test_rs);
+ ?>
+ </select><br />
+ <?php } else { ?>
+ <input type="hidden" name="pdf_page_number"
value="<?php echo htmlspecialchars($chpage); ?>" />
+ <?php } ?>
+
+ <input type="checkbox" name="show_grid"
id="show_grid_opt" />
+ <label for="show_grid_opt"><?php echo __('Show grid');
?></label><br />
+ <input type="checkbox" name="show_color"
id="show_color_opt"
+ checked="checked" />
+ <label for="show_color_opt"><?php echo __('Show color');
?></label><br />
+ <input type="checkbox" name="show_table_dimension"
id="show_table_dim_opt" />
+ <label for="show_table_dim_opt"><?php echo __('Show dimension
of tables'); ?>
+ </label><br />
+ <input type="checkbox" name="all_tab_same_wide"
id="all_tab_same_wide" />
+ <label for="all_tab_same_wide"><?php echo __('Display all
tables with the same width'); ?>
+ </label><br />
+ <input type="checkbox" name="with_doc" id="with_doc"
checked="checked" />
+ <label for="with_doc"><?php echo __('Data Dictionary');
?></label><br />
+ <input type="checkbox" name="show_keys"
id="show_keys" />
+ <label for="show_keys"><?php echo __('Only show keys');
?></label><br />
+
+ <label for="orientation_opt"><?php echo __('Data Dictionary
Format'); ?></label>
+ <select name="orientation" id="orientation_opt">
+ <option value="L"><?php echo
__('Landscape');?></option>
+ <option value="P"><?php echo
__('Portrait');?></option>
+ </select><br />
+
+ <label for="paper_opt"><?php echo __('Paper size');
?></label>
+ <select name="paper" id="paper_opt">
+ <?php
+ foreach ($cfg['PDFPageSizes'] AS $key => $val) {
+ echo '<option value="' . $val . '"';
+ if ($val == $cfg['PDFDefaultPageSize']) {
+ echo ' selected="selected"';
+ }
+ echo ' >' . $val . '</option>' . "\n";
+ }
+ ?>
+ </select>
+</fieldset>
+<fieldset class="tblFooters">
+ <input type="submit" value="<?php echo __('Go');
?>" />
+</fieldset>
+</form>
+
diff --git a/pdf_pages.php b/pdf_pages.php
index 5ad7899..ac5e215 100644
--- a/pdf_pages.php
+++ b/pdf_pages.php
@@ -298,14 +298,26 @@ if ($cfgRelation['pdfwork']) {
</legend>
<?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
<input type="hidden" name="do" value="createpage"
/>
- <input type="text" name="newpage" size="20"
maxlength="50" />
- <input type="checkbox" name="auto_layout_internal" />
-<?php echo '(' . __('Automatic layout') . ' / ' .
__('Internal relations') . ')';
+ <table>
+ <tr>
+ <td><label for="id_newpage"><?php echo __('Page
name'); ?></label></td>
+ <td><input type="text" name="newpage"
id="id_newpage" size="20" maxlength="50" /></td>
+ </tr>
+ <tr>
+ <td><?php echo __('Automatic layout based on'); ?></td>
+ <td>
+ <input type="checkbox" name="auto_layout_internal"
id="id_auto_layout_internal" /><label
for="id_auto_layout_internal"><?php echo __('Internal relations');
?></label><br />
+<?php
if (PMA_StorageEngine::isValid('InnoDB') ||
PMA_StorageEngine::isValid('PBXT')) {
- echo '<input type="checkbox"
name="auto_layout_foreign" />'
- . '(' . __('Automatic layout') . ' / FOREIGN KEY)';
+?>
+ <input type="checkbox" name="auto_layout_foreign"
id="id_auto_layout_foreign" /><label
for="id_auto_layout_foreign">FOREIGN KEY</label><br />
+<?php
}
?>
+ </td></tr>
+ </table>
+ </fieldset>
+ <fieldset class="tblFooters">
<input type="submit" value="<?php echo __('Go');
?>" />
</fieldset>
</form>
@@ -520,39 +532,7 @@ function resetDrag() {
&& ($do == 'edcoord'
|| ($do == 'choosepage' && isset($chpage))
|| ($do == 'createpage' && isset($chpage)))) {
- ?>
-<form method="post" action="pdf_schema.php"
name="pdfoptions">
- <?php echo PMA_generate_common_hidden_inputs($db); ?>
- <input type="hidden" name="pdf_page_number"
value="<?php echo htmlspecialchars($chpage); ?>" />
-
- <?php echo '<br /><strong>' . __('Display PDF schema')
. '</strong>'; ?>: <br />
- <input type="checkbox" name="show_grid"
id="show_grid_opt" /><label for="show_grid_opt"><?php echo
__('Show grid'); ?></label><br />
- <input type="checkbox" name="show_color"
id="show_color_opt" checked="checked" /><label
for="show_color_opt"><?php echo __('Show color');
?></label><br />
- <input type="checkbox" name="show_table_dimension"
id="show_table_dim_opt" /><label
for="show_table_dim_opt"><?php echo __('Show dimension of
tables'); ?></label><br />
- <input type="checkbox" name="all_tab_same_wide"
id="all_tab_same_wide" /><label
for="all_tab_same_wide"><?php echo __('Display all tables with the
same width'); ?></label><br />
- <input type="checkbox" name="with_doc" id="with_doc"
checked="checked" /><label for="with_doc"><?php echo
__('Data Dictionary'); ?></label><br />
- <input type="checkbox" name="show_keys"
id="show_keys" /><label for="show_keys"><?php echo
__('Only show keys'); ?></label><br />
- <label for="orientation_opt"><?php echo __('Data Dictionary
Format'); ?></label>
- <select id="orientation_opt" name="orientation" <?php echo
($cfg['WYSIWYG-PDF'] ?
'onchange="refreshDragOption(\'pdflayout\');"' : '');
?>>
- <option value="L"><?php echo
__('Landscape');?></option>
- <option value="P"><?php echo
__('Portrait');?></option>
- </select><br />
-
- <label for="paper_opt"><?php echo __('Paper size');
?></label>
- <select id="paper_opt" name="paper" <?php echo
($cfg['WYSIWYG-PDF'] ?
'onchange="refreshDragOption(\'pdflayout\');"' : '');
?>>
-<?php
- foreach ($cfg['PDFPageSizes'] AS $key => $val) {
- echo '<option value="' . $val . '"';
- if ($val == $cfg['PDFDefaultPageSize']) {
- echo ' selected="selected"';
- }
- echo ' >' . $val . '</option>' . "\n";
- }
-?>
- </select><br />
- <input type="submit" value="<?php echo
__('Go'); ?>" />
-</form>
-<?php
+ include('./libraries/display_pdf_schema.lib.php');
if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
?>
<script type="text/javascript">
hooks/post-receive
--
phpMyAdmin