3 // vim: expandtab sw=4 ts=4 sts=4:
7 <!-- Set on key handler
for moving using by Ctrl+arrows
-->
8 <script type
="text/javascript" language
="javascript">
10 document
.onkeydown
= onKeyDownArrowsHandler
;
14 <form method
="post" action
="<?php echo $action; ?>">
16 echo PMA_generate_common_hidden_inputs($db, $table);
17 if ($action == 'tbl_create.php3') {
19 <input type
="hidden" name
="reload" value
="1" />
22 else if ($action == 'tbl_addfield.php3') {
25 <input type
="hidden" name
="after_field" value
="<?php echo $after_field; ?>" />
29 $is_backup = ($action != 'tbl_create.php3' && $action != 'tbl_addfield.php3');
32 <table border
="<?php echo $cfg['Border']; ?>">
34 <th
><?php
echo $strField; ?
></th
>
35 <th
><?php
echo $strType . '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types'); ?
></span
></th
>
36 <th
><?php
echo $strLengthSet; ?
></th
>
37 <th
><?php
echo $strAttr; ?
></th
>
38 <th
><?php
echo $strNull; ?
></th
>
39 <th
><?php
echo $strDefault; ?
>**</th
>
40 <th
><?php
echo $strExtra; ?
></th
>
42 // lem9: We could remove this 'if' and let the key information be shown and
43 // editable. However, for this to work, tbl_alter must be modified to use the
44 // key fields, as tbl_addfield does.
47 echo " <th>$strPrimary</th>\n";
48 echo " <th>$strIndex</th>\n";
49 echo " <th>$strUnique</th>\n";
50 echo " <th>---</th>\n";
51 echo " <th>$strIdxFulltext</th>\n";
57 for ($i = 0 ; $i < $num_fields; $i++
) {
58 if (isset($fields_meta)) {
59 $row = $fields_meta[$i];
61 $bgcolor = ($i %
2) ?
$cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
64 <td bgcolor
="<?php echo $bgcolor; ?>">
69 <input type
="hidden" name
="field_orig[]" value
="<?php if (isset($row) && isset($row['Field'])) echo urlencode($row['Field']); ?>" />
74 <input id
="field_<?php echo $i; ?>_1" type
="text" name
="field_name[]" size
="10" maxlength
="64" value
="<?php if (isset($row) && isset($row['Field'])) echo str_replace('"', '"
;', $row['Field
']); ?>" class="textfield" />
76 <td bgcolor="<?php echo $bgcolor; ?>">
77 <select name="field_type[]" id="field_<?php echo $i; ?>_2">
80 if (empty($row['Type
'])) {
84 else if (get_magic_quotes_gpc()) {
85 $type = stripslashes($row['Type
']);
90 // set or enum types: slashes single quotes inside options
91 if (eregi('^
(set|enum
)\
((.+
)\
)$
', $type, $tmp)) {
93 $length = substr(ereg_replace('([^
,])\'\'', '\\
1\\\'', ',' . $tmp[2]), 1);
95 $type = eregi_replace('BINARY
', '', $type);
96 $type = eregi_replace('ZEROFILL
', '', $type);
97 $type = eregi_replace('UNSIGNED
', '', $type);
100 $type = chop(eregi_replace('\\
(.*\\)', '', $type));
102 $length = eregi_replace("^$type\(", '', $length);
103 $length = eregi_replace('\
)$
', '', trim($length));
105 if ($length == $type) {
110 for ($j = 0; $j < count($cfg['ColumnTypes
']); $j++) {
111 echo ' <option value
="'. $cfg['ColumnTypes'][$j] . '"';
112 if (strtoupper($type) == strtoupper($cfg['ColumnTypes
'][$j])) {
113 echo ' selected
="selected"';
115 echo '>' . $cfg['ColumnTypes
'][$j] . '</option
>' . "\n";
120 <td bgcolor="<?php echo $bgcolor; ?>">
125 <input type="hidden" name="field_length_orig[]" value="<?php echo urlencode($length); ?>" />
130 <input id="field_<?php echo $i; ?>_3" type="text" name="field_length[]" size="8" value="<?php echo str_replace('"', '"', $length); ?>" class="textfield" />
132 <td bgcolor
="<?php echo $bgcolor; ?>">
133 <select name
="field_attribute[]" id
="field_<?php echo $i; ?>_4">
136 if (eregi('^(set|enum)$', $type)) {
141 $binary = eregi('BINARY', $row['Type'], $test_attribute1);
142 $unsigned = eregi('UNSIGNED', $row['Type'], $test_attribute2);
143 $zerofill = eregi('ZEROFILL', $row['Type'], $test_attribute3);
147 $strAttribute = 'BINARY';
150 $strAttribute = 'UNSIGNED';
153 $strAttribute = 'UNSIGNED ZEROFILL';
155 for ($j = 0;$j < count($cfg['AttributeTypes']); $j++
) {
156 echo ' <option value="'. $cfg['AttributeTypes'][$j] . '"';
157 if (strtoupper($strAttribute) == strtoupper($cfg['AttributeTypes'][$j])) {
158 echo ' selected="selected"';
160 echo '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n";
165 <td bgcolor
="<?php echo $bgcolor; ?>">
166 <select name
="field_null[]" id
="field_<?php echo $i; ?>_5">
168 if (!isset($row) ||
empty($row['Null'])) {
171 <option value
="NOT NULL">not
null</option
>
172 <option value
="">null</option
>
177 <option value
="">null</option
>
178 <option value
="NOT NULL">not
null</option
>
187 && !isset($row['Default']) && !empty($row['Null'])) {
188 $row['Default'] = 'NULL';
192 <td bgcolor
="<?php echo $bgcolor; ?>">
197 <input type
="hidden" name
="field_default_orig[]" size
="8" value
="<?php if(isset($row) && isset($row['Default'])) echo urlencode($row['Default']); ?>" />
202 <input id
="field_<?php echo $i; ?>_6" type
="text" name
="field_default[]" size
="8" value
="<?php if(isset($row) && isset($row['Default'])) echo str_replace('"', '"
;', $row['Default']); ?>" class="textfield" />
204 <td bgcolor="<?php echo $bgcolor; ?>">
205 <select name="field_extra[]" id="field_<?php echo $i; ?>_7">
207 if(!isset($row) || empty($row['Extra
'])) {
210 <option value=""></option>
211 <option value="AUTO_INCREMENT">auto_increment</option>
216 <option value="AUTO_INCREMENT">auto_increment</option>
217 <option value=""></option>
225 // lem9: See my other comment about removing this 'if'.
227 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'PRI
') {
228 $checked_primary = ' checked
="checked"';
230 $checked_primary = '';
232 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'MUL
') {
233 $checked_index = ' checked
="checked"';
237 if (isset($row) && isset($row['Key
']) && $row['Key
'] == 'UNI
') {
238 $checked_unique = ' checked
="checked"';
240 $checked_unique = '';
242 if (empty($checked_primary)
243 && empty($checked_index)
244 && empty($checked_unique)) {
245 $checked_none = ' checked
="checked"';
247 if (PMA_MYSQL_INT_VERSION >= 32323
248 &&(isset($row) && isset($row['Comment
']) && $row['Comment
'] == 'FULLTEXT
')) {
249 $checked_fulltext = ' checked
="checked"';
251 $checked_fulltext = '';
255 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
256 <input type="radio" name="field_key_<?php echo $i; ?>" value="primary_<?php echo $i; ?>"<?php echo $checked_primary; ?> />
258 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
259 <input type="radio" name="field_key_<?php echo $i; ?>" value="index_<?php echo $i; ?>"<?php echo $checked_index; ?> />
261 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
262 <input type="radio" name="field_key_<?php echo $i; ?>" value="unique_<?php echo $i; ?>"<?php echo $checked_unique; ?> />
264 <td align="center" bgcolor="<?php echo $bgcolor; ?>">
265 <input type="radio" name="field_key_<?php echo $i; ?>" value="none_<?php echo $i; ?>"<?php echo $checked_none; ?> />
268 if (PMA_MYSQL_INT_VERSION >= 32323) {
271 <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
272 <input type="checkbox" name="field_fulltext[]" value="<?php echo $i; ?>"<?php echo $checked_fulltext; ?> />
275 } // end if (PMA_MYSQL_INT_VERSION >= 32323)
277 } // end if ($action ==...)
289 if ($action == 'tbl_create
.php3
' && PMA_MYSQL_INT_VERSION >= 32300) {
294 <td><?php echo $strTableComments; ?> :</td>
296 if ($action == 'tbl_create
.php3
') {
299 <td width="25"> </td>
300 <td><?php echo $strTableType; ?> :</td>
308 <input type="text" name="comment" size="40" maxlength="80" class="textfield" />
311 // BEGIN - Table Type - 2 May 2001 - Robbat2
312 // change by staybyte - 11 June 2001
313 if ($action == 'tbl_create
.php3
') {
314 // find mysql capability - staybyte - 11. June 2001
315 $query = 'SHOW VARIABLES LIKE \'have_%\'
';
316 $result = PMA_mysql_query($query);
317 if ($result != FALSE && mysql_num_rows($result) > 0) {
318 while ($tmp = PMA_mysql_fetch_array($result)) {
319 if (isset($tmp['Variable_name
'])) {
320 switch ($tmp['Variable_name
']) {
322 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
327 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
332 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
337 if (isset($tmp['Variable_name
']) && $tmp['Value
'] == 'YES
') {
345 mysql_free_result($result);
349 <td width="25"> </td>
351 <select name="tbl_type">
352 <option value="Default"><?php echo $strDefault; ?></option>
353 <option value="MYISAM">MyISAM</option>
354 <option value="HEAP">Heap</option>
355 <option value="MERGE">Merge</option>
356 <?php if (isset($tbl_bdb)) { ?><option value="BDB">Berkeley DB</option><?php } ?>
357 <?php if (isset($tbl_gemini)) { ?><option value="GEMINI">Gemini</option><?php } ?>
358 <?php if (isset($tbl_innodb)) { ?><option value="InnoDB">INNO DB</option><?php } ?>
359 <?php if (isset($tbl_isam)) { ?><option value="ISAM">ISAM</option><?php } ?>
372 // END - Table Type - 2 May 2001 - Robbat2
375 <input type="submit" name="submit" value="<?php echo $strSave; ?>" />
380 <td valign="top">* </td>
382 <?php echo $strSetEnumVal . "\n"; ?>
386 <td valign="top">** </td>
388 <?php echo $strDefaultValueHelp . "\n"; ?>
394 <center><?php echo PMA_showMySQLDocu('Reference
', 'CREATE_TABLE
'); ?></center>