Skip to content

Commit

Permalink
some comments resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldor1510 committed Mar 8, 2024
1 parent 0928514 commit cdb636b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 21 deletions.
4 changes: 3 additions & 1 deletion resources/lib/UnitySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,9 @@ public function getGroupRequests()
"requestor" => $row['requestor'],
"group_type" => $row['group_type'],
"group_name" => $row['group_name'],
"requested_on" => $row['requested_on']
"requested_on" => $row['requested_on'],
"start_date" => $row['start_date'],
"end_date" => $row['end_date']
);
}

Expand Down
8 changes: 4 additions & 4 deletions tools/docker-dev/sql/bootstrap.sql
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ CREATE TABLE `groupRequests` (
`group_name` varchar(1000) NOT NULL,
`requestor` varchar(1000) NOT NULL,
`requested_on` timestamp NOT NULL DEFAULT current_timestamp(),
`start_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`end_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
`start_date` timestamp NULL DEFAULT NULL,
`end_date` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- --------------------------------------------------------
Expand Down Expand Up @@ -256,8 +256,8 @@ CREATE TABLE `groupAttributes` (
`id` int(11) NOT NULL,
`group_type` varchar(1000) NOT NULL,
`group_id` varchar(1000) NOT NULL,
`start_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`end_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
`start_date` timestamp NULL DEFAULT NULL,
`end_date` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
Expand Down
6 changes: 6 additions & 0 deletions webroot/admin/group-mgmt.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<td>Group Type</td>
<td>Requestor</td>
<td>Requestor UID</td>
<td>Start/End Dates</td>
<td>Mail</td>
<td>Requested On</td>
<td>Actions</td>
Expand All @@ -96,6 +97,11 @@
$USER->getTypeNameFromSlug($types, $request['group_type']) . "</div></td>";
echo "<td>" . $request_user->getFirstname() . " " . $request_user->getLastname() . "</td>";
echo "<td>" . $request_user->getUID() . "</td>";
if ($request['start_date'] == null || $request['end_date'] == null) {
echo "<td></td>";
} else {
echo "<td>" . date("jS F, Y", strtotime($request['start_date'])) . " - " . date("jS F, Y", strtotime($request['end_date'])) . "</td>";

Check warning on line 103 in webroot/admin/group-mgmt.php

View workflow job for this annotation

GitHub Actions / PHP_CodeSniffer

webroot/admin/group-mgmt.php#L103

Line exceeds 120 characters; contains 146 characters (Generic.Files.LineLength.TooLong)
}
echo "<td><a href='mailto:" . $request_user->getMail() . "'>" . $request_user->getMail() . "</a></td>";
echo "<td>" . date("jS F, Y", strtotime($request['requested_on'])) . "</td>";
echo "<td>";
Expand Down
40 changes: 24 additions & 16 deletions webroot/panel/new_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</div>
<div id="nameInputBox" style="margin-top: 10px;">
<strong>Name (cannot have spaces)&nbsp;&nbsp;</strong><br>
<input type="text" name="group_name" placeholder="name_of_the_group" style="margin-bottom: 15px"><br>
<input type="text" name="group_name" placeholder="Name of Group" style="margin-bottom: 15px"><br>
<div style="color: red; font-size: 0.8rem; display: none; margin-top: -10px;"
id="groupNameError">Error Occured<br></div>
</div>
Expand Down Expand Up @@ -131,38 +131,46 @@
const time_limited = type_info[2];
let date_selector = document.getElementById('dateSelector');
if (time_limited == 1) {
$("#requestGroupButton").prop("disabled", true);
date_selector.style.display = 'block';
} else if (time_limited == 0) {
$("#requestGroupButton").prop("disabled", false);
date_selector.style.display = 'none';
}
let nameInputBox = document.getElementById('nameInputBox');
if (isNameable == 1) {
$("#requestGroupButton").prop("disabled", true);
nameInputBox.style.display = 'block';
} else if (isNameable == 0) {
$("#requestGroupButton").prop("disabled", false);
nameInputBox.style.display = 'none';
}
});

$("input[type=text][name=group_name]").keyup(function() {
$group_name = $(this).val();
$span = $("#groupNameError");
if ($group_name.includes(" ")) {
$span.text("Invalid name. Make sure to not have spaces.");
$span.show();
if ($group_name.length == 0) {
$("#requestGroupButton").prop("disabled", true);
} else {
$span.hide();
$.ajax({url: "<?php echo $CONFIG["site"]["prefix"] ?>/panel/ajax/check_group_name.php?group_name="
+ $(this).val(), success: function(result) {
if (result == "not available") {
$span.text("Name not available. Try something different.");
$span.show();
} else {
$span.hide();
$("#requestGroupButton").prop("disabled", false);
}
}});
$("#requestGroupButton").prop("disabled", true);
if ($group_name.includes(" ")) {
$span.text("Invalid name. Make sure to not have spaces.");
$span.show();
$("#requestGroupButton").prop("disabled", true);
} else {
$span.hide();
$.ajax({url: "<?php echo $CONFIG["site"]["prefix"] ?>/panel/ajax/check_group_name.php?group_name="
+ $(this).val(), success: function(result) {
if (result == "not available") {
$span.text("Name not available. Try something different.");
$span.show();
$("#requestGroupButton").prop("disabled", true);
} else {
$span.hide();
$("#requestGroupButton").prop("disabled", false);
}
}});
}
}
});

Expand Down

0 comments on commit cdb636b

Please sign in to comment.