2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * @package phpMyAdmin-Designer
10 require_once "./pmd_common.php";
12 $tab_column = get_tab_info();
13 $script_tabs = get_script_tabs();
14 $script_contr = get_script_contr();
15 $tab_pos = get_tab_pos();
16 $tables_pk_or_unique_keys = get_pk_or_unique_keys();
17 $tables_all_keys = get_all_keys();
21 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
22 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
23 <html xmlns
:v
="urn:schemas-microsoft-com:vml" xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][1]; ?>" lang
="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][1]; ?>" dir
="<?php echo $GLOBALS['text_dir']; ?>">
25 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset ?>" />
26 <link rel
="icon" href
="pmd/images/favicon.ico" type
="image/x-icon" />
27 <link rel
="shortcut icon" href
="pmd/images/favicon.ico" type
="image/x-icon" />
28 <link rel
="stylesheet" type
="text/css" href
="pmd/styles/<?php echo $GLOBALS['PMD']['STYLE'] ?>/style1.css" />
29 <title
>Designer
</title
>
30 <script type
="text/javascript">
34 var server = "' . PMA_escapeJsString($server) . '";
35 var db = "' . PMA_escapeJsString($db) . '";
36 var token = "' . PMA_escapeJsString($token) . '";';
42 $params = array('lang' => $GLOBALS['lang']);
43 if (isset($GLOBALS['db'])) {
44 $params['db'] = $GLOBALS['db'];
47 <script src
="js/messages.php<?php echo PMA_generate_common_url($params); ?>" type
="text/javascript"></script
>
48 <script src
="pmd/scripts/ajax.js" type
="text/javascript"></script
>
49 <script src
="pmd/scripts/move.js" type
="text/javascript"></script
>
51 <script src
="pmd/scripts/iecanvas.js" type
="text/javascript"></script
>
54 echo $script_tabs . $script_contr . $script_display_field;
58 <body onload
="Main()" class="general_body" id
="pmd_body">
60 <div
class="header" id
="top_menu">
61 <a href
="javascript:Show_left_menu(document.getElementById('key_Show_left_menu'));"
62 onmousedown
="return false;" class="M_butt first" target
="_self">
63 <img id
='key_Show_left_menu' title
="<?php echo __('Show/Hide left menu'); ?>"
64 alt
="v" src
="pmd/images/downarrow2_m.png" /></a
>
65 <a href
="javascript:Save2();" onmousedown
="return false;"
66 class="M_butt" target
="_self"
67 ><img title
="<?php echo __('Save position') ?>" src
="pmd/images/save.png" alt
=""
68 /></a
><a href
="javascript:Start_table_new();" onmousedown
="return false;"
69 class="M_butt" target
="_self"
70 ><img title
="<?php echo __('Create table')?>" src
="pmd/images/table.png" alt
=""
71 /></a
><a href
="javascript:Start_relation();" onmousedown
="return false;"
72 class="M_butt" id
="rel_button" target
="_self"
73 ><img title
="<?php echo __('Create relation') ?>" src
="pmd/images/relation.png" alt
=""
74 /></a
><a href
="javascript:Start_display_field();" onmousedown
="return false;"
75 class="M_butt" id
="display_field_button" target
="_self"
76 ><img title
="<?php echo __('Choose column to display') ?>" src
="pmd/images/display_field.png" alt
=""
77 /></a
><a href
="javascript:location.reload();" onmousedown
="return false;"
78 class="M_butt" target
="_self"
79 ><img title
="<?php echo __('Reload'); ?>" src
="pmd/images/reload.png" alt
=""
80 /></a
><a href
="javascript:Help();" onmousedown
="return false;"
81 class="M_butt" target
="_self"
82 ><img title
="<?php echo __('Help'); ?>" src
="pmd/images/help.png" alt
=""
83 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
84 /><a href
="javascript:Angular_direct();" onmousedown
="return false;"
85 class="M_butt" id
="angular_direct_button" target
="_self"
86 ><img title
="<?php echo __('Angular links') . ' / ' . __('Direct links'); ?>"
87 src
="pmd/images/ang_direct.png" alt
=""
88 /></a
><a href
="javascript:Grid();" onmousedown
="return false;"
89 class="M_butt" id
="grid_button" target
="_self"
90 ><img title
="<?php echo __('Snap to grid') ?>" src
="pmd/images/grid.png" alt
=""
91 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
92 /><a href
="javascript:Small_tab_all(document.getElementById('key_SB_all'));"
93 onmousedown
="return false;" class="M_butt" target
="_self"
94 ><img id
='key_SB_all' title
="<?php echo __('Small/Big All'); ?>" alt
="v"
95 src
="pmd/images/downarrow1.png"
96 /></a
><a href
="javascript:Small_tab_invert();" onmousedown
="return false;"
97 class="M_butt" target
="_self"
98 ><img title
="<?php echo __('Toggle small/big'); ?>" alt
="key" src
="pmd/images/bottom.png"
99 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
100 /><a href
="javascript:PDF_save();" onmousedown
="return false;"
101 class="M_butt" target
="_self"
102 ><img src
="pmd/images/pdf.png" alt
="key" width
="20" height
="20"
103 title
="<?php echo __('Import/Export coordinates for PDF schema'); ?>" /></a
>
104 <a href
="javascript:Top_menu_right(document.getElementById('key_Left_Right'));"
105 onmousedown
="return false;" class="M_butt last" target
="_self">
106 <img src
="pmd/images/2rightarrow_m.png" id
="key_Left_Right" alt
=">"
107 title
="<?php echo __('Move Menu'); ?>" /></a
>
111 <CANVAS id
="canvas" width
="100" height
="100" onclick
="Canvas_click(this)"></CANVAS
>
114 <form action
="" method
="post" name
="form1">
115 <div id
="layer_menu" style
="visibility:<?php echo $hidden ?>;">
116 <div align
="center" style
="padding-top:5px;">
117 <a href
="javascript:Hide_tab_all(document.getElementById('key_HS_all'));"
118 onmousedown
="return false;" class="M_butt" target
="_self">
119 <img title
="<?php echo __('Hide/Show all'); ?>" alt
="v"
120 src
="pmd/images/downarrow1.png" id
='key_HS_all' /></a
>
121 <a href
="javascript:No_have_constr(document.getElementById('key_HS'));"
122 onmousedown
="return false;" class="M_butt" target
="_self">
123 <img title
="<?php echo __('Hide/Show Tables with no relation'); ?>" alt
="v"
124 src
="pmd/images/downarrow2.png" id
='key_HS' /></a
>
127 <div id
="id_scroll_tab" class="scroll_tab">
128 <table width
="100%" style
="padding-left: 3px;">
130 $name_cnt = count($GLOBALS['PMD']['TABLE_NAME']);
131 for ($i = 0; $i < $name_cnt; $i++
) {
133 <tr
><td title
="<?php echo __('Structure'); ?>" width
="1px"
134 onmouseover
="this.className='L_butt2_2'"
135 onmouseout
="this.className='L_butt2_1'">
136 <img onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');"
137 src
="pmd/images/exec.png" alt
="" /></td
>
139 <input onclick
="VisibleTab(this,'<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>')"
140 title
="<?php echo __('Hide'); ?>"
141 id
="check_vis_<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>"
142 style
="margin:0px;" type
="checkbox"
143 value
="<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>"
145 if (isset($tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]])) {
146 echo $tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]]["H"] ?
'checked="checked"' : '';
148 echo 'checked="checked"';
151 <td
class="Tabs" onmouseover
="this.className='Tabs2'"
152 onmouseout
="this.className='Tabs'"
153 onclick
="Select_tab('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>');">
154 <?php
echo $GLOBALS['PMD_OUT']["TABLE_NAME"][$i]; ?
></td
>
163 <?php
echo __('Number of tables') . ': ' . $name_cnt; ?
>
166 <div id
="layer_menu_sizer" onmousedown
="layer_menu_cur_click=1">
171 for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++
) {
172 $t_n = $GLOBALS['PMD']["TABLE_NAME"][$i];
173 $t_n_url = $GLOBALS['PMD_URL']["TABLE_NAME"][$i];
176 <input name
="t_x[<?php echo $t_n_url ?>]" type
="hidden" id
="t_x_<?php echo $t_n_url ?>_" />
177 <input name
="t_y[<?php echo $t_n_url ?>]" type
="hidden" id
="t_y_<?php echo $t_n_url ?>_" />
178 <input name
="t_v[<?php echo $t_n_url ?>]" type
="hidden" id
="t_v_<?php echo $t_n_url ?>_" />
179 <input name
="t_h[<?php echo $t_n_url ?>]" type
="hidden" id
="t_h_<?php echo $t_n_url ?>_" />
181 <table id
="<?php echo $t_n_url ?>" cellpadding
="0" cellspacing
="0" class="tab"
182 style
="position: absolute;
183 left: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["X
"]; else echo rand(180, 800); ?>px;
184 top: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["Y
"]; else echo rand(30, 500); ?>px;
185 visibility: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["H
"] ? "visible
" : "hidden
"; ?>;
189 <td
class="small_tab" onmouseover
="this.className='small_tab2';"
190 onmouseout
="this.className='small_tab';"
191 id
="id_hide_tbody_<?php echo $t_n_url ?>"
192 onclick
="Small_tab('<?php echo $t_n_url ?>', 1)"><?php
193 // no space alloawd here, between tags and content !!!
194 // JavaScript function does require this
195 if (! isset($tab_pos[$t_n]) ||
! empty($tab_pos[$t_n]["V"])) {
201 <td
class="small_tab_pref" onmouseover
="this.className='small_tab_pref2';"
202 onmouseout
="this.className='small_tab_pref';"
203 onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');">
204 <img src
="pmd/images/exec_small.png" alt
="" /></td
>
205 <td nowrap
="nowrap" id
="id_zag_<?php echo $t_n_url ?>" class="tab_zag"
206 onmousedown
="cur_click=document.getElementById('<?php echo $t_n_url ?>');"
207 onmouseover
="this.className = 'tab_zag_2'"
208 onmouseout
="this.className = 'tab_zag'">
211 echo $GLOBALS['PMD_OUT']["OWNER"][$i];
213 echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i];
217 <tbody id
="id_tbody_<?php echo $t_n_url ?>"
218 <?php
if ( isset($tab_pos[$t_n])) echo 'style="display: none;"'; ?
>>
220 $display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
221 for ($j = 0, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $j++
) {
224 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i] . '.'
225 . urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j]) ?>"
227 if ($display_field == $tab_column[$t_n]["COLUMN_NAME"][$j]) {
228 echo ' class="tab_field_3" ';
230 echo ' class="tab_field" ';
233 onmouseover
="old_class = this.className; this.className = 'tab_field_2';"
234 onmouseout
="this.className = old_class;"
235 onmousedown
="Click_field('<?php
236 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]."','".urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j])."',";
237 if (! PMA_foreignkey_supported($GLOBALS['PMD
']['TABLE_TYPE
'][$i])) {
238 echo (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j]]) ? 1 : 0);
240 // if foreign keys are supported, it's not necessary that the
241 // index is a primary key
242 echo (isset($tables_all_keys[$t_n.".".$tab_column[$t_n]["COLUMN_NAME"][$j]]) ?
1 : 0);
245 <td width="10px
" colspan="3"
246 id="<?php
echo $t_n_url.".".urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?
>">
247 <div style="white
-space
:nowrap
">
249 if (isset($tables_pk_or_unique_keys[$t_n.".".$tab_column[$t_n]["COLUMN_NAME
"][$j]])) {
251 <img src="pmd
/styles
/<?php
echo $GLOBALS['PMD']['STYLE'];?
>/images
/FieldKey_small
.png
"
256 <img src="pmd
/styles
/<?php
echo $GLOBALS['PMD']['STYLE']?
>/images
/Field_small
<?php
257 if (strstr($tab_column[$t_n]["TYPE"][$j],'char')
258 ||
strstr($tab_column[$t_n]["TYPE"][$j],'text')) {
260 } elseif (strstr($tab_column[$t_n]["TYPE"][$j],'int')
261 ||
strstr($tab_column[$t_n]["TYPE"][$j],'float')
262 ||
strstr($tab_column[$t_n]["TYPE"][$j],'double')
263 ||
strstr($tab_column[$t_n]["TYPE"][$j],'decimal')) {
265 } elseif (strstr($tab_column[$t_n]["TYPE"][$j],'date')
266 ||
strstr($tab_column[$t_n]["TYPE"][$j],'time')
267 ||
strstr($tab_column[$t_n]["TYPE"][$j],'year')) {
273 echo htmlspecialchars($tab_column[$t_n]["COLUMN_NAME
"][$j]
274 . " : " . $tab_column[$t_n]["TYPE
"][$j], ENT_QUOTES);
288 <div id="hint
"></div>
289 <div id='layer_action' style="visibility
:<?php
echo $hidden ?
>;">Load...</div>
291 <table id="layer_new_relation
" style="visibility
:<?php
echo $hidden ?
>;"
292 width="5%
" border="0" cellpadding="0" cellspacing="0">
295 <td class="frams1
" width="10px
"></td>
296 <td class="frams5
" width="99%
" ></td>
297 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
300 <td class="frams8
"></td>
301 <td class="input_tab
">
302 <table width="168" border="0" align="center
" cellpadding="2" cellspacing="0">
305 <td colspan="2" align="center
" nowrap="nowrap
"><strong><?php echo __('Create relation'); ?></strong></td>
308 <tbody id="foreign_relation
">
310 <td colspan="2" align="center
" nowrap="nowrap
"><strong>FOREIGN KEY</strong></td>
313 <td width="58" nowrap="nowrap
">on delete</td>
314 <td width="102"><select name="on_delete
" id="on_delete
">
315 <option value="nix
" selected="selected
">--</option>
316 <option value="CASCADE
">CASCADE</option>
317 <option value="SET
NULL">SET NULL</option>
318 <option value="NO ACTION
">NO ACTION</option>
319 <option value="RESTRICT
">RESTRICT</option>
324 <td nowrap="nowrap
">on update</td>
325 <td><select name="on_update
" id="on_update
">
326 <option value="nix
" selected="selected
">--</option>
327 <option value="CASCADE
">CASCADE</option>
328 <option value="SET
NULL">SET NULL</option>
329 <option value="NO ACTION
">NO ACTION</option>
330 <option value="RESTRICT
">RESTRICT</option>
337 <td colspan="2" align="center
" nowrap="nowrap
">
338 <input type="button
" class="butt
" name="Button
"
339 value="<?php
echo __('OK'); ?
>" onclick="New_relation()" />
340 <input type="button
" class="butt
" name="Button
"
341 value="<?php
echo __('Cancel'); ?
>"
342 onclick="document
.getElementById('layer_new_relation').style
.visibility
= 'hidden';" />
348 <td class="frams6
"></td>
351 <td class="frams4
"><div class="bor
"></div></td>
352 <td class="frams7
"></td>
353 <td class="frams3
"></td>
358 <table id="layer_upd_relation
" style="visibility
:<?PHP
echo $hidden ?
>;"
359 width="5%
" border="0" cellpadding="0" cellspacing="0">
362 <td class="frams1
" width="10px
"></td>
363 <td class="frams5
" width="99%
"></td>
364 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
367 <td class="frams8
"></td>
368 <td class="input_tab
">
369 <table width="100%
" border="0" align="center
" cellpadding="2" cellspacing="0">
371 <td colspan="3" align="center
" nowrap="nowrap
"><strong><?php echo __('Delete relation'); ?></strong></td>
374 <td colspan="3" align="center
" nowrap="nowrap
">
375 <input name="Button
" type="button
" class="butt
"
376 onclick="Upd_relation()" value="<?php
echo __('Delete'); ?
>" />
377 <input type="button
" class="butt
" name="Button
"
378 value="<?php
echo __('Cancel'); ?
>"
379 onclick="document
.getElementById('layer_upd_relation').style
.visibility
= 'hidden'; Re_load();" />
383 <td class="frams6
"></td>
386 <td class="frams4
"><div class="bor
"></div></td>
387 <td class="frams7
"></td>
388 <td class="frams3
"></td>
392 <!-- cache images -->
393 <img src="pmd
/images
/2leftarrow_m
.png
" width="0" height="0" alt="" />
394 <img src="pmd
/images
/rightarrow1
.png
" width="0" height="0" alt="" />
395 <img src="pmd
/images
/rightarrow2
.png
" width="0" height="0" alt="" />
396 <img src="pmd
/images
/uparrow2_m
.png
" width="0" height="0" alt="" />