adapted patch #3050492 to new code
[phpmyadmin/crack.git] / schema_edit.php
blobfb15d00222ff6654f56d4d3f9320a2f52fc31a79
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @version $Id$
6 * @package phpMyAdmin
7 */
9 /**
10 * Gets some core libraries
13 require_once './libraries/common.inc.php';
14 require_once './libraries/db_common.inc.php';
15 require './libraries/StorageEngine.class.php';
17 $active_page = 'db_operations.php';
18 require_once './libraries/db_common.inc.php';
19 $url_query .= '&amp;goto=schema_edit.php';
20 require_once './libraries/db_info.inc.php';
22 /**
23 * Includ settings for relation stuff
24 * get all variables needed for exporting relational schema
25 * in $cfgRelation
27 require_once './libraries/relation.lib.php';
28 $cfgRelation = PMA_getRelationsParam();
30 /**
31 * This is to avoid "Command out of sync" errors. Before switching this to
32 * a value of 0 (for MYSQLI_USE_RESULT), please check the logic
33 * to free results wherever needed.
35 $query_default_option = PMA_DBI_QUERY_STORE;
37 /**
38 * Now in ./libraries/relation.lib.php we check for all tables
39 * that we need, but if we don't find them we are quiet about it
40 * so people can't work without relational variables.
41 * This page is absolutely useless if you didn't set up your tables
42 * correctly, so it is a good place to see which tables we can and
43 * complain ;-)
45 if (!$cfgRelation['relwork']) {
46 echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'relation', 'config.inc.php') . '<br />' . "\n"
47 . PMA_showDocu('relation') . "\n";
48 require_once './libraries/footer.inc.php';
51 if (!$cfgRelation['displaywork']) {
52 echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_info', 'config.inc.php') . '<br />' . "\n"
53 . PMA_showDocu('table_info') . "\n";
54 require_once './libraries/footer.inc.php';
57 if (!isset($cfgRelation['table_coords'])){
58 echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'table_coords', 'config.inc.php') . '<br />' . "\n"
59 . PMA_showDocu('table_coords') . "\n";
60 require_once './libraries/footer.inc.php';
62 if (!isset($cfgRelation['pdf_pages'])) {
63 echo sprintf(__('<b>%s</b> table not found or not set in %s'), 'pdf_page', 'config.inc.php') . '<br />' . "\n"
64 . PMA_showDocu('pdf_pages') . "\n";
65 require_once './libraries/footer.inc.php';
68 if ($cfgRelation['pdfwork']) {
70 /**
71 * User object created for presenting the HTML options
72 * so, user can interact with it and perform export of relations schema
75 require_once './libraries/schema/User_Schema.class.php';
76 $user_schema = new PMA_User_Schema();
78 /**
79 * This function will process the user defined pages
80 * and tables which will be exported as Relational schema
81 * you can set the table positions on the paper via scratchboard
82 * for table positions, put the x,y co-ordinates
84 * @param string $do It tells what the Schema is supposed to do
85 * create and select a page, generate schema etc
87 if(isset($_REQUEST['do'])){
88 $user_schema->setAction($_REQUEST['do']);
89 $user_schema->processUserPreferences();
92 /**
93 * Show some possibility to select a page for the export of relation schema
94 * Lists all pages created before and can select and edit from them
97 $user_schema->selectPage();
99 /**
100 * Create a new page where relations will be drawn
103 $user_schema->createPage($db);
106 * After selection of page or creating a page
107 * It will show you the list of tables
108 * A dashboard will also be shown where you can position the tables
111 $user_schema->showTableDashBoard();
113 if (isset($_REQUEST['do'])
114 && ($_REQUEST['do'] == 'edcoord'
115 || ($_REQUEST['do']== 'selectpage' && isset($user_schema->choosenPage) && $user_schema->choosenPage != 0)
116 || ($_REQUEST['do'] == 'createpage' && isset($user_schema->choosenPage) && $user_schema->choosenPage != 0))) {
118 /**
119 * show Export schema generation options
121 $user_schema->displaySchemaGenerationOptions();
123 if ((isset($showwysiwyg) && $showwysiwyg == '1')) {
125 <script type="text/javascript">
126 //<![CDATA[
127 ToggleDragDrop('pdflayout');
128 //]]>
129 </script>
130 <?php
132 } // end if
133 } // end if ($cfgRelation['pdfwork'])
136 * Displays the footer
138 echo "\n";
139 require_once './libraries/footer.inc.php';