6 * Gets some core libraries
8 require('./libraries/grab_globals.lib.php3');
9 require('./libraries/common.lib.php3');
10 require('./db_details_common.php3');
14 * Settings for relation stuff
16 require('./libraries/relation.lib.php3');
17 $cfgRelation = PMA_getRelationsParam();
21 * Now in ./libraries/relation.lib.php3 we check for all tables
22 * that we need, but if we don't find them we are quiet about it
23 * so people can work without.
24 * This page is absolutely useless if you didn't set up your tables
25 * correctly, so it is a good place to see which tables we can and
28 if (!$cfgRelation['relwork']) {
29 echo sprintf($strNotSet, 'relation', 'config.inc.php3') . '<br />' . "\n"
30 . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
34 if (!$cfgRelation['displaywork']) {
35 echo sprintf($strNotSet, 'table_info', 'config.inc.php3') . '<br />' . "\n"
36 . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
40 if (!isset($cfgRelation['table_coords'])){
41 echo sprintf($strNotSet, 'table_coords', 'config.inc.php3') . '<br />' . "\n"
42 . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
45 if (!isset($cfgRelation['pdf_pages'])) {
46 echo sprintf($strNotSet, 'pdf_page', 'config.inc.php3') . '<br />' . "\n"
47 . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
51 if ($cfgRelation['pdfwork']) {
52 // Now is the time to work on all changes
56 if (!isset($newpage) ||
$newpage == '') {
57 $newpage = $strNoDescription;
59 $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
60 . ' (db_name, page_descr)'
61 . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
62 PMA_query_as_cu($ins_query);
66 for ($i = 0; $i < $c_table_rows; $i++
) {
67 $arrvalue = 'c_table_' . $i;
68 $arrvalue = $
$arrvalue;
69 if (!isset($arrvalue['x']) ||
$arrvalue['x'] == '') {
72 if (!isset($arrvalue['y']) ||
$arrvalue['y'] == '') {
75 if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
76 $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
77 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
78 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
79 . ' AND pdf_page_number = ' . $chpage;
80 $test_rs = PMA_query_as_cu($test_query);
81 if ($test_rs && mysql_num_rows($test_rs) > 0) {
82 if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
83 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
84 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
85 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
86 . ' AND pdf_page_number = ' . $chpage;
88 $ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
89 . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
90 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
91 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
92 . ' AND pdf_page_number = ' . $chpage;
95 $ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
96 . '(db_name, table_name, pdf_page_number, x, y) '
97 . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
99 PMA_query_as_cu($ch_query);
104 } // end if (isset($do))
106 // We will need an array of all tables in this db
107 $selectboxall[] = '--';
108 $alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db);
109 $alltab_rs = @PMA_mysql_query
($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
110 while (list($table) = @PMA_mysql_fetch_array
($alltab_rs)) {
111 $selectboxall[] = $table;
114 // Now first show some possibility to choose a page for the pdf
115 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
116 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
117 $page_rs = PMA_query_as_cu($page_query);
118 if ($page_rs && mysql_num_rows($page_rs) > 0) {
120 <form method
="post" action
="pdf_pages.php3" name
="selpage">
121 <?php
echo $strChoosePage . "\n"; ?
>
122 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
123 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
124 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
125 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
126 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
127 <input type
="hidden" name
="do" value
="choosepage" />
128 <select name
="chpage" onchange
="this.form.submit()">
130 while ($curr_page = @PMA_mysql_fetch_array
($page_rs)) {
132 . '<option value="' . $curr_page['page_nr'] . '"';
133 if (isset($chpage) && $chpage == $curr_page['page_nr']) {
134 echo ' selected="selected"';
136 echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
141 <input type
="submit" value
="<?php echo $strGo; ?>" />
147 // Possibility to create a new page:
149 <form method
="post" action
="pdf_pages.php3" name
="crpage">
150 <?php
echo $strCreatePage . "\n"; ?
>
151 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
152 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
153 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
154 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
155 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
156 <input type
="hidden" name
="do" value
="createpage" />
157 <input type
="text" name
="newpage" size
="20" maxlength
="50" />
158 <input type
="submit" value
="<?php echo $strGo; ?>" />
161 // Now if we allready have choosen a page number then we should show the
163 if (isset($chpage) && $chpage > 0) {
168 <h2
><?php
echo $strSelectTables ;?
></h2
>
169 <form method
="post" action
="pdf_pages.php3" name
="edcoord">
170 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
171 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
172 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
173 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
174 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
175 <input type
="hidden" name
="chpage" value
="<?php echo $chpage; ?>" />
176 <input type
="hidden" name
="do" value
="edcoord" />
179 <th
><?php
echo $strTable; ?
></th
>
180 <th
><?php
echo $strDelete; ?
></th
>
185 if (isset($ctable)) {
189 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
190 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
191 . ' AND pdf_page_number = ' . $chpage;
192 $page_rs = PMA_query_as_cu($page_query);
195 while ($sh_page = @PMA_mysql_fetch_array
($page_rs)) {
198 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
200 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
204 . "\n" . ' <select name="c_table_' . $i . '[name]">';
205 reset($selectboxall);
206 while (list($key, $value) = each($selectboxall)) {
207 echo "\n" . ' <option value="' . $value . '"';
208 if ($value == $sh_page['table_name']) {
209 echo ' selected="selected"';
211 echo '>' . $value . '</option>';
213 echo "\n" . ' </select>'
216 . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
217 echo "\n" . ' </td>';
219 . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
220 echo "\n" . ' </td>';
222 . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
223 echo "\n" . ' </td>';
224 echo "\n" . ' </tr>';
227 // Do one more empty row
230 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
232 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
236 . "\n" . ' <select name="c_table_' . $i . '[name]">';
237 reset($selectboxall);
238 while (list($key, $value) = each($selectboxall)) {
239 echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
241 echo "\n" . ' </select>'
244 . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
245 echo "\n" . ' </td>';
247 . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
248 echo "\n" . ' </td>';
250 . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
251 echo "\n" . ' </td>';
252 echo "\n" . ' </tr>';
253 echo "\n" . ' </table>' . "\n";
255 echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i +
1) . '">';
256 echo "\n" . ' <input type="submit" value="' . $strGo . '" />';
257 echo "\n" . '</form>' . "\n\n";
260 if ($do == 'edcoord' ||
$do == 'choosepage') {
262 <form method
="post" action
="pdf_schema.php3">
263 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
264 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
265 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
266 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
267 <input type
="hidden" name
="pdf_page_number" value
="<?php echo $chpage; ?>" />
268 <?php
echo $strDisplayPDF; ?
> 
;:<br
/>
269 <input type
="checkbox" name
="show_grid" id
="show_grid_opt" />
270 <label
for="show_grid_opt"><?php
echo $strShowGrid; ?
></label
><br
/>
271 <input type
="checkbox" name
="show_color" id
="show_color_opt" checked
="checked" />
272 <label
for="show_color_opt"><?php
echo $strShowColor; ?
></label
><br
/>
273 <input type
="checkbox" name
="show_table_dimension" id
="show_table_dim_opt" />
274 <label
for="show_table_dim_opt"><?php
echo $strShowTableDimension; ?
></label
><br
/>
275 <input type
="checkbox" name
="all_tab_same_wide" id
="all_tab_same_wide" />
276 <label
for="all_tab_same_wide"><?php
echo $strAllTableSameWidth; ?
></label
>
277  
; 
;<input type
="submit" value
="<?php echo $strGo; ?>" />
281 } // end if ($cfgRelation['pdfwork'])
285 * Displays the footer
288 require('./footer.inc.php3');