1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-11 15:52:25 -05:00

Branch for IW4X practically everything refactored

This commit is contained in:
RaidMax
2017-05-26 17:49:27 -05:00
parent 85a658b987
commit 10075b0d3f
107 changed files with 7426 additions and 3995 deletions

View File

@ -0,0 +1,86 @@
<div id="view">
<div style="float: left;" id="categoryHeader">
</div>
<a href="home"><i class="fa fa-reply themeBlue" aria-hidden="true" style="padding: 0 0.5em; font-size: 24pt; cursor: pointer; margin-top: -5px;"></i></a>
<a href="" id="postThreadButton">
<div style="float: right;" id="postThreadCaption">
<i class="fa fa-plus" aria-hidden="true"></i>
Post
</div>
</a>
<div style="clear: both;"></div>
<hr class="simple"/>
<div id="categoryContainer">
</div>
<hr/>
</div>
<script>
$('#postThreadButton').attr("href", "postthread?id=" + parseGet("id"));
$( document ).on("actionEventLoad", function() {
$.getJSON("_categorythreads?id=" + parseGet("id"), function(response) {
var result = "";
if (response.errorCode != null)
{
if (response.errorCode == 1)
$('#categoryHeader').append('Permission Denied');
else if (response.errorCode == 13)
{
$('#categoryHeader').html("Invalid Category");
$('#postThreadButton').hide();
}
return;
}
if (response.length == 0)
{
$('#categoryHeader').append('No Posts');
return;
}
$.each(response, function(i, thread) {
result +=
"<div class=\"categoryThread table\"> \
<i class=\"fa fa-circle-o themeBlue tableCell\" aria-hidden=\"true\"></i> \
<div class=\"threadTitle tableCell\"><a href=\"thread?id=" + thread["id"] + "\">" + decodeURIComponent(thread["title"]) + "</a><span class=\"threadAuthor tableCell\"><a href=\"user?id=" + thread["author"].id + "\">" + thread["author"].username + "</a></span></div> \
<div class=\"threadTime tableCell\">Last response " + checkJustNow(thread["lastModificationString"]) + "</div> \
<div class=\"threadReplyCount tableCell\"><div class=\"threadReplyBG\">"+ thread.replies +"</div></div> \
<div class=\"threadActions tableCell\" style='vertical-align: middle; " + shouldHideAction(thread.author) +"'><i postid='"+ thread.id + "' class=\"fa fa-times actionHover actionDelete\" aria-hidden=\"true\"></i></div>\
</div>";
});
$('#categoryHeader').html(response[0]["threadCategory"].title);
$('#categoryContainer').append(result);
});
});
$('#content').on('click', '.actionDelete', function(e) {
$.getJSON("_editthread",
{
id : $(this).attr("postid"),
delete : true
},
function(response) {
if (response.success)
window.location.replace(response.destination);
});
});
</script>
<!--
<div id="categoryContainer">
<div class="categoryThread table">
<i class="fa fa-circle-o themeBlue tableCell" aria-hidden="true"></i>
<div class="threadTitle tableCell"><a href="#">This is the particular thread title</a><span class="threadAuthor tableCell"><a href="#">Example Author</a></span></div>
<div class="threadTime tableCell">5 minutes ago</div>
<div class="threadReplyCount tableCell"><div class="threadReplyBG">0</div></div>
</div>-->

View File

