-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml
new file mode 100644
index 00000000..2d5f8778
--- /dev/null
+++ b/nbproject/ant-deploy.xml
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
new file mode 100644
index 00000000..e33d86c6
--- /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/genfiles.properties b/nbproject/genfiles.properties
new file mode 100644
index 00000000..4e021ef0
--- /dev/null
+++ b/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=8f58f4b1
+build.xml.script.CRC32=fe1e176f
+build.xml.stylesheet.CRC32=651128d4@1.68.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=8f58f4b1
+nbproject/build-impl.xml.script.CRC32=c8cae566
+nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties
new file mode 100644
index 00000000..daba0851
--- /dev/null
+++ b/nbproject/private/private.properties
@@ -0,0 +1,10 @@
+deploy.ant.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\8.0.1\\config\\GlassFishEE6\\Properties\\gfv32114702505.properties
+j2ee.platform.is.jsr109=true
+j2ee.server.domain=C:/Users/HP/AppData/Roaming/NetBeans/8.0.1/config/GF_4.1/domain1
+j2ee.server.home=C:/Program Files/glassfish-4.1/glassfish
+j2ee.server.instance=[C:\\Program Files\\glassfish-4.1\\glassfish;C:\\Program Files\\glassfish-4.1\\glassfish\\domains\\domain1]deployer:gfv3ee6:localhost:4848
+j2ee.server.middleware=C:/Program Files/glassfish-4.1
+javac.debug=true
+javadoc.preview=true
+selected.browser=default
+user.properties.file=C:\\Users\\HP\\AppData\\Roaming\\NetBeans\\8.0.1\\build.properties
diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
new file mode 100644
index 00000000..46664b89
--- /dev/null
+++ b/nbproject/private/private.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/admin_page.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/post.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/user_management.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/deleted_post.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/add_post.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/index.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/edit_post.xhtml
+ file:/D:/kuliah/IF/Materi%20Semester%205/WBD/tugas%20II%20blog/simpleblog-nisa/web/publish_post.xhtml
+
+
+
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 00000000..862e8438
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,91 @@
+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-projectapi.jsf_2e_language=Facelets
+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.7-web
+j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.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.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.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.jar
+j2ee.platform.wsit.classpath=
+j2ee.server.type=gfv3ee6
+jar.compress=false
+javac.classpath=\
+ ${libs.jsf20.classpath}:\
+ ${libs.MySQLDriver.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.debug=true
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.7
+javac.target=1.7
+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=simpleblogII.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..6dd0d2d0
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,27 @@
+
+
+ org.netbeans.modules.web.project
+
+
+ simpleblogII
+ 1.6.5
+
+
+ ${libs.jsf20.classpath}
+ WEB-INF/lib
+
+
+ ${libs.MySQLDriver.classpath}
+ WEB-INF/lib
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/new_post.html b/new_post.html
deleted file mode 100644
index fc4e18ee..00000000
--- a/new_post.html
+++ /dev/null
@@ -1,111 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Simple Blog | Tambah Post
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Tambah Post
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/post.html b/post.html
deleted file mode 100644
index c0b6f9e6..00000000
--- a/post.html
+++ /dev/null
@@ -1,140 +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?
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! …
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! …
+
+
+
diff --git a/assets/css/screen.css b/simpleblog/build/web/assets/style.css
similarity index 99%
rename from assets/css/screen.css
rename to simpleblog/build/web/assets/style.css
index 1d8fdf3b..ba38c573 100644
--- a/assets/css/screen.css
+++ b/simpleblog/build/web/assets/style.css
@@ -122,7 +122,7 @@ a:hover {
.wrapper {
max-width: 1500px;
margin: 0 auto;
- background: #fff;
+ background: url(assets/img/green-splash.png);
}
/* Containers to keep content to a set width */
@@ -233,7 +233,7 @@ div.cover > img {
}
/* Contains the time, title and subtitle for an article */
.art-header-inner {
- position: fixed;
+ position: relative;
top: 300px;
left: 50%;
margin-left: -490px;
diff --git a/simpleblog/build/web/gfv3ee6.dpf b/simpleblog/build/web/gfv3ee6.dpf
new file mode 100644
index 00000000..e69de29b
diff --git a/simpleblog/build/web/index.xhtml b/simpleblog/build/web/index.xhtml
new file mode 100644
index 00000000..3999b5d5
--- /dev/null
+++ b/simpleblog/build/web/index.xhtml
@@ -0,0 +1,80 @@
+
+
+
+
+ Home - Simple blog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/simpleblog/build/web/post.xhtml b/simpleblog/build/web/post.xhtml
new file mode 100644
index 00000000..96966c6b
--- /dev/null
+++ b/simpleblog/build/web/post.xhtml
@@ -0,0 +1,117 @@
+
+
+
+
+
+ Apa itu Simple blog? - 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?
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!
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!
+
+
+
diff --git a/simpleblog/web/index.xhtml b/simpleblog/web/index.xhtml
new file mode 100644
index 00000000..3999b5d5
--- /dev/null
+++ b/simpleblog/web/index.xhtml
@@ -0,0 +1,80 @@
+
+
+
+
+ Home - Simple blog
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/simpleblog/web/post.xhtml b/simpleblog/web/post.xhtml
new file mode 100644
index 00000000..96966c6b
--- /dev/null
+++ b/simpleblog/web/post.xhtml
@@ -0,0 +1,117 @@
+
+
+
+
+
+ Apa itu Simple blog? - 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?
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!
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!
+
+
+
+
+
+
+
+
+
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/UserBeans/BlogPost.java b/src/java/UserBeans/BlogPost.java
new file mode 100644
index 00000000..94feec21
--- /dev/null
+++ b/src/java/UserBeans/BlogPost.java
@@ -0,0 +1,144 @@
+/*
+ * 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 UserBeans;
+
+import java.util.Date;
+
+
+/**
+ *
+ * @author Yusuf
+ */
+public class BlogPost {
+
+ private int pid;
+ private int uid;
+ private String username;
+ private String posttitle;
+ private String postcontent;
+ private String postdate;
+ private boolean ispublished;
+ private boolean isdeleted;
+
+ public BlogPost() {
+ pid = 0;
+ uid = 0;
+ posttitle = "";
+ postcontent = "";
+ username = "";
+ ispublished = false;
+ isdeleted = false;
+ Date date = new Date();
+ postdate = String.valueOf(date.getMonth()+1)+"/"+String.valueOf(date.getDate())+"/"+String.valueOf(date.getYear()+1900);
+ }
+
+ public void reset(){
+ pid = 0;
+ uid = 0;
+ posttitle = "";
+ postcontent = "";
+ username = "";
+ ispublished = false;
+ isdeleted = false;
+ Date date = new Date();
+ postdate = String.valueOf(date.getMonth()+1)+"/"+String.valueOf(date.getDate())+"/"+String.valueOf(date.getYear()+1900);
+ }
+
+ public int getPid() {
+ return pid;
+ }
+
+ public int getUid() {
+ return uid;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPosttitle() {
+ return posttitle;
+ }
+
+ public String getPostcontent() {
+ return postcontent;
+ }
+
+ public String getPostContentWithLimit(int limit) {
+ String content = postcontent;
+ if (content.length() > limit) {
+ content = postcontent.substring(0, limit);
+ }
+ return content;
+ }
+
+ public String getPostdate() {
+ return postdate;
+ }
+
+ public boolean getPublished() {
+ return ispublished;
+ }
+
+ public boolean getDeleted() {
+ return isdeleted;
+ }
+
+ public int publishedToInt(){
+ int ret = 0;
+ if(ispublished)
+ ret = 1;
+ return ret;
+ }
+
+ public int deletedToInt(){
+ int ret = 0;
+ if(isdeleted)
+ ret = 1;
+ return ret;
+ }
+
+ public void setPid(int Pid) {
+ pid = Pid;
+ }
+
+ public void setUid(int userID) {
+ uid = userID;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public void setPosttitle(String PostTitle) {
+ posttitle = PostTitle;
+ }
+
+ public void setPostcontent(String PostContent) {
+ postcontent = PostContent;
+ }
+
+ /**
+ *
+ * @param PostDate date format : mm/dd/yyyy
+ */
+ public void setPostdate(String PostDate) {
+ postdate = PostDate;
+ }
+
+
+ public void setPublished(boolean Published) {
+ ispublished = Published;
+ }
+
+
+
+ public void setDeleted(boolean Deleted) {
+ isdeleted = Deleted;
+ }
+
+
+}
diff --git a/src/java/UserBeans/Komentar.java b/src/java/UserBeans/Komentar.java
new file mode 100644
index 00000000..5440c360
--- /dev/null
+++ b/src/java/UserBeans/Komentar.java
@@ -0,0 +1,80 @@
+/*
+ * 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 UserBeans;
+
+import java.sql.Date;
+
+/**
+ *
+ * @author Yusuf
+ */
+public class Komentar {
+
+ private int cid;
+ private int pid;
+ private String komentator;
+ private String komen;
+ private String email;
+ private String commentDate;
+
+ public Komentar() {
+ cid=0;
+ pid=0;
+ komentator="guest";
+ komen="";
+ email="";
+ java.util.Date date = new java.util.Date();
+ commentDate = String.valueOf(date.getYear()+1900)+"-"+String.valueOf(date.getMonth()+1)+"-"+String.valueOf(date.getDate());
+ }
+
+ public int getCid() {
+ return cid;
+ }
+
+ public void setCid(int commentID) {
+ cid = commentID;
+ }
+
+ public int getPid() {
+ return pid;
+ }
+
+ public void setPid(int postID) {
+ pid = postID;
+ }
+
+ public String getKomentator() {
+ return komentator;
+ }
+
+ public void setKomentator(String komentator) {
+ this.komentator = komentator;
+ }
+
+ public String getKomen() {
+ return komen;
+ }
+
+ public void setKomen(String Komen) {
+ komen = Komen;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String Email) {
+ email = Email;
+ }
+
+ public String getCommentDate() {
+ return commentDate;
+ }
+
+ public void setCommentDate(String CommentDate) {
+ commentDate = CommentDate;
+ }
+}
diff --git a/src/java/UserBeans/MainUserData.java b/src/java/UserBeans/MainUserData.java
new file mode 100644
index 00000000..bc0a00d3
--- /dev/null
+++ b/src/java/UserBeans/MainUserData.java
@@ -0,0 +1,39 @@
+/*
+ * 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 UserBeans;
+
+
+import java.util.ArrayList;
+
+/**
+ *
+ * @author Yusuf
+ */
+public class MainUserData {
+ public static void main(String[] args){
+ /*
+ UserData ud = new UserData();
+ User user = ud.getUser("ucup");
+ System.out.println("nama : "+user.getFullname());
+ System.out.println("user : "+user.getUsername());
+ System.out.println("password : "+user.getPassword());
+ */
+
+ /*
+ userMgnt um = new userMgnt();
+ BlogPost post = new BlogPost();
+ post.setPostcontent("lalala2");
+ post.setPosttitle("dadada2");
+ post.setPostdate("12/01/2014");
+ post.setUid(2);
+ um.setPost(post);
+ um.submitPost();
+ */
+
+ userMgnt um = new userMgnt();
+ um.publishPost(9);
+ }
+}
diff --git a/src/java/UserBeans/User.java b/src/java/UserBeans/User.java
new file mode 100644
index 00000000..cae5046f
--- /dev/null
+++ b/src/java/UserBeans/User.java
@@ -0,0 +1,77 @@
+/*
+ * 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 UserBeans;
+
+/**
+ *
+ * @author Yusuf
+ */
+public class User {
+
+ private int uid;
+ private String fullname;
+ private String username;
+ private String password;
+ private String role;
+ private String email;
+
+ public User() {
+ uid = 0;
+ username = "guest";
+ password = "pass";
+ role = "guest";
+ email = "";
+ fullname = "guest";
+ }
+
+ public int getUid() {
+ return uid;
+ }
+
+ public String getUsername() {
+ return username;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public String getFullname(){
+ return fullname;
+ }
+
+ public void setFullname(String fullName){
+ this.fullname = fullName;
+ }
+
+ public void setUid(int uid) {
+ this.uid = uid;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+
+ public void setEmail(String email){
+ this.email = email;
+ }
+}
diff --git a/src/java/UserBeans/UserData.java b/src/java/UserBeans/UserData.java
new file mode 100644
index 00000000..b3143d1b
--- /dev/null
+++ b/src/java/UserBeans/UserData.java
@@ -0,0 +1,447 @@
+/*;;
+
+
+ * 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 UserBeans;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.Statement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author Yusuf
+ */
+public class UserData {
+
+ public UserData(){
+ }
+
+ public User getUser(int uid) {
+ User user = null;
+ Connection con = getConnection();
+ String sql = "SELECT * FROM user WHERE uid=" + uid;
+ try {
+ Statement pst = con.createStatement();
+ ResultSet rs = pst.executeQuery(sql);
+ con.close();
+ user = new User();
+ while (rs.next()) {
+ user.setUid(rs.getInt("uid"));
+ user.setFullname(rs.getString("fullname"));
+ user.setUsername(rs.getString("username"));
+ user.setPassword(rs.getString("password"));
+ user.setRole(rs.getString("role"));
+ user.setEmail(rs.getString("email"));
+ }
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return user;
+ }
+
+ public User getUser(String username) {
+ User user = null;
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT * FROM user WHERE username='" + username + "'";
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ user = new User();
+ while (rs.next()) {
+ user.setUid(rs.getInt("uid"));
+ user.setFullname(rs.getString("fullname"));
+ user.setUsername(rs.getString("username"));
+ user.setPassword(rs.getString("password"));
+ user.setRole(rs.getString("role"));
+ user.setEmail(rs.getString("email"));
+ }
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return user;
+ }
+
+ public ArrayList getListUser(){
+ ArrayList records = new ArrayList();
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT * FROM user";
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ while (rs.next()) {
+ User user = new User();
+ user.setEmail(rs.getString("email"));
+ user.setFullname(rs.getString("fullname"));
+ user.setPassword(rs.getString("password"));
+ user.setRole(rs.getString("role"));
+ user.setUid(rs.getInt("uid"));
+ user.setUsername(rs.getString("username"));
+ records.add(user);
+ }
+ con.close();
+ } catch (SQLException ex) {
+ String exex = ex.getMessage();
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return records;
+ }
+
+ public void writeKomentar(Komentar komentar) {
+ ResultSet rs = null;
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "INSERT INTO `blogjava`.`komentar` (`cid`, `pid`, `komentator`, `komen`, `email`, `commentdate`) VALUES (NULL, " + "'" + komentar.getPid()
+ + "', '" + komentar.getKomentator() + "', '"
+ + komentar.getKomen() + "', '"
+ + komentar.getEmail() + "', '"
+ + komentar.getCommentDate() + "')";
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ String exex = ex.getMessage();
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void writeKomentar(int Pid, String komentator,
+ String komen, String email, Date commentDate) {
+ ResultSet rs = null;
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "INSERT INTO komentar VALUES (NULL, " + "'" + Pid
+ + "', '" + komentator + "', '"
+ + komen + "', '"
+ + email + "', '"
+ + commentDate + "')";
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ String exe = ex.getMessage();
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public Komentar getKomentar(int cid) {
+ Komentar komentar = null;
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT * FROM komentar WHERE cid=" + cid;
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+ con.close();
+
+ komentar = new Komentar();
+ while (rs.next()) {
+ komentar.setCid(rs.getInt("cid"));
+ komentar.setPid(rs.getInt("pid"));
+ komentar.setKomentator(rs.getString("komentator"));
+ komentar.setKomen(rs.getString("komen"));
+ komentar.setEmail(rs.getString("email"));
+ komentar.setCommentDate(rs.getString("commentdate"));
+ }
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return komentar;
+ }
+
+ public ArrayList getListKomentar(int pid) {
+ ArrayList records = new ArrayList();
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT * FROM komentar WHERE pid=" + pid+" ORDER BY cid ASC";
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ while (rs.next()) {
+ Komentar komentar = new Komentar();
+ komentar.setCid(rs.getInt("cid"));
+ komentar.setPid(rs.getInt("pid"));
+ komentar.setKomentator(rs.getString("komentator"));
+ komentar.setKomen(rs.getString("komen"));
+ komentar.setEmail(rs.getString("email"));
+ komentar.setCommentDate(rs.getString("commentdate"));
+ records.add(komentar);
+ }
+ con.close();
+ } catch (SQLException ex) {
+ String exex = ex.getMessage();
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return records;
+ }
+
+ public void writeBlogPost(BlogPost blogPost) {
+
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "INSERT INTO blogpost VALUES (NULL, '"+ blogPost.getUid()
+ + "', '" + blogPost.getPosttitle()
+ + "', '" + blogPost.getPostcontent() + "', '"
+ + blogPost.getPostdate() + "', '"
+ + blogPost.publishedToInt() + "', '"
+ + blogPost.deletedToInt() + "')";
+
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public BlogPost getBlogPost(int pid) {
+ BlogPost blogPost = null;
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ //String sql = "select * from blogpost where pid=1";
+ String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND blogpost.pid=" + pid;
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ blogPost = new BlogPost();
+ rs.first();
+ blogPost.setUsername(rs.getString("fullname"));
+ blogPost.setPid(rs.getInt("pid"));
+ blogPost.setUid(rs.getInt("uid"));
+ blogPost.setPosttitle(rs.getString("posttitle"));
+ blogPost.setPostcontent(rs.getString("postcontent"));
+ blogPost.setPostdate(rs.getString("postdate"));
+ blogPost.setPublished(rs.getBoolean("published"));
+ blogPost.setDeleted(rs.getBoolean("deleted"));
+ con.close();
+ } catch (SQLException ex) {
+ String logg = ex.getMessage();
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return blogPost;
+ }
+
+ public ArrayList getAllBlogPost() {
+ ArrayList records = new ArrayList();
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND published=1 ORDER BY blogpost.postdate DESC";
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ while (rs.next()) {
+ BlogPost blogPost = new BlogPost();
+ blogPost.setPid(rs.getInt("pid"));
+ blogPost.setUid(rs.getInt("uid"));
+ blogPost.setUsername(rs.getString("fullname"));
+ blogPost.setPosttitle(rs.getString("posttitle"));
+ blogPost.setPostcontent(rs.getString("postcontent"));
+ blogPost.setPostdate(rs.getDate("postdate").toString());
+ blogPost.setPublished(rs.getBoolean("published"));
+ blogPost.setDeleted(rs.getBoolean("deleted"));
+ records.add(blogPost);
+ }
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return records;
+ }
+
+ public ArrayList getAllUnpublishedBlogPost(){
+ ArrayList records = new ArrayList();
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND published=0 ORDER BY blogpost.postdate DESC";
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ while (rs.next()) {
+ BlogPost blogPost = new BlogPost();
+ blogPost.setPid(rs.getInt("pid"));
+ blogPost.setUid(rs.getInt("uid"));
+ blogPost.setUsername(rs.getString("fullname"));
+ blogPost.setPosttitle(rs.getString("posttitle"));
+ blogPost.setPostcontent(rs.getString("postcontent"));
+ blogPost.setPostdate(rs.getDate("postdate").toString());
+ blogPost.setPublished(rs.getBoolean("published"));
+ blogPost.setDeleted(rs.getBoolean("deleted"));
+ records.add(blogPost);
+ }
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return records;
+ }
+
+ public ArrayList getDeletedPosts(){
+ ArrayList records = new ArrayList();
+ ResultSet rs = null;
+ Statement pst = null;
+ Connection con = getConnection();
+ String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND deleted=1 ORDER BY blogpost.postdate DESC";
+ try {
+ pst = con.createStatement();
+ rs = pst.executeQuery(sql);
+
+ while (rs.next()) {
+ BlogPost blogPost = new BlogPost();
+ blogPost.setPid(rs.getInt("pid"));
+ blogPost.setUid(rs.getInt("uid"));
+ blogPost.setUsername(rs.getString("fullname"));
+ blogPost.setPosttitle(rs.getString("posttitle"));
+ blogPost.setPostcontent(rs.getString("postcontent"));
+ blogPost.setPostdate(rs.getDate("postdate").toString());
+ blogPost.setPublished(rs.getBoolean("published"));
+ blogPost.setDeleted(rs.getBoolean("deleted"));
+ records.add(blogPost);
+ }
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ return records;
+ }
+
+ public Connection getConnection() {
+ Connection con = null;
+ String url = "jdbc:mysql://localhost:3306/blogjava";
+ String user = "root";
+ String password = "";
+
+ try {
+ Class.forName("com.mysql.jdbc.Driver");
+ } catch (ClassNotFoundException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+
+ try {
+ con = DriverManager.getConnection(url, user, password);
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ } finally {
+ }
+
+ return con;
+ }
+
+ public void publishPost(int pid){
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "UPDATE blogpost SET published = 1 WHERE pid=" + pid;
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void deletePost(int pid){
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "DELETE FROM blogpost WHERE pid=" + pid;
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void softDeletePost(int pid){
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "UPDATE blogpost SET deleted = 1, published = 0 WHERE pid=" + pid;
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void updateUserDB(User updUser){
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "UPDATE user SET fullname='"+updUser.getFullname()
+ +"', username='"+updUser.getUsername()
+ +"', password='"+updUser.getPassword()
+ +"', role='"+updUser.getRole()
+ +"', email='"+updUser.getEmail()
+ +"' WHERE uid="+updUser.getUid();
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void createUserDB(User newUser){
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "INSERT INTO user VALUES (NULL, '"
+ +newUser.getFullname()
+ +"', '"+newUser.getUsername()
+ +"', '"+newUser.getPassword()
+ +"', '"+newUser.getRole()
+ +"', '"+newUser.getEmail()
+ +"')";
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+ public void restorePost(int pid){
+ PreparedStatement pst = null;
+ Connection con = getConnection();
+ String sql = "UPDATE blogpost SET deleted = 0, published = 1 WHERE pid=" + pid;
+ try {
+ pst = con.prepareStatement(sql);
+ pst.execute();
+ con.close();
+ } catch (SQLException ex) {
+ Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }
+
+}
diff --git a/src/java/UserBeans/editPost.java b/src/java/UserBeans/editPost.java
new file mode 100644
index 00000000..77342e70
--- /dev/null
+++ b/src/java/UserBeans/editPost.java
@@ -0,0 +1,59 @@
+/*
+ * 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 UserBeans;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+/**
+ *
+ * @author Yusuf
+ */
+@ManagedBean(name = "edit", eager = true)
+@SessionScoped
+public class editPost {
+
+
+ private int pid;
+ private BlogPost post;
+
+ /**
+ * Creates a new instance of editPost
+ */
+ public editPost() {
+ post = new BlogPost();
+ pid = 0;
+ }
+
+ public String initiate(int ppid){
+ UserData ud = new UserData();
+ pid = ppid;
+ post = ud.getBlogPost(ppid);
+ BlogPost dummy = ud.getBlogPost(ppid);
+ return "faces/edit_post.xhtml";
+ }
+
+ public BlogPost getPost(){
+ return post;
+ }
+
+ public void setPost(BlogPost post){
+ this.post.setDeleted(post.getDeleted());
+ this.post.setPid(post.getPid());
+ this.post.setPostcontent(post.getPostcontent());
+ this.post.setPostdate(post.getPostdate());
+ this.post.setPosttitle(post.getPosttitle());
+ this.post.setPublished(post.getPublished());
+ this.post.setUid(post.getUid());
+ this.post.setUsername(post.getUsername());
+ }
+
+ public String submitPost(){
+ UserData ud = new UserData();
+ ud.writeBlogPost(post);
+ return "faces/index.xhtml";
+ }
+}
diff --git a/src/java/UserBeans/userMgnt.java b/src/java/UserBeans/userMgnt.java
new file mode 100644
index 00000000..e4734f23
--- /dev/null
+++ b/src/java/UserBeans/userMgnt.java
@@ -0,0 +1,300 @@
+package UserBeans;
+
+/*
+ * 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.
+ */
+import java.io.Serializable;
+import java.util.ArrayList;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.faces.context.FacesContext;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ *
+ * @author user
+ */
+@ManagedBean(name = "beans", eager = true)
+@SessionScoped
+public class userMgnt implements Serializable {
+
+ /**
+ * Creates a new instance of userMgnt
+ */
+ private String Message;
+ private Cookie cookie;
+ private User user;
+ private User newUser;
+ private BlogPost post;
+ private BlogPost lihatpost;
+ private ArrayList allPosts;
+ private ArrayList unpublishedPosts;
+ private ArrayList comments;
+ private Komentar komen;
+ private int pid;
+ private ArrayList users;
+ private ArrayList deletedPosts;
+
+ public userMgnt() {
+ user = new User();
+ post = new BlogPost();
+ Message = "tidak ada";
+ cookie = new Cookie("Username", null);
+ cookie.setMaxAge(120);
+ post = new BlogPost();
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ String passedParam = (String) facesContext.getExternalContext().getRequestParameterMap().get("pid");
+ if(passedParam != null)
+ pid = Integer.parseInt(passedParam);
+
+ komen = new Komentar();
+ newUser = new User();
+ }
+
+ public void login() {
+ UserData ud = new UserData();
+ User userValidator = ud.getUser(user.getUsername());
+ if (userValidator != null) {
+ if (user.getPassword().compareTo(userValidator.getPassword()) == 0) {
+ user.setUid(userValidator.getUid());
+ user.setFullname(userValidator.getFullname());
+ user.setRole(userValidator.getRole());
+ user.setEmail(userValidator.getEmail());
+ cookie.setValue(user.getUsername());
+ FacesContext facesContex = FacesContext.getCurrentInstance();
+ HttpServletResponse response = (HttpServletResponse) facesContex.getExternalContext().getResponse();
+ response.addCookie(cookie);
+
+ komen.setEmail(userValidator.getEmail());
+ komen.setKomentator(userValidator.getFullname());
+ } else {
+ Message = "Password is wrong";
+ }
+ } else {
+ Message = "Username not found";
+ }
+ }
+
+ public String Logout() {
+ reset();
+ Message = "tidak ada";
+ cookie.setValue(null);
+ cookie.setMaxAge(0);
+ FacesContext facesContex = FacesContext.getCurrentInstance();
+ HttpServletResponse response = (HttpServletResponse) facesContex.getExternalContext().getResponse();
+ response.addCookie(cookie);
+ return "faces/index.xhtml";
+ }
+
+ public void reset() {
+ user.setFullname("guest");
+ user.setUsername("guest");
+ user.setPassword("pass");
+ user.setEmail("");
+ user.setRole("guest");
+ user.setUid(0);
+ }
+
+ public boolean isLogin() {
+ return user.getUsername().compareTo("guest") != 0 && cookie.getValue() != null;
+ }
+
+ public boolean isAdmin(){
+ return user.getRole().compareTo("admin")==0;
+ }
+
+ public boolean isOwner(){
+ return user.getRole().compareTo("owner")==0;
+ }
+
+ public boolean isEditor(){
+ return user.getRole().compareTo("editor")==0;
+ }
+
+ public boolean activeMessage() {
+ return !Message.equals("tidak ada") && !isLogin();
+ }
+
+ public void submitPost(){
+ UserData ud = new UserData();
+ post.setUid(user.getUid());
+ post.setUsername(user.getFullname());
+ ud.writeBlogPost(post);
+ post.reset();
+ }
+
+ public void publishPost(int pid){
+ UserData ud = new UserData();
+ ud.publishPost(pid);
+ }
+
+ public void softDeletePost(int ppid){
+ UserData ud = new UserData();
+ ud.softDeletePost(ppid);
+ }
+
+ public void deletedPost(int ppid){
+ UserData ud = new UserData();
+ ud.deletePost(ppid);
+ }
+
+ public void writeComment(){
+ UserData ud = new UserData();
+ komen.setPid(post.getPid());
+ ud.writeKomentar(komen);
+ }
+
+ public ArrayList getComments(){
+ UserData ud = new UserData();
+ comments = ud.getListKomentar(post.getPid());
+ return comments;
+ }
+
+ public Komentar getKomen(){
+ return komen;
+ }
+
+ public void setKomen(Komentar komen){
+ this.komen.setCid(komen.getCid());
+ this.komen.setCommentDate(komen.getCommentDate());
+ this.komen.setEmail(komen.getEmail());
+ this.komen.setKomen(komen.getKomen());
+ this.komen.setKomentator(komen.getKomentator());
+ this.komen.setPid(komen.getPid());
+ }
+
+ public ArrayList getUnpublishedPosts(){
+ UserData ud = new UserData();
+ return ud.getAllUnpublishedBlogPost();
+ }
+
+ public void setUnpublishedPosts(ArrayList unpublishedPostSet){
+ unpublishedPosts.clear();
+ for (BlogPost unpublishedPostSet1 : unpublishedPostSet) {
+ unpublishedPosts.add(unpublishedPostSet1);
+ }
+ }
+
+ public User getUser() {
+ return this.user;
+ }
+
+ public void setUser(User newUser) {
+ user.setEmail(newUser.getEmail());
+ user.setFullname(newUser.getFullname());
+ user.setPassword(newUser.getPassword());
+ user.setRole(newUser.getRole());
+ user.setUid(newUser.getUid());
+ user.setUsername(newUser.getUsername());
+ }
+
+ public ArrayList getAllPosts() {
+ UserData ud = new UserData();
+ return ud.getAllBlogPost();
+ }
+
+ public void setAllPosts(ArrayList postSet) {
+ allPosts.clear();
+ for (BlogPost postSet1 : postSet) {
+ allPosts.add(postSet1);
+ }
+ }
+
+ public BlogPost getPost(){
+ return post;
+ }
+
+ public void setPost(BlogPost post){
+ this.post.setPid(post.getPid());
+ this.post.setUid(post.getUid());
+ this.post.setUsername(post.getUsername());
+ this.post.setPosttitle(post.getPosttitle());
+ this.post.setPostcontent(post.getPostcontent());
+ this.post.setPostdate(post.getPostdate());
+ this.post.setPublished(post.getPublished());
+ this.post.setDeleted(post.getDeleted());
+ }
+
+ public String getMessage() {
+ return Message;
+ }
+
+ public ArrayList getUsers(){
+ UserData ud = new UserData();
+ users = ud.getListUser();
+ return users;
+ }
+
+ public void setMessage(String S) {
+ Message = S;
+ }
+
+ public Cookie getCookie() {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+
+ HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
+ Cookie cook = null;
+
+ Cookie[] userCookies = request.getCookies();
+ if (userCookies != null && userCookies.length > 0) {
+ for (int i = 0; i < userCookies.length; i++) {
+ if (userCookies[i].getName().equals("Username")) {
+ cook = userCookies[i];
+ return cook;
+ }
+ }
+ }
+ return null;
+ }
+
+ public String genEditLink(int editPid){
+ return "faces/edit_post.xhtml?pid="+editPid;
+ }
+
+ public String genPostLink(int ppid){
+ UserData ud = new UserData();
+ lihatpost = ud.getBlogPost(ppid);
+ return "faces/post.xhtml";
+ }
+
+ public String updateUserOption(int usersIndex){
+ if(users.size() >= usersIndex){
+ UserData ud = new UserData();
+ ud.updateUserDB(users.get(usersIndex));
+ return "alert('update berhasil');";
+ }
+ return "alert('update gagal');";
+ }
+
+ public ArrayList getDeletedPosts(){
+ UserData ud = new UserData();
+ return ud.getDeletedPosts();
+ }
+
+ public void restoreDeletedPost(int delPid){
+ UserData ud = new UserData();
+ ud.restorePost(delPid);
+ }
+
+ public String genAddPostLink(){
+ post.reset();
+ return "faces/add_post.xhtml";
+ }
+
+ public User getNewUser(){
+ return newUser;
+ }
+
+ public void createNewUser(){
+ UserData ud = new UserData();
+ ud.createUserDB(newUser);
+ }
+
+ public BlogPost getLihatpost(){
+ return lihatpost;
+ }
+}
diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml
new file mode 100644
index 00000000..bc17358c
--- /dev/null
+++ b/web/META-INF/context.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar b/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar
new file mode 100644
index 00000000..1f904143
Binary files /dev/null and b/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar differ
diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml
new file mode 100644
index 00000000..c5e7c738
--- /dev/null
+++ b/web/WEB-INF/web.xml
@@ -0,0 +1,24 @@
+
+
+
+ javax.faces.PROJECT_STAGE
+ Development
+
+
+ Faces Servlet
+ javax.faces.webapp.FacesServlet
+ 1
+
+
+ Faces Servlet
+ /faces/*
+
+
+
+ 30
+
+
+
+ faces/index.xhtml
+
+
diff --git a/web/add_post.xhtml b/web/add_post.xhtml
new file mode 100644
index 00000000..5d5a814e
--- /dev/null
+++ b/web/add_post.xhtml
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+ New Post- Simple blog
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
Tambah Post
+
+
+ Judul:
+
+ Tanggal:
+
+ Konten:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/admin_page.xhtml b/web/admin_page.xhtml
new file mode 100644
index 00000000..03d1ef54
--- /dev/null
+++ b/web/admin_page.xhtml
@@ -0,0 +1,88 @@
+
+
+
+
+ Home - Simple blog
+
+
+
+
+