Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: tbl_properties.inc.php,v 2.38 2005/07/23 12:14:39 lem9 Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 // Check parameters 00005 00006 require_once('./libraries/common.lib.php'); 00007 PMA_checkParameters(array('db','table','action','num_fields')); 00008 00009 00010 // Get available character sets and storage engines 00011 require_once('./libraries/mysql_charsets.lib.php'); 00012 require_once('./libraries/storage_engines.lib.php'); 00013 00014 ?> 00015 <?php if ($cfg['CtrlArrowsMoving']) { ?> 00016 <!-- Set on key handler for moving using by Ctrl+arrows --> 00017 <script src="libraries/keyhandler.js" type="text/javascript" language="javascript"></script> 00018 <script type="text/javascript" language="javascript"> 00019 <!-- 00020 var switch_movement = <?php echo $cfg['DefaultPropDisplay'] == 'horizontal' ? '0' : '1'; ?>; 00021 document.onkeydown = onKeyDownArrowsHandler; 00022 // --> 00023 </script> 00024 <?php } 00025 // here, the div_x_7 represents a div id which contains 00026 // the default CURRENT TIMESTAMP checkbox and label 00027 // and, field_x_7a represents the checkbox itself 00028 00029 if (PMA_MYSQL_INT_VERSION >= 40102) { ?> 00030 <script type="text/javascript" language="javascript"> 00031 <!-- 00032 function display_field_options(field_type, i) { 00033 if (field_type == 'TIMESTAMP') { 00034 getElement('div_' + i + '_7').style.display = 'block'; 00035 } else { 00036 getElement('div_' + i + '_7').style.display = 'none'; 00037 getElement('field_' + i + '_7a').checked = false; 00038 } 00039 return true; 00040 } 00041 // --> 00042 </script> 00043 <?php } ?> 00044 00045 <form method="post" action="<?php echo $action; ?>" onsubmit="return checkTableEditForm(this, <?php echo $num_fields; ?>)" > 00046 <?php 00047 echo PMA_generate_common_hidden_inputs($db, $table); 00048 if ($action == 'tbl_create.php') { 00049 ?> 00050 <input type="hidden" name="reload" value="1" /> 00051 <?php 00052 } 00053 else if ($action == 'tbl_addfield.php') { 00054 echo "\n"; 00055 ?> 00056 <input type="hidden" name="field_where" value="<?php echo $field_where; ?>" /> 00057 <input type="hidden" name="after_field" value="<?php echo $after_field; ?>" /> 00058 <?php 00059 } 00060 echo "\n"; 00061 00062 if (isset($num_fields)) { 00063 ?> 00064 <input type="hidden" name="orig_num_fields" value="<?php echo $num_fields; ?>" /> 00065 <?php 00066 } 00067 00068 if (isset($field_where)) { 00069 ?> 00070 <input type="hidden" name="orig_field_where" value="<?php echo $field_where; ?>" /> 00071 <?php 00072 } 00073 00074 if (isset($after_field)) { 00075 ?> 00076 <input type="hidden" name="orig_after_field" value="<?php echo $after_field; ?>" /> 00077 <?php 00078 } 00079 00080 if (isset($selected) && is_array($selected)) { 00081 foreach ($selected AS $o_fld_nr => $o_fld_val) { 00082 ?> 00083 <input type="hidden" name="selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> 00084 <?php 00085 if (!isset($true_selected)) { 00086 ?> 00087 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> 00088 <?php 00089 } 00090 00091 } 00092 00093 if (isset($true_selected) && is_array($true_selected)) { 00094 foreach ($true_selected AS $o_fld_nr => $o_fld_val) { 00095 ?> 00096 <input type="hidden" name="true_selected[<?php echo $o_fld_nr; ?>]" value="<?php echo urlencode($o_fld_val); ?>" /> 00097 <?php 00098 } 00099 } 00100 00101 } elseif (isset($field)) { 00102 ?> 00103 <input type="hidden" name="orig_field" value="<?php echo urlencode($field); ?>" /> 00104 <input type="hidden" name="true_selected[] value="<?php echo (isset($orig_field) ? $orig_field : urlencode($field)); ?>" /> 00105 <?php 00106 } 00107 00108 $is_backup = ($action != 'tbl_create.php' && $action != 'tbl_addfield.php'); 00109 00110 $header_cells = array(); 00111 $content_cells = array(); 00112 00113 $header_cells[] = $strField; 00114 $header_cells[] = $strType . ($GLOBALS['cfg']['ReplaceHelpImg'] ? PMA_showMySQLDocu('Reference', 'Column_types') : '<br /><span style="font-weight: normal">' . PMA_showMySQLDocu('Reference', 'Column_types') . '</span>'); 00115 $header_cells[] = $strLengthSet; 00116 if (PMA_MYSQL_INT_VERSION >= 40100) { 00117 $header_cells[] = $strCollation; 00118 } 00119 $header_cells[] = $strAttr; 00120 $header_cells[] = $strNull; 00121 $header_cells[] = $strDefault . '**'; 00122 $header_cells[] = $strExtra; 00123 00124 00125 00126 // lem9: We could remove this 'if' and let the key information be shown and 00127 // editable. However, for this to work, tbl_alter must be modified to use the 00128 // key fields, as tbl_addfield does. 00129 00130 if (!$is_backup) { 00131 $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_primary.png" width="16" height="16" alt="' . $strPrimary . '" title="' . $strPrimary . '" />' : $strPrimary; 00132 $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_index.png" width="16" height="16" alt="' . $strIndex . '" title="' . $strIndex . '" />' : $strIndex; 00133 $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_unique.png" width="16" height="16" alt="' . $strUnique . '" title="' . $strUnique . '" />' : $strUnique; 00134 $header_cells[] = '---'; 00135 $header_cells[] = $cfg['PropertiesIconic'] ? '<img src="' . $pmaThemeImage . 'b_ftext.png" width="16" height="16" alt="' . $strIdxFulltext . '" title="' . $strIdxFulltext . '" />' : $strIdxFulltext; 00136 } 00137 00138 require_once('./libraries/relation.lib.php'); 00139 require_once('./libraries/transformations.lib.php'); 00140 $cfgRelation = PMA_getRelationsParam(); 00141 00142 $comments_map = array(); 00143 $mime_map = array(); 00144 $available_mime = array(); 00145 00146 if ($cfgRelation['commwork']) { 00147 $comments_map = PMA_getComments($db, $table); 00148 $header_cells[] = $strComments; 00149 00150 if ($cfgRelation['mimework'] && $cfg['BrowseMIME']) { 00151 $mime_map = PMA_getMIME($db, $table); 00152 $available_mime = PMA_getAvailableMIMEtypes(); 00153 00154 $header_cells[] = $strMIME_MIMEtype; 00155 $header_cells[] = $strMIME_transformation; 00156 $header_cells[] = $strMIME_transformation_options . '***'; 00157 } 00158 } 00159 00160 // garvin: workaround for field_fulltext, because its submitted indizes contain 00161 // the index as a value, not a key. Inserted here for easier maintaineance 00162 // and less code to change in existing files. 00163 if (isset($field_fulltext) && is_array($field_fulltext)) { 00164 foreach ($field_fulltext AS $fulltext_nr => $fulltext_indexkey) { 00165 $submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey; 00166 } 00167 } 00168 00169 for ($i = 0 ; $i < $num_fields; $i++) { 00170 $submit_null = FALSE; 00171 if (isset($regenerate) && $regenerate == TRUE) { 00172 // An error happened with previous inputs, so we will restore the data 00173 // to embed it once again in this form. 00174 00175 $row['Field'] = (isset($field_name) && isset($field_name[$i]) ? $field_name[$i] : FALSE); 00176 $row['Type'] = (isset($field_type) && isset($field_type[$i]) ? $field_type[$i] : FALSE); 00177 $row['Null'] = (isset($field_null) && isset($field_null[$i]) ? $field_null[$i] : ''); 00178 if (isset($field_type[$i]) && $row['Null'] == '') { 00179 $submit_null = TRUE; 00180 } 00181 00182 if (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'primary_' . $i) { 00183 $row['Key'] = 'PRI'; 00184 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'index_' . $i) { 00185 $row['Key'] = 'MUL'; 00186 } elseif (isset(${'field_key_' . $i}) && ${'field_key_' . $i} == 'unique_' . $i) { 00187 $row['Key'] = 'UNI'; 00188 } else { 00189 $row['Key'] = ''; 00190 } 00191 00192 $row['Default'] = (isset($field_default) && isset($field_default[$i]) ? $field_default[$i] : FALSE); 00193 $row['Extra'] = (isset($field_extra) && isset($field_extra[$i]) ? $field_extra[$i] : FALSE); 00194 $row['Comment'] = (isset($submit_fulltext) && isset($submit_fulltext[$i]) && ($submit_fulltext[$i] == $i) ? 'FULLTEXT' : FALSE); 00195 00196 $submit_length = (isset($field_length) && isset($field_length[$i]) ? $field_length[$i] : FALSE); 00197 $submit_attribute = (isset($field_attribute) && isset($field_attribute[$i]) ? $field_attribute[$i] : FALSE); 00198 00199 $submit_default_current_timestamp = (isset($field_default_current_timestamp) && isset($field_default_current_timestamp[$i]) ? TRUE : FALSE); 00200 00201 if (isset($field_comments) && isset($field_comments[$i])) { 00202 $comments_map[$row['Field']] = $field_comments[$i]; 00203 } 00204 00205 if (isset($field_mimetype) && isset($field_mimetype[$i])) { 00206 $mime_map[$row['Field']]['mimetype'] = $field_mimetype[$i]; 00207 } 00208 00209 if (isset($field_transformation) && isset($field_transformation[$i])) { 00210 $mime_map[$row['Field']]['transformation'] = $field_transformation[$i]; 00211 } 00212 00213 if (isset($field_transformation_options) && isset($field_transformation_options[$i])) { 00214 $mime_map[$row['Field']]['transformation_options'] = $field_transformation_options[$i]; 00215 } 00216 00217 } elseif (isset($fields_meta)) { 00218 $row = $fields_meta[$i]; 00219 } 00220 00221 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; 00222 00223 // Cell index: If certain fields get left out, the counter shouldn't chage. 00224 $ci = 0; 00225 // Everytime a cell shall be left out the STRG-jumping feature, $ci_offset 00226 // has to be incremented ($ci_offset++) 00227 $ci_offset = -1; 00228 00229 if ($is_backup) { 00230 $backup_field = (isset($true_selected) && $true_selected[$i] ? $true_selected[$i] : (isset($row) && isset($row['Field']) ? urlencode($row['Field']) : '')); 00231 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_orig[]" value="' . $backup_field . '" />' . "\n"; 00232 } else { 00233 $content_cells[$i][$ci] = ''; 00234 } 00235 00236 $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_name[]" size="10" maxlength="64" value="' . (isset($row) && isset($row['Field']) ? str_replace('"', '"', $row['Field']) : '') . '" class="textfield" title="' . $strField . '" />'; 00237 $ci++; 00238 $content_cells[$i][$ci] = '<select name="field_type[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '" '; 00239 if (PMA_MYSQL_INT_VERSION >= 40102) { 00240 $content_cells[$i][$ci] .= 'onchange="display_field_options(this.options[this.selectedIndex].value,' . $i .')" '; 00241 } 00242 $content_cells[$i][$ci] .= '>' . "\n"; 00243 00244 if (empty($row['Type'])) { 00245 $row['Type'] = ''; 00246 $type = ''; 00247 } 00248 else { 00249 $type = $row['Type']; 00250 } 00251 // set or enum types: slashes single quotes inside options 00252 if (preg_match('@^(set|enum)\((.+)\)$@i', $type, $tmp)) { 00253 $type = $tmp[1]; 00254 $length = substr(preg_replace('@([^,])\'\'@', '\\1\\\'', ',' . $tmp[2]), 1); 00255 } else { 00256 // strip the "BINARY" attribute, except if we find "BINARY(" because 00257 // this would be a BINARY or VARBINARY field type 00258 $type = preg_replace('@BINARY([^\(])@i', '', $type); 00259 $type = preg_replace('@ZEROFILL@i', '', $type); 00260 $type = preg_replace('@UNSIGNED@i', '', $type); 00261 00262 if (strpos($type, '(')) { 00263 $length = chop(substr($type, (strpos($type, '(') + 1), (strpos($type, ')') - strpos($type, '(') - 1))); 00264 $type = chop(substr($type, 0, strpos($type, '('))); 00265 } else { 00266 $length = ''; 00267 } 00268 } // end if else 00269 00270 // some types, for example longtext, are reported as 00271 // "longtext character set latin7" when their charset and / or collation 00272 // differs from the ones of the corresponding database. 00273 if (PMA_MYSQL_INT_VERSION >= 40100) { 00274 $tmp = strpos($type, 'character set'); 00275 if ($tmp) { 00276 $type = substr($type, 0, $tmp-1); 00277 } 00278 } 00279 00280 if (isset($submit_length) && $submit_length != FALSE) { 00281 $length = $submit_length; 00282 } 00283 00284 // rtrim the type, for cases like "float unsigned" 00285 $type = rtrim($type); 00286 $type_upper = strtoupper($type); 00287 00288 $cnt_column_types = count($cfg['ColumnTypes']); 00289 for ($j = 0; $j < $cnt_column_types; $j++) { 00290 $content_cells[$i][$ci] .= ' <option value="'. $cfg['ColumnTypes'][$j] . '"'; 00291 if ($type_upper == strtoupper($cfg['ColumnTypes'][$j])) { 00292 $content_cells[$i][$ci] .= ' selected="selected"'; 00293 } 00294 $content_cells[$i][$ci] .= '>' . $cfg['ColumnTypes'][$j] . '</option>' . "\n"; 00295 } // end for 00296 00297 $content_cells[$i][$ci] .= ' </select>'; 00298 $ci++; 00299 00300 if ($is_backup) { 00301 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_length_orig[]" value="' . urlencode($length) . '" />'; 00302 } else { 00303 $content_cells[$i][$ci] = ''; 00304 } 00305 00306 if (preg_match('@^(set|enum)$@i', $type)) { 00307 $binary = 0; 00308 $unsigned = 0; 00309 $zerofill = 0; 00310 $length_to_display = htmlspecialchars($length); 00311 } else { 00312 $length_to_display = $length; 00313 if (!preg_match('@BINARY[\(]@i', $row['Type']) && PMA_MYSQL_INT_VERSION < 40100) { 00314 $binary = stristr($row['Type'], 'binary'); 00315 } else { 00316 $binary = FALSE; 00317 } 00318 $unsigned = stristr($row['Type'], 'unsigned'); 00319 $zerofill = stristr($row['Type'], 'zerofill'); 00320 } 00321 00322 $content_cells[$i][$ci] .= "\n" . '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_length[]" size="8" value="' . str_replace('"', '"', $length_to_display) . '" class="textfield" />' . "\n"; 00323 $ci++; 00324 00325 if (PMA_MYSQL_INT_VERSION >= 40100) { 00326 $tmp_collation = empty($row['Collation']) ? NULL : $row['Collation']; 00327 $content_cells[$i][$ci] = PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'field_collation[]', 'field_' . $i . '_' . ($ci - $ci_offset), $tmp_collation, FALSE); 00328 unset($tmp_collation); 00329 $ci++; 00330 } 00331 00332 $content_cells[$i][$ci] = '<select style="font-size: ' . $font_smallest . ';" name="field_attribute[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">' . "\n"; 00333 00334 $attribute = ''; 00335 if ($binary) { 00336 $attribute = 'BINARY'; 00337 } 00338 if ($unsigned) { 00339 $attribute = 'UNSIGNED'; 00340 } 00341 if ($zerofill) { 00342 $attribute = 'UNSIGNED ZEROFILL'; 00343 } 00344 00345 if (isset($submit_attribute) && $submit_attribute != FALSE) { 00346 $attribute = $submit_attribute; 00347 } 00348 00349 // here, we have a TIMESTAMP that SHOW FULL FIELDS reports as having the 00350 // NULL attribute, but SHOW CREATE TABLE says the contrary. Believe 00351 // the latter. 00352 if (isset($row['Field']) && isset($analyzed_sql[0]) && $analyzed_sql[0]['create_table_fields'][$row['Field']]['type'] == 'TIMESTAMP' && $analyzed_sql[0]['create_table_fields'][$row['Field']]['timestamp_not_null'] == TRUE) { 00353 $row['Null'] = ''; 00354 } 00355 00356 00357 // MySQL 4.1.2+ TIMESTAMP options 00358 // (if on_update_current_timestamp is set, then it's TRUE) 00359 if (isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['on_update_current_timestamp'])) { 00360 $attribute = 'ON UPDATE CURRENT_TIMESTAMP'; 00361 } 00362 if ((isset($row['Field']) && isset($analyzed_sql[0]['create_table_fields'][$row['Field']]['default_current_timestamp'])) 00363 || (isset($submit_default_current_timestamp) && $submit_default_current_timestamp) ) { 00364 $default_current_timestamp = TRUE; 00365 } else { 00366 $default_current_timestamp = FALSE; 00367 } 00368 00369 // Dynamically add ON UPDATE CURRENT_TIMESTAMP to the possible attributes 00370 if (PMA_MYSQL_INT_VERSION >= 40102 && !in_array('ON UPDATE CURRENT_TIMESTAMP', $cfg['AttributeTypes'])) { 00371 $cfg['AttributeTypes'][] = 'ON UPDATE CURRENT_TIMESTAMP'; 00372 } 00373 00374 00375 $cnt_attribute_types = count($cfg['AttributeTypes']); 00376 for ($j = 0;$j < $cnt_attribute_types; $j++) { 00377 if (PMA_MYSQL_INT_VERSION >= 40100 && $cfg['AttributeTypes'][$j] == 'BINARY') { 00378 continue; 00379 } 00380 $content_cells[$i][$ci] .= ' <option value="'. $cfg['AttributeTypes'][$j] . '"'; 00381 if (strtoupper($attribute) == strtoupper($cfg['AttributeTypes'][$j])) { 00382 $content_cells[$i][$ci] .= ' selected="selected"'; 00383 } 00384 $content_cells[$i][$ci] .= '>' . $cfg['AttributeTypes'][$j] . '</option>' . "\n"; 00385 } 00386 00387 $content_cells[$i][$ci] .= '</select>'; 00388 $ci++; 00389 00390 $content_cells[$i][$ci] = '<select name="field_null[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">'; 00391 00392 if ((!isset($row) || empty($row['Null']) || $row['Null'] == 'NO' || $row['Null'] == 'NOT NULL') && $submit_null == FALSE) { 00393 $content_cells[$i][$ci] .= "\n"; 00394 $content_cells[$i][$ci] .= ' <option value="NOT NULL" selected="selected" >not null</option>' . "\n"; 00395 $content_cells[$i][$ci] .= ' <option value="">null</option>' . "\n"; 00396 } else { 00397 $content_cells[$i][$ci] .= "\n"; 00398 $content_cells[$i][$ci] .= ' <option value="" selected="selected" >null</option>' . "\n"; 00399 $content_cells[$i][$ci] .= ' <option value="NOT NULL">not null</option>' . "\n"; 00400 } 00401 00402 $content_cells[$i][$ci] .= "\n" . '</select>'; 00403 $ci++; 00404 00405 if (isset($row) 00406 && !isset($row['Default']) && isset($row['Null']) && $row['Null'] == 'YES') { 00407 $row['Default'] = 'NULL'; 00408 } 00409 00410 if ($is_backup) { 00411 $content_cells[$i][$ci] = "\n" . '<input type="hidden" name="field_default_orig[]" size="8" value="' . (isset($row) && isset($row['Default']) ? urlencode($row['Default']) : '') . '" />'; 00412 } else { 00413 $content_cells[$i][$ci] = "\n"; 00414 } 00415 00416 // for a TIMESTAMP, do not show CURRENT_TIMESTAMP as a default value 00417 if (PMA_MYSQL_INT_VERSION >= 40102 00418 && $type_upper == 'TIMESTAMP' 00419 && $default_current_timestamp 00420 && isset($row) 00421 && isset($row['Default'])) { 00422 $row['Default'] = ''; 00423 } 00424 00425 $content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_default[]" size="12" value="' . (isset($row) && isset($row['Default']) ? str_replace('"', '"', $row['Default']) : '') . '" class="textfield" />'; 00426 if (PMA_MYSQL_INT_VERSION >= 40102) { 00427 if ($type_upper == 'TIMESTAMP') { 00428 $tmp_display_type = 'block'; 00429 } else { 00430 $tmp_display_type = 'none'; 00431 $default_current_timestamp = FALSE; 00432 } 00433 $content_cells[$i][$ci] .= '<br /><div id="div_' . $i . '_' . ($ci - $ci_offset) . '" style="white-space: nowrap; display: ' . $tmp_display_type . '"><input id="field_' . $i . '_' . ($ci - $ci_offset) . 'a" type="checkbox" name="field_default_current_timestamp[' . $i . ']"'; 00434 if ($default_current_timestamp) { 00435 $content_cells[$i][$ci] .= ' checked="checked" '; 00436 } 00437 $content_cells[$i][$ci] .= ' /><label for="field_' . $i . '_' . ($ci - $ci_offset) . 'a" style="font-size: ' . $font_smallest . ';">CURRENT_TIMESTAMP</label></div>'; 00438 } 00439 $ci++; 00440 00441 $content_cells[$i][$ci] = '<select name="field_extra[]" id="field_' . $i . '_' . ($ci - $ci_offset) . '">'; 00442 00443 if (!isset($row) || empty($row['Extra'])) { 00444 $content_cells[$i][$ci] .= "\n"; 00445 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n"; 00446 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n"; 00447 } else { 00448 $content_cells[$i][$ci] .= "\n"; 00449 $content_cells[$i][$ci] .= '<option value="AUTO_INCREMENT">auto_increment</option>' . "\n"; 00450 $content_cells[$i][$ci] .= '<option value=""></option>' . "\n"; 00451 } 00452 00453 $content_cells[$i][$ci] .= "\n" . '</select>'; 00454 $ci++; 00455 00456 00457 // lem9: See my other comment about removing this 'if'. 00458 if (!$is_backup) { 00459 if (isset($row) && isset($row['Key']) && $row['Key'] == 'PRI') { 00460 $checked_primary = ' checked="checked"'; 00461 } else { 00462 $checked_primary = ''; 00463 } 00464 if (isset($row) && isset($row['Key']) && $row['Key'] == 'MUL') { 00465 $checked_index = ' checked="checked"'; 00466 } else { 00467 $checked_index = ''; 00468 } 00469 if (isset($row) && isset($row['Key']) && $row['Key'] == 'UNI') { 00470 $checked_unique = ' checked="checked"'; 00471 } else { 00472 $checked_unique = ''; 00473 } 00474 if (empty($checked_primary) 00475 && empty($checked_index) 00476 && empty($checked_unique)) { 00477 $checked_none = ' checked="checked"'; 00478 } else { 00479 $checked_none = ''; 00480 } 00481 00482 if ((isset($row) && isset($row['Comment']) && $row['Comment'] == 'FULLTEXT')) { 00483 $checked_fulltext = ' checked="checked"'; 00484 } else { 00485 $checked_fulltext = ''; 00486 } 00487 00488 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="primary_' . $i . '"' . $checked_primary . ' title="' . $strPrimary . '" />'; 00489 $ci++; 00490 00491 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="index_' . $i . '"' . $checked_index . ' title="' . $strIndex . '" />'; 00492 $ci++; 00493 00494 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="unique_' . $i . '"' . $checked_unique . ' title="' . $strUnique . '" />'; 00495 $ci++; 00496 00497 $content_cells[$i][$ci] = "\n" . '<input type="radio" name="field_key_' . $i . '" value="none_' . $i . '"' . $checked_none . ' title="---" />'; 00498 $ci++; 00499 00500 $content_cells[$i][$ci] = '<input type="checkbox" name="field_fulltext[]" value="' . $i . '"' . $checked_fulltext . ' title="' . $strIdxFulltext . '" />'; 00501 $ci++; 00502 } // end if ($action ==...) 00503 00504 // garvin: comments 00505 if ($cfgRelation['commwork']) { 00506 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_comments[]" size="12" value="' . (isset($row) && isset($row['Field']) && is_array($comments_map) && isset($comments_map[$row['Field']]) ? htmlspecialchars($comments_map[$row['Field']]) : '') . '" class="textfield" />'; 00507 $ci++; 00508 } 00509 00510 // garvin: MIME-types 00511 if ($cfgRelation['mimework'] && $cfg['BrowseMIME'] && $cfgRelation['commwork']) { 00512 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_mimetype[]">' . "\n"; 00513 $content_cells[$i][$ci] .= ' <option value=""></option>' . "\n"; 00514 $content_cells[$i][$ci] .= ' <option value="auto">auto-detect</option>' . "\n"; 00515 00516 if (is_array($available_mime['mimetype'])) { 00517 foreach ($available_mime['mimetype'] AS $mimekey => $mimetype) { 00518 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['mimetype']) && ($mime_map[$row['Field']]['mimetype'] == str_replace('/', '_', $mimetype)) ? 'selected ' : ''); 00519 $content_cells[$i][$ci] .= ' <option value="' . str_replace('/', '_', $mimetype) . '" ' . $checked . '>' . htmlspecialchars($mimetype) . '</option>'; 00520 } 00521 } 00522 00523 $content_cells[$i][$ci] .= '</select>'; 00524 $ci++; 00525 00526 $content_cells[$i][$ci] = '<select id="field_' . $i . '_' . ($ci - $ci_offset) . '" size="1" name="field_transformation[]">' . "\n"; 00527 $content_cells[$i][$ci] .= ' <option value="" title="' . $strNone . '"></option>' . "\n"; 00528 if (is_array($available_mime['transformation'])) { 00529 foreach ($available_mime['transformation'] AS $mimekey => $transform) { 00530 $checked = (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation']) && (preg_match('@' . preg_quote($available_mime['transformation_file'][$mimekey]) . '3?@i', $mime_map[$row['Field']]['transformation'])) ? 'selected ' : ''); 00531 $tooltip = 'strTransformation_' . strtolower(preg_replace('@(\.inc\.php3?)$@', '', $available_mime['transformation_file'][$mimekey])); 00532 $tooltip = isset($$tooltip) ? $$tooltip : sprintf(str_replace('<br />', ' ', $strMIME_nodescription), 'PMA_transformation_' . $tooltip . '()'); 00533 $content_cells[$i][$ci] .= '<option value="' . $available_mime['transformation_file'][$mimekey] . '" ' . $checked . ' title="' . htmlspecialchars($tooltip) . '">' . htmlspecialchars($transform) . '</option>' . "\n"; 00534 } 00535 } 00536 00537 $content_cells[$i][$ci] .= '</select>'; 00538 $ci++; 00539 00540 $content_cells[$i][$ci] = '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '" type="text" name="field_transformation_options[]" size="16" value="' . (isset($row) && isset($row['Field']) && isset($mime_map[$row['Field']]['transformation_options']) ? htmlspecialchars($mime_map[$row['Field']]['transformation_options']) : '') . '" class="textfield" />'; 00541 //$ci++; 00542 } 00543 } // end for 00544 00545 if ($cfg['DefaultPropDisplay'] == 'horizontal') { 00546 ?> 00547 <table border="<?php echo $cfg['Border']; ?>" cellpadding="2" cellspacing="1"> 00548 <tr> 00549 <?php 00550 if (is_array($header_cells)) { 00551 foreach ($header_cells AS $header_nr => $header_val) { 00552 ?> 00553 <th class="tblHeaders"><?php echo $header_val; ?></th> 00554 <?php 00555 } 00556 } 00557 ?> 00558 </tr> 00559 <?php 00560 if (is_array($content_cells)) { 00561 $i = 0; 00562 foreach ($content_cells AS $content_nr => $content_row) { 00563 $i++; 00564 echo "\n" . '<tr>' . "\n"; 00565 00566 $bgcolor = ($i % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; 00567 00568 if (is_array($content_row)) { 00569 foreach ($content_row AS $content_row_nr => $content_row_val) { 00570 ?> 00571 <td bgcolor="<?php echo $bgcolor; ?>" align="center"><?php echo $content_row_val; ?></td> 00572 <?php 00573 } 00574 } 00575 00576 echo "\n" . '</tr>' . "\n"; 00577 } 00578 } 00579 ?> 00580 </table> 00581 <br /> 00582 <?php 00583 } else { 00584 ?> 00585 <table border="<?php echo $cfg['Border']; ?>"> 00586 <?php 00587 if (is_array($header_cells)) { 00588 $i = 0; 00589 foreach ($header_cells AS $header_nr => $header_val) { 00590 echo "\n" . '<tr>' . "\n"; 00591 ?> 00592 <th align="right"><?php echo $header_val; ?></th> 00593 <?php 00594 $cnt_content_cells = count($content_cells); 00595 for ($j = 0; $j < $cnt_content_cells; $j++) { 00596 if (isset($content_cells[$j][$i]) && $content_cells[$j][$i] != '') { 00597 $bgcolor = ($j % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo']; 00598 ?> 00599 <td bgcolor="<?php echo $bgcolor; ?>"><?php echo $content_cells[$j][$i]; ?></td> 00600 <?php 00601 } 00602 } 00603 00604 echo "\n" . '</tr>' . "\n"; 00605 $i++; 00606 } 00607 } 00608 ?> 00609 </table> 00610 <br /> 00611 <?php 00612 } 00613 00614 if ($action == 'tbl_create.php') { 00615 echo "\n"; 00616 ?> 00617 <table> 00618 <tr valign="top"> 00619 <td><?php echo $strTableComments; ?>: </td> 00620 <?php 00621 if ($action == 'tbl_create.php') { 00622 echo "\n"; 00623 ?> 00624 <td width="25"> </td> 00625 <td><?php echo $strTableType; ?>: </td> 00626 <?php 00627 if (PMA_MYSQL_INT_VERSION >= 40100) { 00628 echo ' <td width="25"> </td>' . "\n" 00629 . ' <td>' . $strCollation . ': </td>' . "\n"; 00630 } 00631 } 00632 echo "\n"; 00633 ?> 00634 </tr> 00635 <tr> 00636 <td> 00637 <input type="text" name="comment" size="40" maxlength="80" value="<?php echo (isset($comment) ? $comment : ''); ?>" class="textfield" /> 00638 </td> 00639 <?php 00640 // BEGIN - Table Type - 2 May 2001 - Robbat2 00641 // change by staybyte - 11 June 2001 00642 if ($action == 'tbl_create.php') { 00643 // find mysql capability - staybyte - 11. June 2001 00644 $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'have_%\';'); 00645 if ($result) { 00646 while ($tmp = PMA_DBI_fetch_assoc($result)) { 00647 if (isset($tmp['Variable_name'])) { 00648 switch ($tmp['Variable_name']) { 00649 case 'have_bdb': 00650 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') { 00651 $tbl_bdb = TRUE; 00652 } 00653 break; 00654 case 'have_gemini': 00655 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') { 00656 $tbl_gemini = TRUE; 00657 } 00658 break; 00659 case 'have_innodb': 00660 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') { 00661 $tbl_innodb = TRUE; 00662 } 00663 break; 00664 case 'have_isam': 00665 if (isset($tmp['Variable_name']) && $tmp['Value'] == 'YES') { 00666 $tbl_isam = TRUE; 00667 } 00668 break; 00669 } // end switch 00670 } // end if 00671 } // end while 00672 } // end if 00673 PMA_DBI_free_result($result); 00674 00675 echo "\n"; 00676 ?> 00677 <td width="25"> </td> 00678 <td> 00679 <?php echo PMA_generateEnginesDropdown('tbl_type', NULL, (isset($tbl_type) ? $tbl_type : NULL), FALSE, 3); ?> 00680 </td> 00681 <?php 00682 if (PMA_MYSQL_INT_VERSION >= 40100) { 00683 echo ' <td width="25"> </td>' . "\n" 00684 . ' <td>' . "\n" 00685 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_COLLATION, 'tbl_collation', NULL, (isset($tbl_collation) ? $tbl_collation : NULL), FALSE, 3) 00686 . ' </td>' . "\n"; 00687 } 00688 } 00689 echo "\n"; 00690 ?> 00691 </tr> 00692 </table> 00693 <br /> 00694 <?php 00695 } 00696 echo "\n"; 00697 // END - Table Type - 2 May 2001 - Robbat2 00698 ?> 00699 00700 <?php 00701 if ($action == 'tbl_create.php' || $action == 'tbl_addfield.php') { 00702 echo '<div class="tblHeaders" style="width: 30%; text-align: left; padding: 3px;">' . "\n"; 00703 echo ' ' . sprintf($strAddFields, '<input type="text" name="added_fields" size="2" value="1" onfocus="this.select()" style="vertical-align: middle;" />') . "\n"; 00704 echo ' <input type="submit" name="submit_num_fields" value="' . $strGo . '" onclick="return checkFormElementInRange(this.form, \'added_fields\', \'' . str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldAddCount']) . '\', 1)" style="vertical-align: middle;" />' . "\n"; 00705 echo '</div>' . "\n"; 00706 echo "<br />\n"; 00707 } 00708 ?> 00709 00710 <div class="tblFooters" style="width: 80%; text-align: center; padding: 3px;"> 00711 <input type="submit" name="do_save_data" value="<?php echo $strSave; ?>" /> 00712 </div> 00713 00714 </form> 00715 00716 <table> 00717 <tr> 00718 <td valign="top">* </td> 00719 <td> 00720 <?php echo $strSetEnumVal . "\n"; ?> 00721 </td> 00722 </tr> 00723 <tr> 00724 <td valign="top">** </td> 00725 <td> 00726 <?php echo $strDefaultValueHelp . "\n"; ?> 00727 </td> 00728 </tr> 00729 00730 <?php 00731 if ($cfgRelation['commwork'] && $cfgRelation['mimework'] && $cfg['BrowseMIME']) { 00732 ?> 00733 <tr> 00734 <td valign="top" rowspan="2">*** </td> 00735 <td> 00736 <?php echo $strMIME_transformation_options_note . "\n"; ?> 00737 </td> 00738 </tr> 00739 00740 <tr> 00741 <td> 00742 <?php echo sprintf($strMIME_transformation_note, '<a href="libraries/transformations/overview.php?' . PMA_generate_common_url($db, $table) . '" target="_blank">', '</a>') . "\n"; ?> 00743 </td> 00744 </tr> 00745 <?php 00746 } 00747 ?> 00748 00749 </table> 00750 <br /> 00751 00752 <center><?php echo PMA_showMySQLDocu('Reference', 'CREATE_TABLE'); ?></center>