@ -0,0 +1,60 @@
<div id="view" class="table">
<div id="threadView" class="tableCell">
<div class="threadBox">
</div>
<hr/>
</div>
<div id="recentView" class="tableCell">
<div id="recentTitle">
Online Users
</div>
<div id="onlineUsers">
</div>
</div>
</div>
<script>
$( document ).ready(function() {
$.getJSON("_recentthreads", function(response) {
var result = "";
$.each(response, function(i, category) {
result += "<div class=\"categoryTitle datThing\"> \
<div class=\"title\"><a href=\"category?id=" + category["categoryID"] + "\">" + category["categoryTitle"] + "</a></div> \
<div class=\"categoryDescription\">" + category["categoryDescription"] + "</div>" +
"</div> \
<div class=\"threadPreview table\">";
$.each(category["recentThreads"], function(i, thread)
{
result += "<div class=\"individualThreadInfo\">";
result += "<i class=\"fa fa-comment\" aria-hidden=\"true\"></i>";
result += "<span class=\"threadTitle tableCell\"><a href=\"thread?id=" + thread.id + "\">" + decodeURIComponent(thread.title) + "</a> &mdash; <a style='opacity: 0.5;' href=\"user?id=" + thread.author.id + "\">" + thread.author['username'] + "</a></span>";
result += "<span class=\"threadInfo tableCell\"><a class=\"themeOrange\" href=\"" + "user?id=" + thread.author['id'] + "\"></a><span class=\"light\">" + checkJustNow(thread.lastModificationString) + "</span></span>";
result += "<div style=\"display: table-row;\"></div>";
result += "</div>";
});
result += "</div>"
});
$('.threadBox').append(result);
});
$.getJSON("_stats", function(response) {
$.each(response.onlineUsers, function(i, user) {
$('#onlineUsers').append('<a href="user?id=' + user.id + '"><p>' + getColorForLevel(user.ranking.name, user.username) + '<p></a>');
});
});
});
</script>

View File

@ -0,0 +1,59 @@
<div class="infoBox" style="display : none;">
<div class="header">
<i class="fa fa-user" aria-hidden="true"></i>
Login</div>
<div class="alertBox">
</div>
<form id="login" method="get">
<input id="username" name="username" type="text"/>
<label for="username">Username</label>
<input id="password" name="password" type="password"/>
<label for="password">Password</label>
<input id="loginButton" value="Login" type="submit"/>
<a href="register">Register</a>
</form>
</div>
<script>
$( document ).ready(function() {
checkPrivilege();
});
function validateInput()
{
var password = $('form #password');
var username = $('form #username');
if (password.val().length < 1) {
showErrorMessage("Password is required!");
return false;
}
if (username.val().length < 1) {
showErrorMessage("Username is required!");
return false;
}
return true;
}
$("#loginButton").click(function(e) {
e.preventDefault();
if (validateInput())
$.getJSON("_login",
{
username : $('form #username').val(),
password : $('form #password').val()
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
}
);
});
</script>

View File

@ -0,0 +1,56 @@
<div id="postThreadContainer">
<div class="infoBox" style="width: 80%;">
<div class="header">
<i class="fa fa-commenting" aria-hidden="true"></i>
<span>Post New Thread</span>
</div>
<div class="alertBox">
</div>
<form>
<div class="table" style="width: 100%;">
<select id="threadCategory" class="tableCell">
</select>
<input placeholder="Enter thread title..." type="text" id="threadTitle" class="tableCell"/>
</div>
<textarea id="threadContent" placeholder="Enter thread content..."/></textarea>
<input type="submit" value="Post" id="submitThreadButton"/>
</form>
</div>
</div>
<script>
$( document ).ready(function() {
$.getJSON("_categories", function(response) {
$.each(response, function(i, category) {
$('select').append("<option value='" + category.id + "'>" + category.title + "</option>");
});
$('select option[value="'+ parseGet("id") +'"]').attr("selected",true);
});
});
$("#submitThreadButton").click(function(e) {
e.preventDefault();
$.getJSON("_postthread",
{
title : $('form #threadTitle').val(),
content : $('form #threadContent').val(),
category : $('select').val(),
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
}
);
});
</script>

View File

