home *** CD-ROM | disk | FTP | other *** search
/ Freelog 70 / Freelog070.iso / Internet / EasyPHP / easyphp1-8_setup.exe / {app} / phpmyadmin / pdf_pages.php < prev    next >
Encoding:
PHP Script  |  2004-10-08  |  24.3 KB  |  533 lines

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