1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-07-03 10:28:58 -05:00

Apparently I was working with an older codebase.. Oh well, i've merged the changes..

This commit is contained in:
RaidMax
2017-05-26 23:22:50 -05:00
parent 10075b0d3f
commit c151bcbdae
35 changed files with 2056 additions and 414 deletions

View File

@ -1,38 +1,43 @@
<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 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 style="float: right; display: none;" id="editThreadCaption">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
Edit
</div>
<div class="threadContent">_</div>
</div>
</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">
<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>
<textarea placeholder="Reply content..." id="replyContentBox"></textarea>
<div id="submitReplyButton">
<i class="fa fa-reply" aria-hidden="true"></i>
</div>
</div>
</div>
<script>
@ -49,11 +54,14 @@ $.getJSON("_thread?id=" + parseGet('id'), function(Response) {
$('.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));
$('.threadStart .threadContent').html(decodeURIComponent(Response.Thread.formattedContent));
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);
if (user.user.id == Response.Thread.author.id)
$('#editThreadCaption').css("display", "block");
$.each(Response.Replies, function(i, eachReply) {
var cat = "<div class='threadStart table' style='width: 100%;'> \
@ -71,7 +79,8 @@ $.getJSON("_thread?id=" + parseGet('id'), function(Response) {
</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> \
<i style=\"" + shouldHideAction(eachReply.author) + "\" replyid='" + eachReply.id + "' class=\"fa fa-pencil-square-o actionHover actionEdit\" aria-hidden=\"true\"></i> \
<div class='threadContent'>" + decodeURIComponent(eachReply.formattedContent) + "</div> \
</div> \
</div>";
@ -94,6 +103,24 @@ $('#postReplyClose').click(function(e) {
$("#submitReplyButton").click(function(e) {
e.preventDefault();
if ($('#postReplyContainer').attr("editthread") == "true") {
$.getJSON("_editthread",
{
content : $('#replyContentBox').val(),
title : $('#postReplyContainer').attr("threadtitle"),
id : parseGet("id"),
update: true
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
});
}
else if ($('#postReplyContainer').attr("editreply") != "true") {
$.getJSON("_postthread",
{
content : $('#replyContentBox').val(),
@ -108,6 +135,26 @@ $("#submitReplyButton").click(function(e) {
showErrorMessage(result["errorCode"]);
}
});
}
else {
$.getJSON("_editthread",
{
content : $('#replyContentBox').val(),
title : "Reply",
replyid : $('#postReplyContainer').attr("replyid"),
threadid : parseGet("id")
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
});
}
});
@ -123,4 +170,40 @@ $('#content').on('click', '.actionDelete', function(e) {
});
});
$('#content').on('click', '.actionEdit', function (e) {
$('#postReplyContainer').slideDown('fast');
var id = $(this).attr("replyID")
$.getJSON("_thread?replyid=" + id, function(Response) {
$('#postReplyContainer').find("textarea").html(Response.content);
$('#postReplyContainer').attr("editReply", true);
$('#postReplyContainer').attr("replyid", id);
});
/*$.getJSON("_editthread",
{
replyid: $(this).attr("replyid"),
delete: false
},
function (response) {
if (response.success)
window.location.replace(response.destination);
});*/
});
$("#editThreadCaption").click(function(e) {
$('#postReplyContainer').slideDown('fast');
$.getJSON("_thread?id=" + parseGet("id"), function(Response) {
$('#postReplyContainer').find("textarea").html(Response.Thread.content);
$('#postReplyContainer').attr("editthread", true);
$('#postReplyContainer').attr("threadid", parseGet("id"));
$('#postReplyContainer').attr("threadtitle", Response.Thread.title);
});
});
</script>

View File

@ -2,50 +2,56 @@
</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="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-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-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-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 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>
<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;"/>
<hr style="width: calc(100% + 2em); margin-bottom: -1em; margin-left: -1em;" />
</div>
<div style="width: 100%; text-align: center; margin: 1em 0;"><a href="usercp">User Control Panel</a></div>
<script>
$.getJSON("_userinfo?id=" + parseGet('id'), function(user) {
$.getJSON("_userinfo?id=" + parseGet('id'), function (Response) {
var user = Response.user;
if (user == null)
return false;
$('#userCover').html(user.username);
$('#userCover').css("background-color", Response.profile.bannerColor);
var creationDate = new Date(user.creationDate);
$('#userCreated').html("Joined " + (creationDate.getMonth() + 1) + '-' + creationDate.getDate() + '-' + creationDate.getFullYear());
$('#userLogon').html("Last seen " + checkJustNow(user.lastLoginString));
$('#userLogon').html("Last seen " + user.lastLoginString);
$('#userPostCount').html(user.posts + " Posts");
$('#userEmail a').html(user.email);
$('#userEmail a').attr("href", "mailto:" + user.email);
if (Response.profile.showEmail) {
$('#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);

View File

@ -0,0 +1,64 @@
<div class="alertBox">
</div>
<form id="userCP">
<div class="table">
<div class="tableCell">
<span style="display:flex; margin: 0.25em;">Username</span>
<input type="text" name="username" id="username" />
</div>
<div class="tableCell">
<span style="display:flex; margin: 0.25em;">Banner Color</span>
<input type="color" name="bannercolor" id="bannercolor" />
</div>
</div>
<div class="table">
<div class="tableCell">
<span style="display:flex; margin: 0.25em;">New Password</span>
<input type="password" name="updatedpassword" id="updatedpassword"/>
</div>
<div class="table">
<span style="display:flex; margin: 0.25em;">Repeat New Password</span>
<input type="password" name="updatedpasswordrepeat" id="updatedpasswordrepeat" />
</div>
</div>
<div id="userAvatar" style="margin: 1em 0;">
</div>
<span style="display:flex; margin: 0.25em;">Avatar URL</span>
<input style="width: 35%;" type="text" id="avatarurl" name="avatarurl" /><br />
<input id="updateprofile" type="submit" name="submit" value="Update" />
</form>
<script>
$.getJSON("_userinfo", function(result) {
$("#userAvatar").css('background-image', "".concat("url(", result.user['avatarURL'], ")"));
$("#username").val(result.user.username);
$("#bannercolor").val(result.profile.bannerColor);
$("#avatarurl").val(result.user.avatarURL);
});
$('#updateprofile').click(function (e) {
if (user.id == 0)
return false;
e.preventDefault();
$.getJSON("_updateuser",
{
username : $('#username').val(),
bannercolor : $('#bannercolor').val(),
avatarurl : $('#avatarurl').val(),
updatedpassword : $('#updatedpassword').val(),
updatedpasswordrepeat: $('#updatedpasswordrepeat').val()
},
function(result) {
if (result["errorCode"] == 0)
window.location.replace(result["destination"]);
else {
showErrorMessage(result["errorCode"]);
}
});
});
</script>