3 // vim: expandtab sw=4 ts=4 sts=4:
7 * Gets some core libraries
9 require('./libraries/grab_globals.lib.php3');
10 require('./libraries/common.lib.php3');
11 require('./db_details_common.php3');
15 * Settings for relation stuff
17 require('./libraries/relation.lib.php3');
18 $cfgRelation = PMA_getRelationsParam();
22 * Now in ./libraries/relation.lib.php3 we check for all tables
23 * that we need, but if we don't find them we are quiet about it
24 * so people can work without.
25 * This page is absolutely useless if you didn't set up your tables
26 * correctly, so it is a good place to see which tables we can and
29 if (!$cfgRelation['relwork']) {
30 echo sprintf($strNotSet, 'relation', 'config.inc.php3') . '<br />' . "\n"
31 . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
35 if (!$cfgRelation['displaywork']) {
36 echo sprintf($strNotSet, 'table_info', 'config.inc.php3') . '<br />' . "\n"
37 . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
41 if (!isset($cfgRelation['table_coords'])){
42 echo sprintf($strNotSet, 'table_coords', 'config.inc.php3') . '<br />' . "\n"
43 . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
46 if (!isset($cfgRelation['pdf_pages'])) {
47 echo sprintf($strNotSet, 'pdf_page', 'config.inc.php3') . '<br />' . "\n"
48 . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
52 if ($cfgRelation['pdfwork']) {
53 // Now is the time to work on all changes
57 if (!isset($newpage) ||
$newpage == '') {
58 $newpage = $strNoDescription;
60 $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
61 . ' (db_name, page_descr)'
62 . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
63 PMA_query_as_cu($ins_query);
67 for ($i = 0; $i < $c_table_rows; $i++
) {
68 $arrvalue = 'c_table_' . $i;
69 $arrvalue = $
$arrvalue;
70 if (!isset($arrvalue['x']) ||
$arrvalue['x'] == '') {
73 if (!isset($arrvalue['y']) ||
$arrvalue['y'] == '') {
76 if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
77 $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
78 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
79 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
80 . ' AND pdf_page_number = ' . $chpage;
81 $test_rs = PMA_query_as_cu($test_query);
82 if ($test_rs && mysql_num_rows($test_rs) > 0) {
83 if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
84 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
85 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
86 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
87 . ' AND pdf_page_number = ' . $chpage;
89 $ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
90 . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
91 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
92 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
93 . ' AND pdf_page_number = ' . $chpage;
96 $ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
97 . '(db_name, table_name, pdf_page_number, x, y) '
98 . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
100 PMA_query_as_cu($ch_query);
105 } // end if (isset($do))
107 // We will need an array of all tables in this db
108 $selectboxall[] = '--';
109 $alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db);
110 $alltab_rs = @PMA_mysql_query
($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
111 while (list($table) = @PMA_mysql_fetch_array
($alltab_rs)) {
112 $selectboxall[] = $table;
115 // Now first show some possibility to choose a page for the pdf
116 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
117 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
118 $page_rs = PMA_query_as_cu($page_query);
119 if ($page_rs && mysql_num_rows($page_rs) > 0) {
121 <form method
="post" action
="pdf_pages.php3" name
="selpage">
122 <?php
echo $strChoosePage . "\n"; ?
>
123 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
124 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
125 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
126 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
127 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
128 <input type
="hidden" name
="do" value
="choosepage" />
129 <select name
="chpage" onchange
="this.form.submit()">
131 while ($curr_page = @PMA_mysql_fetch_array
($page_rs)) {
133 . '<option value="' . $curr_page['page_nr'] . '"';
134 if (isset($chpage) && $chpage == $curr_page['page_nr']) {
135 echo ' selected="selected"';
137 echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
142 <input type
="submit" value
="<?php echo $strGo; ?>" />
148 // Possibility to create a new page:
150 <form method
="post" action
="pdf_pages.php3" name
="crpage">
151 <?php
echo $strCreatePage . "\n"; ?
>
152 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
153 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
154 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
155 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
156 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
157 <input type
="hidden" name
="do" value
="createpage" />
158 <input type
="text" name
="newpage" size
="20" maxlength
="50" />
159 <input type
="submit" value
="<?php echo $strGo; ?>" />
162 // Now if we allready have choosen a page number then we should show the
164 if (isset($chpage) && $chpage > 0) {
169 <h2
><?php
echo $strSelectTables ;?
></h2
>
170 <form method
="post" action
="pdf_pages.php3" name
="edcoord">
171 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
172 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
173 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
174 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
175 <input type
="hidden" name
="table" value
="<?php echo $table; ?>" />
176 <input type
="hidden" name
="chpage" value
="<?php echo $chpage; ?>" />
177 <input type
="hidden" name
="do" value
="edcoord" />
180 <th
><?php
echo $strTable; ?
></th
>
181 <th
><?php
echo $strDelete; ?
></th
>
186 if (isset($ctable)) {
190 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
191 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
192 . ' AND pdf_page_number = ' . $chpage;
193 $page_rs = PMA_query_as_cu($page_query);
196 while ($sh_page = @PMA_mysql_fetch_array
($page_rs)) {
199 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
201 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
205 . "\n" . ' <select name="c_table_' . $i . '[name]">';
206 reset($selectboxall);
207 while (list($key, $value) = each($selectboxall)) {
208 echo "\n" . ' <option value="' . $value . '"';
209 if ($value == $sh_page['table_name']) {
210 echo ' selected="selected"';
212 echo '>' . $value . '</option>';
214 echo "\n" . ' </select>'
217 . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
218 echo "\n" . ' </td>';
220 . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
221 echo "\n" . ' </td>';
223 . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
224 echo "\n" . ' </td>';
225 echo "\n" . ' </tr>';
228 // Do one more empty row
231 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
233 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
237 . "\n" . ' <select name="c_table_' . $i . '[name]">';
238 reset($selectboxall);
239 while (list($key, $value) = each($selectboxall)) {
240 echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
242 echo "\n" . ' </select>'
245 . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
246 echo "\n" . ' </td>';
248 . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
249 echo "\n" . ' </td>';
251 . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
252 echo "\n" . ' </td>';
253 echo "\n" . ' </tr>';
254 echo "\n" . ' </table>' . "\n";
256 echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i +
1) . '" />';
257 echo "\n" . ' <input type="submit" value="' . $strGo . '" />';
258 echo "\n" . '</form>' . "\n\n";
261 if (isset($do) && ($do == 'edcoord' ||
$do == 'choosepage')) {
263 <form method
="post" action
="pdf_schema.php3">
264 <input type
="hidden" name
="server" value
="<?php echo $server; ?>" />
265 <input type
="hidden" name
="lang" value
="<?php echo $lang; ?>" />
266 <input type
="hidden" name
="convcharset" value
="<?php echo $convcharset; ?>" />
267 <input type
="hidden" name
="db" value
="<?php echo $db; ?>" />
268 <input type
="hidden" name
="pdf_page_number" value
="<?php echo $chpage; ?>" />
269 <?php
echo $strDisplayPDF; ?
> 
;:<br
/>
270 <input type
="checkbox" name
="show_grid" id
="show_grid_opt" />
271 <label
for="show_grid_opt"><?php
echo $strShowGrid; ?
></label
><br
/>
272 <input type
="checkbox" name
="show_color" id
="show_color_opt" checked
="checked" />
273 <label
for="show_color_opt"><?php
echo $strShowColor; ?
></label
><br
/>
274 <input type
="checkbox" name
="show_table_dimension" id
="show_table_dim_opt" />
275 <label
for="show_table_dim_opt"><?php
echo $strShowTableDimension; ?
></label
><br
/>
276 <input type
="checkbox" name
="all_tab_same_wide" id
="all_tab_same_wide" />
277 <label
for="all_tab_same_wide"><?php
echo $strAllTableSameWidth; ?
></label
>
278  
; 
;<input type
="submit" value
="<?php echo $strGo; ?>" />
282 } // end if ($cfgRelation['pdfwork'])
286 * Displays the footer
289 require('./footer.inc.php3');