PDA

View Full Version : EQEmu Templates update


nosfentora
05-21-2009, 03:05 PM
I updated the default eqemu website so that the rules are visible via the web system that comes with the emu.

Replace the contents of menu.html with this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base target="main">
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script>
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
<link rel="stylesheet" title="Default" href="TreeMenu.css" type="text/css" />
</head>

<body class="edgebody">
<!--
<table class="menu" border="0" bgcolor="#12282D" width="100%" height="100%">
<tr>
<td class="menu" valign="top" align="left">
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><a href="status.html">Status</a></td>
</tr> <tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><a href="config.html">Config</a></td>
</tr>
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><a href="rules.html">Rules</a></td>
</tr>
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><a href="world.html">World</a></td>
</tr>
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><a href="zones.html">Zones</a></td>
</tr>
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><a href="database.html">Database</a></td>
</tr>
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><img src="yellow_dot.gif" height="10" width="10"><a href="accounts.html">Accounts</a></td>
</tr>
<tr>
<td><img src="yellow_dot.gif" height="10" width="10"></td>
<td><img src="yellow_dot.gif" height="10" width="10"><a href="minilogin.html">Minilogin</a></td>
</tr>
</table>
</td>
</tr>
</table>
-->

<table class="menu" border="0" bgcolor="#12282D" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr>
<td class="menu" valign="top" align="left" width="100%">
<script language="javascript" type="text/javascript">
EQLMenu = new TreeMenu("TMimages", "EQLMenu", "_self", "auto", true);
EQLMenu.linkTarget = "main";
EQLMenu.SetImageSize(20, 20);
statusmenu = EQLMenu.addItem(new TreeNode('Status', null, 'status.html', false, true, 'tmenu0text'));
statusmenu.addItem(new TreeNode('Players', null, 'players.html', false, true, 'tmenu1text'));
statusmenu.addItem(new TreeNode('Petitions', null, 'petitions.html', false, true, 'tmenu1text'));
worldmenu = EQLMenu.addItem(new TreeNode('World', null, 'world.html', false, true, 'tmenu0text'));
worldmenu.addItem(new TreeNode('Launchers', null, 'launchers.html', false, true, 'tmenu1text'));
worldmenu.addItem(new TreeNode('Chat', null, 'chat.html', false, true, 'tmenu1text'));
zonesmenu = EQLMenu.addItem(new TreeNode('Zones', null, 'zones.html', false, true, 'tmenu0text'));
guildmenu = EQLMenu.addItem(new TreeNode('Guilds', null, 'guilds.html', false, true, 'tmenu0text'));
guildmenu.addItem(new TreeNode('Search', null, 'guildsearch.html', false, true, 'tmenu1text'));
guildmenu.addItem(new TreeNode('Create', null, 'guildcreate.html', false, true, 'tmenu1text'));
dbmenu = EQLMenu.addItem(new TreeNode('Database', null, 'database.html', false, true, 'tmenu0text'));
dbmenu.addItem(new TreeNode('Accounts', null, 'accounts.html', false, true, 'tmenu1text'));
dbmenu.addItem(new TreeNode('Variables', null, 'variables.html', false, true, 'tmenu1text'));
dbmenu.addItem(new TreeNode('Rules', null, 'rules.html', false, true, 'tmenu1text'));
dbmenu.addItem(new TreeNode('Minilogin', null, 'minilogin.html', false, true, 'tmenu1text'));
dbmenu.addItem(new TreeNode('Bans/Filters', null, 'filters.html', false, true, 'tmenu1text'));
dbmenu.addItem(new TreeNode('Commands', null, 'commands.html', false, true, 'tmenu1text'));
configmenu = EQLMenu.addItem(new TreeNode('Config', null, 'config.html', false, true, 'tmenu0text'));
configmenu.addItem(new TreeNode('Rules', null, 'rules.html', false, true, 'tmenu1text'));


/* newNode_1 = newNode.addItem(new TreeNode('Introduction to HTML_TreeMenuXL', null, '#intro', false, true, 'tmenu1text'));
newNode_2 = newNode.addItem(new TreeNode('Using HTML_TreeMenuXL', null, '#chips_version', false, true, 'tmenu1text'));
newNode_2_1 = newNode_2.addItem(new TreeNode('Basic TreeMenus', null, '#basic', false, true, 'tmenu2text'));
newNode_2_2 = newNode_2.addItem(new TreeNode('TreeMenus With Style', null, '#style', false, true, 'tmenu2text'));
newNode_2_3 = newNode_2.addItem(new TreeNode('TreeMenus Without Icons', null, '#noicons', false, true, 'tmenu2text'));
newNode_2_4 = newNode_2.addItem(new TreeNode('Rigid and Expanded TreeMenus', null, '#rigid', false, true, 'tmenu2text'));
newNode_2_5 = newNode_2.addItem(new TreeNode('Controlling Indenting and Vertical Spacing', null, '#advanced_spacing', false, true, 'tmenu2text'));
newNode_2_6 = newNode_2.addItem(new TreeNode('LinkSelect, User Images and User Styles', null, '#advanced_linkselect', false, true, 'tmenu2text'));
newNode_2_7 = newNode_2.addItem(new TreeNode('Listbox Menus', null, '#listbox', false, true, 'tmenu2text'));
newNode_3 = newNode.addItem(new TreeNode('History of TreeMenuXL', null, '#history', false, true, 'tmenu1text'));
newNode_3_1 = newNode_3.addItem(new TreeNode('TreeMenuXL 1.1', null, '#xl11', false, true, 'tmenu2text'));
newNode_3_2 = newNode_3.addItem(new TreeNode('TreeMenuXL 1.2', null, '#xl12', false, true, 'tmenu2text'));
newNode_3_3 = newNode_3.addItem(new TreeNode('Summary of New Features in TreeMenuXL', null, '#summary_of_new_features', false, true, 'tmenu2text'));
newNode_4 = newNode.addItem(new TreeNode('HTML_TreeMenu Reference', null, '#reference', false, true, 'tmenu1text'));
newNode_5 = newNode.addItem(new TreeNode('Things To Do', null, '#thingstodo', false, true, 'tmenu1text'));
newNode_6 = newNode.addItem(new TreeNode('TreeMenuXL Source Code', null, '#sourcecode', false, true, 'tmenu1text'));
newNode_6.iconImageWidth=20;
newNode_6.iconImageHeight=20;
newNode_6.lineImageWidth=20;
newNode_6.lineImageHeight=20;
newNode.iconImageWidth=20;
newNode.iconImageHeight=20;
newNode.lineImageWidth=20;
newNode.lineImageHeight=20;
*/
EQLMenu.drawMenu();
EQLMenu.resetBranches();
</script>
<br/>
</td>
<td class="menuborder" width="1"><img src="spacer.gif"></td>
</tr>
<tr><td colspan="2" class="menuborder" height="1" width="100%"><img src="spacer.gif"></td></tr>
</table>

