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; package unipotsdam.gf.core.management;
import sun.misc.IOUtils;
import unipotsdam.gf.core.database.mysql.MysqlConnect; import unipotsdam.gf.core.database.mysql.MysqlConnect;
import unipotsdam.gf.core.database.mysql.VereinfachtesResultSet; import unipotsdam.gf.core.database.mysql.VereinfachtesResultSet;
import unipotsdam.gf.core.management.group.Group; import unipotsdam.gf.core.management.group.Group;
...@@ -15,6 +16,9 @@ import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; ...@@ -15,6 +16,9 @@ import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier;
import javax.annotation.ManagedBean; import javax.annotation.ManagedBean;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.inject.Singleton; import javax.inject.Singleton;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Blob;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -314,4 +318,13 @@ public class ManagementImpl implements Management { ...@@ -314,4 +318,13 @@ public class ManagementImpl implements Management {
ProjectConfigurationDAO projectConfigurationDAO = new ProjectConfigurationDAO(); ProjectConfigurationDAO projectConfigurationDAO = new ProjectConfigurationDAO();
return projectConfigurationDAO.loadProjectConfiguration(project); 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; package unipotsdam.gf.core.management.user;
import org.glassfish.grizzly.streams.BufferedInput;
import unipotsdam.gf.core.management.ManagementImpl; import unipotsdam.gf.core.management.ManagementImpl;
import unipotsdam.gf.core.states.ProjectPhase;
import unipotsdam.gf.interfaces.ICommunication; import unipotsdam.gf.interfaces.ICommunication;
import unipotsdam.gf.modules.communication.service.CommunicationDummyService; import unipotsdam.gf.modules.communication.service.CommunicationDummyService;
import javax.annotation.ManagedBean; import javax.annotation.ManagedBean;
import javax.inject.Inject; import javax.inject.Inject;
import javax.ws.rs.FormParam; import javax.ws.rs.*;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; 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.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
...@@ -72,7 +75,20 @@ public class UserService { ...@@ -72,7 +75,20 @@ public class UserService {
} else { } else {
return loginError(); 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) { $(document).ready(function (e) {
$("#uploadimage").on('submit',(function(e) { /*$("#uploadimage").on('submit',(function(e) {
e.preventDefault(); e.preventDefault();
$("#message").empty(); $("#message").empty();
$('#loading').show(); $('#loading').show();
$.ajax({ $.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 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) 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. contentType: false, // The content type used when sending data to the server.
...@@ -16,16 +17,15 @@ $(document).ready(function (e) { ...@@ -16,16 +17,15 @@ $(document).ready(function (e) {
$("#message").html(data); $("#message").html(data);
} }
}); });
})); }));*/
// Function to preview image after validation // Function to preview image after validation
$(function() { $(function() {
$("#file").change(function() { $("#file").change(function() {
$("#message").empty(); // To remove the previous error message $("#message").empty(); // To remove the previous error message
let file = this.files[0]; let file = this.files[0];
let imagefile = file.type;
let match= ["image/jpeg","image/png","image/jpg"]; 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'); $('#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>"); $("#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 @@ ...@@ -41,15 +41,16 @@
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<p>Sonstiges:</p> <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> <div id="image_preview"><img id="previewing" src="../assets/img/noImg.png" /></div>
<hr id="line"> <hr id="line">
<div id="selectImage"> <div id="selectImage">
<label>Select Your Image</label><br/> <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" /> <input type="submit" value="Upload" class="submit" />
</div> </div>
</form> </form>
<p id="message"></p>
</li> </li>
</ul> </ul>
...@@ -113,9 +114,8 @@ ...@@ -113,9 +114,8 @@
</div> </div>
</div> </div>
<footer:footer/>
</div> </div>
<footer:footer/>
</div>
</body> </body>
</html> </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 `annotations` (
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` (
`id` varchar(120) NOT NULL, `id` varchar(120) NOT NULL,
`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`userToken` varchar(120) DEFAULT NULL, `userId` int(11) DEFAULT NULL,
`targetId` varchar(120) DEFAULT NULL, `targetId` int(11) DEFAULT NULL,
`targetCategory` VARCHAR(30) NOT NULL, `body` varchar(280) DEFAULT NULL,
`title` varchar(120) DEFAULT NULL,
`comment` varchar(400) DEFAULT NULL,
`startCharacter` int(11) DEFAULT NULL, `startCharacter` int(11) DEFAULT NULL,
`endCharacter` int(11) DEFAULT NULL, `endCharacter` int(11) DEFAULT NULL
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE if not exists `fullsubmissions` ( CREATE TABLE `answeredquiz` (
`id` VARCHAR(120) NOT NULL, `projectId` varchar(400) NOT NULL,
`timestamp` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `studentId` varchar(400) NOT NULL,
`user` VARCHAR(120) NOT NULL, `question` varchar(400) NOT NULL,
`text` MEDIUMTEXT NOT NULL, `correct` tinyint(4) NOT NULL
`projectId` VARCHAR(120) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
PRIMARY KEY (`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `contributionrating` (
`groupId` int(11) NOT NULL,
CREATE TABLE if not exists `submissionparts` ( `fromPeer` varchar(400) NOT NULL,
`timestamp` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, `dossier` int(11) NOT NULL,
`userId` VARCHAR(120) NOT NULL, `research` int(11) NOT NULL
`fullSubmissionId` VARCHAR(120) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
`category` VARCHAR(30) NOT NULL,
PRIMARY KEY (`fullSubmissionId`, `category`) CREATE TABLE `grades` (
) ENGINE = InnoDB DEFAULT CHARSET=utf8; `projectId` varchar(400) NOT NULL,
`studentId` varchar(400) NOT NULL,
CREATE TABLE if not exists `submissionpartbodyelements` ( `grade` double NOT NULL
`fullSubmissionId` VARCHAR(120) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
`category` VARCHAR(30) NOT NULL,
`startCharacter` int(11) NOT NULL, CREATE TABLE `groups` (
`endCharacter` int(11) NOT NULL, `id` int(11) NOT NULL,
PRIMARY KEY (`fullSubmissionId`, `category`, `startCharacter`, `endCharacter`) `projectId` varchar(400) NOT NULL,
) ENGINE = InnoDB DEFAULT CHARSET=utf8; `chatRoomId` varchar(400) NOT NULL
) 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 `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 ( CREATE TABLE `workrating` (
`projectId` varchar(100) NOT NULL, `projectId` varchar(400) NOT NULL,
phaseSelected varchar(200) NOT NULL `studentId` varchar(400) NOT NULL,
) `fromPeer` varchar(400) NOT NULL,
ENGINE = InnoDB `responsibility` int(11) NOT NULL,
DEFAULT CHARSET = utf8; `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 ( ALTER TABLE `annotations`
`projectId` varchar(100) NOT NULL, ADD PRIMARY KEY (`id`);
gfmSelected varchar(200) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
CREATE TABLE if not exists assessmentMechanismSelected ( ALTER TABLE `groups`
`projectId` varchar(100) NOT NULL, ADD PRIMARY KEY (`id`);
amSelected varchar(200) NOT NULL
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8;
ALTER TABLE `projectuser` ALTER TABLE `projectuser`
ADD INDEX (`projectId`, `userId`); ADD KEY `projectId` (`projectId`(255),`userId`(255));
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;
CREATE TABLE if not exists workrating ( ALTER TABLE `users`
`projectId` varchar(400) NOT NULL, ADD UNIQUE KEY `email` (`email`);
`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 = utf8;
CREATE TABLE if not exists contributionrating ( ALTER TABLE `groups`
`projectId` varchar(400) NOT NULL, MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
`studentId` varchar(400) NOT NULL, COMMIT;
`fromPeer` varchar(400) NOT NULL, \ No newline at end of file
`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
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