2013-05-09 11:13:16 -04:00

167 lines
6.4 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>EQEmu</title>
<link rel="stylesheet" type="text/css" href="style/style.css"/>
<script src="scripts/jquery.js"></script>
<script>
<!--
var idx = Math.floor((Math.random()*100000000));
function GetStatusIdx() {
return idx++;
}
function StatusTic() {
$.getJSON("data/launcher_data.html?idx="+GetStatusIdx(),
function(data) {
$("#launcher_table").empty();
var app_html = "<tr>";
app_html += "<th scope=\"col\">Launcher Name </th>";
app_html += "<th scope=\"col\">Zone Count</th>";
app_html += "<th scope=\"col\">Actions</th>";
app_html += "</tr>";
$("#launcher_table").append(app_html);
var i = 0;
for(var i = 0; i < data.launcher_count; i++) {
app_html = "<tr>";
if(data.launchers[i].connected) {
app_html += "<td><a href='launcher.html?name=" + data.launchers[i].name + "'>" + data.launchers[i].name + "</a></td>";
} else {
app_html += "<td><a href='launcher.html?name="+ data.launchers[i].name +"'>"+ data.launchers[i].name +"</a><br><b>Not Connected</b></td>";
}
app_html += "<td>"+ data.launchers[i].static_count +"s, "+ data.launchers[i].dynamic_count +"d</td>";
app_html += "<td>";
app_html += "<a href='launcher.html?name="+ data.launchers[i].name +"'>Details</a> - ";
app_html += "<a href='javascript:void(0)' onclick='RemoveLauncher(\"" + data.launchers[i].name + "\")'>Remove</a>";
app_html += "</td>\n";
app_html += "</tr>\n";
$("#launcher_table").append(app_html);
}
});
}
function RemoveLauncher(name) {
$.getJSON("actions/launcher_action.html?action=remove&launcher_name="+name+"&idx="+GetStatusIdx(),
function(data) {
if(data.status == 0) {
alert(data.message);
} else {
StatusTic();
}
});
}
function AddLauncher() {
var elm = document.getElementById("al_add_button_img");
elm.style.display = "inline";
elm = document.getElementById("al_add_button");
elm.className = "styled_button_disabled";
$('#al_add_button').unbind('click');
elm = document.getElementById("al_name");
var launcher_name = elm.value;
elm.value = "";
elm = document.getElementById("al_count");
var dynamic_count = elm.value;
elm.value = "";
$.getJSON("actions/launcher_action.html?action=add&launcher_name="+launcher_name+"&dynamic_count="+dynamic_count+"&idx="+GetStatusIdx(),
function(data) {
$('#al_add_button').bind('click', AddLauncher);
elm = document.getElementById("al_add_button");
elm.className = "styled_button";
elm = document.getElementById("al_add_button_img");
elm.style.display = "none";
if(data.status == 0) {
alert(data.message);
} else {
StatusTic();
}
});
}
function ShowAddLauncher() {
$("#add_launcher_link").hide();
$("#min_add_launcher_link").show();
$("#add_launcher_table").fadeIn("slow");
}
function HideAddLauncher() {
$("#add_launcher_link").show();
$("#min_add_launcher_link").hide();
$("#add_launcher_table").fadeOut("slow");
}
$(document).ready(function() {
setInterval("StatusTic()", 4000);
$('#al_add_button').bind('click', AddLauncher);
});
-->
</script>
</head>
<?
@list = sort $EQW->ListLaunchers();
?>
<body>
<div class="container">
<?do("templates/scripts/menu.pl");?>
<div id="main_content" class="main">
<h2 align="center">Launchers</h2>
<table id='launcher_table' class='styled_table' width="70%" cellspacing="0" cellpadding="0">
<tr>
<th scope="col">Launcher Name </th>
<th scope="col">Zone Count</th>
<th scope="col">Actions</th>
</tr>
<?
for my $lk (sort @list) {
my $l = $EQW->GetLauncher($lk);
if(!$l) {
next;
}
print "<tr>\n";
if($l->IsConnected()) {
print "\t<td><a href='launcher.html?name=".$l->GetName()."'>".$l->GetName()."</a></td>";
} else {
print "<td><a href='launcher.html?name=".$l->GetName()."'>".$l->GetName()."</a><br><b>Not Connected</b></td>";
}
print "<td>".$l->GetStaticCount()."s, ".$l->GetDynamicCount()."d</td>";
print "<td>";
print "<a href='launcher.html?name=".$l->GetName()."'>Details</a> - ";
print "<a href='javascript:void(0)' onclick='RemoveLauncher(\"" . $l->GetName() . "\")'>Remove</a>";
print "</td>\n";
print "</tr>\n";
}
?>
</table>
</br>
<div align="center">
<span id="add_launcher_link"><a href='javascript:void(0)' onclick='ShowAddLauncher()'>Add Launcher</a></span>
<span id="min_add_launcher_link" style="display:none;"><a href='javascript:void(0)' onclick='HideAddLauncher()'>Minimize</a></span>
</div>
<table id="add_launcher_table" class='styled_table' width="40%" cellspacing="0" cellpadding="0" style="display:none;">
<tr>
<td>
<h2>Add Launcher:</h2>
Name: <input type='text' name='name' id='al_name'>
Dynamic Count: <input type='text' name='dynamics' size="3" id='al_count'>
<button id='al_add_button' class='styled_button'><img id="al_add_button_img" src="images/loading.gif" height="16" width="16" style='display: none;'>Add</button>
</td>
</tr>
</table>
</div>
</div>
<div class="footer">
&copy 2012 EQEmu. All rights reserved.
</div>
</body>
</html>