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 db = "' . PMA_escapeJsString($db) . '";
37 var token = "' . PMA_escapeJsString($token) . '";
38 var LangSelectReferencedKey = "' . PMA_escapeJsString($strSelectReferencedKey) . '";
39 var LangSelectForeignKey = "' . PMA_escapeJsString($strSelectForeignKey) . '";
40 var LangPleaseSelectPrimaryOrUniqueKey = "' . PMA_escapeJsString($strPleaseSelectPrimaryOrUniqueKey) . '";
41 var LangIEnotSupport = "' . PMA_escapeJsString($strIEUnsupported) . '";
42 var LangChangeDisplay = "' . PMA_escapeJsString($strChangeDisplay) . '";
44 var strLang = Array();
45 strLang["strModifications"] = "' . PMA_escapeJsString($strModifications) . '";
46 strLang["strRelationDeleted"] = "' . PMA_escapeJsString($strRelationDeleted) . '";
47 strLang["strInnoDBRelationAdded"] = "' . PMA_escapeJsString($strInnoDBRelationAdded). '";
48 strLang["strGeneralRelationFeat:strDisabled"] = "' . PMA_escapeJsString($strGeneralRelationFeat . ' : ' . $strDisabled) . '";
49 strLang["strInternalRelationAdded"] = "' . PMA_escapeJsString($strInternalRelationAdded) . '";
50 strLang["strErrorRelationAdded"] = "' . PMA_escapeJsString($strErrorRelationAdded) . '";
51 strLang["strErrorRelationExists"] = "' . PMA_escapeJsString($strErrorRelationExists) . '";
52 strLang["strErrorSaveTable"] = "' . PMA_escapeJsString($strErrorSaveTable) . '";';
57 <script src
="pmd/scripts/ajax.js" type
="text/javascript"></script
>
58 <script src
="pmd/scripts/move.js" type
="text/javascript"></script
>
60 <script src
="pmd/scripts/iecanvas.js" type
="text/javascript"></script
>
63 echo $script_tabs . $script_contr . $script_display_field;
67 <body onload
="Main()" class="general_body" id
="pmd_body">
69 <div
class="header" id
="top_menu">
70 <a href
="javascript:Show_left_menu(document.getElementById('key_Show_left_menu'));"
71 onmousedown
="return false;" class="M_butt first" target
="_self">
72 <img id
='key_Show_left_menu' title
="<?php echo $strShowHideLeftMenu; ?>"
73 alt
="v" src
="pmd/images/downarrow2_m.png" /></a
>
74 <a href
="javascript:Save2();" onmousedown
="return false;"
75 class="M_butt" target
="_self"
76 ><img title
="<?php echo $strSavePosition ?>" src
="pmd/images/save.png" alt
=""
77 /></a
><a href
="javascript:Start_table_new();" onmousedown
="return false;"
78 class="M_butt" target
="_self"
79 ><img title
="<?php echo $strCreateTable ?>" src
="pmd/images/table.png" alt
=""
80 /></a
><a href
="javascript:Start_relation();" onmousedown
="return false;"
81 class="M_butt" id
="rel_button" target
="_self"
82 ><img title
="<?php echo $strCreateRelation ?>" src
="pmd/images/relation.png" alt
=""
83 /></a
><a href
="javascript:Start_display_field();" onmousedown
="return false;"
84 class="M_butt" id
="display_field_button" target
="_self"
85 ><img title
="<?php echo $strChangeDisplay ?>" src
="pmd/images/display_field.png" alt
=""
86 /></a
><a href
="javascript:location.reload();" onmousedown
="return false;"
87 class="M_butt" target
="_self"
88 ><img title
="<?php echo $strReload; ?>" src
="pmd/images/reload.png" alt
=""
89 /></a
><a href
="javascript:Help();" onmousedown
="return false;"
90 class="M_butt" target
="_self"
91 ><img title
="<?php echo $strHelp; ?>" src
="pmd/images/help.png" alt
=""
92 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
93 /><a href
="javascript:Angular_direct();" onmousedown
="return false;"
94 class="M_butt" id
="angular_direct_button" target
="_self"
95 ><img title
="<?php echo $strAngularLinks . ' / ' . $strDirectLinks; ?>"
96 src
="pmd/images/ang_direct.png" alt
=""
97 /></a
><a href
="javascript:Grid();" onmousedown
="return false;"
98 class="M_butt" id
="grid_button" target
="_self"
99 ><img title
="<?php echo $strSnapToGrid ?>" src
="pmd/images/grid.png" alt
=""
100 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
101 /><a href
="javascript:Small_tab_all(document.getElementById('key_SB_all'));"
102 onmousedown
="return false;" class="M_butt" target
="_self"
103 ><img id
='key_SB_all' title
="<?php echo $strSmallBigAll; ?>" alt
="v"
104 src
="pmd/images/downarrow1.png"
105 /></a
><a href
="javascript:Small_tab_invert();" onmousedown
="return false;"
106 class="M_butt" target
="_self"
107 ><img title
="<?php echo $strToggleSmallBig; ?>" alt
="key" src
="pmd/images/bottom.png"
108 /></a
><img
class="M_bord" src
="pmd/images/bord.png" alt
=""
109 /><a href
="javascript:PDF_save();" onmousedown
="return false;"
110 class="M_butt" target
="_self"
111 ><img src
="pmd/images/pdf.png" alt
="key" width
="20" height
="20"
112 title
="<?php echo $strImportExportCoords; ?>" /></a
>
113 <a href
="javascript:Top_menu_right(document.getElementById('key_Left_Right'));"
114 onmousedown
="return false;" class="M_butt last" target
="_self">
115 <img src
="pmd/images/2rightarrow_m.png" id
="key_Left_Right" alt
=">"
116 title
="<?php echo $strMoveMenu; ?>" /></a
>
120 <CANVAS id
="canvas" width
="100" height
="100" onclick
="Canvas_click(this)"></CANVAS
>
123 <form action
="" method
="post" name
="form1">
124 <div id
="layer_menu" style
="visibility:<?php echo $hidden ?>;">
125 <div align
="center" style
="padding-top:5px;">
126 <a href
="javascript:Hide_tab_all(document.getElementById('key_HS_all'));"
127 onmousedown
="return false;" class="M_butt" target
="_self">
128 <img title
="<?php echo $strHideShowAll; ?>" alt
="v"
129 src
="pmd/images/downarrow1.png" id
='key_HS_all' /></a
>
130 <a href
="javascript:No_have_constr(document.getElementById('key_HS'));"
131 onmousedown
="return false;" class="M_butt" target
="_self">
132 <img title
="<?php echo $strHideShowNoRelation; ?>" alt
="v"
133 src
="pmd/images/downarrow2.png" id
='key_HS' /></a
>
136 <div id
="id_scroll_tab" class="scroll_tab">
137 <table width
="100%" style
="padding-left: 3px;">
139 for ($i = 0; $i < count($GLOBALS['PMD']['TABLE_NAME']); $i++
) {
141 <tr
><td title
="<?php echo $strStructure; ?>" width
="1px"
142 onmouseover
="this.className='L_butt2_2'"
143 onmouseout
="this.className='L_butt2_1'">
144 <img onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');"
145 src
="pmd/images/exec.png" alt
="" /></td
>
147 <input onclick
="VisibleTab(this,'<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>')"
148 title
="<?php echo $strHide ?>"
149 id
="check_vis_<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>"
150 style
="margin:0px;" type
="checkbox"
151 value
="<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>"
153 if (isset($tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]])) {
154 echo $tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]]["H"] ?
'checked="checked"' : '';
156 echo 'checked="checked"';
159 <td
class="Tabs" onmouseover
="this.className='Tabs2'"
160 onmouseout
="this.className='Tabs'"
161 onclick
="Select_tab('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME
"][$i]; ?>');">
162 <?php
echo $GLOBALS['PMD_OUT']["TABLE_NAME"][$i]; ?
></td
>
171 <?php
echo $strNumberOfTables ?
>: <?php
echo count($GLOBALS['PMD']['TABLE_NAME']) ?
>
174 <div id
="layer_menu_sizer" onmousedown
="layer_menu_cur_click=1">
179 for ($i = 0; $i < count($GLOBALS['PMD']["TABLE_NAME"]); $i++
) {
180 $t_n = $GLOBALS['PMD']["TABLE_NAME"][$i];
181 $t_n_url = $GLOBALS['PMD_URL']["TABLE_NAME"][$i];
184 <input name
="t_x[<?php echo $t_n_url ?>]" type
="hidden" id
="t_x_<?php echo $t_n_url ?>_" />
185 <input name
="t_y[<?php echo $t_n_url ?>]" type
="hidden" id
="t_y_<?php echo $t_n_url ?>_" />
186 <input name
="t_v[<?php echo $t_n_url ?>]" type
="hidden" id
="t_v_<?php echo $t_n_url ?>_" />
187 <input name
="t_h[<?php echo $t_n_url ?>]" type
="hidden" id
="t_h_<?php echo $t_n_url ?>_" />
189 <table id
="<?php echo $t_n_url ?>" cellpadding
="0" cellspacing
="0" class="tab"
190 style
="position: absolute;
191 left: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["X
"]; else echo rand(180, 800); ?>px;
192 top: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["Y
"]; else echo rand(30, 500); ?>px;
193 visibility: <?php if (isset($tab_pos[$t_n])) echo $tab_pos[$t_n]["H
"] ? "visible
" : "hidden
"; ?>;
197 <td
class="small_tab" onmouseover
="this.className='small_tab2';"
198 onmouseout
="this.className='small_tab';"
199 id
="id_hide_tbody_<?php echo $t_n_url ?>"
200 onclick
="Small_tab('<?php echo $t_n_url ?>', 1)"><?php
201 // no space alloawd here, between tags and content !!!
202 // JavaScript function does require this
203 if (! isset($tab_pos[$t_n]) ||
! empty($tab_pos[$t_n]["V"])) {
209 <td
class="small_tab_pref" onmouseover
="this.className='small_tab_pref2';"
210 onmouseout
="this.className='small_tab_pref';"
211 onclick
="Start_tab_upd('<?php echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]; ?>');">
212 <img src
="pmd/images/exec_small.png" alt
="" /></td
>
213 <td nowrap
="nowrap" id
="id_zag_<?php echo $t_n_url ?>" class="tab_zag"
214 onmousedown
="cur_click=document.getElementById('<?php echo $t_n_url ?>');"
215 onmouseover
="this.className = 'tab_zag_2'"
216 onmouseout
="this.className = 'tab_zag'">
219 echo $GLOBALS['PMD_OUT']["OWNER"][$i];
221 echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i];
225 <tbody id
="id_tbody_<?php echo $t_n_url ?>"
226 <?php
if (! isset($tab_pos[$t_n])) echo 'style="display: none;"'; ?
>>
228 $display_field = PMA_getDisplayField($db, $GLOBALS['PMD']["TABLE_NAME_SMALL"][$i]);
229 for ($j = 0; $j < count($tab_column[$t_n]["COLUMN_ID"]); $j++
) {
232 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i] . '.'
233 . urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j]) ?>"
235 if ($display_field == $tab_column[$t_n]["COLUMN_NAME"][$j]) {
236 echo ' class="tab_field_3" ';
238 echo ' class="tab_field" ';
241 onmouseover
="old_class = this.className; this.className = 'tab_field_2';"
242 onmouseout
="this.className = old_class;"
243 onmousedown
="Click_field('<?php
244 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL
"][$i]."','".urlencode($tab_column[$t_n]["COLUMN_NAME
"][$j])."',";
245 if ($GLOBALS['PMD
']['TABLE_TYPE
'][$i] != 'INNODB
') {
246 echo (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j]]) ? 1 : 0);
248 // if this is an InnoDB table, it's not necessary that the
249 // index is a primary key
250 echo (isset($tables_all_keys[$t_n.".".$tab_column[$t_n]["COLUMN_NAME"][$j]]) ?
1 : 0);
253 <td width="10px
" colspan="3"
254 id="<?php
echo $t_n_url.".".urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?
>">
255 <div style="white
-space
:nowrap
">
257 if (isset($tables_pk_or_unique_keys[$t_n.".".$tab_column[$t_n]["COLUMN_NAME
"][$j]])) {
259 <img src="pmd
/styles
/<?php
echo $GLOBALS['PMD']['STYLE'];?
>/images
/FieldKey_small
.png
"
264 <img src="pmd
/styles
/<?php
echo $GLOBALS['PMD']['STYLE']?
>/images
/Field_small
<?php
265 if (strstr($tab_column[$t_n]["TYPE"][$j],'char')
266 ||
strstr($tab_column[$t_n]["TYPE"][$j],'text')) {
268 } elseif (strstr($tab_column[$t_n]["TYPE"][$j],'int')
269 ||
strstr($tab_column[$t_n]["TYPE"][$j],'float')
270 ||
strstr($tab_column[$t_n]["TYPE"][$j],'double')
271 ||
strstr($tab_column[$t_n]["TYPE"][$j],'decimal')) {
273 } elseif (strstr($tab_column[$t_n]["TYPE"][$j],'date')
274 ||
strstr($tab_column[$t_n]["TYPE"][$j],'time')
275 ||
strstr($tab_column[$t_n]["TYPE"][$j],'year')) {
281 echo htmlspecialchars($tab_column[$t_n]["COLUMN_NAME
"][$j]
282 . " : " . $tab_column[$t_n]["TYPE
"][$j], ENT_QUOTES);
296 <div id="hint
"></div>
297 <div id='layer_action' style="visibility
:<?php
echo $hidden ?
>;">Load...</div>
299 <table id="layer_new_relation
" style="visibility
:<?php
echo $hidden ?
>;"
300 width="5%
" border="0" cellpadding="0" cellspacing="0">
303 <td class="frams1
" width="10px
"></td>
304 <td class="frams5
" width="99%
" ></td>
305 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
308 <td class="frams8
"></td>
309 <td class="input_tab
">
310 <table width="168" border="0" align="center
" cellpadding="2" cellspacing="0">
313 <td colspan="2" align="center
" nowrap="nowrap
"><b><?php echo $strCreateRelation; ?></b></td>
316 <tbody id="InnoDB_relation
">
318 <td colspan="2" align="center
" nowrap="nowrap
"><b>InnoDB</b></td>
321 <td width="58" nowrap="nowrap
">on delete</td>
322 <td width="102"><select name="on_delete
" id="on_delete
">
323 <option value="nix
" selected="selected
">--</option>
324 <option value="CASCADE
">CASCADE</option>
325 <option value="SET
NULL">SET NULL</option>
326 <option value="NO ACTION
">NO ACTION</option>
327 <option value="RESTRICT
">RESTRICT</option>
332 <td nowrap="nowrap
">on update</td>
333 <td><select name="on_update
" id="on_update
">
334 <option value="nix
" selected="selected
">--</option>
335 <option value="CASCADE
">CASCADE</option>
336 <option value="SET
NULL">SET NULL</option>
337 <option value="NO ACTION
">NO ACTION</option>
338 <option value="RESTRICT
">RESTRICT</option>
345 <td colspan="2" align="center
" nowrap="nowrap
">
346 <input type="button
" class="butt
" name="Button
"
347 value="<?php
echo $strOK; ?
>" onclick="New_relation()" />
348 <input type="button
" class="butt
" name="Button
"
349 value="<?php
echo $strCancel; ?
>"
350 onclick="document
.getElementById('layer_new_relation').style
.visibility
= 'hidden';" />
356 <td class="frams6
"></td>
359 <td class="frams4
"><div class="bor
"></div></td>
360 <td class="frams7
"></td>
361 <td class="frams3
"></td>
366 <table id="layer_upd_relation
" style="visibility
:<?PHP
echo $hidden ?
>;"
367 width="5%
" border="0" cellpadding="0" cellspacing="0">
370 <td class="frams1
" width="10px
"></td>
371 <td class="frams5
" width="99%
"></td>
372 <td class="frams2
" width="10px
"><div class="bor
"></div></td>
375 <td class="frams8
"></td>
376 <td class="input_tab
">
377 <table width="100%
" border="0" align="center
" cellpadding="2" cellspacing="0">
379 <td colspan="3" align="center
" nowrap="nowrap
"><b><?php echo $strDeleteRelation; ?></b></td>
382 <td colspan="3" align="center
" nowrap="nowrap
">
383 <input name="Button
" type="button
" class="butt
"
384 onclick="Upd_relation()" value="<?php
echo $strDelete; ?
>" />
385 <input type="button
" class="butt
" name="Button
"
386 value="<?php
echo $strCancel; ?
>"
387 onclick="document
.getElementById('layer_upd_relation').style
.visibility
= 'hidden'; Re_load();" />
391 <td class="frams6
"></td>
394 <td class="frams4
"><div class="bor
"></div></td>
395 <td class="frams7
"></td>
396 <td class="frams3
"></td>
400 <!-- cache images -->
401 <img src="pmd
/images
/2leftarrow_m
.png
" width="0" height="0" alt="" />
402 <img src="pmd
/images
/rightarrow1
.png
" width="0" height="0" alt="" />
403 <img src="pmd
/images
/rightarrow2
.png
" width="0" height="0" alt="" />
404 <img src="pmd
/images
/uparrow2_m
.png
" width="0" height="0" alt="" />