@ -0,0 +1,92 @@
<div class="infoBox" style="display:none;">
<div class="header">
<i style="" class="fa fa-user-plus" aria-hidden="true"></i>
Register
</div>
<div class="alertBox">
</div>
<form id="registration" method="get">
<input id="username" name="username" type="text"/>
<input id="hiddenUsername" type="text" name="hiddenUsername" style="display: none;"/>
<label for="username">Username</label>
<input id="password" name="password" type="password"/>
<label for="password">Password</label>
<input id="passwordRepeat" name="passwordRepeat" type="password"/>
<label for="passwordRepeat">Verify Password</label>
<input id="email" name="email" type="text"/>
<label for="email">Email</label>
<input id="registerButton" value="Register" type="submit"/>
</form>
</div>
<script>
$( document ).ready(function() {
checkPrivilege();
});
function validateInput()
{
var password = $('form #password');
var repeatPassword = $('form #passwordRepeat');
var username = $('form #username');
var email = $('form #email');
if (password.val().length < 5) {
showErrorMessage("Passwords must be at least 5 characters!");
return false;
}
if (password.val() != repeatPassword.val()) {
showErrorMessage("Passwords must match!");
return false;
}
if (username.val().length < 3) {
showErrorMessage("Username must contain at least 3 characters!");
return false;
}
if (email.val().length < 3) {
showErrorMessage("Invalid email address!");
return false;
}
return true;
}
$("#registerButton").click(function(e) {
e.preventDefault();
if (validateInput())
$.getJSON("_register",
{
username : $('form #username').val(),
password : $('form #password').val(),
hiddenUsername : $('form #hiddenUsername').val(),
passwordRepeat : $('form #passwordRepeat').val(),
email : $('form #email').val()
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
}
);
});
$('input[type="text"], input[type="password"]').click(function() { $('.alertBox').slideUp("fast"); });
$( document ).ready(function() {
$.getJSON("_userinfo", function(result) {
if (result["matchedName"] != "null")
$('#username, #hiddenUsername').val(result["matchedUsername"]);
});
});
</script>

View File

@ -0,0 +1,126 @@
<div id="threadContainer">
<div id="textNav"><a class="themeBlue" href="home">Home</a> &raquo; </div>
<hr/>
<div class="threadStart table" style="width: 100%;">
<div class="userInfo tableCell">
<div class="userAvatar">
<i class="fa fa-user-secret" aria-hidden="true" style="font-size: 8em;"></i>
</div>
<a class="userProfileLink" href=""><span class="userTitle">_</span></a><br/>
<span style="font-size: 9pt;" class="timePosted">_</span>
</div>
<div class="threadInfo tableCell">
<div class="threadTitle" style="float: left;">_</div>
<div style="float: right;" id="replyThreadCaption">
<i class="fa fa-reply" aria-hidden="true"></i>
Reply
</div>
<div style="clear: both;"></div>
<div class="threadContent">_</div>
</div>
</div>
</div>
<div id="postReplyContainer" style="display: none;">
<hr/>
<div id="postReplyClose">
<i class="fa fa-times" aria-hidden="true"></i>
</div>
<div id="replyContentContainer">
<div class="alertBox">
</div>
<textarea placeholder="Reply content..." id="replyContentBox"></textarea>
<div id="submitReplyButton">
<i class="fa fa-reply" aria-hidden="true"></i>
</div>
</div>
</div>
<script>
$( document ).on("actionEventLoad", function() {
$.getJSON("_thread?id=" + parseGet('id'), function(Response) {
if (Response.errorCode != null)
{
alert('error!');
}
$('#textNav').append('<a class="themeBlue" href="category?id=' + Response.Thread.threadCategory.id + '">' + Response.Thread.threadCategory.title + '</a> &raquo; ' + decodeURIComponent(Response.Thread.title));
$('.threadStart .userTitle').html(Response.Thread.author.username);
$('.threadStart .timePosted').html(getDate(Response.Thread.creationDate));
$('.threadStart .threadTitle').html(decodeURIComponent(Response.Thread.title));
$('.threadStart a.userProfileLink').attr("href", "user?id=" + Response.Thread.author.id);
$('.threadStart .threadContent').html(decodeURIComponent(Response.Thread.content));
if (Response.Thread.author.avatarURL != "")
$('.threadStart .userAvatar').html("").attr("style", "background-image:url('" + Response.Thread.author.avatarURL + "');'");
$('#replyThreadButton').attr("href", "postthread?threadid=" + Response.Thread.id);
$.each(Response.Replies, function(i, eachReply) {
var cat = "<div class='threadStart table' style='width: 100%;'> \
<div class='userInfo tableCell'>";
if (eachReply.author.avatarURL == "")
cat += "<div class='userAvatar'><i class='fa fa-user-secret' aria-hidden='true' style='font-size: 8em;'></i>";
else
cat += "<div class='userAvatar' style=\"background-image:url('" + eachReply.author.avatarURL + "');\">";
cat +=
"</div> \
<a class='userProfileLink' href='user?id="+ eachReply.author.id +"'><span class='userTitle'>" + getColorForLevel(eachReply.author.ranking.name, eachReply.author.username) + "</span></a><br/> \
<span style='font-size: 9pt;' class='timePosted'>" + checkJustNow(eachReply.lastModificationString) + "</span> \
</div> \
<div class='threadInfo tableCell'> \
<i style=\"" + shouldHideAction(eachReply.author) + "\" replyid='" + eachReply.id + "' class=\"fa fa-times actionHover actionDelete\" aria-hidden=\"true\"></i> \
<div class='threadContent'>" + decodeURIComponent(eachReply.content) + "</div> \
</div> \
</div>";
$("#threadContainer").append(cat);
});
});
});
$('#replyThreadCaption').click(function(e) {
e.preventDefault();
$('#postReplyContainer').slideDown('fast');
});
$('#postReplyClose').click(function(e) {
$(this).parent().slideUp('fast');
});
$("#submitReplyButton").click(function(e) {
e.preventDefault();
$.getJSON("_postthread",
{
content : $('#replyContentBox').val(),
title : "Reply",
threadid : parseGet("id")
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
});
});
$('#content').on('click', '.actionDelete', function(e) {
$.getJSON("_editthread",
{
replyid : $(this).attr("replyid"),
delete : true
},
function(response) {
if (response.success)
window.location.replace(response.destination);
});
});
</script>

