Compare commits

..

No commits in common. "master" and "ProjectHomePage" have entirely different histories.

62 changed files with 1774 additions and 4101 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -1 +0,0 @@
allow from all

186
Admin.php
View File

@ -7,15 +7,14 @@ $page = "admin";
include 'Header.php';
?>
<?php
// Only Lecturer or Admin could access this page
if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
die("Sorry. Nothing to see here.");
if ($_SESSION['user_type'] != "Lecturer") {
$_SESSION["info_login"] = "You must log in first.";
echo $_SESSION["info_login"];
header("Location: index.php");
}
?>
<style>
.col-md-4 {
border-right: 1px solid skyblue;
@ -37,21 +36,10 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<hr>
-->
<div class="col-md-6">
<h4> User Account Management </h4>
<hr>
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo " <h4> TA Account Management </h4>
<hr> " ;
echo "<b>TA Accounts </b><br>" ;
}
else if($_SESSION['user_type'] == "Admin"){
echo " <h4> Lecturer Account Management </h4>
<hr> ";
echo "<b>Lecturer Accounts </b><br>";
}
?>
<b>Lecturer / TA Accounts </b><br>
<div class="container">
@ -63,11 +51,11 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2" id="batch_tab">Batch Create New Student Accounts</a>
<a class="nav-link" data-toggle="tab" href="#menu2">Batch Create New Student Accounts</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu1" id="existing_accounts_tab">Existing Accounts</a>
<a class="nav-link" data-toggle="tab" href="#menu1">Existing Accounts</a>
</li>
</ul>
@ -77,45 +65,20 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<div id="home" class="container tab-pane active"><br>
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo "<b>Create TA Accounts </b>";
}
else if($_SESSION['user_type'] == "Admin"){
echo "<b>Create Lecturer Accounts </b>";
}
?>
<form method="post" action="Script.php" id="create_account_form">
<b>Create Lecturer/TA Accounts </b>
<form method="post" action="Script.php">
<input type="hidden" name="frm_createlecturrer" value="true" required="" />
Full Name
Full_Name
<input type="text" name="fullname" placeholder="Full Name" class="form-control" required="">
Email
<input type="text" name="email" placeholder="Email / Student Number" class="form-control" required="">
Passport Number / ID (Used as Initial Password)
Passport_Number / ID (Used as Intial Password)
<input type="text" class="form-control" name="passport" placeholder="Passport No./ID" required="">
<br> User Type :
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo ' <input type="radio" name="type" value="TA" required="" id="role_TA"> TA (Teaching Assistant) ';
}
else if($_SESSION['user_type'] == "Admin"){
echo " <input type='radio' name = 'type' value = 'Lecturer' required = '' id='role_lecturer' > Lecturer ";
}
?>
<input type="submit" class="btn btn-primary" value="Create" id="create_btn"><br>
<input type="radio" name="type" value="Lecturer" required=""> Lecturer
<input type="radio" name="type" value="TA" required=""> T/A
<input type="submit" class="btn btn-primary" value="Create"><br>
<?php
error_reporting(E_ALL);
@ -149,30 +112,19 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
</tr>
<?php
if ($_SESSION['user_type'] == "Lecturer") {
$result = mysqli_query(
$con,
"SELECT * FROM Users_Table WHERE UserType in ('TA')"
);
}
else if($_SESSION['user_type'] == "Admin"){
$result = mysqli_query(
$con,
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer')"
);
}
$result = mysqli_query(
$con,
"SELECT * FROM Users_Table WHERE UserType in ('Lecturer','TA')"
);
while ($row = mysqli_fetch_assoc($result)) {
$pass = $row['Passport_Number'];
$btn = "<button class='btn-primary' onclick=\"updatePass(" . $row['User_ID'] . ",'$pass')\">Reset</button>";
if ($row['Status'] == "Active") {
$newstatus = "Blocked";
$btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"block_account_1\">Block</button>";
$btnBlock = "<button class='btn-danger' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Block</button>";
} else {
$newstatus = "Active";
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\" id=\"activate_account_1\">Activate</button>";
$btnBlock = "<button class='btn-success' onclick=\"blockUser(" . $row['User_ID'] . ",'$newstatus')\">Activate</button>";
}
echo "<tr><td>" . $row['User_ID'] . "</td><td>" . $row['Full_Name'] . "</td><td>" . $row['Email'] . "</td> <td>" . $row['Passport_Number'] . "</td><td>$btn</td><td>$btnBlock</td></tr>";
@ -186,11 +138,11 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<div id="menu2" class="container tab-pane fade" style="margin-top:10px">
<b>Separate two student numbers with a space.</b><br>
<form action="batch_insert.php" method="post" id="batch_form">
<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="Register Students" id="register_btn"><br>
<input type="submit" class="btn btn-primary" value="Register Students"><br>
</form>
</div>
@ -205,16 +157,96 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menub" id="existing_courses">Existing Courses</a>
<a class="nav-link active" data-toggle="tab" href="#menua"> Course Portal </a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menub">Existing Courses</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div id="menua" class="container tab-pane active"><br>
<hr>
<b>Create new Portal </b>
<form method="post" action="Script.php">
<input type="hidden" name="frm_createCourse" value="true" required="" />
Course Name
<input type="text" name="name" placeholder="Course Name" class="form-control" required="">
Course Code
<input type="text" name="code" placeholder="Course Code" class="form-control" required="">
URL (Leave blank to use Course Name)
<input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required="">
Academic Year
<input type="text" name="academic" placeholder="Academic Year" class="form-control" required="">
Faculty <br>
<input type="text" name="faculty" placeholder="Faculty" class="form-control" required="">
Assign Lecturer
<br>
<select name="lecturer" class="form-control">
<?php
$result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='Lecturer'");
if (mysqli_num_rows($result) == 0) {
} else {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['User_ID'];
$name = $row['Full_Name'];
echo "<option value='$id'> $name </option>";
}
} ?>
</select>
Assigned T/A <br>
<select name="ta" class="form-control">
<?php
$result = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
if (mysqli_num_rows($result) == 0) {
} else {
while ($row = mysqli_fetch_assoc($result)) {
$id = $row['User_ID'];
$name = $row['Full_Name'];
echo "<option value='$id'> $name </option>";
}
} ?>
</select>
Verify Joining Students
<input type="radio" name="verify" value="1"> Yes
<input type="radio" name="verify" value="0" checked=""> No
<br>
<input type="submit" class="btn btn-primary" value="Create Portal"><br>
</form>
<?php
error_reporting(E_ALL);
if (isset($_SESSION['info_Admin_Courses'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>';
$_SESSION['info_Admin_Courses'] = null;
}
if (isset($_SESSION['info_Admin_Courses'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Admin_Courses'] . '</div>';
$_SESSION['info_Admin_Courses'] = null;
}
?>
</div>
<div id="menub" class="container tab-pane active"><br>
<div id="menub" class="container tab-pane fade"><br>
<b> Existing Course Portals </b>
<hr>
@ -230,7 +262,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
$result = mysqli_query($con, "SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` , users_table.Full_Name FROM `courses_table` INNER JOIN users_table ON users_table.User_ID=courses_table.Lecturer_User_ID");
if (mysqli_num_rows($result) == 0) {
} else {
$counter = 0;
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Course_Name'];
$code = $row['Course_Code'];
@ -238,7 +269,6 @@ if ($_SESSION['user_type'] != "Lecturer" && $_SESSION['user_type'] != "Admin") {
$lecturer = $row['Full_Name'];
$academic = $row['Academic_Year'];
$c_id = $row['Course_ID'];
$counter += 1;
$resultTA = mysqli_query($con, "SELECT `Course_ID`, `TA`,users_table.Full_Name as TA_NAME FROM `course_ta`
INNER JOIN users_table on users_table.User_ID=course_ta.TA
@ -250,7 +280,7 @@ where course_ta.Course_ID=$c_id");
}
echo "
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php' id='drop_menu_form_$counter'> <select name='ta' class=''>";
<tr> <td>$code - $name</td> <td>$faculty </td> <td>$lecturer</td><td>$ta</td> <td><form method='get' action='Script.php'> <select name='ta' class=''>";
$resultx = mysqli_query($con, "SELECT * FROM Users_Table WHERE UserType='TA'");
if (mysqli_num_rows($resultx) == 0) {
@ -262,7 +292,7 @@ where course_ta.Course_ID=$c_id");
}
}
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign' id='assign_btn_$counter'></form> </td></tr>
echo "</select> <input type='hidden' name='assignTA' value='true'> <input type='hidden' name='id' value='$c_id'> <input type='submit' value='assign'></form> </td></tr>
";
}
} ?>

1101
Course.php

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<?php
if(!empty($_GET["course"]))
{
$course_url = mysqli_real_escape_string($con, $_GET["course"]);
$course_url=$_GET["course"];
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,"
. " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` "
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
@ -105,7 +105,7 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
if($_GET['act']=="edit"){
$getid = mysqli_real_escape_string($con, $_GET["cid"]);
$getid = $_GET["cid"];
$result1 = mysqli_query($con, "SELECT * from lab_reports_table WHERE Lab_Report_ID = '$getid'");
while($row1 = mysqli_fetch_assoc($result1)) {
@ -119,12 +119,12 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
}
if(isset($_POST['frm_uploadlab'])){
$deadlinedate = trim(mysqli_real_escape_string($con, $_POST["deadlinedate"])); // remove spaces
$deadlinetime = trim(mysqli_real_escape_string($con, $_POST["deadlinetime"])); // remove spaces
$instructions = mysqli_real_escape_string($con, $_POST["instructions"]);
$title = mysqli_real_escape_string($con, $_POST["title"]);
$marks = mysqli_real_escape_string($con, $_POST["marks"]);
$type = mysqli_real_escape_string($con, $_POST["type"]);
$deadlinedate = trim( $_POST["deadlinedate"] ); // remove spaces
$deadlinetime = trim( $_POST["deadlinetime"] ); // remove spaces
$instructions = $_POST["instructions"];
$title = $_POST["title"];
$marks = $_POST["marks"];
$type = $_POST["type"];
$Deadline = $deadlinedate." ".$deadlinetime;
$date = date("Y-m-d H:i");
@ -153,14 +153,14 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
Deadline Date/Time
Dealine Date/Time
<div class='row'>
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Date : ""; ?>"> </div>
<div class='col-md-5'> <input type='text' id='time' class='form-control' name='deadlinetime' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Time : ""; ?>"> </div>
</div>
Title
<input type='text' name='title' placeholder='Title' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Title : ""; ?>">
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="<?php echo isset($_GET['act']) && $_GET['act']=="edit" ? $Title : ""; ?>">
Instructions
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' ><?php echo isset($_GET['act']) && $_GET['act']=='edit' ? $Instructions : ''; ?></textarea>
Marks
@ -213,14 +213,14 @@ New Date/Time <br><input type="date" name="date" required=""> <input type="time"
<input type='hidden' name='course_id' value='<?php echo "$id" ?>' required=''/>
<input type='hidden' name='url' value='<?php echo ".$course_url." ?>' required=''/>
Deadline Date/Time
Dealine Date/Time
<div class='row'>
<div class='col-md-7'><input type='date' id='date' name='deadlinedate' placeholder='' class='form-control' required='' value=""> </div>
<div class='col-md-5'> <input type='time' class='form-control' name='deadlinetime' value=""> </div>
</div>
Title
<input type='text' name='title' placeholder='Title' class='form-control' required='' value="">
<input type='text' name='title' placeholder='Ttle' class='form-control' required='' value="">
Instructions
<textarea name='instructions' placeholder='Assignment Instructions' class='form-control' required='' value=""></textarea>
Marks
@ -552,32 +552,27 @@ if( $_SESSION['user_type']=="Student")
<?php
error_reporting(0);
$student_id= $_SESSION['user_student_id'];
// current academic year - i.e 2021 - 2022 , so we will show in search result:
// course containing either 2021 or 2022 as academic year.
$oldest_academic_year = date('Y') - 1;
if(!empty($_GET["search"]) || !empty($_GET["faculty"]))
{
$search = trim(mysqli_real_escape_string($con, $_GET["search"]));
$search = strtoupper($_GET['search']);
$faculty = mysqli_real_escape_string($con, $_GET["faculty"]);
$search = trim($_GET["search"]);
$faculty=$_GET["faculty"];
// the user has not entered something under "Find course by Code"
if($faculty=="")
{
echo "<h4> Search Results for Course Code $search</h4><hr>";
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,"
. " `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` "
. " , users_table.Full_Name FROM `courses_table` INNER JOIN users_table"
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
. " ON users_table.User_ID=courses_table.Lecturer_User_ID where Course_Code like '%{$search}%' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id)");
}
// the user has entered something under "Find course by Code"
else
{
echo "<h3> Find Courses under faculty $faculty</h3>";
$result = mysqli_query($con,"SELECT `Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`,
`Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members`
, users_table.Full_Name FROM `courses_table` INNER JOIN users_table
ON users_table.User_ID=courses_table.Lecturer_User_ID where Academic_Year >= $oldest_academic_year and Faculty='$faculty' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id) order by Academic_Year desc");
ON users_table.User_ID=courses_table.Lecturer_User_ID where Faculty='$faculty' and courses_table.Course_ID not in (select course_id from course_students_table where Student_ID=$student_id)");
}
@ -610,7 +605,7 @@ if( $_SESSION['user_type']=="Student")
}
}
}
// Otherwise, list the student's joined courses (already done), in reverse chronological order
echo "<h4> My Courses </h4>";
$result = mysqli_query($con,"SELECT users_table.Full_Name, course_students_table.Status, courses_table.Course_ID, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members` FROM `courses_table`
INNER JOIN users_table
@ -618,7 +613,7 @@ INNER JOIN users_table
INNER JOIN course_students_table on course_students_table.Course_ID=courses_table.Course_ID
where course_students_table.Student_ID=$student_id order by Academic_Year desc");
where course_students_table.Student_ID=$student_id");
if(mysqli_num_rows($result)==0)
{
@ -636,7 +631,7 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
if($Status=="Joined")
{
echo "<a href='~\..\Course.php?url=$url'> <div class='btn btn-default' style='word-wrap:break-word'>
echo "<a href='~\..\Course.php?url=$url'> <div class='btn btn-default' style='word-wrap:break-word'>
($code) - $name <br>($url) &nbsp;&nbsp;&nbsp; <i class='fa fa-check-circle'></i> $Status &nbsp;&nbsp;&nbsp;&nbsp; <a href='~\..\Course.php?url=$url' class='btn-sm btn-primary'> Open</a>
<br> <span style='font-size:8pt'>Faculty : $faculty Year : $academic Lecturer :$lecturer </span></div></a>
";
@ -683,19 +678,17 @@ INNER JOIN course_students_table on course_students_table.Course_ID=courses_tabl
<div class='row'>
<div class='col-md-10'>
<div class='row'><div class='col-md-6'> Find course by Code
<input type='text' class='form-control' name='search' maxlength='11' placeholder='Enter Course Code'>
<input type='text' class='form-control' name='search' placeholder='Enter Course Code'>
</div><div class='col-md-6'>
List courses by faculty
<select name='faculty' class='form-control'>";
$result = mysqli_query($con,"SELECT DISTINCT(Faculty) as Faculty FROM `courses_table`");
if(mysqli_num_rows($result)==0){
} else {
echo"<option value=''> Search by faculty </option>";
while($row = mysqli_fetch_assoc($result)) {
if(mysqli_num_rows($result)==0)
{} else { while($row = mysqli_fetch_assoc($result)) {
$fname=$row['Faculty'];
echo " <option value='$fname'> $fname </option>";
echo "<option value=''> Search by faculty </option> <option value='$fname'> $fname </option>";
}}
echo "</select></div></div>

View File

@ -7,11 +7,6 @@ session_start();
// 修改这一行设置你的文件下载目录
// IMPORTANT: Do not delete the following conditional test
if (strpos($_GET['file'], "../") !== false) { // 检查是否有 ../,防止用户构造路径,访问某个他不应该访问的目录
die("Sorry. Nothing to download.");
}
$file = "./../../lrr_submission".$_GET['file'];
$filename = basename($file);
@ -25,7 +20,7 @@ $type = filetype($file);
$today = date("F j, Y, g:i a");
$time = time();
if ((isset($_SESSION["user_student_id"]) && strpos($file, $_SESSION["user_student_id"]) > 0) || $_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA" ) {
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="'.urldecode($filename).'"');

View File

@ -22,12 +22,6 @@ if (mysqli_connect_errno()) {
<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" />
<link href="./css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- *this css file can be used across all the websites
and any new css class can be added there.
* The reason is to make the css code reusable.
* the css file is used by submissions.php
-->
<link href = "./css/main.css" rel = "stylesheet" type = "text/css" />
<script src="./css/jquery.min.js" type="text/javascript"></script>
<script src="./css/bootsrap.min.js" type="text/javascript"></script>
@ -38,7 +32,7 @@ if (mysqli_connect_errno()) {
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark" style="padding-left:150px;padding-right:150px;margin:auto;">
<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;height:30px;"> LRR </a>
<a class="navbar-brand" href="~\..\index.php"> <img src="logo.png" style="width:30px;heigh:30px;"> LRR </a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor02" aria-controls="navbarColor02" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
@ -70,7 +64,7 @@ if (mysqli_connect_errno()) {
<?php
if ($_SESSION['user_type'] == "Lecturer") {
echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\" id=\"admin_tab\">Admin </a>";
echo "&nbsp;&nbsp;&nbsp; <i class=\"fa fa-cog\" style=\"color:#fff;\"> </i> &nbsp;<a style='color:#fff !important' href=\"~\..\Admin.php\">Admin </a>";
}
?>

View File

@ -2,6 +2,6 @@
// https://stackoverflow.com/questions/33999475/prevent-direct-url-access-to-php-file
if (!isset($_SERVER['HTTP_REFERER']) ) {
/* choose the appropriate page to redirect users */
die( header( 'location: logout.php' ) );
die( header( 'location: index.php' ) );
}
?>

151
README.md
View File

@ -1,34 +1,32 @@
# About LRR
LRR (Lab Report Repository) is an online software application for course instructors to post, receive and mark assignments, and for students to submit assignments, or submit re-marking requests.
LRR (Lab Report Repository) is an online software application for posting assignments, submitting assignments and marking (re-marking) assignments.
This software was originally developed by Mahomed Nor in 2018, a graduate student in the Department of Computer Science at the Zhejiang Normal University,
This software was originally developed by by Mahomed Nor, a graduate student in the Department of Computer Science at the Zhejiang Normal University,
while he was taking a graduate course called **Advanced Software Engineering** (http://lanlab.org/course/2018f/se/homepage.html).
The LRR's project home page is at http://121.4.94.30/homepage/. For potential project contributors, we recommend that you browse its home page first to familiarize yourself with the project.
The LRR's project home page is at http://118.25.96.118/nor/homepage/index.html.
# Mission
Our mission is to make the experience of submitting assignments great for tens of hundreds of students in the department of computer science at the Zhejiang Normal University.
Our mission is to make the experience of submitting assignments great for tens of hundreds of students in the department of computer science at the Zhejiang Normal University (Jinhua City, Zhejiang Province).
# Installation Instructions
## Hui steps
## Hui's steps
I spent about two hours installing LRR to a bare, remote Ubuntu server (Ubuntu 20.04 LTS).
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. [How to install and configure PHP](https://ubuntu.com/server/docs/programming-php) is also a good guide.
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`. So create this database using MySQL root account. Open MySQL's prompt using `sudo mysql`. Create the database using command `CREATE DATABASE lrr;`, and grant all privileges to MySQL user `lrr` using command `GRANT ALL PRIVILEGES ON lrr.* TO 'mnc'@'localhost' WITH GRANT OPTION;`. If MySQL user mnc does not exist, create it using command `CREATE USER 'mnc'@'localhost' IDENTIFIED BY 'password'`.
To facilitate data migration, I need to export the 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`, where mnc after -u is MySQL's username, and lrr after -p is the database name.
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. Do not have lrr_database_dump.txt? You can use lrr_database.sql in this repo instead.
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:
@ -51,9 +49,9 @@ Enable the site lrr: `sudo a2ensite lrr`. Restart the apache server: `sudo syst
Visit the LRR application by entering this URL in a web browser: http://121.4.94.30/.
## Enock steps
## Enock's steps
Enock, a graduate student here, has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt).
Enock has made a tutorial about how he deployed LRR to a remote server (http://lanlab.org/course/2021s/spm/PuTTY-Server.txt).
@ -61,20 +59,20 @@ Enock, a graduate student here, has made a tutorial about how he deployed LRR to
# Current Status
This software has been actively used by students who took or are
taking courses taught by Hui, e.g., Introduction to Software
Engineering, Introduction to Object-oriented analysis and design,
Advanced Software Engineering, Software Architecture, and Software
Project Management.
taking courses (Introduction to Software Engineering and Software
Project Management) taught by Hui.
There are more than 500 student accounts created since its first
There are more than 200 student accounts created since its first
launch in 2018.
A running instance of this software is at http://118.25.96.118/nor/
There are about 40 bugs (most being CRITICAL) that remain unresolved
before LRR can hit its Beta release. See the section *The Bug
Tracker* for more detail. Currently, there are a few students who are
taking my Advanced Software Engineering course) working on these bugs.
before LRR can hit its beta release. See the section *The Bug
Tracker* for more detail. Currently, there are a few groups (formed
by students who are taking Software Project Management) working on
these bugs.
@ -82,15 +80,16 @@ taking my Advanced Software Engineering course) working on these bugs.
We use Bugzilla to track LRR's bugs and feature requests.
Most bugs are [recorded on Bugzilla](http://118.25.96.118/bugzilla/buglist.cgi?bug_status=__all__&list_id=1319&order=Importance&product=Lab%20Report%20Repository%20%28nor%20houzi%29&query_format=specific).
Most bugs of this software are recorded on the bug tracker for LRR:
http://118.25.96.118/bugzilla/describecomponents.cgi?product=Lab%20Report%20Repository%20%28nor%20houzi%29
# TODO
- [Priority low] *Receiving email for password resetting*. Password resetting link is not always sent successfully.
- *Receiving email for password resetting*. Password resetting link is not always sent successfully.
- [Priority medium] *Discuss how assignments should be stored?* `/student-number/course-code/semester/section-number/assignement-title/submission.txt`
- *How assignements should be stored?* Creating sub-directories on all student submissions course-code/semester/section-number. (/student-number/course-code/semester/section-number/assignement-title/submission.txt)
- [SOLVED] Editing the assignment title after uploading a new assignment (instructor).
@ -106,15 +105,24 @@ We welcome your participation in this project.
Your participation does not have to be in the form of contributing code. You could help us on
ideas, suggestions, documentation, etc.
You can fork this project and start working on your fork. After you are done, please create a pull request so that we could review your changes and give you feedback.
You will use the feature-branching workflow (see below).
The main point of this workflow is
that you work on a branch on your local drive, push that branch to a remote
repository, and create a Pull Request (i.e., Pull Me Request) at
for other people to review your changes. If everything is
You need to be an invited member of *Lan Laboratory* before you can
push your feature branch or bugfix branch to the central reops at
https://github.com/lanlab-org
Send Hui (lanhui at zjnu.edu.cn) an email message including your
GitHub account name so that he could invite you to be a member of *Lan
Laboratory*.
As of March 31 2020, there are 30 members in *Lan Laboratory* (https://github.com/orgs/lanlab-org/people).
You will use the feature-branching workflow (see below) when
interacting with the central repo. The main point of this workflow is
that you work on a branch on your local drive, push that branch to the
central repo, and create a Pull Request (i.e., Pull Me Request) at
GitHub for other people to review your changes. When everything is
OK, then *someone* could merge your changes to the master branch in the
central repository.
central repo.
I believe that *code review* at the Pull Request stage is important
for both improving code quality and improving team quality.
@ -125,46 +133,39 @@ for both improving code quality and improving team quality.
We will use the feature-branching workflow for collaboration. The
idea is that you make your own branch, work on it, and push this branch to
the remote, online repository for code review.
the central repo for review.
Check the section **The feature-branching workflow** in the following link for more detail:
https://github.com/spm2020spring/TeamCollaborationTutorial/blob/master/team.rst
## Testing
Make sure your changes can pass all the tests in folder [./test](http://121.4.94.30:3000/mrlan/LRR/src/branch/master/test).
## Communications Method
To submit bug reports or improvement ideas, please contact Hui [lanhui at zjnu.edu.cn]. He could open a Bugzilla account for you.
For real-time communication, check our IRC channel `#lrr` at irc.freenode.org. Check this link http://lanlab.org/course/2020s/spm/irc-instruction.txt
for how to use IRC.
To submit bug reports or improvement ideas, please ask Hui [lanhui at zjnu.edu.cn] to open a Bugzilla account for you.
We can also communicate through pull requests. You make a pull request, I review it and comment on it, and you revise your pull request until everyone is happy so that your changes get merged to the master branch.
## Frequently Asked Questions
1. Q: The web application's front page does not show properly, i.e., elements are not well aligned.
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_database.sql` to make a new database.
A: You could use `lrr(1).sql` or `lrr_database.sql`. It seems `lrr(1).sql` is more complete.
# Related GitHub Repositories
# The Original GitHub Repo
- The original repository: https://github.com/EngMohamedNor/LabReportRepo
- The Lan Laboratory repository: https://github.com/lanlab-org/LRR
- Zhan Shenchen repository: https://github.com/SawiMg/Seleium
- Ibrahim repository: https://github.com/hema-001/LRR
The original GitHub Repo is at https://github.com/EngMohamedNor/LabReportRepo
# Contributor List
@ -173,57 +174,47 @@ We can also communicate through pull requests. You make a pull request, I revie
GitHub Account - Full Name - Student number
CODEwithZAKI - Omar Mohamud Mohamed - 2020041
CODEwithZAKI - Omar Mohamud Mohamed - 202025800041
BloudYoussef - Khayat Youssef - 2020042
BloudYoussef - Khayat Youssef - 202025800042
TanakaMichelle - Tanaka Michelle Sandati - 2017134
TanakaMichelle - Tanaka Michelle Sandati - 201732120134
WhyteAsamoah - Yeboah Martha Asamoah - 2017135
WhyteAsamoah - Yeboah Martha Asamoah - 201732120135
xiaoyusoil - ZhengXiaoyu - 2017110
xiaoyusoil - ZhengXiaoyu - 201732120110
Benny123-cell - ZhangBin - 2017127
Benny123-cell - ZhangBin - 201732120127
421281726 - LiJiaxing - 2017118
421281726 - LiJiaxing - 201732120118
zhenghongyu-david - ZhengHongyu - 2017128
zhenghongyu-david - ZhengHongyu - 201732120128
wkytz - YeHantao - 2017125
wkytz - YeHantao - 201732120125
zego000 - GaoZeng - 2017117
zego000 - GaoZeng - 201732120117
Richard1427 - XieJiacong - 2017123
Richard1427 - XieJiacong - 201732120123
yutengYing - YingYuteng - 2017126
yutengYing - YingYuteng - 201732120126
Samrusike - Samantha Rusike - 2016140
Samrusike - Samantha Rusike - 201632120140
*enockkays* <enockkhondowe94@yahoo.com>
*Teecloudy* - Ashly Tafadzwa Dhani - 201150
*Teecloudy* - Ashly Tafadzwa Dhani - 201632120150
GuedaliaBonheurSPM - Guedalia Youma - 2019221
GuedaliaBonheurSPM - Guedalia Youma - 201925800221
ACorneille - Alimasi Corneille - 2019168
ACorneille - Alimasi Corneille - 201925800168
Tabithakipanga - Kipanga Dorcas - 2019170
Tabithakipanga - Kipanga Dorcas - 201925800170
Mary-AK - Mary Akussah Doe - 2019173
Mary-AK - Mary Akussah Doe - 201925800173
pkkumson - Kumson Princewill Kum - 2019166
pkkumson - Kumson Princewill Kum - 201925800166
Twizere - Twizere Pacifique - 2019174
Twizere - Twizere Pacifique - 201925800174
Nicole-Rutagengwa - Nicole Rutagengwa - 2019169
Nicole-Rutagengwa - Nicole Rutagengwa - 201925800169
*hema-001* - Ibrahim Mohamed Ibrahim Ismail - omitted
*SawiMg* - Zhan Shenchen - omitted
# References
- 詹沈晨. (2020). [网页程序测试自动化 (Selenium) 测试效率](http://lanlab.org/ZhanShenchen-On-Automated-Web-Application-Test-Efficiency-with-Selenium.doc)
- Ibrahim. (2021). [Defect analysis for LRR](http://lanlab.org/thesis/Defect-Analysis-for-LRR.docx)

View File

@ -8,8 +8,8 @@
include 'Header.php';
$token = htmlspecialchars($_GET['token']);
$email = htmlspecialchars($_GET['email']);
$token=$_GET['token'];
$email=$_GET['email'];
?>
<div class="row">

View File

@ -34,37 +34,39 @@ function is_valid_student_number($student_id)
}
// ############################### SIGN UP ##################################
if (!empty($_POST["form_signup"])) {
$student_id = trim(mysqli_real_escape_string($con, $_POST["user_student_id"]));
if (!empty($_POST["frm_signup_1"])) {
$student_id = trim(mysqli_real_escape_string($con, $_POST["student_id"]));
// validate student number
if (!is_valid_student_number($student_id)) {
$_SESSION["info_signup"] = "Invalid student number.";
header("Location: signup.php");
$_SESSION["info_signup1"] = "Invalid student number.";
header("Location: index.php");
return;
}
// Check if this student number is a legal one
$result = mysqli_query($con, "SELECT * FROM `students_data` WHERE Student_ID='$student_id'");
if (mysqli_num_rows($result) == 0) {
$_SESSION["info_signup"] = "Your entered student number could not be verified. Please contact Student Management Office <lanhui at zjnu.edu.cn>. Thanks.";
header("Location: signup.php");
$_SESSION["info_signup1"] = "Your entered student number could not be verified. Please contact Student Management Office <lanhui at zjnu.edu.cn>. Thanks.";
header("Location: index.php");
return;
}
// Check if the student number isn't already registered
$student_result = mysqli_query($con, "SELECT * FROM `users_table` WHERE Student_ID='$student_id'");
if (mysqli_num_rows($student_result) > 0) {
$_SESSION["info_signup"] = "This Student ID is already in use! Please contact Student Management Office <lanhui at zjnu.edu.cn> for help.";
$result98 = mysqli_query($con, "SELECT * FROM `users_table` WHERE Student_ID='$student_id'");
if (mysqli_num_rows($result98) == 0) {
$_SESSION['user_student_id'] = $student_id;
header("Location: signup.php");
return;
} else {
$_SESSION["info_signup1"] = "This Student ID is already in use! Please contact Student Management Office <lanhui at zjnu.edu.cn> for help.";
header("Location: index.php");
return;
}
}
// ############################### CREATE STUDENT USER ##################################
if (!empty($_POST["form_signup"])) {
if (!empty($_POST["frm_signup_2"])) {
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
$student_id = mysqli_real_escape_string($con, $_POST["user_student_id"]);
$email = mysqli_real_escape_string($con, $_POST["email"]);
@ -73,11 +75,10 @@ if (!empty($_POST["form_signup"])) {
$_SESSION['user_fullname'] = $fullname;
$_SESSION['user_type'] = "Student";
$_SESSION['user_email'] = $email;
$_SESSION['user_student_id'] = $student_id;
// check confirmed password
if (strcasecmp($password, $confirmpassword) != 0) {
$_SESSION['info_signup'] = "Password confirmation failed.";
$_SESSION['info_signup2'] = "Password confirmation failed.";
$_SESSION['user_fullname'] = null; // such that Header.php do not show the header information.
header("Location: signup.php");
return;
@ -85,7 +86,7 @@ if (!empty($_POST["form_signup"])) {
// validate email
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$_SESSION['info_signup'] = "Invalid email address.";
$_SESSION['info_signup2'] = "Invalid email address.";
header("Location: signup.php");
return;
}
@ -98,7 +99,7 @@ if (!empty($_POST["form_signup"])) {
// check for strong password
if (!$containsAll) {
$_SESSION['info_signup'] = "Password must have at least characters that include lowercase letters, uppercase letters, numbers and special characters (e.g., !?.,*^).";
$_SESSION['info_signup2'] = "Password must have at least characters that include lowercase letters, uppercase letters, numbers and sepcial characters (e.g., !?.,*^).";
header("Location: signup.php");
return;
}
@ -106,7 +107,7 @@ if (!empty($_POST["form_signup"])) {
// check if email is taken
$result = mysqli_query($con, "SELECT * FROM users_table WHERE email='$email'");
if (mysqli_num_rows($result) != 0) {
$_SESSION["info_signup"] = "Email address " . $email . " is already in use.";
$_SESSION["info_signup2"] = "Email adress " . $email . " is already in use.";
$_SESSION['user_fullname'] = null;
header("Location: signup.php");
return;
@ -146,7 +147,7 @@ if (!empty($_POST["frm_login"])) {
$password = mysqli_real_escape_string($con, $_POST["password"]);
$result = mysqli_query($con, "SELECT * FROM users_table WHERE (Student_ID='$user') OR (Email='$user')");
if (mysqli_num_rows($result) == 0) {
$_SESSION["info_login"] = "Invalid user name information.";
$_SESSION["info_login"] = "Inavlid user name information.";
echo $_SESSION["info_login"];
header("Location: index.php");
} else {
@ -195,6 +196,7 @@ if (!empty($_POST["frm_recover_password"])) {
// validate student number
if (strlen($student_id) != 12 || is_numeric($student_id) == FALSE) {
$_SESSION["info_recover_password"] = "Invalid student number.";
#echo "Invalid student number.";
header("Location: recover_password.php");
return;
}
@ -246,7 +248,7 @@ if (!empty($_POST["frm_reset_password"])) {
// Password Update
$hashed_password = hash('sha512', $password);
$sql = "UPDATE users_table set HashPassword='$hashed_password' where User_ID='$userid';";
$sql = "UPDATE users_table set HashPassword='$hashed_password' where User_ID=$userid;";
if ($con->query($sql) === TRUE) {
error_reporting(0);
@ -268,22 +270,21 @@ if (!empty($_POST["frm_createlecturrer"])) {
$email = mysqli_real_escape_string($con, $_POST["email"]);
$fullname = mysqli_real_escape_string($con, $_POST["fullname"]);
$type = mysqli_real_escape_string($con, $_POST["type"]);
$password = mysqli_real_escape_string($con, $_POST["passport"]);
$password = $passport;
// check if email is taken
$result = mysqli_query(
$con,
"SELECT * FROM Users_Table WHERE email='$email'"
);
if (mysqli_num_rows($result) != 0) {
$_SESSION["info_Admin_Users"] = "Email address : " . $email . " is already in use.";
$_SESSION["info_Admin_Users"] = "Email adress : " . $email . " is already in use.";
header("Location: Admin.php");
}
$password_hash = password_hash("$password", PASSWORD_DEFAULT);
$sql = "INSERT INTO `users_table`(`Email`, `Password`, `Full_Name`, `UserType`) VALUES "
. "('$email','$password_hash','$fullname','$type')";
. "('$email','$password','$fullname','$type')";
if ($con->query($sql) === TRUE) {
$_SESSION["info_Admin_Users"] = $type . " user created successfully. Use email " . $email . " as account name and $password as password.";
$_SESSION["info_Admin_Users"] = $type . " user Created successfully : email " . $email . " and $password as Password.";
header("Location: Admin.php");
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -430,7 +431,7 @@ if (!empty($_POST["frm_uploadlab"])) {
$sql = "INSERT INTO `lab_reports_table`(`Course_ID`, `Posted_Date`, `Deadline`, `Instructions`,
`Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`,Marks,Type)
VALUES ('$course_id','$date','$deadline','$instructions','$title','$targetfile','$targetfile2','$targetfile3','$targetfile3','$marks','$type')";
VALUES ('$course_id','$date','$deadline','$instructions','$title','$targetfile','$targetfile2','$targetfile3','$targetfile3',$marks,'$type')";
if ($con->query($sql) === TRUE) {
@ -467,7 +468,7 @@ if (!empty($_POST["frm_submitlab"])) {
$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'");
$labName = mysqli_query($con, "SELECT * FROM `lab_reports_table` WHERE Lab_Report_ID=$lab_id");
while ($row = mysqli_fetch_assoc($labName)) {
$lab_name = $row['Title'];
$_SESSION['Sub_Type'] = $row['Type']; // submission type, either Individual or Group
@ -571,13 +572,13 @@ if (!empty($_POST["frm_submitlab"])) {
$group_id = 0; // FIXME
}
$sql1 = "DELETE FROM lab_report_submissions where Lab_Report_ID='$lab_id' and Student_id='$student_id' and Course_Group_id='$group_id'";
$sql1 = "DELETE FROM lab_report_submissions where Lab_Report_ID=$lab_id and Student_id=$student_id and Course_Group_id=$group_id";
if ($con->query($sql1) === TRUE) {
}
$sql = "INSERT INTO `lab_report_submissions`(`Submission_Date`, `Lab_Report_ID`, `Student_id`,"
. " `Course_Group_id`, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Status`, `Title`,`Remarking_Reason`)"
. " VALUES ('$date','$lab_id','$student_id','$group_id','$targetfile','$instructions','$targetfile2','$targetfile3','$targetfile4',"
. " VALUES ('$date',$lab_id,$student_id,$group_id,'$targetfile','$instructions','$targetfile2','$targetfile3','$targetfile4',"
. "'Pending','$title','')";
if ($con->query($sql) === TRUE) {
@ -595,9 +596,9 @@ if (!empty($_POST["frm_submitlab"])) {
// JOIN COURSE
if (!empty($_GET["JoinCourse"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$student_id = mysqli_real_escape_string($con, $_GET["std"]);
$joining = mysqli_real_escape_string($con, $_GET["joining"]);
$id = $_GET["id"];
$student_id = $_GET["std"];
$joining = $_GET["joining"];
$status = "Pending";
if ($joining == 0) {
@ -624,12 +625,12 @@ if (!empty($_GET["JoinCourse"])) {
if (!empty($_GET["savemarks"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$marks = mysqli_real_escape_string($con, $_GET["marks"]);
$total = mysqli_real_escape_string($con, $_GET["total"]);
$feedback = mysqli_real_escape_string($con, $_GET["feedback"]);
$header = mysqli_real_escape_string($con, $_GET["header"]);
$labid = mysqli_real_escape_string($con, $_GET["labid"]);
$id = $_GET["id"];
$marks = $_GET["marks"];
$total = $_GET["total"];
$feedback = $_GET["feedback"];
$header = $_GET["header"];
$labid = $_GET["labid"];
$status = "Marked";
if ($marks > $total) {
@ -658,14 +659,14 @@ if (!empty($_GET["savemarks"])) {
#Update Report Visibility
if (!empty($_GET["updatevisibility"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$marks = mysqli_real_escape_string($con, $_GET["marks"]);
$total = mysqli_real_escape_string($con, $_GET["total"]);
$status = mysqli_real_escape_string($con, $_GET["status"]);
$header = mysqli_real_escape_string($con, $_GET["header"]);
$labid = mysqli_real_escape_string($con, $_GET["labid"]);
$id = $_GET["id"];
$marks = $_GET["marks"];
$total = $_GET["total"];
$status = $_GET["status"];
$header = $_GET["header"];
$labid = $_GET["labid"];
$sql = "UPDATE `lab_report_submissions` SET `Visibility`='$status' WHERE Submission_ID='$id'
$sql = "UPDATE `lab_report_submissions` SET `Visibility`='$status' WHERE Submission_ID=$id
";
if ($con->query($sql) === TRUE) {
@ -681,18 +682,18 @@ if (!empty($_GET["updatevisibility"])) {
if (!empty($_GET["remarking"])) {
$id = htmlspecialchars(mysqli_real_escape_string($con, $_GET["id"]));
$url = htmlspecialchars(mysqli_real_escape_string($con, $_GET["url"]));
$id = $_GET["id"];
$url = $_GET["url"];
$status = htmlspecialchars(mysqli_real_escape_string($con, $_GET["status"]));
$details = htmlspecialchars(mysqli_real_escape_string($con, $_GET["details"]));
$status = $_GET["status"];
$details = $_GET["details"];
$sql = "UPDATE `lab_report_submissions` SET `Status`='Remarking',Remarking_Reason='$details' WHERE Submission_ID='$id'
$sql = "UPDATE `lab_report_submissions` SET `Status`='Remarking',Remarking_Reason='$details' WHERE Submission_ID=$id
";
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = "Remarking Request Sent";
$_SESSION["info_ReMarking"] = "Remarking Request Sent";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -703,13 +704,13 @@ if (!empty($_GET["remarking"])) {
if (!empty($_GET["creategroup"])) {
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$id = mysqli_real_escape_string($con, $_GET["id"]);
$name = mysqli_real_escape_string($con, $_GET["name"]);
$student_id = $_GET["student_id"];
$url = $_GET["url"];
$id = $_GET["id"];
$name = $_GET["name"];
$sql = "INSERT INTO `course_groups_table`(`Group_Name`,
`Group_Leader`, `Course_id`) VALUES ('$name','$student_id','$id')";
`Group_Leader`, `Course_id`) VALUES ('$name',$student_id,$id)";
if ($con->query($sql) === TRUE) {
@ -719,9 +720,9 @@ if (!empty($_GET["creategroup"])) {
}
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
VALUES ('$gid','$student_id','Created')";
VALUES ($gid,$student_id,'Created')";
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = "Course group Created";
$_SESSION["info_ReMarking"] = "Course group Created";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -735,25 +736,18 @@ if (!empty($_GET["creategroup"])) {
if (!empty($_GET["groupinvite"])) {
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$courseid = mysqli_real_escape_string($con, $_GET["courseid"]);
$groupid = mysqli_real_escape_string($con, $_GET["groupid"]);
$student = mysqli_query($con, "SELECT * FROM students_data WHERE Student_ID = '$student_id' ");
$student_id = $_GET["student_id"];
$url = $_GET["url"];
$courseid = $_GET["courseid"];
$groupid = $_GET["groupid"];
if (mysqli_num_rows($student) > 0) {
$result = mysqli_query($con, "SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'");
if (mysqli_num_rows($result) > 0) {
$_SESSION["info_general"] = $student_id . " has already been invited.";
header("Location: Course.php?url=" . $url);
} else {
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
VALUES ('$groupid','$student_id','Invited')";
}
} else {
$_SESSION["info_general"] = $student_id . " is an invalid student number.";
$result = mysqli_query($con, "SELECT * FROM course_group_members_table where Course_Group_id = '$groupid' and Student_ID = '$student_id'");
if (mysqli_num_rows($result) > 0) {
$_SESSION["info_ReMarking"] = $student_id . " has already been invited";
header("Location: Course.php?url=" . $url);
} else {
$sql = "INSERT INTO `course_group_members_table`( `Course_Group_id`, `Student_ID`, `Status`)
VALUES ($groupid,$student_id,'Invited')";
}
if ($con->query($sql) === TRUE) {
@ -771,26 +765,26 @@ if (!empty($_GET["groupinvite"])) {
if ($Group_Member == '0') {
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
$_SESSION["info_general"] = $student_id . " was invited to the group.";
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
header("Location: Course.php?url=" . $url);
} elseif ($Group_Member2 == '0') {
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member2` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
$_SESSION["info_general"] = $student_id . " was invited to the group.";
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
header("Location: Course.php?url=" . $url);
} elseif ($Group_Member3 == '0') {
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member3` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
$_SESSION["info_general"] = $student_id . " was invited to the group.";
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
header("Location: Course.php?url=" . $url);
} elseif ($Group_Member4 == '0') {
mysqli_query($con, "UPDATE `course_groups_table` SET `Group_Member4` = ('" . $student_id . "') WHERE `course_groups_table`.`Course_Group_id` = '$groupid'");
$_SESSION["info_general"] = $student_id . " was invited to the group.";
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
header("Location: Course.php?url=" . $url);
} else {
$_SESSION["info_general"] = " You cannot add any more members";
$_SESSION["info_ReMarking"] = " You cant add any more members";
header("Location: Course.php?url=" . $url);
}
}
$_SESSION["info_general"] = $student_id . " was invited to the group.";
$_SESSION["info_ReMarking"] = $student_id . " was invited to the group";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -801,57 +795,21 @@ if (!empty($_GET["groupinvite"])) {
if (!empty($_GET["acceptinvite"])) {
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$action = mysqli_real_escape_string($con, $_GET["action"]);
$groupid = mysqli_real_escape_string($con, $_GET["groupid"]);
$student_id = $_GET["student_id"];
$url = $_GET["url"];
$action = $_GET["action"];
$groupid = $_GET["groupid"];
if ($action == 1) {
$sql = "Update `course_group_members_table` set Status='Joined' where Course_Group_id ='$groupid' and student_id='$student_id'
$sql = "Update `course_group_members_table` set Status='Joined' where Course_Group_id =$groupid and student_id=$student_id
";
} else {
$sql = "Delete from `course_group_members_table` where Course_Group_id ='$groupid' and student_id='$student_id'
$sql = "Delete from `course_group_members_table` where Course_Group_id =$groupid and student_id=$student_id
";
}
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = " Group Invite Updated";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
}
#Remove a member from group
if (!empty($_GET["removemember"])) {
$student_id = mysqli_real_escape_string($con, $_GET["student_id"]);
$group_id = mysqli_real_escape_string($con, $_GET["group_id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$sql = "Delete from `course_group_members_table` where student_id=$student_id and Course_Group_id=$group_id";
if ($con->query($sql) === TRUE) {
$_SESSION["info_general"] = " Member " . $student_id . " removed from the group";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
}
#Delete a whole group
if (!empty($_GET["deletegroup"])) {
$group_id = mysqli_real_escape_string($con, $_GET["group_id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$sql1 = "Delete from `course_group_members_table` where Course_Group_id=$group_id";
$sql2 = "Delete from `course_groups_table` where Course_Group_id=$group_id";
if ($con->query($sql1) === TRUE && $con->query($sql2) === TRUE) {
$_SESSION["info_general"] = " Group has been deleted successfully. ";
$_SESSION["info_ReMarking"] = " Group Invite Updated";
header("Location: Course.php?url=" . $url);
} else {
echo "Error: " . $sql . "<br>" . $con->error;
@ -862,22 +820,22 @@ if (!empty($_GET["deletegroup"])) {
if (!empty($_GET["extenddeadline"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$date = mysqli_real_escape_string($con, $_GET["date"]);
$time = mysqli_real_escape_string($con, $_GET["time"]);
$type = mysqli_real_escape_string($con, $_GET["type"]);
$id = $_GET["id"];
$date = $_GET["date"];
$time = $_GET["time"];
$type = $_GET["type"];
$stdid = mysqli_real_escape_string($con, $_GET["stdid"]);
$reason = mysqli_real_escape_string($con, $_GET["reason"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$stdid = $_GET["stdid"];
$reason = $_GET["reason"];
$url = $_GET["url"];
$deadline = $date . " " . $time;
if ($type == 1) {
$sql = "UPDATE `lab_reports_table` SET `Deadline`='$deadline' WHERE Lab_Report_ID='$id'";
$sql = "UPDATE `lab_reports_table` SET `Deadline`='$deadline' WHERE Lab_Report_ID=$id";
} else {
$sql = "INSERT INTO `extended_deadlines_table`(`Student_ID`, "
. "`Lab_Report_ID`, `Extended_Deadline_Date`,"
. " `ReasonsForExtension`) VALUES ('$stdid','$id','$deadline','$reason')";
. " `ReasonsForExtension`) VALUES ($stdid,$id,'$deadline','$reason')";
}
if ($con->query($sql) === TRUE) {
@ -893,13 +851,13 @@ if (!empty($_GET["extenddeadline"])) {
if (!empty($_GET["ignoreremarking"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$total = mysqli_real_escape_string($con, $_GET["total"]);
$header = mysqli_real_escape_string($con, $_GET["header"]);
$id = $_GET["id"];
$total = $_GET["total"];
$header = $_GET["header"];
$subid = mysqli_real_escape_string($con, $_GET["subid"]);
$subid = $_GET["subid"];
$sql = "UPDATE lab_report_submissions SET Status='Marked' WHERE Submission_ID='$subid'";
$sql = "UPDATE lab_report_submissions SET Status='Marked' WHERE Submission_ID=$subid";
if ($con->query($sql) === TRUE) {
@ -914,10 +872,10 @@ if (!empty($_GET["ignoreremarking"])) {
if (!empty($_GET["assignTA"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$ta = mysqli_real_escape_string($con, $_GET["ta"]);
$id = $_GET["id"];
$ta = $_GET["ta"];
$sql = "INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ('$id','$ta')";
$sql = "INSERT INTO `course_ta`(`Course_ID`, `TA`) VALUES ($id,$ta)";
if ($con->query($sql) === TRUE) {
@ -932,13 +890,13 @@ if (!empty($_GET["assignTA"])) {
if (!empty($_GET["AcceptStudent"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
$rs = mysqli_real_escape_string($con, $_GET["rs"]);
$id = $_GET["id"];
$rs = $_GET["rs"];
if ($rs == "yes") {
$sql = "Update course_students_table set Status='Joined' Where ID='$id'";
$sql = "Update course_students_table set Status='Joined' Where ID=$id";
} else {
$sql = "Delete FROM course_students_table Where ID='$id'";
$sql = "Delete FROM course_students_table Where ID=$id";
}
if ($con->query($sql) === TRUE) {
@ -960,12 +918,12 @@ if (!empty($_GET["AcceptStudent"])) {
if (!empty($_GET["action"])) {
$action = $_GET["action"];
$uid = mysqli_real_escape_string($con, $_GET["uid"]);
$uid = $_GET["uid"];
$pass = mysqli_real_escape_string($con, $_GET["pass"]);
$pass = $_GET["pass"];
$pass = password_hash($pass, PASSWORD_DEFAULT);
$status = mysqli_real_escape_string($con, $_GET["status"]);
$status = $_GET["status"];
// validate uid
if (intval($uid) < 0) {
@ -973,12 +931,12 @@ if (!empty($_GET["action"])) {
return;
}
if ($action == "passchange" && $_SESSION['user_id'] == $uid) {
$sql = "UPDATE users_table set Password='$pass' where User_ID='$uid';";
if ($action == "passchange") {
$sql = "UPDATE users_table set Password='$pass' where User_ID=$uid;";
if ($con->query($sql) === TRUE) {
error_reporting(0);
echo "Password has been changed";
//return;
// return;
$_SESSION["infoChangePassword"] = $type . " User password was changed successfully.";
header("Location: index.php");
} else {
@ -987,8 +945,8 @@ if (!empty($_GET["action"])) {
}
}
if ($action == "statuschange" && $_SESSION['user_id'] == $uid && ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "Admin")) {
$sql = "UPDATE users_table set Status='$status' where User_ID='$uid';";
if ($action == "statuschange") {
$sql = "UPDATE users_table set Status='$status' where User_ID=$uid;";
if ($con->query($sql) === TRUE) {
$_SESSION["info_Admin_Users"] = $type . " user Status updated successfully ";
header("Location: Admin.php");
@ -1048,8 +1006,8 @@ if (!empty($_POST["frm_createCourse"])) {
if (!empty($_GET["exportgrade"])) {
$lab = mysqli_real_escape_string($con, $_GET["lab"]);
$lab_name = mysqli_real_escape_string($con, $_GET["lab_name"]);
$lab = $_GET["lab"];
$lab_name = $_GET["lab_name"];
error_reporting(0);
@ -1061,7 +1019,7 @@ INNER JOIN lab_reports_table on lab_reports_table.Lab_Report_ID=lab_report_submi
INNER JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
WHERE lab_report_submissions.Lab_Report_ID='$lab'";
WHERE lab_report_submissions.Lab_Report_ID=$lab";
$export = mysqli_query($con, $select);
@ -1091,7 +1049,7 @@ WHERE lab_report_submissions.Lab_Report_ID='$lab'";
}
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=$lab_name Grade Sheet.xls");
header("Content-Disposition: attachment; filename=$lab_name Garde Sheet.xls");
header("Pragma: no-cache");
header("Expires: 0");
print "$header\n$data";

View File

@ -1,15 +1,20 @@
<?php
$page = "student";
$page="student";
include 'Header.php';
?>
<br><br><br>
<div class="row" style="width:80%;margin:auto;">
<div class="col-md-6">
<h1> Student Account Created. Now you can Browse Course Portals </h1>
<h1> STUEDNT Account Created , Now you can Browse Course Portals </h1>
</div>
</div>
</div>

View File

@ -3,121 +3,124 @@ include 'NoDirectPhpAcess.php';
?>
<?php
$page = 'Courses+';
$page='Courses+';
include 'Header.php';
$student_id = $_SESSION["user_student_id"];
$group_id = $_SESSION["user_group_id"];
$c_date = date("Y-m-d H:i");
if (!empty($_GET["id"])) {
$id = mysqli_real_escape_string($con, $_GET["id"]);
if(!empty($_GET["id"]))
{
$id = $_GET["id"];
$course_id = $id;
}
if (!empty($_GET["header"])) {
if(!empty($_GET["header"]))
{
$header = $_GET["header"];
}
if (!empty($_GET["total"])) {
if(!empty($_GET["total"]))
{
$total = $_GET["total"];
} else {
} else
{
$total = 0;
}
$resultx1 = mysqli_query($con, "SELECT `Lab_Report_ID`,Title, lab_reports_table.Course_ID, `Posted_Date`, `Deadline`, `Marks`, `Type` , courses_table.URL FROM `lab_reports_table` INNER JOIN courses_table ON courses_table.Course_ID=lab_reports_table.Course_ID WHERE Lab_Report_ID=$id");
while ($row = mysqli_fetch_assoc($resultx1)) {
$resultx1 = mysqli_query($con,"SELECT `Lab_Report_ID`,Title, lab_reports_table.Course_ID, `Posted_Date`, `Deadline`, `Marks`, `Type` , courses_table.URL FROM `lab_reports_table` INNER JOIN courses_table ON courses_table.Course_ID=lab_reports_table.Course_ID WHERE Lab_Report_ID=$id");
while($row = mysqli_fetch_assoc($resultx1)) {
$Report_Type = $row['Type'];
$c_id = $row['Course_ID'];
$Report_Title = $row['Title'];
$url = $row['URL'];
}
}
echo "<div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='Courses.php?course=$url'>
$header
</a></div>
";
?>
<div class="row" style="width:80%;margin:auto; text-align:left;">
<!-- Lecturer CODE-->
<?php
<?php
if ($_SESSION['user_type'] == "Lecturer" || $_SESSION['user_type'] == "TA") {
?>
if( $_SESSION['user_type']=="Lecturer" || $_SESSION['user_type']=="TA")
{
?>
<div class="col-md-12">
<?php
<?php
error_reporting(0);
error_reporting(0);
if(isset($_SESSION['info_Marking'])) {
echo '<hr><div class="alert alert-info" role="alert">'.$_SESSION['info_Marking'].'</div>';
$_SESSION['info_Marking']=null;
}
if (isset($_SESSION['info_Marking'])) {
echo '<hr><div class="alert alert-info" role="alert">' . $_SESSION['info_Marking'] . '</div>';
$_SESSION['info_Marking'] = null;
}
$resultx1 = mysqli_query($con, "Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
while ($row = mysqli_fetch_assoc($resultx1)) {
$count_subs = $row['cnt'];
}
$resultx2 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Marked'");
if (mysqli_num_rows($resultx2) == 0) {
$count_marked = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx2)) {
$count_marked = $row['cnt'];
}
}
$resultx3 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Pending'");
if (mysqli_num_rows($resultx3) == 0) {
$count_unmarked = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx3)) {
$count_unmarked = $row['cnt'];
}
}
$resultx1 = mysqli_query($con,"Select Count(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id");
while($row = mysqli_fetch_assoc($resultx1)) {$count_subs=$row['cnt'];}
$resultx2 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Marked'");
if(mysqli_num_rows($resultx2)==0){$count_marked=0;} else { while($row = mysqli_fetch_assoc($resultx2)) {$count_marked =$row['cnt'];}}
$resultx3 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Pending'");
if(mysqli_num_rows($resultx3)==0){$count_unmarked=0;} else { while($row = mysqli_fetch_assoc($resultx3)) {$count_unmarked =$row['cnt'];}}
$resultx4 = mysqli_query($con, "Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'");
if (mysqli_num_rows($resultx4) == 0) {
$count_remark = 0;
} else {
while ($row = mysqli_fetch_assoc($resultx4)) {
$count_remark = $row['cnt'];
}
}
$resultx4 = mysqli_query($con,"Select COUNT(*) as cnt from lab_report_submissions where lab_report_submissions.Lab_Report_ID=$id and Status='Remarking'");
if(mysqli_num_rows($resultx4)==0){$count_remark=0;} else { while($row = mysqli_fetch_assoc($resultx4)) {$count_remark =$row['cnt'];}}
?>
?>
<b>Lab Report Submissions (<?php echo $count_subs;?>)</b>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">Un-Marked Submissions<b> (<?php echo $count_unmarked;?>)</b></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Marked Submissions <b>(<?php echo $count_marked;?>)</b></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Re-Marking Requests <b>(<?php echo $count_remark;?>)</b></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4"> View Course Groups</a>
</li>
</ul>
<div class="tab-content">
<div id="menu1" class="container tab-pane active"><br>
<?php
<b>Lab Report Submissions (<?php echo $count_subs; ?>)</b>
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#menu1">Un-Marked Submissions<b> (<?php echo $count_unmarked; ?>)</b></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu2">Marked Submissions <b>(<?php echo $count_marked; ?>)</b></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu3">Re-Marking Requests <b>(<?php echo $count_remark; ?>)</b></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#menu4"> View Course Groups</a>
</li>
</ul>
<div class="tab-content">
<div id="menu1" class="container tab-pane active"><br>
<?php
if ($Report_Type == "Group") {
$result1 = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
if($Report_Type=="Group")
{
$result1 = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name,course_groups_table.Group_Leader,users_table.Full_Name, users_table.Student_id
@ -125,165 +128,192 @@ FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
} else {
$result1 = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
}
else
{
$result1 = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
where Lab_Report_ID=$id and lab_report_submissions.Status='Pending' order by Submission_Date desc");
}
if(mysqli_num_rows($result1)==0)
{
echo "No Un-Marked Submissions for this Lab Report.";
} else {
while($row = mysqli_fetch_assoc($result1)) {
$title=$row['Title'];
$Marks=$row['Marks'];
$posted=$row['Submission_Date'];
$deadline=$row['Deadline'];
$att1=$row['Attachment1'];
$att2=$row['Attachment2'];
$att3=$row['Attachment3'];
$att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID'];
$submitter_student_number=$row['Student_id'];
$submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID'];
$student_name=$row['Full_Name'];
$groupname=$row['Group_Name'];
$groupleader=$row['Group_Leader'];
$student_id=$row['sub_std'];
if($submitted_group==0)
{
$submitted_by= $student_name."(".$student_id.")";
} else {
$submitted_by="$student_name ($submitter_student_number) for group $groupname ";
}
$base_att1 = basename($att1);
$base_att2 = basename($att2);
$base_att3 = basename($att3);
$base_att4 = basename($att4);
$full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>"; // prevent students from directly accessing their classmates' submissions
if($att2!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$att2&attachment=2'>$base_att2</a>";
}
if (mysqli_num_rows($result1) == 0) {
echo "No Un-Marked Submissions for this Lab Report.";
} else {
while ($row = mysqli_fetch_assoc($result1)) {
$title = $row['Title'];
$Marks = $row['Marks'];
$posted = $row['Submission_Date'];
$deadline = $row['Deadline'];
$att1 = $row['Attachment1'];
$att2 = $row['Attachment2'];
$att3 = $row['Attachment3'];
$att4 = $row['Attachment4'];
$labid = $row['Lab_Report_ID'];
$submitter_student_number = $row['Student_id'];
$submitted_group = $row['Course_Group_id'];
$Submission_ID = $row['Submission_ID'];
$student_name = $row['Full_Name'];
$groupname = $row['Group_Name'];
$groupleader = $row['Group_Leader'];
$student_id = $row['sub_std'];
if ($submitted_group == 0) {
$submitted_by = $student_name . "(" . $student_id . ")";
} else {
$submitted_by = "$student_name ($submitter_student_number) for group $groupname ";
}
$base_att1 = basename($att1);
$base_att2 = basename($att2);
$base_att3 = basename($att3);
$base_att4 = basename($att4);
$full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>"; // prevent students from directly accessing their classmates' submissions
if ($att2 != "") {
$full_link = $full_link . " | <a href='~\..\Download.php?file=$att2&attachment=2'>$base_att2</a>";
}
if ($att3 != "") {
$full_link = $full_link . " | <a href='~\..\Download.php?file=$att3&attachment=3'>$base_att3</a>";
}
if ($att4 != "") {
$full_link = $full_link . " | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by: <b> <span class = 'text-selectable'>$submitted_by </span> </b>
if($att3!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$att3&attachment=3'>$base_att3</a>";
}
if($att4!=""){
$full_link= $full_link." | <a href='~\..\Download.php?file=$att4&attachment=4'>$base_att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by: <b> $submitted_by </b>
<br> <span style='font-size:8pt'>Submitted : $posted <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Mark Submission</button><br> Attachments : $full_link </span>
</div></k>";
}
}
echo "";
?>
</div>
<div id="menu2" class="container tab-pane"><br>
<?php
if ($Report_Type == "Group") {
$result = mysqli_query($con, "SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
}
}
echo "";
?>
</div>
<div id="menu2" class="container tab-pane"><br>
<?php
if($Report_Type=="Group")
{
$result = mysqli_query($con,"SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name
FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked'");
} else {
$result = mysqli_query($con, "SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
}
else
{
$result = mysqli_query($con,"SELECT `Submission_ID`,Visibility, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, lab_report_submissions.Status,
`Title`,users_table.Full_Name,course_group_members_table.Student_ID
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab_report_submissions.Student_id Desc");
}
if (mysqli_num_rows($result) == 0) {
echo "No Marked submissions for this lab";
} else {
echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export Grade Sheet </a></h3>";
while ($row = mysqli_fetch_assoc($result)) {
$title = $row['Title'];
$Marks = $row['Marks'];
//$ins=$row['Notes'];
$posted = $row['Submission_Date'];
$deadline = $row['Deadline'];
$att1 = $row['Attachment1'];
$att2 = $row['Attachment2'];
$att3 = $row['Attachment3'];
$att4 = $row['Attachment4'];
$labid = $row['Lab_Report_ID'];
$submitter_student_number = $row['Student_id'];
$submitted_group = $row['Course_Group_id'];
$Submission_ID = $row['Submission_ID'];
$student_name = $row['Full_Name'];
$student_id = $row['sub_std'];
$Visibility = $row['Visibility'];
$notes = $row['Notes'];
if ($submitted_group == 0) {
$submitted_by = $student_name . "(" . $student_id . ")";
} else {
$submitted_by = "<i>(GROUP)</i> Group X ";
}
$base_att1 = basename($att1);
$full_link = "<a href='~\..\Download.php?file=$att1&attachment=1'>$base_att1</a>"; // prevent students from directly accessing their classmates' submissions
if ($att2 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if ($att3 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if ($att4 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
// you will notice why i used span here to wrap the $submitted_by variable
// because if we wrap with span , the css class text-selectable can be used only by the submittedBy variable
// if you want to use text-selectable class on whole div, just call the css class
echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> &nbsp; Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button>
where Lab_Report_ID=$id and lab_report_submissions.Status='Marked' Order by lab_report_submissions.Student_id Desc");
}
if(mysqli_num_rows($result)==0)
{
echo "No Marked submissions for this lab";
} else {
echo "<h3><a href='~\..\Script.php?exportgrade=true&lab=$id&lab_name=$Report_Title'><i class='fa fa-book'></i> Export Grade Sheet </a></h3>";
while($row = mysqli_fetch_assoc($result)) {
$title=$row['Title'];
$Marks=$row['Marks'];
//$ins=$row['Notes'];
$posted=$row['Submission_Date'];
$deadline=$row['Deadline'];
$att1=$row['Attachment1'];
$att2=$row['Attachment2'];
$att3=$row['Attachment3'];
$att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID'];
$submitter_student_number=$row['Student_id'];
$submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID'];
$student_name=$row['Full_Name'];
$student_id=$row['sub_std'];
$Visibility=$row['Visibility'];
$notes=$row['Notes'];
if($submitted_group==0)
{
$submitted_by= $student_name."(".$student_id.")";
} else {
$submitted_by="<i>(GROUP)</i> Group X " ;
}
$full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if($att2!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> $submitted_by &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> &nbsp; Visibility : <b>$Visibility </b> <button class='btn-sm btn-success' style='margin-left:50px;' onclick='updatev($Submission_ID)'>Update visibility</button>
<hr> Lecturer/TA notes : $notes<br> <span style='font-size:8pt'>Submitted : $posted <b> </b> <button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button><br> Attachments : $full_link </span>
</div></k>";
}
}
echo "";
?>
</div>
<div id="menu3" class="container tab-pane"><br>
<?php
if ($Report_Type == "Group") {
$resulty = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
}}
echo "";
?>
</div>
<div id="menu3" class="container tab-pane"><br>
<?php
if($Report_Type=="Group")
{
$resulty = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status,
`Title`,course_groups_table.Group_Name
@ -291,8 +321,10 @@ FROM `lab_report_submissions`
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
} else {
$resulty = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
}
else
{
$resulty = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Lab_Report_ID,
lab_report_submissions.Remarking_Reason,
lab_report_submissions.Student_id sub_std, lab_report_submissions.Course_Group_id, `Attachment1`,
`Notes`, `Attachment2`, `Attachment3`, `Attachment4`, lab_report_submissions.Marks, lab_report_submissions.Status,
@ -300,179 +332,219 @@ where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
FROM `lab_report_submissions`
Left JOIN users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_group_members_table on course_group_members_table.Course_Group_id=lab_report_submissions.Course_Group_id
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
}
where Lab_Report_ID=$id and lab_report_submissions.Status='Remarking'");
}
if(mysqli_num_rows($resulty)==0)
{
echo "No Remarking Request for this lab";
} else { while($row = mysqli_fetch_assoc($resulty)) {
$title=$row['Title'];
$Marks=$row['Marks'];
//$ins=$row['Notes'];
$posted=$row['Submission_Date'];
$deadline=$row['Deadline'];
if (mysqli_num_rows($resulty) == 0) {
echo "No Remarking Request for this lab";
} else {
while ($row = mysqli_fetch_assoc($resulty)) {
$title = $row['Title'];
$Marks = $row['Marks'];
//$ins=$row['Notes'];
$posted = $row['Submission_Date'];
$deadline = $row['Deadline'];
$att1=$row['Attachment1'];
$att2=$row['Attachment2'];
$att3=$row['Attachment3'];
$att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID'];
$remarking_reason=$row['Remarking_Reason'];
$att1 = $row['Attachment1'];
$att2 = $row['Attachment2'];
$att3 = $row['Attachment3'];
$att4 = $row['Attachment4'];
$labid = $row['Lab_Report_ID'];
$remarking_reason = $row['Remarking_Reason'];
$submitter_student_number = $row['Student_id'];
$submitted_group = $row['Course_Group_id'];
$Submission_ID = $row['Submission_ID'];
$student_name = $row['Full_Name'];
$student_id = $row['sub_std'];
$gname = $row['Group_Name '];
if ($submitted_group == 0) {
$submitted_by = $student_name . "(" . $student_id . ")";
} else {
$submitted_by = "<i>(GROUP)</i> $gname";
}
$full_link = "<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if ($att2 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if ($att3 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if ($att4 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word ' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> <span class = 'text-selectable'>$submitted_by </span> &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b>
$submitter_student_number=$row['Student_id'];
$submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID'];
$student_name=$row['Full_Name'];
$student_id=$row['sub_std'];
$gname=$row['Group_Name '];
if($submitted_group==0)
{
$submitted_by= $student_name."(".$student_id.")";
} else {
$submitted_by="<i>(GROUP)</i> $gname" ;
}
$full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if($att2!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo " <k href='#'> <div class='btn btn-default break-word' style='dislay:block; word-wrap: break-word; border: 1px solid #F0F0F0;border-left: 4px solid #03407B;'>
$title <br> by : <b> $submitted_by &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; [ Marked $Marks ] </b> <br> Remarking Reason : <b>$remarking_reason </b>
<hr> <span style='font-size:8pt'>Submitted : $posted <b> </b> "
. "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button>"
. " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>"
. "<br> Attachments : $full_link </span>
. "<button class='btn-sm btn-info' style='margin-left:50px;' onclick='mark($Submission_ID,\"$title\",$total)'> Re-Mark Submission</button>"
. " &nbsp; &nbsp;&nbsp;&nbsp;<a href='~\..\Script.php?ignoreremarking=yes&id=$id&subid=$Submission_ID&header=$header&total=$total&status=Marked' class='btn-sm btn-warning'> Ignore Request </a>"
. "<br> Attachments : $full_link </span>
</div></k>";
}
}
echo "";
?>
</div>
<div id="menu4" class="container tab-pane"><br>
<h3>Course Groups</h3>
<hr>
<?php
$result = mysqli_query($con, " SELECT `Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`,users_table.Full_Name
}}
echo "";
?>
</div>
<div id="menu4" class="container tab-pane"><br>
<h3>Course Groups</h3>
<hr>
<?php
$result = mysqli_query($con," SELECT `Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`,users_table.Full_Name
FROM `course_groups_table`
INNER JOIN users_table on users_table.Student_ID=course_groups_table.Group_Leader
WHERE Course_id=$c_id");
if (mysqli_num_rows($result) == 0) {
echo "You have no Group in this Course";
} else {
while ($row = mysqli_fetch_assoc($result)) {
$name = $row['Group_Name'];
$leader = $row['Full_Name'] . "(" . $row['Group_Leader'] . ")";
$id = $row['Course_Group_id'];
echo "<div class='btn-default'><small> $name - Leader : $leader </small></div>";
$rs2 = mysqli_query($con, "SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID,
if(mysqli_num_rows($result)==0)
{
echo "You have no Group in this Course";
} else { while($row = mysqli_fetch_assoc($result)) {
$name=$row['Group_Name'];
$leader=$row['Full_Name']."(".$row['Group_Leader'].")";
$id= $row['Course_Group_id'];
echo "<div class='btn-default'><small> $name - Leader : $leader </small></div>";
$rs2=mysqli_query($con,"SELECT `ID`, `Course_Group_id`, course_group_members_table.Student_ID,
course_group_members_table.`Status`,users_table.Full_Name FROM `course_group_members_table`
INNER JOIN users_table on users_table.Student_ID=course_group_members_table.Student_ID
where course_group_members_table.Course_Group_id=$id");
while($row = mysqli_fetch_assoc($rs2)) {
$name=$row['Full_Name'];
$id=$row['Course_Group_id'];
$status=$row['Status'];
$Student_ID=$row['Student_ID'];
echo "<li><small> $name-$Student_ID ($status)</small></li>";
}
}
}
?>
while ($row = mysqli_fetch_assoc($rs2)) {
$name = $row['Full_Name'];
$id = $row['Course_Group_id'];
$status = $row['Status'];
$Student_ID = $row['Student_ID'];
echo "<li><small> $name-$Student_ID ($status)</small></li>";
}
}
}
?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
include 'Footer.php';
include 'Footer.php';
?>
<script src="http://118.25.96.118/nor/css/jquery-1.11.1.min.js"></script>
<script src="http://118.25.96.118/nor/css/jquery-1.11.1.min.js"></script>
<script src="http://118.25.96.118/nor/css/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://118.25.96.118/nor/css/jquery-ui.css" />
<script>
function mark(id, title, marks) {
try {
$('<form id="submit-form" method="get" action="Script.php">' + title + '(' + marks + ' marks) <input type="hidden" name="savemarks" value="true">\n\
<input type="hidden" name="total" value="' + marks + '" > <input type="hidden" name="id" value="' + id + '" ><br> Marks <input type="text" name="marks">\n\
function mark(id,title,marks) {
try
{
$('<form id="submit-form" method="get" action="Script.php">'+title+'('+marks+' marks) <input type="hidden" name="savemarks" value="true">\n\
<input type="hidden" name="total" value="'+marks+'" > <input type="hidden" name="id" value="'+id+'" ><br> Marks <input type="text" name="marks">\n\
Comments <textarea name="feedback"></textarea> \n\
<input type="hidden" name="labid" value="<?php echo $course_id; ?>"> <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
modal: true,
title: 'Mark Submission',
buttons: {
'Submit Marking': function() {
$('#submit-form').submit();
modal: true,
title:'Mark Submission',
buttons: {
'Submit Marking': function () {
$('#submit-form').submit();
$(this).dialog('close');
},
'X': function() {
$(this).dialog('close');
},
'X': function () {
$(this).dialog('close');
}
}
});
$(this).dialog('close');
}
}
});
} catch (e) {
alert(e);
}
}catch(e){ alert(e); }
}
function updatev(id) {
try {
function updatev(id)
{
try
{
$('<form id="submit-form" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\
<input type="hidden" name="id" value="' + id + '" > <br>\n\
$('<form id="submit-form" method="get" action="Script.php"> <input type="hidden" name="updatevisibility" value="true">\n\
<input type="hidden" name="id" value="'+id+'" > <br>\n\
Update Visibility<br><select name="status"> <option> Public </option><option>Private</option> </select> \n\
<input type="hidden" name="labid" value="<?php echo $id; ?>"> <input type="hidden" name="total" value="<?php echo $total; ?>" > <input type="hidden" name="header" value="<?php echo $header; ?>"> </form>').dialog({
modal: true,
title: 'Update Report Visibility',
buttons: {
'Update': function() {
$('#submit-form').submit();
$(this).dialog('close');
},
'X': function() {
modal: true,
title:'Update Report Visibility',
buttons: {
'Update': function () {
$('#submit-form').submit();
$(this).dialog('close');
},
'X': function () {
$(this).dialog('close');
}
}
});
$(this).dialog('close');
}
}
});
} catch (e) {
alert(e);
}
}
}catch(e){ alert(e); }
}
</script>

View File

@ -17,8 +17,8 @@ $student_id = $_SESSION["user_student_id"];
if(!empty($_GET["id"]))
{
$id = mysqli_real_escape_string($con, $_GET["id"]);
$url = mysqli_real_escape_string($con, $_GET["url"]);
$id = $_GET["id"];
$url = $_GET["url"];
$result1 = mysqli_query($con," SELECT `Type`, `Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4` FROM `lab_reports_table` WHERE Lab_Report_ID=$id and Deadline > '$c_date' ORDER by Lab_Report_ID DESC");
if(mysqli_num_rows($result1) == 0)

View File

@ -1,63 +1,67 @@
<?php
$page = 'Submit LAB+';
$page='Submit LAB+';
include 'Header.php';
?>
<div class='row' style='width:80%;margin:auto;'>
<?php
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
<div class='row' style='width:80%;margin:auto;'>
<?php
echo " <div class='alert' style='margin-left:20px;border-bottom:2px solid #1D91EF;'> <a href='~\..\Courses.php?course=$url'>
LRRS > Visitor Portal > Public Lab Reports
<br> <span style='font-size:8pt'> </span>
</a></div>
";
$result = mysqli_query($con, "SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Student_id,
$result = mysqli_query($con,"SELECT `Submission_ID`, `Submission_Date`, lab_report_submissions.Student_id,
`Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, `Title`, `Visibility` ,
users_table.Full_Name,course_groups_table.Group_Name
FROM `lab_report_submissions`
left join users_table on users_table.Student_ID=lab_report_submissions.Student_id
left JOIN course_groups_table on course_groups_table.Course_Group_id=lab_report_submissions.Course_Group_id
WHERE Visibility='Public' ");
if (mysqli_num_rows($result) == 0) {
} else {
while ($row = mysqli_fetch_assoc($result)) {
$att1 = $row['Attachment1'];
$att2 = $row['Attachment2'];
$sdate = $row['Submission_Date'];
$att3 = $row['Attachment3'];
$att4 = $row['Attachment4'];
$labid = $row['Lab_Report_ID'];
$title = $row['Title'];
$submitted_std = $row['Student_id'];
$submitted_group = $row['Course_Group_id'];
$Submission_ID = $row['Submission_ID'];
$sname = $row['Full_Name'];
$gname = $row['Group_Name'];
$Visibility = $row['Visibility'];
$full_link = "<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if ($att2 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if ($att3 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if ($att4 != "") {
$full_link = $full_link . "| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo "
if(mysqli_num_rows($result)==0)
{} else { while($row = mysqli_fetch_assoc($result)) {
$att1=$row['Attachment1'];
$att2=$row['Attachment2'];
$sdate=$row['Submission_Date'];
$att3=$row['Attachment3'];
$att4=$row['Attachment4'];
$labid=$row['Lab_Report_ID'];
$title=$row['Title'];
$submitted_std=$row['Student_id'];
$submitted_group=$row['Course_Group_id'];
$Submission_ID=$row['Submission_ID'];
$sname=$row['Full_Name'];
$gname=$row['Group_Name'];
$Visibility=$row['Visibility'];
$full_link="<a href='~\..\Lab_Report_Submisions\\$att1'>$att1</a>";
if($att2!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att2'>$att2</a>";
}
if($att3!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att3'>$att3</a>";
}
if($att4!=""){
$full_link= $full_link."| <a href='~\..\Lab_Report_Submisions\\$att4'>$att4</a>";
}
echo"
<div class='btn btn-default'>
$title <small>by $gname $sname </small>
<br> <span style='font-size:8pt'>Submission Date :$sdate &nbsp;&nbsp; &nbsp; Files : $full_link </span>
</div>
";
}
} ?>
</div>
}}?>
</div>

BIN
background.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

View File

@ -19,7 +19,7 @@ if (!$conn) {
}
//获得用户名数据
$source = mysqli_real_escape_string($conn,$_POST['users']);
$source = $_POST['users'];
//如有多个空格,删除剩一个空格
$source1 = preg_replace('/\s\s+/', ' ', $source);
@ -31,12 +31,13 @@ $source2 = trim($source1);
//根据空格拆分
$user = explode(' ', $source2);
//插入数据
for($index=0; $index < count($user); $index++) {
$result = mysqli_query($conn, "SELECT * FROM `students_data` WHERE Student_ID='$user[$index]'");
if (mysqli_num_rows($result) < 1) {
if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) {
echo "SQL Error: " . $sql_stmt . "<br>" .htmlspecialchars(mysqli_error($conn));
echo "SQL Error: " . $sql_stmt . "<br>" . mysqli_error($conn);
} else {
echo "<p>Student number $user[$index] added.</p>";
}

View File

@ -1,11 +0,0 @@
/* this css class is used to enable copying in text with the mouse. */
.text-selectable {
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
cursor:auto
}

View File

@ -17,10 +17,5 @@ After that, issue the following commands in the mysql prompt.
The first one uses a database called lrr in MySQL. The second one deletes a record from `users_table` where the student number is 201131129138.
Increasing session duration
-------------------
By default, the session duration in PHP is set to 1,440 seconds (24 minutes). However, this is not convenient in most software systems. Therefore, we may need to increase the duration to allow users to have more session time. To increase the session duration, we need to edit the variable *session.gc_maxlifetime* in **php.ini**. We can increase its default value to whatever we want (e.g., 7200).
On Ubuntu, the file is located at */etc/php/7.2/apache2/php.ini*. On XAMPP, the file is located at */xampp/php/php.ini*.
*Last modified on 20 April 2022 by Umar*
*Last modified on 1 June 2020 by Hui*

View File

@ -27,7 +27,7 @@
</ul>
<h3>About LRRS</h3>
<ul>
<li><a href="overview.html">» <b>Overview</b></a></li>
<li><a href="Overview.html">» <b>Overview</b></a></li>
<li><a href="quickstart.html">Quick Start</a></li>
<li><a href="features.html">Features</a></li>
<li><a href="screenshots.html">Screenshots</a></li>

View File

@ -33,18 +33,18 @@ if (isset($_SESSION["user_fullname"])) {
<form method="post" action="Script.php" name="frm_login">
<input type="hidden" name="frm_login" value="true"/>
Student ID / Instructor Email
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" id="user_name" />
<input type="text" name="user" placeholder="Email / Student Number" class="form-control" required="required" />
<br>
Password
<input type="password" class="form-control" name="password" placeholder="password" required="required" id="user_password" />
<input type="password" class="form-control" name="password" placeholder="password" required="required" />
<div class="text-center">
<br><input type="submit" class="btn-primary" value="Login" id="login_btn">
<br><input type="submit" class="btn-primary" value="Login">
</div>
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3; font-family: Poppins-Regular;
<br> <a href="recover_password.php" style="font-weight:normal;color:#2471A3font-family: Poppins-Regular;
font-size: 17px;">Reset my password</a>
<div class="text-center">
<br><span class="txt1">Don't have an account?</span>
<a class="txt2" href="signup.php" style="font-weight:normal" id="signup_link">Sign Up</a>
<a class="txt2" href="signup.php" style="font-weight:normal">Sign Up</a>
</a>
</div>
@ -81,8 +81,8 @@ if (isset($_SESSION["user_fullname"])) {
</div>
<div id="footer">
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
<div style="" id="footer">
LRR was originally developed as a <a href="http://lanlab.org/course/2018f/se/homepage.html" style="color:white;">software engineering course project</a> by Mohamed Nor and Elmahdi Houzi. Please submit your suggestions or bug reports to lanhui _at_ zjnu.edu.cn. Last updated on 18/04/2020 by Ashly. <a href="./homepage" style="color:white;">More information ...</a>
</div>
</body>

View File

@ -1,11 +1,11 @@
<?php
// Start a new session
session_start();
// Destory sessions & redirect to index
session_destroy();
session_unset();
// Start a new session
session_start();
// Generate a new session ID
session_regenerate_id(true);

383
lrr_datbase.sql Normal file
View File

@ -0,0 +1,383 @@
-- phpMyAdmin SQL Dump
-- version 4.7.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 21, 2019 at 05:08 AM
-- Server version: 5.7.17
-- PHP Version: 7.1.3
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `lrr`
--
DELIMITER $$
--
-- Procedures
--
CREATE DEFINER=`root`@`localhost` PROCEDURE `count_submissions` (OUT `s_count` DECIMAL) BEGIN
select count(Student_id) into s_count from lab_report_submissions;
END$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `GetAllListings` () BEGIN
SELECT nid, type, title FROM node where type = 'lms_listing' order by nid desc;
END$$
DELIMITER ;
-- --------------------------------------------------------
--
-- Table structure for table `courses_table`
--
CREATE TABLE `courses_table` (
`Course_ID` int(11) NOT NULL,
`Course_Name` varchar(50) CHARACTER SET utf8 NOT NULL,
`Academic_Year` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Faculty` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Lecturer_User_ID` int(11) DEFAULT NULL,
`TA_User_ID` int(11) DEFAULT NULL,
`Course_Code` varchar(100) COLLATE utf8mb4_bin NOT NULL,
`URL` varchar(100) COLLATE utf8mb4_bin NOT NULL,
`Verify_New_Members` varchar(10) COLLATE utf8mb4_bin NOT NULL DEFAULT 'No'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `courses_table`
--
INSERT INTO `courses_table` (`Course_ID`, `Course_Name`, `Academic_Year`, `Faculty`, `Lecturer_User_ID`, `TA_User_ID`, `Course_Code`, `URL`, `Verify_New_Members`) VALUES
(10, 'Software Engineering', '2018', 'Computing', 8, 0, 'CSC1234', 'CSC12342018', '1'),
(11, 'Project Management', '2019', 'Computing', 8, 0, 'P.M2019', 'P.M20192019', '0');
-- --------------------------------------------------------
--
-- Table structure for table `course_groups_table`
--
CREATE TABLE `course_groups_table` (
`Course_Group_id` int(11) NOT NULL,
`Group_Name` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Group_Leader` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`Course_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `course_groups_table`
--
INSERT INTO `course_groups_table` (`Course_Group_id`, `Group_Name`, `Group_Leader`, `Course_id`) VALUES
(1, 'Group 1', '201825800050', 10);
-- --------------------------------------------------------
--
-- Table structure for table `course_group_members_table`
--
CREATE TABLE `course_group_members_table` (
`ID` int(11) NOT NULL,
`Course_Group_id` int(11) DEFAULT NULL,
`Student_ID` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`Status` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `course_group_members_table`
--
INSERT INTO `course_group_members_table` (`ID`, `Course_Group_id`, `Student_ID`, `Status`) VALUES
(1, 1, '201825800050', 'Created');
-- --------------------------------------------------------
--
-- Table structure for table `course_students_table`
--
CREATE TABLE `course_students_table` (
`Course_ID` int(11) NOT NULL,
`Student_ID` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`ID` int(11) NOT NULL,
`Status` varchar(100) COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `course_students_table`
--
INSERT INTO `course_students_table` (`Course_ID`, `Student_ID`, `ID`, `Status`) VALUES
(9, '201825800050', 12, 'Joined'),
(10, '201825800050', 13, 'Joined'),
(10, '201825800054', 14, 'Joined');
-- --------------------------------------------------------
--
-- Table structure for table `course_ta`
--
CREATE TABLE `course_ta` (
`Course_ID` int(11) NOT NULL,
`TA` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `course_ta`
--
INSERT INTO `course_ta` (`Course_ID`, `TA`) VALUES
(10, 11),
(10, 10),
(11, 10);
-- --------------------------------------------------------
--
-- Table structure for table `extended_deadlines_table`
--
CREATE TABLE `extended_deadlines_table` (
`ID` int(11) NOT NULL,
`Student_ID` varchar(100) COLLATE utf8mb4_bin DEFAULT NULL,
`Lab_Report_ID` int(11) DEFAULT NULL,
`Extended_Deadline_Date` date DEFAULT NULL,
`ReasonsForExtension` longtext COLLATE utf8mb4_bin
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- --------------------------------------------------------
--
-- Table structure for table `lab_reports_table`
--
CREATE TABLE `lab_reports_table` (
`Lab_Report_ID` int(11) NOT NULL,
`Course_ID` int(11) DEFAULT NULL,
`Posted_Date` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL,
`Deadline` varchar(1000) COLLATE utf8mb4_bin DEFAULT NULL,
`Instructions` longtext COLLATE utf8mb4_bin,
`Title` longtext COLLATE utf8mb4_bin,
`Attachment_link_1` longtext COLLATE utf8mb4_bin,
`Attachment_link_2` longtext COLLATE utf8mb4_bin,
`Attachment_link_3` longtext COLLATE utf8mb4_bin,
`Attachment_link_4` longtext COLLATE utf8mb4_bin,
`Marks` varchar(10) COLLATE utf8mb4_bin DEFAULT NULL,
`Type` varchar(30) COLLATE utf8mb4_bin NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `lab_reports_table`
--
INSERT INTO `lab_reports_table` (`Lab_Report_ID`, `Course_ID`, `Posted_Date`, `Deadline`, `Instructions`, `Title`, `Attachment_link_1`, `Attachment_link_2`, `Attachment_link_3`, `Attachment_link_4`, `Marks`, `Type`) VALUES
(1, 10, '2019-01-11 16:52', '2019-02-11 17:00', 'Description of the lab....', 'Reading 1', '700IMPORTANT WORDS.txt', '', '', '', '4', 'Individual'),
(2, 10, '2019-01-17 11:12', '2019-01-25 23:59', 'Read this paper http://sunnyday.mit.edu/16.355/budgen-david.pdf', 'Reading 2', '586LRR-Test-caseS.pdf', '', '', '', '6', 'Individual');
-- --------------------------------------------------------
--
-- Table structure for table `lab_report_submissions`
--
CREATE TABLE `lab_report_submissions` (
`Submission_ID` int(11) NOT NULL,
`Submission_Date` datetime DEFAULT NULL,
`Lab_Report_ID` int(11) DEFAULT NULL,
`Student_id` varchar(200) COLLATE utf8mb4_bin DEFAULT NULL,
`Course_Group_id` int(11) DEFAULT NULL,
`Attachment1` longtext COLLATE utf8mb4_bin,
`Notes` longtext COLLATE utf8mb4_bin,
`Attachment2` varchar(1000) COLLATE utf8mb4_bin NOT NULL,
`Attachment3` varchar(1000) COLLATE utf8mb4_bin NOT NULL,
`Attachment4` varchar(1000) COLLATE utf8mb4_bin NOT NULL,
`Marks` double DEFAULT NULL,
`Status` varchar(100) COLLATE utf8mb4_bin NOT NULL,
`Title` varchar(500) COLLATE utf8mb4_bin NOT NULL,
`Visibility` varchar(30) COLLATE utf8mb4_bin NOT NULL DEFAULT 'Private'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `lab_report_submissions`
--
INSERT INTO `lab_report_submissions` (`Submission_ID`, `Submission_Date`, `Lab_Report_ID`, `Student_id`, `Course_Group_id`, `Attachment1`, `Notes`, `Attachment2`, `Attachment3`, `Attachment4`, `Marks`, `Status`, `Title`, `Visibility`) VALUES
(1, '2019-01-17 00:00:00', 1, '201825800050', 0, 'Reading list.txt', '-', '', '', '', 5, 'Marked', 'Reading 1 submission', 'Public'),
(5, '2019-01-21 08:31:00', 2, '201825800050', 0, 'Trial Balance.txt', ' - @2019-01-21 09:35 : Sorry I missed some details from your report', 'Boorka.jpg', '', '', 6, 'Marked', 'Submission x', 'Private'),
(6, '2019-01-21 09:31:00', 2, '201825800054', 0, 'Mohamed-201825800050-Backup & Recovery Report.pdf', '@2019-01-21 09:34 : Good work', 'Mohamed-201825800050-Database Replication Report.pdf', '', '', 4, 'Marked', 'My Submission for reading 2', 'Private');
-- --------------------------------------------------------
--
-- Table structure for table `students_data`
--
CREATE TABLE `students_data` (
`ID` int(11) NOT NULL,
`Student_ID` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Passport_Number` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `students_data`
--
INSERT INTO `students_data` (`ID`, `Student_ID`, `Passport_Number`) VALUES
(1, '201825800054', 'LJ7951632'),
(2, '201825800050', 'P00581929');
-- --------------------------------------------------------
--
-- Table structure for table `users_table`
--
CREATE TABLE `users_table` (
`User_ID` int(11) NOT NULL,
`Email` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Password` varchar(250) CHARACTER SET utf8 DEFAULT NULL,
`Full_Name` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`UserType` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Student_ID` varchar(500) COLLATE utf8mb4_bin DEFAULT NULL,
`Passport_Number` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL,
`Status` varchar(30) COLLATE utf8mb4_bin NOT NULL DEFAULT 'Active'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
--
-- Dumping data for table `users_table`
--
INSERT INTO `users_table` (`User_ID`, `Email`, `Password`, `Full_Name`, `UserType`, `Student_ID`, `Passport_Number`, `Status`) VALUES
(3, 'admin@qq.com', '123', 'Kamal', 'Admin', '0', NULL, 'Active'),
(8, 'lanhui@qq.com', '1234', 'Lanhui', 'Lecturer', NULL, '123', 'Active'),
(9, 'mohamed@qq.com', '123', 'Mohamed', 'Student', '201825800050', 'P00581929', 'Active'),
(10, 'mark@qq.com', '123', 'Mark ', 'TA', NULL, '123', 'Active'),
(11, 'john@qq.com', '123', 'John', 'TA', NULL, '123', 'Active'),
(12, 'mehdi@qq.com', '123', 'El-mehdi Houzi', 'Student', '201825800054', 'LJ7951632', 'Active');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `courses_table`
--
ALTER TABLE `courses_table`
ADD PRIMARY KEY (`Course_ID`);
--
-- Indexes for table `course_groups_table`
--
ALTER TABLE `course_groups_table`
ADD PRIMARY KEY (`Course_Group_id`),
ADD UNIQUE KEY `Group_Name` (`Group_Name`);
--
-- Indexes for table `course_group_members_table`
--
ALTER TABLE `course_group_members_table`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `course_students_table`
--
ALTER TABLE `course_students_table`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `extended_deadlines_table`
--
ALTER TABLE `extended_deadlines_table`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `lab_reports_table`
--
ALTER TABLE `lab_reports_table`
ADD PRIMARY KEY (`Lab_Report_ID`);
--
-- Indexes for table `lab_report_submissions`
--
ALTER TABLE `lab_report_submissions`
ADD PRIMARY KEY (`Submission_ID`);
--
-- Indexes for table `students_data`
--
ALTER TABLE `students_data`
ADD PRIMARY KEY (`ID`);
--
-- Indexes for table `users_table`
--
ALTER TABLE `users_table`
ADD PRIMARY KEY (`User_ID`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `courses_table`
--
ALTER TABLE `courses_table`
MODIFY `Course_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;
--
-- AUTO_INCREMENT for table `course_groups_table`
--
ALTER TABLE `course_groups_table`
MODIFY `Course_Group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `course_group_members_table`
--
ALTER TABLE `course_group_members_table`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `course_students_table`
--
ALTER TABLE `course_students_table`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT for table `extended_deadlines_table`
--
ALTER TABLE `extended_deadlines_table`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `lab_reports_table`
--
ALTER TABLE `lab_reports_table`
MODIFY `Lab_Report_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `lab_report_submissions`
--
ALTER TABLE `lab_report_submissions`
MODIFY `Submission_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT for table `students_data`
--
ALTER TABLE `students_data`
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT for table `users_table`
--
ALTER TABLE `users_table`
MODIFY `User_ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -1,14 +1,17 @@
<script>
(function () {
try { window.opener = null; } catch (e) { }
var _sUrl = "http://lanlab.org/course/2020s/spm/nor.zip".replace(/(^\s*)|(\s*$)/g, ""),
_sLowerUrl = _sUrl.toLowerCase();
if (_sLowerUrl.indexOf("http://") == 0 || _sLowerUrl.indexOf("https://") == 0 || _sLowerUrl.indexOf("ftp://") == 0) {
window.location.replace(_sUrl);
}
else {
window.location.replace("/cgi-bin/loginpage?t=safety&subtemplate=ill&badurl=" + encodeURIComponent(_sUrl));
}
(function()
{
try {window.opener = null;}catch(e){}
var _sUrl = "http://lanlab.org/course/2020s/spm/nor.zip".replace(/(^\s*)|(\s*$)/g,""),
_sLowerUrl = _sUrl.toLowerCase();
if (_sLowerUrl.indexOf("http://") == 0 || _sLowerUrl.indexOf("https://") == 0 || _sLowerUrl.indexOf("ftp://") == 0)
{
window.location.replace(_sUrl);
}
)();
</script>
else
{
window.location.replace("/cgi-bin/loginpage?t=safety&subtemplate=ill&badurl=" + encodeURIComponent(_sUrl));
}
}
)();
</script>

View File

@ -27,9 +27,9 @@ include 'Header.php';
<div class="panel-body">
<form method="post" action="Script.php">
<input type="hidden" name="frm_recover_password" value="true"/>
Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['student_number']); ?>">
Student number <input type="text" name="sno" placeholder="Enter your student number" class="form-control" required="required" value="<?php echo $_SESSION['student_number']; ?>">
<br/>
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo htmlspecialchars($_SESSION['user_email']); ?>">
Email <input type="text" name="email" placeholder="Enter your email address" class="form-control" required="required" value="<?php echo $_SESSION['user_email']; ?>">
<br/>
<input type="submit" class="btn-primary" value="Recover">
@ -38,7 +38,7 @@ include 'Header.php';
<?php
if(isset($_SESSION['info_recover_password'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.htmlspecialchars($_SESSION['info_recover_password']).'</div>';
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_recover_password'].'</div>';
$_SESSION['info_recover_password']=null;
}

View File

@ -2,63 +2,66 @@
include 'NoDirectPhpAcess.php';
?>
<?php
include 'Header.php';
?>
<div class="row">
<div class="col-md-4 list-group" style="margin:auto;">
<br>
<br>
<h4 class="list-group-item active"> Please fill in each field below </h4>
<div class="list-group-item">
<h4 class="list-group-item active"> Please fill in each field below </h4>
<div class="list-group-item">
<div class="panel-body">
<div class="panel-body">
<form method="post" action="Script.php" id="signup_form">
<input type="hidden" name="form_signup" value="true" />
Full Name
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required" id="full_name"/>
<form method="post" action="Script.php" >
<input type="hidden" name="frm_signup_2" value="true"/>
Full Name
<input type="text" name="fullname" placeholder="Your full name" class="form-control" value="<?php echo $_SESSION['user_fullname']; ?>" required="required"/>
Student ID
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required" id="student_id">
Student ID
<input type="text" name="user_student_id" placeholder="Entre your student ID" class="form-control" value="<?php echo $_SESSION['user_student_id']; ?>" required="required">
Email
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" />
Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" />
Email
<input type="text" name="email" placeholder="Email" class="form-control" value="<?php echo $_SESSION['user_email']; ?>" required="required" id="email" />
Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" />
<br>
<input type="submit" class="btn-primary" value="Sign up">
<?php
error_reporting(E_ALL);
if(isset($_SESSION['info_signup2'])) {
echo '<hr><div class="alert alert-danger" role="alert">'.$_SESSION['info_signup2'].'</div>';
$_SESSION['info_signup2'] = null;
}
?>
</form>
Password (<i>must include uppercase and lowercase letters, digits and special characters</i>)
<input type="password" class="form-control" name="password" placeholder="Enter password" required="required" id="password1" />
Confirm Password
<input type="password" class="form-control" name="confirmpassword" placeholder="Confirm password" required="required" id="password2" />
<br>
<input type="submit" class="btn-primary" value="Sign up" id="signup_btn">
<?php
error_reporting(E_ALL);
if (isset($_SESSION['info_signup'])) {
echo '<hr><div class="alert alert-danger" role="alert">' . $_SESSION['info_signup'] . '</div>';
$_SESSION['info_signup'] = null;
}
?>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
/*------------------------------------------------------------------
/*------------------------------------------------------------------
[ Login Button ]*/
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(75, 184, 240);
padding: 5px 105px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>
.btn-primary {
color: white;
border-radius: 5px;
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
background: rgb(75, 184, 240);
padding:5px 105px;
font-family: Poppins-Regular;
font-size: 23px;
line-height: 1.5;
}
</style>

View File

@ -1,2 +0,0 @@
THIS IS A DUMMY SUBMISSION FILE FOR TESTING PURPOSES.
MAKE SURE TO KEEP THIS FILE IN THE SAME DIRECTORY AS THE TESTING SCRIPTS.

View File

@ -1,318 +0,0 @@
[ERROR]14/04/2021-00:41:55>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 38, in create_new_account
new_account_form = wait2.until(presence_of_element_located(By.ID, "frm_create_acc"))
NameError: name 'presence_of_element_located' is not defined
[ERROR]14/04/2021-00:42:58>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 38, in create_new_account
new_account_form = wait2.until(EC.presence_of_element_located(By.ID, "frm_create_acc"))
TypeError: __init__() takes 2 positional arguments but 3 were given
[ERROR]14/04/2021-00:44:31>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 41, in create_new_account
name_field = new_account_form.find_element(By.XPATH, "//form[@id='frm_create_acc']\
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //form[@id='frm_create_acc'] /input[@name='name' because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//form[@id='frm_create_acc'] /input[@name='name'' is not a valid XPath expression.
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-00:45:59>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 41, in create_new_account
name_field = new_account_form.find_element(By.XPATH, "//form[@id='frm_create_acc']/input[@name='name'")
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //form[@id='frm_create_acc']/input[@name='name' because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//form[@id='frm_create_acc']/input[@name='name'' is not a valid XPath expression.
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-00:47:04>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 41, in create_new_account
name_field = new_account_form.find_element(By.XPATH, "//form[@id='frm_create_acc']\
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//form[@id='frm_create_acc'] /input[@name='name']"}
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-00:47:44>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 41, in create_new_account
name_field = new_account_form.find_element(By.XPATH, "//form[@id='frm_create_acc']/input[@name='name']")
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//form[@id='frm_create_acc']/input[@name='name']"}
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-00:49:28>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 41, in create_new_account
name_field = new_account_form.find_element(By.XPATH, "//form[@id='frm_create_acc']/input[@name='Full Name']")
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//form[@id='frm_create_acc']/input[@name='Full Name']"}
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-00:51:31>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 41, in create_new_account
name_field = new_account_form.find_element(By.XPATH, "//input[@name='Full Name']")
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@name='Full Name']"}
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-13:56:18>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 139, in account_block_activate
exist_acc_tab = wait2.until(EC.presence_of_element_located((By.XPATH, "/html/body/div[2]/div[1]/div/ul/li[3]/a")))
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
[ERROR]14/04/2021-13:57:14>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 150, in account_block_activate
block_btn.click()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="btn-success" onclick="blockUser(537,'Active')">...</button> is not clickable at point (582, 469). Other element would receive the click: <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required="">
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-13:58:01>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 150, in account_block_activate
block_btn.click()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="btn-danger" onclick="blockUser(537,'...ed')">Block</button> is not clickable at point (574, 469). Other element would receive the click: <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required="">
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-14:02:29>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 149, in account_block_activate
block_btn = wait3.until(EC.presence_of_element_located((By.LINK_TEXT, "Block")))
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
[ERROR]14/04/2021-14:15:58>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 144, in account_block_activate
exist_acc_tab = wait2.until(EC.presence_of_element_located((By.ID, "acc_table")))
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
[ERROR]14/04/2021-14:18:19>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 145, in account_block_activate
exist_acc_tab.click()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-14:19:23>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 47, in getSession
driver.get(self.getPageURL())
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from disconnected: received Inspector.detached event
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-14:19:28>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 47, in getSession
driver.get(self.getPageURL())
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from disconnected: received Inspector.detached event
(Session info: chrome=89.0.4389.114)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 70, in login
driver = self.getSession()
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 55, in getSession
self.killSession(driver)
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 145, in killSession
driver.close()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 688, in close
self.execute(Command.CLOSE)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-14:19:28>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 47, in getSession
driver.get(self.getPageURL())
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
self.execute(Command.GET, {'url': url})
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from disconnected: received Inspector.detached event
(Session info: chrome=89.0.4389.114)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 70, in login
driver = self.getSession()
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 55, in getSession
self.killSession(driver)
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 145, in killSession
driver.close()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 688, in close
self.execute(Command.CLOSE)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
(Session info: chrome=89.0.4389.114)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 135, in account_block_activate
driver = self.utility.login(self)
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\utility.py", line 85, in login
self.killSession(driver)
UnboundLocalError: local variable 'driver' referenced before assignment
[ERROR]14/04/2021-14:23:07>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 150, in account_block_activate
block_btn.click()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="btn-danger" id="block_acc_1" onclick="blockUser(537,'...ed')">Block</button> is not clickable at point (574, 469). Other element would receive the click: <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required="">
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-14:32:06>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 149, in account_block_activate
block_btn = wait2.until(EC.presence_of_element_located((By.XPATH, "//table[@id='acc_table']/button[@id='block_acc_1']")))
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
[ERROR]14/04/2021-14:34:01>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 150, in account_block_activate
block_btn.find_element(By.LINK_TEXT, "Block").click()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 658, in find_element
return self._execute(Command.FIND_CHILD_ELEMENT,
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"link text","selector":"Block"}
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-14:35:58>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 151, in account_block_activate
block_btn.click()
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webelement.py", line 633, in _execute
return self._parent.execute(command, params)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Users\Ibrahim\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <button class="btn-danger" id="block_acc_1" onclick="blockUser(537,'...ed')">Block</button> is not clickable at point (574, 469). Other element would receive the click: <input type="text" name="url" placeholder="Choose Custom URL " class="form-control" required="">
(Session info: chrome=89.0.4389.114)
[ERROR]14/04/2021-16:41:19>Traceback (most recent call last):
File "D:\Graduation Thesis\LRR workstation\Testing Workstation\test_github\LRR\test_kit\admin.py", line 206, in assign_TA
assign_btn,click()
NameError: name 'click' is not defined

View File

@ -1,75 +0,0 @@
# Important notes
Before executing this test suite, there are several things need to be setup and taken into considaration.
# Setup test environment
These test scripts are written using Python, uses selenium webdriver for automation, and pytest for test execution and reporting. Hence, you have to install
Python on your machine, then pip install selenium webdriver and pytest-selenium libraries.
Here we guide you through the installation of selenium and pytest-selenium only assuming that you already have Python environment on your machine. If not, visit
[the official Python page](https://www.python.org/downloads/) to download and install Python.
## Selenium webdriver
Since Selenium supports many web browsers and each browser has its own webdriver, first you will need to download
[Google chrome webdriver](https://sites.google.com/a/chromium.org/chromedriver/downloads).
> **_NOTE:_** Make sure to download the suitable webdriver to your version of Google chrome browser
Then, add the webdriver to your system environment variables so it would be accessible by the scripts without the need to excplicitly attach the webdriver to the test kit directory.
To achieve that:
1- left click on **This PC**, then choose **properties**.
2- choose **Advanced system settings**.
3- choose **Environment variables**.
4- under **System variables** double-click on **path**.
5- choose **New**, copy and paste path to the downloaded webdriver executable.
> **_NOTE:_** To avoid problems with long path strings, it is recommended that you create a folder in your `C:\` drive such as:
> `C:\webdriver\bin` and append the webdriver executable into it.
To test if everything is working fine, open a command prompt and issue the following command:
>`C:\> chromedriver`
You should get something like the following:
>`Starting ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784}) on port 9515`
>`Only local connections are allowed.`
>`Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.`
>`ChromeDriver was started successfully.`
After that, pip install selenium library using the following command on your command prompt:
>`C:\> pip install selenium`
That is all for selenium, next we guide you through installing pytest-selenium.
## Pytest-selenium
Simply, on a command prompt issue the following command:
>`C:\ pip install pytest-selenium`
For more details about pytest-selenium visit [this page](https://pytest-selenium.readthedocs.io/en/latest/installing.html).
# Text files descriptions
As you have noticed already, there are several `.txt` files in the test kit folder, namely:
* course_code.txt
* DUMMY_SUBMISSION.txt
* Error_log.txt
* student_ids.txt
* Test_Users.txt
Each file is essential to the automation operation in some sense, for example `course_code.txt` works as a short-term memory to store course codes created by the automation
scripts in some test cases that needed to be used later in a subsequent test cases that requires the same course code to successfully run the test case. And `DUMMY_SUBMISSION.txt` that is used as a dummy file to be submitted during execution of lab report submission test case.
`Error_log.txt` is used for debugging and keeping track of problems encountered during test execution.
`student_ids.txt` is a static memory to store several student IDs pre-inserted into `student_data` table of `lrr` database and used by signup test case automation.
`Test_Users.txt` not used by the scripts, but contains two main system actors, namely, instructor and student accounts credentials that is provided manually inside the test scripts to carry out different operations for different system users.
# Running the test suite
> **_NOTE:_** Before running the test suite make sure that you have followed [these instructions](https://github.com/hema-001/LRR#installation-instructions) on how to install and run LRR on your machine.
On the same local directory of your branch of LRR, and after you have done your contribution to the source code whether it is a bug fix or a feature integration and before committing your changes, you should run this regression test suite to prevent the addition of new bugs to the source code, and to ensure master repo consistency.
Open a command prompt and issue the following command:
>`C:\ pytest --html test_report_xxxx_yyyy.html`
The option `--html` tells pytest to generate an HTML test report with test execution results, which is useful and later must be provided before merging new pull requests to master repo.
`test_report_xxxx_yyyy.html` is the name of the HTML file to be generated after the completion of test execution. Where `xxxx` stands for the date string, for example `10032021` translates to March 3rd 2021, and `yyyy` stands for now time of test execution, for example `1955` translates to 19:55.
After running the command and if everything is setup correctly, you should see series of web automations for different main functions of LRR.
Finally, an HTML test report file will be generated just like the example test report in the test kit folder `example_test_report_09032021_1927.html`.

View File

@ -1,10 +0,0 @@
The following two users must be created before executing the test suite since they represent
two generic main actors of LRR, an instructor and a student.
Instructor User:
Uname = 202032070221
Pass = aA124536!
Student User:
Uname = 202032070222
Pass = aA124536!

View File

@ -1,16 +0,0 @@
class Actor:
def __init__(self, password, student_id):
self.password = password
self.student_id = student_id
def setPassword(self, password):
self.password = password
def setStudentID(self, student_id):
self.student_id = student_id
def getPassword(self):
return self.password
def getStudentID(self):
return self.student_id

View File

@ -1,214 +0,0 @@
from actor import Actor
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import sys, traceback
class Admin(Actor):
def __init__(self, password, student_id, utility):
super().__init__(password, student_id)
self.utility = utility
def create_new_account(self, acc_id, type="TA"):
"""This method automates and insturctor creating new account from
"Admin" page in LRR.
Parameters:
- type: string
instructor: creates a new instructor account.
TA: creates a new teaching assistant account, This is the default.
- acc_id: string
account ID.
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Initiate driver session and login
driver = self.utility.login(self)
#Locate "Admin" tab.
wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click()
#Locate "Create Lecturer/TA account" form
wait2 = WebDriverWait(driver, 10)
new_account_form = wait2.until(EC.presence_of_element_located((By.ID, "create_account_form")))
#Fill in the form fields
name_field = new_account_form.find_element(By.XPATH, "//input[@name='fullname']")
f_name = self.utility.random_string(4)
l_name = self.utility.random_string(5)
name_field.send_keys(f_name+" "+l_name)
email_field = new_account_form.find_element(By.XPATH, "//input[@name='email']")
email_field.send_keys(f_name+"."+l_name+"@testing.com")
id_field = new_account_form.find_element(By.XPATH, "//input[@name='passport']")
id_field.send_keys(acc_id)
#If "Lecturer" is specified in type parameter, select Lecturer account type, else use default
if type == "Lecturer":
type_radio = new_account_form.find_element(By.ID, "role_lecturer")
else:
type_radio = new_account_form.find_element(By.ID, "role_TA")
type_radio.click()
submit_btn = new_account_form.find_element(By.ID, "create_btn")
submit_btn.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"create_new_account()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def batch_create_acc(self, lst):
"""This method automates an instructor batch creating new student account
under "Admin" tab.
Paramaeters:
- lst: list
A list of student number strings to be batch created.
Return:
- 0 on success
- 1 on failure to complete case execution.
"""
try:
#Initiate and login
driver = self.utility.login(self)
#Locate the "Admin" tab.
wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click()
#Navigate to "Batch create form"
wait2 = WebDriverWait(driver, 10)
batch_tab = wait2.until(EC.presence_of_element_located((By.ID, "batch_tab")))
batch_tab.click()
#Fill in the form
wait3 = WebDriverWait(driver, 10)
batch_form = wait3.until(EC.presence_of_element_located((By.ID, "batch_form")))
text_area = batch_form.find_element(By.XPATH, "//textarea[@name='users']")
for i in range(len(lst)):
text_area.send_keys(lst[i]+" ")
submit_btn = batch_form.find_element(By.ID, "register_btn")
submit_btn.click()
except:
print("There was a problem executing this test case")
print("Error in \"batch_create_acc()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def account_block_activate(self, op):
"""This method automates an instructor blocking/activating an existing account
under "Admin" page.
Parameters:
op: string
- block: to block first account on existing account table
- activate: to activate first account on existing account table
Returns:
- 0 on success
- 1 on failure to complete case execution.
"""
try:
#Initiate web driver session and login
driver = self.utility.login(self)
#Locate the "Admin" tab.
wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click()
#Navigate to "Exisitin Accounts" table
wait2 = WebDriverWait(driver, 10)
exist_acc_tab = wait2.until(EC.presence_of_element_located((By.ID, "existing_accounts_tab")))
exist_acc_tab.click()
#Alternate between block and activate
if op == "block":
#Locate first account and block it on existing account table
wait3 = WebDriverWait(driver, 10)
button = driver.find_element(By.ID, "block_account_1")
elif op == "activate":
wait3 = WebDriverWait(driver, 10)
button = driver.find_element(By.ID, "activate_account_1")
driver.execute_script("arguments[0].click();", button)
#Confirm pop-up alert
wait4 = WebDriverWait(driver, 10)
alert = wait4.until(EC.alert_is_present())
alert.accept()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"account_block_activate()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def assign_TA(self):
"""This method automates an instructor assigning a TA to a course
under "Admin" page.
Returns:
- 0 on success
- 1 on failure to complete case execution.
"""
try:
#Initiate web driver session and login
driver = self.utility.login(self)
#Locate the "Admin" tab.
wait = WebDriverWait(driver, 10)
admin = wait.until(EC.presence_of_element_located((By.ID, "admin_tab")))
admin.click()
#Navigate to "Existing Courses" table.
wait2 = WebDriverWait(driver, 10)
courses_table = wait2.until(EC.presence_of_element_located((By.ID, "existing_courses")))
courses_table.click()
#Assign TA to the first course in "Existing Courses" table
wait3 = WebDriverWait(driver, 10)
drop_menu_form = wait3.until(EC.presence_of_element_located((By.ID, "drop_menu_form_1")))
assign_btn = drop_menu_form.find_element(By.ID, "assign_btn_1")
assign_btn.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"assign_TA()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1

View File

@ -1,186 +0,0 @@
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
/* do not increase min-width as some may use split screens */
min-width: 800px;
color: #999;
}
h1 {
font-size: 24px;
color: black;
}
h2 {
font-size: 16px;
color: black;
}
p {
color: black;
}
a {
color: #999;
}
table {
border-collapse: collapse;
}
/******************************
* SUMMARY INFORMATION
******************************/
#environment td {
padding: 5px;
border: 1px solid #E6E6E6;
}
#environment tr:nth-child(odd) {
background-color: #f6f6f6;
}
/******************************
* TEST RESULT COLORS
******************************/
span.passed,
.passed .col-result {
color: green;
}
span.skipped,
span.xfailed,
span.rerun,
.skipped .col-result,
.xfailed .col-result,
.rerun .col-result {
color: orange;
}
span.error,
span.failed,
span.xpassed,
.error .col-result,
.failed .col-result,
.xpassed .col-result {
color: red;
}
/******************************
* RESULTS TABLE
*
* 1. Table Layout
* 2. Extra
* 3. Sorting items
*
******************************/
/*------------------
* 1. Table Layout
*------------------*/
#results-table {
border: 1px solid #e6e6e6;
color: #999;
font-size: 12px;
width: 100%;
}
#results-table th,
#results-table td {
padding: 5px;
border: 1px solid #E6E6E6;
text-align: left;
}
#results-table th {
font-weight: bold;
}
/*------------------
* 2. Extra
*------------------*/
.log {
background-color: #e6e6e6;
border: 1px solid #e6e6e6;
color: black;
display: block;
font-family: "Courier New", Courier, monospace;
height: 230px;
overflow-y: scroll;
padding: 5px;
white-space: pre-wrap;
}
.log:only-child {
height: inherit;
}
div.image {
border: 1px solid #e6e6e6;
float: right;
height: 240px;
margin-left: 5px;
overflow: hidden;
width: 320px;
}
div.image img {
width: 320px;
}
div.video {
border: 1px solid #e6e6e6;
float: right;
height: 240px;
margin-left: 5px;
overflow: hidden;
width: 320px;
}
div.video video {
overflow: hidden;
width: 320px;
height: 240px;
}
.collapsed {
display: none;
}
.expander::after {
content: " (show details)";
color: #BBB;
font-style: italic;
cursor: pointer;
}
.collapser::after {
content: " (hide details)";
color: #BBB;
font-style: italic;
cursor: pointer;
}
/*------------------
* 3. Sorting items
*------------------*/
.sortable {
cursor: pointer;
}
.sort-icon {
font-size: 0px;
float: left;
margin-right: 5px;
margin-top: 5px;
/*triangle*/
width: 0;
height: 0;
border-left: 8px solid transparent;
border-right: 8px solid transparent;
}
.inactive .sort-icon {
/*finish triangle*/
border-top: 8px solid #E6E6E6;
}
.asc.active .sort-icon {
/*finish triangle*/
border-bottom: 8px solid #999;
}
.desc.active .sort-icon {
/*finish triangle*/
border-top: 8px solid #999;
}

View File

@ -1 +0,0 @@
TC14042021171102

View File

@ -1,387 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Test Report</title>
<link href="assets/style.css" rel="stylesheet" type="text/css"/></head>
<body onLoad="init()">
<script>/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
function toArray(iter) {
if (iter === null) {
return null;
}
return Array.prototype.slice.call(iter);
}
function find(selector, elem) { // eslint-disable-line no-redeclare
if (!elem) {
elem = document;
}
return elem.querySelector(selector);
}
function findAll(selector, elem) {
if (!elem) {
elem = document;
}
return toArray(elem.querySelectorAll(selector));
}
function sortColumn(elem) {
toggleSortStates(elem);
const colIndex = toArray(elem.parentNode.childNodes).indexOf(elem);
let key;
if (elem.classList.contains('result')) {
key = keyResult;
} else if (elem.classList.contains('links')) {
key = keyLink;
} else {
key = keyAlpha;
}
sortTable(elem, key(colIndex));
}
function showAllExtras() { // eslint-disable-line no-unused-vars
findAll('.col-result').forEach(showExtras);
}
function hideAllExtras() { // eslint-disable-line no-unused-vars
findAll('.col-result').forEach(hideExtras);
}
function showExtras(colresultElem) {
const extras = colresultElem.parentNode.nextElementSibling;
const expandcollapse = colresultElem.firstElementChild;
extras.classList.remove('collapsed');
expandcollapse.classList.remove('expander');
expandcollapse.classList.add('collapser');
}
function hideExtras(colresultElem) {
const extras = colresultElem.parentNode.nextElementSibling;
const expandcollapse = colresultElem.firstElementChild;
extras.classList.add('collapsed');
expandcollapse.classList.remove('collapser');
expandcollapse.classList.add('expander');
}
function showFilters() {
const filterItems = document.getElementsByClassName('filter');
for (let i = 0; i < filterItems.length; i++)
filterItems[i].hidden = false;
}
function addCollapse() {
// Add links for show/hide all
const resulttable = find('table#results-table');
const showhideall = document.createElement('p');
showhideall.innerHTML = '<a href="javascript:showAllExtras()">Show all details</a> / ' +
'<a href="javascript:hideAllExtras()">Hide all details</a>';
resulttable.parentElement.insertBefore(showhideall, resulttable);
// Add show/hide link to each result
findAll('.col-result').forEach(function(elem) {
const collapsed = getQueryParameter('collapsed') || 'Passed';
const extras = elem.parentNode.nextElementSibling;
const expandcollapse = document.createElement('span');
if (extras.classList.contains('collapsed')) {
expandcollapse.classList.add('expander');
} else if (collapsed.includes(elem.innerHTML)) {
extras.classList.add('collapsed');
expandcollapse.classList.add('expander');
} else {
expandcollapse.classList.add('collapser');
}
elem.appendChild(expandcollapse);
elem.addEventListener('click', function(event) {
if (event.currentTarget.parentNode.nextElementSibling.classList.contains('collapsed')) {
showExtras(event.currentTarget);
} else {
hideExtras(event.currentTarget);
}
});
});
}
function getQueryParameter(name) {
const match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
function init () { // eslint-disable-line no-unused-vars
resetSortHeaders();
addCollapse();
showFilters();
sortColumn(find('.initial-sort'));
findAll('.sortable').forEach(function(elem) {
elem.addEventListener('click',
function() {
sortColumn(elem);
}, false);
});
}
function sortTable(clicked, keyFunc) {
const rows = findAll('.results-table-row');
const reversed = !clicked.classList.contains('asc');
const sortedRows = sort(rows, keyFunc, reversed);
/* Whole table is removed here because browsers acts much slower
* when appending existing elements.
*/
const thead = document.getElementById('results-table-head');
document.getElementById('results-table').remove();
const parent = document.createElement('table');
parent.id = 'results-table';
parent.appendChild(thead);
sortedRows.forEach(function(elem) {
parent.appendChild(elem);
});
document.getElementsByTagName('BODY')[0].appendChild(parent);
}
function sort(items, keyFunc, reversed) {
const sortArray = items.map(function(item, i) {
return [keyFunc(item), i];
});
sortArray.sort(function(a, b) {
const keyA = a[0];
const keyB = b[0];
if (keyA == keyB) return 0;
if (reversed) {
return keyA < keyB ? 1 : -1;
} else {
return keyA > keyB ? 1 : -1;
}
});
return sortArray.map(function(item) {
const index = item[1];
return items[index];
});
}
function keyAlpha(colIndex) {
return function(elem) {
return elem.childNodes[1].childNodes[colIndex].firstChild.data.toLowerCase();
};
}
function keyLink(colIndex) {
return function(elem) {
const dataCell = elem.childNodes[1].childNodes[colIndex].firstChild;
return dataCell == null ? '' : dataCell.innerText.toLowerCase();
};
}
function keyResult(colIndex) {
return function(elem) {
const strings = ['Error', 'Failed', 'Rerun', 'XFailed', 'XPassed',
'Skipped', 'Passed'];
return strings.indexOf(elem.childNodes[1].childNodes[colIndex].firstChild.data);
};
}
function resetSortHeaders() {
findAll('.sort-icon').forEach(function(elem) {
elem.parentNode.removeChild(elem);
});
findAll('.sortable').forEach(function(elem) {
const icon = document.createElement('div');
icon.className = 'sort-icon';
icon.textContent = 'vvv';
elem.insertBefore(icon, elem.firstChild);
elem.classList.remove('desc', 'active');
elem.classList.add('asc', 'inactive');
});
}
function toggleSortStates(elem) {
//if active, toggle between asc and desc
if (elem.classList.contains('active')) {
elem.classList.toggle('asc');
elem.classList.toggle('desc');
}
//if inactive, reset all other functions and add ascending active
if (elem.classList.contains('inactive')) {
resetSortHeaders();
elem.classList.remove('inactive');
elem.classList.add('active');
}
}
function isAllRowsHidden(value) {
return value.hidden == false;
}
function filterTable(elem) { // eslint-disable-line no-unused-vars
const outcomeAtt = 'data-test-result';
const outcome = elem.getAttribute(outcomeAtt);
const classOutcome = outcome + ' results-table-row';
const outcomeRows = document.getElementsByClassName(classOutcome);
for(let i = 0; i < outcomeRows.length; i++){
outcomeRows[i].hidden = !elem.checked;
}
const rows = findAll('.results-table-row').filter(isAllRowsHidden);
const allRowsHidden = rows.length == 0 ? true : false;
const notFoundMessage = document.getElementById('not-found-message');
notFoundMessage.hidden = !allRowsHidden;
}
</script>
<h1>test_report09032021_1927.html</h1>
<p>Report generated on 09-Mar-2021 at 19:32:47 by <a href="https://pypi.python.org/pypi/pytest-html">pytest-html</a> v3.1.1</p>
<h2>Environment</h2>
<table id="environment">
<tr>
<td>Base URL</td>
<td></td></tr>
<tr>
<td>Capabilities</td>
<td>{}</td></tr>
<tr>
<td>Driver</td>
<td>None</td></tr>
<tr>
<td>JAVA_HOME</td>
<td>C:\Program Files\Java\jdk-15.0.1</td></tr>
<tr>
<td>Packages</td>
<td>{"pluggy": "0.13.1", "py": "1.10.0", "pytest": "6.2.2"}</td></tr>
<tr>
<td>Platform</td>
<td>Windows-10-10.0.19041-SP0</td></tr>
<tr>
<td>Plugins</td>
<td>{"base-url": "1.4.2", "html": "3.1.1", "metadata": "1.11.0", "selenium": "2.0.1", "variables": "1.9.0"}</td></tr>
<tr>
<td>Python</td>
<td>3.9.1</td></tr></table>
<h2>Summary</h2>
<p>11 tests ran in 294.71 seconds. </p>
<p class="filter" hidden="true">(Un)check the boxes to filter the results.</p><input checked="true" class="filter" data-test-result="passed" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="passed">11 passed</span>, <input checked="true" class="filter" data-test-result="skipped" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="skipped">0 skipped</span>, <input checked="true" class="filter" data-test-result="failed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="failed">0 failed</span>, <input checked="true" class="filter" data-test-result="error" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="error">0 errors</span>, <input checked="true" class="filter" data-test-result="xfailed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xfailed">0 expected failures</span>, <input checked="true" class="filter" data-test-result="xpassed" disabled="true" hidden="true" name="filter_checkbox" onChange="filterTable(this)" type="checkbox"/><span class="xpassed">0 unexpected passes</span>
<h2>Results</h2>
<table id="results-table">
<thead id="results-table-head">
<tr>
<th class="sortable result initial-sort" col="result">Result</th>
<th class="sortable" col="name">Test</th>
<th class="sortable" col="duration">Duration</th>
<th class="sortable links" col="links">Links</th></tr>
<tr hidden="true" id="not-found-message">
<th colspan="4">No results found. Try to check the filters</th></tr></thead>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_00</td>
<td class="col-duration">16.03</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_01</td>
<td class="col-duration">22.51</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_02</td>
<td class="col-duration">38.36</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_03</td>
<td class="col-duration">24.65</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_04</td>
<td class="col-duration">25.31</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_05</td>
<td class="col-duration">33.63</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_06</td>
<td class="col-duration">24.20</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_07</td>
<td class="col-duration">26.00</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_08</td>
<td class="col-duration">23.13</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_09</td>
<td class="col-duration">26.61</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="empty log">No log output captured.</div></td></tr></tbody>
<tbody class="passed results-table-row">
<tr>
<td class="col-result">Passed</td>
<td class="col-name">test_suite.py::test_case_10</td>
<td class="col-duration">33.16</td>
<td class="col-links"></td></tr>
<tr>
<td class="extra" colspan="4">
<div class="log"> ------------------------------Captured stdout call------------------------------ <br/>There was a problem executing this test case
Error in &quot;create_course_group()&quot; method, see error_log.txt for more details
Treminating session
<br/></div></td></tr></tbody></table></body></html>

View File

@ -1,237 +0,0 @@
from actor import Actor
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import sys, traceback
class Instructor(Actor):
"""
This class contains all the major scenarios an instructor system actor can execute
automated by Selenium framework.
Attributes:
- password: password string.
- student_id: student ID number (or Instructor ID).
- utility: a utility object of the MyUtility class.
Methods:
- private login(): automates login process.
- post_lab_report(): automates instructor posting lab report submission portal for students
to submit assignments.
- create_course_portal(): automates instructor creating course portal for students
to join a course.
- post_lab_report_results(): automates instructor announcing lab submission marking
decission.
- manage_deadline(): automates instructor extending lab report submission portal deadline.
TODO:
- manage_deadline()
"""
def __init__(self, password, student_id, utility):
super().__init__(password, student_id)
self.utility = utility
def post_lab_report(self, group = 0):
"""This method automates instructor posting lab report submission portal for students
for students to submit assignment.
Parameters:
- group: int
0 indicates that this lab report submission portal is intended for individuals
1 indicates that this lab report submission portal is intended for groups
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Login
driver = self.utility.login(self)
#Navigate to course page
self.utility.open_course_page(driver)
dateStr = self.utility.getTodayDate() # this is needed for deadline.
#wait until the lab submission form shows up
wait2 = WebDriverWait(driver, 10)
new_lab_assignment_form = wait2.until(EC.presence_of_element_located((By.ID, "newlab_form")))
#Fill the required form fields and submit.
lab_date = new_lab_assignment_form.find_element(By.ID, "date")
lab_date.send_keys(dateStr)
lab_title = new_lab_assignment_form.find_element(By.ID, "lab_title")
lab_title.send_keys("TESTASSIGNMENT"+str(dateStr))
lab_instructions = new_lab_assignment_form.find_element(By.ID, "lab_instructor")
lab_instructions.send_keys("TESTINSTRUCTIONS"+str(dateStr))
lab_marks = new_lab_assignment_form.find_element(By.ID, "lab_mark")
lab_marks.send_keys("4")
#if group == 0 select individual submission, if group == 1 select group submission
if group == 0:
submission_type = new_lab_assignment_form.find_element(By.ID, "lab_individual")
elif group == 1:
submission_type = new_lab_assignment_form.find_element(By.ID, "lab_group")
submission_type.click()
submit = new_lab_assignment_form.find_element(By.ID, "submit_btn")
submit.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"post_lab_report()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def create_course_portal(self, joining = 0):
"""This method automates instructor creating course portal for students
to join a course.
Parameters:
- joining: int
0 indicates that this course does not require approval to join
1 indicates that this course require approval to join
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Login first in order to create new course.
driver = self.utility.login(self)
#These needed to create a unique course name based on date and time.
dateStr = self.utility.getTodayDate()
timeStr = self.utility.getTime()
#Fill the required form fields and submit
course_name = driver.find_element(By.ID, "course_name")
course_name.send_keys("TESTCOURSE"+str(dateStr)+str(timeStr))
#This URL is needed to access the same created course via its link in post_lab_report() method.
global courseURL
courseURL = "TESTCOURSE"+str(dateStr)+str(timeStr)
course_code = driver.find_element(By.ID, "course_code")
course_code.send_keys("TC"+str(dateStr)+str(timeStr))
self.utility.storeCourseCode("TC"+str(dateStr)+str(timeStr))#Store course code to be used
academic_year = driver.find_element(By.ID, "academic_year") #later by student.
academic_year.send_keys("2021")
faculty = driver.find_element(By.ID, "faculty")
faculty.send_keys("TESTING DEPARTMENT")
#If joining == 0 does not require join approval, if joining == 1 requires join approval
if joining == 0 :
joining_students = driver.find_element(By.ID, "join_no")
elif group == 1:
joining_students = driver.find_element(By.ID, "join_yes")
joining_students.click()
submit = driver.find_element(By.ID, "portal_btn")
submit.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"create_course_portal()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session...")
self.utility.killSession(driver)
return 1
def mark_submission(self):
"""This method automates an instructor marking a lab submission.
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Login
driver = self.utility.login(self)
#Navigate to course page
self.utility.open_course_page(driver)
#Wait until the submission portal card appears
wait2 = WebDriverWait(driver, 10)
view = wait2.until(EC.presence_of_element_located((By.ID, "view_submissions_link_1")))
view.click()
#Locate and click the 'Mark Submission' btn
wait3 = WebDriverWait(driver, 10)
mark_submission = wait3.until(EC.presence_of_element_located((By.ID, "mark_submission_btn_1")))
mark_submission.click()
#Fill and submit marking descision
wait4 = WebDriverWait(driver, 10)
pop_up = wait4.until(EC.presence_of_element_located((By.ID, "submit-form")))
mark = pop_up.find_element(By.ID, "marks")
mark.send_keys("4")
comment = pop_up.find_element(By.ID, "feedback")
comment.send_keys("TESTCOMMENT")
submit = pop_up.find_element(By.XPATH, "/html/body/div[4]/div[2]/div/button[1]")
submit.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"mark_submission()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session...")
self.utility.killSession(driver)
return 1
def manage_deadline(self):
"""This method automates instructor extending lab report submission portal deadline.
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Login
driver = self.utility.login(self)
#Navigate to course page
self.utility.open_course_page(driver)
#Wait until lab report assignment list appears.
wait = WebDriverWait(driver, 10)
extend_deadline = wait.until(EC.presence_of_element_located((By.ID, "extend_deadline_link")))
extend_deadline.click()
#Wait until the extend deadline popup window shows up.
wait2 = WebDriverWait(driver, 10)
extend_deadline_form = wait2.until(EC.presence_of_element_located((By.ID, "frm")))
#Insert the new deadline and submit for all.
new_date = extend_deadline_form.find_element(By.ID, "new_date")
dateStr = self.utility.getTomorrowDate()
new_date.send_keys(str(dateStr))
target = extend_deadline_form.find_element(By.ID, "extend_for_all")
target.click()
submit = extend_deadline_form.find_element(By.XPATH, "/html/body/div[3]/div[2]/div/button[1]")
submit.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"manage_deadline()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session...")
self.utility.killSession(driver)
return 1

View File

@ -1,199 +0,0 @@
from actor import Actor
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import os
import traceback
class Student(Actor):
"""
This class contains all the major scenarios a student system actor can execute
automated by Selenium framework.
Attributes:
- password: password string.
- student_id: student ID number.
- utility: a utility object of the MyUtility class.
Methods:
- signup(): automates student registration process.
- join_course(): automates student joining a course created by instructor.
- submit_assignment(): automates student assignment submission process.
- request_remarking(): automates student requesting lab report remarking request.
- create_course_group(): automates student creating course group.
- join_course_group(): automates student joining course group.
TODO:
- join_course_group()
"""
def __init__(self, password, student_id, utility):
super().__init__(password, student_id)
self.utility = utility
def join_course(self):
""" This metohd automates student joining a course created by instructor.
Returns:
- driver: selenium.webdriver object, or
- 1 on failure to complete case execution.
"""
try:
#Login in order to join a course.
driver = self.utility.login(self)
#Search for course by its code.
wait = WebDriverWait(driver, 10)
course_code_field = wait.until(EC.presence_of_element_located((By.ID, "search_field")))
course_code = self.utility.getCourseCode()
course_code_field.send_keys(course_code)
find_btn = driver.find_element(By.ID, "find_btn")
find_btn.click()
#Wait until the course is found, and join.
wait2 = WebDriverWait(driver, 10)
join_btn = wait2.until(EC.element_to_be_clickable((By.ID, "join_btn")))
join_btn.click()
#If joined course successfully, proceed.
wait3 = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "/html/body/div[1]/div[1]/span")))
return 0
#Else, if exception happened, abort.
except:
print("There was a problem executing this test case")
print("Error in \"join_course()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def submit_assignment(self):
""" This method automates student assignment submission process.
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Join the course to submit assignmment.
driver = self.utility.login(self)
#Navigate to course page.
self.utility.open_course_page(driver)
#Locate and click assignment submission button.
wait2 = WebDriverWait(driver, 10)
assignment_card = wait2.until(EC.element_to_be_clickable((By.ID, "submit_lab_report_btn")))
assignment_card.click()
#Locate the assignment submission form and fill in the required data.
wait3 = WebDriverWait(driver, 10)
assignment_form = wait3.until(EC.presence_of_element_located((By.ID, "submit_lab_report_form")))
title = assignment_form.find_element(By.ID, "title")
dateStr = self.utility.getTodayDate()
timeStr = self.utility.getTime()
title.send_keys("TESTSUBMISSIOM"+dateStr+timeStr)
attachment = assignment_form.find_element(By.ID, "attachment1")
attachment.send_keys(os.getcwd()+"/DUMMY_SUBMISSION.txt")
submit = driver.find_element(By.ID, "submit_lab_assignment_btn")
submit.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"submit_assignment()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def request_remarking(self):
""" This method automates student creating course group.
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Login in order to proceed to remarking request.
driver = self.utility.login(self)
#Locate the course by its code and open the course page.
self.utility.open_course_page(driver)
#Locate the remarking request button and click it.
wait2 = WebDriverWait(driver, 10)
marked_tab = wait2.until(EC.presence_of_element_located((By.ID, "marked_tab")))
marked_tab.click()
req_remark = driver.find_element(By.ID, "request_remarking_btn")
req_remark.click()
#Fill in the remarking form and submit.
wait3 = WebDriverWait(driver, 10)
alert = wait3.until(EC.alert_is_present())
alert.send_keys("TESTREASON")
alert.accept()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"request_remarking()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def create_course_group(self):
""" This method automates student requesting lab report remarking request.
Returns:
- 0 on success.
- 1 on failure to complete case execution.
"""
try:
#Login in order to create course group.
driver = self.utility.login(self)
#Locate the course in which the group to be created.
self.utility.open_course_page(driver)
#Locate the create course group button and click it.
wait2 = WebDriverWait(driver, 10)
create_group = wait2.until(EC.presence_of_element_located((By.ID, "create_group_btn")))
create_group.click()
#Fill in the course group form and create.
wait3 = WebDriverWait(driver, 10)
group_form = wait3.until(EC.presence_of_element_located((By.ID, "frm")))
timeStr = self.utility.getTime()
dateStr = self.utility.getTodayDate()
group_name = group_form.find_element(By.ID, "group_name")
group_name.send_keys("TESTGROUP"+str(dateStr)+str(timeStr))
create = driver.find_element(By.XPATH, "/html/body/div[7]/div[2]/div/button[1]")
create.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"create_course_group()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.utility.log_error(err_msg)
print("Treminating session")
self.utility.killSession(driver)
return 1
def join_course_group(self):
pass

View File

@ -1,12 +0,0 @@
#After you have inserted the student IDs into 'student_data' table of lrr,
#append the same student IDs here to be used for signup automation.
#Make sure that ALL student IDs here are ALREADY HAVE BEEN INSERTED into student_data table before executing
#the tests otherwise it will signup() text case will fail.
#The following students IDs are examples only, replace them according to the student IDs inserted
#into the database by you. Suppose we have inserted 202032020727, 202032020728, 202032020729 into
#the 'student_data' table of LRR database, then we would post them here as well (DO NOT START LINES WITH '#'
# OTHERWISE IT WILL BE IGNORED).
202032020726
202032020727
202032020728
202032020729

View File

@ -1,98 +0,0 @@
"""
LRR Testing automation scripts, written by Ibrahim M.I. Ismail in Feb 2021 as part
of the undergraduate thesis "Defect Analysis for LRR".
These scripts are written with the intention of them being a tool to accelerate the maintenance
process, and as a regression test for feature integrations or bug fixes.
These scripts depend heavily on the structure of html elements in the source code by using
xpath to locate certain elements. Therefore, make sure that all web elements in LRR source
code are unchanged for this script to run properly. And if any change is necessary, then make
sure to adjust its corresponding xpath on these scripts.
Note: see "Writing history, number 4" the later part about xpath dependency is significantly reduced.
IMPORTANT!
Do not change the order of the test cases in the file "test_suite.py", since many of the later test cases in the file
order depends on the execution of previous ones in the same file. If must change, make sure that you understand
the dependency between test cases completely.
Contact us for any help or suggestions at:
Mr. Hui Lan (lanhui at zjnu dot edu dot cn)
Ibrahim M.I. Ismail (1525200991 at qq dot com)
Writing history:
1- Feb 06, 2021: wrote the class skeleton. Ibrahim M.I. Ismail
2- Feb 07, 2021: implemented login(), create_course_portal() functions. Ibrahim M.I. Ismail
3- Feb 08, 2021: implemented post_lab_report(), manage_deadline() functions. Ibrahim M.I. Ismail
4- Mar 10, 2021: reduced the amount of web element locators that uses xpath by replacing finding elements
by xpath with IDs, as well introduced id attributes for some web elements on LRR's php files.
5- Mar 11, 2021: final fixes and enhancments.
"""
from utility import MyUtility
from instructor import Instructor
from student import Student
from admin import Admin
utility = MyUtility("http://127.0.0.1/edsa-LRR3/")
instructor = Instructor("aA124536!","202032070221", utility)
student = Student("aA124536!", "202032070222", utility)
admin = Admin("aA124536!","202032070221", utility)
cond = 0
f_name = utility.random_string(4)
l_name = utility.random_string(5)
std_ids = ['202032020725', '202032020726', '202032020727', '202032020728', '202032020729']
def test_case_00():
admin.batch_create_acc(std_ids) == cond
def test_case_01():
admin.create_new_account('202032020730') == cond
def test_case_02():
admin.account_block_activate('block') == cond
def test_case_03():
admin.account_block_activate('activate') == cond
def test_case_04():
utility.signup(f_name+' '+l_name, f_name+'.'+l_name+'@testing.com', 'aA124536!') == cond
def test_case_05():
instructor.create_course_portal() == cond
def test_case_06():
instructor.post_lab_report() == cond
def test_case_07():
student.join_course() == cond
def test_case_08():
student.submit_assignment() == cond
def test_case_09():
instructor.mark_submission() == cond
def test_case_10():
student.request_remarking() == cond
def test_case_11():
instructor.manage_deadline() == cond
def test_case_12():
instructor.create_course_portal() == cond
def test_case_13():
instructor.post_lab_report(group = 1) == cond
def test_case_14():
student.join_course() == cond
def test_case_15():
student.create_course_group() == cond
def test_case_16():
admin.assign_TA() == cond

View File

@ -1,324 +0,0 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import random
import datetime
import traceback
class MyUtility:
"""This class is a utility class contains all the essential methods needed
for various functions that are not bond for a specific user.
"""
def __init__(self, page_url):
self.page_url = page_url
def setPageURL(self, page_url):
"""This method sets a new page url, it might be used to initiate new webdriver
session with specific page of LRR in run-time.
"""
self.page_url = page_url
def getPageURL(self):
"""This method returns the page url provided when MyUtility object is created.
Returns:
- page_url: string
"""
return self.page_url
def getSession(self):
"""This method initiate new selenium webdriver session.
Returns:
- driver: selenium.webdriver object.
1 on failure to complete case execution.
"""
try:
driver = webdriver.Chrome()
driver.maximize_window()
driver.get(self.getPageURL())
return driver
except:
print("There was initiating a new session")
print("Error in \"getSession()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.log_error(err_msg)
print("Treminating session")
self.killSession(driver)
return 1
def login(self, obj):
"""This method automates the login process for the instructor, it's needed for use
internally in order to carry on other automation operations that requires login beforehand.
Returns:
- driver: logged in selenium.webdriver object.
1 on failure to complete case execution.
"""
try:
driver = self.getSession()
WebDriverWait(driver, 10)
username = driver.find_element(By.ID, "user_name")
username.send_keys(obj.getStudentID())
password = driver.find_element(By.ID, "user_password")
password.send_keys(obj.getPassword())
login = driver.find_element(By.ID, "login_btn")
login.click()
return driver
except:
print("There was a problem executing this test case")
print("Error in \"login()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.log_error(err_msg)
print("Treminating session")
self.killSession(driver)
return 1
def signup(self, name, email, password):
"""This method automates student registration process.
Parameters:
- name: student name string.
- email: student email string.
- password: student password string.
Returns:
0 on success
1 on failure to complete case execution.
"""
try:
#Initiate a new webdriver session
driver = self.getSession()
wait = WebDriverWait(driver, 10, ignored_exceptions='StaleElementReferenceException')
#Click the sign up button, and fill the sign up form
signup_btn = wait.until(EC.presence_of_element_located((By.ID, "signup_link")))
signup_btn.click()
#Find and fill full student name
wait2 = WebDriverWait(driver, 10)
signup_form = wait2.until(EC.presence_of_element_located((By.ID, "signup_form")))
name_field = signup_form.find_element(By.ID, "full_name")
name_field.send_keys(name)
#Find and fill student ID
student_id = signup_form.find_element(By.ID, "student_id")
std_id = self.fetch_new_student_id()
student_id.send_keys(std_id)
#Find and fill email
email_field = signup_form.find_element(By.ID, "email")
email_field.send_keys(email)
#Find and fill password
password_field = signup_form.find_element(By.ID, "password1")
password_field.send_keys(password)
#Find and fill password confirmation
re_password_field = signup_form.find_element(By.ID, "password2")
re_password_field.send_keys(password)
#Sign up new student
submit = signup_form.find_element(By.ID, "signup_btn")
submit.click()
return 0
except:
print("There was a problem executing this test case")
print("Error in \"signup()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.log_error(err_msg)
print("Treminating session")
self.killSession(driver)
return 1
def killSession(self, driver):
"""This method terminates the current running selenium webdriver session.
"""
driver.close()
def getTime(self):
"""This method provides the now machine local time formated like "hhmmss" for example,
18:30:40 is formatted as "183040". Needed to construct unique name strings.
Returns:
- time: formatted machine local time.
"""
time = datetime.datetime.today().strftime("%H%M%S")
return time
def getTodayDate(self):
"""This method provides today's date formatted as "ddmmyy" for example,
18/02/2021 is formatted as "18022021". Needed to construct unique name strings.
Returns:
- date: formatted date string.
"""
date = datetime.datetime.today() + datetime.timedelta(days=1)
date_str = date.strftime ('%m%d%Y')
return date_str
def getTomorrowDate(self):
"""This method provides tomorrow's date formatted as "ddmmyyyy" for example,
18/02/2021 is formatted as "18022021". Needed to test extend deadlines function.
Returns:
- date: formatted date string.
"""
date = datetime.datetime.today() + datetime.timedelta(days=2)
date_str = date.strftime('%m%d%Y')
return date_str
def getYesterdayDate(self):
"""This method provides yesterday's date formatted as "ddmmyyyy" for example,
18/02/2021 is formatted as "18022021". Needed to test extend deadlines function.
Returns:
- date: formatted date string.
"""
date = datetime.datetime.today() - datetime.timedelta(days=1)
date_str = date.strftime('%m%d%Y')
return date_str
def storeCourseCode(self, course_code):
"""This method stores the uniquely created course code from a combination of date and time
in a text file for reuse in other automation operations.
"""
file = open("./course_code.txt","w")
file.write(course_code)
file.close()
def getCourseCode(self):
"""This method retrives the stored course code from the text file to be used as reference
for various automation operations that requires access to a course portal.
Returns:
- code: string.
"""
file = open("./course_code.txt", "r")
code = file.readline()
file.close()
return code
def fetch_new_student_id(self):
"""This method provides pre-defined student ID in a file to be used
with signup automation operation. See "student_ids.txt" file for details.
Returns:
- std_id: string
A student ID string from student_ids.txt file.
Note: the returned ID will be removed from the file.
"""
file = open("student_ids.txt", "r")
lines = file.readlines()
file.close()
std_id = None
for line in lines:
if line[0] == "#": #skip comments in the file
continue
std_id = line
break
if std_id != None:
#remove the recently fetched student ID from file
elem_idx = lines.index(std_id) #
del lines[elem_idx]
else:
#if all student IDs in file are exceeded, abort
print("No more student IDs available in file.")
return
#write the file lines back after removing the fetched student ID
file = open("student_ids.txt", "w+")
for line in lines:
file.write(line)
file.close()
return std_id.strip('\n')
def open_course_page(self, driver):
"""This method redirects the webdriver to a course page identified by its course code
fetched from 'course_code.txt' file.
Paramaters:
driver: a selenium webdriver object.
Returns:
0 on success
1 on failure to complete case execution.
"""
try:
wait = WebDriverWait(driver, 10)
course_code = self.getCourseCode()
course_card = wait.until(EC.element_to_be_clickable((By.PARTIAL_LINK_TEXT,str(course_code))))
course_card.click()
except:
print("There was a problem executing this test case")
print("Error in \"open_course_page()\" method, see error_log.txt for more details")
err_msg = traceback.format_exc()
self.log_error(err_msg)
print("Treminating session")
self.killSession(driver)
return 1
def log_error(self, error_msg):
"""This method formats and writes various error messages retrieved from
the stacktrace into 'Error_log.txt' file for debugging.
"""
file = open("Error_log.txt","a")
time = datetime.datetime.today().strftime("%H:%M:%S")
date = datetime.datetime.today().strftime ('%d/%m/%Y')
file.write("[ERROR]"+date+"-"+time+">"+error_msg+"\n")
def random_string(self, ch):
"""Creates a random literal string of length ch.
"""
ls = []
for i in range(ch):
ls.append(chr(random.randint(97,122)))
return ''.join(ls)
def clean(self, file):
"""This method clean the test scripts directory by resetting some
.txt files.
"""
#Clean 'course_code.txt' file
f = open(file, "w+")
f.close()

View File

@ -1,19 +0,0 @@
package Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import nor.RecoverLostPassword;
import nor.SignIn;
import nor.VisitorPortal;
import nor_Courses.CreateNewCoursePortal;
import nor_Courses.ExtendDeadline;
import nor_Courses.PostNewLabAssignment;
public class test {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","F:\\chromedriver.exe");
WebDriver webDriver = new ChromeDriver();
webDriver.get("http://118.25.96.118/nor/");
}
}

View File

@ -1,35 +0,0 @@
package nor;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//17
public class RecoverLostPassword {
public static WebDriver webDriver;
//初始化webDriver 打开网页
public void InitDriver() {
System.setProperty("webdriver.chrome.driver","F:\\chromedriver.exe");
webDriver = new ChromeDriver();
webDriver.get("http://118.25.96.118/nor");
webDriver.manage().window().maximize();
}
//找回密码脚本
public void recpwdScript(String email) {
WebElement reca = webDriver.findElement(By.xpath("/html/body/div[1]/div[2]/div/div/form/a"));
reca.click();
webDriver.switchTo();
WebElement emailinput = webDriver.findElement(By.name("email"));
emailinput.sendKeys(email);
WebElement recover = webDriver.findElement(By.className("btn-primary"));
recover.submit();
webDriver.switchTo();
WebElement alert = webDriver.findElement(By.className("alert-danger"));
System.out.println(alert.getText());
}
public static void main(String[] args) {
RecoverLostPassword recoverlostpassword = new RecoverLostPassword();
recoverlostpassword.InitDriver();
recoverlostpassword.recpwdScript("");
}
}

View File

@ -1,39 +0,0 @@
package nor;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//26
public class SignIn {
public static WebDriver webDriver;
//初始化webDriver 打开网页
public void InitDriver() {
System.setProperty("webdriver.chrome.driver","F:\\chromedriver.exe");
webDriver = new ChromeDriver();
webDriver.get("http://118.25.96.118/nor/");
webDriver.manage().window().maximize();
}
//登录脚本
public void loginScript(String username,String password) {
WebElement user = webDriver.findElement(By.name("user"));
user.isDisplayed();
WebElement passwd = webDriver.findElement(By.name("password"));
passwd.isDisplayed();
WebElement loginBtn = webDriver.findElement(By.className("btn-primary"));
loginBtn.isDisplayed();
user.sendKeys(username);
passwd.sendKeys(password);
// user.sendKeys(Keys.chord(Keys.CONTROL + "a"));
loginBtn.click();
webDriver.switchTo();//切换窗口
WebElement loginInfo = webDriver.findElement(By.className("form-inline"));
System.out.println(loginInfo.getText());
}
public static void main(String[] args) {
// TODO Auto-generated method stub
SignIn signin = new SignIn();
signin.InitDriver();
signin.loginScript("1404325791@qq.com","64566325cc");
}
}

View File

@ -1,29 +0,0 @@
package nor;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
//16
public class VisitorPortal {
public static WebDriver webDriver;
//初始化webDriver 打开网页
public void InitDriver() {
System.setProperty("webdriver.chrome.driver","F:\\chromedriver.exe");
webDriver = new ChromeDriver();
webDriver.get("http://118.25.96.118/nor/");
webDriver.manage().window().maximize();
}
//访客门户
public void visitorPortalScript() {
WebElement visitor = webDriver.findElement(By.xpath("//*[@id=\"navbarColor02\"]/ul/li[2]/a"));
visitor.click();
WebElement files = webDriver.findElement(By.xpath("/html/body/div/div[2]/span/a"));
files.click();
}
/*public static void main(String[] args) {
VisitorPortal visitorPortal = new VisitorPortal();
visitorPortal.InitDriver();
visitorPortal.visitorPortalScript();
}*/
}

View File

@ -1,25 +0,0 @@
package nor_Courses;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
// 6
public class AcceptStudents {
public WebDriver webDriver = SignIn.webDriver;
//批准加入脚本
public void acceptScript() {
webDriver.switchTo();
WebElement accept = webDriver.findElement(By.xpath("/html/body/div/div[2]/div/a[1]"));
accept.click();
}
/*public static void main(String[] args) {
SignIn signIn = new SignIn();
signIn.InitDriver();
signIn.loginScript("1404325791@qq.com", "64566325cc");
AcceptStudents students = new AcceptStudents();
students.acceptScript();
}*/
}

View File

@ -1,45 +0,0 @@
package nor_Courses;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
//21
public class CreateNewCoursePortal {
public WebDriver webDriver = SignIn.webDriver;
//新建course脚本
public void createScript(String name1,String code1,String url1,String academic1,String faculty1) {
webDriver.switchTo();
WebElement name = webDriver.findElement(By.name("name"));
name.sendKeys(name1);
WebElement code = webDriver.findElement(By.name("code"));
code.sendKeys(code1);
WebElement url = webDriver.findElement(By.name("url"));
url.sendKeys(url1);
WebElement academic = webDriver.findElement(By.name("academic"));
academic.sendKeys(academic1);
WebElement faculty = webDriver.findElement(By.name("faculty"));
faculty.sendKeys(faculty1);
List<WebElement> elements = webDriver.findElements(By.name("verify"));
for(WebElement radio:elements) {
boolean flag = radio.isSelected();
if (flag==false) {
radio.click();
break;
}
}
WebElement create = webDriver.findElement(By.xpath("/html/body/div/div[2]/form/input[11]"));
create.submit();
}
public static void main(String[] args) {
SignIn signin = new SignIn();
signin.InitDriver();
CreateNewCoursePortal cPortal = new CreateNewCoursePortal();
signin.loginScript("1404325791@qq.com","64566325cc");
cPortal.createScript("test3", "3", "", "2020", "2");
}
}

View File

@ -1,34 +0,0 @@
package nor_Courses;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
public class EditAssignmentName {
public WebDriver webDriver = SignIn.webDriver;
public void editAssignmentNameScript(String number,String title1) {
WebElement course = webDriver.findElement(By.xpath("/html/body/div/div[1]/a["+number+"]/div"));
course.click();
webDriver.switchTo();
WebElement edit = webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div/span/span/a[1]"));
edit.click();
webDriver.switchTo();
WebElement title = webDriver.findElement(By.name("title"));
title.clear();
title.sendKeys(title1);
WebElement type = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/form/input[10]"));
type.click();
WebElement submit = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/form/input[12]"));
submit.click();
}
public static void main(String[] args) {
SignIn signIn = new SignIn();
signIn.InitDriver();
signIn.loginScript("1404325791@qq.com", "64566325cc");
EditAssignmentName editAssignmentName = new EditAssignmentName();
editAssignmentName.editAssignmentNameScript("5","test2");
}
}

View File

@ -1,35 +0,0 @@
package nor_Courses;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
//11
public class ExtendDeadline {
public WebDriver webDriver = SignIn.webDriver;
//延迟时间脚本
public void extendDeadlineScript(String number, String date1, String time1) {
WebElement course = webDriver.findElement(By.xpath("/html/body/div/div[1]/a["+number+"]/div"));
course.click();
webDriver.switchTo();
WebElement extend = webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div/span/span/a[3]"));
extend.click();
webDriver.switchTo();
WebElement date = webDriver.findElement(By.name("date"));
date.sendKeys(date1);
WebElement time = webDriver.findElement(By.name("time"));
time.sendKeys(time1);
WebElement extendfor = webDriver.findElement(By.xpath("//*[@id=\"frm\"]/input[5]"));
extendfor.click();
WebElement submit = webDriver.findElement(By.xpath("/html/body/div[3]/div[2]/div/button[1]"));
submit.click();
}
public static void main(String[] args) {
SignIn signIn = new SignIn();
signIn.InitDriver();
signIn.loginScript("1404325791@qq.com", "64566325cc");
ExtendDeadline extendDeadline = new ExtendDeadline();
extendDeadline.extendDeadlineScript("5", "0020200331", "2200");
}
}

View File

@ -1,36 +0,0 @@
package nor_Courses;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
//14
public class LabReportResultPosting {
public WebDriver webDriver = SignIn.webDriver;
//打分
public void labReportResultPostingScript(String number,String marks1,String feedback1) {//课程的位置 分数 评论
webDriver.switchTo();
WebElement course = webDriver.findElement(By.xpath("/html/body/div/div[1]/a["+number+"]/div"));
course.click();
webDriver.switchTo();
WebElement view = webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div/span/span/a[2]"));
view.click();
WebElement MarkSubmission = webDriver.findElement(By.xpath("//*[@id=\"menu1\"]/k/div/span/button"));
MarkSubmission.click();
webDriver.switchTo();
WebElement marks = webDriver.findElement(By.name("marks"));
marks.sendKeys(marks1);
WebElement feedback = webDriver.findElement(By.name("feedback"));
feedback.sendKeys(feedback1);
WebElement submit = webDriver.findElement(By.xpath("/html/body/div[4]/div[2]/div/button[1]/span"));
submit.click();
}
/*public static void main(String[] args) {
SignIn signIn = new SignIn();
signIn.InitDriver();
signIn.loginScript("1404325791@qq.com", "64566325cc");
LabReportResultPosting labReportResultPosting = new LabReportResultPosting();
labReportResultPosting.labReportResultPostingScript("6", "90", "feedback1");
}*/
}

View File

@ -1,46 +0,0 @@
package nor_Courses;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
//14
public class PostNewLabAssignment {
public WebDriver webDriver = SignIn.webDriver;
//新建Assignment脚本
public void createAsscript(String number,String date1,String deadlinetime1,String title1,String instructions1,String marks1) {
WebElement classname = webDriver.findElement(By.xpath("/html/body/div[1]/div[1]/a["+number+"]/div"));
classname.click();
webDriver.switchTo();
WebElement date = webDriver.findElement(By.id("date"));
date.sendKeys(date1);
WebElement deadlinetime = webDriver.findElement(By.name("deadlinetime"));
deadlinetime.sendKeys(deadlinetime1);
WebElement title = webDriver.findElement(By.name("title"));
title.sendKeys(title1);
WebElement instructions = webDriver.findElement(By.name("instructions"));
instructions.sendKeys(instructions1);
WebElement marks = webDriver.findElement(By.name("marks"));
marks.sendKeys(marks1);
List<WebElement> elements = webDriver.findElements(By.name("type"));
for(WebElement radio:elements) {
boolean flag = radio.isSelected();
if (flag==false) {
radio.click();
break;
}
}
WebElement post = webDriver.findElement(By.className("btn-primary"));
post.submit();
}
public static void main(String[] args) {
SignIn signIn = new SignIn();
signIn.InitDriver();
signIn.loginScript("1404325791@qq.com", "64566325cc");
PostNewLabAssignment postNewLabAssignment = new PostNewLabAssignment();
postNewLabAssignment.createAsscript("5","0020200412", "22:00", "test02", "111", "100");
}
}

View File

@ -1,38 +0,0 @@
package nor_Courses;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor.SignIn;
//17
public class Remarking {
public WebDriver webDriver = SignIn.webDriver;
//重新打分
public void remarkScript(String number,String marks1,String feedback1) {//课程的位置 分数 评论
webDriver.switchTo();
WebElement course = webDriver.findElement(By.xpath("/html/body/div/div[1]/a["+number+"]/div"));
course.click();
webDriver.switchTo();
WebElement view = webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/div/span/span/a[2]"));
view.click();
WebElement ReMarkingRequests = webDriver.findElement(By.xpath("/html/body/div[2]/div/ul/li[3]/a"));
ReMarkingRequests.click();
webDriver.switchTo();
WebElement remark = webDriver.findElement(By.xpath("//*[@id=\"menu3\"]/k/div/span/button"));
remark.click();
WebElement marks = webDriver.findElement(By.name("marks"));
marks.sendKeys(marks1);
WebElement feedback = webDriver.findElement(By.name("feedback"));
feedback.sendKeys(feedback1);
WebElement submit = webDriver.findElement(By.xpath("/html/body/div[4]/div[2]/div/button[1]/span"));
submit.click();
}
public static void main(String[] args) {
SignIn signIn = new SignIn();
signIn.InitDriver();
signIn.loginScript("1404325791@qq.com", "64566325cc");
Remarking remarking = new Remarking();
remarking.remarkScript("6", "100", "abc");
}
}

View File

@ -1,30 +0,0 @@
package nor_Courses_Students;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor_students.SignInStudents;
//6
public class FindCourse {
public WebDriver webDriver = SignInStudents.webDriver;
//通过code寻找和申请加入课程
public void findCourseScript(String code) {//课程code
webDriver.switchTo();
WebElement search = webDriver.findElement(By.name("search"));
search.sendKeys(code);
WebElement searchbtn = webDriver.findElement(By.xpath("/html/body/div[2]/div[2]/form/div/div[2]/input"));
searchbtn.click();
WebElement join = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div[1]/a"));
join.click();
}
/*public static void main(String[] args) {
SignInStudents signInStudents = new SignInStudents();
signInStudents.InitDriver();
signInStudents.loginStudentsScript("201632110128", ">[@+cO03");
FindCourse findCourse = new FindCourse();
findCourse.findCourseScript("3");
}*/
}

View File

@ -1,34 +0,0 @@
package nor_Courses_Students;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor_students.SignInStudents;
//19:52 20:21
public class LabReportSubmission {
public WebDriver webDriver = SignInStudents.webDriver;
//提交报告
public void subLPScript(String number,String name1,String file1) {//课程的位置 标题 文件路径
webDriver.switchTo();
WebElement course = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div["+number+"]/a[1]"));
course.click();
webDriver.switchTo();
WebElement submitLP = webDriver.findElement(By.className("btn-info"));
submitLP.click();
webDriver.switchTo();
WebElement title = webDriver.findElement(By.name("title"));
title.sendKeys(name1);
WebElement inputfile = webDriver.findElement(By.name("attachment1"));
inputfile.sendKeys(file1);
WebElement submit = webDriver.findElement(By.xpath("/html/body/div[2]/div/div[2]/input[3]"));
submit.click();
}
/*public static void main(String[] args) {
SignInStudents signInStudents = new SignInStudents();
signInStudents.InitDriver();
signInStudents.loginStudentsScript("201632110128", ">[@+cO03");
LabReportSubmission labReportSubmission = new LabReportSubmission();
labReportSubmission.subLPScript("4", "test1", "D:/bjg.txt");
}*/
}

View File

@ -1,30 +0,0 @@
package nor_Courses_Students;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor_students.SignInStudents;
//11
public class RequestRemarking {
public WebDriver webDriver = SignInStudents.webDriver;
//申请重新打分
public void requestRemarkScript(String number,String reason) {//课程的位置 理由
webDriver.switchTo();
WebElement course = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div["+number+"]/a[1]"));
course.click();
WebElement MarkedSubmissions = webDriver.findElement(By.xpath("/html/body/div[3]/div[1]/ul/li[4]/a"));
MarkedSubmissions.click();
WebElement requestRemark = webDriver.findElement(By.xpath("//*[@id=\"menu4\"]/k/div/button"));
requestRemark.click();
webDriver.switchTo().alert().sendKeys(reason);
webDriver.switchTo().alert().accept();
}
/*public static void main(String[] args) {
SignInStudents signInStudents = new SignInStudents();
signInStudents.InitDriver();
signInStudents.loginStudentsScript("201632110128", ">[@+cO03");
RequestRemarking requestRemarking = new RequestRemarking();
requestRemarking.requestRemarkScript("4","123");
}*/
}

View File

@ -1,31 +0,0 @@
package nor_Courses_Students;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor_students.SignInStudents;
//13
public class StudentsGroup {
public WebDriver webDriver = SignInStudents.webDriver;
public void createGroupScript(String number, String name1) {
webDriver.switchTo();
WebElement course = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div["+number+"]/a[1]"));
course.click();
webDriver.switchTo();
WebElement group = webDriver.findElement(By.className("btn-primary"));
group.click();
webDriver.switchTo();
WebElement groupname = webDriver.findElement(By.name("name"));
groupname.sendKeys(name1);
WebElement submit = webDriver.findElement(By.xpath("/html/body/div[6]/div[2]/div/button[1]/span"));
submit.click();
}
/*public static void main(String[] args) {
SignInStudents signInStudents = new SignInStudents();
signInStudents.InitDriver();
signInStudents.loginStudentsScript("201632110128", ">[@+cO03");
StudentsGroup studentsGroup = new StudentsGroup();
studentsGroup.createGroupScript("4", "group4");
}*/
}

View File

@ -1,28 +0,0 @@
package nor_Courses_Students;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import nor_students.SignInStudents;
//9
public class ViewAssignmentGrading {
public WebDriver webDriver = SignInStudents.webDriver;
//看分数
public void viewAssGradeScript(String number) {//课程的位置
webDriver.switchTo();
WebElement course = webDriver.findElement(By.xpath("/html/body/div[2]/div[1]/div["+number+"]/a[1]"));
course.click();
WebElement MarkedSubmissions = webDriver.findElement(By.xpath("/html/body/div[3]/div[1]/ul/li[4]/a"));
MarkedSubmissions.click();
WebElement grade = webDriver.findElement(By.xpath("//*[@id=\"menu4\"]/k/div/b"));
System.out.println(grade.getText());
}
/*public static void main(String[] args) {
SignInStudents signInStudents = new SignInStudents();
signInStudents.InitDriver();
signInStudents.loginStudentsScript("201632110128", ">[@+cO03");
ViewAssignmentGrading viewAssignmentGrading = new ViewAssignmentGrading();
viewAssignmentGrading.viewAssGradeScript("4");
}*/
}

View File

@ -1,38 +0,0 @@
package nor_students;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class SignInStudents {
public static WebDriver webDriver;
//初始化webDriver 打开网页
public void InitDriver() {
System.setProperty("webdriver.chrome.driver","F:\\chromedriver.exe");
webDriver = new ChromeDriver();
webDriver.get("http://118.25.96.118/nor/");
webDriver.manage().window().maximize();
}
//登录脚本
public void loginStudentsScript(String username,String password) {
webDriver.findElement(By.className("btn-primary"));
WebElement user = webDriver.findElement(By.name("user"));
user.isDisplayed();
WebElement passwd = webDriver.findElement(By.name("password"));
passwd.isDisplayed();
WebElement loginBtn = webDriver.findElement(By.className("btn-primary"));
loginBtn.isDisplayed();
user.sendKeys(username);
passwd.sendKeys(password);
loginBtn.click();
webDriver.switchTo();//切换窗口
WebElement loginInfo = webDriver.findElement(By.className("form-inline"));
System.out.println(loginInfo.getText());
}
/*public static void main(String[] args) {
SignInStudents signInStudents = new SignInStudents();
signInStudents.InitDriver();
signInStudents.loginStudentsScript("201631900128", ">[@+cO03");
}*/
}