summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortspitzer2013-07-31 12:34:49 +0200
committertspitzer2013-07-31 12:34:49 +0200
commit631fa9ca94754e9a20d8bfd5225e63b7dc7f108e (patch)
tree9e4b2fa952e50335e5adca4f4be2b2ee648ae462
parenterste SQL Abfragen (diff)
downloadtutor-module-631fa9ca94754e9a20d8bfd5225e63b7dc7f108e.tar.gz
tutor-module-631fa9ca94754e9a20d8bfd5225e63b7dc7f108e.tar.xz
tutor-module-631fa9ca94754e9a20d8bfd5225e63b7dc7f108e.zip
new
-rw-r--r--Dozentenmodul_V1/.settings/org.eclipse.jdt.core.prefs4
-rw-r--r--Dozentenmodul_V1/WebContent/GUI/de/Home.jsp35
-rw-r--r--Dozentenmodul_V1/WebContent/GUI/de/VLUpload.jsp41
-rw-r--r--Dozentenmodul_V1/WebContent/GUI/de/createVL_Software.jsp2
-rw-r--r--Dozentenmodul_V1/WebContent/jar/jakarta-commons-net.jarbin0 -> 239350 bytes
-rw-r--r--Dozentenmodul_V1/WebContent/jar/jakarta-commons-oro.jarbin0 -> 73481 bytes
-rw-r--r--Dozentenmodul_V1/WebContent/jar/wjhk.jupload.jarbin0 -> 343591 bytes
-rw-r--r--Dozentenmodul_V1/WebContent/js/functions.js4
-rw-r--r--Dozentenmodul_V1/build/classes/db/MySQL.classbin3231 -> 3646 bytes
-rw-r--r--Dozentenmodul_V1/build/classes/ftpupload/Ftpupload.classbin0 -> 1111 bytes
-rw-r--r--Dozentenmodul_V1/src/db/MySQL.java30
-rw-r--r--Dozentenmodul_V1/src/ftpupload/Ftpupload.java87
12 files changed, 188 insertions, 15 deletions
diff --git a/Dozentenmodul_V1/.settings/org.eclipse.jdt.core.prefs b/Dozentenmodul_V1/.settings/org.eclipse.jdt.core.prefs
index 11f6e462..838bd9d6 100644
--- a/Dozentenmodul_V1/.settings/org.eclipse.jdt.core.prefs
+++ b/Dozentenmodul_V1/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
diff --git a/Dozentenmodul_V1/WebContent/GUI/de/Home.jsp b/Dozentenmodul_V1/WebContent/GUI/de/Home.jsp
index a242111a..cdeda876 100644
--- a/Dozentenmodul_V1/WebContent/GUI/de/Home.jsp
+++ b/Dozentenmodul_V1/WebContent/GUI/de/Home.jsp
@@ -18,13 +18,25 @@
<div id="content">
- <h2>Aktive VL's</h2>
+ <h2>Aktive VLs</h2>
<ul>
<%
MySQL sql=new MySQL();
Connection con= sql.getConnection();
- ResultSet rs=sql.getActiveVLs(con, "tobias.spitzer@hs-offenburg.de");
+ ResultSet u=sql.getUserpk(con, "tobias.spitzer@hs-offenburg.de");
+
+ while(u.next())
+ {
+
+ ResultSet v=sql.getVMpk(con, u.getString("pk"));
+
+ while(v.next())
+ {
+
+
+
+ ResultSet rs=sql.getActiveVLs(con, v.getString("VM_pk"));
while(rs.next()){
@@ -32,19 +44,18 @@
<li><%=rs.getString("Laborname") %></li>
<%
}
+ }
+ }
%>
</ul>
- <h2>Inaktive VL's</h2>
+ <h2>Inaktive VLs</h2>
<ul>
- <%
- rs=sql.getInactiveVLs(con, "tobias.spitzer@hs-offenburg.de");
- while(rs.next())
- {
- %>
- <li><%=rs.getString("Laborname") %><img src="/Dozentenmodul_V1/img/Pencil3.png" alt="Bearbeiten"></img></li>
- <%
- }
- %>
+
+
+ <li><img src="/Dozentenmodul_V1/img/Pencil3.png" alt="Bearbeiten"></img></li>
+
+
+
</ul>
</div>
diff --git a/Dozentenmodul_V1/WebContent/GUI/de/VLUpload.jsp b/Dozentenmodul_V1/WebContent/GUI/de/VLUpload.jsp
new file mode 100644
index 00000000..328f6efb
--- /dev/null
+++ b/Dozentenmodul_V1/WebContent/GUI/de/VLUpload.jsp
@@ -0,0 +1,41 @@
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<link rel="stylesheet" type="text/css"
+ href="/Dozentenmodul_V1/css/Layout.css"></link>
+<title>VL Upload Bereich</title>
+</head>
+<body>
+ <jsp:include page="header.html" />
+ <jsp:include page="menü.html" />
+ <jsp:include page="news.jsp" />
+
+ <div id="content">
+ <div id="bread">
+ Sie sind hier: <a href="#" rel="createVL_allgemine.jsp">Allgemein</a>
+ &gt;
+ <a href="#" rel="system">System</a>
+ &gt;
+ <a href="#" rel="software">Software</a>
+ &gt;
+ <a href="#" rel="software">Upload</a>
+ </div>
+ <br></br>
+ <h2>Upload Tool</h2>
+ <object codetype="application/java-archive"
+ archive="/Dozentenmodul_V1/jar/wjhk.jupload.jar, /Dozentenmodul_V1/jar/jakarta-commons-oro.jar, /Dozentenmodul_V1/jar/jakarta-commons-net.jar"
+ classid="java:wjhk.jupload2.JUploadApplet.class" width="800"
+ height="600">
+ <param name="postURL" value="ftp://fr-bwlehrpool-rw-admin:fefobu36@bwsonas.lsdf.kit.edu:21/bwlehrpool" />
+
+ <param name="showLogWindow" value="true" />
+ <param name="serverProtocol" value="FTP" />
+ <param name="lookAndFeel" value="system" />
+ </object>
+ </div>
+ <jsp:include page="footer.html" />
+</body>
+</html> \ No newline at end of file
diff --git a/Dozentenmodul_V1/WebContent/GUI/de/createVL_Software.jsp b/Dozentenmodul_V1/WebContent/GUI/de/createVL_Software.jsp
index 1f91807a..69377ab2 100644
--- a/Dozentenmodul_V1/WebContent/GUI/de/createVL_Software.jsp
+++ b/Dozentenmodul_V1/WebContent/GUI/de/createVL_Software.jsp
@@ -71,7 +71,7 @@
</div>
</fieldset>
<br>
- <button id="buttonAddSW" name="addSW">Software hinzufügen</button><br><br>
+ <button id="buttonAddSW" name="addSW" onclick="saveSW()">Software hinzufügen</button><br><br>
<button id="buttonBackSW" type="submit">Zurück</button>
<button id="buttonReady" type="submit">Weiter zur VL Erzeugung</button>
</form>
diff --git a/Dozentenmodul_V1/WebContent/jar/jakarta-commons-net.jar b/Dozentenmodul_V1/WebContent/jar/jakarta-commons-net.jar
new file mode 100644
index 00000000..a2880ab9
--- /dev/null
+++ b/Dozentenmodul_V1/WebContent/jar/jakarta-commons-net.jar
Binary files differ
diff --git a/Dozentenmodul_V1/WebContent/jar/jakarta-commons-oro.jar b/Dozentenmodul_V1/WebContent/jar/jakarta-commons-oro.jar
new file mode 100644
index 00000000..3a1cc642
--- /dev/null
+++ b/Dozentenmodul_V1/WebContent/jar/jakarta-commons-oro.jar
Binary files differ
diff --git a/Dozentenmodul_V1/WebContent/jar/wjhk.jupload.jar b/Dozentenmodul_V1/WebContent/jar/wjhk.jupload.jar
new file mode 100644
index 00000000..0409e153
--- /dev/null
+++ b/Dozentenmodul_V1/WebContent/jar/wjhk.jupload.jar
Binary files differ
diff --git a/Dozentenmodul_V1/WebContent/js/functions.js b/Dozentenmodul_V1/WebContent/js/functions.js
index 666b1e74..fc4cd849 100644
--- a/Dozentenmodul_V1/WebContent/js/functions.js
+++ b/Dozentenmodul_V1/WebContent/js/functions.js
@@ -16,4 +16,8 @@ function refresh(){
}
}
+}
+
+function saveSW(){
+
} \ No newline at end of file
diff --git a/Dozentenmodul_V1/build/classes/db/MySQL.class b/Dozentenmodul_V1/build/classes/db/MySQL.class
index c5f2bdad..09075e54 100644
--- a/Dozentenmodul_V1/build/classes/db/MySQL.class
+++ b/Dozentenmodul_V1/build/classes/db/MySQL.class
Binary files differ
diff --git a/Dozentenmodul_V1/build/classes/ftpupload/Ftpupload.class b/Dozentenmodul_V1/build/classes/ftpupload/Ftpupload.class
new file mode 100644
index 00000000..28c25b2a
--- /dev/null
+++ b/Dozentenmodul_V1/build/classes/ftpupload/Ftpupload.class
Binary files differ
diff --git a/Dozentenmodul_V1/src/db/MySQL.java b/Dozentenmodul_V1/src/db/MySQL.java
index 6e6d84c0..ac02d8c4 100644
--- a/Dozentenmodul_V1/src/db/MySQL.java
+++ b/Dozentenmodul_V1/src/db/MySQL.java
@@ -65,12 +65,38 @@ public class MySQL {
}
- public ResultSet getActiveVLs(Connection con, String Mail)
+ public ResultSet getUserpk(Connection con, String Mail)
{
Statement stm;
try {
stm = con.createStatement();
- return stm.executeQuery("Select Laborname from bwLehrpool.VM where IstAktiv=1 and pk=(SELECT VM_pk FROM bwLehrpool.Benutzer_has_VM where Benutzer_pk=(SELECT pk FROM bwLehrpool.Benutzer where EMail like '"+Mail+"'));");
+ return stm.executeQuery("SELECT pk FROM bwLehrpool.Benutzer where EMail like '"+Mail+"';");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public ResultSet getVMpk(Connection con, String Userpk)
+ {
+ Statement stm;
+ try {
+ stm = con.createStatement();
+ return stm.executeQuery("SELECT VM_pk FROM bwLehrpool.Benutzer_has_VM where Benutzer_pk="+Userpk+";");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public ResultSet getActiveVLs(Connection con, String VMpk)
+ {
+ Statement stm;
+ try {
+ stm = con.createStatement();
+ return stm.executeQuery("Select Laborname from bwLehrpool.VM where IstAktiv=1 and pk="+VMpk+";");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/Dozentenmodul_V1/src/ftpupload/Ftpupload.java b/Dozentenmodul_V1/src/ftpupload/Ftpupload.java
new file mode 100644
index 00000000..92f65517
--- /dev/null
+++ b/Dozentenmodul_V1/src/ftpupload/Ftpupload.java
@@ -0,0 +1,87 @@
+package ftpupload;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPReply;
+/**
+ * Servlet implementation class Ftpupload
+ */
+@WebServlet("/Ftpupload")
+public class Ftpupload extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * @see HttpServlet#HttpServlet()
+ */
+ public Ftpupload() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+ doPost(request, response);
+ }
+
+ /**
+ * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
+ */
+ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
+
+ String hostName = "openslx-nfs.rz.hs-offenburg.de";
+ String username = "tspitzer";
+ String password = "";
+ String location = request.getParameter("file");
+
+ System.out.println(location);
+ FTPClient ftp = null;
+
+ InputStream in = null;
+ try {
+ ftp = new FTPClient();
+ ftp.
+ ftp.connect(hostName);
+ ftp.login(username, password);
+
+ ftp.setFileType(FTP.BINARY_FILE_TYPE);
+ ftp.
+ ftp.changeWorkingDirectory("/ei");
+
+ int reply = ftp.getReplyCode();
+ System.out.println("Received Reply from FTP Connection:" + reply);
+
+ if(FTPReply.isPositiveCompletion(reply)){
+ System.out.println("Connected Success");
+ }
+
+ System.out.println(location);
+
+ File f1 = new File("C:\\Users\\tspitzer\\Pictures\\"+location);
+ in = new FileInputStream(f1);
+
+ ftp.storeFile("test.vmdk",in);
+
+
+ System.out.println("SUCCESS");
+
+ ftp.logout();
+ ftp.disconnect();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+}