- added PMA_getDbLink

- use fieldset for create table from
This commit is contained in:
Sebastian Mendel
2005-11-09 10:38:33 +00:00
parent 713f2d4836
commit bfddbeafa4
3 changed files with 127 additions and 130 deletions

View File

@@ -12,6 +12,8 @@ $Source$
* db_details_structure.php:
- fixed display issues
- display default engine in footer
* libraries/common.lib.php: added PMA_getDbLink
* libraries/display_create_table.lib.php: use fieldset
2005-11-08 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* Documentation.html, browse_foreigners.php, error.php,

View File

@@ -2991,6 +2991,29 @@ window.parent.updateTableTitle( '<?php echo $uni_tbl; ?>', '<?php echo PMA_jsFor
return str_replace('%u', $cfg['Server']['user'], $dir);
}
} // end if: minimal common.lib needed?
/**
* returns html code for db link to default db page
*
* @uses $GLOBALS['cfg']['DefaultTabDatabase']
* @uses $GLOBALS['db']
* @uses $GLOBALS['strJumpToDB']
* @uses PMA_generate_common_url()
* @param string $database
* @return string html link to default db page
*/
function PMA_getDbLink( $database = NULL ) {
if ( empty( $database ) ) {
if ( empty( $GLOBALS['db'] ) ) {
return '';
}
$database = $GLOBALS['db'];
}
return '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url( $database ) . '"'
.' title="' . sprintf( $GLOBALS['strJumpToDB'], htmlspecialchars( $database ) ) . '">'
.htmlspecialchars( $database ) . '</a>';
}
} // end if: minimal common.lib needed?
?>

View File

@@ -67,61 +67,33 @@ foreach($dbs_where_create_table_allowed as $allowed_db) {
} // end foreach
unset($i, $max_position, $chunk, $pattern);
if ($is_create_table_priv) {
?>
<!-- Create a new table -->
<form method="post" action="tbl_create.php" onsubmit="return (emptyFormElements(this, 'table') &amp;&amp; checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldCount']); ?>', 1))">
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td class="tblHeaders" colspan="3" nowrap="nowrap"><?php
echo PMA_generate_common_hidden_inputs($db);
if($cfg['PropertiesIconic']){ echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />'; }
// if you want navigation:
$strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url() . '&amp;db=' . urlencode($GLOBALS['db']) . '">'
. htmlspecialchars($GLOBALS['db']) . '</a>';
// else use
// $strDBLink = htmlspecialchars($db);
echo ' ' . sprintf($strCreateNewTable, $strDBLink) . ':&nbsp;' . "\n";
echo ' </td></tr>';
echo ' <tr bgcolor="'.$cfg['BgcolorOne'].'"><td nowrap="nowrap">';
echo ' ' . $strName . ':&nbsp;' . "\n";
echo ' </td>';
echo ' <td nowrap="nowrap">';
echo ' ' . '<input type="text" name="table" maxlength="64" size="30" class="textfield" />';
echo ' </td><td>&nbsp;</td></tr>';
echo ' <tr bgcolor="'.$cfg['BgcolorOne'].'"><td nowrap="nowrap">';
if (!isset($strNumberOfFields)) {
$strNumberOfFields = $strFields;
<form method="post" action="tbl_create.php"
onsubmit="return (emptyFormElements(this, 'table') &amp;&amp; checkFormElementInRange(this, 'num_fields', '<?php echo str_replace('\'', '\\\'', $GLOBALS['strInvalidFieldCount']); ?>', 1))">
<fieldset>
<legend>
<?php
if ( $GLOBALS['cfg']['PropertiesIconic'] ) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />';
}
echo ' ' . $strNumberOfFields . ':&nbsp;' . "\n";
echo ' </td>';
echo ' <td nowrap="nowrap">';
echo ' ' . '<input type="text" name="num_fields" size="2" class="textfield" />' . "\n";
echo ' </td>';
echo ' <td align="right">';
echo ' ' . '&nbsp;<input type="submit" value="' . $strGo . '" />' . "\n";
echo ' </td> </tr>';
echo ' </table>';
echo '</form>' . "\n";
} else {
?>
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td class="tblHeaders" colspan="3" nowrap="nowrap"><?php
if($cfg['PropertiesIconic']) {
echo '<img class="icon" src="' . $pmaThemeImage . 'b_newtbl.png" width="16" height="16" alt="" />' . "\n";
}
$strDBLink = htmlspecialchars($db);
echo ' ' . sprintf($strCreateNewTable, $strDBLink) . ':&nbsp;' . "\n";
echo ' </td></tr>' . "\n";
echo ' <tr>' . "\n";
echo ' <td>' . "\n";
echo '<span class="noPrivileges">'
. ($cfg['ErrorIconic'] ? '<img class="icon" src="' . $pmaThemeImage . 's_error2.png" width="11" height="11" alt="" />' : '')
. '' . $strNoPrivileges .'</span>' . "\n";
echo ' </td>' . "\n";
echo ' </tr>' . "\n";
echo ' </table>' . "\n";
} // end if
echo sprintf( $strCreateNewTable, PMA_getDbLink() );
?>
</legend>
<?php if ( $is_create_table_priv ) { ?>
<?php echo PMA_generate_common_hidden_inputs( $db ); ?>
<div class="formelement">
<?php echo $strName; ?>:
<input type="text" name="table" maxlength="64" size="30" />
</div>
<div class="formelement">
<?php echo $strNumberOfFields; ?>:
<input type="text" name="num_fields" size="2" />
</div>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" value="<?php echo $strGo; ?>" />
<?php } else { ?>
<div class="error"><?php echo $strNoPrivileges; ?></div>
<?php } // end if else ?>
</fieldset>
</form>