diff --git a/website/public/createGroup.php b/website/public/createGroup.php
new file mode 100644
index 0000000..ffeb6e3
--- /dev/null
+++ b/website/public/createGroup.php
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/website/public/group.php b/website/public/group.php
index 72da9c8..84726fa 100644
--- a/website/public/group.php
+++ b/website/public/group.php
@@ -13,13 +13,15 @@
include_once("../queries/group_page.php");
-$group = selectGroupByName($_GET["groupname"]);
-$members = selectGroupMembers(2);
+if(!$group = selectGroupByName($_GET["groupname"])) {
+ header("HTTP/1.0 404 Not Found");
+ header("Location: error/404.php");
+ die();
+}
+
+
+$members = selectGroupMembers($group["groupID"]);
-?>
-
-
-
+
+
+
+
+
+
+
+getClass();
+ $alertMessage = $w->getMessage();
+ }
+}
+
+/* Add your view files here. */
+include("../views/groupAdmin.php");
+
+/* This adds the footer. */
+include("../views/footer.php");
+?>
+
+
diff --git a/website/public/js/chat.js b/website/public/js/chat.js
index 6a027c8..f431b91 100644
--- a/website/public/js/chat.js
+++ b/website/public/js/chat.js
@@ -9,18 +9,25 @@ $(document).ready(function() {
$(".chat-field").hide();
});
+// This function loads the new messages and runs the addMessages function to show them.
function loadMessages() {
+ // If the function is not running elsewhere, run it here.
if (!gettingMessages) {
gettingMessages = true;
+ // Get the messages.
$.post(
"API/loadMessages.php",
$("#lastIDForm").serialize()
).done(function (data) {
+ // Post the messages in the chat.
if (data && data != "[]") {
messages = JSON.parse(data);
addMessages(messages);
$("#lastID").val(messages[messages.length - 1].messageID);
}
+
+ loadUnreadMessages();
+
gettingMessages = false;
});
} else {
@@ -28,7 +35,7 @@ function loadMessages() {
}
}
-
+// Send a message to a friend of the user.
function sendMessage() {
$.post(
"API/sendMessage.php",
@@ -36,43 +43,59 @@ function sendMessage() {
).done(function(response) {
if (response == "frozen") {
alert("Je account is bevroren, dus je kan niet chat berichten versturen. Contacteer een admin als je denkt dat dit onjuist is.");
+ } else if (response == "logged out") {
+ window.location.href = "login.php?url=" + window.location.pathname;
}
+ // Load messages if the message has been send, so it shows in the chat.
+ loadMessages();
});
$("#newContent").val("");
- loadMessages();
}
+// Add messages to the chat.
function addMessages(messages) {
var messagesText = "";
+
+ // Loop over all the messages.
for(var i in messages) {
- // Initialize message variables
+ // Initialize message variables.
var thisDate = new Date(messages[i].creationdate.replace(/ /,"T"));
- var thisTime = thisDate.getHours() + ":" + thisDate.getMinutes();
+ var thisTime = thisDate.getHours() + ":" + ('0' + thisDate.getMinutes()).slice(-2);
var type;
thisDate.setHours(0,0,0,0);
+ // See where the message has been send from, so it shows on the right side.
if (messages[i].destination == $(".destinationID").val()) {
type = "chat-message-self";
} else {
type = "chat-message-other";
}
+
+ // If it is the first message, open the message box and maybe add a year.
if (i == 0) {
+ if (thisDate.getTime() > previousDate.getTime()) {
+ messagesText += '\
+ ';
+ }
previousDate = thisDate;
- messagesText += '\
- ';
+ previousTime = thisTime;
+ previousType = type;
messagesText += '';
previousTime = thisTime;
previousType = type;
+ // If the date is different, add a new date.
if (thisDate > previousDate) {
previousDate = thisDate;
messagesText += '\
@@ -83,8 +106,11 @@ function addMessages(messages) {
';
}
+ // Open the new message.
messagesText += '';
+ // Add all the new created messaged to the chat.
$("#chat-history").append(messagesText);
+ // Scroll down, so the user can see the new messages.
$("#chat-history").scrollTop($("#chat-history")[0].scrollHeight - $('#chat-history')[0].clientHeight);
}
+// Switch to a different user.
function switchUser(userID) {
previousDate = new Date("1970-01-01 00:00:00");
$(".chat-field").show();
@@ -108,6 +137,7 @@ function switchUser(userID) {
$("#friend-item-" + userID).addClass("active-friend-chat");
}
+// Insert a message in the chat, this is used when it is empty.
function sayEmpty() {
$("#chat-history").html("Probeer ook eens foto's en video's te sturen");
}
\ No newline at end of file
diff --git a/website/public/js/friendButtons.js b/website/public/js/friendButtons.js
index 47c476a..87222e9 100644
--- a/website/public/js/friendButtons.js
+++ b/website/public/js/friendButtons.js
@@ -19,24 +19,24 @@ function placeFriendButtons() {
case "0":
value1 = "request";
class1 = "green";
- text1 = "Bevriend";
- icon1 = "fa-handshake-o";
+ text1 = "Word vrienden";
+ icon1 = "fa-user-plus";
break;
case "1":
value1 = userID;
class1 = "green";
text1 = "Chat";
- icon1 = "fa-comment-o";
+ icon1 = "fa-comment";
value2 = "delete";
class2 = "red";
- text2 = "Verwijder";
- icon2 = "fa-times";
+ text2 = "Ontvriend";
+ icon2 = "fa-user-times";
break;
case "2":
value1 = "delete";
class1 = "red";
text1 = "Trek verzoek in";
- icon1 = "fa-cross";
+ icon1 = "fa-times";
break;
case "3":
value1 = "accept";
@@ -51,16 +51,18 @@ function placeFriendButtons() {
}
$buttonContainer.append(
- "");
+ "");
$buttonContainer.append(
- "");
+ "");
- $buttonContainer.children().click(function() {
+ $buttonContainer.find("button").click(function() {
if (isNaN(this.value))
editFriendship(userID, this.value);
else if (this.value != "")
diff --git a/website/public/js/groupButtons.js b/website/public/js/groupButtons.js
index e6ada67..caf3ab8 100644
--- a/website/public/js/groupButtons.js
+++ b/website/public/js/groupButtons.js
@@ -3,31 +3,41 @@ function placeGroupButtons() {
.done(function(data) {
var $buttonContainer = $("div.group-button-container");
- if(data == 'none') {
+ if (data == 'none') {
$buttonContainer.append(
- "