IW4M-Admin/Admin/webfront/header.html

209 lines
5.8 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>IW4MAdmin by RaidMax</title>
<meta name="description" content="Administration tool for IW4M servers. IW4MAdmin Created by RaidMax">
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://use.fontawesome.com/9c581fe29b.js"></script>
<link rel="stylesheet" type="text/css" href="/webfront/main.css"/>
<link rel="stylesheet" type="text/css" href="/webfront/mobile.css"/>
</head>
<script>
var user;
$.getJSON("_userinfo", function(response) {
user = response;
$(document).trigger("actionEventLoad");
});
function showErrorMessage(msg)
{
message = "An unknown error occurred!";
switch(msg)
{
case 0:
message = "No error";
break;
case 1:
message = "Permission denied";
break;
case 2:
message = "User exists";
break;
case 3:
message = "Invalid user";
break;
case 4:
message = "Incorrect username or password";
break;
case 5:
message = "No credentials entered";
break;
case 6:
message = "User not authorized";
break;
case 7:
message = "Password too long";
break;
case 8:
message = "Username too long";
break;
case 9:
message = "Bad profile data entered";
break;
case 10:
message = "Invalid session";
break;
case 11:
message = "Bad thread content entered";
break;
case 12:
message = "No thread content entered";
break;
case 13:
message = "Thread content too long";
break;
case 14:
message = "Thread title too long";
break;
case 15:
message = "Invalid thread specified";
break;
case 16:
message = "Could not save reply";
break;
case 17:
message = "Invalid category specified";
break;
case 18:
message = "Empty category";
break;
case 19:
message = "Password do not match";
break;
}
$('.alertBox').html(message).addClass('error').slideDown("fast");
}
function parseGet(val) {
var result = "undefined",
tmp = [];
location.search
.substr(1)
.split("&")
.forEach(function (item) {
tmp = item.split("=");
if (tmp[0] === val) result = decodeURIComponent(tmp[1]);
});
return result;
}
function getColorForLevel(level, name)
{
switch (level)
{
case "User":
case "Guest":
return "<span style='color: rgba(255, 255, 255, 0.85);'>" + name + "</span>";
case "Trusted":
case "Kick":
case "User":
return "<span style='color: rgba(116,147,99,1);''>" + name + "</span>";
case "Flagged":
case "Flag":
case "TempBan":
return "<span style='color: rgba(253, 139, 22, 0.85);'>" + name + "</span>";
case "Banned":
case "Ban":
case "Console":
return "<span style='color: rgba(255, 69, 69, 0.85);'>" + name + "</span>";
case "Moderator":
case "Warning":
case "Report":
return "<span style='color: rgba(235, 211, 101, 0.75);'>" + name + "</span>";
case "Administrator":
return "<span style='color: rgba(236, 130, 222, 0.69);'>" + name + "</span>";
case "SeniorAdmin":
return "<span style='color: rgba(50, 177, 185, 0.85);'>" + name + "</span>";
case "Owner":
return "<span style='color: rgb(0, 122, 204);'>" + name + "</span>";
}
}
function formatMessages(messages)
{
var chats = "";
$.each(messages, function(i, chat) {
chats +=
"<div class='chatPlayerName tableCell'>" + $("<div/>").html(chat['Name']).text()+ ":</div><div class='chatPlayerMessage tableCell'>" + $("<div/>").html(chat['Message']).text() + "</div> \
<div style='display:table-row'></div>"
});
return chats;
}
function getPages()
{
$.getJSON("/pages", function(result){
$.each(result, function(i, page){
if (page['visible'] == true)
$("#navContainer").append("<div class=navEntry><a href=\"" + page['pagePath'] + "\">" + page['pageName'] + "</a></div>");
});
});
}
function shouldHideAction(author)
{
// fixme dynamic
if (author.ranking == null)
return " display: none";
else if (user.user.ranking.name == "Moderator" || user.user.ranking.name == "Administrator" || user.user.id == author.id)
return "";
else {
return " display: none";
}
}
function formatPlayers(players)
{
var p = "";
for (i = 0; i < players.length; i++)
{
p += "<div class='playerName tableCell'><a href=\"/players?id=" + players[1*i]['playerID'] + "\">" + getColorForLevel(players[1*i]['playerLevel'], $("<div/>").html(players[1*i]['playerName']).text()) + "</a></div>";
if (i % 2 == 1 && i != 0 )
p += "<div style='display: table-row'></div>";
}
return p;
}
function checkJustNow(timestr)
{
return timestr
}
function getDate(datestr)
{
var creationDate = new Date(datestr);
return (creationDate.getMonth() + 1) + '-' + creationDate.getDate() + '-' + creationDate.getFullYear();
}
function checkPrivilege()
{
$.getJSON("_userinfo", function (response) { if (response.user.ranking.id != 1) window.location.replace("home"); else $('.infoBox').show(); });
}
</script>
<body>
<div id="header">
<div id="navContainer">
<div id="navHeader">IW4MAdmin</div>
</div>
</div>
<div class="loader"></div>
<div id="content">