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