replace dropdown with radio, if short

This commit is contained in:
Korakot Chaovavanich
2001-05-08 09:34:25 +00:00
parent b5e5688792
commit 6f943e9d3e
2 changed files with 28 additions and 10 deletions

View File

@@ -5,6 +5,9 @@ phpMyAdmin - Changelog
$Id$
$Source$
2001-05-08 Korakot Chaovavanich <korakot@iname.com>
* In edit page, replace dropdown with radio if short enough
2001-05-08 Lo<4C>c Chapeaux <lolo@phpheaven.net>
* db_readdump.php3, line 14 and sql.php3, line 112: two warnings were
displayed with the phpMyBookmark path if the error reporting level

View File

@@ -92,16 +92,31 @@ for($i=0;$i<mysql_num_rows($table_def);$i++)
$set = ereg_replace("\\)$", "", $set);
$set = explode(",", $set);
echo "<td><select name=fields[$field]>\n";
echo "<option value=\"\">\n";
for($j=0; $j<count($set);$j++)
{
echo '<option value="'.substr($set[$j], 1, -1).'"';
if($data == substr($set[$j], 1, -1) || ($data == "" && substr($set[$j], 1, -1) == $row_table_def["Default"]))
echo " selected";
echo ">".htmlspecialchars(substr($set[$j], 1, -1))."\n";
}
echo "</select></td>";
// show dropdown or radio depend on length
if (strlen($row_table_def["Type"]) > 20) {
echo "<td><select name=fields[$field]>\n";
echo "<option value=\"\">\n";
for($j=0; $j<count($set);$j++)
{
echo '<option value="'.substr($set[$j], 1, -1).'"';
if($data == substr($set[$j], 1, -1) || ($data == "" && substr($set[$j], 1, -1) == $row_table_def["Default"]))
echo " selected";
echo ">".htmlspecialchars(substr($set[$j], 1, -1))."\n";
}
echo "</select></td>";
}
else {
echo "<td>\n";
for($j=0; $j<count($set);$j++)
{
echo "<input type=radio name=fields[$field] ";
echo 'value="'.substr($set[$j], 1, -1).'"';
if($data == substr($set[$j], 1, -1) || ($data == "" && substr($set[$j], 1, -1) == $row_table_def["Default"]))
echo " checked";
echo ">".htmlspecialchars(substr($set[$j], 1, -1))."\n";
}
echo "</td>";
}
}
elseif(strstr($row_table_def["Type"], "set"))