pmd_general.php 36 KB

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