<?PHP

#############################################################################
#                              Site@School
# Site@School is a website management system designed for schools.
#
# insert_table.php 
#$Id: insert_table.php,v 1.1 2006/10/03 12:27:15 fstuurman Exp $
############################################################################
include ("../../../configuration/database.inc.php"); // connecting to database
mysql_connect("$db_server", "$db_username", "$db_password");
mysql_select_db("$db_name");

$query = "SELECT config_value FROM $table_configuration where config_key='language'";
$result = mysql_query($query) or die_script(mysql_error());
$sas_language = mysql_result($result, 0);
include ("../../../languages/$sas_language/$sas_language.php");
unset ($query);
unset ($result);
?>
<html style="width: 380; height: 435">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?PHP echo $sas_lang['lang_charset'] ?>"> 
<title><?PHP echo $sas_lang['insert_table'] ?></title>

<script type="text/javascript" src="popup.js"></script>

<script type="text/javascript">

function Init() {
  __dlg_init();
  window.focus();
  document.getElementById("f_rows").focus();
  
};

function onOK() {
  var required = {
    "f_rows": "You must enter a number of rows",
    "f_cols": "You must enter a number of columns"
  };
  for (var i in required) {
    var el = document.getElementById(i);
    if (!el.value) {
      alert(required[i]);
      el.focus();
      return false;
    }
  }
  var fields = ["f_rows", "f_cols", "f_width", "f_unit",
                "f_align", "f_border", "f_spacing", "f_padding"];
  var param = new Object();
  for (var i in fields) {
    var id = fields[i];
    var el = document.getElementById(id);
    param[id] = el.value;
  }
  __dlg_close(param);
  return false;
};

function onCancel() {
  __dlg_close(null);
  return false;
};

</script>

<style type="text/css">
html, body {
  background: ButtonFace;
  color: ButtonText;
  font: 11px Tahoma,Verdana,sans-serif;
  margin: 0px;
  padding: 0px;
}
body { padding: 5px; }
table {
  font: 11px Tahoma,Verdana,sans-serif;
}
form p {
  margin-top: 5px;
  margin-bottom: 5px;
}
.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
fieldset { padding: 0px 10px 5px 5px; }
select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
.space { padding: 2px; }

.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
border-bottom: 1px solid black; letter-spacing: 2px;
}
form { padding: 0px; margin: 0px; }
</style>

</head>

<body onload="Init()">

<div class="title"><?PHP echo $sas_lang['insert_table'] ?></div>

<form action="" method="get">
<fieldset margin-left: 15px;">
<div class="space"></div>
<table border="0" style="padding: 0px; margin: 2px">
  <tbody>

  <tr>
    <td style="width: 4em; text-align: right"><?PHP echo $sas_lang['table_rows'] ?></td>
    <td><input type="text" name="rows" id="f_rows" size="5" value="2" /></td>
    <td width="20">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td style="width: 4em; text-align: right"><?PHP echo $sas_lang['table_cols'] ?></td>
    <td><input type="text" name="cols" id="f_cols" size="5" value="4" /></td>
    <td>&nbsp;</td>
    <td align="right"><?PHP echo $sas_lang['width'] ?></td>
    <td><input type="text" name="width" id="f_width" size="5" value="100" /></td>
    <td><select size="1" name="unit" id="f_unit" title="Width unit">
      <option value="%" selected="1"  >%</option>
      <option value="px"              >Px</option>
      <option value="em"              >Em</option>
    </select></td>
  </tr>
  <tr><td width="100%" colspan="6">&nbsp;</td></tr>
  <tr>
  <td style="width: 4em; text-align: right"><?PHP echo $sas_lang['outline'] ?></td>
  <td><select size="1" name="align" id="f_align"
  title="Positioning of this image">
  <option value="" selected="1"                >Not set</option>
  <option value="left"                         >Left</option>
  <option value="right"                        >Right</option>
  <option value="texttop"                      >Texttop</option>
  <option value="absmiddle"                    >Absmiddle</option>
  <option value="baseline"                     >Baseline</option>
  <option value="absbottom"                    >Absbottom</option>
  <option value="bottom"                       >Bottom</option>
  <option value="middle"                       >Middle</option>
  <option value="top"                          >Top</option>
</select></td>
  <td>&nbsp;</td>
  <td width="85" align="right">Cell spacing:</td>
  <td><input type="text" name="spacing" id="f_spacing" size="5" value="1" /></td>
  <td>&nbsp;</td>
  </tr>
  <tr>
  <td style="width: 4em; text-align: right"><?PHP echo $sas_lang['border'] ?></td>
  <td><input type="text" name="border" id="f_border" size="2" value="1" /></td>
  <td>&nbsp;</td>
  <td width="85" align="right">Cell padding:</td>
  <td><input type="text" name="padding" id="f_padding" size="5" value="1" /></td>
  <td>&nbsp;</td>
  </tr>
  </tbody>
</table>
</fieldset>
<div style="margin-top: 15px; text-align: right;">
<hr />
<button type="button" name="cancel" onclick="return onCancel();"><?PHP echo $sas_lang['cancel'] ?></button>&nbsp;
<button type="button" name="ok" onclick="return onOK();"><?PHP echo $sas_lang['insert'] ?></button>
</div>

</form>

</body>
</html>