pmd_general.php 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * phpMyAdmin designer general code
  5. *
  6. * @package PhpMyAdmin-Designer
  7. */
  8. /**
  9. *
  10. */
  11. require_once 'libraries/common.inc.php';
  12. require_once 'libraries/pmd_common.php';
  13. $script_display_field = PMA_getTablesInfo();
  14. $tab_column = PMA_getColumnsInfo();
  15. $script_tables = PMA_getScriptTabs();
  16. $script_contr = PMA_getScriptContr();
  17. $tab_pos = PMA_getTabPos();
  18. $tables_pk_or_unique_keys = PMA_getPKOrUniqueKeys();
  19. $tables_all_keys = PMA_getAllKeys();
  20. $params = array('lang' => $GLOBALS['lang']);
  21. if (isset($_GET['db'])) {
  22. $params['db'] = $_GET['db'];
  23. }
  24. $response = PMA_Response::getInstance();
  25. $response->getFooter()->setMinimal();
  26. $header = $response->getHeader();
  27. $header->setBodyId('pmd_body');
  28. $scripts = $header->getScripts();
  29. $scripts->addFile('jquery/jquery.fullscreen.js');
  30. $scripts->addFile('pmd/ajax.js');
  31. $scripts->addFile('pmd/history.js');
  32. $scripts->addFile('pmd/move.js');
  33. $scripts->addFile('pmd/iecanvas.js', true);
  34. $scripts->addFile('pmd/init.js');
  35. require 'libraries/db_common.inc.php';
  36. require 'libraries/db_info.inc.php';
  37. // Embed some data into HTML, later it will be read
  38. // by pmd/init.js and converted to JS variables.
  39. echo '<div id="script_server" class="hide">';
  40. echo htmlspecialchars($GLOBALS['server']);
  41. echo '</div>';
  42. echo '<div id="script_db" class="hide">';
  43. echo htmlspecialchars($_GET['db']);
  44. echo '</div>';
  45. echo '<div id="script_token" class="hide">';
  46. echo htmlspecialchars($_GET['token']);
  47. echo '</div>';
  48. echo '<div id="script_tables" class="hide">';
  49. echo htmlspecialchars(json_encode($script_tables));
  50. echo '</div>';
  51. echo '<div id="script_contr" class="hide">';
  52. echo htmlspecialchars(json_encode($script_contr));
  53. echo '</div>';
  54. echo '<div id="script_display_field" class="hide">';
  55. echo htmlspecialchars(json_encode($script_display_field));
  56. echo '</div>';
  57. ?>
  58. <div class="pmd_header" id="top_menu">
  59. <a href="#" onclick="Show_left_menu(document.getElementById('key_Show_left_menu')); return false"
  60. class="M_butt first" target="_self">
  61. <img id='key_Show_left_menu'
  62. title="<?php echo __('Show/Hide left menu'); ?>" alt="v"
  63. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow2_m.png'); ?>" />
  64. </a>
  65. <a href="#" id="enterFullscreen" onclick="Enter_fullscreen(); return false"
  66. class="M_butt" target="_self">
  67. <img title="<?php echo __('View in fullscreen') ?>" alt=""
  68. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/viewInFullscreen.png'); ?>" />
  69. </a>
  70. <a href="#" id="exitFullscreen" onclick="Exit_fullscreen(); return false"
  71. class="M_butt hide" target="_self">
  72. <img title="<?php echo __('Exit fullscreen') ?>" alt=""
  73. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/exitFullscreen.png'); ?>" />
  74. </a>
  75. <img class="M_bord"
  76. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>"
  77. alt="" />
  78. <a href="#" onclick="Save2(); return false" class="M_butt" target="_self">
  79. <img title="<?php echo __('Save position') ?>" alt=""
  80. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/save.png'); ?>" />
  81. </a>
  82. <a href="#" onclick="Start_table_new(); return false"
  83. class="M_butt" target="_self">
  84. <img title="<?php echo __('Create table')?>" alt=""
  85. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/table.png'); ?>" />
  86. </a>
  87. <a href="#" onclick="Start_relation(); return false" class="M_butt"
  88. id="rel_button" target="_self">
  89. <img title="<?php echo __('Create relation') ?>" alt=""
  90. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/relation.png'); ?>" />
  91. </a>
  92. <a href="#" onclick="Start_display_field(); return false"
  93. class="M_butt" id="display_field_button" target="_self">
  94. <img title="<?php echo __('Choose column to display') ?>" alt=""
  95. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/display_field.png'); ?>" />
  96. </a>
  97. <a href="#" onclick="location.reload(); return false" class="M_butt"
  98. target="_self">
  99. <img title="<?php echo __('Reload'); ?>" alt=""
  100. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/reload.png'); ?>" />
  101. </a>
  102. <a href="<?php echo PMA_Util::getDocuLink('faq', 'faq6-31') ?>"
  103. target="documentation" class="M_butt" target="_self">
  104. <img title="<?php echo __('Help'); ?>" alt=""
  105. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/help.png'); ?>" />
  106. </a>
  107. <img class="M_bord"
  108. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>"
  109. alt="" />
  110. <a href="#" onclick="Angular_direct(); return false"
  111. class="M_butt" id="angular_direct_button" target="_self">
  112. <img title="<?php echo __('Angular links') . ' / ' . __('Direct links'); ?>" alt=""
  113. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/ang_direct.png'); ?>" />
  114. </a>
  115. <a href="#" onclick="Grid(); return false" class="M_butt" id="grid_button"
  116. target="_self">
  117. <img title="<?php echo __('Snap to grid') ?>"
  118. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/grid.png'); ?>" alt="" />
  119. </a>
  120. <img class="M_bord" src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt="" />
  121. <a href="#" onclick="Small_tab_all(document.getElementById('key_SB_all')); return false"
  122. class="M_butt" target="_self">
  123. <img id='key_SB_all' title="<?php echo __('Small/Big All'); ?>" alt="v"
  124. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow1.png'); ?>" />
  125. </a>
  126. <a href="#" onclick="Small_tab_invert(); return false" class="M_butt"
  127. target="_self" >
  128. <img title="<?php echo __('Toggle small/big'); ?>" alt="key"
  129. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bottom.png'); ?>" />
  130. </a>
  131. <a href="#" onclick="Relation_lines_invert(); return false"
  132. class="M_butt" target="_self" >
  133. <img title="<?php echo __('Toggle relation lines'); ?>" alt="key"
  134. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/toggle_lines.png'); ?>" />
  135. </a>
  136. <img class="M_bord" src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt="" />
  137. <a href="#" onclick="PDF_save(); return false" class="M_butt ajax">
  138. <img src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/pdf.png'); ?>" alt="key"
  139. width="20" height="20" title="<?php echo __('Import/Export coordinates for relational schema'); ?>" />
  140. </a>
  141. <?php
  142. if (isset($_REQUEST['query'])) {
  143. echo '<a href="#" onclick="build_query(\'SQL Query on Database\', 0)" onmousedown="return false;"
  144. class="M_butt" target="_self">';
  145. echo '<img src="'
  146. . $_SESSION['PMA_Theme']->getImgPath('pmd/query_builder.png')
  147. . '" alt="key" width="20" height="20" title="';
  148. echo __('Build Query');
  149. echo '"/></a>';
  150. }
  151. ?>
  152. <a href="#" onclick="Top_menu_right(document.getElementById('key_Left_Right')); return false"
  153. class="M_butt last" target="_self">
  154. <img src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/2rightarrow_m.png'); ?>"
  155. id="key_Left_Right" alt=">" title="<?php echo __('Move Menu'); ?>" />
  156. </a>
  157. </div>
  158. <div id="canvas_outer">
  159. <form action="" method="post" name="form1">
  160. <div id="osn_tab">
  161. <canvas class="pmd" id="canvas" width="100" height="100"
  162. onclick="Canvas_click(this)"></canvas>
  163. </div>
  164. <div id="layer_menu" style="display:none;">
  165. <div class="center" style="padding-top:5px;">
  166. <a href="#"
  167. onclick="Hide_tab_all(document.getElementById('key_HS_all')); return false" class="M_butt" target="_self">
  168. <img title="<?php echo __('Hide/Show all'); ?>" alt="v"
  169. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow1.png'); ?>" id='key_HS_all' /></a>
  170. <a href="#"
  171. onclick="No_have_constr(document.getElementById('key_HS')); return false" class="M_butt" target="_self">
  172. <img title="<?php echo __('Hide/Show Tables with no relation'); ?>" alt="v"
  173. src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow2.png'); ?>" id='key_HS' /></a>
  174. </div>
  175. <div id="id_scroll_tab" class="scroll_tab">
  176. <table width="100%" style="padding-left: 3px;">
  177. <?php
  178. $name_cnt = count($GLOBALS['PMD']['TABLE_NAME']);
  179. for ($i = 0; $i < $name_cnt; $i++) {
  180. echo '<tr><td title="' . __('Structure') . '" width="1px" '
  181. . 'onmouseover="this.className=\'L_butt2_2\'" '
  182. . 'onmouseout="this.className=\'L_butt2_1\'" class="L_butt2_1">';
  183. echo '<img '
  184. . 'onclick="Start_tab_upd(\''
  185. . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '\');" '
  186. . 'src="' . $_SESSION['PMA_Theme']->getImgPath('pmd/exec.png')
  187. . '" alt="" />';
  188. echo '</td>';
  189. echo '<td width="1px">';
  190. echo '<input onclick="VisibleTab(this,\''
  191. . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '\')" '
  192. . 'title="' . __('Hide') . '" '
  193. . 'id="check_vis_' . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '" '
  194. . 'style="margin:0px;" type="checkbox" '
  195. . 'value="' . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '"';
  196. if (isset($tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]])) {
  197. echo $tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]]["H"]
  198. ? 'checked="checked"'
  199. : '';
  200. } else {
  201. echo 'checked="checked"';
  202. }
  203. echo '/></td>';
  204. echo '<td class="pmd_Tabs" onmouseover="this.className=\'pmd_Tabs2\'" '
  205. . 'onmouseout="this.className=\'pmd_Tabs\'" ' . 'onclick="Select_tab(\''
  206. . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '\');">';
  207. echo $GLOBALS['PMD_OUT']["TABLE_NAME"][$i];
  208. echo '</td>';
  209. echo '</tr>';
  210. }
  211. echo '</table>';
  212. echo '</div>';
  213. echo '<div class="center">';
  214. echo __('Number of tables:') . ' ' . $name_cnt;
  215. echo '</div>';
  216. echo '<div class="floatright">';
  217. echo '<div id="layer_menu_sizer" onmousedown="layer_menu_cur_click=1">';
  218. echo '</div>';
  219. echo '</div>';
  220. echo '</div>';
  221. for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++) {
  222. $t_n = $GLOBALS['PMD']["TABLE_NAME"][$i];
  223. $t_n_url = $GLOBALS['PMD_URL']["TABLE_NAME"][$i];
  224. echo '<input name="t_x[' . $t_n_url . ']" type="hidden" id="t_x_'
  225. . $t_n_url . '_" />'
  226. . '<input name="t_y[' . $t_n_url . ']" type="hidden" id="t_y_'
  227. . $t_n_url . '_" />'
  228. . '<input name="t_v[' . $t_n_url . ']" type="hidden" id="t_v_'
  229. . $t_n_url . '_" />'
  230. . '<input name="t_h[' . $t_n_url . ']" type="hidden" id="t_h_'
  231. . $t_n_url . '_" />';
  232. ?>
  233. <table id="<?php echo $t_n_url ?>" cellpadding="0" cellspacing="0" class="pmd_tab"
  234. style="position: absolute;
  235. left: <?php
  236. echo isset($tab_pos[$t_n]) ? $tab_pos[$t_n]["X"] : rand(20, 700); ?>px;
  237. top: <?php
  238. echo isset($tab_pos[$t_n]) ? $tab_pos[$t_n]["Y"] : rand(20, 550); ?>px;
  239. visibility: <?php
  240. echo ! isset($tab_pos[$t_n]) || $tab_pos[$t_n]["H"]
  241. ? "visible"
  242. : "hidden"; ?>;
  243. z-index: 1;">
  244. <thead>
  245. <tr>
  246. <?php
  247. if (isset($_REQUEST['query'])) {
  248. echo '<td class="select_all">';
  249. echo '<input type="checkbox" value="select_all_'
  250. . htmlspecialchars($t_n_url) . '" style="margin: 0px;" ';
  251. echo 'id="select_all_' . htmlspecialchars($t_n_url) . '" title="select all" ';
  252. echo 'onclick="Select_all(\'' . htmlspecialchars($t_n_url) . '\',\''
  253. . htmlspecialchars($GLOBALS['PMD_OUT']["OWNER"][$i]) . '\')"></td>';
  254. }
  255. ?>
  256. <td class="small_tab" onmouseover="this.className='small_tab2';"
  257. onmouseout="this.className='small_tab';"
  258. id="id_hide_tbody_<?php echo $t_n_url ?>"
  259. onclick="Small_tab('<?php echo $t_n_url ?>', 1)"><?php
  260. // no space alloawd here, between tags and content !!!
  261. // JavaScript function does require this
  262. if (! isset($tab_pos[$t_n]) || ! empty($tab_pos[$t_n]["V"])) {
  263. echo 'v';
  264. } else {
  265. echo '&gt;';
  266. }
  267. ?></td>
  268. <td class="small_tab_pref" onmouseover="this.className='small_tab_pref2';"
  269. onmouseout="this.className='small_tab_pref';"
  270. onclick="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i]; ?>');">
  271. <img src="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/exec_small.png'); ?>" alt="" /></td>
  272. <td id="id_zag_<?php echo $t_n_url ?>" class="tab_zag nowrap"
  273. onmousedown="cur_click=document.getElementById('<?php echo $t_n_url ?>');"/
  274. onmouseover="Table_onover('<?php echo $t_n_url ?>',0,<?php echo (isset($_REQUEST['query'])? 1 : 0 )?> )"
  275. onmouseout="Table_onover('<?php echo $t_n_url ?>',1,<?php echo (isset($_REQUEST['query']) ? 1 : 0 )?>)">
  276. <span class='owner'>
  277. <?php echo $GLOBALS['PMD_OUT']["OWNER"][$i]; ?>.
  278. </span>
  279. <?php echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]; ?>
  280. </td>
  281. <?php
  282. if (isset($_REQUEST['query'])) {
  283. echo '<td class="tab_zag" onmouseover="Table_onover(\''
  284. . htmlspecialchars($t_n_url) . '\',0,1)" id="id_zag_'
  285. . htmlspecialchars($t_n_url) . '_2"';
  286. echo 'onmousedown="cur_click=document.getElementById(\''
  287. . htmlspecialchars($t_n_url) . '\');"';
  288. echo 'onmouseout="Table_onover(\'' . htmlspecialchars($t_n_url) . '\',1,1)">';
  289. }
  290. ?>
  291. </tr>
  292. </thead>
  293. <tbody id="id_tbody_<?php echo $t_n_url ?>"
  294. <?php
  295. if (isset($tab_pos[$t_n]) && empty($tab_pos[$t_n]["V"])) {
  296. echo 'style="display: none;"';
  297. }
  298. echo '>';
  299. $display_field = PMA_getDisplayField(
  300. $_GET['db'],
  301. $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]
  302. );
  303. for (
  304. $j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]);
  305. $j < $id_cnt;
  306. $j++
  307. ) {
  308. echo '<tr id="id_tr_'
  309. . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '.'
  310. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '"';
  311. if ($display_field == $tab_column[$t_n]["COLUMN_NAME"][$j]) {
  312. echo ' class="tab_field_3" ';
  313. } else {
  314. echo ' class="tab_field" ';
  315. }
  316. ?>
  317. onmouseover="old_class = this.className; this.className = 'tab_field_2';"
  318. onmouseout="this.className = old_class;"
  319. onmousedown="Click_field('<?php
  320. echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . "','"
  321. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . "',";
  322. $tmpColumn = $t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j];
  323. if (!PMA_Util::isForeignKeySupported($GLOBALS['PMD']['TABLE_TYPE'][$i])) {
  324. echo (isset($tables_pk_or_unique_keys[$tmpColumn]) ? 1 : 0);
  325. } else {
  326. // if foreign keys are supported, it's not necessary that the
  327. // index is a primary key
  328. echo (isset($tables_all_keys[$tmpColumn]) ? 1 : 0);
  329. }
  330. ?>)">
  331. <?php
  332. if (isset($_REQUEST['query'])) {
  333. echo '<td class="select_all">';
  334. echo '<input value="' . htmlspecialchars($t_n_url)
  335. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '"';
  336. echo 'type="checkbox" id="select_' . htmlspecialchars($t_n_url) . '._'
  337. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '" ';
  338. echo 'style="margin: 0px;" title="select_'
  339. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '" ';
  340. echo 'onclick="store_column(\''
  341. . urlencode($GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]) . '\',\''
  342. . htmlspecialchars($GLOBALS['PMD_OUT']["OWNER"][$i]) . '\',\''
  343. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '\')"></td>';
  344. }?>
  345. <td width="10px" colspan="3"
  346. id="<?php echo $t_n_url
  347. . "."
  348. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?>">
  349. <div class="nowrap">
  350. <?php
  351. if (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j]])) {
  352. ?>
  353. <img src="<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>pmd/FieldKey_small.png"
  354. alt="*" />
  355. <?php
  356. } else {
  357. ?>
  358. <img src="<?php echo $_SESSION['PMA_Theme']->getImgPath(); ?>pmd/Field_small<?php
  359. if (strstr($tab_column[$t_n]["TYPE"][$j], 'char')
  360. || strstr($tab_column[$t_n]["TYPE"][$j], 'text')
  361. ) {
  362. echo '_char';
  363. } elseif (strstr($tab_column[$t_n]["TYPE"][$j], 'int')
  364. || strstr($tab_column[$t_n]["TYPE"][$j], 'float')
  365. || strstr($tab_column[$t_n]["TYPE"][$j], 'double')
  366. || strstr($tab_column[$t_n]["TYPE"][$j], 'decimal')
  367. ) {
  368. echo '_int';
  369. } elseif (strstr($tab_column[$t_n]["TYPE"][$j], 'date')
  370. || strstr($tab_column[$t_n]["TYPE"][$j], 'time')
  371. || strstr($tab_column[$t_n]["TYPE"][$j], 'year')
  372. ) {
  373. echo '_date';
  374. }
  375. ?>.png" alt="*" />
  376. <?php
  377. }
  378. echo htmlspecialchars(
  379. $tab_column[$t_n]["COLUMN_NAME"][$j] . " : "
  380. . $tab_column[$t_n]["TYPE"][$j],
  381. ENT_QUOTES
  382. );
  383. echo "</div>\n</td>\n";
  384. if (isset($_REQUEST['query'])) {
  385. /*$temp = $GLOBALS['PMD_OUT']["OWNER"][$i] . '.'
  386. . $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i];*/
  387. echo '<td class="small_tab_pref" '
  388. . 'onmouseover="this.className=\'small_tab_pref2\';"';
  389. echo 'onmouseout="this.className=\'small_tab_pref\';"';
  390. echo 'onclick="Click_option(\'pmd_optionse\',\''
  391. . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '\',\''
  392. . $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i] . '\')" >';
  393. echo '<img src="'
  394. . $_SESSION['PMA_Theme']->getImgPath('pmd/exec_small.png')
  395. . '" title="options" alt="" /></td> ';
  396. }
  397. echo "</tr>\n";
  398. }
  399. echo "</tbody>\n</table>\n";
  400. }
  401. ?>
  402. </form>
  403. </div>
  404. <div id="pmd_hint"></div>
  405. <table id="layer_new_relation" style="display:none;"
  406. width="5%" cellpadding="0" cellspacing="0">
  407. <tbody>
  408. <tr>
  409. <td class="frams1" width="10px"></td>
  410. <td class="frams5" width="99%" ></td>
  411. <td class="frams2" width="10px"><div class="bor"></div></td>
  412. </tr>
  413. <tr>
  414. <td class="frams8"></td>
  415. <td class="input_tab">
  416. <table width="168" class="center" cellpadding="2" cellspacing="0">
  417. <thead>
  418. <tr>
  419. <td colspan="2" class="center nowrap">
  420. <strong><?php echo __('Create relation'); ?></strong>
  421. </td>
  422. </tr>
  423. </thead>
  424. <tbody id="foreign_relation">
  425. <tr>
  426. <td colspan="2" class="center nowrap"><strong>FOREIGN KEY</strong></td>
  427. </tr>
  428. <tr>
  429. <td width="58" class="nowrap">on delete</td>
  430. <td width="102"><select name="on_delete" id="on_delete">
  431. <option value="nix" selected="selected">--</option>
  432. <option value="CASCADE">CASCADE</option>
  433. <option value="SET NULL">SET NULL</option>
  434. <option value="NO ACTION">NO ACTION</option>
  435. <option value="RESTRICT">RESTRICT</option>
  436. </select>
  437. </td>
  438. </tr>
  439. <tr>
  440. <td class="nowrap">on update</td>
  441. <td><select name="on_update" id="on_update">
  442. <option value="nix" selected="selected">--</option>
  443. <option value="CASCADE">CASCADE</option>
  444. <option value="SET NULL">SET NULL</option>
  445. <option value="NO ACTION">NO ACTION</option>
  446. <option value="RESTRICT">RESTRICT</option>
  447. </select>
  448. </td>
  449. </tr>
  450. </tbody>
  451. <tbody>
  452. <tr>
  453. <td colspan="2" class="center nowrap">
  454. <input type="button" class="butt" name="Button"
  455. value="<?php echo __('OK'); ?>" onclick="New_relation()" />
  456. <input type="button" class="butt" name="Button"
  457. value="<?php echo __('Cancel'); ?>"
  458. onclick="document.getElementById('layer_new_relation').style.display = 'none';" />
  459. </td>
  460. </tr>
  461. </tbody>
  462. </table>
  463. </td>
  464. <td class="frams6"></td>
  465. </tr>
  466. <tr>
  467. <td class="frams4"><div class="bor"></div></td>
  468. <td class="frams7"></td>
  469. <td class="frams3"></td>
  470. </tr>
  471. </tbody>
  472. </table>
  473. <table id="layer_upd_relation" style="display:none;"
  474. width="5%" cellpadding="0" cellspacing="0">
  475. <tbody>
  476. <tr>
  477. <td class="frams1" width="10px"></td>
  478. <td class="frams5" width="99%"></td>
  479. <td class="frams2" width="10px"><div class="bor"></div></td>
  480. </tr>
  481. <tr>
  482. <td class="frams8"></td>
  483. <td class="input_tab">
  484. <table width="100%" class="center" cellpadding="2" cellspacing="0">
  485. <tr>
  486. <td colspan="3" class="center nowrap">
  487. <strong><?php echo __('Delete relation'); ?></strong>
  488. </td>
  489. </tr>
  490. <tr>
  491. <td colspan="3" class="center nowrap">
  492. <input name="Button" type="button" class="butt"
  493. onclick="Upd_relation()" value="<?php echo __('Delete'); ?>" />
  494. <input type="button" class="butt" name="Button"
  495. value="<?php echo __('Cancel'); ?>"
  496. onclick="document.getElementById('layer_upd_relation').style.display = 'none'; Re_load();" />
  497. </td>
  498. </tr>
  499. </table></td>
  500. <td class="frams6"></td>
  501. </tr>
  502. <tr>
  503. <td class="frams4"><div class="bor"></div></td>
  504. <td class="frams7"></td>
  505. <td class="frams3"></td>
  506. </tr>
  507. </tbody>
  508. </table>
  509. <table id="pmd_optionse" style="display:none;"
  510. width="5%" cellpadding="0" cellspacing="0">
  511. <tbody>
  512. <tr>
  513. <td class="frams1" width="10px"></td>
  514. <td class="frams5" width="99%" ></td>
  515. <td class="frams2" width="10px"><div class="bor"></div></td>
  516. </tr>
  517. <tr>
  518. <td class="frams8"></td>
  519. <td class="input_tab">
  520. <table width="168" class="center" cellpadding="2" cellspacing="0">
  521. <thead>
  522. <tr>
  523. <td colspan="2" rowspan="2" id="option_col_name"
  524. class="center nowrap">
  525. </td>
  526. </tr>
  527. </thead>
  528. <tbody id="where">
  529. <tr><td class="center nowrap"><b>WHERE</b></td></tr>
  530. <tr>
  531. <td width="58" class="nowrap"><?php echo __('Relation operator'); ?></td>
  532. <td width="102"><select name="rel_opt" id="rel_opt">
  533. <option value="--" selected="selected"> -- </option>
  534. <option value="="> = </option>
  535. <option value="&gt;"> &gt; </option>
  536. <option value="&lt;"> &lt; </option>
  537. <option value="&gt;="> &gt;= </option>
  538. <option value="&lt;="> &lt;= </option>
  539. <option value="NOT"> NOT </option>
  540. <option value="IN"> IN </option>
  541. <option value="EXCEPT"> <?php echo __('Except'); ?> </option>
  542. <option value="NOT IN"> NOT IN </option>
  543. </select>
  544. </td>
  545. </tr>
  546. <tr>
  547. <td class="nowrap"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td>
  548. <td><textarea id="Query" value="" cols="18"></textarea>
  549. </td>
  550. </tr>
  551. <tr><td class="center nowrap"><b><?php echo __('Rename to'); ?></b></td></tr>
  552. <tr>
  553. <td width="58" class="nowrap"><?php echo __('New name'); ?></td>
  554. <td width="102"><input type="text" value="" id="new_name"/></td>
  555. </tr>
  556. <tr><td class="center nowrap"><b><?php echo __('Aggregate'); ?></b></td></tr>
  557. <tr>
  558. <td width="58" class="nowrap"><?php echo __('Operator'); ?></td>
  559. <td width="102"><select name="operator" id="operator">
  560. <option value="---" selected="selected">---</option>
  561. <option value="sum" > SUM </option>
  562. <option value="min"> MIN </option>
  563. <option value="max"> MAX </option>
  564. <option value="avg"> AVG </option>
  565. <option value="count"> COUNT </option>
  566. </select>
  567. </td></tr>
  568. <tr>
  569. <td width="58" class="center nowrap"><b>GROUP BY</b></td>
  570. <td><input type="checkbox" value="groupby" id="groupby"/></td>
  571. </tr>
  572. <tr>
  573. <td width="58" class="center nowrap"><b>ORDER BY</b></td>
  574. <td><input type="checkbox" value="orderby" id="orderby"/></td>
  575. </tr>
  576. <tr><td class="center nowrap"><b>HAVING</b></td></tr>
  577. <tr>
  578. <td width="58" class="nowrap"><?php echo __('Operator'); ?></td>
  579. <td width="102"><select name="h_operator" id="h_operator">
  580. <option value="---" selected="selected">---</option>
  581. <option value="None" > <?php echo __('None'); ?> </option>
  582. <option value="sum" > SUM </option>
  583. <option value="min"> MIN </option>
  584. <option value="max"> MAX </option>
  585. <option value="avg"> AVG </option>
  586. <option value="count"> COUNT </option>
  587. </select>
  588. </td></tr>
  589. <tr>
  590. <td width="58" class="nowrap"><?php echo __('Relation operator'); ?></td>
  591. <td width="102"><select name="h_rel_opt" id="h_rel_opt">
  592. <option value="--" selected="selected"> -- </option>
  593. <option value="="> = </option>
  594. <option value="&gt;"> &gt; </option>
  595. <option value="&lt;"> &lt; </option>
  596. <option value="&gt;="> &gt;= </option>
  597. <option value="&lt;="> &lt;= </option>
  598. <option value="NOT"> NOT </option>
  599. <option value="IN"> IN </option>
  600. <option value="EXCEPT"> <?php echo __('Except'); ?> </option>
  601. <option value="NOT IN"> NOT IN </option>
  602. </select>
  603. </td>
  604. </tr>
  605. <tr>
  606. <td width="58" class="nowrap">
  607. <?php echo __('Value'); ?>/<br/>
  608. <?php echo __('subquery'); ?>
  609. </td>
  610. <td width="102">
  611. <textarea id="having" value="" cols="18"></textarea>
  612. </td>
  613. </tr>
  614. </tbody>
  615. <tbody>
  616. <tr>
  617. <td colspan="2" class="center nowrap">
  618. <input type="button" class="butt" name="Button"
  619. value="<?php echo __('OK'); ?>" onclick="add_object()" />
  620. <input type="button" class="butt" name="Button"
  621. value="<?php echo __('Cancel'); ?>"
  622. onclick="Close_option()" />
  623. </td>
  624. </tr>
  625. </tbody>
  626. </table>
  627. </td>
  628. <td class="frams6"></td>
  629. </tr>
  630. <tr>
  631. <td class="frams4"><div class="bor"></div></td>
  632. <td class="frams7"></td>
  633. <td class="frams3"></td>
  634. </tr>
  635. </tbody>
  636. </table>
  637. <table id="query_rename_to" style="display:none;"
  638. width="5%" cellpadding="0" cellspacing="0">
  639. <tbody>
  640. <tr>
  641. <td class="frams1" width="10px"></td>
  642. <td class="frams5" width="99%" ></td>
  643. <td class="frams2" width="10px"><div class="bor"></div></td>
  644. </tr>
  645. <tr>
  646. <td class="frams8"></td>
  647. <td class="input_tab">
  648. <table width="168" class="center" cellpadding="2" cellspacing="0">
  649. <thead>
  650. <tr>
  651. <td colspan="2" class="center nowrap">
  652. <strong><?php echo __('Rename to'); ?></strong>
  653. </td>
  654. </tr>
  655. </thead>
  656. <tbody id="rename_to">
  657. <tr>
  658. <td width="58" class="nowrap"><?php echo __('New name'); ?></td>
  659. <td width="102">
  660. <input type="text" value="" id="e_rename"/>
  661. </td>
  662. </tr>
  663. </tbody>
  664. <tbody>
  665. <tr>
  666. <td colspan="2" class="center nowrap">
  667. <input type="button" class="butt" name="Button"
  668. value="<?php echo __('OK'); ?>" onclick="edit('Rename')" />
  669. <input type="button" class="butt" name="Button"
  670. value="<?php echo __('Cancel'); ?>"
  671. onclick="document.getElementById('query_rename_to').style.display = 'none';" />
  672. </td>
  673. </tr>
  674. </tbody>
  675. </table>
  676. </td>
  677. <td class="frams6"></td>
  678. </tr>
  679. <tr>
  680. <td class="frams4"><div class="bor"></div></td>
  681. <td class="frams7"></td>
  682. <td class="frams3"></td>
  683. </tr>
  684. </tbody>
  685. </table>
  686. <table id="query_having" style="display:none;"
  687. width="5%" cellpadding="0" cellspacing="0">
  688. <tbody>
  689. <tr>
  690. <td class="frams1" width="10px"></td>
  691. <td class="frams5" width="99%" ></td>
  692. <td class="frams2" width="10px"><div class="bor"></div></td>
  693. </tr>
  694. <tr>
  695. <td class="frams8"></td>
  696. <td class="input_tab">
  697. <table width="168" class="center" cellpadding="2" cellspacing="0">
  698. <thead>
  699. <tr>
  700. <td colspan="2" class="center nowrap"><strong>HAVING</strong></td>
  701. </tr>
  702. </thead>
  703. <tbody id="rename_to">
  704. <tr>
  705. <td width="58" class="nowrap"><?php echo __('Operator'); ?></td>
  706. <td width="102"><select name="hoperator" id="hoperator">
  707. <option value="---" selected="selected">---</option>
  708. <option value="None" > None </option>
  709. <option value="sum" > SUM </option>
  710. <option value="min"> MIN </option>
  711. <option value="max"> MAX </option>
  712. <option value="avg"> AVG </option>
  713. <option value="count"> COUNT </option>
  714. </select>
  715. </td></tr>
  716. <tr>
  717. <tr>
  718. <td width="58" class="nowrap"><?php echo __('Operator'); ?></td>
  719. <td width="102"><select name="hrel_opt" id="hrel_opt">
  720. <option value="--" selected="selected"> -- </option>
  721. <option value="="> = </option>
  722. <option value="&gt;"> &gt; </option>
  723. <option value="&lt;"> &lt; </option>
  724. <option value="&gt;="> &gt;= </option>
  725. <option value="&lt;="> &lt;= </option>
  726. <option value="NOT"> NOT </option>
  727. <option value="IN"> IN </option>
  728. <option value="EXCEPT"> <?php echo __('Except'); ?> </option>
  729. <option value="NOT IN"> NOT IN </option>
  730. </select>
  731. </td>
  732. </tr>
  733. <tr>
  734. <td class="nowrap"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td>
  735. <td><textarea id="hQuery" value="" cols="18"></textarea>
  736. </td>
  737. </tr>
  738. </tbody>
  739. <tbody>
  740. <tr>
  741. <td colspan="2" class="center nowrap">
  742. <input type="button" class="butt" name="Button"
  743. value="<?php echo __('OK'); ?>" onclick="edit('Having')" />
  744. <input type="button" class="butt" name="Button"
  745. value="<?php echo __('Cancel'); ?>"
  746. onclick="document.getElementById('query_having').style.display = 'none';" />
  747. </td>
  748. </tr>
  749. </tbody>
  750. </table>
  751. </td>
  752. <td class="frams6"></td>
  753. </tr>
  754. <tr>
  755. <td class="frams4"><div class="bor"></div></td>
  756. <td class="frams7"></td>
  757. <td class="frams3"></td>
  758. </tr>
  759. </tbody>
  760. </table>
  761. <table id="query_Aggregate" style="display:none;"
  762. width="5%" cellpadding="0" cellspacing="0">
  763. <tbody>
  764. <tr>
  765. <td class="frams1" width="10px"></td>
  766. <td class="frams5" width="99%" ></td>
  767. <td class="frams2" width="10px"><div class="bor"></div></td>
  768. </tr>
  769. <tr>
  770. <td class="frams8"></td>
  771. <td class="input_tab">
  772. <table width="168" class="center" cellpadding="2" cellspacing="0">
  773. <thead>
  774. <tr>
  775. <td colspan="2" class="center nowrap">
  776. <strong><?php echo __('Aggregate'); ?></strong>
  777. </td>
  778. </tr>
  779. </thead>
  780. <tbody>
  781. <tr>
  782. <td width="58" class="nowrap"><?php echo __('Operator'); ?></td>
  783. <td width="102">
  784. <select name="operator" id="e_operator">
  785. <option value="---" selected="selected">---</option>
  786. <option value="sum" > SUM </option>
  787. <option value="min"> MIN </option>
  788. <option value="max"> MAX </option>
  789. <option value="avg"> AVG </option>
  790. <option value="avg"> COUNT </option>
  791. </select>
  792. </td></tr>
  793. </tbody>
  794. <tbody>
  795. <tr>
  796. <td colspan="2" class="center nowrap">
  797. <input type="button" class="butt" name="Button"
  798. value="<?php echo __('OK'); ?>" onclick="edit('Aggregate')" />
  799. <input type="button" class="butt" name="Button"
  800. value="<?php echo __('Cancel'); ?>"
  801. onclick="document.getElementById('query_Aggregate').style.display = 'none';" />
  802. </td>
  803. </tr>
  804. </tbody>
  805. </table>
  806. </td>
  807. <td class="frams6"></td>
  808. </tr>
  809. <tr>
  810. <td class="frams4"><div class="bor"></div></td>
  811. <td class="frams7"></td>
  812. <td class="frams3"></td>
  813. </tr>
  814. </tbody>
  815. </table>
  816. <table id="query_where" style="display:none;"
  817. width="5%" cellpadding="0" cellspacing="0">
  818. <tbody>
  819. <tr>
  820. <td class="frams1" width="10px"></td>
  821. <td class="frams5" width="99%" ></td>
  822. <td class="frams2" width="10px"><div class="bor"></div></td>
  823. </tr>
  824. <tr>
  825. <td class="frams8"></td>
  826. <td class="input_tab">
  827. <table width="168" class="center" cellpadding="2" cellspacing="0">
  828. <thead>
  829. <tr>
  830. <td colspan="2" class="center nowrap"><strong>WHERE</strong></td>
  831. </tr>
  832. </thead>
  833. <tbody id="rename_to">
  834. <tr>
  835. <td width="58" class="nowrap"><?php echo __('Operator'); ?></td>
  836. <td width="102"><select name="erel_opt" id="erel_opt">
  837. <option value="--" selected="selected"> -- </option>
  838. <option value="=" > = </option>
  839. <option value="&gt;"> &gt; </option>
  840. <option value="&lt;"> &lt; </option>
  841. <option value="&gt;="> &gt;= </option>
  842. <option value="&lt;="> &lt;= </option>
  843. <option value="NOT"> NOT </option>
  844. <option value="IN"> IN </option>
  845. <option value="EXCEPT"> <?php echo __('Except'); ?> </option>
  846. <option value="NOT IN"> NOT IN </option>
  847. </select>
  848. </td>
  849. </tr>
  850. <tr>
  851. <td class="nowrap"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td>
  852. <td><textarea id="eQuery" value="" cols="18"></textarea>
  853. </td>
  854. </tr>
  855. </tbody>
  856. <tbody>
  857. <tr>
  858. <td colspan="2" class="center nowrap">
  859. <input type="button" class="butt" name="Button"
  860. value="<?php echo __('OK'); ?>" onclick="edit('Where')" />
  861. <input type="button" class="butt" name="Button"
  862. value="<?php echo __('Cancel'); ?>"
  863. onclick="document.getElementById('query_where').style.display = 'none';" />
  864. </td>
  865. </tr>
  866. </tbody>
  867. </table>
  868. </td>
  869. <td class="frams6"></td>
  870. </tr>
  871. <tr>
  872. <td class="frams4"><div class="bor"></div></td>
  873. <td class="frams7"></td>
  874. <td class="frams3"></td>
  875. </tr>
  876. </tbody>
  877. </table>
  878. <?php
  879. if (! empty($_REQUEST['query'])) {
  880. echo '<div class="panel">';
  881. echo '<div style="clear:both;"></div>';
  882. echo '<div id="ab"></div>';
  883. echo '<div style="clear:both;"></div>';
  884. echo '</div>';
  885. echo '<a class="trigger" href="#">' . __('Active options') . '</a>';
  886. echo '<div id="filter"></div>';
  887. echo '<div id="box">';
  888. echo '<span id="boxtitle"></span>';
  889. echo '<form method="post" action="db_qbe.php">';
  890. echo '<textarea cols="80" name="sql_query" id="textSqlquery"'
  891. . ' rows="15"></textarea><div id="tblfooter">';
  892. echo ' <input type="submit" name="submit_sql" class="btn" />';
  893. echo ' <input type="button" name="cancel" value="'
  894. . __('Cancel') . '" onclick="closebox()" class="btn" />';
  895. echo PMA_URL_getHiddenInputs($_GET['db']);
  896. echo '</div></p>';
  897. echo '</form></div>';
  898. } ?>
  899. <!-- cache images -->
  900. <?php
  901. echo '<img src="'
  902. . $_SESSION['PMA_Theme']->getImgPath('pmd/2leftarrow_m.png')
  903. . '" width="0" height="0" alt="" />'
  904. . '<img src="'
  905. . $_SESSION['PMA_Theme']->getImgPath('pmd/rightarrow1.png')
  906. . '" width="0" height="0" alt="" />'
  907. . '<img src="'
  908. . $_SESSION['PMA_Theme']->getImgPath('pmd/rightarrow2.png')
  909. . '" width="0" height="0" alt="" />'
  910. . '<img src="'
  911. . $_SESSION['PMA_Theme']->getImgPath('pmd/uparrow2_m.png')
  912. . '" width="0" height="0" alt="" />'
  913. . '<div id="PMA_disable_floating_menubar"></div>';
  914. ?>