6 * Gets some core libraries
8 require('./libraries/grab_globals.lib.php3');
9 require('./libraries/common.lib.php3');
10 include('./db_details_common.php3');
13 * Settings for relation stuff
15 require('./libraries/relation.lib.php3');
16 $cfgRelation = PMA_getRelationsParam();
20 * Now in ./libraries/relation.lib.php3 we check for all tables
21 * that we need, but if we don't find them we are quiet about it
22 * so people can work without.
23 * This page is absolutely useless if you didn't set up your tables
24 * correctly, so it is a good place to see which tables we can and
27 if (!$cfgRelation['relwork']) {
28 echo sprintf($strNotSet, 'relation', 'config.inc.php3') . '<br />' . "\n"
29 . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
33 if (!$cfgRelation['displaywork']) {
34 echo sprintf($strNotSet, 'table_info', 'config.inc.php3') . '<br />' . "\n"
35 . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
39 if (!isset($cfgRelation['table_coords'])){
40 echo sprintf($strNotSet, 'table_coords', 'config.inc.php3') . '<br />' . "\n"
41 . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
44 if (!isset($cfgRelation['pdf_pages'])) {
45 echo sprintf($strNotSet, 'pdf_page', 'config.inc.php3') . '<br />' . "\n"
46 . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
50 if ($cfgRelation['pdfwork']) {
51 // Now is the time to work on all changes
55 if (!isset($newpage) ||
$newpage == '') {
56 $newpage = $strNoDescription;
58 $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
59 . ' (db_name, page_descr)'
60 . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
61 PMA_query_as_cu($ins_query);
65 while (list($key, $arrvalue) = each($ctable)) {
66 if (!isset($arrvalue['x']) ||
$arrvalue['x'] == '') {
69 if (!isset($arrvalue['y']) ||
$arrvalue['y'] == '') {
72 if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
73 $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
74 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
75 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
76 . ' AND pdf_page_number = ' . $chpage;
77 $test_rs = PMA_query_as_cu($test_query);
78 if ($test_rs && mysql_num_rows($test_rs) > 0) {
79 if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
80 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
81 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
82 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
83 . ' AND pdf_page_number = ' . $chpage;
85 $ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
86 . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
87 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
88 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
89 . ' AND pdf_page_number = ' . $chpage;
92 $ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
93 . '(db_name, table_name, pdf_page_number, x, y) '
94 . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
96 PMA_query_as_cu($ch_query);
101 } // end if (isset($do))
103 // We will need an array of all tables in this db
104 $selectboxall[] = '--';
105 $alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db);
106 $alltab_rs = @PMA_mysql_query
($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
107 while (list($table) = @PMA_mysql_fetch_array
($alltab_rs)) {
108 $selectboxall[] = $table;
111 // Now first show some possibility to choose a page for the pdf
112 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
113 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
114 $page_rs = PMA_query_as_cu($page_query);
115 if ($page_rs && mysql_num_rows($page_rs) > 0) {
117 <form action
="pdf_pages.php3" method
="post" name
="selpage">
118 <?php
echo $strChoosePage . "\n"; ?
>
119 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
120 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
121 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
122 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
123 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
124 <input type
="hidden" name
="do" value
="choosepage" />
125 <select name
="chpage" onchange
="this.form.submit()">
127 while ($curr_page = @PMA_mysql_fetch_array
($page_rs)) {
129 . '<option value="' . $curr_page['page_nr'] . '"';
130 if (isset($chpage) && $chpage == $curr_page['page_nr']) {
131 echo ' selected="selected"';
133 echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
138 <input type
="submit" value
="<?php echo $strGo; ?>" />
144 // Possibility to create a new page:
146 <form action
="pdf_pages.php3" method
="post" name
="crpage">
147 <?php
echo $strCreatePage . "\n"; ?
>
148 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
149 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
150 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
151 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
152 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
153 <input type
="hidden" name
="do" value
="createpage" />
154 <input type
="text" name
="newpage" size
="20" maxlength
="50" />
155 <input type
="submit" value
="<?php echo $strGo; ?>" />
158 // Now if we allready have choosen a page number then we should show the
160 if (isset($chpage) && $chpage > 0) {
165 <h2
><?php
echo $strSelectTables ;?
></h2
>
166 <form action
="pdf_pages.php3" method
="post" name
="edcoord">
167 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
168 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
169 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
170 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
171 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
172 <input type
="hidden" name
="chpage" value
="<?php echo $chpage; ?>" />
173 <input type
="hidden" name
="do" value
="edcoord" />
176 <th
><?php
echo $strTable; ?
></th
>
177 <th
><?php
echo $strDelete; ?
></th
>
182 if (isset($ctable)) {
186 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
187 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
188 . ' AND pdf_page_number = ' . $chpage;
189 $page_rs = PMA_query_as_cu($page_query);
192 while ($sh_page = @PMA_mysql_fetch_array
($page_rs)) {
195 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
197 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
201 . "\n" . ' <select name="ctable[' . $i . '][name]">';
202 reset($selectboxall);
203 while (list($key, $value) = each($selectboxall)) {
204 echo "\n" . ' <option value="' . $value . '"';
205 if ($value == $sh_page['table_name']) {
206 echo ' selected="selected"';
208 echo '>' . $value . '</option>';
210 echo "\n" . ' </select>'
213 . "\n" . ' <input type="checkbox" name="ctable[' . $i . '][delete]" value="y" />' . $strDelete;
214 echo "\n" . ' </td>';
216 . "\n" . ' <input type="text" name="ctable[' . $i . '][x]" value="' . $sh_page['x'] . '" />';
217 echo "\n" . ' </td>';
219 . "\n" . ' <input type="text" name="ctable[' . $i . '][y]" value="' . $sh_page['y'] . '" />';
220 echo "\n" . ' </td>';
221 echo "\n" . ' </tr>';
224 // Do one more empty row
227 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
229 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
233 . "\n" . ' <select name="ctable[' . $i . '][name]">';
234 reset($selectboxall);
235 while (list($key, $value) = each($selectboxall)) {
236 echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
238 echo "\n" . ' </select>'
241 . "\n" . ' <input type="checkbox" name="ctable[' . $i . '][delete]" value="y" />' . $strDelete;
242 echo "\n" . ' </td>';
244 . "\n" . ' <input type="text" name="ctable[' . $i . '][x]" value="' . $sh_page['x'] . '" />';
245 echo "\n" . ' </td>';
247 . "\n" . ' <input type="text" name="ctable[' . $i . '][y]" value="' . $sh_page['y'] . '" />';
248 echo "\n" . ' </td>';
249 echo "\n" . ' </tr>';
250 echo "\n" . ' </table>' . "\n";
252 echo "\n" . ' <input type="submit" value="' . $strGo . '" />';
253 echo "\n" . '</form>' . "\n\n";
255 if($do=="edcoord" ||
$do == "choosepage"){
257 <form method
="post" action
="pdf_schema.php3">
258 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
259 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
260 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
261 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
262 <input type
="hidden" name
="pdf_page_number" value
="<?php echo $chpage; ?>" />
263 <?php
echo $strDisplayPDF; ?
> 
;:<br
/>
264 <input type
="checkbox" name
="show_grid" id
="show_grid_opt" />
265 <label
for="show_grid_opt"><?php
echo $strShowGrid; ?
></label
><br
/>
266 <input type
="checkbox" name
="show_color" id
="show_color_opt" checked
="checked" />
267 <label
for="show_color_opt"><?php
echo $strShowColor; ?
></label
><br
/>
268 <input type
="checkbox" name
="show_table_dimension" id
="show_table_dim_opt" />
269 <label
for="show_table_dim_opt"><?php
echo $strShowTableDimension; ?
></label
><br
/>
270 <input type
="checkbox" name
="all_tab_same_wide" id
="all_tab_same_wide" />
271 <label
for="all_tab_same_wide"><?php
echo $strAllTableSameWidth; ?
></label
>
272  
; 
;<input type
="submit" value
="<?php echo $strGo; ?>" />
276 } // end if ($cfgRelation['pdfwork'])
280 * Displays the footer
283 require('./footer.inc.php3');