2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * phpMyAdmin designer general code
6 * @package PhpMyAdmin-Designer
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/pmd_common.php';
15 $script_display_field = PMA_getTablesInfo();
16 $tab_column = PMA_getColumnsInfo();
17 $script_tables = PMA_getScriptTabs();
18 $tables_pk_or_unique_keys = PMA_getPKOrUniqueKeys();
19 $tables_all_keys = PMA_getAllKeys();
22 $response = PMA_Response
::getInstance();
24 if (isset($_REQUEST['dialog'])) {
26 include_once 'libraries/designer.lib.php';
27 if ($_REQUEST['dialog'] == 'edit') {
28 $html = PMA_getHtmlForEditOrDeletePages($GLOBALS['db'], 'edit');
29 } else if ($_REQUEST['dialog'] == 'delete') {
30 $html = PMA_getHtmlForEditOrDeletePages($GLOBALS['db'], 'delete');
31 } else if ($_REQUEST['dialog'] == 'save_as') {
32 $html = PMA_getHtmlForPageSaveAs($GLOBALS['db']);
33 } else if ($_REQUEST['dialog'] == 'export') {
34 $html = PMA_getHtmlForSchemaExport($GLOBALS['db'], $_REQUEST['selected_page']);
37 $response->addHTML($html);
41 if (isset($_REQUEST['operation'])) {
43 if ($_REQUEST['operation'] == 'delete') {
44 $result = PMA_deletePage($_REQUEST['selected_page']);
46 $response->isSuccess(true);
48 $response->isSuccess(false);
50 } elseif ($_REQUEST['operation'] == 'save') {
51 if ($_REQUEST['save_page'] == 'same') {
52 $page = $_REQUEST['selected_page'];
53 } elseif ($_REQUEST['save_page'] == 'new') {
54 $page = PMA_createNewPage($_REQUEST['selected_value'], $GLOBALS['db']);
55 $response->addJSON('id', $page);
57 if (PMA_saveTablePositions($page)) {
58 $response->isSuccess(true);
60 $response->isSuccess(false);
65 if (! empty($_REQUEST['page'])) {
66 $display_page = $_REQUEST['page'];
68 $display_page = PMA_getFirstPage($_REQUEST['db']);
72 $tab_pos = PMA_getTablePositions($display_page);
73 $selected_page = PMA_getPageName($display_page);
74 $script_contr = PMA_getScriptContr();
76 $params = array('lang' => $GLOBALS['lang']);
77 if (isset($_GET['db'])) {
78 $params['db'] = $_GET['db'];
81 $response = PMA_Response
::getInstance();
82 $response->getFooter()->setMinimal();
83 $header = $response->getHeader();
84 $header->setBodyId('pmd_body');
85 $scripts = $header->getScripts();
86 $scripts->addFile('jquery/jquery.fullscreen.js');
87 $scripts->addFile('pmd/ajax.js');
88 $scripts->addFile('pmd/history.js');
89 $scripts->addFile('pmd/move.js');
90 $scripts->addFile('pmd/iecanvas.js', true);
91 $scripts->addFile('pmd/init.js');
93 require 'libraries/db_common.inc.php';
94 require 'libraries/db_info.inc.php';
96 // Embed some data into HTML, later it will be read
97 // by pmd/init.js and converted to JS variables.
98 echo '<div id="script_server" class="hide">';
99 echo htmlspecialchars($GLOBALS['server']);
101 echo '<div id="script_db" class="hide">';
102 echo htmlspecialchars($_GET['db']);
104 echo '<div id="script_token" class="hide">';
105 echo htmlspecialchars($_GET['token']);
107 echo '<div id="script_tables" class="hide">';
108 echo htmlspecialchars(json_encode($script_tables));
110 echo '<div id="script_contr" class="hide">';
111 echo htmlspecialchars(json_encode($script_contr));
113 echo '<div id="script_display_field" class="hide">';
114 echo htmlspecialchars(json_encode($script_display_field));
116 echo '<div id="script_display_page" class="hide">';
117 echo htmlspecialchars($display_page);
121 <div
class="pmd_header" id
="top_menu">
122 <a href
="#" onclick
="Show_left_menu(document.getElementById('key_Show_left_menu')); return false"
123 class="M_butt first" target
="_self">
124 <img id
='key_Show_left_menu'
125 title
="<?php echo __('Show/Hide left menu'); ?>" alt
="v"
126 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow2_m.png'); ?>" />
128 <a href
="#" id
="enterFullscreen" onclick
="Enter_fullscreen(); return false"
129 class="M_butt" target
="_self">
130 <img title
="<?php echo __('View in fullscreen') ?>" alt
=""
131 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/viewInFullscreen.png'); ?>" />
133 <a href
="#" id
="exitFullscreen" onclick
="Exit_fullscreen(); return false"
134 class="M_butt hide" target
="_self">
135 <img title
="<?php echo __('Exit fullscreen') ?>" alt
=""
136 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/exitFullscreen.png'); ?>" />
139 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>"
141 <a href
="#" onclick
="New(); return false" class="M_butt" target
="_self">
142 <img title
="<?php echo __('New page') ?>" alt
=""
143 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/page_add.png'); ?>" />
145 <a href
="#" onclick
="Edit_pages(); return false" class="M_butt ajax" target
="_self">
146 <img title
="<?php echo __('Open page') ?>" alt
=""
147 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/page_edit.png'); ?>" />
149 <a href
="#" onclick
="Save3(); return false" class="M_butt" target
="_self">
150 <img title
="<?php echo __('Save position') ?>" alt
=""
151 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/save.png'); ?>" />
153 <a href
="#" onclick
="Save_as(); return false" class="M_butt ajax" target
="_self">
154 <img title
="<?php echo __('Save positions as') ?>" alt
=""
155 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/save_as.png'); ?>" />
157 <a href
="#" onclick
="Delete_pages(); return false" class="M_butt ajax" target
="_self">
158 <img title
="<?php echo __('Delete pages') ?>" alt
=""
159 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/page_delete.png'); ?>" />
161 <img
class="M_bord" src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt
="" />
162 <a href
="#" onclick
="Start_table_new(); return false"
163 class="M_butt" target
="_self">
164 <img title
="<?php echo __('Create table')?>" alt
=""
165 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/table.png'); ?>" />
167 <a href
="#" onclick
="Start_relation(); return false" class="M_butt"
168 id
="rel_button" target
="_self">
169 <img title
="<?php echo __('Create relation') ?>" alt
=""
170 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/relation.png'); ?>" />
172 <a href
="#" onclick
="Start_display_field(); return false"
173 class="M_butt" id
="display_field_button" target
="_self">
174 <img title
="<?php echo __('Choose column to display') ?>" alt
=""
175 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/display_field.png'); ?>" />
177 <a href
="#" onclick
="location.reload(); return false" class="M_butt"
179 <img title
="<?php echo __('Reload'); ?>" alt
=""
180 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/reload.png'); ?>" />
182 <a href
="<?php echo PMA_Util::getDocuLink('faq', 'faq6-31') ?>"
183 target
="documentation" class="M_butt" target
="_self">
184 <img title
="<?php echo __('Help'); ?>" alt
=""
185 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/help.png'); ?>" />
188 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>"
190 <a href
="#" onclick
="Angular_direct(); return false"
191 class="M_butt" id
="angular_direct_button" target
="_self">
192 <img title
="<?php echo __('Angular links') . ' / ' . __('Direct links'); ?>" alt
=""
193 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/ang_direct.png'); ?>" />
195 <a href
="#" onclick
="Grid(); return false" class="M_butt" id
="grid_button"
197 <img title
="<?php echo __('Snap to grid') ?>"
198 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/grid.png'); ?>" alt
="" />
200 <img
class="M_bord" src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt
="" />
201 <a href
="#" onclick
="Small_tab_all(document.getElementById('key_SB_all')); return false"
202 class="M_butt" target
="_self">
203 <img id
='key_SB_all' title
="<?php echo __('Small/Big All'); ?>" alt
="v"
204 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow1.png'); ?>" />
206 <a href
="#" onclick
="Small_tab_invert(); return false" class="M_butt"
208 <img title
="<?php echo __('Toggle small/big'); ?>" alt
="key"
209 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bottom.png'); ?>" />
211 <a href
="#" onclick
="Relation_lines_invert(); return false"
212 class="M_butt" target
="_self" >
213 <img title
="<?php echo __('Toggle relation lines'); ?>" alt
="key"
214 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/toggle_lines.png'); ?>" />
216 <img
class="M_bord" src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt
="" />
217 <span id
="page_name"><?php
echo htmlspecialchars($selected_page) ?
></span
>
218 <img
class="M_bord" src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt
="" />
219 <a href
="#" onclick
="Export_pages(); return false"
220 class="M_butt" target
="_self" >
221 <img title
="<?php echo __('Export schema'); ?>" alt
="key"
222 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/export.png'); ?>" />
224 <img
class="M_bord" src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/bord.png'); ?>" alt
="" />
226 if (isset($_REQUEST['query'])) {
227 echo '<a href="#" onclick="build_query(\'SQL Query on Database\', 0)" onmousedown="return false;"
228 class="M_butt" target="_self">';
230 . $_SESSION['PMA_Theme']->getImgPath('pmd/query_builder.png')
231 . '" alt="key" width="20" height="20" title="';
232 echo __('Build Query');
236 <a href
="#" onclick
="Top_menu_right(document.getElementById('key_Left_Right')); return false"
237 class="M_butt last" target
="_self">
238 <img src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/2rightarrow_m.png'); ?>"
239 id
="key_Left_Right" alt
=">" title
="<?php echo __('Move Menu'); ?>" />
243 <div id
="canvas_outer">
244 <form action
="" method
="post" name
="form1">
246 <canvas
class="pmd" id
="canvas" width
="100" height
="100"
247 onclick
="Canvas_click(this)"></canvas
>
249 <div id
="layer_menu" style
="display:none;">
250 <div
class="center" style
="padding-top:5px;">
252 onclick
="Hide_tab_all(document.getElementById('key_HS_all')); return false" class="M_butt" target
="_self">
253 <img title
="<?php echo __('Hide/Show all'); ?>" alt
="v"
254 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow1.png'); ?>" id
='key_HS_all' /></a
>
256 onclick
="No_have_constr(document.getElementById('key_HS')); return false" class="M_butt" target
="_self">
257 <img title
="<?php echo __('Hide/Show Tables with no relation'); ?>" alt
="v"
258 src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/downarrow2.png'); ?>" id
='key_HS' /></a
>
261 <div id
="id_scroll_tab" class="scroll_tab">
262 <table width
="100%" style
="padding-left: 3px;">
264 $name_cnt = count($GLOBALS['PMD']['TABLE_NAME']);
265 for ($i = 0; $i < $name_cnt; $i++
) {
267 echo '<tr><td title="' . __('Structure') . '" width="1px" '
268 . 'onmouseover="this.className=\'L_butt2_2\'" '
269 . 'onmouseout="this.className=\'L_butt2_1\'" class="L_butt2_1">';
271 . 'onclick="Start_tab_upd(\''
272 . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '\');" '
273 . 'src="' . $_SESSION['PMA_Theme']->getImgPath('pmd/exec.png')
276 echo '<td width="1px">';
277 echo '<input onclick="VisibleTab(this,\''
278 . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '\')" '
279 . 'title="' . __('Hide') . '" '
280 . 'id="check_vis_' . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '" '
281 . 'style="margin:0px;" type="checkbox" '
282 . 'value="' . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '"';
283 if ((isset($tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]])
284 && $tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]]["H"])
285 ||
$display_page == -1
287 echo 'checked="checked"';
290 echo '<td class="pmd_Tabs" onmouseover="this.className=\'pmd_Tabs2\'" '
291 . 'onmouseout="this.className=\'pmd_Tabs\'" ' . 'onclick="Select_tab(\''
292 . $GLOBALS['PMD_URL']["TABLE_NAME"][$i] . '\');">';
293 echo $GLOBALS['PMD_OUT']["TABLE_NAME"][$i];
300 echo '<div class="center">';
301 echo __('Number of tables:') . ' ' . $name_cnt;
303 echo '<div class="floatright">';
304 echo '<div id="layer_menu_sizer" onmousedown="layer_menu_cur_click=1">';
309 for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++
) {
310 $t_n = $GLOBALS['PMD']["TABLE_NAME"][$i];
311 $t_n_url = $GLOBALS['PMD_URL']["TABLE_NAME"][$i];
313 echo '<input name="t_x[' . $t_n_url . ']" type="hidden" id="t_x_'
315 . '<input name="t_y[' . $t_n_url . ']" type="hidden" id="t_y_'
317 . '<input name="t_v[' . $t_n_url . ']" type="hidden" id="t_v_'
319 . '<input name="t_h[' . $t_n_url . ']" type="hidden" id="t_h_'
320 . $t_n_url . '_" />';
322 <table id
="<?php echo $t_n_url ?>" cellpadding
="0" cellspacing
="0" class="pmd_tab"
323 style
="position: absolute;
325 echo isset($tab_pos[$t_n]) ? $tab_pos[$t_n]["X
"] : rand(20, 700); ?>px;
327 echo isset($tab_pos[$t_n]) ? $tab_pos[$t_n]["Y
"] : rand(20, 550); ?>px;
329 echo (isset($tab_pos[$t_n]) || $display_page == -1) ? "block
" : "none
"; ?>;
334 if (isset($_REQUEST['query'])) {
335 echo '<td class="select_all">';
336 echo '<input type="checkbox" value="select_all_'
337 . htmlspecialchars($t_n_url) . '" style="margin: 0px;" ';
338 echo 'id="select_all_' . htmlspecialchars($t_n_url) . '" title="select all" ';
339 echo 'onclick="Select_all(\'' . htmlspecialchars($t_n_url) . '\',\''
340 . htmlspecialchars($GLOBALS['PMD_OUT']["OWNER"][$i]) . '\')"></td>';
343 <td
class="small_tab" onmouseover
="this.className='small_tab2';"
344 onmouseout
="this.className='small_tab';"
345 id
="id_hide_tbody_<?php echo $t_n_url ?>"
346 onclick
="Small_tab('<?php echo $t_n_url ?>', 1)"><?php
347 // no space alloawd here, between tags and content !!!
348 // JavaScript function does require this
349 if (! isset($tab_pos[$t_n]) ||
! empty($tab_pos[$t_n]["V"])) {
355 <td
class="small_tab_pref" onmouseover
="this.className='small_tab_pref2';"
356 onmouseout
="this.className='small_tab_pref';"
357 onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');">
358 <img src
="<?php echo $_SESSION['PMA_Theme']->getImgPath('pmd/exec_small.png'); ?>" alt
="" /></td
>
359 <td id
="id_zag_<?php echo $t_n_url ?>" class="tab_zag nowrap"
360 onmousedown
="cur_click=document.getElementById('<?php echo $t_n_url ?>');"/
361 onmouseover
="Table_onover('<?php echo $t_n_url ?>',0,<?php echo (isset($_REQUEST['query'])? 1 : 0 )?> )"
362 onmouseout
="Table_onover('<?php echo $t_n_url ?>',1,<?php echo (isset($_REQUEST['query']) ? 1 : 0 )?>)">
364 <?php
echo $GLOBALS['PMD_OUT']["OWNER"][$i]; ?
>.
366 <?php
echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i]; ?
>
369 if (isset($_REQUEST['query'])) {
370 echo '<td class="tab_zag" onmouseover="Table_onover(\''
371 . htmlspecialchars($t_n_url) . '\',0,1)" id="id_zag_'
372 . htmlspecialchars($t_n_url) . '_2"';
373 echo 'onmousedown="cur_click=document.getElementById(\''
374 . htmlspecialchars($t_n_url) . '\');"';
375 echo 'onmouseout="Table_onover(\'' . htmlspecialchars($t_n_url) . '\',1,1)">';
380 <tbody id
="id_tbody_<?php echo $t_n_url ?>"
382 if (isset($tab_pos[$t_n]) && empty($tab_pos[$t_n]["V"])) {
383 echo 'style="display: none;"';
386 $display_field = PMA_getDisplayField(
388 $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]
391 $j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]);
395 echo '<tr id="id_tr_'
396 . $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '.'
397 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '"';
398 if ($display_field == $tab_column[$t_n]["COLUMN_NAME"][$j]) {
399 echo ' class="tab_field_3" ';
401 echo ' class="tab_field" ';
404 onmouseover
="old_class = this.className; this.className = 'tab_field_2';"
405 onmouseout
="this.className = old_class;"
406 onmousedown
="Click_field('<?php
407 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i] . "','"
408 . urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j]) . "',";
409 $tmpColumn = $t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j];
410 if (!PMA_Util::isForeignKeySupported($GLOBALS['PMD
']['TABLE_TYPE
'][$i])) {
411 echo (isset($tables_pk_or_unique_keys[$tmpColumn]) ? 1 : 0);
413 // if foreign keys are supported, it's not necessary that the
414 // index is a primary key
415 echo (isset($tables_all_keys[$tmpColumn]) ?
1 : 0);
419 if (isset($_REQUEST['query'])) {
420 echo '<td class="select_all
">';
421 echo '<input value="' . htmlspecialchars($t_n_url)
422 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '"';
423 echo 'type="checkbox
" id="select_
' . htmlspecialchars($t_n_url) . '._
'
424 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '" ';
425 echo 'style="margin
: 0px
;" title="select_
'
426 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '" ';
427 echo 'onclick="store_column(\''
428 . urlencode($GLOBALS['PMD_OUT
']["TABLE_NAME_SMALL"][$i]) . '\'
,\''
429 . htmlspecialchars($GLOBALS['PMD_OUT
']["OWNER"][$i]) . '\'
,\''
430 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '\'
)"></td>';
432 <td width="10px
" colspan="3"
433 id="<?php
echo $t_n_url
435 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?
>">
438 if (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME
"][$j]])) {
440 <img src="<?php
echo $_SESSION['PMA_Theme']->getImgPath(); ?
>pmd
/FieldKey_small
.png
"
445 <img src="<?php
echo $_SESSION['PMA_Theme']->getImgPath(); ?
>pmd
/Field_small
<?php
446 if (strstr($tab_column[$t_n]["TYPE"][$j], 'char')
447 ||
strstr($tab_column[$t_n]["TYPE"][$j], 'text')
450 } elseif (strstr($tab_column[$t_n]["TYPE"][$j], 'int')
451 ||
strstr($tab_column[$t_n]["TYPE"][$j], 'float')
452 ||
strstr($tab_column[$t_n]["TYPE"][$j], 'double')
453 ||
strstr($tab_column[$t_n]["TYPE"][$j], 'decimal')
456 } elseif (strstr($tab_column[$t_n]["TYPE"][$j], 'date')
457 ||
strstr($tab_column[$t_n]["TYPE"][$j], 'time')
458 ||
strstr($tab_column[$t_n]["TYPE"][$j], 'year')
465 echo htmlspecialchars(
466 $tab_column[$t_n]["COLUMN_NAME
"][$j] . " : "
467 . $tab_column[$t_n]["TYPE
"][$j],
470 echo "</div
>\n</td
>\n";
471 if (isset($_REQUEST['query'])) {
472 /*$temp = $GLOBALS['PMD_OUT']["OWNER
"][$i] . '.'
473 . $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL
"][$i];*/
474 echo '<td class="small_tab_pref
" '
475 . 'onmouseover="this
.className
=\'small_tab_pref2\'
;"';
476 echo 'onmouseout="this
.className
=\'small_tab_pref\'
;"';
477 echo 'onclick="Click_option(\'pmd_optionse\'
,\''
478 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) . '\'
,\''
479 . $GLOBALS['PMD_OUT
']["TABLE_NAME_SMALL"][$i] . '\'
)" >';
481 . $_SESSION['PMA_Theme
']->getImgPath('pmd
/exec_small
.png
')
482 . '" title="options
" alt="" /></td> ';
486 echo "</tbody
>\n</table
>\n";
491 <div id="pmd_hint
"></div>
493 <table id="layer_new_relation
" style="display
:none
;"
494 width="5%
" cellpadding="0" cellspacing="0">
497 <td class="frams1
" width="10px
"></td>
498 <td class="frams5
" width="99%
" ></td>
499 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
502 <td class="frams8
"></td>
503 <td class="input_tab
">
504 <table width="168" class="center
" cellpadding="2" cellspacing="0">
507 <td colspan="2" class="center nowrap
">
508 <strong><?php echo __('Create relation'); ?></strong>
512 <tbody id="foreign_relation
">
514 <td colspan="2" class="center nowrap
"><strong>FOREIGN KEY</strong></td>
517 <td width="58" class="nowrap
">on delete</td>
518 <td width="102"><select name="on_delete
" id="on_delete
">
519 <option value="nix
" selected="selected
">--</option>
520 <option value="CASCADE
">CASCADE</option>
521 <option value="SET
NULL">SET NULL</option>
522 <option value="NO ACTION
">NO ACTION</option>
523 <option value="RESTRICT
">RESTRICT</option>
528 <td class="nowrap
">on update</td>
529 <td><select name="on_update
" id="on_update
">
530 <option value="nix
" selected="selected
">--</option>
531 <option value="CASCADE
">CASCADE</option>
532 <option value="SET
NULL">SET NULL</option>
533 <option value="NO ACTION
">NO ACTION</option>
534 <option value="RESTRICT
">RESTRICT</option>
541 <td colspan="2" class="center nowrap
">
542 <input type="button
" class="butt
" name="Button
"
543 value="<?php
echo __('OK'); ?
>" onclick="New_relation()" />
544 <input type="button
" class="butt
" name="Button
"
545 value="<?php
echo __('Cancel'); ?
>"
546 onclick="document
.getElementById('layer_new_relation').style
.display
= 'none';" />
552 <td class="frams6
"></td>
555 <td class="frams4
"><div class="bor
"></div></td>
556 <td class="frams7
"></td>
557 <td class="frams3
"></td>
562 <table id="layer_upd_relation
" style="display
:none
;"
563 width="5%
" cellpadding="0" cellspacing="0">
566 <td class="frams1
" width="10px
"></td>
567 <td class="frams5
" width="99%
"></td>
568 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
571 <td class="frams8
"></td>
572 <td class="input_tab
">
573 <table width="100%
" class="center
" cellpadding="2" cellspacing="0">
575 <td colspan="3" class="center nowrap
">
576 <strong><?php echo __('Delete relation'); ?></strong>
580 <td colspan="3" class="center nowrap
">
581 <input name="Button
" type="button
" class="butt
"
582 onclick="Upd_relation()" value="<?php
echo __('Delete'); ?
>" />
583 <input type="button
" class="butt
" name="Button
"
584 value="<?php
echo __('Cancel'); ?
>"
585 onclick="document
.getElementById('layer_upd_relation').style
.display
= 'none'; Re_load();" />
589 <td class="frams6
"></td>
592 <td class="frams4
"><div class="bor
"></div></td>
593 <td class="frams7
"></td>
594 <td class="frams3
"></td>
599 <table id="pmd_optionse
" style="display
:none
;"
600 width="5%
" cellpadding="0" cellspacing="0">
603 <td class="frams1
" width="10px
"></td>
604 <td class="frams5
" width="99%
" ></td>
605 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
608 <td class="frams8
"></td>
609 <td class="input_tab
">
610 <table width="168" class="center
" cellpadding="2" cellspacing="0">
613 <td colspan="2" rowspan="2" id="option_col_name
"
614 class="center nowrap
">
619 <tr><td class="center nowrap
"><b>WHERE</b></td></tr>
621 <td width="58" class="nowrap
"><?php echo __('Relation operator'); ?></td>
622 <td width="102"><select name="rel_opt
" id="rel_opt
">
623 <option value="--" selected="selected
"> -- </option>
624 <option value="="> = </option>
625 <option value=">
;"> > </option>
626 <option value="<
;"> < </option>
627 <option value=">
;="> >= </option>
628 <option value="<
;="> <= </option>
629 <option value="NOT
"> NOT </option>
630 <option value="IN
"> IN </option>
631 <option value="EXCEPT
"> <?php echo __('Except'); ?> </option>
632 <option value="NOT IN
"> NOT IN </option>
637 <td class="nowrap
"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td>
638 <td><textarea id="Query
" value="" cols="18"></textarea>
641 <tr><td class="center nowrap
"><b><?php echo __('Rename to'); ?></b></td></tr>
643 <td width="58" class="nowrap
"><?php echo __('New name'); ?></td>
644 <td width="102"><input type="text
" value="" id="new_name
"/></td>
646 <tr><td class="center nowrap
"><b><?php echo __('Aggregate'); ?></b></td></tr>
648 <td width="58" class="nowrap
"><?php echo __('Operator'); ?></td>
649 <td width="102"><select name="operator
" id="operator
">
650 <option value="---" selected="selected
">---</option>
651 <option value="sum
" > SUM </option>
652 <option value="min
"> MIN </option>
653 <option value="max
"> MAX </option>
654 <option value="avg
"> AVG </option>
655 <option value="count
"> COUNT </option>
659 <td width="58" class="center nowrap
"><b>GROUP BY</b></td>
660 <td><input type="checkbox
" value="groupby
" id="groupby
"/></td>
663 <td width="58" class="center nowrap
"><b>ORDER BY</b></td>
664 <td><input type="checkbox
" value="orderby
" id="orderby
"/></td>
666 <tr><td class="center nowrap
"><b>HAVING</b></td></tr>
668 <td width="58" class="nowrap
"><?php echo __('Operator'); ?></td>
669 <td width="102"><select name="h_operator
" id="h_operator
">
670 <option value="---" selected="selected
">---</option>
671 <option value="None
" > <?php echo __('None'); ?> </option>
672 <option value="sum
" > SUM </option>
673 <option value="min
"> MIN </option>
674 <option value="max
"> MAX </option>
675 <option value="avg
"> AVG </option>
676 <option value="count
"> COUNT </option>
680 <td width="58" class="nowrap
"><?php echo __('Relation operator'); ?></td>
681 <td width="102"><select name="h_rel_opt
" id="h_rel_opt
">
682 <option value="--" selected="selected
"> -- </option>
683 <option value="="> = </option>
684 <option value=">
;"> > </option>
685 <option value="<
;"> < </option>
686 <option value=">
;="> >= </option>
687 <option value="<
;="> <= </option>
688 <option value="NOT
"> NOT </option>
689 <option value="IN
"> IN </option>
690 <option value="EXCEPT
"> <?php echo __('Except'); ?> </option>
691 <option value="NOT IN
"> NOT IN </option>
696 <td width="58" class="nowrap
">
697 <?php echo __('Value'); ?>/<br/>
698 <?php echo __('subquery'); ?>
701 <textarea id="having
" value="" cols="18"></textarea>
707 <td colspan="2" class="center nowrap
">
708 <input type="button
" class="butt
" name="Button
"
709 value="<?php
echo __('OK'); ?
>" onclick="add_object()" />
710 <input type="button
" class="butt
" name="Button
"
711 value="<?php
echo __('Cancel'); ?
>"
712 onclick="Close_option()" />
718 <td class="frams6
"></td>
721 <td class="frams4
"><div class="bor
"></div></td>
722 <td class="frams7
"></td>
723 <td class="frams3
"></td>
728 <table id="query_rename_to
" style="display
:none
;"
729 width="5%
" cellpadding="0" cellspacing="0">
732 <td class="frams1
" width="10px
"></td>
733 <td class="frams5
" width="99%
" ></td>
734 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
737 <td class="frams8
"></td>
738 <td class="input_tab
">
739 <table width="168" class="center
" cellpadding="2" cellspacing="0">
742 <td colspan="2" class="center nowrap
">
743 <strong><?php echo __('Rename to'); ?></strong>
747 <tbody id="rename_to
">
749 <td width="58" class="nowrap
"><?php echo __('New name'); ?></td>
751 <input type="text
" value="" id="e_rename
"/>
757 <td colspan="2" class="center nowrap
">
758 <input type="button
" class="butt
" name="Button
"
759 value="<?php
echo __('OK'); ?
>" onclick="edit('Rename')" />
760 <input type="button
" class="butt
" name="Button
"
761 value="<?php
echo __('Cancel'); ?
>"
762 onclick="document
.getElementById('query_rename_to').style
.display
= 'none';" />
768 <td class="frams6
"></td>
771 <td class="frams4
"><div class="bor
"></div></td>
772 <td class="frams7
"></td>
773 <td class="frams3
"></td>
778 <table id="query_having
" style="display
:none
;"
779 width="5%
" cellpadding="0" cellspacing="0">
782 <td class="frams1
" width="10px
"></td>
783 <td class="frams5
" width="99%
" ></td>
784 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
787 <td class="frams8
"></td>
788 <td class="input_tab
">
789 <table width="168" class="center
" cellpadding="2" cellspacing="0">
792 <td colspan="2" class="center nowrap
"><strong>HAVING</strong></td>
795 <tbody id="rename_to
">
797 <td width="58" class="nowrap
"><?php echo __('Operator'); ?></td>
798 <td width="102"><select name="hoperator
" id="hoperator
">
799 <option value="---" selected="selected
">---</option>
800 <option value="None
" > None </option>
801 <option value="sum
" > SUM </option>
802 <option value="min
"> MIN </option>
803 <option value="max
"> MAX </option>
804 <option value="avg
"> AVG </option>
805 <option value="count
"> COUNT </option>
810 <td width="58" class="nowrap
"><?php echo __('Operator'); ?></td>
811 <td width="102"><select name="hrel_opt
" id="hrel_opt
">
812 <option value="--" selected="selected
"> -- </option>
813 <option value="="> = </option>
814 <option value=">
;"> > </option>
815 <option value="<
;"> < </option>
816 <option value=">
;="> >= </option>
817 <option value="<
;="> <= </option>
818 <option value="NOT
"> NOT </option>
819 <option value="IN
"> IN </option>
820 <option value="EXCEPT
"> <?php echo __('Except'); ?> </option>
821 <option value="NOT IN
"> NOT IN </option>
826 <td class="nowrap
"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td>
827 <td><textarea id="hQuery
" value="" cols="18"></textarea>
833 <td colspan="2" class="center nowrap
">
834 <input type="button
" class="butt
" name="Button
"
835 value="<?php
echo __('OK'); ?
>" onclick="edit('Having')" />
836 <input type="button
" class="butt
" name="Button
"
837 value="<?php
echo __('Cancel'); ?
>"
838 onclick="document
.getElementById('query_having').style
.display
= 'none';" />
844 <td class="frams6
"></td>
847 <td class="frams4
"><div class="bor
"></div></td>
848 <td class="frams7
"></td>
849 <td class="frams3
"></td>
854 <table id="query_Aggregate
" style="display
:none
;"
855 width="5%
" cellpadding="0" cellspacing="0">
858 <td class="frams1
" width="10px
"></td>
859 <td class="frams5
" width="99%
" ></td>
860 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
863 <td class="frams8
"></td>
864 <td class="input_tab
">
865 <table width="168" class="center
" cellpadding="2" cellspacing="0">
868 <td colspan="2" class="center nowrap
">
869 <strong><?php echo __('Aggregate'); ?></strong>
875 <td width="58" class="nowrap
"><?php echo __('Operator'); ?></td>
877 <select name="operator
" id="e_operator
">
878 <option value="---" selected="selected
">---</option>
879 <option value="sum
" > SUM </option>
880 <option value="min
"> MIN </option>
881 <option value="max
"> MAX </option>
882 <option value="avg
"> AVG </option>
883 <option value="avg
"> COUNT </option>
889 <td colspan="2" class="center nowrap
">
890 <input type="button
" class="butt
" name="Button
"
891 value="<?php
echo __('OK'); ?
>" onclick="edit('Aggregate')" />
892 <input type="button
" class="butt
" name="Button
"
893 value="<?php
echo __('Cancel'); ?
>"
894 onclick="document
.getElementById('query_Aggregate').style
.display
= 'none';" />
900 <td class="frams6
"></td>
903 <td class="frams4
"><div class="bor
"></div></td>
904 <td class="frams7
"></td>
905 <td class="frams3
"></td>
910 <table id="query_where
" style="display
:none
;"
911 width="5%
" cellpadding="0" cellspacing="0">
914 <td class="frams1
" width="10px
"></td>
915 <td class="frams5
" width="99%
" ></td>
916 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
919 <td class="frams8
"></td>
920 <td class="input_tab
">
921 <table width="168" class="center
" cellpadding="2" cellspacing="0">
924 <td colspan="2" class="center nowrap
"><strong>WHERE</strong></td>
927 <tbody id="rename_to
">
929 <td width="58" class="nowrap
"><?php echo __('Operator'); ?></td>
930 <td width="102"><select name="erel_opt
" id="erel_opt
">
931 <option value="--" selected="selected
"> -- </option>
932 <option value="=" > = </option>
933 <option value=">
;"> > </option>
934 <option value="<
;"> < </option>
935 <option value=">
;="> >= </option>
936 <option value="<
;="> <= </option>
937 <option value="NOT
"> NOT </option>
938 <option value="IN
"> IN </option>
939 <option value="EXCEPT
"> <?php echo __('Except'); ?> </option>
940 <option value="NOT IN
"> NOT IN </option>
945 <td class="nowrap
"><?php echo __('Value'); ?>/<br /><?php echo __('subquery'); ?></td>
946 <td><textarea id="eQuery
" value="" cols="18"></textarea>
952 <td colspan="2" class="center nowrap
">
953 <input type="button
" class="butt
" name="Button
"
954 value="<?php
echo __('OK'); ?
>" onclick="edit('Where')" />
955 <input type="button
" class="butt
" name="Button
"
956 value="<?php
echo __('Cancel'); ?
>"
957 onclick="document
.getElementById('query_where').style
.display
= 'none';" />
963 <td class="frams6
"></td>
966 <td class="frams4
"><div class="bor
"></div></td>
967 <td class="frams7
"></td>
968 <td class="frams3
"></td>
974 if (! empty($_REQUEST['query'])) {
975 echo '<div class="panel
">';
976 echo '<div style="clear
:both
;"></div>';
977 echo '<div id="ab
"></div>';
978 echo '<div style="clear
:both
;"></div>';
980 echo '<a class="trigger
" href="#">' . __('Active options') . '</a>';
981 echo '<div id="filter"></div>';
982 echo '<div id="box">';
983 echo '<span id="boxtitle"></span>';
984 echo '<form method="post" action="db_qbe.php">';
985 echo '<textarea cols="80" name="sql_query" id="textSqlquery"'
986 . ' rows="15"></textarea><div id="tblfooter">';
987 echo ' <input type="submit" name="submit_sql" class="btn" />';
988 echo ' <input type="button" name="cancel" value="'
989 . __('Cancel') . '" onclick="closebox()" class="btn" />';
990 echo PMA_URL_getHiddenInputs($_GET['db']);
992 echo '</form></div>';
997 <!-- cache images
-->
1000 . $_SESSION['PMA_Theme']->getImgPath('pmd/2leftarrow_m.png')
1001 . '" width="0" height="0" alt="" />'
1003 . $_SESSION['PMA_Theme']->getImgPath('pmd/rightarrow1.png')
1004 . '" width="0" height="0" alt="" />'
1006 . $_SESSION['PMA_Theme']->getImgPath('pmd/rightarrow2.png')
1007 . '" width="0" height="0" alt="" />'
1009 . $_SESSION['PMA_Theme']->getImgPath('pmd/uparrow2_m.png')
1010 . '" width="0" height="0" alt="" />'
1011 . '<div id="PMA_disable_floating_menubar"></div>';