From 4a8559183c7dbd123b9863a2c61094647d35079f Mon Sep 17 00:00:00 2001 From: wiragotama Date: Wed, 19 Nov 2014 18:00:34 +0700 Subject: [PATCH 01/41] DB connected --- build.xml | 71 + build/web/META-INF/MANIFEST.MF | 2 + build/web/META-INF/context.xml | 2 + .../WEB-INF/classes/.netbeans_automatic_build | 0 .../classes/.netbeans_update_resources | 0 .../WEB-INF/classes/DB/DBConnectionDemo.class | Bin 0 -> 3792 bytes .../WEB-INF/classes/DB/DatabaseAccess.class | Bin 0 -> 5992 bytes build/web/WEB-INF/classes/Model/Comment.class | Bin 0 -> 1802 bytes build/web/WEB-INF/classes/Model/Post.class | Bin 0 -> 5999 bytes build/web/index.jsp | 17 + nbproject/ant-deploy.xml | 49 + nbproject/build-impl.xml | 1441 +++++++++++++++++ nbproject/genfiles.properties | 8 + nbproject/private/private.properties | 4 + nbproject/private/private.xml | 13 + nbproject/project.properties | 84 + nbproject/project.xml | 18 + src/conf/MANIFEST.MF | 2 + src/java/DB/DBConnectionDemo.java | 113 ++ src/java/DB/DatabaseAccess.java | 183 +++ src/java/Model/Comment.java | 84 + src/java/Model/Post.java | 184 +++ web/META-INF/context.xml | 2 + web/index.jsp | 17 + 24 files changed, 2294 insertions(+) create mode 100644 build.xml create mode 100644 build/web/META-INF/MANIFEST.MF create mode 100644 build/web/META-INF/context.xml create mode 100644 build/web/WEB-INF/classes/.netbeans_automatic_build create mode 100644 build/web/WEB-INF/classes/.netbeans_update_resources create mode 100644 build/web/WEB-INF/classes/DB/DBConnectionDemo.class create mode 100644 build/web/WEB-INF/classes/DB/DatabaseAccess.class create mode 100644 build/web/WEB-INF/classes/Model/Comment.class create mode 100644 build/web/WEB-INF/classes/Model/Post.class create mode 100644 build/web/index.jsp create mode 100644 nbproject/ant-deploy.xml create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/private/private.properties create mode 100644 nbproject/private/private.xml create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/conf/MANIFEST.MF create mode 100644 src/java/DB/DBConnectionDemo.java create mode 100644 src/java/DB/DatabaseAccess.java create mode 100644 src/java/Model/Comment.java create mode 100644 src/java/Model/Post.java create mode 100644 web/META-INF/context.xml create mode 100644 web/index.jsp diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..081099f2 --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project TubesWBD. + + + diff --git a/build/web/META-INF/MANIFEST.MF b/build/web/META-INF/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/build/web/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/build/web/META-INF/context.xml b/build/web/META-INF/context.xml new file mode 100644 index 00000000..25a9cf87 --- /dev/null +++ b/build/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/build/web/WEB-INF/classes/.netbeans_automatic_build b/build/web/WEB-INF/classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/.netbeans_update_resources b/build/web/WEB-INF/classes/.netbeans_update_resources new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/DB/DBConnectionDemo.class b/build/web/WEB-INF/classes/DB/DBConnectionDemo.class new file mode 100644 index 0000000000000000000000000000000000000000..09a9b52acb9ee7eb7667fd8893c601ede1a6375b GIT binary patch literal 3792 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 u_zvY1&idDg^PW@3-7L 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 literal 0 HcmV?d00001 diff --git a/build/web/index.jsp b/build/web/index.jsp new file mode 100644 index 00000000..40535e66 --- /dev/null +++ b/build/web/index.jsp @@ -0,0 +1,17 @@ +<%-- + Document : index + Created on : Nov 19, 2014, 12:39:05 PM + Author : wira gotama +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + +

Hello World!

+ + diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 00000000..9bc5adf7 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 00000000..2af74b4f --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1441 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 00000000..5296ac58 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=fc5cdc27 +build.xml.script.CRC32=34dbbe87 +build.xml.stylesheet.CRC32=651128d4@1.65.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=fc5cdc27 +nbproject/build-impl.xml.script.CRC32=18f059e4 +nbproject/build-impl.xml.stylesheet.CRC32=d659eb7a@1.65.1.1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 00000000..62c74ea5 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,4 @@ +deploy.ant.properties.file=C:\\Users\\wira gotama\\AppData\\Roaming\\NetBeans\\7.4\\tomcat70.properties +j2ee.server.home=C:/xampp/tomcat +j2ee.server.instance=tomcat70:home=C:\\xampp\\tomcat +user.properties.file=C:\\Users\\wira gotama\\AppData\\Roaming\\NetBeans\\7.4\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 00000000..cb37d6e4 --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,13 @@ + + + + + + file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/DB/DBConnectionDemo.java + file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/DB/DatabaseAccess.java + file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/web/index.jsp + file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/Model/Post.java + file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/Model/Comment.java + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..64d6eba2 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,84 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.6-web +j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.2.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar +j2ee.server.type=Tomcat +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +no.dependencies=false +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=TubesWBD.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 00000000..4a7caa8e --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,18 @@ + + + org.netbeans.modules.web.project + + + TubesWBD + 1.6.5 + + + + + + + + + + + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/java/DB/DBConnectionDemo.java b/src/java/DB/DBConnectionDemo.java new file mode 100644 index 00000000..684f947f --- /dev/null +++ b/src/java/DB/DBConnectionDemo.java @@ -0,0 +1,113 @@ +package DB; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; + +public class DBConnectionDemo { + + public static void main(String args[]) { + // Mengakses instans + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + + // Set konfigurasi + databaseAccess.setDatabase("EMP"); + databaseAccess.setUsername("root"); // secara default root + databaseAccess.setPassword(""); // secara default string kosong + + // Membuka koneksi + try { + databaseAccess.openConnection(); + System.out.println("Berhasil membuka koneksi"); + } catch (SQLException e) { + System.out.println("Gagal membuka koneksi"); + System.out.println(e); + } + + // -------------------INSERT---------------------- + // Melakukan INSERT INTO Employee (id,age,first,last) VALUES + // (200,21,'Kevin','Yudi + // Utama'); + ArrayList columns = new ArrayList(Arrays.asList("id", "age", + "first", "last")); + ArrayList values = new ArrayList(Arrays.asList("200", "21", + "'Kevin'", "'Yudi'")); + try { + databaseAccess.insertRecords("Employee", columns, values); + System.out.println("Berhasil memasukkan records"); + } catch (SQLException e1) { + System.out.println("Gagal memasukkan records"); + System.out.println("Error : " + e1); + } + // Alternatif databaseAccess.executeUpdateQuery("INSERT INTO Employee + // (age,first,last) VALUES (21,'Kevin','Yudi Utama');");" + + // -----------------DELETE------------------------ + // Melakukan DELETE FROM Employee WHERE first='Kevin' AND last='Yudi'; + + // null jika tidak ada kondisi (menghapus seluruh records pada tabel); + String condition = "first='Kevin' AND last='Yudi'"; + + try { + databaseAccess.deleteRecords("Employee", condition); + System.out.println("Berhasil menghapus records"); + } catch (SQLException e1) { + System.out.println("Gagal menghapus records"); + e1.printStackTrace(); + } + // Alternatif databaseAccess.executeUpdateQuery("DELETE FROM Employee + // WHERE + // first='Kevin' AND last='Yudi';"); + + // -------------------UPDATE---------------------------- + // melakukan UPDATE Employee SET first='Wira',last='Gotama' WHERE Id = + // 103; + columns = new ArrayList(Arrays.asList("first", "last")); + values = new ArrayList(Arrays.asList("'Wira'", "'Gotama'")); + condition = "Id = 103"; + try { + databaseAccess + .updateRecords("Employee", columns, values, condition); + System.out.println("Berhasil melakukan update terhadap database"); + } catch (SQLException e2) { + System.out.println("Gagal melakukan update terhadap database"); + System.out.println(e2); + } + + // -----------------SELECT-------------------------- + // melakukan SELECT id,first,last FROM Employee; + columns = new ArrayList(Arrays.asList("id", "first", "last")); + condition = null; // jika ada kondisi dapat dimasukkan seperti pada + // INSERT dan DELETE; + ResultSet result = null; + try { + result = databaseAccess.selectRecords("Employee", columns, + condition); + System.out.println("Berhasil melakukan seleksi pada database"); + } catch (SQLException e1) { + System.out.println("Gagal melkaukan seleksi pada database"); + System.out.println(e1); + } + + // Mengakses hasil seleksi + try { + while (result.next()) { + System.out.println("Id = " + result.getInt("id")); + System.out.println("First Name = " + result.getString("first")); + System.out.println("Last Name = " + result.getString("last")); + System.out.println("---------------------------------------"); + } + } catch (SQLException e1) { + e1.printStackTrace(); + } + + // Menutup koneksi + try { + databaseAccess.closeConnection(); + } catch (SQLException e) { + e.printStackTrace(); + } + + } +} diff --git a/src/java/DB/DatabaseAccess.java b/src/java/DB/DatabaseAccess.java new file mode 100644 index 00000000..f7a16cc1 --- /dev/null +++ b/src/java/DB/DatabaseAccess.java @@ -0,0 +1,183 @@ +package DB; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; + +import javax.servlet.annotation.WebServlet; + +@WebServlet("/index") +public class DatabaseAccess { + + private static DatabaseAccess instance; + private Connection conn; + private Statement statement; + // JDBC driver name and database URL + final String jdbcDriver; + String DB_URL; + + // Database credentials + String USER; + String PASS; + + private DatabaseAccess() { + + this.jdbcDriver = "com.mysql.jdbc.Driver"; + this.DB_URL = "jdbc:mysql://localhost/EMP"; + + this.USER = "root"; + this.PASS = ""; + + } + + public void setUsername(String username) { + this.USER = username; + } + + public void setPassword(String password) { + this.PASS = password; + } + + public void setDatabase(String databaseName) { + this.DB_URL = "jdbc:mysql://localhost/" + databaseName; + } + + public static DatabaseAccess getInstance() { + if (instance == null) { + instance = new DatabaseAccess(); + } + return instance; + } + + public void openConnection() throws SQLException { + try { + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + + // Open a connection + this.conn = DriverManager.getConnection(this.DB_URL, this.USER, + this.PASS); + } catch (SQLException se) { + System.out.println("Cannot open connection"); + throw se; + } catch (ClassNotFoundException e) { + System.out.println("JDBC not found"); + } + this.statement = this.conn.createStatement(); + } + + public void closeConnection() throws SQLException { + try { + this.conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + throw e; + } + } + + public ResultSet executeFetchQuery(String query) { + ResultSet resultSet = null; + try { + resultSet = this.statement.executeQuery(query); + } catch (SQLException e) { + System.out.println(e); + } + return resultSet; + } + + public void executeUpdateQuery(String query) { + if (this.statement == null) { + try { + this.statement = this.conn.createStatement(); + } catch (SQLException e) { + e.printStackTrace(); + } + } + ResultSet resultSet = null; + try { + this.statement.executeUpdate(query); + } catch (SQLException e) { + System.out.println(e); + } + } + + public void insertRecords(String tableName, ArrayList columns, + ArrayList values) throws SQLException { + StringBuilder query = new StringBuilder("INSERT INTO " + tableName + + " ("); + for (int i = 0; i < columns.size(); i++) { + query.append(columns.get(i)); + if (i != columns.size() - 1) { + query.append(","); + } else { + query.append(")"); + } + } + query.append(" VALUES ("); + for (int i = 0; i < values.size(); i++) { + query.append(values.get(i)); + if (i != values.size() - 1) { + query.append(","); + } else { + query.append(")"); + } + } + query.append(";"); + this.statement.executeUpdate(query.toString()); + } + + public void deleteRecords(String tableName, String condition) + throws SQLException { + String query = "DELETE FROM " + tableName; + if (condition != null) { + query += " WHERE " + condition; + } + query += ";"; + this.statement.executeUpdate(query); + } + + public ResultSet selectRecords(String tableName, ArrayList columns, + String condition) throws SQLException { + StringBuilder query = new StringBuilder("SELECT "); + for (int i = 0; i < columns.size(); i++) { + query.append(columns.get(i)); + if (i != columns.size() - 1) { + query.append(","); + } + } + query.append(" FROM " + tableName); + if (condition != null) { + query.append(" WHERE " + condition); + } + query.append(";"); + ResultSet resultSet = this.statement.executeQuery(query.toString()); + return resultSet; + } + + public ResultSet selectAllRecords(String tableName, String condition) + throws SQLException { + StringBuilder query = new StringBuilder("SELECT * FROM " + tableName); + if (condition != null) { + query.append(" WHERE " + condition); + } + query.append(";"); + ResultSet resultSet = this.statement.executeQuery(query.toString()); + return resultSet; + } + + public void updateRecords(String tableName, ArrayList column, + ArrayList value, String condition) throws SQLException { + StringBuilder query = new StringBuilder("UPDATE " + tableName + " SET "); + for (int i = 0; i < column.size(); i++) { + query.append(column.get(i) + "=" + value.get(i)); + if (i != column.size() - 1) { + query.append(","); + } + } + query.append(" WHERE " + condition); + this.statement.executeUpdate(query.toString()); + } +} \ No newline at end of file diff --git a/src/java/Model/Comment.java b/src/java/Model/Comment.java new file mode 100644 index 00000000..f7037565 --- /dev/null +++ b/src/java/Model/Comment.java @@ -0,0 +1,84 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package Model; +import DB.*; +import java.util.Date; +import java.lang.Object; +import java.sql.Timestamp; +/** + * + * @author wira gotama + */ +public class Comment { + private int id; + private int post_id; + private String creator; + private String email; + private String text; + private Timestamp timestamp; + + public Comment() {} + + public Comment(int id, int post_id, String creator, String email, String text, Timestamp timestamp) { + this.id = id; + this.post_id = post_id; + this.creator = creator; + this.email = email; + this.text = text; + this.timestamp = timestamp; + } + + /* Setter */ + public void setId(int id) { + this.id = id; + } + + public void setPostId(int post_id) { + this.post_id = post_id; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public void setEmail(String email) { + this.email = email; + } + + public void setText(String text) { + this.text = text; + } + + public void setTimestampe(Timestamp timestamp) { + this.timestamp = timestamp; + } + + /* Getter */ + public int getId() { + return id; + } + + public int getPostId() { + return post_id; + } + + public String getCreator() { + return creator; + } + + public String getEmail() { + return email; + } + + public String getText() { + return text; + } + + public Timestamp getTimestamp() { + return timestamp; + } +} diff --git a/src/java/Model/Post.java b/src/java/Model/Post.java new file mode 100644 index 00000000..a6e6fc6b --- /dev/null +++ b/src/java/Model/Post.java @@ -0,0 +1,184 @@ +package Model; + +import DB.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Vector; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; +/** + * + * @author wira gotama + */ +public class Post { + private int id; + private String title; + private String creator; + private String text; + private Timestamp timestamp; + private Vector comments; + + public Post() {} + + public Post(int id, String title, String creator, String text, Timestamp timestamp) { + this.id = id; + this.title = title; + this.creator = creator; + this.text = text; + this.timestamp = timestamp; + } + + /* Setter */ + public void setId(int id) { + this.id = id; + } + + public void setTitle(String title) { + this.title = title; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public void setText(String text) { + this.text = text; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + + /* Getter */ + public int getId() { + return this.id; + } + + public String getTitle() { + return this.title; + } + + public String getCreator() { + return this.creator; + } + + public String getText() { + return this.text; + } + + public Timestamp getTimestamp() { + return this.timestamp; + } + + /* Other */ + public void addComment(Comment c) { + comments.add(c); + } + + public void removeComment(int comment_id) { + boolean stop = false; + for (int i=0; i<=comments.size() && !stop; i++) { + if (comments.get(i).getId()==comment_id) { + comments.remove(i); + stop = true; + } + } + //update ke database, asumsi koneksi ke database udah established + if (stop) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "id="+comment_id; + try { + databaseAccess.deleteRecords("Comments", condition); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + } + + public void loadComment() { + /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ + + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + //query sql + ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); + String condition = "post_id=" + this.id; // jika ada kondisi dapat dimasukkan seperti pada + ResultSet result = null; + try { + result = databaseAccess.selectRecords("Comments", columns, condition); + } catch (SQLException e1) { + e1.printStackTrace(); + } + //fetch the result + try { + while (result.next()) { + Comment c = new Comment(result.getInt("id"), result.getInt("post_id"), result.getString("creator"), + result.getString("email"), result.getString("text"), result.getTimestamp("timestamp")); + addComment(c); + } + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + + public void saveComment() { + /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ + + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("id")); + + for (int i=0; i<=comments.size(); i++) { + String condition = "post_id=" + comments.get(i).getId(); + ResultSet result = null; + + //cek apakah comment yang bersangkutan ada di database atau tidak + try { + result = databaseAccess.selectRecords("Comments", columns, condition); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + + if (result!=null) { //update + updateCommentDB(comments.get(i)); + } + else { //insert + insertCommentDB(comments.get(i)); + } + } + } + + private void updateCommentDB(Comment c) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("text", "timestamp")); + ArrayListvalues = new ArrayList(Arrays.asList(c.getText(), c.getTimestamp())); + String condition = "id="+c.getId(); + try { + databaseAccess.updateRecords("Comments", columns, values, condition); + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + private void insertCommentDB(Comment c) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); + ArrayList values = new ArrayList(Arrays.asList(c.getId(), c.getPostId(), c.getCreator(), + c.getEmail(), c.getText(), c.getTimestamp())); + try { + databaseAccess.insertRecords("Comments", columns, values); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void edit() { //edit utk bagian JSP? + + } +} diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml new file mode 100644 index 00000000..25a9cf87 --- /dev/null +++ b/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/index.jsp b/web/index.jsp new file mode 100644 index 00000000..40535e66 --- /dev/null +++ b/web/index.jsp @@ -0,0 +1,17 @@ +<%-- + Document : index + Created on : Nov 19, 2014, 12:39:05 PM + Author : wira gotama +--%> + +<%@page contentType="text/html" pageEncoding="UTF-8"%> + + + + + JSP Page + + +

Hello World!

+ + From bee2344f8a266a3a7d4b676eec6b2ddc16ee75aa Mon Sep 17 00:00:00 2001 From: melvinfonda Date: Thu, 20 Nov 2014 13:19:38 +0700 Subject: [PATCH 02/41] bagian melvin --- src/java/Model/StaticPost.java | 181 +++++++++++++++++++++++++++++++++ src/java/Model/User.java | 60 +++++++++++ 2 files changed, 241 insertions(+) create mode 100644 src/java/Model/StaticPost.java create mode 100644 src/java/Model/User.java diff --git a/src/java/Model/StaticPost.java b/src/java/Model/StaticPost.java new file mode 100644 index 00000000..f3271ae5 --- /dev/null +++ b/src/java/Model/StaticPost.java @@ -0,0 +1,181 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package Model; + +import DB.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Vector; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author user + */ +public class StaticPost { + private Vector posts; + + public StaticPost () {} + + public void addPost(Post p) { + posts.add(p); + } + + public Post getPost(int post_id) + { + Post p1; + boolean stop = false; + for (int i=0; i<=posts.size() && !stop; i++) { + if (posts.get(i).getId()==post_id) { + p1 = posts.get(i); + stop = true; + } + } + + ResultSet result =null; + if (stop) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "id="+post_id; + try { + result = databaseAccess.selectAllRecords("Posts",condition); + } + catch (SQLException e1) { + System.out.println(e1); + } + } + + //fetch the result + Post p = null; + try + { + while (result.next()) { + + p = new Post(result.getInt("post_id"), result.getString("title") ,result.getString("creator") , + result.getString("text"), result.getTimestamp("timestamp")); + + } + } + catch (SQLException e1) { + e1.printStackTrace(); + } + return p; + } + + public void removePost(int post_id) { + boolean stop = false; + for (int i=0; i<=posts.size() && !stop; i++) { + if (posts.get(i).getId()==post_id) { + posts.remove(i); + stop = true; + } + } + //update ke database, asumsi koneksi ke database udah established + if (stop) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "id="+post_id; + try { + databaseAccess.deleteRecords("Posts", condition); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + } + + public void savePost() { + /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ + + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("id")); + + for (int i=0; i<=posts.size(); i++) { + String condition = "post_id=" + posts.get(i).getId(); + ResultSet result = null; + + //cek apakah post yang bersangkutan ada di database atau tidak + try { + result = databaseAccess.selectRecords("Posts", columns, condition); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + + if (result!=null) { //update + updatePostDB(posts.get(i)); + } + else { //insert + insertPostDB(posts.get(i)); + } + } + } + + private void updatePostDB(Post p) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("text", "timestamp")); + ArrayListvalues = new ArrayList(Arrays.asList(p.getText(), p.getTimestamp())); + String condition = "id="+p.getId(); + try { + databaseAccess.updateRecords("Posts", columns, values, condition); + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + + private void insertPostDB(Post p) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns; + columns = new ArrayList(Arrays.asList("id", "title" ,"creator", "text", "timestamp")); + ArrayList values = new ArrayList(Arrays.asList(p.getId(), p.getTitle(), p.getCreator(), + p.getText(), p.getTimestamp())); + try { + databaseAccess.insertRecords("Posts", columns, values); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public Vector filter(int user_id){ + Vector posts = new Vector(); + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "user_id="+user_id; + ResultSet resultSet = null; + + try { + resultSet = databaseAccess.selectAllRecords("Posts", condition); + } + catch (SQLException e1) { + System.out.println(e1); + } + + try + { + while (resultSet.next()){ + posts.add(new Post(resultSet.getInt("id"), resultSet.getString("title"), resultSet.getString("creator"), + resultSet.getString("text"), resultSet.getTimestamp("timestamp"))); + } + + } + catch (SQLException e1) { + e1.printStackTrace(); + } + return posts; + } + + + + + + +} diff --git a/src/java/Model/User.java b/src/java/Model/User.java new file mode 100644 index 00000000..d491f9bf --- /dev/null +++ b/src/java/Model/User.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package Model; + +/** + * + * @author user + */ +public class User { + private int id; + private String username; + private String pass; + private enum role {owner, editor, admin, guest}; + + public User () {} + + public User(int id, String username, String pass) + { + this.id = id; + this.username = username; + this.pass = pass; + } + + /* Setter */ + public void setId(int id) { + this.id = id; + } + + public void setUsername(String username){ + this.username = username; + } + + public void setPass(String pass) { + this.pass = pass; + } + + /* Getter */ + public int getId(){ + return this.id; + } + + public int getUsername(){ + return this.id; + } + + public int getPass(){ + return this.id; + } + + + + + +} + + From 81955b9a7d0a7eec5939b3de1d6b7aebad25f260 Mon Sep 17 00:00:00 2001 From: melvinfonda Date: Thu, 20 Nov 2014 13:41:18 +0700 Subject: [PATCH 03/41] update post --- src/java/Model/Post.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/java/Model/Post.java b/src/java/Model/Post.java index a6e6fc6b..a31840b6 100644 --- a/src/java/Model/Post.java +++ b/src/java/Model/Post.java @@ -106,6 +106,7 @@ public void loadComment() { /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + comments = new Vector(); //query sql ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); String condition = "post_id=" + this.id; // jika ada kondisi dapat dimasukkan seperti pada From dbd6a52f58caa48a901e05a1b2a88d66090ba1ab Mon Sep 17 00:00:00 2001 From: wiragotama Date: Sun, 23 Nov 2014 15:36:08 +0700 Subject: [PATCH 04/41] perkembangan --- assets/css/button.css | 0 assets/css/screen.css | 118 +++++++++++++++++++++++++++++++++++++++++- login.html | 79 ++++++++++++++++++++++++++++ user_management.html | 80 ++++++++++++++++++++++++++++ 4 files changed, 276 insertions(+), 1 deletion(-) create mode 100644 assets/css/button.css create mode 100644 login.html create mode 100644 user_management.html diff --git a/assets/css/button.css b/assets/css/button.css new file mode 100644 index 00000000..e69de29b diff --git a/assets/css/screen.css b/assets/css/screen.css index 1d8fdf3b..1ad7a160 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -858,4 +858,120 @@ label { margin-right: 15px; width: 100px; padding-top: 5px; -} \ No newline at end of file +} + +.loginContainer { + height : 500px; +} + +.login{ + position : absolute; + top : calc(40% - 75px); + left : calc(50% - 50px); + height : 150px; + width : 350px; + padding : 10px; + z-index : 2; +} + +.login input[type=text]{ + width : 250px; + height : 30px; + background : #ffffff; + border : 1px solid rgba(62,62,62,0.6); + border-radius : 2px; + color : #000000; + font-family : 'Exo', sans-serif; + font-size : 16px; + font-weight : 400; + padding : 4px; +} + +.login input[type=password]{ + width : 250px; + height : 30px; + background : #ffffff; + border : 1px solid rgba(62,62,62,0.6); + border-radius : 2px; + color : #000000; + font-family : 'Exo', sans-serif; + font-size : 16px; + font-weight : 400; + padding : 4px; + margin-top : 10px; +} + +.login input[type=submit]{ + width : 260px; + height : 35px; + background : #3E3E33; + border : 1px solid #fff; + cursor : pointer; + border-radius : 2px; + color : #ffffff; + font-family : 'Exo', sans-serif; + font-size : 16px; + font-weight : 400; + padding : 6px; + margin-top : 10px; +} + +.login input[type=submit]:hover{ + opacity : 0.8; +} + +.login input[type=submit]:active{ + opacity : 0.6; +} + +.login input[type=text]:focus{ + outline : none; + border : 1px solid rgba(255,153,51,0.9); +} + +.login input[type=password]:focus{ + outline : none; + border : 1px solid rgba(255,153,51,0.9); +} + +.login input[type=submit]:focus{ + outline: none; +} + +.login input[type=checkbox] { + margin-left : 120px; +} + +.blogAbout{ + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 300; + font-size: 8px; + line-height: 30px; + color: #000; + position : absolute; + top : calc(38% - 35px); + left: calc(45% - 255px); + z-index : 2; +} + +.blogAbout div{ + float : left; + color : #3E3E33; + font-size : 35px; + font-weight : 200; +} + +.blogAbout div span{ + text-transform: uppercase; + color : #F40034; +} + +.blogAbout div div{ + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size : 15px; + color : #3E3E33; +} + +.crudContaier { + height : 500px; +} diff --git a/login.html b/login.html new file mode 100644 index 00000000..a5ad821c --- /dev/null +++ b/login.html @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
+ + + +
+
+
+
Welcome
---Sang Penguasa Dunia---
+
+ +
+
+ + + +
+ + + \ No newline at end of file diff --git a/user_management.html b/user_management.html new file mode 100644 index 00000000..47bd426c --- /dev/null +++ b/user_management.html @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+ + + \ No newline at end of file From 11852815bbae7bc45f7a6388f5dd00a1504c9c37 Mon Sep 17 00:00:00 2001 From: melvinfonda Date: Sun, 23 Nov 2014 15:36:38 +0700 Subject: [PATCH 05/41] DB simple_blog.sql --- simple_blog.sql | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 simple_blog.sql diff --git a/simple_blog.sql b/simple_blog.sql new file mode 100644 index 00000000..e5116b5e --- /dev/null +++ b/simple_blog.sql @@ -0,0 +1,70 @@ +-- phpMyAdmin SQL Dump +-- version 4.1.12 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Generation Time: Nov 23, 2014 at 09:26 AM +-- Server version: 5.6.16 +-- PHP Version: 5.5.11 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!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 utf8 */; + +-- +-- Database: `simple_blog` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `komentar` +-- + +CREATE TABLE IF NOT EXISTS `komentar` ( + `Id_Komentar` int(10) NOT NULL AUTO_INCREMENT, + `Nama` varchar(40) NOT NULL, + `Tanggal` date NOT NULL, + `Komentar` text NOT NULL, + `Id_Post` int(10) NOT NULL, + `Id_User` int(10) NOT NULL, + PRIMARY KEY (`Id_Komentar`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `post` +-- + +CREATE TABLE IF NOT EXISTS `post` ( + `Id_Post` int(10) NOT NULL AUTO_INCREMENT, + `Judul` varchar(100) NOT NULL, + `Tanggal` date NOT NULL, + `Konten` text NOT NULL, + `Id_User` int(10) NOT NULL, + PRIMARY KEY (`Id_Post`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `Id_User` int(10) NOT NULL AUTO_INCREMENT, + `Username` varchar(40) NOT NULL, + `Password` varchar(20) NOT NULL, + `Role` varchar(10) NOT NULL, + PRIMARY KEY (`Id_User`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From 925d4eb553ed4eb4a6d1c86e487dee0f6536d49c Mon Sep 17 00:00:00 2001 From: wiragotama Date: Sun, 23 Nov 2014 16:41:27 +0700 Subject: [PATCH 06/41] user management page kelar lho... --- assets/css/screen.css | 58 ++++++++++++++++++++++++--- assets/js/validate.js | 8 ++++ delete_user.html | 86 +++++++++++++++++++++++++++++++++++++++ login.html | 2 +- new_post.html | 3 -- new_user.html | 93 +++++++++++++++++++++++++++++++++++++++++++ read_user.html | 86 +++++++++++++++++++++++++++++++++++++++ update_user.html | 93 +++++++++++++++++++++++++++++++++++++++++++ user_management.html | 28 +++++-------- 9 files changed, 431 insertions(+), 26 deletions(-) create mode 100644 assets/js/validate.js create mode 100644 delete_user.html create mode 100644 new_user.html create mode 100644 read_user.html create mode 100644 update_user.html diff --git a/assets/css/screen.css b/assets/css/screen.css index 1ad7a160..43949cab 100644 --- a/assets/css/screen.css +++ b/assets/css/screen.css @@ -106,15 +106,11 @@ header#teaser h1 { /* Links ================================================== */ a { - color: #F40034; text-decoration: none; -webkit-transition: color .2s ease-in-out; -moz-transition: color .2s ease-in-out; transition: color .2s ease-in-out; } -a:hover { - color: #F40034; -} /* Layout ================================================== */ @@ -843,7 +839,7 @@ hr.featured-article:after { height: 90px; } -#contact-area textarea:focus, #contact-area input:focus { +#contact-area textarea:focus, #contact-area input:focus, #contact-area select:focus { border: 2px solid #900; } @@ -852,6 +848,12 @@ hr.featured-article:after { } +#contact-area select { + width : 100px; + padding : 5px; + border: 2px solid #ccc; +} + label { float: left; text-align: right; @@ -975,3 +977,49 @@ label { .crudContaier { height : 500px; } + +.navManagement { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + margin-left : 0px; + position : absolute; + top : calc(16%); + left: calc(13%); + z-index : 2; +} +.navManagement ul +{ + list-style-type : none; + margin : 0; + padding-left : 0; +} + +.navManagement li +{ + display : inline; + float : left; + padding : 8px; + padding-left : 20px; +} + +.navManagement a, +.navManagement a:focus, +.navManagement a:visited, +.navManagement a:hover, +.navManagement a:active { + color : #000000; + text-decoration : none; +} + +.navManagement a:hover { + color : #FF9933; +} + +.form { + margin-top : 200px; + margin-left : 300px; + margin-bottom : 40px; +} + +.userdata { + margin-bottom : 40px; +} \ No newline at end of file diff --git a/assets/js/validate.js b/assets/js/validate.js new file mode 100644 index 00000000..9eff85e2 --- /dev/null +++ b/assets/js/validate.js @@ -0,0 +1,8 @@ +function validateDeletion() { +/* Post deletion confirmation */ + var answer = confirm ("Are you sure want to delete this user?"); + if (answer) { + return true; + } + else return false; +} \ No newline at end of file diff --git a/delete_user.html b/delete_user.html new file mode 100644 index 00000000..e20e792d --- /dev/null +++ b/delete_user.html @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
+ + + + + +
+
+
+
+ + +
+ +
+
+
+
+
+
+ + + +
+ + + \ No newline at end of file diff --git a/login.html b/login.html index a5ad821c..076ced84 100644 --- a/login.html +++ b/login.html @@ -47,7 +47,7 @@
Welcome
---Sang Penguasa Dunia---
diff --git a/read_user.html b/read_user.html index 456ef496..b4188c0c 100644 --- a/read_user.html +++ b/read_user.html @@ -48,6 +48,8 @@
  • Read
  • Update
  • Delete
  • +
  • Add Post
  • +
  • Edit Post
  • diff --git a/update_user.html b/update_user.html index 55600152..e0db504e 100644 --- a/update_user.html +++ b/update_user.html @@ -49,6 +49,8 @@
  • Read
  • Update
  • Delete
  • +
  • Add Post
  • +
  • Edit Post
  • diff --git a/user_management.html b/user_management.html index f2733271..2405167b 100644 --- a/user_management.html +++ b/user_management.html @@ -48,6 +48,8 @@
  • Read
  • Update
  • Delete
  • +
  • Add Post
  • +
  • Edit Post
  • From 23a3c88590ad4afa35ab5e692198219080f22d23 Mon Sep 17 00:00:00 2001 From: wiragotama Date: Sun, 23 Nov 2014 19:28:00 +0700 Subject: [PATCH 08/41] webpage xhtml --- .../admin_edit_post.xhtml | 40 +- .../admin_new_post.xhtml | 50 +- {assets => WebPage/assets}/css/button.css | 0 {assets => WebPage/assets}/css/screen.css | 0 {assets => WebPage/assets}/img/favicon.ico | Bin {assets => WebPage/assets}/img/pre.png | Bin {assets => WebPage/assets}/js/validate.js | 0 delete_user.html => WebPage/delete_user.xhtml | 46 +- index.html => WebPage/index.xhtml | 75 +- login.html => WebPage/login.xhtml | 52 +- WebPage/new_post.xhtml | 88 + new_user.html => WebPage/new_user.xhtml | 50 +- post.html => WebPage/post.xhtml | 82 +- read_user.html => WebPage/read_user.xhtml | 46 +- readme.md => WebPage/readme.md | 0 update_user.html => WebPage/update_user.xhtml | 50 +- .../user_management.xhtml | 40 +- build.xml | 71 - build/web/META-INF/MANIFEST.MF | 2 - build/web/META-INF/context.xml | 2 - .../WEB-INF/classes/.netbeans_automatic_build | 0 .../classes/.netbeans_update_resources | 0 .../WEB-INF/classes/DB/DBConnectionDemo.class | Bin 3792 -> 0 bytes .../WEB-INF/classes/DB/DatabaseAccess.class | Bin 5992 -> 0 bytes build/web/WEB-INF/classes/Model/Comment.class | Bin 1802 -> 0 bytes build/web/WEB-INF/classes/Model/Post.class | Bin 5999 -> 0 bytes build/web/index.jsp | 17 - nbproject/ant-deploy.xml | 49 - nbproject/build-impl.xml | 1441 ----------------- nbproject/genfiles.properties | 8 - nbproject/private/private.properties | 4 - nbproject/private/private.xml | 13 - nbproject/project.properties | 84 - nbproject/project.xml | 18 - new_post.html | 108 -- simple_blog.sql | 70 - src/conf/MANIFEST.MF | 2 - src/java/DB/DBConnectionDemo.java | 113 -- src/java/DB/DatabaseAccess.java | 183 --- src/java/Model/Comment.java | 84 - src/java/Model/Post.java | 185 --- src/java/Model/StaticPost.java | 181 --- src/java/Model/User.java | 60 - web/META-INF/context.xml | 2 - web/index.jsp | 17 - 45 files changed, 326 insertions(+), 3007 deletions(-) rename admin_edit_post.html => WebPage/admin_edit_post.xhtml (70%) rename admin_new_post.html => WebPage/admin_new_post.xhtml (69%) rename {assets => WebPage/assets}/css/button.css (100%) rename {assets => WebPage/assets}/css/screen.css (100%) rename {assets => WebPage/assets}/img/favicon.ico (100%) rename {assets => WebPage/assets}/img/pre.png (100%) rename {assets => WebPage/assets}/js/validate.js (100%) rename delete_user.html => WebPage/delete_user.xhtml (72%) rename index.html => WebPage/index.xhtml (55%) rename login.html => WebPage/login.xhtml (59%) create mode 100644 WebPage/new_post.xhtml rename new_user.html => WebPage/new_user.xhtml (71%) rename post.html => WebPage/post.xhtml (63%) rename read_user.html => WebPage/read_user.xhtml (71%) rename readme.md => WebPage/readme.md (100%) rename update_user.html => WebPage/update_user.xhtml (71%) rename user_management.html => WebPage/user_management.xhtml (70%) delete mode 100644 build.xml delete mode 100644 build/web/META-INF/MANIFEST.MF delete mode 100644 build/web/META-INF/context.xml delete mode 100644 build/web/WEB-INF/classes/.netbeans_automatic_build delete mode 100644 build/web/WEB-INF/classes/.netbeans_update_resources delete mode 100644 build/web/WEB-INF/classes/DB/DBConnectionDemo.class delete mode 100644 build/web/WEB-INF/classes/DB/DatabaseAccess.class delete mode 100644 build/web/WEB-INF/classes/Model/Comment.class delete mode 100644 build/web/WEB-INF/classes/Model/Post.class delete mode 100644 build/web/index.jsp delete mode 100644 nbproject/ant-deploy.xml delete mode 100644 nbproject/build-impl.xml delete mode 100644 nbproject/genfiles.properties delete mode 100644 nbproject/private/private.properties delete mode 100644 nbproject/private/private.xml delete mode 100644 nbproject/project.properties delete mode 100644 nbproject/project.xml delete mode 100644 new_post.html delete mode 100644 simple_blog.sql delete mode 100644 src/conf/MANIFEST.MF delete mode 100644 src/java/DB/DBConnectionDemo.java delete mode 100644 src/java/DB/DatabaseAccess.java delete mode 100644 src/java/Model/Comment.java delete mode 100644 src/java/Model/Post.java delete mode 100644 src/java/Model/StaticPost.java delete mode 100644 src/java/Model/User.java delete mode 100644 web/META-INF/context.xml delete mode 100644 web/index.jsp diff --git a/admin_edit_post.html b/WebPage/admin_edit_post.xhtml similarity index 70% rename from admin_edit_post.html rename to WebPage/admin_edit_post.xhtml index df66cb5d..b1a8ca2c 100644 --- a/admin_edit_post.html +++ b/WebPage/admin_edit_post.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - + @@ -61,14 +61,12 @@ diff --git a/admin_new_post.html b/WebPage/admin_new_post.xhtml similarity index 69% rename from admin_new_post.html rename to WebPage/admin_new_post.xhtml index cb45fbc1..dab61b62 100644 --- a/admin_new_post.html +++ b/WebPage/admin_new_post.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -58,15 +58,15 @@
    - + - + -
    +
    - +
    @@ -74,14 +74,12 @@ diff --git a/assets/css/button.css b/WebPage/assets/css/button.css similarity index 100% rename from assets/css/button.css rename to WebPage/assets/css/button.css diff --git a/assets/css/screen.css b/WebPage/assets/css/screen.css similarity index 100% rename from assets/css/screen.css rename to WebPage/assets/css/screen.css diff --git a/assets/img/favicon.ico b/WebPage/assets/img/favicon.ico similarity index 100% rename from assets/img/favicon.ico rename to WebPage/assets/img/favicon.ico diff --git a/assets/img/pre.png b/WebPage/assets/img/pre.png similarity index 100% rename from assets/img/pre.png rename to WebPage/assets/img/pre.png diff --git a/assets/js/validate.js b/WebPage/assets/js/validate.js similarity index 100% rename from assets/js/validate.js rename to WebPage/assets/js/validate.js diff --git a/delete_user.html b/WebPage/delete_user.xhtml similarity index 72% rename from delete_user.html rename to WebPage/delete_user.xhtml index 0aaf6b62..ebf79b6a 100644 --- a/delete_user.html +++ b/WebPage/delete_user.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - + @@ -58,9 +58,9 @@
    - -
    - + +
    +
    @@ -71,14 +71,12 @@ diff --git a/index.html b/WebPage/index.xhtml similarity index 55% rename from index.html rename to WebPage/index.xhtml index 07cff0ba..13143361 100644 --- a/index.html +++ b/WebPage/index.xhtml @@ -1,29 +1,31 @@ - + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + + + -
    Ψ
    - - - - - \ No newline at end of file diff --git a/login.html b/WebPage/login.xhtml similarity index 59% rename from login.html rename to WebPage/login.xhtml index 076ced84..2ca5c3df 100644 --- a/login.html +++ b/WebPage/login.xhtml @@ -1,29 +1,30 @@ - + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - + + -
    Ψ
    - \ No newline at end of file diff --git a/WebPage/new_post.xhtml b/WebPage/new_post.xhtml new file mode 100644 index 00000000..9617b277 --- /dev/null +++ b/WebPage/new_post.xhtml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Tambah Post

    + +
    +
    + + + + + + +
    + + + +
    +
    +
    +
    + +
    + + + +
    + + + \ No newline at end of file diff --git a/new_user.html b/WebPage/new_user.xhtml similarity index 71% rename from new_user.html rename to WebPage/new_user.xhtml index c2765c3c..4fbb8bcd 100644 --- a/new_user.html +++ b/WebPage/new_user.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -58,19 +58,19 @@
    - + - +

    +

    - +
    @@ -78,14 +78,12 @@ diff --git a/post.html b/WebPage/post.xhtml similarity index 63% rename from post.html rename to WebPage/post.xhtml index c0b6f9e6..f2173e8a 100644 --- a/post.html +++ b/WebPage/post.xhtml @@ -1,29 +1,30 @@ - + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + + -
    Ψ
    - - - - - \ No newline at end of file diff --git a/read_user.html b/WebPage/read_user.xhtml similarity index 71% rename from read_user.html rename to WebPage/read_user.xhtml index b4188c0c..8f82ad23 100644 --- a/read_user.html +++ b/WebPage/read_user.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - + @@ -58,9 +58,9 @@
    - -
    - + +
    +
    @@ -71,14 +71,12 @@ diff --git a/readme.md b/WebPage/readme.md similarity index 100% rename from readme.md rename to WebPage/readme.md diff --git a/update_user.html b/WebPage/update_user.xhtml similarity index 71% rename from update_user.html rename to WebPage/update_user.xhtml index e0db504e..8e7c5ad1 100644 --- a/update_user.html +++ b/WebPage/update_user.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -58,19 +58,19 @@
    - + - +

    +

    - +
    @@ -78,14 +78,12 @@ diff --git a/user_management.html b/WebPage/user_management.xhtml similarity index 70% rename from user_management.html rename to WebPage/user_management.xhtml index 2405167b..96068372 100644 --- a/user_management.html +++ b/WebPage/user_management.xhtml @@ -1,30 +1,30 @@ - + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - + @@ -59,14 +59,12 @@ diff --git a/build.xml b/build.xml deleted file mode 100644 index 081099f2..00000000 --- a/build.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - Builds, tests, and runs the project TubesWBD. - - - diff --git a/build/web/META-INF/MANIFEST.MF b/build/web/META-INF/MANIFEST.MF deleted file mode 100644 index 59499bce..00000000 --- a/build/web/META-INF/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/build/web/META-INF/context.xml b/build/web/META-INF/context.xml deleted file mode 100644 index 25a9cf87..00000000 --- a/build/web/META-INF/context.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/build/web/WEB-INF/classes/.netbeans_automatic_build b/build/web/WEB-INF/classes/.netbeans_automatic_build deleted file mode 100644 index e69de29b..00000000 diff --git a/build/web/WEB-INF/classes/.netbeans_update_resources b/build/web/WEB-INF/classes/.netbeans_update_resources deleted file mode 100644 index e69de29b..00000000 diff --git a/build/web/WEB-INF/classes/DB/DBConnectionDemo.class b/build/web/WEB-INF/classes/DB/DBConnectionDemo.class deleted file mode 100644 index 09a9b52acb9ee7eb7667fd8893c601ede1a6375b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3792 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 u_zvY1&idDg^PW@3-7L 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 diff --git a/build/web/index.jsp b/build/web/index.jsp deleted file mode 100644 index 40535e66..00000000 --- a/build/web/index.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%-- - Document : index - Created on : Nov 19, 2014, 12:39:05 PM - Author : wira gotama ---%> - -<%@page contentType="text/html" pageEncoding="UTF-8"%> - - - - - JSP Page - - -

    Hello World!

    - - diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml deleted file mode 100644 index 9bc5adf7..00000000 --- a/nbproject/ant-deploy.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml deleted file mode 100644 index 2af74b4f..00000000 --- a/nbproject/build-impl.xml +++ /dev/null @@ -1,1441 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set src.dir - Must set test.src.dir - Must set build.dir - Must set build.web.dir - Must set build.generated.dir - Must set dist.dir - Must set build.classes.dir - Must set dist.javadoc.dir - Must set build.test.classes.dir - Must set build.test.results.dir - Must set build.classes.excludes - Must set dist.war - - - - - - - - - -The Java EE server classpath is not correctly set up - server home directory is missing. -Either open the project in the IDE and assign the server or setup the server classpath manually. -For example like this: - ant -Dj2ee.server.home=<app_server_installation_directory> - - -The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. -Either open the project in the IDE and assign the server or setup the server classpath manually. -For example like this: - ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) -or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - No tests executed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -The libs.CopyLibs.classpath property is not set up. -This property must point to -org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part -of NetBeans IDE installation and is usually located at -<netbeans_installation>/java<version>/ant/extra folder. -Either open the project in the IDE and make sure CopyLibs library -exists or setup the property manually. For example like this: - ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must set JVM to use for profiling in profiler.info.jvm - Must set profiler agent JVM arguments in profiler.info.jvmargs.agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.jsp.includes - - - - - - - - - - - - - - - - - - - - - - - - - - Must select a file in the IDE or set jsp.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. - - - Launching ${browse.url} - - - - - - Must select one file in the IDE or set run.class - - - - Must select one file in the IDE or set run.class - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - - - - - - - - Must select one file in the IDE or set debug.class - - - - - Must set fix.includes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This target only works when run from inside the NetBeans IDE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Must select some files in the IDE or set javac.includes - - - - - - - - - - - - - - - - - - - Some tests failed; see details above. - - - - - - - - - Must select some files in the IDE or set test.includes - - - - Some tests failed; see details above. - - - - Must select some files in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - Some tests failed; see details above. - - - - - Must select one file in the IDE or set test.class - - - - Must select one file in the IDE or set test.class - Must select some method in the IDE or set test.method - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties deleted file mode 100644 index 5296ac58..00000000 --- a/nbproject/genfiles.properties +++ /dev/null @@ -1,8 +0,0 @@ -build.xml.data.CRC32=fc5cdc27 -build.xml.script.CRC32=34dbbe87 -build.xml.stylesheet.CRC32=651128d4@1.65.1.1 -# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. -# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=fc5cdc27 -nbproject/build-impl.xml.script.CRC32=18f059e4 -nbproject/build-impl.xml.stylesheet.CRC32=d659eb7a@1.65.1.1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties deleted file mode 100644 index 62c74ea5..00000000 --- a/nbproject/private/private.properties +++ /dev/null @@ -1,4 +0,0 @@ -deploy.ant.properties.file=C:\\Users\\wira gotama\\AppData\\Roaming\\NetBeans\\7.4\\tomcat70.properties -j2ee.server.home=C:/xampp/tomcat -j2ee.server.instance=tomcat70:home=C:\\xampp\\tomcat -user.properties.file=C:\\Users\\wira gotama\\AppData\\Roaming\\NetBeans\\7.4\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml deleted file mode 100644 index cb37d6e4..00000000 --- a/nbproject/private/private.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/DB/DBConnectionDemo.java - file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/DB/DatabaseAccess.java - file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/web/index.jsp - file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/Model/Post.java - file:/E:/ITB%202012/TEKNIK%20INFORMATIKA%202012%20NIM%2013512015/Semester%205/Pengembangan%20Aplikasi%20Berbasis%20Web/Tugas/Tubes%202/TubesWBD/src/java/Model/Comment.java - - - diff --git a/nbproject/project.properties b/nbproject/project.properties deleted file mode 100644 index 64d6eba2..00000000 --- a/nbproject/project.properties +++ /dev/null @@ -1,84 +0,0 @@ -annotation.processing.enabled=true -annotation.processing.enabled.in.editor=true -annotation.processing.processors.list= -annotation.processing.run.all.processors=true -annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output -build.classes.dir=${build.web.dir}/WEB-INF/classes -build.classes.excludes=**/*.java,**/*.form -build.dir=build -build.generated.dir=${build.dir}/generated -build.generated.sources.dir=${build.dir}/generated-sources -build.test.classes.dir=${build.dir}/test/classes -build.test.results.dir=${build.dir}/test/results -build.web.dir=${build.dir}/web -build.web.excludes=${build.classes.excludes} -client.urlPart= -compile.jsps=false -conf.dir=${source.root}/conf -debug.classpath=${build.classes.dir}:${javac.classpath} -debug.test.classpath=\ - ${run.test.classpath} -display.browser=true -# Files to be excluded from distribution war -dist.archive.excludes= -dist.dir=dist -dist.ear.war=${dist.dir}/${war.ear.name} -dist.javadoc.dir=${dist.dir}/javadoc -dist.war=${dist.dir}/${war.name} -endorsed.classpath=\ - ${libs.javaee-endorsed-api-6.0.classpath} -excludes= -includes=** -j2ee.compile.on.save=true -j2ee.copy.static.files.on.save=true -j2ee.deploy.on.save=true -j2ee.platform=1.6-web -j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.2.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar -j2ee.server.type=Tomcat -jar.compress=false -javac.classpath= -# Space-separated list of extra javac options -javac.compilerargs= -javac.debug=true -javac.deprecation=false -javac.processorpath=\ - ${javac.classpath} -javac.source=1.6 -javac.target=1.6 -javac.test.classpath=\ - ${javac.classpath}:\ - ${build.classes.dir} -javac.test.processorpath=\ - ${javac.test.classpath} -javadoc.additionalparam= -javadoc.author=false -javadoc.encoding=${source.encoding} -javadoc.noindex=false -javadoc.nonavbar=false -javadoc.notree=false -javadoc.preview=true -javadoc.private=false -javadoc.splitindex=true -javadoc.use=true -javadoc.version=false -javadoc.windowtitle= -lib.dir=${web.docbase.dir}/WEB-INF/lib -no.dependencies=false -persistence.xml.dir=${conf.dir} -platform.active=default_platform -resource.dir=setup -run.test.classpath=\ - ${javac.test.classpath}:\ - ${build.test.classes.dir} -# Space-separated list of JVM arguments used when running a class with a main method or a unit test -# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): -runmain.jvmargs= -source.encoding=UTF-8 -source.root=src -src.dir=${source.root}/java -test.src.dir=test -war.content.additional= -war.ear.name=${war.name} -war.name=TubesWBD.war -web.docbase.dir=web -webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml deleted file mode 100644 index 4a7caa8e..00000000 --- a/nbproject/project.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - org.netbeans.modules.web.project - - - TubesWBD - 1.6.5 - - - - - - - - - - - diff --git a/new_post.html b/new_post.html deleted file mode 100644 index dbe0917b..00000000 --- a/new_post.html +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog | Tambah Post - - - - - -
    - - - -
    - - -

    -

    - -
    -
    -

    Tambah Post

    - -
    -
    - - - - - - -
    - - - -
    -
    -
    -
    - -
    - - - -
    - - - - - - - - \ No newline at end of file diff --git a/simple_blog.sql b/simple_blog.sql deleted file mode 100644 index e5116b5e..00000000 --- a/simple_blog.sql +++ /dev/null @@ -1,70 +0,0 @@ --- phpMyAdmin SQL Dump --- version 4.1.12 --- http://www.phpmyadmin.net --- --- Host: 127.0.0.1 --- Generation Time: Nov 23, 2014 at 09:26 AM --- Server version: 5.6.16 --- PHP Version: 5.5.11 - -SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+00:00"; - - -/*!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 utf8 */; - --- --- Database: `simple_blog` --- - --- -------------------------------------------------------- - --- --- Table structure for table `komentar` --- - -CREATE TABLE IF NOT EXISTS `komentar` ( - `Id_Komentar` int(10) NOT NULL AUTO_INCREMENT, - `Nama` varchar(40) NOT NULL, - `Tanggal` date NOT NULL, - `Komentar` text NOT NULL, - `Id_Post` int(10) NOT NULL, - `Id_User` int(10) NOT NULL, - PRIMARY KEY (`Id_Komentar`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `post` --- - -CREATE TABLE IF NOT EXISTS `post` ( - `Id_Post` int(10) NOT NULL AUTO_INCREMENT, - `Judul` varchar(100) NOT NULL, - `Tanggal` date NOT NULL, - `Konten` text NOT NULL, - `Id_User` int(10) NOT NULL, - PRIMARY KEY (`Id_Post`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - --- --- Table structure for table `user` --- - -CREATE TABLE IF NOT EXISTS `user` ( - `Id_User` int(10) NOT NULL AUTO_INCREMENT, - `Username` varchar(40) NOT NULL, - `Password` varchar(20) NOT NULL, - `Role` varchar(10) NOT NULL, - PRIMARY KEY (`Id_User`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF deleted file mode 100644 index 59499bce..00000000 --- a/src/conf/MANIFEST.MF +++ /dev/null @@ -1,2 +0,0 @@ -Manifest-Version: 1.0 - diff --git a/src/java/DB/DBConnectionDemo.java b/src/java/DB/DBConnectionDemo.java deleted file mode 100644 index 684f947f..00000000 --- a/src/java/DB/DBConnectionDemo.java +++ /dev/null @@ -1,113 +0,0 @@ -package DB; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; - -public class DBConnectionDemo { - - public static void main(String args[]) { - // Mengakses instans - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - - // Set konfigurasi - databaseAccess.setDatabase("EMP"); - databaseAccess.setUsername("root"); // secara default root - databaseAccess.setPassword(""); // secara default string kosong - - // Membuka koneksi - try { - databaseAccess.openConnection(); - System.out.println("Berhasil membuka koneksi"); - } catch (SQLException e) { - System.out.println("Gagal membuka koneksi"); - System.out.println(e); - } - - // -------------------INSERT---------------------- - // Melakukan INSERT INTO Employee (id,age,first,last) VALUES - // (200,21,'Kevin','Yudi - // Utama'); - ArrayList columns = new ArrayList(Arrays.asList("id", "age", - "first", "last")); - ArrayList values = new ArrayList(Arrays.asList("200", "21", - "'Kevin'", "'Yudi'")); - try { - databaseAccess.insertRecords("Employee", columns, values); - System.out.println("Berhasil memasukkan records"); - } catch (SQLException e1) { - System.out.println("Gagal memasukkan records"); - System.out.println("Error : " + e1); - } - // Alternatif databaseAccess.executeUpdateQuery("INSERT INTO Employee - // (age,first,last) VALUES (21,'Kevin','Yudi Utama');");" - - // -----------------DELETE------------------------ - // Melakukan DELETE FROM Employee WHERE first='Kevin' AND last='Yudi'; - - // null jika tidak ada kondisi (menghapus seluruh records pada tabel); - String condition = "first='Kevin' AND last='Yudi'"; - - try { - databaseAccess.deleteRecords("Employee", condition); - System.out.println("Berhasil menghapus records"); - } catch (SQLException e1) { - System.out.println("Gagal menghapus records"); - e1.printStackTrace(); - } - // Alternatif databaseAccess.executeUpdateQuery("DELETE FROM Employee - // WHERE - // first='Kevin' AND last='Yudi';"); - - // -------------------UPDATE---------------------------- - // melakukan UPDATE Employee SET first='Wira',last='Gotama' WHERE Id = - // 103; - columns = new ArrayList(Arrays.asList("first", "last")); - values = new ArrayList(Arrays.asList("'Wira'", "'Gotama'")); - condition = "Id = 103"; - try { - databaseAccess - .updateRecords("Employee", columns, values, condition); - System.out.println("Berhasil melakukan update terhadap database"); - } catch (SQLException e2) { - System.out.println("Gagal melakukan update terhadap database"); - System.out.println(e2); - } - - // -----------------SELECT-------------------------- - // melakukan SELECT id,first,last FROM Employee; - columns = new ArrayList(Arrays.asList("id", "first", "last")); - condition = null; // jika ada kondisi dapat dimasukkan seperti pada - // INSERT dan DELETE; - ResultSet result = null; - try { - result = databaseAccess.selectRecords("Employee", columns, - condition); - System.out.println("Berhasil melakukan seleksi pada database"); - } catch (SQLException e1) { - System.out.println("Gagal melkaukan seleksi pada database"); - System.out.println(e1); - } - - // Mengakses hasil seleksi - try { - while (result.next()) { - System.out.println("Id = " + result.getInt("id")); - System.out.println("First Name = " + result.getString("first")); - System.out.println("Last Name = " + result.getString("last")); - System.out.println("---------------------------------------"); - } - } catch (SQLException e1) { - e1.printStackTrace(); - } - - // Menutup koneksi - try { - databaseAccess.closeConnection(); - } catch (SQLException e) { - e.printStackTrace(); - } - - } -} diff --git a/src/java/DB/DatabaseAccess.java b/src/java/DB/DatabaseAccess.java deleted file mode 100644 index f7a16cc1..00000000 --- a/src/java/DB/DatabaseAccess.java +++ /dev/null @@ -1,183 +0,0 @@ -package DB; - -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; - -import javax.servlet.annotation.WebServlet; - -@WebServlet("/index") -public class DatabaseAccess { - - private static DatabaseAccess instance; - private Connection conn; - private Statement statement; - // JDBC driver name and database URL - final String jdbcDriver; - String DB_URL; - - // Database credentials - String USER; - String PASS; - - private DatabaseAccess() { - - this.jdbcDriver = "com.mysql.jdbc.Driver"; - this.DB_URL = "jdbc:mysql://localhost/EMP"; - - this.USER = "root"; - this.PASS = ""; - - } - - public void setUsername(String username) { - this.USER = username; - } - - public void setPassword(String password) { - this.PASS = password; - } - - public void setDatabase(String databaseName) { - this.DB_URL = "jdbc:mysql://localhost/" + databaseName; - } - - public static DatabaseAccess getInstance() { - if (instance == null) { - instance = new DatabaseAccess(); - } - return instance; - } - - public void openConnection() throws SQLException { - try { - // Register JDBC driver - Class.forName("com.mysql.jdbc.Driver"); - - // Open a connection - this.conn = DriverManager.getConnection(this.DB_URL, this.USER, - this.PASS); - } catch (SQLException se) { - System.out.println("Cannot open connection"); - throw se; - } catch (ClassNotFoundException e) { - System.out.println("JDBC not found"); - } - this.statement = this.conn.createStatement(); - } - - public void closeConnection() throws SQLException { - try { - this.conn.close(); - } catch (SQLException e) { - e.printStackTrace(); - throw e; - } - } - - public ResultSet executeFetchQuery(String query) { - ResultSet resultSet = null; - try { - resultSet = this.statement.executeQuery(query); - } catch (SQLException e) { - System.out.println(e); - } - return resultSet; - } - - public void executeUpdateQuery(String query) { - if (this.statement == null) { - try { - this.statement = this.conn.createStatement(); - } catch (SQLException e) { - e.printStackTrace(); - } - } - ResultSet resultSet = null; - try { - this.statement.executeUpdate(query); - } catch (SQLException e) { - System.out.println(e); - } - } - - public void insertRecords(String tableName, ArrayList columns, - ArrayList values) throws SQLException { - StringBuilder query = new StringBuilder("INSERT INTO " + tableName - + " ("); - for (int i = 0; i < columns.size(); i++) { - query.append(columns.get(i)); - if (i != columns.size() - 1) { - query.append(","); - } else { - query.append(")"); - } - } - query.append(" VALUES ("); - for (int i = 0; i < values.size(); i++) { - query.append(values.get(i)); - if (i != values.size() - 1) { - query.append(","); - } else { - query.append(")"); - } - } - query.append(";"); - this.statement.executeUpdate(query.toString()); - } - - public void deleteRecords(String tableName, String condition) - throws SQLException { - String query = "DELETE FROM " + tableName; - if (condition != null) { - query += " WHERE " + condition; - } - query += ";"; - this.statement.executeUpdate(query); - } - - public ResultSet selectRecords(String tableName, ArrayList columns, - String condition) throws SQLException { - StringBuilder query = new StringBuilder("SELECT "); - for (int i = 0; i < columns.size(); i++) { - query.append(columns.get(i)); - if (i != columns.size() - 1) { - query.append(","); - } - } - query.append(" FROM " + tableName); - if (condition != null) { - query.append(" WHERE " + condition); - } - query.append(";"); - ResultSet resultSet = this.statement.executeQuery(query.toString()); - return resultSet; - } - - public ResultSet selectAllRecords(String tableName, String condition) - throws SQLException { - StringBuilder query = new StringBuilder("SELECT * FROM " + tableName); - if (condition != null) { - query.append(" WHERE " + condition); - } - query.append(";"); - ResultSet resultSet = this.statement.executeQuery(query.toString()); - return resultSet; - } - - public void updateRecords(String tableName, ArrayList column, - ArrayList value, String condition) throws SQLException { - StringBuilder query = new StringBuilder("UPDATE " + tableName + " SET "); - for (int i = 0; i < column.size(); i++) { - query.append(column.get(i) + "=" + value.get(i)); - if (i != column.size() - 1) { - query.append(","); - } - } - query.append(" WHERE " + condition); - this.statement.executeUpdate(query.toString()); - } -} \ No newline at end of file diff --git a/src/java/Model/Comment.java b/src/java/Model/Comment.java deleted file mode 100644 index f7037565..00000000 --- a/src/java/Model/Comment.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package Model; -import DB.*; -import java.util.Date; -import java.lang.Object; -import java.sql.Timestamp; -/** - * - * @author wira gotama - */ -public class Comment { - private int id; - private int post_id; - private String creator; - private String email; - private String text; - private Timestamp timestamp; - - public Comment() {} - - public Comment(int id, int post_id, String creator, String email, String text, Timestamp timestamp) { - this.id = id; - this.post_id = post_id; - this.creator = creator; - this.email = email; - this.text = text; - this.timestamp = timestamp; - } - - /* Setter */ - public void setId(int id) { - this.id = id; - } - - public void setPostId(int post_id) { - this.post_id = post_id; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public void setEmail(String email) { - this.email = email; - } - - public void setText(String text) { - this.text = text; - } - - public void setTimestampe(Timestamp timestamp) { - this.timestamp = timestamp; - } - - /* Getter */ - public int getId() { - return id; - } - - public int getPostId() { - return post_id; - } - - public String getCreator() { - return creator; - } - - public String getEmail() { - return email; - } - - public String getText() { - return text; - } - - public Timestamp getTimestamp() { - return timestamp; - } -} diff --git a/src/java/Model/Post.java b/src/java/Model/Post.java deleted file mode 100644 index a31840b6..00000000 --- a/src/java/Model/Post.java +++ /dev/null @@ -1,185 +0,0 @@ -package Model; - -import DB.*; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Vector; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.logging.Level; -import java.util.logging.Logger; -/** - * - * @author wira gotama - */ -public class Post { - private int id; - private String title; - private String creator; - private String text; - private Timestamp timestamp; - private Vector comments; - - public Post() {} - - public Post(int id, String title, String creator, String text, Timestamp timestamp) { - this.id = id; - this.title = title; - this.creator = creator; - this.text = text; - this.timestamp = timestamp; - } - - /* Setter */ - public void setId(int id) { - this.id = id; - } - - public void setTitle(String title) { - this.title = title; - } - - public void setCreator(String creator) { - this.creator = creator; - } - - public void setText(String text) { - this.text = text; - } - - public void setTimestamp(Timestamp timestamp) { - this.timestamp = timestamp; - } - - /* Getter */ - public int getId() { - return this.id; - } - - public String getTitle() { - return this.title; - } - - public String getCreator() { - return this.creator; - } - - public String getText() { - return this.text; - } - - public Timestamp getTimestamp() { - return this.timestamp; - } - - /* Other */ - public void addComment(Comment c) { - comments.add(c); - } - - public void removeComment(int comment_id) { - boolean stop = false; - for (int i=0; i<=comments.size() && !stop; i++) { - if (comments.get(i).getId()==comment_id) { - comments.remove(i); - stop = true; - } - } - //update ke database, asumsi koneksi ke database udah established - if (stop) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - String condition = "id="+comment_id; - try { - databaseAccess.deleteRecords("Comments", condition); - } catch (SQLException e1) { - e1.printStackTrace(); - } - } - } - - public void loadComment() { - /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ - - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - comments = new Vector(); - //query sql - ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); - String condition = "post_id=" + this.id; // jika ada kondisi dapat dimasukkan seperti pada - ResultSet result = null; - try { - result = databaseAccess.selectRecords("Comments", columns, condition); - } catch (SQLException e1) { - e1.printStackTrace(); - } - //fetch the result - try { - while (result.next()) { - Comment c = new Comment(result.getInt("id"), result.getInt("post_id"), result.getString("creator"), - result.getString("email"), result.getString("text"), result.getTimestamp("timestamp")); - addComment(c); - } - } catch (SQLException e1) { - e1.printStackTrace(); - } - } - - public void saveComment() { - /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ - - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - ArrayList columns = new ArrayList(Arrays.asList("id")); - - for (int i=0; i<=comments.size(); i++) { - String condition = "post_id=" + comments.get(i).getId(); - ResultSet result = null; - - //cek apakah comment yang bersangkutan ada di database atau tidak - try { - result = databaseAccess.selectRecords("Comments", columns, condition); - } catch (SQLException ex) { - Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); - } - - if (result!=null) { //update - updateCommentDB(comments.get(i)); - } - else { //insert - insertCommentDB(comments.get(i)); - } - } - } - - private void updateCommentDB(Comment c) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - ArrayList columns = new ArrayList(Arrays.asList("text", "timestamp")); - ArrayListvalues = new ArrayList(Arrays.asList(c.getText(), c.getTimestamp())); - String condition = "id="+c.getId(); - try { - databaseAccess.updateRecords("Comments", columns, values, condition); - - } catch (SQLException e) { - e.printStackTrace(); - } - } - - private void insertCommentDB(Comment c) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); - ArrayList values = new ArrayList(Arrays.asList(c.getId(), c.getPostId(), c.getCreator(), - c.getEmail(), c.getText(), c.getTimestamp())); - try { - databaseAccess.insertRecords("Comments", columns, values); - } catch (SQLException ex) { - Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); - } - } - - public void edit() { //edit utk bagian JSP? - - } -} diff --git a/src/java/Model/StaticPost.java b/src/java/Model/StaticPost.java deleted file mode 100644 index f3271ae5..00000000 --- a/src/java/Model/StaticPost.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package Model; - -import DB.*; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Vector; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * - * @author user - */ -public class StaticPost { - private Vector posts; - - public StaticPost () {} - - public void addPost(Post p) { - posts.add(p); - } - - public Post getPost(int post_id) - { - Post p1; - boolean stop = false; - for (int i=0; i<=posts.size() && !stop; i++) { - if (posts.get(i).getId()==post_id) { - p1 = posts.get(i); - stop = true; - } - } - - ResultSet result =null; - if (stop) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - String condition = "id="+post_id; - try { - result = databaseAccess.selectAllRecords("Posts",condition); - } - catch (SQLException e1) { - System.out.println(e1); - } - } - - //fetch the result - Post p = null; - try - { - while (result.next()) { - - p = new Post(result.getInt("post_id"), result.getString("title") ,result.getString("creator") , - result.getString("text"), result.getTimestamp("timestamp")); - - } - } - catch (SQLException e1) { - e1.printStackTrace(); - } - return p; - } - - public void removePost(int post_id) { - boolean stop = false; - for (int i=0; i<=posts.size() && !stop; i++) { - if (posts.get(i).getId()==post_id) { - posts.remove(i); - stop = true; - } - } - //update ke database, asumsi koneksi ke database udah established - if (stop) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - String condition = "id="+post_id; - try { - databaseAccess.deleteRecords("Posts", condition); - } catch (SQLException e1) { - e1.printStackTrace(); - } - } - } - - public void savePost() { - /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ - - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - ArrayList columns = new ArrayList(Arrays.asList("id")); - - for (int i=0; i<=posts.size(); i++) { - String condition = "post_id=" + posts.get(i).getId(); - ResultSet result = null; - - //cek apakah post yang bersangkutan ada di database atau tidak - try { - result = databaseAccess.selectRecords("Posts", columns, condition); - } catch (SQLException ex) { - Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); - } - - if (result!=null) { //update - updatePostDB(posts.get(i)); - } - else { //insert - insertPostDB(posts.get(i)); - } - } - } - - private void updatePostDB(Post p) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - ArrayList columns = new ArrayList(Arrays.asList("text", "timestamp")); - ArrayListvalues = new ArrayList(Arrays.asList(p.getText(), p.getTimestamp())); - String condition = "id="+p.getId(); - try { - databaseAccess.updateRecords("Posts", columns, values, condition); - - } catch (SQLException e) { - e.printStackTrace(); - } - } - - - private void insertPostDB(Post p) { - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - ArrayList columns; - columns = new ArrayList(Arrays.asList("id", "title" ,"creator", "text", "timestamp")); - ArrayList values = new ArrayList(Arrays.asList(p.getId(), p.getTitle(), p.getCreator(), - p.getText(), p.getTimestamp())); - try { - databaseAccess.insertRecords("Posts", columns, values); - } catch (SQLException ex) { - Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); - } - } - - public Vector filter(int user_id){ - Vector posts = new Vector(); - DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); - String condition = "user_id="+user_id; - ResultSet resultSet = null; - - try { - resultSet = databaseAccess.selectAllRecords("Posts", condition); - } - catch (SQLException e1) { - System.out.println(e1); - } - - try - { - while (resultSet.next()){ - posts.add(new Post(resultSet.getInt("id"), resultSet.getString("title"), resultSet.getString("creator"), - resultSet.getString("text"), resultSet.getTimestamp("timestamp"))); - } - - } - catch (SQLException e1) { - e1.printStackTrace(); - } - return posts; - } - - - - - - -} diff --git a/src/java/Model/User.java b/src/java/Model/User.java deleted file mode 100644 index d491f9bf..00000000 --- a/src/java/Model/User.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -package Model; - -/** - * - * @author user - */ -public class User { - private int id; - private String username; - private String pass; - private enum role {owner, editor, admin, guest}; - - public User () {} - - public User(int id, String username, String pass) - { - this.id = id; - this.username = username; - this.pass = pass; - } - - /* Setter */ - public void setId(int id) { - this.id = id; - } - - public void setUsername(String username){ - this.username = username; - } - - public void setPass(String pass) { - this.pass = pass; - } - - /* Getter */ - public int getId(){ - return this.id; - } - - public int getUsername(){ - return this.id; - } - - public int getPass(){ - return this.id; - } - - - - - -} - - diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml deleted file mode 100644 index 25a9cf87..00000000 --- a/web/META-INF/context.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/web/index.jsp b/web/index.jsp deleted file mode 100644 index 40535e66..00000000 --- a/web/index.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%-- - Document : index - Created on : Nov 19, 2014, 12:39:05 PM - Author : wira gotama ---%> - -<%@page contentType="text/html" pageEncoding="UTF-8"%> - - - - - JSP Page - - -

    Hello World!

    - - From 9858dcdafde76f3b2e16d5e2d7bb44cf0952ef12 Mon Sep 17 00:00:00 2001 From: kevinyu Date: Sun, 23 Nov 2014 19:35:47 +0700 Subject: [PATCH 09/41] Recommit --- build.xml | 71 ++ nbproject/ant-deploy.xml | 49 + nbproject/build-impl.xml | 1446 +++++++++++++++++++++++ nbproject/faces-config.NavData | 6 + nbproject/genfiles.properties | 8 + nbproject/project.properties | 93 ++ nbproject/project.xml | 27 + src/conf/MANIFEST.MF | 2 + src/java/Bean/LoginBean.java | 58 + src/java/Database/DBConnectionDemo.java | 113 ++ src/java/Database/DatabaseAccess.java | 175 +++ src/java/Filter/LoginFilter.java | 47 + src/java/Filter/LoginRedirect.java | 46 + src/java/Model/Comment.java | 84 ++ src/java/Model/Post.java | 185 +++ src/java/Model/StaticPost.java | 181 +++ src/java/Model/User.java | 60 + web/META-INF/context.xml | 2 + web/WEB-INF/faces-config.xml | 7 + web/WEB-INF/web.xml | 67 ++ web/admin_edit_post.xhtml | 76 ++ web/admin_new_post.xhtml | 89 ++ web/assets/css/screen.css | 973 +++++++++++++++ web/delete_user.xhtml | 86 ++ web/index.xhtml | 95 ++ web/login.xhtml | 82 ++ web/new_post.xhtml | 88 ++ web/new_user.xhtml | 93 ++ web/post.xhtml | 120 ++ web/read_user.xhtml | 86 ++ web/readme.md | 39 + web/test.xhtml | 23 + web/update_user.xhtml | 93 ++ web/user_management.xhtml | 74 ++ 34 files changed, 4744 insertions(+) create mode 100644 build.xml create mode 100644 nbproject/ant-deploy.xml create mode 100644 nbproject/build-impl.xml create mode 100644 nbproject/faces-config.NavData create mode 100644 nbproject/genfiles.properties create mode 100644 nbproject/project.properties create mode 100644 nbproject/project.xml create mode 100644 src/conf/MANIFEST.MF create mode 100644 src/java/Bean/LoginBean.java create mode 100644 src/java/Database/DBConnectionDemo.java create mode 100644 src/java/Database/DatabaseAccess.java create mode 100644 src/java/Filter/LoginFilter.java create mode 100644 src/java/Filter/LoginRedirect.java create mode 100644 src/java/Model/Comment.java create mode 100644 src/java/Model/Post.java create mode 100644 src/java/Model/StaticPost.java create mode 100644 src/java/Model/User.java create mode 100644 web/META-INF/context.xml create mode 100644 web/WEB-INF/faces-config.xml create mode 100644 web/WEB-INF/web.xml create mode 100644 web/admin_edit_post.xhtml create mode 100644 web/admin_new_post.xhtml create mode 100644 web/assets/css/screen.css create mode 100644 web/delete_user.xhtml create mode 100644 web/index.xhtml create mode 100644 web/login.xhtml create mode 100644 web/new_post.xhtml create mode 100644 web/new_user.xhtml create mode 100644 web/post.xhtml create mode 100644 web/read_user.xhtml create mode 100644 web/readme.md create mode 100644 web/test.xhtml create mode 100644 web/update_user.xhtml create mode 100644 web/user_management.xhtml diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..d4510c0e --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project Simple-Blog. + + + diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 00000000..9bc5adf7 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 00000000..16a91752 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData new file mode 100644 index 00000000..298bfc50 --- /dev/null +++ b/nbproject/faces-config.NavData @@ -0,0 +1,6 @@ + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 00000000..b158fcde --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=9e42ad05 +build.xml.script.CRC32=36fbb5af +build.xml.stylesheet.CRC32=651128d4@1.67.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=9e42ad05 +nbproject/build-impl.xml.script.CRC32=fd4140b7 +nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.67.1.1 diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..653e1b07 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,93 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css +auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=JSP +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +file.reference.mysql-connector-java-3.1.14-bin.jar=../../DeveloperTool/mysql-connector-java-3.1.14/mysql-connector-java-3.1.14-bin.jar +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.6-web +j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.1.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar +j2ee.server.type=Tomcat +jar.compress=false +javac.classpath=\ + ${libs.jsf20.classpath}:\ + ${file.reference.mysql-connector-java-3.1.14-bin.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=Simple-Blog.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 00000000..c8bc5773 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,27 @@ + + + org.netbeans.modules.web.project + + + Simple-Blog + 1.6.5 + + + ${libs.jsf20.classpath} + WEB-INF/lib + + + ${file.reference.mysql-connector-java-3.1.14-bin.jar} + WEB-INF/lib + + + + + + + + + + + + diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/java/Bean/LoginBean.java b/src/java/Bean/LoginBean.java new file mode 100644 index 00000000..901336e4 --- /dev/null +++ b/src/java/Bean/LoginBean.java @@ -0,0 +1,58 @@ +package Bean; + + +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.HttpSession; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author kevinyu + */ +@ManagedBean +@SessionScoped +public class LoginBean implements Serializable{ + private String username; + private String password; + + public String getPassword() { + return password; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public void setPassword(String password) { + this.password = password; + } + + public String doNavigation() { + boolean isExist = true; + if (isExist){ + HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); + session.setAttribute("isLogin","yes"); + return "index?faces-redirect=true"; + } + else { + return "login"; + } + } + + public String logout() { + FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); + return "login?faces-redirect=true"; + } +} diff --git a/src/java/Database/DBConnectionDemo.java b/src/java/Database/DBConnectionDemo.java new file mode 100644 index 00000000..ff3d5071 --- /dev/null +++ b/src/java/Database/DBConnectionDemo.java @@ -0,0 +1,113 @@ +package Database; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; + +public class DBConnectionDemo { + + public static void main(String args[]) { + // Mengakses instans + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + + // Set konfigurasi + databaseAccess.setDatabase("EMP"); + databaseAccess.setUsername("root"); // secara default root + databaseAccess.setPassword(""); // secara default string kosong + + // Membuka koneksi + try { + databaseAccess.openConnection(); + System.out.println("Berhasil membuka koneksi"); + } catch (SQLException e) { + System.out.println("Gagal membuka koneksi"); + System.out.println(e); + } + + // -------------------INSERT---------------------- + // Melakukan INSERT INTO Employee (id,age,first,last) VALUES + // (200,21,'Kevin','Yudi + // Utama'); + ArrayList columns = new ArrayList(Arrays.asList("id", "age", + "first", "last")); + ArrayList values = new ArrayList(Arrays.asList("200", "21", + "'Kevin'", "'Yudi'")); + try { + databaseAccess.insertRecords("Employee", columns, values); + System.out.println("Berhasil memasukkan records"); + } catch (SQLException e1) { + System.out.println("Gagal memasukkan records"); + System.out.println("Error : " + e1); + } + // Alternatif databaseAccess.executeUpdateQuery("INSERT INTO Employee + // (age,first,last) VALUES (21,'Kevin','Yudi Utama');");" + + // -----------------DELETE------------------------ + // Melakukan DELETE FROM Employee WHERE first='Kevin' AND last='Yudi'; + + // null jika tidak ada kondisi (menghapus seluruh records pada tabel); + String condition = "first='Kevin' AND last='Yudi'"; + + try { + databaseAccess.deleteRecords("Employee", condition); + System.out.println("Berhasil menghapus records"); + } catch (SQLException e1) { + System.out.println("Gagal menghapus records"); + e1.printStackTrace(); + } + // Alternatif databaseAccess.executeUpdateQuery("DELETE FROM Employee + // WHERE + // first='Kevin' AND last='Yudi';"); + + // -------------------UPDATE---------------------------- + // melakukan UPDATE Employee SET first='Wira',last='Gotama' WHERE Id = + // 103; + columns = new ArrayList(Arrays.asList("first", "last")); + values = new ArrayList(Arrays.asList("'Wira'", "'Gotama'")); + condition = "Id = 103"; + try { + databaseAccess + .updateRecords("Employee", columns, values, condition); + System.out.println("Berhasil melakukan update terhadap database"); + } catch (SQLException e2) { + System.out.println("Gagal melakukan update terhadap database"); + System.out.println(e2); + } + + // -----------------SELECT-------------------------- + // melakukan SELECT id,first,last FROM Employee; + columns = new ArrayList(Arrays.asList("id", "first", "last")); + condition = null; // jika ada kondisi dapat dimasukkan seperti pada + // INSERT dan DELETE; + ResultSet result = null; + try { + result = databaseAccess.selectRecords("Employee", columns, + condition); + System.out.println("Berhasil melakukan seleksi pada database"); + } catch (SQLException e1) { + System.out.println("Gagal melkaukan seleksi pada database"); + System.out.println(e1); + } + + // Mengakses hasil seleksi + try { + while (result.next()) { + System.out.println("Id = " + result.getInt("id")); + System.out.println("First Name = " + result.getString("first")); + System.out.println("Last Name = " + result.getString("last")); + System.out.println("---------------------------------------"); + } + } catch (SQLException e1) { + e1.printStackTrace(); + } + + // Menutup koneksi + try { + databaseAccess.closeConnection(); + } catch (SQLException e) { + e.printStackTrace(); + } + + } +} diff --git a/src/java/Database/DatabaseAccess.java b/src/java/Database/DatabaseAccess.java new file mode 100644 index 00000000..864ec2fb --- /dev/null +++ b/src/java/Database/DatabaseAccess.java @@ -0,0 +1,175 @@ +package Database; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; + +import javax.servlet.annotation.WebServlet; + +public class DatabaseAccess { + + private static DatabaseAccess instance; + private Connection conn; + private Statement statement; + // JDBC driver name and database URL + final String jdbcDriver; + String DB_URL; + + // Database credentials + String USER; + String PASS; + + private DatabaseAccess() { + + this.jdbcDriver = "com.mysql.jdbc.Driver"; + this.DB_URL = "jdbc:mysql://localhost/EMP"; + + this.USER = "root"; + this.PASS = ""; + + } + + public void setUsername(String username) { + this.USER = username; + } + + public void setPassword(String password) { + this.PASS = password; + } + + public void setDatabase(String databaseName) { + this.DB_URL = "jdbc:mysql://localhost/" + databaseName; + } + + public static DatabaseAccess getInstance() { + if (instance == null) { + instance = new DatabaseAccess(); + } + return instance; + } + + public void openConnection() throws SQLException { + try { + // Register JDBC driver + Class.forName("com.mysql.jdbc.Driver"); + + // Open a connection + this.conn = DriverManager.getConnection(this.DB_URL, this.USER, + this.PASS); + } catch (SQLException se) { + System.out.println("Cannot open connection"); + throw se; + } catch (ClassNotFoundException e) { + System.out.println("JDBC not found"); + } + this.statement = this.conn.createStatement(); + } + + public void closeConnection() throws SQLException { + try { + this.conn.close(); + } catch (SQLException e) { + e.printStackTrace(); + throw e; + } + } + + public ResultSet executeFetchQuery(String query) { + ResultSet resultSet = null; + try { + resultSet = this.statement.executeQuery(query); + } catch (SQLException e) { + System.out.println(e); + } + return resultSet; + } + + public void executeUpdateQuery(String query) { + ResultSet resultSet = null; + try { + this.statement.executeUpdate(query); + } catch (SQLException e) { + System.out.println(e); + } + } + + public void insertRecords(String tableName, ArrayList columns, + ArrayList values) throws SQLException { + StringBuilder query = new StringBuilder("INSERT INTO " + tableName + + " ("); + for (int i = 0; i < columns.size(); i++) { + query.append(columns.get(i)); + if (i != columns.size() - 1) { + query.append(","); + } else { + query.append(")"); + } + } + query.append(" VALUES ("); + for (int i = 0; i < values.size(); i++) { + query.append(values.get(i)); + if (i != values.size() - 1) { + query.append(","); + } else { + query.append(")"); + } + } + query.append(";"); + this.statement.executeUpdate(query.toString()); + } + + public void deleteRecords(String tableName, String condition) + throws SQLException { + String query = "DELETE FROM " + tableName; + if (condition != null) { + query += " WHERE " + condition; + } + query += ";"; + this.statement.executeUpdate(query); + } + + public ResultSet selectRecords(String tableName, ArrayList columns, + String condition) throws SQLException { + StringBuilder query = new StringBuilder("SELECT "); + for (int i = 0; i < columns.size(); i++) { + query.append(columns.get(i)); + if (i != columns.size() - 1) { + query.append(","); + } + } + query.append(" FROM " + tableName); + if (condition != null) { + query.append(" WHERE " + condition); + } + query.append(";"); + ResultSet resultSet = this.statement.executeQuery(query.toString()); + return resultSet; + } + + public ResultSet selectAllRecords(String tableName, String condition) + throws SQLException { + StringBuilder query = new StringBuilder("SELECT * FROM " + tableName); + if (condition != null) { + query.append(" WHERE " + condition); + } + query.append(";"); + ResultSet resultSet = this.statement.executeQuery(query.toString()); + return resultSet; + } + + public void updateRecords(String tableName, ArrayList column, + ArrayList value, String condition) throws SQLException { + StringBuilder query = new StringBuilder("UPDATE " + tableName + " SET "); + for (int i = 0; i < column.size(); i++) { + query.append(column.get(i) + "=" + value.get(i)); + if (i != column.size() - 1) { + query.append(","); + } + } + query.append(" WHERE " + condition); + this.statement.executeUpdate(query.toString()); + } +} \ No newline at end of file diff --git a/src/java/Filter/LoginFilter.java b/src/java/Filter/LoginFilter.java new file mode 100644 index 00000000..15aedb34 --- /dev/null +++ b/src/java/Filter/LoginFilter.java @@ -0,0 +1,47 @@ +package Filter; + + +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author kevinyu + */ + +public class LoginFilter implements Filter{ + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest) request; + String isLogin = (String) req.getSession().getAttribute("isLogin"); + if ((isLogin!=null) && (isLogin.equals("yes"))) { + chain.doFilter(request,response); + } + else { + HttpServletResponse res = (HttpServletResponse)response; + res.sendRedirect("/WebApplication1/login.jsf"); + } + } + + @Override + public void destroy() { + } + +} diff --git a/src/java/Filter/LoginRedirect.java b/src/java/Filter/LoginRedirect.java new file mode 100644 index 00000000..f6857a45 --- /dev/null +++ b/src/java/Filter/LoginRedirect.java @@ -0,0 +1,46 @@ +package Filter; + +import java.io.IOException; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @author kevinyu + */ +public class LoginRedirect implements Filter{ + + @Override + public void init(FilterConfig filterConfig) throws ServletException { + } + + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + HttpServletRequest req = (HttpServletRequest) request; + String isLogin = (String) req.getSession().getAttribute("isLogin"); + if ((isLogin!=null) && (isLogin.equals("yes"))) { + HttpServletResponse res = (HttpServletResponse) response; + res.sendRedirect("/WebApplication1/index.jsf"); + } + else { + chain.doFilter(request,response); + } + } + + @Override + public void destroy() { + } + +} diff --git a/src/java/Model/Comment.java b/src/java/Model/Comment.java new file mode 100644 index 00000000..d4ec89a2 --- /dev/null +++ b/src/java/Model/Comment.java @@ -0,0 +1,84 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package Model; +import Database.*; +import java.util.Date; +import java.lang.Object; +import java.sql.Timestamp; +/** + * + * @author wira gotama + */ +public class Comment { + private int id; + private int post_id; + private String creator; + private String email; + private String text; + private Timestamp timestamp; + + public Comment() {} + + public Comment(int id, int post_id, String creator, String email, String text, Timestamp timestamp) { + this.id = id; + this.post_id = post_id; + this.creator = creator; + this.email = email; + this.text = text; + this.timestamp = timestamp; + } + + /* Setter */ + public void setId(int id) { + this.id = id; + } + + public void setPostId(int post_id) { + this.post_id = post_id; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public void setEmail(String email) { + this.email = email; + } + + public void setText(String text) { + this.text = text; + } + + public void setTimestampe(Timestamp timestamp) { + this.timestamp = timestamp; + } + + /* Getter */ + public int getId() { + return id; + } + + public int getPostId() { + return post_id; + } + + public String getCreator() { + return creator; + } + + public String getEmail() { + return email; + } + + public String getText() { + return text; + } + + public Timestamp getTimestamp() { + return timestamp; + } +} diff --git a/src/java/Model/Post.java b/src/java/Model/Post.java new file mode 100644 index 00000000..f7db4809 --- /dev/null +++ b/src/java/Model/Post.java @@ -0,0 +1,185 @@ +package Model; + +import Database.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Vector; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; +/** + * + * @author wira gotama + */ +public class Post { + private int id; + private String title; + private String creator; + private String text; + private Timestamp timestamp; + private Vector comments; + + public Post() {} + + public Post(int id, String title, String creator, String text, Timestamp timestamp) { + this.id = id; + this.title = title; + this.creator = creator; + this.text = text; + this.timestamp = timestamp; + } + + /* Setter */ + public void setId(int id) { + this.id = id; + } + + public void setTitle(String title) { + this.title = title; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public void setText(String text) { + this.text = text; + } + + public void setTimestamp(Timestamp timestamp) { + this.timestamp = timestamp; + } + + /* Getter */ + public int getId() { + return this.id; + } + + public String getTitle() { + return this.title; + } + + public String getCreator() { + return this.creator; + } + + public String getText() { + return this.text; + } + + public Timestamp getTimestamp() { + return this.timestamp; + } + + /* Other */ + public void addComment(Comment c) { + comments.add(c); + } + + public void removeComment(int comment_id) { + boolean stop = false; + for (int i=0; i<=comments.size() && !stop; i++) { + if (comments.get(i).getId()==comment_id) { + comments.remove(i); + stop = true; + } + } + //update ke database, asumsi koneksi ke database udah established + if (stop) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "id="+comment_id; + try { + databaseAccess.deleteRecords("Comments", condition); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + } + + public void loadComment() { + /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ + + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + comments = new Vector(); + //query sql + ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); + String condition = "post_id=" + this.id; // jika ada kondisi dapat dimasukkan seperti pada + ResultSet result = null; + try { + result = databaseAccess.selectRecords("Comments", columns, condition); + } catch (SQLException e1) { + e1.printStackTrace(); + } + //fetch the result + try { + while (result.next()) { + Comment c = new Comment(result.getInt("id"), result.getInt("post_id"), result.getString("creator"), + result.getString("email"), result.getString("text"), result.getTimestamp("timestamp")); + addComment(c); + } + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + + public void saveComment() { + /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ + + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("id")); + + for (int i=0; i<=comments.size(); i++) { + String condition = "post_id=" + comments.get(i).getId(); + ResultSet result = null; + + //cek apakah comment yang bersangkutan ada di database atau tidak + try { + result = databaseAccess.selectRecords("Comments", columns, condition); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + + if (result!=null) { //update + updateCommentDB(comments.get(i)); + } + else { //insert + insertCommentDB(comments.get(i)); + } + } + } + + private void updateCommentDB(Comment c) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("text", "timestamp")); + ArrayListvalues = new ArrayList(Arrays.asList(c.getText(), c.getTimestamp())); + String condition = "id="+c.getId(); + try { + databaseAccess.updateRecords("Comments", columns, values, condition); + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + private void insertCommentDB(Comment c) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("id", "post_id", "creator", "email", "text", "timestamp")); + ArrayList values = new ArrayList(Arrays.asList(c.getId(), c.getPostId(), c.getCreator(), + c.getEmail(), c.getText(), c.getTimestamp())); + try { + databaseAccess.insertRecords("Comments", columns, values); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void edit() { //edit utk bagian JSP? + + } +} diff --git a/src/java/Model/StaticPost.java b/src/java/Model/StaticPost.java new file mode 100644 index 00000000..8916694e --- /dev/null +++ b/src/java/Model/StaticPost.java @@ -0,0 +1,181 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package Model; + +import Database.*; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Vector; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author user + */ +public class StaticPost { + private Vector posts; + + public StaticPost () {} + + public void addPost(Post p) { + posts.add(p); + } + + public Post getPost(int post_id) + { + Post p1; + boolean stop = false; + for (int i=0; i<=posts.size() && !stop; i++) { + if (posts.get(i).getId()==post_id) { + p1 = posts.get(i); + stop = true; + } + } + + ResultSet result =null; + if (stop) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "id="+post_id; + try { + result = databaseAccess.selectAllRecords("Posts",condition); + } + catch (SQLException e1) { + System.out.println(e1); + } + } + + //fetch the result + Post p = null; + try + { + while (result.next()) { + + p = new Post(result.getInt("post_id"), result.getString("title") ,result.getString("creator") , + result.getString("text"), result.getTimestamp("timestamp")); + + } + } + catch (SQLException e1) { + e1.printStackTrace(); + } + return p; + } + + public void removePost(int post_id) { + boolean stop = false; + for (int i=0; i<=posts.size() && !stop; i++) { + if (posts.get(i).getId()==post_id) { + posts.remove(i); + stop = true; + } + } + //update ke database, asumsi koneksi ke database udah established + if (stop) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "id="+post_id; + try { + databaseAccess.deleteRecords("Posts", condition); + } catch (SQLException e1) { + e1.printStackTrace(); + } + } + } + + public void savePost() { + /* Asumsi : koneksi diurus oleh kelas yang memanggil atau controller */ + + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("id")); + + for (int i=0; i<=posts.size(); i++) { + String condition = "post_id=" + posts.get(i).getId(); + ResultSet result = null; + + //cek apakah post yang bersangkutan ada di database atau tidak + try { + result = databaseAccess.selectRecords("Posts", columns, condition); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + + if (result!=null) { //update + updatePostDB(posts.get(i)); + } + else { //insert + insertPostDB(posts.get(i)); + } + } + } + + private void updatePostDB(Post p) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns = new ArrayList(Arrays.asList("text", "timestamp")); + ArrayListvalues = new ArrayList(Arrays.asList(p.getText(), p.getTimestamp())); + String condition = "id="+p.getId(); + try { + databaseAccess.updateRecords("Posts", columns, values, condition); + + } catch (SQLException e) { + e.printStackTrace(); + } + } + + + private void insertPostDB(Post p) { + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + ArrayList columns; + columns = new ArrayList(Arrays.asList("id", "title" ,"creator", "text", "timestamp")); + ArrayList values = new ArrayList(Arrays.asList(p.getId(), p.getTitle(), p.getCreator(), + p.getText(), p.getTimestamp())); + try { + databaseAccess.insertRecords("Posts", columns, values); + } catch (SQLException ex) { + Logger.getLogger(Post.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public Vector filter(int user_id){ + Vector posts = new Vector(); + DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); + String condition = "user_id="+user_id; + ResultSet resultSet = null; + + try { + resultSet = databaseAccess.selectAllRecords("Posts", condition); + } + catch (SQLException e1) { + System.out.println(e1); + } + + try + { + while (resultSet.next()){ + posts.add(new Post(resultSet.getInt("id"), resultSet.getString("title"), resultSet.getString("creator"), + resultSet.getString("text"), resultSet.getTimestamp("timestamp"))); + } + + } + catch (SQLException e1) { + e1.printStackTrace(); + } + return posts; + } + + + + + + +} diff --git a/src/java/Model/User.java b/src/java/Model/User.java new file mode 100644 index 00000000..d491f9bf --- /dev/null +++ b/src/java/Model/User.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package Model; + +/** + * + * @author user + */ +public class User { + private int id; + private String username; + private String pass; + private enum role {owner, editor, admin, guest}; + + public User () {} + + public User(int id, String username, String pass) + { + this.id = id; + this.username = username; + this.pass = pass; + } + + /* Setter */ + public void setId(int id) { + this.id = id; + } + + public void setUsername(String username){ + this.username = username; + } + + public void setPass(String pass) { + this.pass = pass; + } + + /* Getter */ + public int getId(){ + return this.id; + } + + public int getUsername(){ + return this.id; + } + + public int getPass(){ + return this.id; + } + + + + + +} + + diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml new file mode 100644 index 00000000..0c58003f --- /dev/null +++ b/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..0393e360 --- /dev/null +++ b/web/WEB-INF/faces-config.xml @@ -0,0 +1,7 @@ + + + + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 00000000..03d21cb9 --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,67 @@ + + + + loginFilter + + Filter.LoginFilter + + + test-param + Initialization Paramter + + + + loginRedirect + + Filter.LoginRedirect + + + test-param + Initialization Paramter + + + + + loginFilter + /index.jsf + + + loginRedirect + /login.jsf + + + + + + loginFilter + LoginFilter + + + + loginRedirect + LoginRedirect + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + *.jsf + + + + 30 + + + + login.jsf + + + diff --git a/web/admin_edit_post.xhtml b/web/admin_edit_post.xhtml new file mode 100644 index 00000000..b1a8ca2c --- /dev/null +++ b/web/admin_edit_post.xhtml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + + +
    + +
    + + + +
    + + + \ No newline at end of file diff --git a/web/admin_new_post.xhtml b/web/admin_new_post.xhtml new file mode 100644 index 00000000..dab61b62 --- /dev/null +++ b/web/admin_new_post.xhtml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + + +
    +
    +
    + + + + + + +
    + + + +
    +
    +
    + + + +
    + + + \ No newline at end of file diff --git a/web/assets/css/screen.css b/web/assets/css/screen.css new file mode 100644 index 00000000..cfdf186e --- /dev/null +++ b/web/assets/css/screen.css @@ -0,0 +1,973 @@ +@import url(http://fonts.googleapis.com/css?family=Open+Sans); +@import url(http://fonts.googleapis.com/css?family=Questrial); + +/* Reset & Basics (Inspired by E. Meyers) +================================================== */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; } +article, aside, details, figcaption, figure, footer, header, hgroup, menu, time, nav, section { + display: block; } +html, body, .wrapper { + min-height: 100%; +} + + +/* Body +================================================== */ +html, body { + height: 100%; +} +.wrapper { + min-height: 100%; +} +body { + overflow-x: hidden; + font: 17px/28px ff-meta-serif-web-pro, "Georgia", serif; + color: #333; + background: #fff; +} + + +/* Typography +================================================== */ +h1, h2, h3, h4, h5, h6 { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: normal; + text-transform: uppercase; + font-weight: 700; + color: #000; + text-rendering: optimizeLegibility; +} + +h1 { + font-size: 50px; + padding-bottom: 30px; +} + +h2 { + font-size: 45px; + padding-bottom: 25px; +} + +h3 { + font-size: 40px; + padding-bottom: 20px; +} + +h4 { + font-size: 35px; + padding-bottom: 15px; +} + +h5 { + font-size: 30px; + padding-bottom: 10px; +} + +p { + margin: 0 0 28px 0; +} + +strong { + font-weight: bold; +} +em { + font-style: italic; +} +sup { + line-height: 0; +} + +small { + font-size: 70%; +} + +cite { + font-size: 80%; + font-style: italic; + } + +/* Teaser +================================================== */ + +header#teaser h1 { + text-transform: none !important; + color: #333; + font-size: 28px !important; + font-weight: 300 !important; +} + + +/* Links +================================================== */ +a { + color: #F40034; + text-decoration: none; + -webkit-transition: color .2s ease-in-out; + -moz-transition: color .2s ease-in-out; + transition: color .2s ease-in-out; +} +a:hover { + color: #F40034; +} + +/* Layout +================================================== */ +/* White container that is the "page" */ +.wrapper { + max-width: 1500px; + margin: 0 auto; + background: #fff; +} + +/* Containers to keep content to a set width */ +.nav, +.art-header-inner, +.footer, +.art-list, +.abt, +.fourohfour { + width: 980px; +} +.nav, +.art-body-inner, +.footer, +.art-list, +.abt, +.fourohfour { + position: relative; + margin: 0 auto; +} + +/* Nav +================================================== */ +.nav { + position: absolute; + top: 0; + left: 50%; + height: 70px; + padding-top: 40px; + margin-left: -490px; /* Half width of nav */ + border-bottom: 1px solid #333; + z-index: 2; +} +.nav.fixed { + position: fixed; +} +#logo { + float: left; +} +.nav-primary { + float: right; +} +.nav-primary li { + display: inline-block; + margin-left: 10px; + font-weight: 500; +} +#logo h1, +.nav-primary li, +.nav-primary li a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 700; + font-size: 13px; + line-height: 30px; + color: #000; + text-transform: uppercase; +} + +#logo h1 { + height: 30px; + margin-left: 0px; + letter-spacing: 1px; + font-family: 'Questrial', sans-serif; + font-size: 30px; +} + +#logo h1 span{ + color: #F40034 !important; +} + +.nav li:first-child { + margin-left: 0; /* Remove left margin from the first nav li */ +} + +/* Home Page +================================================== */ + +div#home {} + +#home > div.cover { + max-width: 980px; + margin: 0px auto; + /*padding-top: 110px;*/ +} + +div.cover { + +} + +div.cover > img { + width: 100%; + height: 100%; +} + + +/* Article +================================================== */ +.art { + margin-top: -131px; +} +/* Header */ +.art-header { + height: 900px; + /* Background image is defined in the post */ + background-position: top center; + background-attachment: fixed; + overflow: hidden; +} +/* Contains the time, title and subtitle for an article */ +.art-header-inner { + position: fixed; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: left; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} + +.loginContainer { + height : 500px; +} + +.login{ + position : absolute; + top : calc(40% - 75px); + left : calc(50% - 50px); + height : 150px; + width : 350px; + padding : 10px; + z-index : 2; +} + +.login input[type=text]{ + width : 250px; + height : 30px; + background : #ffffff; + border : 1px solid rgba(62,62,62,0.6); + border-radius : 2px; + color : #000000; + font-family : 'Exo', sans-serif; + font-size : 16px; + font-weight : 400; + padding : 4px; +} + +.login input[type=password]{ + width : 250px; + height : 30px; + background : #ffffff; + border : 1px solid rgba(62,62,62,0.6); + border-radius : 2px; + color : #000000; + font-family : 'Exo', sans-serif; + font-size : 16px; + font-weight : 400; + padding : 4px; + margin-top : 10px; +} + +.login input[type=submit]{ + width : 260px; + height : 35px; + background : #3E3E33; + border : 1px solid #fff; + cursor : pointer; + border-radius : 2px; + color : #ffffff; + font-family : 'Exo', sans-serif; + font-size : 16px; + font-weight : 400; + padding : 6px; + margin-top : 10px; +} + +.login input[type=submit]:hover{ + opacity : 0.8; +} + +.login input[type=submit]:active{ + opacity : 0.6; +} + +.login input[type=text]:focus{ + outline : none; + border : 1px solid rgba(255,153,51,0.9); +} + +.login input[type=password]:focus{ + outline : none; + border : 1px solid rgba(255,153,51,0.9); +} + +.login input[type=submit]:focus{ + outline: none; +} + +.login input[type=checkbox] { + margin-left : 120px; +} + +.blogAbout{ + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-weight: 300; + font-size: 8px; + line-height: 30px; + color: #000; + position : absolute; + top : calc(38% - 35px); + left: calc(45% - 255px); + z-index : 2; +} + +.blogAbout div{ + float : left; + color : #3E3E33; + font-size : 35px; + font-weight : 200; +} + +.blogAbout div span{ + text-transform: uppercase; + color : #F40034; +} + +.blogAbout div div{ + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size : 15px; + color : #3E3E33; +} \ No newline at end of file diff --git a/web/delete_user.xhtml b/web/delete_user.xhtml new file mode 100644 index 00000000..ebf79b6a --- /dev/null +++ b/web/delete_user.xhtml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + +
    +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    +
    + + + +
    + + + \ No newline at end of file diff --git a/web/index.xhtml b/web/index.xhtml new file mode 100644 index 00000000..8fecda6f --- /dev/null +++ b/web/index.xhtml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + +
    +
    + +
    +
    + + + +
    + + + diff --git a/web/login.xhtml b/web/login.xhtml new file mode 100644 index 00000000..7ea2c7bb --- /dev/null +++ b/web/login.xhtml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + +
    +
    +
    +
    Welcome
    ---Sang Penguasa Dunia---
    +
    + +
    +
    + + + +
    + +
    + diff --git a/web/new_post.xhtml b/web/new_post.xhtml new file mode 100644 index 00000000..9617b277 --- /dev/null +++ b/web/new_post.xhtml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Tambah Post + + + + + +
    + + + +
    + + +

    -

    + +
    +
    +

    Tambah Post

    + +
    +
    + + + + + + +
    + + + +
    +
    +
    +
    + +
    + + + +
    + + + \ No newline at end of file diff --git a/web/new_user.xhtml b/web/new_user.xhtml new file mode 100644 index 00000000..4fbb8bcd --- /dev/null +++ b/web/new_user.xhtml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + + +
    +
    +
    + + + + + + + +

    + + +
    +
    +
    + + + +
    + + + \ No newline at end of file diff --git a/web/post.xhtml b/web/post.xhtml new file mode 100644 index 00000000..f2173e8a --- /dev/null +++ b/web/post.xhtml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog | Apa itu Simple Blog? + + + + + +
    + + + +
    + +
    +
    + +

    Apa itu Simple Blog?

    +

    +
    +
    + +
    +
    +
    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.

    +

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?

    + +
    + +

    Komentar

    + +
    +
    + + + + + + +
    + + + +
    +
    + +
      +
    • +
      +

      Jems

      +
      2 menit lalu
      +
      +

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt!

      +
    • + +
    • +
      +

      Kave

      +
      1 jam lalu
      +
      +

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt!

      +
    • +
    +
    +
    + +
    + + + +
    + + + \ No newline at end of file diff --git a/web/read_user.xhtml b/web/read_user.xhtml new file mode 100644 index 00000000..8f82ad23 --- /dev/null +++ b/web/read_user.xhtml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + +
    +
    +
    +
    + + +
    + +
    +
    +
    +
    +
    +
    + + + +
    + + + \ No newline at end of file diff --git a/web/readme.md b/web/readme.md new file mode 100644 index 00000000..5e7e48f5 --- /dev/null +++ b/web/readme.md @@ -0,0 +1,39 @@ +# Simple Blog Java + +Tugas 2 IF3110. + +![Simple Blog](http://i655.photobucket.com/albums/uu275/sonnylazuardi/ss-5.jpg) + +## Deskripsi + +Gunakan template ini untuk membuat sebuah blog sederhana dengan menggunakan bahasa pemrograman PHP. + +## Spesifikasi + +Spesifikasi untuk Tugas II IF3110 dapat diakses pada pranala berikut: + +https://www.dropbox.com/sh/ig1hf108ad9fqxi/AAA2PMjPFICSFo3ypdrHl39La?dl=0 + +## Deliverable + +Tiap-tiap Kelompok Membuat Organizationnya masing-masing, dengan langkah: + +1. Klik tanda Tambah disamping username pada Github, Pilih Create New Organization + +2. Buat Organisasi dengan Nama : IF3110-II-Nomor_Kelompok . Nomor Kelompok dapat diakses [disini](https://docs.google.com/spreadsheets/d/1Y-FGJ_feIVYNRv-o0ycBXyfAiKMFXKA17cvw3Mhjd1A/edit?usp=sharing) + +3. Masukkan email address salah satu anggota untuk billing email ( bebas ). + +4. Undang anggota kelompok untuk menjadi anggota Organisasi. + +5. Lakukan Fork Repository ini ke Organisasi yang baru dibentuk + +6. Setelah selesai mengerjakan, lakukan Pull Request. + +## Lisensi + +© 2014 Asisten IF3110 + +Yogi | [Sonny](http://github.com/sonnylazuardi) | Fathan | Renusa | Kelvin | Yanuar + +Dosen: [Yudistira Dwi Wardhana](http://github.com/yudis) \ No newline at end of file diff --git a/web/test.xhtml b/web/test.xhtml new file mode 100644 index 00000000..c3c92b21 --- /dev/null +++ b/web/test.xhtml @@ -0,0 +1,23 @@ + + + +Test Tags + + + +

    Test Tags

    +
    +Test that JSF Tags Render Properly + +Verify that you see a textfield and button below.

    +Textfield: + +
    +Button: + +
    +
    +
    \ No newline at end of file diff --git a/web/update_user.xhtml b/web/update_user.xhtml new file mode 100644 index 00000000..8e7c5ad1 --- /dev/null +++ b/web/update_user.xhtml @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + + +
    +
    +
    + + + + + + + +

    + + +
    +
    +
    + + + +
    + + + \ No newline at end of file diff --git a/web/user_management.xhtml b/web/user_management.xhtml new file mode 100644 index 00000000..96068372 --- /dev/null +++ b/web/user_management.xhtml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Simple Blog + + + + + +
    + + + + + +
    +
    + + + +
    + + + \ No newline at end of file From 3d13ea266dc7fd830158533fdb3230051b19072c Mon Sep 17 00:00:00 2001 From: wiragotama Date: Sun, 23 Nov 2014 19:41:27 +0700 Subject: [PATCH 10/41] recommit2 --- WebPage/admin_new_post.xhtml | 89 -- WebPage/assets/css/screen.css | 1025 ----------------- WebPage/delete_user.xhtml | 86 -- WebPage/index.xhtml | 95 -- WebPage/login.xhtml | 77 -- WebPage/new_post.xhtml | 88 -- WebPage/new_user.xhtml | 93 -- WebPage/post.xhtml | 120 -- WebPage/read_user.xhtml | 86 -- WebPage/readme.md | 39 - WebPage/update_user.xhtml | 93 -- WebPage/user_management.xhtml | 74 -- web/admin_edit_post.xhtml | 17 +- .../admin_list_post.xhtml | 17 +- web/admin_new_post.xhtml | 17 +- {WebPage => web}/assets/css/button.css | 0 web/assets/css/screen.css | 62 +- {WebPage => web}/assets/img/favicon.ico | Bin {WebPage => web}/assets/img/pre.png | Bin {WebPage => web}/assets/js/validate.js | 0 web/delete_user.xhtml | 17 +- web/index.xhtml | 2 +- web/login.xhtml | 41 +- web/new_user.xhtml | 17 +- web/post.xhtml | 2 +- web/read_user.xhtml | 17 +- web/update_user.xhtml | 15 +- web/user_management.xhtml | 17 +- 28 files changed, 148 insertions(+), 2058 deletions(-) delete mode 100644 WebPage/admin_new_post.xhtml delete mode 100644 WebPage/assets/css/screen.css delete mode 100644 WebPage/delete_user.xhtml delete mode 100644 WebPage/index.xhtml delete mode 100644 WebPage/login.xhtml delete mode 100644 WebPage/new_post.xhtml delete mode 100644 WebPage/new_user.xhtml delete mode 100644 WebPage/post.xhtml delete mode 100644 WebPage/read_user.xhtml delete mode 100644 WebPage/readme.md delete mode 100644 WebPage/update_user.xhtml delete mode 100644 WebPage/user_management.xhtml rename WebPage/admin_edit_post.xhtml => web/admin_list_post.xhtml (78%) rename {WebPage => web}/assets/css/button.css (100%) rename {WebPage => web}/assets/img/favicon.ico (100%) rename {WebPage => web}/assets/img/pre.png (100%) rename {WebPage => web}/assets/js/validate.js (100%) diff --git a/WebPage/admin_new_post.xhtml b/WebPage/admin_new_post.xhtml deleted file mode 100644 index dab61b62..00000000 --- a/WebPage/admin_new_post.xhtml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - - - - -
    -
    -
    - - - - - - -
    - - - -
    -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/assets/css/screen.css b/WebPage/assets/css/screen.css deleted file mode 100644 index 43949cab..00000000 --- a/WebPage/assets/css/screen.css +++ /dev/null @@ -1,1025 +0,0 @@ -@import url(http://fonts.googleapis.com/css?family=Open+Sans); -@import url(http://fonts.googleapis.com/css?family=Questrial); - -/* Reset & Basics (Inspired by E. Meyers) -================================================== */ -html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, address, cite, code, em, img, small, strong, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, embed, figure, figcaption, footer, header, hgroup, menu, nav, section, summary, time, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; } -article, aside, details, figcaption, figure, footer, header, hgroup, menu, time, nav, section { - display: block; } -html, body, .wrapper { - min-height: 100%; -} - - -/* Body -================================================== */ -html, body { - height: 100%; -} -.wrapper { - min-height: 100%; -} -body { - overflow-x: hidden; - font: 17px/28px ff-meta-serif-web-pro, "Georgia", serif; - color: #333; - background: #fff; -} - - -/* Typography -================================================== */ -h1, h2, h3, h4, h5, h6 { - font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; - font-weight: normal; - text-transform: uppercase; - font-weight: 700; - color: #000; - text-rendering: optimizeLegibility; -} - -h1 { - font-size: 50px; - padding-bottom: 30px; -} - -h2 { - font-size: 45px; - padding-bottom: 25px; -} - -h3 { - font-size: 40px; - padding-bottom: 20px; -} - -h4 { - font-size: 35px; - padding-bottom: 15px; -} - -h5 { - font-size: 30px; - padding-bottom: 10px; -} - -p { - margin: 0 0 28px 0; -} - -strong { - font-weight: bold; -} -em { - font-style: italic; -} -sup { - line-height: 0; -} - -small { - font-size: 70%; -} - -cite { - font-size: 80%; - font-style: italic; - } - -/* Teaser -================================================== */ - -header#teaser h1 { - text-transform: none !important; - color: #333; - font-size: 28px !important; - font-weight: 300 !important; -} - - -/* Links -================================================== */ -a { - text-decoration: none; - -webkit-transition: color .2s ease-in-out; - -moz-transition: color .2s ease-in-out; - transition: color .2s ease-in-out; -} - -/* Layout -================================================== */ -/* White container that is the "page" */ -.wrapper { - max-width: 1500px; - margin: 0 auto; - background: #fff; -} - -/* Containers to keep content to a set width */ -.nav, -.art-header-inner, -.footer, -.art-list, -.abt, -.fourohfour { - width: 980px; -} -.nav, -.art-body-inner, -.footer, -.art-list, -.abt, -.fourohfour { - position: relative; - margin: 0 auto; -} - -/* Nav -================================================== */ -.nav { - position: absolute; - top: 0; - left: 50%; - height: 70px; - padding-top: 40px; - margin-left: -490px; /* Half width of nav */ - border-bottom: 1px solid #333; - z-index: 2; -} -.nav.fixed { - position: fixed; -} -#logo { - float: left; -} -.nav-primary { - float: right; -} -.nav-primary li { - display: inline-block; - margin-left: 10px; - font-weight: 500; -} -#logo h1, -.nav-primary li, -.nav-primary li a { - font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; - font-weight: 700; - font-size: 13px; - line-height: 30px; - color: #000; - text-transform: uppercase; -} - -#logo h1 { - height: 30px; - margin-left: 0px; - letter-spacing: 1px; - font-family: 'Questrial', sans-serif; - font-size: 30px; -} - -#logo h1 span{ - color: #F40034 !important; -} - -.nav li:first-child { - margin-left: 0; /* Remove left margin from the first nav li */ -} - -/* Home Page -================================================== */ - -div#home {} - -#home > div.cover { - max-width: 980px; - margin: 0px auto; - /*padding-top: 110px;*/ -} - -div.cover { - -} - -div.cover > img { - width: 100%; - height: 100%; -} - - -/* Article -================================================== */ -.art { - margin-top: -131px; -} -/* Header */ -.art-header { - height: 900px; - /* Background image is defined in the post */ - background-position: top center; - background-attachment: fixed; - overflow: hidden; -} -/* Contains the time, title and subtitle for an article */ -.art-header-inner { - position: fixed; - top: 300px; - left: 50%; - margin-left: -490px; -} -.art-time, -.art-title, -.art-subtitle { - text-align: center; - text-transform: uppercase; -} -.art-time { - font-size: 14px; - line-height: 1.8; - letter-spacing: 4px; -} -.art-title { - font-size: 100px; - line-height: .9; - letter-spacing: -2px; - width: 100%; -} -.art-subtitle { - margin-top: 4px; - font-size: 14px; - line-height: 1.3; - letter-spacing: 4px; -} - -/* If small header, make few adjustments */ -.small .art-title { - font-size: 70px; - line-height: 65px; -} -.small.art-header-inner { - top: 320px; -} - -/* Body */ -.art-body { - position: relative; - width: 100%; - background: #fff; - z-index: 100; - -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); - -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); - box-shadow: 0 -3px 3px rgba(0,0,0,.2); -} -.art-body-inner { - font-family: Georgia,Cambria,"Times New Roman",Times,serif; - max-width: 640px; - padding: 80px 0 50px; - letter-spacing: 0.01rem; - font-weight: 400; - font-style: normal; - font-size: 21px; - line-height: 1.5; -} -.art-body-inner a:hover { - border-bottom: 1px solid #F40034; - padding-bottom:2px; -} -.art-body-inner ul, -.art-body-inner ol { /* For lists in the article body */ - margin-bottom: 26px; -} -.art-body-inner ul li { - list-style: disc; -} - -.art-body-inner mark { - background-color: #fdffb6; - padding: 2px; - -webkit-box-shadow: #fdffb6 0 0 5px; - -moz-box-shadow: #fdffb6 0 0 5px; - box-shadow: #fdffb6 0 0 5px; -} - -.art-body-inner blockquote { - font-size: 16px; - background: #f9f9f9; - border-left: 10px solid #ccc; - margin: 1.5em 10px; - padding: 0.5em 10px; - quotes: "\201C""\201D""\2018""\2019"; -} - -.art-body-inner blockquote p:first-child:before { - color: #ccc; - content: "“"; - font-size: 4em; - line-height: 0.1em; - margin-right: 0.25em; - vertical-align: -0.4em; -} - -.art-body-inner blockquote p { - margin-bottom: 1.5em; -} - -.art-body-inner blockquote p:last-child { - margin-bottom: 0; -} - - -.dropcap { /* First character on articles */ - float: left; - margin: 47px 10px 20px 0; - font-size: 100px; - line-height: 0; -} -.art-subhead { /* Subheads are used to break up sections of an article */ - margin: 60px 0 15px; - font-size: 20px; - line-height: 28px; - letter-spacing: 3px; -} -.callout { /* Callouts are like large pullquotes */ - font-weight: bold; -} -.art-body-inner img { - max-width: 100%; - max-height: 600px; - margin-bottom: 26px; -} -.art-body-inner img.center { - display: block; - margin-left: auto; - margin-right: auto; -} -.art-body-inner .art-reference { - font-size: 80%; - color: #999; - margin-top: 50px; -} - -/* For simple, white background posts */ -.simple .art-body { - background: none; - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; -} - - -/* List of Articles -================================================== */ -.art-list { - padding: 120px 0 0; -} -.art-list-body { - position: relative; - overflow: hidden; -} -.art-list-item { - padding: 40px 0; - list-style: none; - overflow: hidden; - border-bottom: 1px solid #ccc; -} -.art-list-item:last-child { - border-bottom: none; -} -.art-list-title { - font-size: 26px; - line-height: 26px; - font-weight: 700; -} -.art-list-item-title-and-time { - float: left; - width: 30%; - margin-bottom: 10px; -} -.art-list-time { - font-size: 12px; - line-height: 20px; - letter-spacing: 2px; - text-transform: uppercase; - color: #999; -} -.art-list-title a { - color: #000; -} -.art-list-title a:hover { - color: #F40034; -} -.art-list-item p { - width: 65%; - float: left; - margin-left: 5%; - margin-bottom: 0; - font-size: 16px; - line-height: 24px; -} - - -/* Footer -================================================== */ -.footer { - padding: 30px 0 40px; - overflow: hidden; - border-top: 1px solid #ccc; -} -.footer, -.footer a { - font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; - font-size: 13px; - text-transform: uppercase; - color: #777; -} -.footer a:hover { - color: #000; -} -.back-to-top, -.footer-nav, -.offsite-links { - width: 45%; - float: left; -} -.psi { - width:10%; - float:left; - text-align: center; -} -.footer-nav { - text-align: center; -} -.offsite-links { - text-align: right; -} -.footer .twitter-link:hover { - color: #0084B4; -} -.footer .instagram-link:hover { - color: #3F729B; -} -.footer .github-link:hover { - color: #c5376d; -} -.footer .caffein8-link:hover{ - color: black; -} -.footer .rss-link:hover { - color: #e85d24; -} -/* Remove prev & next links on loop */ -.art-list + .footer .footer-nav, -.abt + .footer .footer-nav { - text-indent: -9999px; - text-align: left; -} - - -/* White Reverse Theme -================================================== */ -/* Nav */ -.nav.white { - border-bottom-color: #fff; - border-bottom-color: rgba(255,255,255,.3); -} -.nav.white li a, -.nav.white li, -.nav.white #logo h1 { - color: #fff; - text-shadow: 0 0 8px rgba(0,0,0,.5); -} -.nav.white #logo h1 { - background-position: top center; -} - -nav.pagination{ - text-align: right; - padding-bottom: 25px; -} -/* Art header */ -.art-header.white { - background-color: #111; -} -.art-header.white .art-time, -.art-header.white .art-title, -.art-header.white .art-subtitle { - color: #fff; - text-shadow: 0 0 8px rgba(0,0,0,.5); -} - - -/* About page -================================================== */ -.abt { - padding: 200px 0 100px; - list-style: none; -} -.abt .abt-header { - font-size: 140px; - line-height: 1; - text-transform: none; -} -.abt .abt-subheader { - font-size: 24px; - font-style: italic; - text-transform: none; - color: #777; -} -.abt-body { - -moz-column-count: 2; - -moz-column-gap: 20px; - -webkit-column-count: 2; - -webkit-column-gap: 20px; - margin-bottom: 28px; -} -.abt-signoff { - line-height: 1.3; - font-style: italic; - color: #777; -} - -/* 404 page -================================================== */ -.fourohfour { - padding: 240px 0 100px; - text-align: center; -} - -/* Code -================================================== */ - -code, tt { -background: #ededee; -color: #3C4043; -font-size: 90%; -padding: 1px 3px; -} - -pre { - width: 92%; - overflow: auto; - margin: 2rem 0; - padding: 1rem 0.8rem 1rem 1.2rem; - color: #3f3b36; - border: 1px solid #ccc; - border-left: 1rem solid #ccc; - font: lighter 1.2rem/2rem monospace; - background: url(/assets/img/pre.png) repeat 0 -0.9rem; - background-size: 1px 4rem; -} - -pre code, tt { -font-size: inherit; -white-space: -moz-pre-wrap; -white-space: pre-wrap; -background: transparent; -border: none; -padding: 0; -} - - -.gist { - font-size: 14px; -} - - -/* Responsive -================================================== */ -@media only screen and (max-width: 1080px) { - /* Set all of the 980 containers to flexible width */ - .nav, - .art-body-inner, - .art-header-inner, - .footer, - .art-list, - .abt, - .fourohfour { - width: 90%; - } - .nav, - .art-header-inner { - margin-left: -45%; - } -} - -@media only screen and (max-width: 1024px) { - /* Everything becomes scrolling and non-fading */ - .nav, - .nav.fixed { - position: relative; - opacity: 1 !important; /* Important to override JS values */ - display: inline-block; - } - .art-header-inner { - position: relative; - top: 0 !important; /* Important to override JS values */ - margin-top: 240px !important; /* Important to override JS values */ - opacity: 1 !important; /* Important to override JS values */ - } - /* Articles no longer have fixed heights */ - .art-header { - height: auto; - padding-bottom: 100px; - background-size: cover !important; - background-attachment: scroll; - } - /* Remove bottom space out if articles doesn't have a background */ - .simple .art-header { - padding-bottom: 0; - } - .art-list { - padding-top: 0; - } - .abt { - padding: 40px 0; - } - .fourohfour { - padding: 80px 0 60px; - } -} - -@media only screen and (max-width: 780px) { - .art-body-inner ul, - .art-body-inner ol { - margin-left: 20px; - } - .art-title { - letter-spacing: 0; - } - .art-subtitle, - .art-time { - font-size: 12px; - } - .nav { - padding-top: 25px; - height: 55px; - } - .art-list-item-title-and-time, - .art-list-item p { - float: none; - width: auto; - margin-left: 0; - } - .abt-body { - -moz-column-count: 1; - -webkit-column-count: 1; - } -} - -@media only screen and (max-width: 500px) { - .nav-primary li { - margin-left: 10px; - } - .nav #logo h1 { - font-size: 16px; - letter-spacing: -1px; - } - .nav li a { - font-size: 12px; - } - .art-header { - padding-bottom: 50px; - } - .art-header-inner { - margin-top: 190px !important; - } - .art-body-inner { - padding-top: 30px; - } - body { - font-size: 15px; - line-height: 24px; - } - p { - margin-bottom: 24px; - } - .footer { - padding: 10px 0 20px; - } - .back-to-top, - .footer-nav { - width: 50%; - } - .back-to-top { - text-align: left; - } - .footer-nav { - text-align: right; - } - .offsite-links { - float: left; - width: 100%; - text-align: left; - } - .offsite-links a { - font-size: 12px; - } - .art-list + .footer .footer-nav { - display: none; - } - .abt .abt-header { - font-size: 80px; - } - .abt .abt-subheader { - font-size: 18px; - } -} - - -/* Misc -================================================== */ -::selection { - background: #000; - color: #fff; -} -::-moz-selection { - background: #000; - color: #fff; -} -img.left { - float: left; - margin-right: 20px; -} -img.right { - float: right; - margin-left: 20px; -} -/* Clearfixing pile */ -.nav:before, -.art-body-inner:before, -.footer:before, -.art-list:before { - content:""; - display:table; -} -.nav:after, -.art-body-inner:after, -.footer:after, -.art-list:after { - clear:both; -} -.nav, -.art-body-inner, -.footer, -.art-list { - zoom:1; /* For IE 6/7 (trigger hasLayout) */ -} - - -@-webkit-keyframes le-fade { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} -@-moz-keyframes le-fade { - 0% { - opacity: 0; - } - 100% { - opacity: 1; - } -} - -.art-header-inner { - -webkit-animation: le-fade .5s 0 1 ease-out; - -moz-animation: le-fade .5s 0 1 ease-out; -} - -.art-list, -.nav, -.abt, -.art-body { - -webkit-animation: le-fade .5s 0s 1 ease-out; - -moz-animation: le-fade .5s 0s 1 ease-out; -} - -hr.featured-article { - padding: 0; - border: none; - border-top: medium double #bbb; - color: #bbb; - text-align: center; -} -hr.featured-article:after { - content: "✭ Featured Article ✭"; - display: inline-block; - position: relative; - top: -0.8em; - font-size: 1.2em; - padding: 0 0.6em; - background: white; -} - -/* FORM */ - -#contact-area { - width: 600px; - margin-top: 25px; -} - -#contact-area input, #contact-area textarea { - padding: 5px; - width: 471px; - font-family: Helvetica, sans-serif; - margin: 0px 0px 10px 0px; - border: 2px solid #ccc; -} - -#contact-area textarea { - height: 90px; -} - -#contact-area textarea:focus, #contact-area input:focus, #contact-area select:focus { - border: 2px solid #900; -} - -#contact-area input.submit-button { - width: 100px; - -} - -#contact-area select { - width : 100px; - padding : 5px; - border: 2px solid #ccc; -} - -label { - float: left; - text-align: right; - margin-right: 15px; - width: 100px; - padding-top: 5px; -} - -.loginContainer { - height : 500px; -} - -.login{ - position : absolute; - top : calc(40% - 75px); - left : calc(50% - 50px); - height : 150px; - width : 350px; - padding : 10px; - z-index : 2; -} - -.login input[type=text]{ - width : 250px; - height : 30px; - background : #ffffff; - border : 1px solid rgba(62,62,62,0.6); - border-radius : 2px; - color : #000000; - font-family : 'Exo', sans-serif; - font-size : 16px; - font-weight : 400; - padding : 4px; -} - -.login input[type=password]{ - width : 250px; - height : 30px; - background : #ffffff; - border : 1px solid rgba(62,62,62,0.6); - border-radius : 2px; - color : #000000; - font-family : 'Exo', sans-serif; - font-size : 16px; - font-weight : 400; - padding : 4px; - margin-top : 10px; -} - -.login input[type=submit]{ - width : 260px; - height : 35px; - background : #3E3E33; - border : 1px solid #fff; - cursor : pointer; - border-radius : 2px; - color : #ffffff; - font-family : 'Exo', sans-serif; - font-size : 16px; - font-weight : 400; - padding : 6px; - margin-top : 10px; -} - -.login input[type=submit]:hover{ - opacity : 0.8; -} - -.login input[type=submit]:active{ - opacity : 0.6; -} - -.login input[type=text]:focus{ - outline : none; - border : 1px solid rgba(255,153,51,0.9); -} - -.login input[type=password]:focus{ - outline : none; - border : 1px solid rgba(255,153,51,0.9); -} - -.login input[type=submit]:focus{ - outline: none; -} - -.login input[type=checkbox] { - margin-left : 120px; -} - -.blogAbout{ - font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; - font-weight: 300; - font-size: 8px; - line-height: 30px; - color: #000; - position : absolute; - top : calc(38% - 35px); - left: calc(45% - 255px); - z-index : 2; -} - -.blogAbout div{ - float : left; - color : #3E3E33; - font-size : 35px; - font-weight : 200; -} - -.blogAbout div span{ - text-transform: uppercase; - color : #F40034; -} - -.blogAbout div div{ - font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; - font-size : 15px; - color : #3E3E33; -} - -.crudContaier { - height : 500px; -} - -.navManagement { - font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; - margin-left : 0px; - position : absolute; - top : calc(16%); - left: calc(13%); - z-index : 2; -} -.navManagement ul -{ - list-style-type : none; - margin : 0; - padding-left : 0; -} - -.navManagement li -{ - display : inline; - float : left; - padding : 8px; - padding-left : 20px; -} - -.navManagement a, -.navManagement a:focus, -.navManagement a:visited, -.navManagement a:hover, -.navManagement a:active { - color : #000000; - text-decoration : none; -} - -.navManagement a:hover { - color : #FF9933; -} - -.form { - margin-top : 200px; - margin-left : 300px; - margin-bottom : 40px; -} - -.userdata { - margin-bottom : 40px; -} \ No newline at end of file diff --git a/WebPage/delete_user.xhtml b/WebPage/delete_user.xhtml deleted file mode 100644 index ebf79b6a..00000000 --- a/WebPage/delete_user.xhtml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - - - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/index.xhtml b/WebPage/index.xhtml deleted file mode 100644 index 13143361..00000000 --- a/WebPage/index.xhtml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - -
    -
    - -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/login.xhtml b/WebPage/login.xhtml deleted file mode 100644 index 2ca5c3df..00000000 --- a/WebPage/login.xhtml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - -
    -
    -
    -
    Welcome
    ---Sang Penguasa Dunia---
    -
    - -
    -
    - - - -
    - - \ No newline at end of file diff --git a/WebPage/new_post.xhtml b/WebPage/new_post.xhtml deleted file mode 100644 index 9617b277..00000000 --- a/WebPage/new_post.xhtml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog | Tambah Post - - - - - -
    - - - -
    - - -

    -

    - -
    -
    -

    Tambah Post

    - -
    -
    - - - - - - -
    - - - -
    -
    -
    -
    - -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/new_user.xhtml b/WebPage/new_user.xhtml deleted file mode 100644 index 4fbb8bcd..00000000 --- a/WebPage/new_user.xhtml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - - - - -
    -
    -
    - - - - - - - -

    - - -
    -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/post.xhtml b/WebPage/post.xhtml deleted file mode 100644 index f2173e8a..00000000 --- a/WebPage/post.xhtml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog | Apa itu Simple Blog? - - - - - -
    - - - -
    - -
    -
    - -

    Apa itu Simple Blog?

    -

    -
    -
    - -
    -
    -
    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Blanditiis aliquam minus consequuntur amet nulla eius, neque beatae, nostrum possimus, officiis eaque consectetur. Sequi sunt maiores dolore, illum quidem eos explicabo! Lorem ipsum dolor sit amet, consectetur adipisicing elit. Magnam consequuntur consequatur molestiae saepe sed, incidunt sunt inventore minima voluptatum adipisci hic, est ipsa iste. Nobis, aperiam provident quae. Reprehenderit, iste.

    -

    Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores animi tenetur nam delectus eveniet iste non culpa laborum provident minima numquam excepturi rem commodi, officia accusamus eos voluptates obcaecati. Possimus?

    - -
    - -

    Komentar

    - -
    -
    - - - - - - -
    - - - -
    -
    - -
      -
    • -
      -

      Jems

      -
      2 menit lalu
      -
      -

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt!

      -
    • - -
    • -
      -

      Kave

      -
      1 jam lalu
      -
      -

      Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perferendis repudiandae quae natus quos alias eos repellendus a obcaecati cupiditate similique quibusdam, atque omnis illum, minus ex dolorem facilis tempora deserunt!

      -
    • -
    -
    -
    - -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/read_user.xhtml b/WebPage/read_user.xhtml deleted file mode 100644 index 8f82ad23..00000000 --- a/WebPage/read_user.xhtml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - - - -
    -
    -
    -
    - - -
    - -
    -
    -
    -
    -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/readme.md b/WebPage/readme.md deleted file mode 100644 index 5e7e48f5..00000000 --- a/WebPage/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# Simple Blog Java - -Tugas 2 IF3110. - -![Simple Blog](http://i655.photobucket.com/albums/uu275/sonnylazuardi/ss-5.jpg) - -## Deskripsi - -Gunakan template ini untuk membuat sebuah blog sederhana dengan menggunakan bahasa pemrograman PHP. - -## Spesifikasi - -Spesifikasi untuk Tugas II IF3110 dapat diakses pada pranala berikut: - -https://www.dropbox.com/sh/ig1hf108ad9fqxi/AAA2PMjPFICSFo3ypdrHl39La?dl=0 - -## Deliverable - -Tiap-tiap Kelompok Membuat Organizationnya masing-masing, dengan langkah: - -1. Klik tanda Tambah disamping username pada Github, Pilih Create New Organization - -2. Buat Organisasi dengan Nama : IF3110-II-Nomor_Kelompok . Nomor Kelompok dapat diakses [disini](https://docs.google.com/spreadsheets/d/1Y-FGJ_feIVYNRv-o0ycBXyfAiKMFXKA17cvw3Mhjd1A/edit?usp=sharing) - -3. Masukkan email address salah satu anggota untuk billing email ( bebas ). - -4. Undang anggota kelompok untuk menjadi anggota Organisasi. - -5. Lakukan Fork Repository ini ke Organisasi yang baru dibentuk - -6. Setelah selesai mengerjakan, lakukan Pull Request. - -## Lisensi - -© 2014 Asisten IF3110 - -Yogi | [Sonny](http://github.com/sonnylazuardi) | Fathan | Renusa | Kelvin | Yanuar - -Dosen: [Yudistira Dwi Wardhana](http://github.com/yudis) \ No newline at end of file diff --git a/WebPage/update_user.xhtml b/WebPage/update_user.xhtml deleted file mode 100644 index 8e7c5ad1..00000000 --- a/WebPage/update_user.xhtml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - - - - -
    -
    -
    - - - - - - - -

    - - -
    -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/WebPage/user_management.xhtml b/WebPage/user_management.xhtml deleted file mode 100644 index 96068372..00000000 --- a/WebPage/user_management.xhtml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
    - - - - - -
    -
    - - - -
    - - - \ No newline at end of file diff --git a/web/admin_edit_post.xhtml b/web/admin_edit_post.xhtml index b1a8ca2c..d11e2812 100644 --- a/web/admin_edit_post.xhtml +++ b/web/admin_edit_post.xhtml @@ -38,19 +38,20 @@
    diff --git a/WebPage/admin_edit_post.xhtml b/web/admin_list_post.xhtml similarity index 78% rename from WebPage/admin_edit_post.xhtml rename to web/admin_list_post.xhtml index b1a8ca2c..2c040d4b 100644 --- a/WebPage/admin_edit_post.xhtml +++ b/web/admin_list_post.xhtml @@ -38,19 +38,20 @@
    diff --git a/web/admin_new_post.xhtml b/web/admin_new_post.xhtml index dab61b62..47e74570 100644 --- a/web/admin_new_post.xhtml +++ b/web/admin_new_post.xhtml @@ -38,19 +38,20 @@
    diff --git a/WebPage/assets/css/button.css b/web/assets/css/button.css similarity index 100% rename from WebPage/assets/css/button.css rename to web/assets/css/button.css diff --git a/web/assets/css/screen.css b/web/assets/css/screen.css index cfdf186e..43949cab 100644 --- a/web/assets/css/screen.css +++ b/web/assets/css/screen.css @@ -106,15 +106,11 @@ header#teaser h1 { /* Links ================================================== */ a { - color: #F40034; text-decoration: none; -webkit-transition: color .2s ease-in-out; -moz-transition: color .2s ease-in-out; transition: color .2s ease-in-out; } -a:hover { - color: #F40034; -} /* Layout ================================================== */ @@ -843,7 +839,7 @@ hr.featured-article:after { height: 90px; } -#contact-area textarea:focus, #contact-area input:focus { +#contact-area textarea:focus, #contact-area input:focus, #contact-area select:focus { border: 2px solid #900; } @@ -852,6 +848,12 @@ hr.featured-article:after { } +#contact-area select { + width : 100px; + padding : 5px; + border: 2px solid #ccc; +} + label { float: left; text-align: right; @@ -970,4 +972,54 @@ label { font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; font-size : 15px; color : #3E3E33; +} + +.crudContaier { + height : 500px; +} + +.navManagement { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + margin-left : 0px; + position : absolute; + top : calc(16%); + left: calc(13%); + z-index : 2; +} +.navManagement ul +{ + list-style-type : none; + margin : 0; + padding-left : 0; +} + +.navManagement li +{ + display : inline; + float : left; + padding : 8px; + padding-left : 20px; +} + +.navManagement a, +.navManagement a:focus, +.navManagement a:visited, +.navManagement a:hover, +.navManagement a:active { + color : #000000; + text-decoration : none; +} + +.navManagement a:hover { + color : #FF9933; +} + +.form { + margin-top : 200px; + margin-left : 300px; + margin-bottom : 40px; +} + +.userdata { + margin-bottom : 40px; } \ No newline at end of file diff --git a/WebPage/assets/img/favicon.ico b/web/assets/img/favicon.ico similarity index 100% rename from WebPage/assets/img/favicon.ico rename to web/assets/img/favicon.ico diff --git a/WebPage/assets/img/pre.png b/web/assets/img/pre.png similarity index 100% rename from WebPage/assets/img/pre.png rename to web/assets/img/pre.png diff --git a/WebPage/assets/js/validate.js b/web/assets/js/validate.js similarity index 100% rename from WebPage/assets/js/validate.js rename to web/assets/js/validate.js diff --git a/web/delete_user.xhtml b/web/delete_user.xhtml index ebf79b6a..53523fc5 100644 --- a/web/delete_user.xhtml +++ b/web/delete_user.xhtml @@ -38,18 +38,19 @@
    diff --git a/web/index.xhtml b/web/index.xhtml index 8fecda6f..13143361 100644 --- a/web/index.xhtml +++ b/web/index.xhtml @@ -92,4 +92,4 @@
    - + \ No newline at end of file diff --git a/web/login.xhtml b/web/login.xhtml index 7ea2c7bb..2ca5c3df 100644 --- a/web/login.xhtml +++ b/web/login.xhtml @@ -1,9 +1,6 @@ - - - + + @@ -19,13 +16,14 @@ xmlns:h="http://xmlns.jcp.org/jsf/html"> - - - - - + + + + + + -
    Psi;
    - - - + + \ No newline at end of file diff --git a/web/new_user.xhtml b/web/new_user.xhtml index 4fbb8bcd..6b4c4e67 100644 --- a/web/new_user.xhtml +++ b/web/new_user.xhtml @@ -38,19 +38,20 @@
    diff --git a/web/post.xhtml b/web/post.xhtml index f2173e8a..7b3f01dd 100644 --- a/web/post.xhtml +++ b/web/post.xhtml @@ -39,7 +39,7 @@
    diff --git a/web/new_user.xhtml b/web/new_user.xhtml index 6b4c4e67..78cabf5e 100644 --- a/web/new_user.xhtml +++ b/web/new_user.xhtml @@ -52,6 +52,7 @@
  • Add Post
  • Edit Post
  • List Post
  • +
  • Log out
  • diff --git a/web/read_user.xhtml b/web/read_user.xhtml index a83efc66..4c3a58b7 100644 --- a/web/read_user.xhtml +++ b/web/read_user.xhtml @@ -51,6 +51,7 @@
  • Add Post
  • Edit Post
  • List Post
  • +
  • Log out
  • diff --git a/web/update_user.xhtml b/web/update_user.xhtml index 9ba4f294..30dfdbda 100644 --- a/web/update_user.xhtml +++ b/web/update_user.xhtml @@ -52,6 +52,7 @@
  • Add Post
  • Edit Post
  • List Post
  • +
  • Log out
  • diff --git a/web/user_management.xhtml b/web/user_management.xhtml index 54764c98..ec3f06db 100644 --- a/web/user_management.xhtml +++ b/web/user_management.xhtml @@ -51,6 +51,7 @@
  • Add Post
  • Edit Post
  • List Post
  • +
  • Log out
  • From 7c54c89003fa1413f6d0e156690aa55583100d63 Mon Sep 17 00:00:00 2001 From: melvinfonda Date: Sun, 23 Nov 2014 21:38:36 +0700 Subject: [PATCH 13/41] update log out --- web/editor_edit_post.xhtml | 1 + web/editor_home.xhtml | 1 + web/editor_list_post.xhtml | 1 + web/editor_new_post.xhtml | 1 + web/owner_home.xhtml | 1 + web/owner_list_post.xhtml | 1 + web/owner_new_post.xhtml | 1 + 7 files changed, 7 insertions(+) diff --git a/web/editor_edit_post.xhtml b/web/editor_edit_post.xhtml index b58588ea..59580248 100644 --- a/web/editor_edit_post.xhtml +++ b/web/editor_edit_post.xhtml @@ -48,6 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • +
  • Log out
  • diff --git a/web/editor_home.xhtml b/web/editor_home.xhtml index 65c1ca72..1d9a7f2c 100644 --- a/web/editor_home.xhtml +++ b/web/editor_home.xhtml @@ -48,6 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • +
  • Log out
  • diff --git a/web/editor_list_post.xhtml b/web/editor_list_post.xhtml index ab9ca4b9..954799ae 100644 --- a/web/editor_list_post.xhtml +++ b/web/editor_list_post.xhtml @@ -48,6 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • +
  • Log out
  • diff --git a/web/editor_new_post.xhtml b/web/editor_new_post.xhtml index 476adab5..6b547a3f 100644 --- a/web/editor_new_post.xhtml +++ b/web/editor_new_post.xhtml @@ -48,6 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • +
  • Log out
  • diff --git a/web/owner_home.xhtml b/web/owner_home.xhtml index f6b98a56..4e7d9fa3 100644 --- a/web/owner_home.xhtml +++ b/web/owner_home.xhtml @@ -47,6 +47,7 @@
  • Home
  • List Post
  • Add Post
  • +
  • Log out
  • diff --git a/web/owner_list_post.xhtml b/web/owner_list_post.xhtml index 26894f4b..641d7e84 100644 --- a/web/owner_list_post.xhtml +++ b/web/owner_list_post.xhtml @@ -48,6 +48,7 @@
  • Home
  • List Post
  • Add Post
  • +
  • Log out
  • diff --git a/web/owner_new_post.xhtml b/web/owner_new_post.xhtml index 3f7c5337..ce060ed9 100644 --- a/web/owner_new_post.xhtml +++ b/web/owner_new_post.xhtml @@ -47,6 +47,7 @@
  • Home
  • List Post
  • Add Post
  • +
  • Log out
  • From 883ea21edcd28e40dfe4fb7e1c3a47c5e57a7d25 Mon Sep 17 00:00:00 2001 From: melvinfonda Date: Mon, 24 Nov 2014 12:03:06 +0700 Subject: [PATCH 14/41] edit log out --- web/editor_edit_post.xhtml | 2 +- web/editor_home.xhtml | 2 +- web/editor_list_post.xhtml | 2 +- web/editor_new_post.xhtml | 2 +- web/owner_home.xhtml | 2 +- web/owner_list_post.xhtml | 2 +- web/owner_new_post.xhtml | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/web/editor_edit_post.xhtml b/web/editor_edit_post.xhtml index 59580248..cb1366c4 100644 --- a/web/editor_edit_post.xhtml +++ b/web/editor_edit_post.xhtml @@ -48,7 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • -
  • Log out
  • +
  • Log out
  • diff --git a/web/editor_home.xhtml b/web/editor_home.xhtml index 1d9a7f2c..73f6cce9 100644 --- a/web/editor_home.xhtml +++ b/web/editor_home.xhtml @@ -48,7 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • -
  • Log out
  • +
  • Log out
  • diff --git a/web/editor_list_post.xhtml b/web/editor_list_post.xhtml index 954799ae..6e50d959 100644 --- a/web/editor_list_post.xhtml +++ b/web/editor_list_post.xhtml @@ -48,7 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • -
  • Log out
  • +
  • Log out
  • diff --git a/web/editor_new_post.xhtml b/web/editor_new_post.xhtml index 6b547a3f..d2f44fe9 100644 --- a/web/editor_new_post.xhtml +++ b/web/editor_new_post.xhtml @@ -48,7 +48,7 @@
  • List Post
  • Add Post
  • Edit Post
  • -
  • Log out
  • +
  • Log out
  • diff --git a/web/owner_home.xhtml b/web/owner_home.xhtml index 4e7d9fa3..6c9a2639 100644 --- a/web/owner_home.xhtml +++ b/web/owner_home.xhtml @@ -47,7 +47,7 @@
  • Home
  • List Post
  • Add Post
  • -
  • Log out
  • +
  • Log out
  • diff --git a/web/owner_list_post.xhtml b/web/owner_list_post.xhtml index 641d7e84..296b4bd9 100644 --- a/web/owner_list_post.xhtml +++ b/web/owner_list_post.xhtml @@ -48,7 +48,7 @@
  • Home
  • List Post
  • Add Post
  • -
  • Log out
  • +
  • Log out
  • diff --git a/web/owner_new_post.xhtml b/web/owner_new_post.xhtml index ce060ed9..406c5561 100644 --- a/web/owner_new_post.xhtml +++ b/web/owner_new_post.xhtml @@ -47,7 +47,7 @@
  • Home
  • List Post
  • Add Post
  • -
  • Log out
  • +
  • Log out
  • From 1c5252ea6fbd1aae3c310b1ca55882c355860704 Mon Sep 17 00:00:00 2001 From: melvinfonda Date: Tue, 25 Nov 2014 11:08:06 +0700 Subject: [PATCH 15/41] post ditambahkan published dan deleted --- simple_blog.sql | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/simple_blog.sql b/simple_blog.sql index e5116b5e..5fef6e12 100644 --- a/simple_blog.sql +++ b/simple_blog.sql @@ -3,7 +3,7 @@ -- http://www.phpmyadmin.net -- -- Host: 127.0.0.1 --- Generation Time: Nov 23, 2014 at 09:26 AM +-- Generation Time: Nov 25, 2014 at 05:04 AM -- Server version: 5.6.16 -- PHP Version: 5.5.11 @@ -22,22 +22,6 @@ SET time_zone = "+00:00"; -- -------------------------------------------------------- --- --- Table structure for table `komentar` --- - -CREATE TABLE IF NOT EXISTS `komentar` ( - `Id_Komentar` int(10) NOT NULL AUTO_INCREMENT, - `Nama` varchar(40) NOT NULL, - `Tanggal` date NOT NULL, - `Komentar` text NOT NULL, - `Id_Post` int(10) NOT NULL, - `Id_User` int(10) NOT NULL, - PRIMARY KEY (`Id_Komentar`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - --- -------------------------------------------------------- - -- -- Table structure for table `post` -- @@ -48,23 +32,11 @@ CREATE TABLE IF NOT EXISTS `post` ( `Tanggal` date NOT NULL, `Konten` text NOT NULL, `Id_User` int(10) NOT NULL, + `Published` tinyint(1) NOT NULL DEFAULT '0', + `Deleted` tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (`Id_Post`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; --- -------------------------------------------------------- - --- --- Table structure for table `user` --- - -CREATE TABLE IF NOT EXISTS `user` ( - `Id_User` int(10) NOT NULL AUTO_INCREMENT, - `Username` varchar(40) NOT NULL, - `Password` varchar(20) NOT NULL, - `Role` varchar(10) NOT NULL, - PRIMARY KEY (`Id_User`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; - /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; From dcb14653df0b71c5633851848f5eba5e62aaac61 Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:14:45 +0700 Subject: [PATCH 16/41] JSF --- web/owner_new_post.xhtml | 44 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/web/owner_new_post.xhtml b/web/owner_new_post.xhtml index 3f7c5337..e72ea9e6 100644 --- a/web/owner_new_post.xhtml +++ b/web/owner_new_post.xhtml @@ -1,6 +1,8 @@ - - + + @@ -32,9 +34,9 @@ Simple Blog - + - +
    -
    -
    -
    - - - - - - -
    - - - -
    -
    -
    + + + + Judul: + + + Tanggal: + + + Konten:
    + + + +
    +
    +
    @@ -82,5 +84,5 @@ - + \ No newline at end of file From 52fec9ef9bd81ab0c4c944f63da5ef950435fd18 Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:18:49 +0700 Subject: [PATCH 17/41] JSF --- src/java/Database/DBConnectionDemo.java | 31 ++++++++++++++----------- src/java/Database/DatabaseAccess.java | 11 +++++++-- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/java/Database/DBConnectionDemo.java b/src/java/Database/DBConnectionDemo.java index ff3d5071..7268d0b3 100644 --- a/src/java/Database/DBConnectionDemo.java +++ b/src/java/Database/DBConnectionDemo.java @@ -1,9 +1,8 @@ package Database; -import java.sql.ResultSet; +import Model.Post; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Arrays; +import java.sql.Timestamp; public class DBConnectionDemo { @@ -12,7 +11,7 @@ public static void main(String args[]) { DatabaseAccess databaseAccess = DatabaseAccess.getInstance(); // Set konfigurasi - databaseAccess.setDatabase("EMP"); + databaseAccess.setDatabase("simple_blog"); databaseAccess.setUsername("root"); // secara default root databaseAccess.setPassword(""); // secara default string kosong @@ -29,14 +28,17 @@ public static void main(String args[]) { // Melakukan INSERT INTO Employee (id,age,first,last) VALUES // (200,21,'Kevin','Yudi // Utama'); - ArrayList columns = new ArrayList(Arrays.asList("id", "age", - "first", "last")); - ArrayList values = new ArrayList(Arrays.asList("200", "21", - "'Kevin'", "'Yudi'")); + Post p = new Post(); + p.setTitle("Post Testing"); + p.setText("Ini adalah post testing"); + p.setTimeString("2012-08-07"); + Timestamp ts = p.getTimestamp(); try { - databaseAccess.insertRecords("Employee", columns, values); + databaseAccess.executeUpdateQuery("INSERT INTO post (Judul,Id_User,Konten,Tanggal) VALUES" + + "('"+p.getTitle()+"',1,'"+p.getText()+"','"+ + p.getTimeString()+"');"); System.out.println("Berhasil memasukkan records"); - } catch (SQLException e1) { + } catch (Exception e1) { System.out.println("Gagal memasukkan records"); System.out.println("Error : " + e1); } @@ -47,7 +49,7 @@ public static void main(String args[]) { // Melakukan DELETE FROM Employee WHERE first='Kevin' AND last='Yudi'; // null jika tidak ada kondisi (menghapus seluruh records pada tabel); - String condition = "first='Kevin' AND last='Yudi'"; + /*String condition = "first='Kevin' AND last='Yudi'"; try { databaseAccess.deleteRecords("Employee", condition); @@ -63,8 +65,8 @@ public static void main(String args[]) { // -------------------UPDATE---------------------------- // melakukan UPDATE Employee SET first='Wira',last='Gotama' WHERE Id = // 103; - columns = new ArrayList(Arrays.asList("first", "last")); - values = new ArrayList(Arrays.asList("'Wira'", "'Gotama'")); + ArrayList columns = new ArrayList(Arrays.asList("first", "last")); + ArrayList values = new ArrayList(Arrays.asList("'Wira'", "'Gotama'")); condition = "Id = 103"; try { databaseAccess @@ -100,11 +102,12 @@ public static void main(String args[]) { } } catch (SQLException e1) { e1.printStackTrace(); - } + }*/ // Menutup koneksi try { databaseAccess.closeConnection(); + System.out.println("Berhasil menutup koneksi"); } catch (SQLException e) { e.printStackTrace(); } diff --git a/src/java/Database/DatabaseAccess.java b/src/java/Database/DatabaseAccess.java index 864ec2fb..dacfdf62 100644 --- a/src/java/Database/DatabaseAccess.java +++ b/src/java/Database/DatabaseAccess.java @@ -25,7 +25,7 @@ public class DatabaseAccess { private DatabaseAccess() { this.jdbcDriver = "com.mysql.jdbc.Driver"; - this.DB_URL = "jdbc:mysql://localhost/EMP"; + this.DB_URL = "jdbc:mysql://localhost/simple_blog"; this.USER = "root"; this.PASS = ""; @@ -88,6 +88,7 @@ public ResultSet executeFetchQuery(String query) { } public void executeUpdateQuery(String query) { + System.out.println(query); ResultSet resultSet = null; try { this.statement.executeUpdate(query); @@ -118,6 +119,7 @@ public void insertRecords(String tableName, ArrayList columns, } } query.append(";"); + System.out.println(query); this.statement.executeUpdate(query.toString()); } @@ -128,6 +130,7 @@ public void deleteRecords(String tableName, String condition) query += " WHERE " + condition; } query += ";"; + System.out.println(query); this.statement.executeUpdate(query); } @@ -169,7 +172,11 @@ public void updateRecords(String tableName, ArrayList column, query.append(","); } } - query.append(" WHERE " + condition); + if (condition!=null){ + query.append(" WHERE " + condition); + } + query.append(";"); + System.out.println(query); this.statement.executeUpdate(query.toString()); } } \ No newline at end of file From e7c61fedc9559231b5b75e2de6f83685e2d70cbe Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:24:01 +0700 Subject: [PATCH 18/41] JSF --- web/login.xhtml | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/web/login.xhtml b/web/login.xhtml index 2ca5c3df..e7cba6cf 100644 --- a/web/login.xhtml +++ b/web/login.xhtml @@ -1,6 +1,9 @@ - - + + + @@ -16,14 +19,13 @@ - - - - - + + + + + - +
    Psi;
    - - \ No newline at end of file + +
    + From 61f0c116e616ea29f606f36699c6f8153fe72644 Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:24:16 +0700 Subject: [PATCH 19/41] JSF --- src/java/Model/User.java | 49 ++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/java/Model/User.java b/src/java/Model/User.java index d491f9bf..7423b679 100644 --- a/src/java/Model/User.java +++ b/src/java/Model/User.java @@ -6,15 +6,25 @@ package Model; +import Database.DatabaseAccess; +import java.util.ArrayList; +import java.util.Arrays; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + /** * * @author user */ + +@ManagedBean +@SessionScoped public class User { private int id; private String username; private String pass; - private enum role {owner, editor, admin, guest}; + private enum Role {owner, editor, admin, guest}; + private Role role; public User () {} @@ -34,7 +44,7 @@ public void setUsername(String username){ this.username = username; } - public void setPass(String pass) { + public void setPassword(String pass) { this.pass = pass; } @@ -43,18 +53,37 @@ public int getId(){ return this.id; } - public int getUsername(){ - return this.id; + public String getUsername(){ + return username; } - public int getPass(){ - return this.id; + public String getPassword(){ + return this.pass; } - - - - + public void setRole(String newRole) { + if (newRole.equals("owner")) { + role = Role.owner; + } else if (newRole.equals("admin")) { + role = Role.admin; + } else if (newRole.equals("editor")) { + role = Role.editor; + } else { + role = Role.guest; + } + } + + public String getRole() { + if (role==Role.owner) { + return "owner"; + } else if (role==Role.admin) { + return "admin"; + } else if (role==Role.editor) { + return "editor"; + } else { + return "guest"; + } + } } From 538fefacf1438f31d45fc9abc6bc675a85221e11 Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:24:30 +0700 Subject: [PATCH 20/41] JSF --- web/update_user.xhtml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/web/update_user.xhtml b/web/update_user.xhtml index 9ba4f294..9c5d35ae 100644 --- a/web/update_user.xhtml +++ b/web/update_user.xhtml @@ -1,6 +1,8 @@ - - + + @@ -32,9 +34,9 @@ Simple Blog - + - +
    - +
    \ No newline at end of file From b1d5a46b0b1c33949e98ac12e7b16580e1751188 Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:24:43 +0700 Subject: [PATCH 21/41] JSF --- nbproject/project.properties | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nbproject/project.properties b/nbproject/project.properties index 653e1b07..7d6751e9 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -10,6 +10,7 @@ auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=JSP +auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=assets/js build.classes.dir=${build.web.dir}/WEB-INF/classes build.classes.excludes=**/*.java,**/*.form build.dir=build @@ -41,8 +42,13 @@ j2ee.compile.on.save=true j2ee.copy.static.files.on.save=true j2ee.deploy.on.save=true j2ee.platform=1.6-web -j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.1.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar -j2ee.server.type=Tomcat +j2ee.platform.classpath=${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv3ee6 jar.compress=false javac.classpath=\ ${libs.jsf20.classpath}:\ From e04007cda8ae8232e580cdd718766bee4299e88f Mon Sep 17 00:00:00 2001 From: kevinyu Date: Tue, 25 Nov 2014 16:24:52 +0700 Subject: [PATCH 22/41] JSF --- web/admin_edit_post.xhtml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/web/admin_edit_post.xhtml b/web/admin_edit_post.xhtml index d11e2812..3fd28cf5 100644 --- a/web/admin_edit_post.xhtml +++ b/web/admin_edit_post.xhtml @@ -1,5 +1,8 @@ - + @@ -54,10 +57,25 @@
  • List Post
  • - -
    - -
    + + + + + Judul: + + + Tanggal: + + + Konten:
    + + + + + +
    +
    +