Calendar layout improvements.
[openemr.git] / phpmyadmin / pmd_general.php
blob366f5dd9afe7fabc86213878dcb6e7bd3da91ccc
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @author Ivan A Kirillov (Ivan.A.Kirillov@gmail.com)
5 * @version $Id$
6 * @package phpMyAdmin-Designer
7 */
9 /**
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();
20 $hidden = "hidden";
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']; ?>">
26 <head>
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">
33 // <![CDATA[
34 <?php
35 echo '
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) . '";';
56 // ]]>
57 </script>
58 <script src="pmd/scripts/ajax.js" type="text/javascript"></script>
59 <script src="pmd/scripts/move.js" type="text/javascript"></script>
60 <!--[if IE]>
61 <script src="pmd/scripts/iecanvas.js" type="text/javascript"></script>
62 <![endif]-->
63 <?php
64 echo $script_tabs . $script_contr . $script_display_field;
67 </head>
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>
118 </div>
120 <div id="osn_tab">
121 <CANVAS id="canvas" width="100" height="100" onclick="Canvas_click(this)"></CANVAS>
122 </div>
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>
135 </div>
137 <div id="id_scroll_tab" class="scroll_tab">
138 <table width="100%" style="padding-left: 3px;">
139 <?php
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>
147 <td width="1px">
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]; ?>"
153 <?php
154 if (isset($tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]])) {
155 echo $tab_pos[$GLOBALS['PMD']["TABLE_NAME"][$i]]["H"] ? 'checked="checked"' : '';
156 } else {
157 echo 'checked="checked"';
159 ?> /></td>
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>
164 </tr>
165 <?php
168 </table>
169 </div>
171 <div align="center">
172 <?php echo $strNumberOfTables ?>: <?php echo count($GLOBALS['PMD']['TABLE_NAME']) ?>
173 </div>
174 <div align="right">
175 <div id="layer_menu_sizer" onmousedown="layer_menu_cur_click=1">
176 </div>
177 </div>
178 </div>
179 <?php
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"; ?>;
196 <thead>
197 <tr>
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"])) {
205 echo 'v';
206 } else {
207 echo '&gt;';
209 ?></td>
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'">
218 <span class='owner'>
219 <?php
220 echo $GLOBALS['PMD_OUT']["OWNER"][$i];
221 echo '.</span>';
222 echo $GLOBALS['PMD_OUT']["TABLE_NAME_SMALL"][$i];
223 ?></td>
224 </tr>
225 </thead>
226 <tbody id="id_tbody_<?php echo $t_n_url ?>"
227 <?php if (! isset($tab_pos[$t_n])) echo 'style="display: none;"'; ?>>
228 <?php
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++) {
232 <tr id="id_tr_<?php
233 echo $GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i] . '.'
234 . urlencode($tab_column[$t_n]["COLUMN_NAME"][$j]) ?>"
235 <?php
236 if ($display_field == $tab_column[$t_n]["COLUMN_NAME"][$j]) {
237 echo ' class="tab_field_3" ';
238 } else {
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);
248 } else {
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);
253 ?>)">
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">
257 <?php
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"
261 alt="*" />
262 <?php
263 } else {
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')) {
268 echo '_char';
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')) {
273 echo '_int';
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')) {
277 echo '_date';
279 ?>.png" alt="*" />
280 <?php
282 echo htmlspecialchars($tab_column[$t_n]["COLUMN_NAME"][$j]
283 . " : " . $tab_column[$t_n]["TYPE"][$j], ENT_QUOTES);
285 </div>
286 </td>
287 </tr>
288 <?php
291 </tbody>
292 </table>
293 <?php
296 </form>
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">
302 <tbody>
303 <tr>
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>
307 </tr>
308 <tr>
309 <td class="frams8"></td>
310 <td class="input_tab">
311 <table width="168" border="0" align="center" cellpadding="2" cellspacing="0">
312 <thead>
313 <tr>
314 <td colspan="2" align="center" nowrap="nowrap"><b><?php echo $strCreateRelation; ?></b></td>
315 </tr>
316 </thead>
317 <tbody id="InnoDB_relation">
318 <tr>
319 <td colspan="2" align="center" nowrap="nowrap"><b>InnoDB</b></td>
320 </tr>
321 <tr>
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>
329 </select>
330 </td>
331 </tr>
332 <tr>
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>
340 </select>
341 </td>
342 </tr>
343 </tbody>
344 <tbody>
345 <tr>
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';" />
352 </td>
353 </tr>
354 </tbody>
355 </table>
356 </td>
357 <td class="frams6"></td>
358 </tr>
359 <tr>
360 <td class="frams4"><div class="bor"></div></td>
361 <td class="frams7"></td>
362 <td class="frams3"></td>
363 </tr>
364 </tbody>
365 </table>
367 <table id="layer_upd_relation" style="visibility:<?PHP echo $hidden ?>;"
368 width="5%" border="0" cellpadding="0" cellspacing="0">
369 <tbody>
370 <tr>
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>
374 </tr>
375 <tr>
376 <td class="frams8"></td>
377 <td class="input_tab">
378 <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
379 <tr>
380 <td colspan="3" align="center" nowrap="nowrap"><b><?php echo $strDeleteRelation; ?></b></td>
381 </tr>
382 <tr>
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();" />
389 </td>
390 </tr>
391 </table></td>
392 <td class="frams6"></td>
393 </tr>
394 <tr>
395 <td class="frams4"><div class="bor"></div></td>
396 <td class="frams7"></td>
397 <td class="frams3"></td>
398 </tr>
399 </tbody>
400 </table>
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="" />
406 </body>
407 </html>