<?php
session_start();
$user_ID=$_SESSION[user_ID];
if (!$user_ID || $user_ID=='0')
{
header('location: index.php');
die('Login failed');
}
require("util.php");
$sql = new MySQL_class;
$sql->Create("generator");
$esql = new MySQL_class;
$esql->Create("generator");
if ($_GET[sheet]) { $_SESSION[var_sheet] = $_GET[sheet]; }
if ($_GET[ColumnID]) { $_SESSION[var_ColumnID] = $_GET[ColumnID]; }
$sheet=$_SESSION[var_sheet];
$ColumnID=$_SESSION[var_ColumnID];
?>
<?php
if ($_POST['Name']!='') {
$Name = ($_POST['Name']);
$Size = $_POST['Size'];
$Type = $_POST['Type'];
$intern = ($_POST['intern']);
$Calculation = ($_POST['Calculation']);
$Sort = $_POST['Sort'];
}
?>
<html>
<head>
<link href="list.css" type="text/css" rel=stylesheet>
<meta content="text/css" http-equiv="Content-Style-Type">
<title>Column add</title>
</head>
<body class="top" onload="Insert.<?php
if ($_POST[FOCUS]==470) {echo 'intern';}
else {echo 'name';}
?>.focus();">
<form name="Insert" action="postaddcolumn.php" method="post">
<input type=hidden name="FOCUS" value="">
<table class=enter>
<tr id=title><th colspan=2>Column add</th></tr>
<tr><th>Name</th>
<td>
<?php
$current=($_POST['Name']!='');
$strdefault = $_POST['Name'];
echo "<input type=text name=\"Name\" size=0 value=\"$strdefault\">";
?>
</td></tr>
<tr><th>Size</th>
<td>
<?php
$current=($_POST['Size']!='');
$strdefault = $_POST['Size'];
echo "<input type=text name=\"Size\" size=5 value=\"$strdefault\">";
?>
</td></tr>
<tr><th>Type</th>
<td>
<?php
$current=($_POST['Type']!='');
echo ("<select name=\"Type\" OnChange=\"Insert.action=''; Insert.FOCUS.value='470'; Insert.submit();\">");
if ('date' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"date\"$sel>date</option>\n";
if ('datemin' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"datemin\"$sel>datemin</option>\n";
if ('datemax' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"datemax\"$sel>datemax</option>\n";
if ('number' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"number\"$sel>number</option>\n";
if ('select' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"select\"$sel>select</option>\n";
if ('char' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"char\"$sel>char</option>\n";
if ('text' == $_POST['Type']) {$sel='selected ';} else {$sel='';};
echo "<option value=\"text\"$sel>text</option>\n";
echo ("</select>");
?>
</td></tr>
<tr><th>SQL Table</th>
<td>
<?php
$current=($_POST['intern']!='');
$strdefault = $_POST['intern'];
echo "<input type=text name=\"intern\" size=0 value=\"$strdefault\">";
?>
</td></tr>
<tr><th>Calculation</th>
<td>
<?php
$current=($_POST['Calculation']!='');
$strdefault = $_POST['Calculation'];
echo "<textarea name=\"Calculation\" rows=5 cols=40>$strdefault</textarea>";
?>
</td></tr>
<tr><th>Sort</th>
<td>
<?php
$current=($_POST['Sort']!='');
$strdefault = $_POST['Sort'];
echo "<input type=text name=\"Sort\" size=5 value=\"$strdefault\">";
?>
</td></tr>
</table>
<p id=buttons>
<input type=submit value=Add>
<input type=button value=Cancel onClick="window.close()">
</p>
</form>
</body>
</html>