mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
svn -> git Migration
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
||||
"http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2 align="center">Variable Settings</h2>
|
||||
<hr/>
|
||||
<?
|
||||
my $gets = $request->get_all;
|
||||
my $error=0;
|
||||
if (defined($gets->{"update.x"})) {
|
||||
$EQDB->query("delete from variables");
|
||||
my $max=$gets->{maxid};
|
||||
for(my $i=0;$i<$max;++$i) {
|
||||
my ($varname,$info,$value) = ($gets->{"variable$i"},$gets->{"info$i"},$gets->{"value$i"});
|
||||
next if (!$varname);
|
||||
$q=sprintf("replace into variables (varname,information,value) values('%s','%s','%s')",$EQDB->escape_string($varname),$EQDB->escape_string($info),$EQDB->escape_string($value));
|
||||
$EQDB->query($q);
|
||||
if ($EQDB->get_errno) {
|
||||
$error=1;
|
||||
printf("Error adding variable %s: %s<br>\n",$varname,$EQDB->error);
|
||||
}
|
||||
}
|
||||
if ($error==0) {
|
||||
printf("<h3>Variable settings updated, will take affect on server restart.</h3><br>\n");
|
||||
}
|
||||
}
|
||||
?>
|
||||
<form method="get" action="variables.html">
|
||||
<?
|
||||
my $i=0;
|
||||
$q="select * from variables order by varname";
|
||||
my $res=$EQDB->query($q);
|
||||
if ($res) {
|
||||
print "<table id=\"var_tab\" border=\"1\" cellspacing=\"2\" cellpadding=\"3\" class=\"zonelist\"><tr>\n";
|
||||
printf "\t\t<th scope=\"col\" width=\"150\">Variable</th>\n";
|
||||
printf "\t\t<th scope=\"col\" width=\"250\">Description</th>\n";
|
||||
printf "\t\t<th scope=\"col\" width=\"260\">Value</th>\n";
|
||||
printf "\t</tr>\n";
|
||||
|
||||
while(my $row=$res->fetch_row_hash) {
|
||||
printf "\t\t<tr><td>%s<input id=\"var%d\" type=\"hidden\" name=\"variable%d\" value=\"%s\"></td>\n",$row->{varname},$i,$i,$row->{varname};
|
||||
printf "\t\t<td>%s<input type=\"hidden\" name=\"info%d\" value=\"%s\"></td>\n",$row->{information},$i,$row->{information};
|
||||
printf "\t\t<td><textarea cols=\"30\" rows=\"2\" name=\"value%d\">%s</textarea> <img src=\"delete.gif\" alt=\"delete\" onClick=\"del_row(%d)\"></td>\n",$i,$row->{value},$i;
|
||||
print "\t</tr>\n";
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
printf("<tr><td colspan=\"3\" align=\"center\"><input value=\"Add New Variable\" type=button onClick=\"add_row()\"/></td></tr>\n");
|
||||
printf("</table><script language=\"javascript\">var next_field=%d;</script>\n",$i);
|
||||
printf("<input type=\"hidden\" id=\"maxid\" value=\"%d\" name=\"maxid\">\n",$i-1);
|
||||
?>
|
||||
<script language="javascript">
|
||||
function add_row() {
|
||||
var tab=document.getElementById('var_tab');
|
||||
var row=tab.insertRow(tab.rows.length-1);
|
||||
|
||||
var cell=row.insertCell(0);
|
||||
var el=document.createElement('input');
|
||||
el.type='text';
|
||||
el.name='variable'+next_field;
|
||||
el.value='NewVariable';
|
||||
el.id='var'+next_field;
|
||||
el.size=20;
|
||||
cell.appendChild(el);
|
||||
|
||||
cell=row.insertCell(1);
|
||||
el=document.createElement('textarea');
|
||||
el.rows='2';
|
||||
el.cols='30';
|
||||
el.name='info'+next_field;
|
||||
el.text='NewInfo';
|
||||
cell.appendChild(el);
|
||||
|
||||
cell=row.insertCell(2);
|
||||
el=document.createElement('textarea');
|
||||
el.rows='2';
|
||||
el.cols='30';
|
||||
el.name='value'+next_field;
|
||||
el.text='NewValue';
|
||||
cell.appendChild(el);
|
||||
|
||||
el=document.createElement('img');
|
||||
el.src='delete.gif';
|
||||
el.onclick=new Function('del_row('+next_field+')');
|
||||
cell.appendChild(el);
|
||||
|
||||
++next_field;
|
||||
|
||||
var inp=document.getElementById('maxid');
|
||||
inp.value=next_field;
|
||||
|
||||
}
|
||||
function del_row(i) {
|
||||
var row=document.getElementById('var'+i);
|
||||
row.parentNode.parentNode.parentNode.removeChild(row.parentNode.parentNode);
|
||||
}
|
||||
</script>
|
||||
<p>
|
||||
<input type="image" src="update.png" name="update"/>
|
||||
<input type="image" src="reset.png" name="reset"/>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user