View File

@ -0,0 +1,56 @@
<div id="userCover" style="display:none;">
</div>
<div id="userInfoBox">
<div class="table" style="width: 100%;">
<div class="tableCell" style="vertical-align:middle; width: 70%;">
<div class="userInfoField table">
<i class="fa fa-user tableCell" aria-hidden="true"></i> <span class="tableCell" id="userCreated">_</span>
</div>
<div class="userInfoField table">
<i class="fa fa-clock-o tableCell" aria-hidden="true"></i> <span class="tableCell" id="userLogon">_</span>
</div>
<div class="userInfoField table">
<i class="fa fa-comment tableCell" aria-hidden="true"></i> <span class="tableCell" id="userPostCount">_</span>
</div>
<div class="userInfoField table">
<i class="fa fa-envelope-o tableCell" aria-hidden="true"></i> <span class="tableCell" id="userEmail"><a href="#" class="themeBlue">_</a></span>
</div>
<div class="userInfoField table">
<i class="fa fa-users tableCell" aria-hidden="true"></i> <span class="tableCell" id="userRank">_</span>
</div>
</div>
<div class="tableCell" style="vertical-align:middle;">
<div id="userAvatar" class="">
<i class="fa fa-user-secret" aria-hidden="true" style="font-size: 19em; margin-top: -56px;"></i>
</div>
</div>
</div>
<hr style="width: calc(100% + 2em); margin-bottom: -1em; margin-left: -1em;"/>
</div>
<script>
$.getJSON("_userinfo?id=" + parseGet('id'), function(user) {
if (user == null)
return false;
$('#userCover').html(user.username);
var creationDate = new Date(user.creationDate);
$('#userCreated').html("Joined " + (creationDate.getMonth() + 1) + '-' + creationDate.getDate() + '-' + creationDate.getFullYear());
$('#userLogon').html("Last seen " + checkJustNow(user.lastLoginString));
$('#userPostCount').html(user.posts + " Posts");
$('#userEmail a').html(user.email);
$('#userEmail a').attr("href", "mailto:" + user.email);
$('#userAvatar').html('');
$('#userAvatar').attr("style", "background-image:url('" + user.avatarURL + "');'");
$('#userRank').html(user.ranking.name);
$('#userCover').slideDown('fast');
});
</script>