Merge branch 'master' into SIMPLICITY_link

SIMPLICITY_link
mrlan 2021-10-18 20:53:16 +08:00
commit f2e74727b7
9 changed files with 157 additions and 32 deletions

View File

@ -146,12 +146,12 @@ if(isset($_SESSION['info_Admin_Users'])) {
<!-- code contributed by Xu Xiaopeng (https://github.com/xxp1999) -->
<div id="menu2" class="container tab-pane fade" style="margin-top:10px" >
<b>Please separate student numbers with spaces.</b><br>
<b>Separate two student numbers with a space.</b><br>
<form action="batch_insert.php" method="post">
<p>
<textarea cols="80" rows="16" name="users" required=""></textarea>
</p>
<input type="submit" class="btn btn-primary" value="Create All"><br>
<input type="submit" class="btn btn-primary" value="Register Students"><br>
</form>
</div>

View File

@ -98,6 +98,92 @@ if( $_SESSION['user_type'] == "Student")
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4">Marked</a>
</li>
<!----------Delete Course Button----------->
<li>
<html>
<body>
<div class="modal fade" id="delcourse">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">Please confirm!</h2>
<button type="button" class="close red" data-dismiss="modal">
<span>&times;</span>
</button>
</div>
<div class="modal-body">
<p>Are you sure about deleting this course? This action can not be reversed!</p>
</div>
<div class="modal-footer">
<form method="POST" action="">
<button type="button" class="btn action-button blue" data-dismiss="modal">Cancel</button>
<input type="submit" name="submit" class="btn action-button red" value="Delete"/>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col">
<button type="button" class="btn action-button red" data-toggle="modal" data-target="#delcourse">Delete Course</button>
</div>
</div>
</div>
</div>
<?php
// Connect to MySQL database
$con = mysqli_connect("localhost", $mysql_username, $mysql_password, "lrr");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(isset($_POST['submit'])){
header("Location: Courses.php");
$result = mysqli_query($con, "DELETE FROM course_students_table WHERE Course_ID='$course_id'");
}
?>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
<style>
/*--------------------[ Delete Course Button ]*/
.action-button {
font-family: 'Pacifico', cursive;
font-size: 18px;
color: #FFF;
text-decoration: none;
}
.red {
background-color: #E74C3C;
border-bottom: 5px solid #BD3E31;
text-shadow: 0px -2px #BD3E31;
}
.blue {
background-color: #4d4dff;
border-bottom: 5px solid #4d4dff;
text-shadow: 0px -2px #4d4dff;
}
</style>
</body>
</html>
</li>
</ul>

View File

@ -23,7 +23,7 @@ $time = time();
if ( (isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"])) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
// 发送文件头部
header("Content-type: $type");
header("Content-Disposition: attachment;filename=$filename");
header('Content-Disposition: attachment;filename="'.urldecode($filename).'"');
header("Content-Transfer-Encoding: binary");
header('Pragma: no-cache');
header('Expires: 0');

View File

@ -18,7 +18,7 @@ if (mysqli_connect_errno()) {
<html>
<header>
<head>
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
<link href="./font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
@ -29,7 +29,7 @@ if (mysqli_connect_errno()) {
<script src="./css/jquery.datetimepicker.min.js" type="text/javascript"></script>
</header>
</head>
<body>

View File

@ -17,7 +17,41 @@ Our mission is to make the experience of submitting assignments great for tens o
# Installation Instructions
Check file INSTALLATION.md (TBA) for details.
## Hui's steps
I spent about two hours on installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS).
LRR needs Apache and MySQL to run. I followed [How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04) to set up these server applications.
LRR uses a database called `lrr`. I need to export existing `lrr` to a plain text file (including many sql commands) and import that text file to the newly created `lrr` database on the new server.
The command for exporting the database is `mysqldump -u mnc -p lrr > lrr_database_dump.txt`.
The command for importing is `mysql -u mnc -p lrr < lrr_database_dump.txt`. Read [How to Import and Export MySQL Databases in Linux](https://phoenixnap.com/kb/import-and-export-mysql-database) for more detail.
LRR also needs to store assignment submissions. We store them in a folder called `../../lrr_submission`. Note that `lrr_submission` is two levels above the project folder (where many PHP files reside). I copied this folder from the existing one. I think it is also OK if you create an empty folder.
We need to set a proper owner and accessibility for `lrr_submission` using the following two commands:
`sudo chown -R www-data:www-data lrr_submission` and `sudo chmod -R g+rw lrr_submission`. Also, remember to change the user name and password in `lrr_submission//KeepItSafe.txt` for the database connection.
The above steps are preparation work. Now we could clone the LRR's repository to `/var/www/html/`.
Rename LRR to lrr. Change the owner of lrr: `sudo chown -R $USER:$USER /var/www/lrr`. Edit apache configure file: `sudo nano /etc/apache2/sites-available/lrr.conf`.
<VirtualHost *:80>
ServerName lrr
ServerAlias www.lrr.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/lrr
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo systemctl reload apache2`.
Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/.
## Enock's steps
Enock has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt).
@ -120,7 +154,12 @@ To submit bug reports or improvement ideas, please ask Hui [lanhui at zjnu.edu.c
## Frequently Asked Questions
Check FAQ.md (TBA) for details.
1. Q: The web application's front page does not show properly, i.e., elements are not well aligned.
A: You missed two folders `css` and `font-awesome`. These folders include third-party js or css files and therefore are not included.
1. Q: What if I do not have any information about the `lrr` database?
A: You could use `lrr(1).sql` or `lrr_database.sql`. It seems `lrr(1).sql` is more complete.

View File

@ -1,4 +1,4 @@
* Student Regisreation Process is now simplyfied, Student Passport/ID checking process skipped as there is no where find that information currenly. The system now checks Student Passport / National ID from users tables insead of verifying from school databse.
* Student Registration Process is now simplified, Student Passport/ID checking process skipped as there is nowhere find that information currently. The system now checks Student Passport / National ID from users tables instead of verifying from school database.

View File

@ -414,7 +414,7 @@ if (!empty($_POST["frm_uploadlab"])) {
$deadline = $deadlinedate." ".$deadlinetime;
$date = date("Y-m-d H:i");
$date = date("Y-m-d H:i:s");
@ -537,7 +537,7 @@ if (!empty($_POST["frm_submitlab"])) {
$url = mysqli_real_escape_string($con, $_POST["url"]);
$deadline = $deadlinedate." ".$deadlinetime;
$date = date("Y-m-d H:i");
$date = date("Y-m-d H:i:s");
// GET UPLOADED FILES
$labName = mysqli_query($con,"SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID=$lab_id");
@ -633,17 +633,17 @@ if (!empty($_POST["frm_submitlab"])) {
$targetfile4 = "";
if(strlen($_FILES['attachment1']['name']) > 2 ) { // why greater than 2???
$targetfile = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment1']['name'];
$targetfile = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment1']['name']);
}
if(strlen($_FILES['attachment2']['name']) > 2 ) {
$targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment2']['name']; }
$targetfile2 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment2']['name']); }
if(strlen($_FILES['attachment3']['name']) > 2 ) {
$targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment3']['name'];}
$targetfile3 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment3']['name']);}
if(strlen($_FILES['attachment4']['name']) > 2 ) {
$targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".$_FILES['attachment4']['name'];
$targetfile4 = "/".$student_id."/".$url."/".$lab_name."/".rawurlencode($_FILES['attachment4']['name']);
}
// When $group_id is not properly initialized, use integer 0 as its value.
@ -729,7 +729,7 @@ if (!empty($_GET["savemarks"])) {
echo " Marks could not be greater than total";
return;
}
$date= date("Y-m-d H:i");
$date= date("Y-m-d H:i:s");
$feedback="<br>@$date : ".$feedback;
$sql="UPDATE `lab_report_submissions` SET `Marks`='$marks',`Status`='$status',"

View File

@ -32,7 +32,7 @@ if (isset($_SESSION["user_fullname"])) {
<form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/>
Student ID / Email
Student ID / Instructor Email
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" />
<br>
Password