1 | <?php
|
---|
2 | /* $Id: pdf_pages.php 9819 2007-01-02 14:52:51Z lem9 $ */
|
---|
3 | // vim: expandtab sw=4 ts=4 sts=4:
|
---|
4 |
|
---|
5 | /**
|
---|
6 | * Gets some core libraries
|
---|
7 | */
|
---|
8 | require_once('./libraries/common.lib.php');
|
---|
9 | require_once('./libraries/db_common.inc.php');
|
---|
10 |
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Settings for relation stuff
|
---|
14 | */
|
---|
15 | require_once('./libraries/relation.lib.php');
|
---|
16 | $cfgRelation = PMA_getRelationsParam();
|
---|
17 |
|
---|
18 | // This is to avoid "Command out of sync" errors. Before switching this to
|
---|
19 | // a value of 0 (for MYSQLI_USE_RESULT), please check the logic
|
---|
20 | // to free results wherever needed.
|
---|
21 | $query_default_option = PMA_DBI_QUERY_STORE;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Now in ./libraries/relation.lib.php we check for all tables
|
---|
25 | * that we need, but if we don't find them we are quiet about it
|
---|
26 | * so people can work without.
|
---|
27 | * This page is absolutely useless if you didn't set up your tables
|
---|
28 | * correctly, so it is a good place to see which tables we can and
|
---|
29 | * complain ;-)
|
---|
30 | */
|
---|
31 | if (!$cfgRelation['relwork']) {
|
---|
32 | echo sprintf($strNotSet, 'relation', 'config.inc.php') . '<br />' . "\n"
|
---|
33 | . '<a href="./Documentation.html#relation" target="documentation">' . $strDocu . '</a>' . "\n";
|
---|
34 | require_once('./libraries/footer.inc.php');
|
---|
35 | }
|
---|
36 |
|
---|
37 | if (!$cfgRelation['displaywork']) {
|
---|
38 | echo sprintf($strNotSet, 'table_info', 'config.inc.php') . '<br />' . "\n"
|
---|
39 | . '<a href="./Documentation.html#table_info" target="documentation">' . $strDocu . '</a>' . "\n";
|
---|
40 | require_once('./libraries/footer.inc.php');
|
---|
41 | }
|
---|
42 |
|
---|
43 | if (!isset($cfgRelation['table_coords'])){
|
---|
44 | echo sprintf($strNotSet, 'table_coords', 'config.inc.php') . '<br />' . "\n"
|
---|
45 | . '<a href="./Documentation.html#table_coords" target="documentation">' . $strDocu . '</a>' . "\n";
|
---|
46 | exit();
|
---|
47 | }
|
---|
48 | if (!isset($cfgRelation['pdf_pages'])) {
|
---|
49 | echo sprintf($strNotSet, 'pdf_page', 'config.inc.php') . '<br />' . "\n"
|
---|
50 | . '<a href="./Documentation.html#pdf_pages" target="documentation">' . $strDocu . '</a>' . "\n";
|
---|
51 | exit();
|
---|
52 | }
|
---|
53 |
|
---|
54 | if ($cfgRelation['pdfwork']) {
|
---|
55 | // Now is the time to work on all changes
|
---|
56 | if (isset($do)) {
|
---|
57 | switch ($do) {
|
---|
58 | case 'choosepage':
|
---|
59 | if ($action_choose=="1") {
|
---|
60 | $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
|
---|
61 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
---|
62 | . ' AND pdf_page_number = ' . $chpage;
|
---|
63 | PMA_query_as_cu($ch_query, FALSE, $query_default_option);
|
---|
64 |
|
---|
65 | $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
---|
66 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
---|
67 | . ' AND page_nr = ' . $chpage;
|
---|
68 | PMA_query_as_cu($ch_query, FALSE, $query_default_option);
|
---|
69 |
|
---|
70 | unset($chpage);
|
---|
71 | }
|
---|
72 | break;
|
---|
73 | case 'createpage':
|
---|
74 | if (!isset($newpage) || $newpage == '') {
|
---|
75 | $newpage = $strNoDescription;
|
---|
76 | }
|
---|
77 | $ins_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
---|
78 | . ' (db_name, page_descr)'
|
---|
79 | . ' VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($newpage) . '\')';
|
---|
80 | PMA_query_as_cu($ins_query, FALSE, $query_default_option);
|
---|
81 | $pdf_page_number = PMA_DBI_insert_id(isset($controllink) ? $controllink : '');
|
---|
82 |
|
---|
83 | // A u t o m a t i c l a y o u t
|
---|
84 | // ================================
|
---|
85 | if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
|
---|
86 | $all_tables = array();
|
---|
87 | }
|
---|
88 |
|
---|
89 | if (isset($auto_layout_innodb)) {
|
---|
90 | // get the tables list
|
---|
91 | $tables = PMA_DBI_get_tables_full($db);
|
---|
92 | // find the InnoDB ones
|
---|
93 | $innodb_tables = array();
|
---|
94 | foreach($tables as $table_name => $table_properties) {
|
---|
95 | if ($table_properties['ENGINE'] == 'InnoDB') {
|
---|
96 | $innodb_tables[] = $table_name;
|
---|
97 | }
|
---|
98 | }
|
---|
99 | $all_tables = $innodb_tables;
|
---|
100 | // could be improved by finding the tables which have the
|
---|
101 | // most references keys and place them at the beginning
|
---|
102 | // of the array (so that they are all center of schema)
|
---|
103 | unset($tables, $innodb_tables);
|
---|
104 | } // endif auto_layout_innodb
|
---|
105 |
|
---|
106 | if (isset($auto_layout_internal)) {
|
---|
107 | // get the tables that have relations, by descending
|
---|
108 | // number of links
|
---|
109 | $master_tables = 'SELECT COUNT(master_table), master_table'
|
---|
110 | . ' FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['relation'])
|
---|
111 | . ' WHERE master_db = \'' . $db . '\''
|
---|
112 | . ' GROUP BY master_table'
|
---|
113 | . ' ORDER BY ' . PMA_backquote('COUNT(master_table)') . ' DESC ';
|
---|
114 | $master_tables_rs = PMA_query_as_cu($master_tables, FALSE, $query_default_option);
|
---|
115 | if ($master_tables_rs && PMA_DBI_num_rows($master_tables_rs) > 0) {
|
---|
116 | // first put all the master tables at beginning
|
---|
117 | // of the list, so they are near the center of
|
---|
118 | // the schema
|
---|
119 | while (list(, $master_table) = PMA_DBI_fetch_row($master_tables_rs)) {
|
---|
120 | $all_tables[] = $master_table;
|
---|
121 | }
|
---|
122 |
|
---|
123 | // then for each master, add its foreigns into an array
|
---|
124 | // of foreign tables, if not already there
|
---|
125 | // (a foreign might be foreign for more than
|
---|
126 | // one table, and might be a master itself)
|
---|
127 |
|
---|
128 | $foreign_tables = array();
|
---|
129 | foreach ($all_tables AS $master_table) {
|
---|
130 | $foreigners = PMA_getForeigners($db, $master_table);
|
---|
131 | foreach ($foreigners AS $foreigner) {
|
---|
132 | if (!in_array($foreigner['foreign_table'], $foreign_tables)) {
|
---|
133 | $foreign_tables[] = $foreigner['foreign_table'];
|
---|
134 | }
|
---|
135 | }
|
---|
136 | }
|
---|
137 |
|
---|
138 | // then merge the arrays
|
---|
139 | foreach ($foreign_tables AS $foreign_table) {
|
---|
140 | if (!in_array($foreign_table, $all_tables)) {
|
---|
141 | $all_tables[] = $foreign_table;
|
---|
142 | }
|
---|
143 | }
|
---|
144 | } // endif there are master tables
|
---|
145 | } // endif auto_layout_internal
|
---|
146 |
|
---|
147 | if (isset($auto_layout_internal) || isset($auto_layout_innodb)) {
|
---|
148 | // now generate the coordinates for the schema,
|
---|
149 | // in a clockwise spiral
|
---|
150 |
|
---|
151 | $pos_x = 300;
|
---|
152 | $pos_y = 300;
|
---|
153 | $delta = 110;
|
---|
154 | $delta_mult = 1.10;
|
---|
155 | $direction = "right";
|
---|
156 | foreach ($all_tables AS $current_table) {
|
---|
157 |
|
---|
158 | // save current table's coordinates
|
---|
159 | $insert_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
|
---|
160 | . '(db_name, table_name, pdf_page_number, x, y) '
|
---|
161 | . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($current_table) . '\',' . $pdf_page_number . ',' . $pos_x . ',' . $pos_y . ')';
|
---|
162 | PMA_query_as_cu($insert_query, FALSE, $query_default_option);
|
---|
163 |
|
---|
164 | // compute for the next table
|
---|
165 | switch ($direction) {
|
---|
166 | case 'right':
|
---|
167 | $pos_x += $delta;
|
---|
168 | $direction = "down";
|
---|
169 | $delta *= $delta_mult;
|
---|
170 | break;
|
---|
171 | case 'down':
|
---|
172 | $pos_y += $delta;
|
---|
173 | $direction = "left";
|
---|
174 | $delta *= $delta_mult;
|
---|
175 | break;
|
---|
176 | case 'left':
|
---|
177 | $pos_x -= $delta;
|
---|
178 | $direction = "up";
|
---|
179 | $delta *= $delta_mult;
|
---|
180 | break;
|
---|
181 | case 'up':
|
---|
182 | $pos_y -= $delta;
|
---|
183 | $direction = "right";
|
---|
184 | $delta *= $delta_mult;
|
---|
185 | break;
|
---|
186 | } // end switch
|
---|
187 | } // end foreach
|
---|
188 | } // end if some auto-layout to do
|
---|
189 |
|
---|
190 | $chpage = $pdf_page_number;
|
---|
191 |
|
---|
192 | break;
|
---|
193 |
|
---|
194 | case 'edcoord':
|
---|
195 | for ($i = 0; $i < $c_table_rows; $i++) {
|
---|
196 | $arrvalue = 'c_table_' . $i;
|
---|
197 | $arrvalue = $$arrvalue;
|
---|
198 | if (!isset($arrvalue['x']) || $arrvalue['x'] == '') {
|
---|
199 | $arrvalue['x'] = 0;
|
---|
200 | }
|
---|
201 | if (!isset($arrvalue['y']) || $arrvalue['y'] == '') {
|
---|
202 | $arrvalue['y'] = 0;
|
---|
203 | }
|
---|
204 | if (isset($arrvalue['name']) && $arrvalue['name'] != '--') {
|
---|
205 | $test_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
|
---|
206 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
---|
207 | . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
|
---|
208 | . ' AND pdf_page_number = ' . $chpage;
|
---|
209 | $test_rs = PMA_query_as_cu($test_query, FALSE, $query_default_option);
|
---|
210 | if ($test_rs && PMA_DBI_num_rows($test_rs) > 0) {
|
---|
211 | if (isset($arrvalue['delete']) && $arrvalue['delete'] == 'y') {
|
---|
212 | $ch_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
|
---|
213 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
---|
214 | . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
|
---|
215 | . ' AND pdf_page_number = ' . $chpage;
|
---|
216 | } else {
|
---|
217 | $ch_query = 'UPDATE ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
|
---|
218 | . 'SET x = ' . $arrvalue['x'] . ', y= ' . $arrvalue['y']
|
---|
219 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
---|
220 | . ' AND table_name = \'' . PMA_sqlAddslashes($arrvalue['name']) . '\''
|
---|
221 | . ' AND pdf_page_number = ' . $chpage;
|
---|
222 | }
|
---|
223 | } else {
|
---|
224 | $ch_query = 'INSERT INTO ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' '
|
---|
225 | . '(db_name, table_name, pdf_page_number, x, y) '
|
---|
226 | . 'VALUES (\'' . PMA_sqlAddslashes($db) . '\', \'' . PMA_sqlAddslashes($arrvalue['name']) . '\',' . $chpage . ',' . $arrvalue['x'] . ',' . $arrvalue['y'] . ')';
|
---|
227 | }
|
---|
228 | PMA_query_as_cu($ch_query, FALSE, $query_default_option);
|
---|
229 | } // end if
|
---|
230 | } // end for
|
---|
231 | break;
|
---|
232 | case 'deleteCrap':
|
---|
233 | foreach ($delrow AS $current_row) {
|
---|
234 | $d_query = 'DELETE FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords']) . ' ' . "\n"
|
---|
235 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'' . "\n"
|
---|
236 | . ' AND table_name = \'' . PMA_sqlAddslashes($current_row) . '\'' . "\n"
|
---|
237 | . ' AND pdf_page_number = ' . $chpage;
|
---|
238 | PMA_query_as_cu($d_query, FALSE, $query_default_option);
|
---|
239 | }
|
---|
240 | break;
|
---|
241 | } // end switch
|
---|
242 | } // end if (isset($do))
|
---|
243 |
|
---|
244 | // We will need an array of all tables in this db
|
---|
245 | $selectboxall = array('--');
|
---|
246 | $alltab_rs = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE);
|
---|
247 | while ($val = @PMA_DBI_fetch_row($alltab_rs)) {
|
---|
248 | $selectboxall[] = $val[0];
|
---|
249 | }
|
---|
250 |
|
---|
251 | // Now first show some possibility to choose a page for the pdf
|
---|
252 | $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['pdf_pages'])
|
---|
253 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\'';
|
---|
254 | $page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);
|
---|
255 |
|
---|
256 | if ($page_rs && PMA_DBI_num_rows($page_rs) > 0) {
|
---|
257 | ?>
|
---|
258 | <form method="get" action="pdf_pages.php" name="selpage">
|
---|
259 | <fieldset>
|
---|
260 | <legend>
|
---|
261 | <?php echo $strChoosePage . "\n"; ?>
|
---|
262 | </legend>
|
---|
263 | <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
---|
264 | <input type="hidden" name="do" value="choosepage" />
|
---|
265 | <select name="chpage" onchange="this.form.submit()">
|
---|
266 | <?php
|
---|
267 | while ($curr_page = PMA_DBI_fetch_assoc($page_rs)) {
|
---|
268 | echo "\n" . ' '
|
---|
269 | . '<option value="' . $curr_page['page_nr'] . '"';
|
---|
270 | if (isset($chpage) && $chpage == $curr_page['page_nr']) {
|
---|
271 | echo ' selected="selected"';
|
---|
272 | }
|
---|
273 | echo '>' . $curr_page['page_nr'] . ': ' . $curr_page['page_descr'] . '</option>';
|
---|
274 | } // end while
|
---|
275 | echo "\n";
|
---|
276 | ?>
|
---|
277 | </select>
|
---|
278 | <input type="radio" name="action_choose" value="0" id="radio_choose0" checked="checked" style="vertical-align: middle" /><label for="radio_choose0">
|
---|
279 | <?php echo $strEdit; ?> </label>
|
---|
280 | <input type="radio" name="action_choose" value="1" id="radio_choose1" style="vertical-align: middle" /><label for="radio_choose1">
|
---|
281 | <?php echo $strDelete; ?> </label>
|
---|
282 | <input type="submit" value="<?php echo $strGo; ?>" /><br />
|
---|
283 | </fieldset>
|
---|
284 | </form>
|
---|
285 | <?php
|
---|
286 | }
|
---|
287 | echo "\n";
|
---|
288 |
|
---|
289 | // Possibility to create a new page:
|
---|
290 | ?>
|
---|
291 | <form method="post" action="pdf_pages.php" name="crpage">
|
---|
292 | <fieldset>
|
---|
293 | <legend>
|
---|
294 | <?php echo $strCreatePage . "\n"; ?>
|
---|
295 | </legend>
|
---|
296 | <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
---|
297 | <input type="hidden" name="do" value="createpage" />
|
---|
298 | <input type="text" name="newpage" size="20" maxlength="50" />
|
---|
299 | <input type="checkbox" name="auto_layout_internal" />
|
---|
300 | <?php echo '(' . $strAutomaticLayout . ' / ' . $strInternalRelations . ')' . "\n"; ?>
|
---|
301 | <input type="checkbox" name="auto_layout_innodb" />
|
---|
302 | <?php echo '(' . $strAutomaticLayout . ' / InnoDB)' . "\n"; ?>
|
---|
303 | <input type="submit" value="<?php echo $strGo; ?>" />
|
---|
304 | </fieldset>
|
---|
305 | </form>
|
---|
306 | <?php
|
---|
307 | // Now if we already have chosen a page number then we should show the
|
---|
308 | // tables involved
|
---|
309 | if (isset($chpage) && $chpage > 0) {
|
---|
310 | echo "\n";
|
---|
311 | ?>
|
---|
312 | <hr />
|
---|
313 |
|
---|
314 | <h2><?php echo $strSelectTables ;?></h2>
|
---|
315 |
|
---|
316 | <?php
|
---|
317 | $page_query = 'SELECT * FROM ' . PMA_backquote($GLOBALS['cfgRelation']['db']) . '.' . PMA_backquote($cfgRelation['table_coords'])
|
---|
318 | . ' WHERE db_name = \'' . PMA_sqlAddslashes($db) . '\''
|
---|
319 | . ' AND pdf_page_number = ' . $chpage;
|
---|
320 | $page_rs = PMA_query_as_cu($page_query, FALSE, $query_default_option);
|
---|
321 | $array_sh_page = array();
|
---|
322 | $draginit = '';
|
---|
323 | $reset_draginit = '';
|
---|
324 | $i = 0;
|
---|
325 | while ($temp_sh_page = @PMA_DBI_fetch_assoc($page_rs)) {
|
---|
326 | $array_sh_page[] = $temp_sh_page;
|
---|
327 | }
|
---|
328 |
|
---|
329 | // garvin: Display WYSIWYG-PDF parts?
|
---|
330 | if ($cfg['WYSIWYG-PDF']) {
|
---|
331 | if (!isset($_POST['with_field_names']) && !isset($_POST['showwysiwyg'])) {
|
---|
332 | $with_field_names = TRUE;
|
---|
333 | }
|
---|
334 | ?>
|
---|
335 | <script type="text/javascript" language="javascript" src="./js/dom-drag.js"></script>
|
---|
336 | <form method="post" action="pdf_pages.php" name="dragdrop">
|
---|
337 | <input type="button" name="dragdrop" value="<?php echo $strToggleScratchboard; ?>" onclick="ToggleDragDrop('pdflayout');" />
|
---|
338 | <input type="button" name="dragdropreset" value="<?php echo $strReset; ?>" onclick="resetDrag();" />
|
---|
339 | </form>
|
---|
340 | <div id="pdflayout" class="pdflayout" style="visibility: hidden;">
|
---|
341 | <?php
|
---|
342 | foreach ($array_sh_page AS $key => $temp_sh_page) {
|
---|
343 | $drag_x = $temp_sh_page['x'];
|
---|
344 | $drag_y = $temp_sh_page['y'];
|
---|
345 |
|
---|
346 | $draginit .= ' Drag.init(getElement("table_' . $i . '"), null, 0, parseInt(myid.style.width)-2, 0, parseInt(myid.style.height)-5);' . "\n";
|
---|
347 | $draginit .= ' getElement("table_' . $i . '").onDrag = function (x, y) { document.edcoord.elements["c_table_' . $i . '[x]"].value = parseInt(x); document.edcoord.elements["c_table_' . $i . '[y]"].value = parseInt(y) }' . "\n";
|
---|
348 | $draginit .= ' getElement("table_' . $i . '").style.left = "' . $drag_x . 'px";' . "\n";
|
---|
349 | $draginit .= ' getElement("table_' . $i . '").style.top = "' . $drag_y . 'px";' . "\n";
|
---|
350 | $reset_draginit .= ' getElement("table_' . $i . '").style.left = "2px";' . "\n";
|
---|
351 | $reset_draginit .= ' getElement("table_' . $i . '").style.top = "' . (15 * $i) . 'px";' . "\n";
|
---|
352 | $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[x]"].value = "2"' . "\n";
|
---|
353 | $reset_draginit .= ' document.edcoord.elements["c_table_' . $i . '[y]"].value = "' . (15 * $i) . '"' . "\n";
|
---|
354 |
|
---|
355 | $local_query = 'SHOW FIELDS FROM '
|
---|
356 | . PMA_backquote($temp_sh_page['table_name'] )
|
---|
357 | . ' FROM ' . PMA_backquote($db);
|
---|
358 | $fields_rs = PMA_DBI_query($local_query);
|
---|
359 | unset($local_query);
|
---|
360 | $fields_cnt = PMA_DBI_num_rows($fields_rs);
|
---|
361 |
|
---|
362 | echo '<div id="table_' . $i . '" class="pdflayout_table"><u>' . $temp_sh_page['table_name'] . '</u>';
|
---|
363 | if (isset($with_field_names)) {
|
---|
364 | while ($row = PMA_DBI_fetch_assoc($fields_rs)) {
|
---|
365 | echo '<br />' . htmlspecialchars($row['Field']) . "\n";
|
---|
366 | }
|
---|
367 | }
|
---|
368 | echo '</div>' . "\n";
|
---|
369 | PMA_DBI_free_result($fields_rs);
|
---|
370 | unset($fields_rs);
|
---|
371 |
|
---|
372 | $i++;
|
---|
373 | }
|
---|
374 | ?>
|
---|
375 | </div>
|
---|
376 | <script type="text/javascript" language="javascript">
|
---|
377 | //<![CDATA[
|
---|
378 | function init() {
|
---|
379 | refreshLayout();
|
---|
380 | myid = getElement('pdflayout');
|
---|
381 | <?php echo $draginit; ?>
|
---|
382 | }
|
---|
383 |
|
---|
384 | function resetDrag() {
|
---|
385 | <?php echo $reset_draginit; ?>
|
---|
386 | }
|
---|
387 | //]]>
|
---|
388 | </script>
|
---|
389 | <?php
|
---|
390 | } // end if WYSIWYG-PDF
|
---|
391 | ?>
|
---|
392 |
|
---|
393 | <form method="post" action="pdf_pages.php" name="edcoord">
|
---|
394 | <?php echo PMA_generate_common_hidden_inputs($db, $table); ?>
|
---|
395 | <input type="hidden" name="chpage" value="<?php echo $chpage; ?>" />
|
---|
396 | <input type="hidden" name="do" value="edcoord" />
|
---|
397 | <table border="0">
|
---|
398 | <tr>
|
---|
399 | <th><?php echo $strTable; ?></th>
|
---|
400 | <th><?php echo $strDelete; ?></th>
|
---|
401 | <th>X</th>
|
---|
402 | <th>Y</th>
|
---|
403 | </tr>
|
---|
404 | <?php
|
---|
405 | if (isset($ctable)) {
|
---|
406 | unset($ctable);
|
---|
407 | }
|
---|
408 |
|
---|
409 |
|
---|
410 | $i = 0;
|
---|
411 | $odd_row = true;
|
---|
412 | foreach ($array_sh_page AS $dummy_sh_page => $sh_page) {
|
---|
413 | $_mtab = $sh_page['table_name'];
|
---|
414 | $tabExist[$_mtab] = FALSE;
|
---|
415 | echo "\n" . ' <tr class="';
|
---|
416 | if ($odd_row) {
|
---|
417 | echo 'odd';
|
---|
418 | } else {
|
---|
419 | echo 'even';
|
---|
420 | }
|
---|
421 | echo '">';
|
---|
422 | $odd_row != $odd_row;
|
---|
423 | echo "\n" . ' <td>'
|
---|
424 | . "\n" . ' <select name="c_table_' . $i . '[name]">';
|
---|
425 | foreach ($selectboxall AS $key => $value) {
|
---|
426 | echo "\n" . ' <option value="' . $value . '"';
|
---|
427 | if ($value == $sh_page['table_name']) {
|
---|
428 | echo ' selected="selected"';
|
---|
429 | $tabExist[$_mtab] = TRUE;
|
---|
430 | }
|
---|
431 | echo '>' . $value . '</option>';
|
---|
432 | } // end while
|
---|
433 | echo "\n" . ' </select>'
|
---|
434 | . "\n" . ' </td>';
|
---|
435 | echo "\n" . ' <td>'
|
---|
436 | . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
|
---|
437 | echo "\n" . ' </td>';
|
---|
438 | echo "\n" . ' <td>'
|
---|
439 | . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'x\', this.value)"' : '') . ' name="c_table_' . $i . '[x]" value="' . $sh_page['x'] . '" />';
|
---|
440 | echo "\n" . ' </td>';
|
---|
441 | echo "\n" . ' <td>'
|
---|
442 | . "\n" . ' <input type="text" ' . ($cfg['WYSIWYG-PDF'] ? 'onchange="dragPlace(' . $i . ', \'y\', this.value)"' : '') . ' name="c_table_' . $i . '[y]" value="' . $sh_page['y'] . '" />';
|
---|
443 | echo "\n" . ' </td>';
|
---|
444 | echo "\n" . ' </tr>';
|
---|
445 | $i++;
|
---|
446 | } // end while
|
---|
447 | // Do one more empty row
|
---|
448 | echo "\n" . ' <tr class="';
|
---|
449 | if ($odd_row) {
|
---|
450 | echo 'odd';
|
---|
451 | } else {
|
---|
452 | echo 'even';
|
---|
453 | }
|
---|
454 | $odd_row != $odd_row;
|
---|
455 | echo '">';
|
---|
456 | echo "\n" . ' <td>'
|
---|
457 | . "\n" . ' <select name="c_table_' . $i . '[name]">';
|
---|
458 | foreach ($selectboxall AS $key => $value) {
|
---|
459 | echo "\n" . ' <option value="' . $value . '">' . $value . '</option>';
|
---|
460 | }
|
---|
461 | echo "\n" . ' </select>'
|
---|
462 | . "\n" . ' </td>';
|
---|
463 | echo "\n" . ' <td>'
|
---|
464 | . "\n" . ' <input type="checkbox" name="c_table_' . $i . '[delete]" value="y" />' . $strDelete;
|
---|
465 | echo "\n" . ' </td>';
|
---|
466 | echo "\n" . ' <td>'
|
---|
467 | . "\n" . ' <input type="text" name="c_table_' . $i . '[x]" value="' . (isset($sh_page['x'])?$sh_page['x']:'') . '" />';
|
---|
468 | echo "\n" . ' </td>';
|
---|
469 | echo "\n" . ' <td>'
|
---|
470 | . "\n" . ' <input type="text" name="c_table_' . $i . '[y]" value="' . (isset($sh_page['y'])?$sh_page['y']:'') . '" />';
|
---|
471 | echo "\n" . ' </td>';
|
---|
472 | echo "\n" . ' </tr>';
|
---|
473 | echo "\n" . ' </table>' . "\n";
|
---|
474 |
|
---|
475 | echo "\n" . ' <input type="hidden" name="c_table_rows" value="' . ($i + 1) . '" />';
|
---|
476 | echo ($cfg['WYSIWYG-PDF'] ? "\n" . ' <input type="hidden" name="showwysiwyg" value="' . ((isset($showwysiwyg) && $showwysiwyg == '1') ? '1' : '0') . '" />' : '');
|
---|
477 | echo "\n" . ' <input type="checkbox" name="with_field_names" ' . (isset($with_field_names) ? 'checked="checked"' : ''). ' />' . $strColumnNames . '<br />';
|
---|
478 | echo "\n" . ' <input type="submit" value="' . $strSave . '" />';
|
---|
479 | echo "\n" . '</form>' . "\n\n";
|
---|
480 | } // end if
|
---|
481 |
|
---|
482 | // Check if there are tables that need to be deleted,
|
---|
483 | // if there are, ask the user for allowance
|
---|
484 | $_strtrans = '';
|
---|
485 | $_strname = '';
|
---|
486 | $shoot = FALSE;
|
---|
487 | if (!empty($tabExist) && is_array($tabExist)) {
|
---|
488 | foreach ($tabExist AS $key => $value) {
|
---|
489 | if (!$value) {
|
---|
490 | $_strtrans .= '<input type="hidden" name="delrow[]" value="' . $key . '" />' . "\n";
|
---|
491 | $_strname .= '<li>' . $key . '</li>' . "\n";
|
---|
492 | $shoot = TRUE;
|
---|
493 | }
|
---|
494 | }
|
---|
495 | if ($shoot) {
|
---|
496 | echo '<form action="pdf_pages.php" method="post">' . "\n"
|
---|
497 | . PMA_generate_common_hidden_inputs($db, $table)
|
---|
498 | . '<input type="hidden" name="do" value="deleteCrap" />' . "\n"
|
---|
499 | . '<input type="hidden" name="chpage" value="' . $chpage . '" />' . "\n"
|
---|
500 | . $strDelOld
|
---|
501 | . '<ul>' . "\n"
|
---|
502 | . $_strname
|
---|
503 | . '</ul>' . "\n"
|
---|
504 | . $_strtrans
|
---|
505 | . '<input type="submit" value="' . $strGo . '" />' . "\n"
|
---|
506 | . '</form>';
|
---|
507 | }
|
---|
508 | }
|
---|
509 | // ------------------------------------
|
---|
510 | // d i s p l a y p d f s c h e m a
|
---|
511 | // ------------------------------------
|
---|
512 |
|
---|
513 | if (isset($do)
|
---|
514 | && ($do == 'edcoord'
|
---|
515 | || ($do == 'choosepage' && isset($chpage))
|
---|
516 | || ($do == 'createpage' && isset($chpage)))) {
|
---|
517 | ?>
|
---|
518 | <form method="post" action="pdf_schema.php" name="pdfoptions">
|
---|
519 | <?php echo PMA_generate_common_hidden_inputs($db); ?>
|
---|
520 | <input type="hidden" name="pdf_page_number" value="<?php echo $chpage; ?>" />
|
---|
521 |
|
---|
522 | <?php echo '<br /><b>' . $strDisplayPDF . '</b>'; ?>: <br />
|
---|
523 | <input type="checkbox" name="show_grid" id="show_grid_opt" /><label for="show_grid_opt"><?php echo $strShowGrid; ?></label><br />
|
---|
524 | <input type="checkbox" name="show_color" id="show_color_opt" checked="checked" /><label for="show_color_opt"><?php echo $strShowColor; ?></label><br />
|
---|
525 | <input type="checkbox" name="show_table_dimension" id="show_table_dim_opt" /><label for="show_table_dim_opt"><?php echo $strShowTableDimension; ?></label><br />
|
---|
526 | <input type="checkbox" name="all_tab_same_wide" id="all_tab_same_wide" /><label for="all_tab_same_wide"><?php echo $strAllTableSameWidth; ?></label><br />
|
---|
527 | <input type="checkbox" name="with_doc" id="with_doc" checked="checked" /><label for="with_doc"><?php echo $strDataDict; ?></label>
|
---|
528 | <br />
|
---|
529 | <label for="orientation_opt"><?php echo $strShowDatadictAs; ?></label>
|
---|
530 | <select id="orientation_opt" name="orientation" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
|
---|
531 | <option value="L"><?php echo $strLandscape;?></option>
|
---|
532 | <option value="P"><?php echo $strPortrait;?></option>
|
---|
533 | </select><br />
|
---|
534 |
|
---|
535 | <label for="paper_opt"><?php echo $strPaperSize; ?></label>
|
---|
536 | <select id="paper_opt" name="paper" <?php echo ($cfg['WYSIWYG-PDF'] ? 'onchange="refreshDragOption(\'pdflayout\');"' : ''); ?>>
|
---|
537 | <?php
|
---|
538 | foreach ($cfg['PDFPageSizes'] AS $key => $val) {
|
---|
539 | echo '<option value="' . $val . '"';
|
---|
540 | if ($val == $cfg['PDFDefaultPageSize']) {
|
---|
541 | echo ' selected="selected"';
|
---|
542 | }
|
---|
543 | echo ' >' . $val . '</option>' . "\n";
|
---|
544 | }
|
---|
545 | ?>
|
---|
546 | </select><br />
|
---|
547 | <input type="submit" value="<?php echo $strGo; ?>" />
|
---|
548 | </form>
|
---|
549 | <?php
|
---|
550 | if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
|
---|
551 | ?>
|
---|
552 | <script type="text/javascript" language="javascript">
|
---|
553 | //<![CDATA[
|
---|
554 | ToggleDragDrop('pdflayout');
|
---|
555 | //]]>
|
---|
556 | </script>
|
---|
557 | <?php
|
---|
558 | }
|
---|
559 | } // end if
|
---|
560 | } // end if ($cfgRelation['pdfwork'])
|
---|
561 |
|
---|
562 |
|
---|
563 | /**
|
---|
564 | * Displays the footer
|
---|
565 | */
|
---|
566 | echo "\n";
|
---|
567 | require_once('./libraries/footer.inc.php');
|
---|
568 | ?>
|
---|