diff --git a/bin/comm/Connector.class b/bin/comm/Connector.class index 32afe06..c30dc93 100644 Binary files a/bin/comm/Connector.class and b/bin/comm/Connector.class differ diff --git a/bin/comm/DataBase.class b/bin/comm/DataBase.class index 60abf81..847d409 100644 Binary files a/bin/comm/DataBase.class and b/bin/comm/DataBase.class differ diff --git a/bin/comm/EmailComm$1.class b/bin/comm/EmailComm$1.class index 3dcec80..ff88fed 100644 Binary files a/bin/comm/EmailComm$1.class and b/bin/comm/EmailComm$1.class differ diff --git a/bin/comm/EmailComm.class b/bin/comm/EmailComm.class index 59a71a7..8b22655 100644 Binary files a/bin/comm/EmailComm.class and b/bin/comm/EmailComm.class differ diff --git a/bin/gui/LoginPage.class b/bin/gui/LoginPage.class index d4251ec..48b1586 100644 Binary files a/bin/gui/LoginPage.class and b/bin/gui/LoginPage.class differ diff --git a/bin/gui/ProfessorGUI$1.class b/bin/gui/ProfessorGUI$1.class index b071010..7c62773 100644 Binary files a/bin/gui/ProfessorGUI$1.class and b/bin/gui/ProfessorGUI$1.class differ diff --git a/bin/gui/ProfessorGUI.class b/bin/gui/ProfessorGUI.class index 1f26aa7..40adce1 100644 Binary files a/bin/gui/ProfessorGUI.class and b/bin/gui/ProfessorGUI.class differ diff --git a/bin/gui/Question.class b/bin/gui/Question.class index 4947bd1..5bc121f 100644 Binary files a/bin/gui/Question.class and b/bin/gui/Question.class differ diff --git a/bin/gui/QuestionPages.class b/bin/gui/QuestionPages.class index baad9ff..8c92882 100644 Binary files a/bin/gui/QuestionPages.class and b/bin/gui/QuestionPages.class differ diff --git a/bin/questions.txt b/bin/questions.txt index 7b945ff..731163e 100644 --- a/bin/questions.txt +++ b/bin/questions.txt @@ -2,8 +2,8 @@ Are you here today? Yes No -What do you know about OOD so far? -# +Write down what you know about OOD so far +## How far along are you on your projects with your groups and when do you expect to finish? Haven't started @@ -13,4 +13,4 @@ Already started coding Need help Do you feel like all of your team members are contributing enough your team members are contributing enough your team members are contributing enough? -# +## diff --git a/src/gui/CheckIP.java b/src/gui/CheckIP.java new file mode 100644 index 0000000..e03e297 --- /dev/null +++ b/src/gui/CheckIP.java @@ -0,0 +1,27 @@ +package gui; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; + +import javax.swing.JOptionPane; + +public class CheckIP { + public static void main() throws Exception { + //goes to http://checkip.amazonaws.com + URL whatismyip = new URL("http://checkip.amazonaws.com"); + //reads in IP Address + BufferedReader in = new BufferedReader(new InputStreamReader(whatismyip.openStream())); + //Convert IP to String + String ip = in.readLine(); + + //Checks if IP is a GSU public IP Address + if (ip.matches("141.165.(.*)")) { + JOptionPane.showMessageDialog(null, ip, "GSU IP Checker", 1); + } + else + JOptionPane.showMessageDialog(null, "Sorry, your IP Address does not match one on Georgia Southern Statesboro Campus. " + + "\rPlease use a computer on campus to take this quiz.", "GSU IP Checker", 0); + //System.exit(0); + //Uncomment when done with testing + } + } diff --git a/src/gui/LoginPage.java b/src/gui/LoginPage.java index 0e678c8..8c8fcde 100644 --- a/src/gui/LoginPage.java +++ b/src/gui/LoginPage.java @@ -15,6 +15,7 @@ public class LoginPage { + static boolean inClass; private Pane pane; private Scene scene; private PasswordField codeField; @@ -27,6 +28,15 @@ public class LoginPage { private DropShadow shadowOff = new DropShadow(20, colorOff); public LoginPage() { + //Added IP Checker if in class button is selected + if(inClass = true) { + try { + CheckIP.main(); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + pane = new Pane(); Pane outerPane = new Pane(); diff --git a/src/gui/ProfessorGUI.java b/src/gui/ProfessorGUI.java index cc7908a..6d34c80 100644 --- a/src/gui/ProfessorGUI.java +++ b/src/gui/ProfessorGUI.java @@ -17,8 +17,9 @@ import java.sql.SQLException; public class ProfessorGUI extends Application { - - private DataBase dataBase = new DataBase(); + private String fileName; + + //private DataBase dataBase = new DataBase(); private String emailList = ""; @@ -116,7 +117,7 @@ public void handle(ActionEvent arg0) { fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Text Files", "*.txt")); //Remove the .txt from file name - String fileName = startPage.getLblEFile().getText(); + fileName = startPage.getLblQFile().getText(); fileName = fileName.substring(0, fileName.length()-4); //call create report @@ -129,6 +130,13 @@ public void handle(ActionEvent arg0) { e.printStackTrace(); } + AnswerReport.createAnswerReportTxt(fileName); + try { + gradeReport.appendGradeReportTxt(fileName); + }catch (SQLException e) { + e.printStackTrace(); + } + File file = fileChooser.showOpenDialog(reportStage); Desktop openFile = Desktop.getDesktop(); if(file.exists()) @@ -202,14 +210,19 @@ public void handle(ActionEvent event) { @Override public void handle(ActionEvent event) { + fileName = startPage.getLblQFile().getText(); + fileName = fileName.substring(0, fileName.length()-4); EmailComm eCom = new EmailComm(); eCom.sendEmails(vPage.getEmailField().getText(), vPage.getPassField().getText(), "This is a test", "This is a test for our Project", emailList); - - dataBase.Write("CREATE TABLE public.\"" + questionList.getName() + "\"" + "(" +/* + dataBase.Write("CREATE TABLE public.\"" + fileName + "\"" + "(" + "\"studentEmail\" text COLLATE pg_catalog.\"default\"," + "responses text[] COLLATE pg_catalog.\"default\"," + "\"finalGrade\" double precision" + ")" - + "WITH (" + "OIDS = FALSE)" + "TABLESPACE pg_default;"); + + "WITH (" + "OIDS = FALSE)" + "TABLESPACE pg_default;" + " " + "INSERT INTO " + "\"QuizCodes\" VALUES ('" + fileName + + "', " + sendPage.getQuizCode().getText() + ");"); + */ + } }); diff --git a/src/gui/SendPage.java b/src/gui/SendPage.java index 23b0e77..d675315 100644 --- a/src/gui/SendPage.java +++ b/src/gui/SendPage.java @@ -1,6 +1,7 @@ package gui; import javafx.collections.FXCollections; + import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; @@ -47,6 +48,7 @@ public class SendPage { private CheckBox cb1; private CheckBox cb2; + private CheckBox cb3; private Label errorLabel; @@ -64,6 +66,7 @@ public SendPage(Stage parentStage) { cb1 = new CheckBox("Randomize Questions"); cb2 = new CheckBox("Randomize Answer Choices"); + cb3 = new CheckBox("In Class Quiz"); rb1 = new RadioButton("Provide feedback with all questions."); rb2 = new RadioButton("Provide feedback with only incorrect answers."); @@ -86,6 +89,7 @@ public SendPage(Stage parentStage) { endMin = new ComboBox<>(FXCollections.observableArrayList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59)); buildSendPage(sendStage, parentStage, sendPane, sendScene); + } public void buildSendPage(Stage sendStage, Stage parentStage, Pane sendPane, Scene sendScene) { @@ -283,11 +287,15 @@ public void buildSendPage(Stage sendStage, Stage parentStage, Pane sendPane, Sce cb1.setTextFill(Color.WHITE); cb1.setFont(Font.font("Arial", 13)); - cb2.setLayoutX(cb1.getLayoutX() + 160); cb2.setLayoutY(cb1.getLayoutY()); cb2.setTextFill(Color.WHITE); cb2.setFont(Font.font("Arial", 13)); + + cb3.setLayoutX(cb1.getLayoutX()); + cb3.setLayoutY(cb1.getLayoutY()+60); + cb3.setTextFill(Color.WHITE); + cb3.setFont(Font.font("Arial", 13)); rb1.setLayoutX(feedbackBox.getLayoutX()); rb2.setLayoutX(feedbackBox.getLayoutX()); @@ -307,7 +315,10 @@ public void buildSendPage(Stage sendStage, Stage parentStage, Pane sendPane, Sce send.setFont(Font.font("Arial", FontWeight.BOLD,18)); send.setStyle(Styles.BUTTONSTYLE); send.setOnMouseEntered(e -> send.setStyle(Styles.BUTTONHOVER)); - send.setOnMouseExited(e -> send.setStyle(Styles.BUTTONSTYLE)); + send.setOnMouseExited(e -> {send.setStyle(Styles.BUTTONSTYLE); + check(); + }); + //Added IP Checker if in class button is selected when send is pushed errorLabel = new Label(); errorLabel.setLayoutX(90); @@ -329,12 +340,19 @@ public void buildSendPage(Stage sendStage, Stage parentStage, Pane sendPane, Sce - sendPane.getChildren().addAll(cb1, cb2, send, startMonth, startDay, startHour, startMin, feedbackBox, startDayLabel, + sendPane.getChildren().addAll(cb1, cb2, cb3, send, startMonth, startDay, startHour, startMin, feedbackBox, startDayLabel, startHourLabel, startMonthLabel, startMinLabel, endDayLabel, endHourLabel, endMonthLabel, endMinLabel, qBox, quizCode, rBox, startTimeBox, endTimeBox, cancel, endMonth, endDay, endHour, endMin, errorLabel); sendStage.getIcons().add(Styles.GSIcon); sendStage.setScene(sendScene); } + public void check() { + if(cb3.isSelected()) { + LoginPage.inClass = true; + }else { + LoginPage.inClass = false; + } + } public void showSendPage() { this.sendStage.show(); @@ -401,6 +419,10 @@ public CheckBox getCb2() { return cb2; } + public CheckBox getCb3() { + return cb3; + } + public TextField getQuizCode() { return quizCode; } diff --git a/src/gui/gradeReport.java b/src/gui/gradeReport.java index 254885f..5f75e01 100644 --- a/src/gui/gradeReport.java +++ b/src/gui/gradeReport.java @@ -29,7 +29,8 @@ public static void appendGradeReportTxt(String fileName) throws SQLException { try (BufferedWriter bw = new BufferedWriter(new FileWriter(gradeReport))) { - bw.write("\t\t\t\t\t"+fileName+" Scores\n"); + bw.write("\t\t\t\t\t"+fileName+" Scores"); + bw.newLine(); Connector con = new Connector(); con.connect(); @@ -40,7 +41,9 @@ public static void appendGradeReportTxt(String fileName) throws SQLException { while (resultSetAvg.next()) { Double average = resultSetAvg.getDouble(1); String saverage = Double.toString(Math.round(average * 100.0)/100.0); - bw.write("The Class Average is "+saverage+"\n\n"); + bw.write("The Class Average is "+saverage); + bw.newLine(); + bw.newLine(); } ResultSet resultSet = con.MakeQuery("Select \"studentEmail\",\"finalGrade\" from \""+fileName+"\""); @@ -50,7 +53,7 @@ public static void appendGradeReportTxt(String fileName) throws SQLException { String sgrade = Double.toString(Math.round(grade * 100.0)/100.0); bw.write(email + " -\t "); //Print email bw.write(sgrade); //Print grade - bw.write("\n");//Move to the next line to print the next row. + bw.newLine();//Move to the next line to print the next row. } System.out.println("Done");