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 ($action_choose=="1") {
58 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
59 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
60 . ' AND pdf_page_number = ' . $chpage;
61 PMA_query_as_cu($ch_query);
63 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
64 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
65 . ' AND page_nr = ' . $chpage;
66 PMA_query_as_cu($ch_query);
70 if (!isset($newpage) ||
$newpage == '') {
71 $newpage = $strNoDescription;
73 $ins_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['pdf_pages'])
74 . ' (db_name, page_descr)'
75 . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
76 PMA_query_as_cu($ins_query);
80 for ($i = 0; $i < $c_table_rows; $i++
) {
81 $arrvalue = 'c_table_' . $i;
82 $arrvalue = $
$arrvalue;
83 if (!isset($arrvalue['x']) ||
$arrvalue['x'] == '') {
86 if (!isset($arrvalue['y']) ||
$arrvalue['y'] == '') {
89 if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
90 $test_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
91 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
92 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
93 . ' AND pdf_page_number = ' . $chpage;
94 $test_rs = PMA_query_as_cu($test_query);
95 if ($test_rs && mysql_num_rows($test_rs) > 0) {
96 if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
97 $ch_query = 'DELETE FROM ' . PMA_backquote($cfgRelation['table_coords'])
98 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
99 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
100 . ' AND pdf_page_number = ' . $chpage;
102 $ch_query = 'UPDATE ' . PMA_backquote($cfgRelation['table_coords']) . ' '
103 . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
104 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
105 . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
106 . ' AND pdf_page_number = ' . $chpage;
109 $ch_query = 'INSERT INTO ' . PMA_backquote($cfgRelation['table_coords']) . ' '
110 . '(db_name, table_name, pdf_page_number, x, y) '
111 . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
113 PMA_query_as_cu($ch_query);
118 } // end if (isset($do))
120 // We will need an array of all tables in this db
121 $selectboxall[] = '--';
122 $alltab_qry = 'SHOW TABLES FROM ' . PMA_backquote($db);
123 $alltab_rs = @PMA_mysql_query
($alltab_qry) or PMA_mysqlDie('', $alltab_qry, '', $err_url_0);
124 while (list($table) = @PMA_mysql_fetch_array
($alltab_rs)) {
125 $selectboxall[] = $table;
128 // Now first show some possibility to choose a page for the pdf
129 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['pdf_pages'])
130 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
131 $page_rs = PMA_query_as_cu($page_query);
132 if ($page_rs && mysql_num_rows($page_rs) > 0) {
134 <form method
="post" action
="pdf_pages.php3" name
="selpage">
135 <?php
echo $strChoosePage . "\n"; ?
>
136 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
137 <input type
="hidden" name
="do" value
="choosepage" />
138 <select name
="chpage" onchange
="this.form.submit()">
140 while ($curr_page = @PMA_mysql_fetch_array
($page_rs)) {
142 . '<option value="' . $curr_page['page_nr'] . '"';
143 if (isset($chpage) && $chpage == $curr_page['page_nr']) {
144 echo ' selected="selected"';
146 echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
151 <input type
="radio" name
="action_choose" value
="0" id
="radio_choose0" checked
="checked" style
="vertical-align: middle" /> <label
for="radio_choose0">
152 <?php
echo $strEdit; ?
> </label
>
153 <input type
="radio" name
="action_choose" value
="1" id
="radio_choose1" style
="vertical-align: middle" /> <label
for="radio_choose1">
154 <?php
echo $strDelete; ?
> </label
>
156 <input type
="submit" value
="<?php echo $strGo; ?>" />
162 // Possibility to create a new page:
164 <form method
="post" action
="pdf_pages.php3" name
="crpage">
165 <?php
echo $strCreatePage . "\n"; ?
>
166 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
167 <input type
="hidden" name
="do" value
="createpage" />
168 <input type
="text" name
="newpage" size
="20" maxlength
="50" />
169 <input type
="submit" value
="<?php echo $strGo; ?>" />
172 // Now if we allready have choosen a page number then we should show the
174 if (isset($chpage) && $chpage > 0) {
179 <h2
><?php
echo $strSelectTables ;?
></h2
>
180 <form method
="post" action
="pdf_pages.php3" name
="edcoord">
181 <?php
echo PMA_generate_common_hidden_inputs($db, $table); ?
>
182 <input type
="hidden" name
="chpage" value
="<?php echo $chpage; ?>" />
183 <input type
="hidden" name
="do" value
="edcoord" />
186 <th
><?php
echo $strTable; ?
></th
>
187 <th
><?php
echo $strDelete; ?
></th
>
192 if (isset($ctable)) {
196 $page_query = 'SELECT * FROM ' . PMA_backquote($cfgRelation['table_coords'])
197 . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
198 . ' AND pdf_page_number = ' . $chpage;
199 $page_rs = PMA_query_as_cu($page_query);
202 while ($sh_page = @PMA_mysql_fetch_array
($page_rs)) {
205 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
207 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
211 . "\n" . ' <select name="c_table_' . $i . '[name]">';
212 reset($selectboxall);
213 while (list($key, $value) = each($selectboxall)) {
214 echo "\n" . ' <option value="' . $value . '"';
215 if ($value == $sh_page['table_name']) {
216 echo ' selected="selected"';
218 echo '>' . $value . '</option>';
220 echo "\n" . ' </select>'
223 . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
224 echo "\n" . ' </td>';
226 . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
227 echo "\n" . ' </td>';
229 . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
230 echo "\n" . ' </td>';
231 echo "\n" . ' </tr>';
234 // Do one more empty row
237 echo 'bgcolor="' . $cfg['BgcolorOne'] . '"';
239 echo 'bgcolor="' . $cfg['BgcolorTwo'] . '"';
243 . "\n" . ' <select name="c_table_' . $i . '[name]">';
244 reset($selectboxall);
245 while (list($key, $value) = each($selectboxall)) {
246 echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
248 echo "\n" . ' </select>'
251 . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
252 echo "\n" . ' </td>';
254 . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
255 echo "\n" . ' </td>';
257 . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
258 echo "\n" . ' </td>';
259 echo "\n" . ' </tr>';
260 echo "\n" . ' </table>' . "\n";
262 echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i +
1) . '" />';
263 echo "\n" . ' <input type="submit" value="' . $strGo . '" />';
264 echo "\n" . '</form>' . "\n\n";
267 if (isset($do) && ($do == 'edcoord' ||
$do == 'choosepage')) {
269 <form method
="post" action
="pdf_schema.php3">
270 <?php
echo PMA_generate_common_hidden_inputs($db); ?
>
271 <input type
="hidden" name
="pdf_page_number" value
="<?php echo $chpage; ?>" />
272 <?php
echo $strDisplayPDF; ?
> 
;:<br
/>
273 <input type
="checkbox" name
="show_grid" id
="show_grid_opt" />
274 <label
for="show_grid_opt"><?php
echo $strShowGrid; ?
></label
><br
/>
275 <input type
="checkbox" name
="show_color" id
="show_color_opt" checked
="checked" />
276 <label
for="show_color_opt"><?php
echo $strShowColor; ?
></label
><br
/>
277 <input type
="checkbox" name
="show_table_dimension" id
="show_table_dim_opt" />
278 <label
for="show_table_dim_opt"><?php
echo $strShowTableDimension; ?
></label
><br
/>
279 <input type
="checkbox" name
="all_tab_same_wide" id
="all_tab_same_wide" />
280 <label
for="all_tab_same_wide"><?php
echo $strAllTableSameWidth; ?
></label
><br
/>
281 <input type
="checkbox" name
="with_doc" id
="with_doc" checked
="checked" />
282 <label
for="with_doc"><?php
echo $strDataDict; ?
></label
> <br
/>
283 <?php
echo $strShowDatadictAs; ?
>
284 <select name
="orientation">
285 <option value
="L"><?php
echo $strLandscape;?
></option
>
286 <option value
="P"><?php
echo $strPortrait;?
></option
>
288  
; 
;<input type
="submit" value
="<?php echo $strGo; ?>" />
292 } // end if ($cfgRelation['pdfwork'])
296 * Displays the footer
299 require('./footer.inc.php3');