2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * @author Ivan A Kirillov (Ivan.A.Kirillov@gmail.com)
6 * @package phpMyAdmin-Designer
12 require_once "./pmd_common.php";
14 $tab_column = get_tab_info();
15 $script_tabs = get_script_tabs();
16 $script_contr = get_script_contr();
17 $tab_pos = get_tab_pos();
18 $tables_pk_or_unique_keys = get_pk_or_unique_keys();
19 $tables_all_keys = get_all_keys();
23 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
24 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
25 <html xmlns
:v
="urn:schemas-microsoft-com:vml" xmlns
="http://www.w3.org/1999/xhtml" xml
:lang
="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" lang
="<?php echo $GLOBALS['available_languages'][$GLOBALS['lang']][2]; ?>" dir
="<?php echo $GLOBALS['text_dir']; ?>">
27 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset ?>" />
28 <link rel
="icon" href
="pmd/images/favicon.ico" type
="image/x-icon" />
29 <link rel
="shortcut icon" href
="pmd/images/favicon.ico" type
="image/x-icon" />
30 <link rel
="stylesheet" type
="text/css" href
="pmd/styles/<?php echo $GLOBALS['PMD']['STYLE'] ?>/style1.css" />
31 <title
>Designer
</title
>
32 <script type
="text/javascript">
36 var server = "' . PMA_escapeJsString($server) . '";
37 var db = "' . PMA_escapeJsString($db) . '";
38 var token = "' . PMA_escapeJsString($token) . '";
39 var LangSelectReferencedKey = "' . PMA_escapeJsString($strSelectReferencedKey) . '";
40 var LangSelectForeignKey = "' . PMA_escapeJsString($strSelectForeignKey) . '";
41 var LangPleaseSelectPrimaryOrUniqueKey = "' . PMA_escapeJsString($strPleaseSelectPrimaryOrUniqueKey) . '";
42 var LangIEnotSupport = "' . PMA_escapeJsString($strIEUnsupported) . '";
43 var LangChangeDisplay = "' . PMA_escapeJsString($strChangeDisplay) . '";
45 var strLang = Array();
46 strLang["strModifications"] = "' . PMA_escapeJsString($strModifications) . '";
47 strLang["strRelationDeleted"] = "' . PMA_escapeJsString($strRelationDeleted) . '";
48 strLang["strInnoDBRelationAdded"] = "' . PMA_escapeJsString($strInnoDBRelationAdded). '";
49 strLang["strGeneralRelationFeat:strDisabled"] = "' . PMA_escapeJsString($strGeneralRelationFeat . ' : ' . $strDisabled) . '";
50 strLang["strInternalRelationAdded"] = "' . PMA_escapeJsString($strInternalRelationAdded) . '";
51 strLang["strErrorRelationAdded"] = "' . PMA_escapeJsString($strErrorRelationAdded) . '";
52 strLang["strErrorRelationExists"] = "' . PMA_escapeJsString($strErrorRelationExists) . '";
53 strLang["strErrorSaveTable"] = "' . PMA_escapeJsString($strErrorSaveTable) . '";';
58 <script src
="pmd/scripts/ajax.js" type
="text/javascript"></script
>
59 <script src
="pmd/scripts/move.js" type
="text/javascript"></script
>
61 <script src
="pmd/scripts/iecanvas.js" type
="text/javascript"></script
>
64 echo $script_tabs . $script_contr . $script_display_field;
68 <body onload
="Main()" class="general_body" id
="pmd_body">
70 <div
class="header" id
="top_menu">
71 <a href
="javascript:Show_left_menu(document.getElementById('key_Show_left_menu'));"
72 onmousedown
="return false;" class="M_butt first" target
="_self">
73 <img id
='key_Show_left_menu' title
="<?php echo $strShowHideLeftMenu; ?>"
74 alt
="v" src
="pmd/images/downarrow2_m.png" /></a
>
75 <a href
="javascript:Save2();" onmousedown
="return false;"
76 class="M_butt" target
="_self"
77 ><img title
="<?php echo $strSavePosition ?>" src
="pmd/images/save.png" alt
=""
78 /></a
><a href
="javascript:Start_table_new();" onmousedown
="return false;"
79 class="M_butt" target
="_self"
80 ><img title
="<?php echo $strCreateTable ?>" src
="pmd/images/table.png" alt
=""
81 /></a
><a href
="javascript:Start_relation();" onmousedown
="return false;"
82 class="M_butt" id
="rel_button" target
="_self"
83 ><img title
="<?php echo $strCreateRelation ?>" src
="pmd/images/relation.png" alt
=""
84 /></a
><a href
="javascript:Start_display_field();" onmousedown
="return false;"
85 class="M_butt" id
="display_field_button" target
="_self"
86 ><img title
="<?php echo $strChangeDisplay ?>" src
="pmd/images/display_field.png" alt
=""
87 /></a
><a href
="javascript:location.reload();" onmousedown
="return false;"
88 class="M_butt" target
="_self"
89 ><img title
="<?php echo $strReload; ?>" src
="pmd/images/reload.png" alt
=""
90 /></a
><a href
="javascript:Help();" onmousedown
="return false;"
91 class="M_butt" target
="_self"
92 ><img title
="<?php echo $strHelp; ?>" src
="pmd/images/help.png" alt
=""
93 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
94 /><a href
="javascript:Angular_direct();" onmousedown
="return false;"
95 class="M_butt" id
="angular_direct_button" target
="_self"
96 ><img title
="<?php echo $strAngularLinks . ' / ' . $strDirectLinks; ?>"
97 src
="pmd/images/ang_direct.png" alt
=""
98 /></a
><a href
="javascript:Grid();" onmousedown
="return false;"
99 class="M_butt" id
="grid_button" target
="_self"
100 ><img title
="<?php echo $strSnapToGrid ?>" src
="pmd/images/grid.png" alt
=""
101 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
102 /><a href
="javascript:Small_tab_all(document.getElementById('key_SB_all'));"
103 onmousedown
="return false;" class="M_butt" target
="_self"
104 ><img id
='key_SB_all' title
="<?php echo $strSmallBigAll; ?>" alt
="v"
105 src
="pmd/images/downarrow1.png"
106 /></a
><a href
="javascript:Small_tab_invert();" onmousedown
="return false;"
107 class="M_butt" target
="_self"
108 ><img title
="<?php echo $strToggleSmallBig; ?>" alt
="key" src
="pmd/images/bottom.png"
109 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
110 /><a href
="javascript:PDF_save();" onmousedown
="return false;"
111 class="M_butt" target
="_self"
112 ><img src
="pmd/images/pdf.png" alt
="key" width
="20" height
="20"
113 title
="<?php echo $strImportExportCoords; ?>" /></a
>
114 <a href
="javascript:Top_menu_right(document.getElementById('key_Left_Right'));"
115 onmousedown
="return false;" class="M_butt last" target
="_self">
116 <img src
="pmd/images/2rightarrow_m.png" id
="key_Left_Right" alt
=">"
117 title
="<?php echo $strMoveMenu; ?>" /></a
>
121 <CANVAS id
="canvas" width
="100" height
="100" onclick
="Canvas_click(this)"></CANVAS
>
124 <form action
="" method
="post" name
="form1">
125 <div id
="layer_menu" style
="visibility:<?php echo $hidden ?>;">
126 <div align
="center" style
="padding-top:5px;">
127 <a href
="javascript:Hide_tab_all(document.getElementById('key_HS_all'));"
128 onmousedown
="return false;" class="M_butt" target
="_self">
129 <img title
="<?php echo $strHideShowAll; ?>" alt
="v"
130 src
="pmd/images/downarrow1.png" id
='key_HS_all' /></a
>
131 <a href
="javascript:No_have_constr(document.getElementById('key_HS'));"
132 onmousedown
="return false;" class="M_butt" target
="_self">
133 <img title
="<?php echo $strHideShowNoRelation; ?>" alt
="v"
134 src
="pmd/images/downarrow2.png" id
='key_HS' /></a
>
137 <div id
="id_scroll_tab" class="scroll_tab">
138 <table width
="100%" style
="padding-left: 3px;">
140 for ($i = 0; $i < count($GLOBALS['PMD']['TABLE_NAME']); $i++
) {
142 <tr
><td title
="<?php echo $strStructure; ?>" width
="1px"
143 onmouseover
="this.className='L_butt2_2'"
144 onmouseout
="this.className='L_butt2_1'">
145 <img onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');"
146 src
="pmd/images/exec.png" alt
="" /></td
>
148 <input onclick
="VisibleTab(this,'<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>')"
149 title
="<?php echo $strHide ?>"
150 id
="check_vis_<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>"
151 style
="margin:0px;" type
="checkbox"
152 value
="<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>"
154 if (isset($tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]])) {
155 echo $tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]]["H"] ?
'checked="checked"' : '';
157 echo 'checked="checked"';
160 <td
class="Tabs" onmouseover
="this.className='Tabs2'"
161 onmouseout
="this.className='Tabs'"
162 onclick
="Select_tab('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>');">
163 <?php
echo $GLOBALS['PMD_OUT']["TABLE_NAME"][$i]; ?
></td
>
172 <?php
echo $strNumberOfTables ?
>: <?php
echo count($GLOBALS['PMD']['TABLE_NAME']) ?
>
175 <div id
="layer_menu_sizer" onmousedown
="layer_menu_cur_click=1">
180 for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++
) {
181 $t_n = $GLOBALS['PMD']["TABLE_NAME"][$i];
182 $t_n_url = $GLOBALS['PMD_URL']["TABLE_NAME"][$i];
185 <input name
="t_x[<?php echo $t_n_url ?>]" type
="hidden" id
="t_x_<?php echo $t_n_url ?>_" />
186 <input name
="t_y[<?php echo $t_n_url ?>]" type
="hidden" id
="t_y_<?php echo $t_n_url ?>_" />
187 <input name
="t_v[<?php echo $t_n_url ?>]" type
="hidden" id
="t_v_<?php echo $t_n_url ?>_" />
188 <input name
="t_h[<?php echo $t_n_url ?>]" type
="hidden" id
="t_h_<?php echo $t_n_url ?>_" />
190 <table id
="<?php echo $t_n_url ?>" cellpadding
="0" cellspacing
="0" class="tab"
191 style
="position: absolute;
192 left: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["X
"]; else echo rand(180, 800); ?>px;
193 top: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["Y
"]; else echo rand(30, 500); ?>px;
194 visibility: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["H
"] ? "visible
" : "hidden
"; ?>;
198 <td
class="small_tab" onmouseover
="this.className='small_tab2';"
199 onmouseout
="this.className='small_tab';"
200 id
="id_hide_tbody_<?php echo $t_n_url ?>"
201 onclick
="Small_tab('<?php echo $t_n_url ?>', 1)"><?php
202 // no space alloawd here, between tags and content !!!
203 // JavaScript function does require this
204 if (! isset($tab_pos[$t_n]) ||
! empty($tab_pos[$t_n]["V"])) {
210 <td
class="small_tab_pref" onmouseover
="this.className='small_tab_pref2';"
211 onmouseout
="this.className='small_tab_pref';"
212 onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');">
213 <img src
="pmd/images/exec_small.png" alt
="" /></td
>
214 <td nowrap
="nowrap" id
="id_zag_<?php echo $t_n_url ?>" class="tab_zag"
215 onmousedown
="cur_click=document.getElementById('<?php echo $t_n_url ?>');"
216 onmouseover
="this.className = 'tab_zag_2'"
217 onmouseout
="this.className = 'tab_zag'">
220 echo $GLOBALS['PMD_OUT']["OWNER"][$i];
222 echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i];
226 <tbody id
="id_tbody_<?php echo $t_n_url ?>"
227 <?php
if (! isset($tab_pos[$t_n])) echo 'style="display: none;"'; ?
>>
229 $display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
230 for ($j = 0; $j < count($tab_column[$t_n]["COLUMN_ID"]); $j++
) {
233 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i] . '.'
234 . urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j]) ?>"
236 if ($display_field == $tab_column[$t_n]["COLUMN_NAME"][$j]) {
237 echo ' class="tab_field_3" ';
239 echo ' class="tab_field" ';
242 onmouseover
="old_class = this.className; this.className = 'tab_field_2';"
243 onmouseout
="this.className = old_class;"
244 onmousedown
="Click_field('<?php
245 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]."','".urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j])."',";
246 if ($GLOBALS['PMD
']['TABLE_TYPE
'][$i] != 'INNODB
') {
247 echo (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j]]) ? 1 : 0);
249 // if this is an InnoDB table, it's not necessary that the
250 // index is a primary key
251 echo (isset($tables_all_keys[$t_n.".".$tab_column[$t_n]["COLUMN_NAME"][$j]]) ?
1 : 0);
254 <td width="10px
" colspan="3"
255 id="<?php
echo $t_n_url.".".urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?
>">
256 <div style="white
-space
:nowrap
">
258 if (isset($tables_pk_or_unique_keys[$t_n.".".$tab_column[$t_n]["COLUMN_NAME
"][$j]])) {
260 <img src="pmd
/styles
/<?php
echo $GLOBALS['PMD']['STYLE'];?
>/images
/FieldKey_small
.png
"
265 <img src="pmd
/styles
/<?php
echo $GLOBALS['PMD']['STYLE']?
>/images
/Field_small
<?php
266 if (strstr($tab_column[$t_n]["TYPE"][$j],'char')
267 ||
strstr($tab_column[$t_n]["TYPE"][$j],'text')) {
269 } elseif (strstr($tab_column[$t_n]["TYPE"][$j],'int')
270 ||
strstr($tab_column[$t_n]["TYPE"][$j],'float')
271 ||
strstr($tab_column[$t_n]["TYPE"][$j],'double')
272 ||
strstr($tab_column[$t_n]["TYPE"][$j],'decimal')) {
274 } elseif (strstr($tab_column[$t_n]["TYPE"][$j],'date')
275 ||
strstr($tab_column[$t_n]["TYPE"][$j],'time')
276 ||
strstr($tab_column[$t_n]["TYPE"][$j],'year')) {
282 echo htmlspecialchars($tab_column[$t_n]["COLUMN_NAME
"][$j]
283 . " : " . $tab_column[$t_n]["TYPE
"][$j], ENT_QUOTES);
297 <div id="hint
"></div>
298 <div id='layer_action' style="visibility
:<?php
echo $hidden ?
>;">Load...</div>
300 <table id="layer_new_relation
" style="visibility
:<?php
echo $hidden ?
>;"
301 width="5%
" border="0" cellpadding="0" cellspacing="0">
304 <td class="frams1
" width="10px
"></td>
305 <td class="frams5
" width="99%
" ></td>
306 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
309 <td class="frams8
"></td>
310 <td class="input_tab
">
311 <table width="168" border="0" align="center
" cellpadding="2" cellspacing="0">
314 <td colspan="2" align="center
" nowrap="nowrap
"><b><?php echo $strCreateRelation; ?></b></td>
317 <tbody id="InnoDB_relation
">
319 <td colspan="2" align="center
" nowrap="nowrap
"><b>InnoDB</b></td>
322 <td width="58" nowrap="nowrap
">on delete</td>
323 <td width="102"><select name="on_delete
" id="on_delete
">
324 <option value="nix
" selected="selected
">--</option>
325 <option value="CASCADE
">CASCADE</option>
326 <option value="SET
NULL">SET NULL</option>
327 <option value="NO ACTION
">NO ACTION</option>
328 <option value="RESTRICT
">RESTRICT</option>
333 <td nowrap="nowrap
">on update</td>
334 <td><select name="on_update
" id="on_update
">
335 <option value="nix
" selected="selected
">--</option>
336 <option value="CASCADE
">CASCADE</option>
337 <option value="SET
NULL">SET NULL</option>
338 <option value="NO ACTION
">NO ACTION</option>
339 <option value="RESTRICT
">RESTRICT</option>
346 <td colspan="2" align="center
" nowrap="nowrap
">
347 <input type="button
" class="butt
" name="Button
"
348 value="<?php
echo $strOK; ?
>" onclick="New_relation()" />
349 <input type="button
" class="butt
" name="Button
"
350 value="<?php
echo $strCancel; ?
>"
351 onclick="document
.getElementById('layer_new_relation').style
.visibility
= 'hidden';" />
357 <td class="frams6
"></td>
360 <td class="frams4
"><div class="bor
"></div></td>
361 <td class="frams7
"></td>
362 <td class="frams3
"></td>
367 <table id="layer_upd_relation
" style="visibility
:<?PHP
echo $hidden ?
>;"
368 width="5%
" border="0" cellpadding="0" cellspacing="0">
371 <td class="frams1
" width="10px
"></td>
372 <td class="frams5
" width="99%
"></td>
373 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
376 <td class="frams8
"></td>
377 <td class="input_tab
">
378 <table width="100%
" border="0" align="center
" cellpadding="2" cellspacing="0">
380 <td colspan="3" align="center
" nowrap="nowrap
"><b><?php echo $strDeleteRelation; ?></b></td>
383 <td colspan="3" align="center
" nowrap="nowrap
">
384 <input name="Button
" type="button
" class="butt
"
385 onclick="Upd_relation()" value="<?php
echo $strDelete; ?
>" />
386 <input type="button
" class="butt
" name="Button
"
387 value="<?php
echo $strCancel; ?
>"
388 onclick="document
.getElementById('layer_upd_relation').style
.visibility
= 'hidden'; Re_load();" />
392 <td class="frams6
"></td>
395 <td class="frams4
"><div class="bor
"></div></td>
396 <td class="frams7
"></td>
397 <td class="frams3
"></td>
401 <!-- cache images -->
402 <img src="pmd
/images
/2leftarrow_m
.png
" width="0" height="0" alt="" />
403 <img src="pmd
/images
/rightarrow1
.png
" width="0" height="0" alt="" />
404 <img src="pmd
/images
/rightarrow2
.png
" width="0" height="0" alt="" />
405 <img src="pmd
/images
/uparrow2_m
.png
" width="0" height="0" alt="" />