</body>
</html>

Replace the contents of rules.html with this

<!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">Rule Settings</h2>
<hr/>
<?
my $gets = $request->get_all;
my $error=0;
if (defined($gets->{"update.x"})) {
$EQDB->query("delete from rule_values");
my $max=$gets->{maxid};
for(my $i=0;$i<$max;++$i) {
my ($ruleset_id,$rule_name,$info,$value) = ($gets->{"rule$i"},$gets->{"name$i"},$gets->{"info$i"},$gets->{"value$i"});
next if (!$ruleset_id);
$q=sprintf("replace into rule_values (ruleset_id,rule_name,rule_value,notes) values('%s','%s','%s','%s')",$EQDB->escape_string($ruleset_id),$EQDB->escape_string($rule_name),$EQDB->escape_string($value),$EQDB->escape_string($info));
$EQDB->query($q);
if ($EQDB->get_errno) {
$error=1;
printf("Error adding rule %s: %s<br>\n",$varname,$EQDB->error);
}
}
if ($error==0) {
printf("<h3>Rule settings updated, will take affect on server restart.</h3><br>\n");
}
}
?>
<form method="get" action="rules.html">
<?
my $i=0;
$q="select * from rule_values order by rule_name";
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=\"100\">Ruleset ID</th>\n";
printf "\t\t<th scope=\"col\" width=\"150\">Rule Name</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=\"rule%d\" type=\"hidden\" name=\"rule%d\" value=\"%s\"></td>\n",$row->{ruleset_id},$i,$i,$row->{ruleset_id};
printf "\t\t<td>%s<input type=\"hidden\" name=\"name%d\" value=\"%s\"></td>\n",$row->{rule_name},$i,$row->{rule_name};
printf "\t\t<td>%s<input type=\"hidden\" name=\"info%d\" value=\"%s\"></td>\n",$row->{notes},$i,$row->{notes};
printf "\t\t<td><textarea cols=\"30\" rows=\"2\" name=\"value%d\">%s</textarea>&nbsp;<img src=\"delete.gif\" alt=\"delete\" onClick=\"del_row(%d)\"></td>\n",$i,$row->{rule_value},$i;
print "\t</tr>\n";
++$i;
}
}
printf("<tr><td colspan=\"3\" align=\"center\"><input value=\"Add New Rule\" 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='rule_id'+next_field;
el.value='NewRuleID';
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='RuleName'+next_field;
el.text='NewRuleName';
cell.appendChild(el);

cell=row.insertCell(2);
el=document.createElement('textarea');
el.rows='2';
el.cols='30';
el.name='Description'+next_field;
el.text='NewDescription';
cell.appendChild(el);

cell=row.insertCell(3);
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(r ow.parentNode.parentNode);
}
</script>
<p>
<input type="image" src="update.png" name="update"/>
<input type="image" src="reset.png" name="reset"/>
</form>
</body>
</html>
I tested this and it loads the rules fine.
All credit goes to whoever wrote the variables.html source, as i used that as a starting point and just adjusted/added things where need be.

nosfentora
05-21-2009, 03:11 PM
replace the contents of database.html with this


<!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">Database Operations</h2>
<hr/>
<p>Some basic database operations...</p>
<p><a href="accounts.html">Accounts</a> - View and edit characters and accounts</p>
<p><a href="variables.html">Variables</a> - View and change in-database variables</p>
<p><a href="rules.html">Rules</a> - View and change in-database rules</p>
<p><a href="filters.html">Filters And Bans</a> - View and edit name filters and banned accounts</p>
<p><a href="minilogin.html">Mini-login</a> Change Server Type and Settings</p>
</body>
</html>

Lillu
08-08-2009, 04:04 PM
Thanks a lot nosfentora!

Anyone esle planning on extending the default eqemu website features or at least code the missing functions? I'm looking forward to see it, it's a great feature and is a great help for server ops. Sadly I myself don't have the knowledge to do it..