From 136ac66866845ac0fc3b4fd617e484eb178e769d Mon Sep 17 00:00:00 2001
From: Axel <wiepke@uni-potsdam.de>
Date: Sun, 29 Jul 2018 12:14:29 +0200
Subject: [PATCH] fix: headline for docent-pages

---
 .../gf/config/GFDatabaseConfig.java           |  4 +--
 .../gf/core/management/user/headLine.java     | 19 +++++++++++++-
 .../src/main/webapp/pages/createProject.jsp   | 25 ++++---------------
 .../src/main/webapp/pages/overview-docent.jsp |  7 +-----
 4 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/config/GFDatabaseConfig.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/config/GFDatabaseConfig.java
index cefe2e28..25290510 100644
--- a/gemeinsamforschen/src/main/java/unipotsdam/gf/config/GFDatabaseConfig.java
+++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/config/GFDatabaseConfig.java
@@ -7,7 +7,7 @@ public class GFDatabaseConfig {
     public static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
     public static final String DB_URL = "jdbc:mysql://localhost";
     //  Database credentials
-    public static final String USER = "root2";
-    public static final String PASS = "voyager2";
+    public static final String USER = "root";
+    public static final String PASS = "";
     public static final String DB_NAME = "fltrail";
 }
diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/core/management/user/headLine.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/core/management/user/headLine.java
index 5286e026..087a26f8 100644
--- a/gemeinsamforschen/src/main/java/unipotsdam/gf/core/management/user/headLine.java
+++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/core/management/user/headLine.java
@@ -1,5 +1,7 @@
 package unipotsdam.gf.core.management.user;
 
+import unipotsdam.gf.core.management.ManagementImpl;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.JspWriter;
@@ -12,11 +14,26 @@ public class headLine extends SimpleTagSupport {
         PageContext pageContext = (PageContext) getJspContext();
         HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
         String projectId = request.getParameter("projectId");
+        String token = request.getParameter("token");
+        ManagementImpl management = new ManagementImpl();
         JspWriter out = getJspContext().getOut();
+        User user =  management.getUserByToken(token);
+        Boolean isStudent = user.getStudent();
         out.println("<div class=\"container-fluid\">\n" +
                 "            <table style=\"width:100%\">\n" +
                 "                <tr>\n" +
-                "                    <td style=\"width:70%\"><h2 id=\"headLineProject\"></h2></td>\n" +
+                "                    <td style=\"width:70%\"><h2 id=\"headLineProject\">");
+        if (projectId!=null){
+            out.println(projectId);
+        }else{
+            if (isStudent){
+                out.println("Studentenübersicht "+user.getName());
+            }else{
+                out.println("Dozentenübersicht "+user.getName());
+            }
+
+        }
+        out.println("</h2></td>\n" +
                 "                    <td style=\"width:30%\">\n" +
                 "                        <div align=\"right\" class=\"dropdown\">\n" +
                 "                        <button style=\"right: 50px;margin-top:-4px;\" class=\"btn btn-primary dropdown-toggle\" type=\"button\"\n" +
diff --git a/gemeinsamforschen/src/main/webapp/pages/createProject.jsp b/gemeinsamforschen/src/main/webapp/pages/createProject.jsp
index b1336109..3984538c 100644
--- a/gemeinsamforschen/src/main/webapp/pages/createProject.jsp
+++ b/gemeinsamforschen/src/main/webapp/pages/createProject.jsp
@@ -1,37 +1,22 @@
 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
 <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %>
+<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %>
+<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %>
 
 <!DOCTYPE html>
 <html>
 
 <head>
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <title>fltrail</title>
-    <link rel="stylesheet" href="../assets/css/styles.css">
-    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
-    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
-    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
-    <link rel="stylesheet" href="../assets/fonts/font-awesome.min.css">
-    <link rel="stylesheet" href="../assets/css/Community-ChatComments.css">
-    <link rel="stylesheet" href="../assets/css/Sidebar-Menu-1.css">
-    <link rel="stylesheet" href="../assets/css/Sidebar-Menu.css">
-    <script src="../assets/js/utility.js"></script>
+    <omniDependencies:omniDependencies/>
     <script src="../assets/js/createProject.js"></script>
 
 </head>
 
 <body>
 <div id="wrapper">
-    <menu:menu></menu:menu>
+    <menu:menu/>
     <div class="page-content-wrapper">
-        <div class="container-fluid">
-
-            <h1>Einschreiben in einen Kurs</h1>
-            <a href="#"><span class="glyphicon glyphicon-envelope"
-                              style="font-size:27px;margin-top:-17px;margin-left:600px;"></span></a>
-            <a href="#"><span class="glyphicon glyphicon-cog"
-                              style="font-size:29px;margin-left:5px;margin-top:-25px;"></span></a>
-        </div>
+        <headLine:headLine/>
         <div style="margin-left: 2%;">
             <br><br>
             <label>Projektname: <input placeholder="Projektname"></label>
diff --git a/gemeinsamforschen/src/main/webapp/pages/overview-docent.jsp b/gemeinsamforschen/src/main/webapp/pages/overview-docent.jsp
index 7d41c3df..66419d37 100644
--- a/gemeinsamforschen/src/main/webapp/pages/overview-docent.jsp
+++ b/gemeinsamforschen/src/main/webapp/pages/overview-docent.jsp
@@ -16,12 +16,7 @@
     <menu:menu/>
     <div class="page-content-wrapper">
 
-        <h1>Übersicht für Dozent1</h1>
-        <a href="#"><span class="glyphicon glyphicon-envelope"
-                          style="font-size:27px;margin-top:-17px;margin-left:600px;"></span></a>
-        <a href="#"><span class="glyphicon glyphicon-cog"
-                          style="font-size:29px;margin-left:5px;margin-top:-25px;"></span></a>
-        <div>
+        <headLine:headLine/>
             <table id="projects">  <!-- getElementById('projects').append um neue Projekte anzufügen -->
                 <tr class="pageChanger">
                     <td>
-- 
GitLab