Skip to content
Snippets Groups Projects
Commit 0a771bdd authored by Axel's avatar Axel
Browse files

db-scheme updated assessment Axel.

parent 6b9de8e2
No related branches found
No related tags found
No related merge requests found
package unipotsdam.gf.core.management;
import sun.misc.IOUtils;
import unipotsdam.gf.core.database.mysql.MysqlConnect;
import unipotsdam.gf.core.database.mysql.VereinfachtesResultSet;
import unipotsdam.gf.core.management.group.Group;
......@@ -15,6 +16,9 @@ import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier;
import javax.annotation.ManagedBean;
import javax.annotation.Resource;
import javax.inject.Singleton;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Blob;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
......@@ -314,4 +318,13 @@ public class ManagementImpl implements Management {
ProjectConfigurationDAO projectConfigurationDAO = new ProjectConfigurationDAO();
return projectConfigurationDAO.loadProjectConfiguration(project);
}
public String saveProfilePicture(FileInputStream image, String studentId){
MysqlConnect connect = new MysqlConnect();
connect.connect();
Blob blobbedImage= (Blob) image;
String mysqlRequest = "INSERT INTO `profilepicture`(`studentId`, `image`) VALUES (?,?)";
connect.issueInsertOrDeleteStatement(mysqlRequest, studentId, blobbedImage);
return "success";
}
}
package unipotsdam.gf.core.management.user;
import org.glassfish.grizzly.streams.BufferedInput;
import unipotsdam.gf.core.management.ManagementImpl;
import unipotsdam.gf.core.states.ProjectPhase;
import unipotsdam.gf.interfaces.ICommunication;
import unipotsdam.gf.modules.communication.service.CommunicationDummyService;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
import java.io.File;
import java.io.FileInputStream;
import java.net.URI;
import java.net.URISyntaxException;
......@@ -72,7 +75,20 @@ public class UserService {
} else {
return loginError();
}
}
@POST
@Produces(MediaType.TEXT_PLAIN)
@Path("/student/{studentId}")
public String getQuiz(@FormParam("image") File file, @PathParam("studentId") String studentId) {
ManagementImpl management = new ManagementImpl();
try{
FileInputStream fis = new FileInputStream(file);
return management.saveProfilePicture(fis, studentId);
}catch(Exception e){
return e.toString();
}
}
......
package unipotsdam.gf.core.states;
public class configPhaseShift {
Boolean DossierWritten;
Integer FeedbackCount =1;
Integer QuizCount =10;
Integer JournalCount=5;
Boolean DossierFinalized;
Boolean JournalFinalized;
Boolean AssessmentDone;
}
$(document).ready(function (e) {
$("#uploadimage").on('submit',(function(e) {
/*$("#uploadimage").on('submit',(function(e) {
e.preventDefault();
$("#message").empty();
$('#loading').show();
$.ajax({
url: "ajax_php_file.php", // Url to which the request is send
url: "../rest/user/student/wiepke", // Url to which the request is send
method: "POST",
type: "POST", // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false, // The content type used when sending data to the server.
......@@ -16,16 +17,15 @@ $(document).ready(function (e) {
$("#message").html(data);
}
});
}));
}));*/
// Function to preview image after validation
$(function() {
$("#file").change(function() {
$("#message").empty(); // To remove the previous error message
let file = this.files[0];
let imagefile = file.type;
let match= ["image/jpeg","image/png","image/jpg"];
if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[2])))
if(!((file.type===match[0]) || (file.type===match[1]) || (file.type===match[2])))
{
$('#previewing').attr('src','noimage.png');
$("#message").html("<p id='error'>Please Select A valid Image File</p>"+"<h4>Note</h4>"+"<span id='error_message'>Only jpeg, jpg and png Images type allowed</span>");
......
......@@ -41,15 +41,16 @@
</li>
<li class="list-group-item">
<p>Sonstiges:</p>
<form id="uploadimage" action="" method="post" enctype="multipart/form-data">
<form id="uploadimage" method="post" action="../rest/user/student/wiepke">
<div id="image_preview"><img id="previewing" src="../assets/img/noImg.png" /></div>
<hr id="line">
<div id="selectImage">
<label>Select Your Image</label><br/>
<input type="file" name="file" id="file" required />
<input type="file" name="image" id="file" required />
<input type="submit" value="Upload" class="submit" />
</div>
</form>
<p id="message"></p>
</li>
</ul>
......@@ -113,9 +114,8 @@
</div>
</div>
<footer:footer/>
</div>
<footer:footer/>
</div>
</body>
</html>
\ No newline at end of file
CREATE DATABASE IF NOT EXISTS `fltrail`
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
DEFAULT CHARACTER SET utf8
/*!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 */;
COLLATE utf8_general_ci;
USE `fltrail`;
CREATE TABLE if not exists `projects` (
`id` varchar(100) NOT NULL,
`password` varchar(400) NOT NULL,
`active` tinyint(1) NOT NULL,
`timecreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
`author` varchar(400) NOT NULL,
`adminPassword` varchar(400) NOT NULL,
`token` varchar(400) NOT NULL,
`phase` varchar(400) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists `groups` (
`id` int NOT NULL AUTO_INCREMENT,
`projectId` varchar(400) NOT NULL,
`chatRoomId` varchar(400) NOT NULL,
PRIMARY KEY (id)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists groupuser
(
userEmail varchar(400) NOT NULL,
groupId int NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists `tags` (
`projectId` varchar(100) NOT NULL,
`tag` varchar(400) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists `users` (
`name` varchar(100) NOT NULL,
`password` varchar(200) NOT NULL,
`email` varchar(255) NOT NULL,
`token` varchar(800) NOT NULL,
`rocketChatId` varchar(400) NOT NULL,
`rocketChatAuthToken` varchar(800) NOT NULL,
UNIQUE (email)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists projectuser
(
projectId varchar(100) NOT NULL,
userId varchar(100) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists `annotations` (
CREATE TABLE `annotations` (
`id` varchar(120) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`userToken` varchar(120) DEFAULT NULL,
`targetId` varchar(120) DEFAULT NULL,
`targetCategory` VARCHAR(30) NOT NULL,
`title` varchar(120) DEFAULT NULL,
`comment` varchar(400) DEFAULT NULL,
`userId` int(11) DEFAULT NULL,
`targetId` int(11) DEFAULT NULL,
`body` varchar(280) DEFAULT NULL,
`startCharacter` int(11) DEFAULT NULL,
`endCharacter` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
`endCharacter` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE if not exists `fullsubmissions` (
`id` VARCHAR(120) NOT NULL,
`timestamp` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`user` VARCHAR(120) NOT NULL,
`text` MEDIUMTEXT NOT NULL,
`projectId` VARCHAR(120) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE if not exists `submissionparts` (
`timestamp` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`userId` VARCHAR(120) NOT NULL,
`fullSubmissionId` VARCHAR(120) NOT NULL,
`category` VARCHAR(30) NOT NULL,
PRIMARY KEY (`fullSubmissionId`, `category`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE if not exists `submissionpartbodyelements` (
`fullSubmissionId` VARCHAR(120) NOT NULL,
`category` VARCHAR(30) NOT NULL,
`startCharacter` int(11) NOT NULL,
`endCharacter` int(11) NOT NULL,
PRIMARY KEY (`fullSubmissionId`, `category`, `startCharacter`, `endCharacter`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
alter table users
add isStudent tinyint(1) default '1' null;
CREATE TABLE if not exists quiz
(
author varchar(400) NOT NULL,
projectId varchar(400) NOT NULL,
question varchar(400) NOT NULL,
mcType varchar(400) NOT NULL,
answer varchar(400) NOT NULL,
correct tinyint(1) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists grades
(
projectId varchar(400) NOT NULL,
studentId varchar(400) NOT NULL,
grade double NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists tasks
CREATE TABLE `answeredquiz` (
`projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
`question` varchar(400) NOT NULL,
`correct` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `contributionrating` (
`groupId` int(11) NOT NULL,
`fromPeer` varchar(400) NOT NULL,
`dossier` int(11) NOT NULL,
`research` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `grades` (
`projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
`grade` double NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `groups` (
`id` int(11) NOT NULL,
`projectId` varchar(400) NOT NULL,
`chatRoomId` varchar(400) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
(
CREATE TABLE `groupuser` (
`studentId` varchar(400) NOT NULL,
`projectId` varchar(400) NOT NULL,
`groupId` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
userId varchar(400) NOT NULL,
CREATE TABLE `phasesselected` (
`projectId` varchar(100) NOT NULL,
`phaseSelected` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `profilepicture` (
`studentId` varchar(200) NOT NULL,
`image` longblob NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE `projects` (
`id` varchar(400) NOT NULL,
`password` varchar(400) NOT NULL,
`active` tinyint(1) NOT NULL,
`timecreated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`author` varchar(400) NOT NULL,
`adminPassword` varchar(400) NOT NULL,
`token` varchar(400) NOT NULL,
`phase` varchar(400) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
projectId varchar(400) NOT NULL,
CREATE TABLE `projectuser` (
`projectId` varchar(400) NOT NULL,
`userId` varchar(400) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
taskUrl varchar(400) NOT NULL
)
CREATE TABLE `quiz` (
`author` varchar(400) NOT NULL,
`projectId` varchar(400) NOT NULL,
`question` varchar(400) NOT NULL,
`mcType` varchar(400) NOT NULL,
`answer` varchar(400) NOT NULL,
`correct` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ENGINE = InnoDB
CREATE TABLE `tags` (
`projectId` varchar(400) NOT NULL,
`tag` varchar(400) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DEFAULT CHARSET = utf8;
CREATE TABLE `tasks` (
`userId` varchar(400) NOT NULL,
`projectId` varchar(400) NOT NULL,
`taskUrl` varchar(400) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users` (
`name` varchar(400) NOT NULL,
`password` varchar(200) NOT NULL,
`email` varchar(255) NOT NULL,
`token` varchar(800) NOT NULL,
`rocketChatId` varchar(400) NOT NULL,
`rocketChatAuthToken` varchar(800) NOT NULL,
`isStudent` tinyint(1) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE if not exists phasesSelected (
`projectId` varchar(100) NOT NULL,
phaseSelected varchar(200) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE `workrating` (
`projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
`fromPeer` varchar(400) NOT NULL,
`responsibility` int(11) NOT NULL,
`partOfWork` int(11) NOT NULL,
`cooperation` int(11) NOT NULL,
`communication` int(11) NOT NULL,
`autonomous` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
CREATE TABLE if not exists categoriesSelected (
`projectId` varchar(100) NOT NULL,
categorySelected varchar(200) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists groupfindingMechanismSelected (
`projectId` varchar(100) NOT NULL,
gfmSelected varchar(200) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
ALTER TABLE `annotations`
ADD PRIMARY KEY (`id`);
CREATE TABLE if not exists assessmentMechanismSelected (
`projectId` varchar(100) NOT NULL,
amSelected varchar(200) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`);
ALTER TABLE `projectuser`
ADD INDEX (`projectId`, `userId`);
ALTER TABLE `projectuser`
ADD UNIQUE (`projectId`, `userId`);
ALTER TABLE `projects`
ADD UNIQUE (`id`);
CREATE TABLE if not exists answeredquiz (
`projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
`question` varchar(400) NOT NULL,
`correct` tinyint(4) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
ADD KEY `projectId` (`projectId`(255),`userId`(255));
CREATE TABLE if not exists workrating (
`projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
`fromPeer` varchar(400) NOT NULL,
`responsibility` int(11) NOT NULL,
`partOfWork` int(11) NOT NULL,
`cooperation` int(11) NOT NULL,
`communication` int(11) NOT NULL,
`autonomous` int(11) NOT NULL
ALTER TABLE `users`
ADD UNIQUE KEY `email` (`email`);
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists contributionrating (
`projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
`fromPeer` varchar(400) NOT NULL,
`dossier` int(11) NOT NULL,
`eJournal` int(11) NOT NULL,
`research` int(11) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
\ No newline at end of file
ALTER TABLE `groups`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment