Skip to content

Commit af86246

Browse files
committedNov 29, 2009
Importing the latest Guncho code.
0 parents  commit af86246

File tree

487 files changed

+348586
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

487 files changed

+348586
-0
lines changed
 

‎ControlPanel/Admin.aspx

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="ControlPanel.Admin" %>
2+
<%@ Register TagPrefix="cp" TagName="Header" Src="~/header.ascx" %>
3+
<%@ Register TagPrefix="cp" TagName="Footer" Src="~/footer.ascx" %>
4+
5+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6+
7+
<html xmlns="http://www.w3.org/1999/xhtml" >
8+
<head runat="server">
9+
<title>Adminstration - Guncho Control Panel</title>
10+
</head>
11+
<body>
12+
<form id="form1" runat="server">
13+
<cp:Header runat="server" />
14+
15+
<asp:Label ID="errorLabel" ForeColor="red" runat="server" />
16+
17+
<asp:Panel ID="adminPanel" runat="server">
18+
<asp:Panel ID="shutdownPanel" runat="server">
19+
<b>Shut down the server:</b>
20+
<br />
21+
<asp:CheckBox ID="chkConfirmShutdown" Text="Really!" runat="server" />
22+
<asp:Button ID="btnShutdown" Text="Shut Down" OnClick="btnShutdown_Click" runat="server" />
23+
</asp:Panel>
24+
<asp:Panel ID="passwdPanel" runat="server">
25+
<b>Reset a player's password:</b>
26+
<br />
27+
<asp:TextBox ID="txtResetUser" runat="server" />
28+
<asp:TextBox ID="txtResetPasswd" TextMode="Password" runat="server" />
29+
<asp:Button ID="btnResetPasswd" Text="Change Password" OnClick="btnResetPasswd_Click" runat="server" />
30+
</asp:Panel>
31+
</asp:Panel>
32+
33+
<cp:Footer runat="server" />
34+
</form>
35+
</body>
36+
</html>

‎ControlPanel/Admin.aspx.cs

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using System;
2+
using System.Data;
3+
using System.Configuration;
4+
using System.Collections;
5+
using System.Web;
6+
using System.Web.Security;
7+
using System.Web.UI;
8+
using System.Web.UI.WebControls;
9+
using System.Web.UI.WebControls.WebParts;
10+
using System.Web.UI.HtmlControls;
11+
using Guncho;
12+
13+
namespace ControlPanel
14+
{
15+
public partial class Admin : System.Web.UI.Page
16+
{
17+
private IController controller;
18+
19+
protected void Page_Load(object sender, EventArgs e)
20+
{
21+
controller = Common.GetController(Session);
22+
23+
if (controller.IsPlayerAdmin(Context.User.Identity.Name))
24+
{
25+
errorLabel.Text = "";
26+
adminPanel.Visible = true;
27+
}
28+
else
29+
{
30+
errorLabel.Text = "Permission denied.";
31+
adminPanel.Visible = false;
32+
}
33+
}
34+
35+
protected void btnShutdown_Click(object sender, EventArgs e)
36+
{
37+
if (chkConfirmShutdown.Checked)
38+
{
39+
errorLabel.Text = "The server is shutting down.";
40+
controller.Shutdown("requested by " + Context.User.Identity.Name);
41+
}
42+
else
43+
{
44+
errorLabel.Text = "You must confirm shutdown by clicking the check box.";
45+
}
46+
}
47+
48+
protected void btnResetPasswd_Click(object sender, EventArgs e)
49+
{
50+
string user = txtResetUser.Text;
51+
string pass = txtResetPasswd.Text;
52+
53+
if (user == "" || pass == "")
54+
{
55+
errorLabel.Text = "Player name or password missing.";
56+
}
57+
else if (!controller.IsPlayer(user))
58+
{
59+
errorLabel.Text = "No such player.";
60+
}
61+
else
62+
{
63+
errorLabel.Text = "Changed password for " + controller.CapitalizePlayerName(user) + ".";
64+
controller.ChangePassword(user, pass);
65+
controller.SavePlayerChanges(user);
66+
}
67+
}
68+
}
69+
}

0 commit comments

Comments
 (0)