2 /* vim: set expandtab sw=4 ts=4 sts=4: */
5 * @package phpMyAdmin-Designer
11 require_once "./pmd_common.php";
13 $tab_column = get_tab_info();
14 $script_tabs = get_script_tabs();
15 $script_contr = get_script_contr();
16 $tab_pos = get_tab_pos();
17 $tables_pk_or_unique_keys = get_pk_or_unique_keys();
18 $tables_all_keys = get_all_keys();
22 <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
23 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
24 <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']; ?>">
26 <meta http
-equiv
="Content-Type" content
="text/html; charset=<?php echo $charset ?>" />
27 <link rel
="icon" href
="pmd/images/favicon.ico" type
="image/x-icon" />
28 <link rel
="shortcut icon" href
="pmd/images/favicon.ico" type
="image/x-icon" />
29 <link rel
="stylesheet" type
="text/css" href
="pmd/styles/<?php echo $GLOBALS['PMD']['STYLE'] ?>/style1.css" />
30 <title
>Designer
</title
>
31 <script type
="text/javascript">
35 var server = "' . PMA_escapeJsString($server) . '";
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["strForeignKeyRelationAdded"] = "' . PMA_escapeJsString($strForeignKeyRelationAdded). '";
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 $name_cnt = count($GLOBALS['PMD']['TABLE_NAME']);
140 for ($i = 0; $i < $name_cnt; $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 . ': ' . $name_cnt; ?
>
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, $id_cnt = count($tab_column[$t_n]["COLUMN_ID"]); $j < $id_cnt; $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 (! PMA_foreignkey_supported($GLOBALS['PMD
']['TABLE_TYPE
'][$i])) {
247 echo (isset($tables_pk_or_unique_keys[$t_n . "." . $tab_column[$t_n]["COLUMN_NAME"][$j]]) ? 1 : 0);
249 // if foreign keys are supported, 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
"><strong><?php echo $strCreateRelation; ?></strong></td>
317 <tbody id="foreign_relation
">
319 <td colspan="2" align="center
" nowrap="nowrap
"><strong>FOREIGN KEY</strong></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
"><strong><?php echo $strDeleteRelation; ?></strong></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="" />