Skip to content

Commit

Permalink
Sections show in webconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
greghaynes committed May 28, 2010
1 parent 8ebf8fa commit 251eaf9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tools/http/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ <h1>XSBS Admin Panel</h1>
<li>Clients: <span id="status_clients"></span> (<span id="status_players"></span> players, <span id="status_spectators"></span> spectatrs)</li>
</ul>
</div>
<div id="configuration-tab"><h3>Plugins:</h3>
<div id="config-plugins-accordion">
<div id="configuration-tab">
<div id="config_plugins">
</div>
</div>
</div>
Expand Down
5 changes: 5 additions & 0 deletions tools/http/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ h1
color: red;
}

.config_sections
{
list-style-type: none;
}

21 changes: 17 additions & 4 deletions tools/http/js/xsbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,24 @@ function enableTopNav(hostname, username, password)
$('#topnav_logout').click(function() { window.location.reload(); });
}

function configPluginSelected(hostname, username, password, plugin_name) {
if($("#plugin_config_" + plugin_name).html() != "")
$("#plugin_config_" + plugin_name).empty();
else
{
$.getJSON('http://' + hostname + '/json/admin/config/' + plugin_name + '?username=' + username + '&password=' + password, function(data) {
sections = $("<ul class=\"config_sections\"><h4>Sections</h4></ul>");
$.each(data.sections, function(i, section) {
sections.append("<li><a href=\"#\">" + section + "</a></li>");
});
$("#plugin_config_" + plugin_name).html(sections);
});
}
}

function configPageAddPlugin(hostname, username, password, plugin_name) {
$("<h3><a href=\"#\">" + plugin_name + "</a></h3>").appendTo("#config-plugins-accordion");
$("<div>Content about " + plugin_name + "</div>").appendTo("#config-plugins-accordion");
$("<h3 class=\"head\"><a href=\"#\" id=\"a_config_plugin_" + plugin_name + "\">" + plugin_name + "</a></h3><div id=\"plugin_config_" + plugin_name + "\"></div>").appendTo("#config_plugins");
$("#a_config_plugin_" + plugin_name).click(function() { configPluginSelected(hostname, username, password, plugin_name); });
}

function configPage(hostname, username, password) {
Expand All @@ -95,15 +110,13 @@ function configPage(hostname, username, password) {
$.each(data.plugins, function(i, plugin_name) {
configPageAddPlugin(hostname, username, password, plugin_name);
});
$("#config-plugins-accordion").accordion();
}
else
alert("Error");
});
}

function configPageInvalidLogin() {
$('#config-plugins-list').html('<font color=\"red\">Invalid login</font>');
}

function adminPageNoLogin(hostname) {
Expand Down

0 comments on commit 251eaf9

Please sign in to comment.