From 69a2349785ed11b1cbba637a9d0ffa3a7597e833 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 21:37:17 +0700 Subject: [PATCH 01/30] Add Netbeans project --- .gitignore | 1 + SimpleBlog/build.xml | 71 ++ SimpleBlog/nbproject/ant-deploy.xml | 111 ++ SimpleBlog/nbproject/build-impl.xml | 1444 ++++++++++++++++++++++ SimpleBlog/nbproject/genfiles.properties | 8 + SimpleBlog/nbproject/project.properties | 91 ++ SimpleBlog/nbproject/project.xml | 23 + SimpleBlog/src/conf/MANIFEST.MF | 2 + SimpleBlog/web/WEB-INF/web.xml | 24 + SimpleBlog/web/index.xhtml | 14 + SimpleBlog/web/welcomePrimefaces.xhtml | 51 + 11 files changed, 1840 insertions(+) create mode 100644 .gitignore create mode 100644 SimpleBlog/build.xml create mode 100644 SimpleBlog/nbproject/ant-deploy.xml create mode 100644 SimpleBlog/nbproject/build-impl.xml create mode 100644 SimpleBlog/nbproject/genfiles.properties create mode 100644 SimpleBlog/nbproject/project.properties create mode 100644 SimpleBlog/nbproject/project.xml create mode 100644 SimpleBlog/src/conf/MANIFEST.MF create mode 100644 SimpleBlog/web/WEB-INF/web.xml create mode 100644 SimpleBlog/web/index.xhtml create mode 100644 SimpleBlog/web/welcomePrimefaces.xhtml diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..d32a7920 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/SimpleBlog/nbproject/private/ \ No newline at end of file diff --git a/SimpleBlog/build.xml b/SimpleBlog/build.xml new file mode 100644 index 00000000..b949aae0 --- /dev/null +++ b/SimpleBlog/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project SimpleBlog. + + + diff --git a/SimpleBlog/nbproject/ant-deploy.xml b/SimpleBlog/nbproject/ant-deploy.xml new file mode 100644 index 00000000..2d5f8778 --- /dev/null +++ b/SimpleBlog/nbproject/ant-deploy.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimpleBlog/nbproject/build-impl.xml b/SimpleBlog/nbproject/build-impl.xml new file mode 100644 index 00000000..ec443653 --- /dev/null +++ b/SimpleBlog/nbproject/build-impl.xml @@ -0,0 +1,1444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/SimpleBlog/nbproject/genfiles.properties b/SimpleBlog/nbproject/genfiles.properties new file mode 100644 index 00000000..b23e99c3 --- /dev/null +++ b/SimpleBlog/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=5ee20916 +build.xml.script.CRC32=bedf25f1 +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=5ee20916 +nbproject/build-impl.xml.script.CRC32=e646747f +nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/SimpleBlog/nbproject/project.properties b/SimpleBlog/nbproject/project.properties new file mode 100644 index 00000000..0e0a8af0 --- /dev/null +++ b/SimpleBlog/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.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.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.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.primefaces.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +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=SimpleBlog.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/SimpleBlog/nbproject/project.xml b/SimpleBlog/nbproject/project.xml new file mode 100644 index 00000000..a2343094 --- /dev/null +++ b/SimpleBlog/nbproject/project.xml @@ -0,0 +1,23 @@ + + + org.netbeans.modules.web.project + + + SimpleBlog + 1.6.5 + + + ${libs.primefaces.classpath} + WEB-INF/lib + + + + + + + + + + + + diff --git a/SimpleBlog/src/conf/MANIFEST.MF b/SimpleBlog/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/SimpleBlog/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/SimpleBlog/web/WEB-INF/web.xml b/SimpleBlog/web/WEB-INF/web.xml new file mode 100644 index 00000000..c5e7c738 --- /dev/null +++ b/SimpleBlog/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/SimpleBlog/web/index.xhtml b/SimpleBlog/web/index.xhtml new file mode 100644 index 00000000..2c0cc9a7 --- /dev/null +++ b/SimpleBlog/web/index.xhtml @@ -0,0 +1,14 @@ + + + + + Facelet Title + + + Hello from Facelets +
+ +
+ + diff --git a/SimpleBlog/web/welcomePrimefaces.xhtml b/SimpleBlog/web/welcomePrimefaces.xhtml new file mode 100644 index 00000000..8c9dbc44 --- /dev/null +++ b/SimpleBlog/web/welcomePrimefaces.xhtml @@ -0,0 +1,51 @@ + + + + + + + + PrimeFaces + + + + + + + + + Header + + + + Footer + + + + + + + + + + + + + + + + + Welcome to PrimeFaces + + + + + + + + + From 7a583f0c846999609fdbfcdb9c2b350a0fec4429 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 21:43:14 +0700 Subject: [PATCH 02/30] Test build success --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d32a7920..15c0816f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/SimpleBlog/nbproject/private/ \ No newline at end of file +/SimpleBlog/nbproject/private/ +/SimpleBlog/build/ +/SimpleBlog/dist/ \ No newline at end of file From 0ce2591f34f7fff24f9a9817ef3892318754d50b Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 22:28:48 +0700 Subject: [PATCH 03/30] Add template and head --- SimpleBlog/web/WEB-INF/templates/head.xhtml | 35 + .../web/WEB-INF/templates/template.xhtml | 28 + SimpleBlog/web/resources/css/custom.css | 15 + SimpleBlog/web/resources/css/screen.css | 861 ++++++++++++++++++ SimpleBlog/web/resources/img/favicon.ico | Bin 0 -> 799 bytes SimpleBlog/web/resources/img/pre.png | Bin 0 -> 78 bytes 6 files changed, 939 insertions(+) create mode 100644 SimpleBlog/web/WEB-INF/templates/head.xhtml create mode 100644 SimpleBlog/web/WEB-INF/templates/template.xhtml create mode 100644 SimpleBlog/web/resources/css/custom.css create mode 100644 SimpleBlog/web/resources/css/screen.css create mode 100644 SimpleBlog/web/resources/img/favicon.ico create mode 100644 SimpleBlog/web/resources/img/pre.png diff --git a/SimpleBlog/web/WEB-INF/templates/head.xhtml b/SimpleBlog/web/WEB-INF/templates/head.xhtml new file mode 100644 index 00000000..c4c05f5a --- /dev/null +++ b/SimpleBlog/web/WEB-INF/templates/head.xhtml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/SimpleBlog/web/WEB-INF/templates/template.xhtml b/SimpleBlog/web/WEB-INF/templates/template.xhtml new file mode 100644 index 00000000..1aaec84f --- /dev/null +++ b/SimpleBlog/web/WEB-INF/templates/template.xhtml @@ -0,0 +1,28 @@ + + + + + + + Facelets Template + + + + +
+ Header +
+ +
+ Content +
+ +
+ Footer +
+ +
+ + diff --git a/SimpleBlog/web/resources/css/custom.css b/SimpleBlog/web/resources/css/custom.css new file mode 100644 index 00000000..cf6377c2 --- /dev/null +++ b/SimpleBlog/web/resources/css/custom.css @@ -0,0 +1,15 @@ +.art-title { + margin-bottom:40px +} + +.art-header { + height: 500px; +} + +.art-header-inner { + position: relative; +} + +.art { + margin-top: 0px; +} \ No newline at end of file diff --git a/SimpleBlog/web/resources/css/screen.css b/SimpleBlog/web/resources/css/screen.css new file mode 100644 index 00000000..1d8fdf3b --- /dev/null +++ b/SimpleBlog/web/resources/css/screen.css @@ -0,0 +1,861 @@ +@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; +} \ No newline at end of file diff --git a/SimpleBlog/web/resources/img/favicon.ico b/SimpleBlog/web/resources/img/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..40b40ed345847af1db325abe295a4d7c33cc51d9 GIT binary patch literal 799 zcmZ?wbhEHbRA5kGc$UeqZ{NPZfB)9j)^6Us`Olv}|Ni~^`SWLYcXw)Ps)K`rqod=Z zMT^$0Ti4v&eCN)c-@kvqef!qi+dDKg^!@wyU%q@%RaG@NH($Pd`GN%tl9G}xUc6XR zQu6E9FLibGuV25udiCn{>(}4Ee~*cY`SIh2tE=m-UAqn)I`rbji{9SeckkZKojdp0 zvuEz^?gtJWP*G9YxN+mzvuFMM{GL2{qNu1iW5$g8_wN@K6&V>BZQHi(@#DvNd3lzW zmLEQRxPANf_U+p*UAlDo^y%p6==k{fH*el_bab?~wpLVBeE$47J3IUC-Mhxd#!Hqg z@$m34Gc(J{$+Z^ zfgzJY2V@Q?P8it#H)J+7x3spkcXW1jck-(-hw?JH@v`)EtEXqoo}E5zdY96i*(uFN zj0-Y3q?&aXr)xJUr*kZjNcUQi$uByGv)MHxowvt!Rt9@B(;SH=f#c~~U98q~HZ(=d zNo?X+@6f5SID?ZlQ)UiZror)R3hjJv=A>l?%&`{^ew41l*Dk;$_GoTkf%6J>Eil=TJ#E=(?aY;SM|LZ4G}!4c(8v)yZsj{E+;CCD xp^pWP3S4uv5|&mxacW8Syewc*%yzV+uO-MJ;ZQ Date: Mon, 24 Nov 2014 22:40:41 +0700 Subject: [PATCH 04/30] Add header & footer --- SimpleBlog/web/WEB-INF/templates/foot.xhtml | 7 ++ SimpleBlog/web/WEB-INF/templates/footer.xhtml | 14 +++ SimpleBlog/web/WEB-INF/templates/header.xhtml | 12 ++ .../web/WEB-INF/templates/template.xhtml | 23 ++-- SimpleBlog/web/resources/js/simpleblog.js | 114 ++++++++++++++++++ 5 files changed, 157 insertions(+), 13 deletions(-) create mode 100644 SimpleBlog/web/WEB-INF/templates/foot.xhtml create mode 100644 SimpleBlog/web/WEB-INF/templates/footer.xhtml create mode 100644 SimpleBlog/web/WEB-INF/templates/header.xhtml create mode 100644 SimpleBlog/web/resources/js/simpleblog.js diff --git a/SimpleBlog/web/WEB-INF/templates/foot.xhtml b/SimpleBlog/web/WEB-INF/templates/foot.xhtml new file mode 100644 index 00000000..1c9de136 --- /dev/null +++ b/SimpleBlog/web/WEB-INF/templates/foot.xhtml @@ -0,0 +1,7 @@ + + + + + + diff --git a/SimpleBlog/web/WEB-INF/templates/footer.xhtml b/SimpleBlog/web/WEB-INF/templates/footer.xhtml new file mode 100644 index 00000000..065b52da --- /dev/null +++ b/SimpleBlog/web/WEB-INF/templates/footer.xhtml @@ -0,0 +1,14 @@ + + + + + + diff --git a/SimpleBlog/web/WEB-INF/templates/header.xhtml b/SimpleBlog/web/WEB-INF/templates/header.xhtml new file mode 100644 index 00000000..bf61e66e --- /dev/null +++ b/SimpleBlog/web/WEB-INF/templates/header.xhtml @@ -0,0 +1,12 @@ + + + + + + diff --git a/SimpleBlog/web/WEB-INF/templates/template.xhtml b/SimpleBlog/web/WEB-INF/templates/template.xhtml index 1aaec84f..1415660b 100644 --- a/SimpleBlog/web/WEB-INF/templates/template.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/template.xhtml @@ -5,24 +5,21 @@ xmlns:h="http://xmlns.jcp.org/jsf/html"> - - Facelets Template + + <ui:insert name="title">SimpleBlog</ui:insert> - + +
+ -
- Header -
- -
- Content -
+
+ Content +
-
- Footer +
- + diff --git a/SimpleBlog/web/resources/js/simpleblog.js b/SimpleBlog/web/resources/js/simpleblog.js new file mode 100644 index 00000000..80537988 --- /dev/null +++ b/SimpleBlog/web/resources/js/simpleblog.js @@ -0,0 +1,114 @@ +function deleteConfirmationBox(url) { + var confirm = window.confirm("Apakah Anda yakin menghapus post ini?"); + + if (confirm) { + window.location = url; + } else { + return false; + } +} + +function addComment(url, comment, postId) { + if (!validateComment(comment)) { + return false; + } + + var xmlhttp= window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { + var loadUrl = url.replace("new", "list") + "/" + postId; + loadComment(loadUrl); + } + } + + var parameters = "postid=" + postId + "&name=" + comment.Nama.value + "&email=" + comment.Email.value + "&content=" + comment.Komentar.value; + xmlhttp.open("POST", url, true); + xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + xmlhttp.send(parameters); +} + +function loadComment(url) { + var xmlhttp= window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); + + xmlhttp.onreadystatechange = function() { + if (xmlhttp.readyState==4 && xmlhttp.status==200) { + document.getElementById("comments").innerHTML = xmlhttp.responseText; + document.getElementById("Nama").value = ''; + document.getElementById("Email").value = ''; + document.getElementById("Komentar").value = ''; + } + } + + xmlhttp.open("GET", url, true); + xmlhttp.send(); +} + +function validatePost(post) { + if (isBlank(post.Judul.value)) { + alert("Judul Tidak Boleh Kosong"); + return false; + } + + if (isBlank(post.Tanggal.value)) { + alert("Tanggal Tidak Boleh Kosong"); + return false; + } + + if (isBlank(post.Konten.value)) { + alert("Konten Tidak Boleh Kosong"); + return false; + } + + var regex = /^(\d{1,2})-(\d{1,2})-(\d{4})$/ + if (!regex.test(post.Tanggal.value)) { + alert("Format Tanggal Tidak Valid"); + return false; + } + + var dd = post.Tanggal.value.split("-")[0]; + var mm = post.Tanggal.value.split("-")[1]; + var yy = post.Tanggal.value.split("-")[2]; + var date = new Date(yy, mm - 1, dd); + if ((date.getDate() != dd) || (date.getMonth() + 1 != mm) || (date.getFullYear() != yy)) { + alert("Angka Yang Dimasukkan Bukanlah Tanggal"); + return false; + } + + var today = new Date(); + if (today > date) { + alert("Tanggal Harus Lebih Dari Hari Ini"); + return false; + } + + return true; +} + +function validateComment(comment) { + if (isBlank(comment.Nama.value)) { + alert("Nama Tidak Boleh Kosong"); + return false; + } + + if (isBlank(comment.Email.value)) { + alert("Nama Tidak Boleh Kosong"); + return false; + } + + if (isBlank(comment.Komentar.value)) { + alert("Komentar Tidak Boleh Kosong"); + return false; + } + + var regex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + if (!regex.test(comment.Email.value)) { + alert("Email Yang Dimasukkan Tidak Valid"); + return false; + } + + return true; +} + +function isBlank(str) { + return (!str || 0 === str.length || /^\s*$/.test(str)); +} \ No newline at end of file From 11a9c22fb9e5d7c4dc01d0548b10ac9a6fabae51 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 22:57:01 +0700 Subject: [PATCH 05/30] Add homepage --- SimpleBlog/web/WEB-INF/templates/header.xhtml | 2 + .../web/WEB-INF/templates/template.xhtml | 6 +-- SimpleBlog/web/postList.xhtml | 54 +++++++++++++++++++ 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 SimpleBlog/web/postList.xhtml diff --git a/SimpleBlog/web/WEB-INF/templates/header.xhtml b/SimpleBlog/web/WEB-INF/templates/header.xhtml index bf61e66e..1506334a 100644 --- a/SimpleBlog/web/WEB-INF/templates/header.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/header.xhtml @@ -4,9 +4,11 @@ xmlns:h="http://xmlns.jcp.org/jsf/html"> diff --git a/SimpleBlog/web/WEB-INF/templates/template.xhtml b/SimpleBlog/web/WEB-INF/templates/template.xhtml index 1415660b..e52a5b30 100644 --- a/SimpleBlog/web/WEB-INF/templates/template.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/template.xhtml @@ -6,16 +6,14 @@ - <ui:insert name="title">SimpleBlog</ui:insert>SimpleBlog
-
- Content -
+ Content
diff --git a/SimpleBlog/web/postList.xhtml b/SimpleBlog/web/postList.xhtml new file mode 100644 index 00000000..dc62e418 --- /dev/null +++ b/SimpleBlog/web/postList.xhtml @@ -0,0 +1,54 @@ + + + + + + Simple Blog + + + + + + + \ No newline at end of file From f7918f29e13398cea6fbd9cd6c8def01a4cfcbe5 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 23:01:16 +0700 Subject: [PATCH 06/30] Change HTML5 & homepage --- SimpleBlog/web/WEB-INF/templates/foot.xhtml | 2 - SimpleBlog/web/WEB-INF/templates/footer.xhtml | 3 -- SimpleBlog/web/WEB-INF/templates/head.xhtml | 2 - SimpleBlog/web/WEB-INF/templates/header.xhtml | 2 - .../web/WEB-INF/templates/template.xhtml | 3 +- SimpleBlog/web/WEB-INF/web.xml | 2 +- SimpleBlog/web/index.xhtml | 14 ----- SimpleBlog/web/postList.xhtml | 2 - SimpleBlog/web/welcomePrimefaces.xhtml | 51 ------------------- 9 files changed, 2 insertions(+), 79 deletions(-) delete mode 100644 SimpleBlog/web/index.xhtml delete mode 100644 SimpleBlog/web/welcomePrimefaces.xhtml diff --git a/SimpleBlog/web/WEB-INF/templates/foot.xhtml b/SimpleBlog/web/WEB-INF/templates/foot.xhtml index 1c9de136..74673420 100644 --- a/SimpleBlog/web/WEB-INF/templates/foot.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/foot.xhtml @@ -1,5 +1,3 @@ - - diff --git a/SimpleBlog/web/WEB-INF/templates/footer.xhtml b/SimpleBlog/web/WEB-INF/templates/footer.xhtml index 065b52da..45058528 100644 --- a/SimpleBlog/web/WEB-INF/templates/footer.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/footer.xhtml @@ -1,12 +1,9 @@ - -
-
Ψ
diff --git a/SimpleBlog/web/WEB-INF/templates/head.xhtml b/SimpleBlog/web/WEB-INF/templates/head.xhtml index c4c05f5a..15045ba3 100644 --- a/SimpleBlog/web/WEB-INF/templates/head.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/head.xhtml @@ -1,5 +1,3 @@ - - diff --git a/SimpleBlog/web/WEB-INF/templates/header.xhtml b/SimpleBlog/web/WEB-INF/templates/header.xhtml index 1506334a..2cfc0dae 100644 --- a/SimpleBlog/web/WEB-INF/templates/header.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/header.xhtml @@ -1,5 +1,3 @@ - - diff --git a/SimpleBlog/web/WEB-INF/templates/template.xhtml b/SimpleBlog/web/WEB-INF/templates/template.xhtml index e52a5b30..c2297b62 100644 --- a/SimpleBlog/web/WEB-INF/templates/template.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/template.xhtml @@ -1,5 +1,4 @@ - - + diff --git a/SimpleBlog/web/WEB-INF/web.xml b/SimpleBlog/web/WEB-INF/web.xml index c5e7c738..c0e3fd4f 100644 --- a/SimpleBlog/web/WEB-INF/web.xml +++ b/SimpleBlog/web/WEB-INF/web.xml @@ -19,6 +19,6 @@ - faces/index.xhtml + faces/postList.xhtml diff --git a/SimpleBlog/web/index.xhtml b/SimpleBlog/web/index.xhtml deleted file mode 100644 index 2c0cc9a7..00000000 --- a/SimpleBlog/web/index.xhtml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Facelet Title - - - Hello from Facelets -
- -
- - diff --git a/SimpleBlog/web/postList.xhtml b/SimpleBlog/web/postList.xhtml index dc62e418..e515b7a4 100644 --- a/SimpleBlog/web/postList.xhtml +++ b/SimpleBlog/web/postList.xhtml @@ -1,5 +1,3 @@ - - diff --git a/SimpleBlog/web/welcomePrimefaces.xhtml b/SimpleBlog/web/welcomePrimefaces.xhtml deleted file mode 100644 index 8c9dbc44..00000000 --- a/SimpleBlog/web/welcomePrimefaces.xhtml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - PrimeFaces - - - - - - - - - Header - - - - Footer - - - - - - - - - - - - - - - - - Welcome to PrimeFaces - - - - - - - - - From 4512a9882694b8398da990a23c8c84b56da059f0 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 23:11:39 +0700 Subject: [PATCH 07/30] Add newpost page --- SimpleBlog/web/WEB-INF/templates/header.xhtml | 6 +-- SimpleBlog/web/postNew.xhtml | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 SimpleBlog/web/postNew.xhtml diff --git a/SimpleBlog/web/WEB-INF/templates/header.xhtml b/SimpleBlog/web/WEB-INF/templates/header.xhtml index 2cfc0dae..9c6f9842 100644 --- a/SimpleBlog/web/WEB-INF/templates/header.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/header.xhtml @@ -2,11 +2,9 @@ xmlns:h="http://xmlns.jcp.org/jsf/html"> diff --git a/SimpleBlog/web/postNew.xhtml b/SimpleBlog/web/postNew.xhtml new file mode 100644 index 00000000..147f94f5 --- /dev/null +++ b/SimpleBlog/web/postNew.xhtml @@ -0,0 +1,43 @@ + + + + + + New Post + + + +
+ +

+ +
+
+

Tambah Post

+ +
+
+ +
+
+
+
+ +
+
+ +
From fa83b55b521851d0c79b0d564bb5743b4ef03b23 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Mon, 24 Nov 2014 23:15:51 +0700 Subject: [PATCH 08/30] Add detailpost page --- SimpleBlog/web/postDetail.xhtml | 66 +++++++++++++++++++++++++++++++++ SimpleBlog/web/postNew.xhtml | 2 - 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 SimpleBlog/web/postDetail.xhtml diff --git a/SimpleBlog/web/postDetail.xhtml b/SimpleBlog/web/postDetail.xhtml new file mode 100644 index 00000000..f46ff7c6 --- /dev/null +++ b/SimpleBlog/web/postDetail.xhtml @@ -0,0 +1,66 @@ + + + + Title + + + + + + + diff --git a/SimpleBlog/web/postNew.xhtml b/SimpleBlog/web/postNew.xhtml index 147f94f5..c628459d 100644 --- a/SimpleBlog/web/postNew.xhtml +++ b/SimpleBlog/web/postNew.xhtml @@ -1,5 +1,3 @@ - - From c880c95d4e70394b66ebe8e52132b099deb6a2e5 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 00:09:55 +0700 Subject: [PATCH 09/30] Add post entity --- SimpleBlog/nbproject/faces-config.NavData | 6 + SimpleBlog/nbproject/project.properties | 5 +- SimpleBlog/src/conf/persistence.xml | 10 ++ .../informatika/wbd/jpa/entities/Post.java | 134 ++++++++++++++++++ .../informatika/wbd/jsf/PostController.java | 11 ++ SimpleBlog/web/WEB-INF/faces-config.xml | 7 + 6 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 SimpleBlog/nbproject/faces-config.NavData create mode 100644 SimpleBlog/src/conf/persistence.xml create mode 100644 SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java create mode 100644 SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java create mode 100644 SimpleBlog/web/WEB-INF/faces-config.xml diff --git a/SimpleBlog/nbproject/faces-config.NavData b/SimpleBlog/nbproject/faces-config.NavData new file mode 100644 index 00000000..298bfc50 --- /dev/null +++ b/SimpleBlog/nbproject/faces-config.NavData @@ -0,0 +1,6 @@ + + + + + + diff --git a/SimpleBlog/nbproject/project.properties b/SimpleBlog/nbproject/project.properties index 0e0a8af0..5f66438f 100644 --- a/SimpleBlog/nbproject/project.properties +++ b/SimpleBlog/nbproject/project.properties @@ -1,5 +1,6 @@ annotation.processing.enabled=true annotation.processing.enabled.in.editor=true +annotation.processing.processor.options=-Aeclipselink.canonicalmodel.use_static_factory=false annotation.processing.processors.list= annotation.processing.run.all.processors=true annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output @@ -49,7 +50,9 @@ javac.compilerargs= javac.debug=true javac.deprecation=false javac.processorpath=\ - ${javac.classpath} + ${javac.classpath}:\ + ${libs.eclipselink.classpath}:\ + ${libs.eclipselinkmodelgen.classpath} javac.source=1.8 javac.target=1.8 javac.test.classpath=\ diff --git a/SimpleBlog/src/conf/persistence.xml b/SimpleBlog/src/conf/persistence.xml new file mode 100644 index 00000000..d9b6740d --- /dev/null +++ b/SimpleBlog/src/conf/persistence.xml @@ -0,0 +1,10 @@ + + + + java:comp/DefaultDataSource + false + + + + + diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java new file mode 100644 index 00000000..3dbb2b28 --- /dev/null +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java @@ -0,0 +1,134 @@ +package id.ac.itb.informatika.wbd.jpa.entities; + +import java.io.Serializable; +import java.util.Date; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@Table(name = "posts") +public class Post implements Serializable { + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @Column(name = "post_id") + @GeneratedValue(strategy = GenerationType.AUTO) + private Long id; + + @Column(name = "post_title") + private String title; + + @Column(name = "post_date") + @Temporal(TemporalType.TIMESTAMP) + private Date date; + + @Column(name = "post_content") + private String content; + + @Column(name = "post_featured") + private Boolean featured; + + @Column(name = "post_modified") + @Temporal(TemporalType.TIMESTAMP) + private Date modified; + + public Post() { + } + + public Post(Long id) { + this.id = id; + } + + public Post(Long id, String title, Date date, String content) { + this.id = id; + this.title = title; + this.date = date; + this.content = content; + this.featured = false; + this.modified = date; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Boolean getFeatured() { + return featured; + } + + public void setFeatured(Boolean featured) { + this.featured = featured; + } + + public Date getModified() { + return modified; + } + + public void setModified(Date modified) { + this.modified = modified; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (id != null ? id.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Post)) { + return false; + } + Post other = (Post) object; + if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { + return false; + } + return true; + } + + @Override + public String toString() { + return "id.ac.itb.informatika.wbd.jpa.entities.Post[ id=" + id + " ]"; + } + +} diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java new file mode 100644 index 00000000..6f426ceb --- /dev/null +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -0,0 +1,11 @@ +package id.ac.itb.informatika.wbd.jsf; + +public class PostController { + + public PostController() { + FacesContext facesContext = FacesContext.getCurrentInstance(); + } + + private Post post = null; + +} diff --git a/SimpleBlog/web/WEB-INF/faces-config.xml b/SimpleBlog/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..0393e360 --- /dev/null +++ b/SimpleBlog/web/WEB-INF/faces-config.xml @@ -0,0 +1,7 @@ + + + + From b11db1180313393f6400237ce6271c785b50aef8 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 00:26:54 +0700 Subject: [PATCH 10/30] Add PostJpaController --- .../wbd/jpa/controller/PostJpaController.java | 37 +++++++++++++++++++ .../informatika/wbd/jpa/entities/Post.java | 7 +++- .../informatika/wbd/jsf/PostController.java | 5 +++ 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java new file mode 100644 index 00000000..9e747dca --- /dev/null +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java @@ -0,0 +1,37 @@ +/* + * 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 id.ac.itb.informatika.wbd.jpa.controller; + +import id.ac.itb.informatika.wbd.jpa.entities.Post; +import javax.annotation.Resource; +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.PersistenceUnit; +import javax.transaction.UserTransaction; + +public class PostJpaController { + @Resource + private UserTransaction utx = null; + + @PersistenceUnit(unitName = "SimpleBlogPU") + private EntityManagerFactory emf = null; + + public EntityManager getEntityManager() { + return emf.createEntityManager(); + } + + public void create(Post post) { + + } + + public void edit(Post post) { + + } + + public void destroy(Long id) { + + } +} diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java index 3dbb2b28..c96d108b 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/entities/Post.java @@ -8,14 +8,18 @@ import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; @Entity @Table(name = "posts") +@NamedQueries({@NamedQuery(name = "Post.findAll", query = "SELECT c FROM Post c"), + @NamedQuery(name = "Post.findById", query = "SELECT c FROM Post c WHERE c.id = :id"), + @NamedQuery(name = "Post.findByTitle", query = "SELECT c FROM Post c WHERE c.title = :title")}) public class Post implements Serializable { - private static final long serialVersionUID = 1L; @Id @@ -65,7 +69,6 @@ public void setId(Long id) { this.id = id; } - public String getTitle() { return title; } diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java index 6f426ceb..2e9da8ea 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -1,5 +1,9 @@ package id.ac.itb.informatika.wbd.jsf; +import id.ac.itb.informatika.wbd.jpa.controller.PostJpaController; +import id.ac.itb.informatika.wbd.jpa.entities.Post; +import javax.faces.context.FacesContext; + public class PostController { public PostController() { @@ -7,5 +11,6 @@ public PostController() { } private Post post = null; + private PostJpaController jpaController = null; } From efe277eaf5b07417c2e7f2e981b0759e401c053a Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 01:30:05 +0700 Subject: [PATCH 11/30] Add post placeholder --- .../wbd/jpa/controller/PostJpaController.java | 12 ++++++ .../informatika/wbd/jsf/PostController.java | 12 ++++++ SimpleBlog/web/WEB-INF/templates/head.xhtml | 2 +- SimpleBlog/web/postList.xhtml | 41 +++++++------------ 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java index 9e747dca..d262bd71 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java @@ -6,10 +6,12 @@ package id.ac.itb.informatika.wbd.jpa.controller; import id.ac.itb.informatika.wbd.jpa.entities.Post; +import java.util.List; import javax.annotation.Resource; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.PersistenceUnit; +import javax.persistence.Query; import javax.transaction.UserTransaction; public class PostJpaController { @@ -34,4 +36,14 @@ public void edit(Post post) { public void destroy(Long id) { } + + public List getPostList() { + EntityManager em = getEntityManager(); + try { + Query q = em.createQuery("select object(o) from Post as o"); + return q.getResultList(); + } finally { + em.close(); + } + } } diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java index 2e9da8ea..3be8f2c9 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -2,8 +2,13 @@ import id.ac.itb.informatika.wbd.jpa.controller.PostJpaController; import id.ac.itb.informatika.wbd.jpa.entities.Post; +import java.util.List; +import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; +import javax.inject.Named; +@Named +@SessionScoped public class PostController { public PostController() { @@ -12,5 +17,12 @@ public PostController() { private Post post = null; private PostJpaController jpaController = null; + private List postList = null; + public List getPostList() { + if (postList == null) { + postList = jpaController.getPostList(); + } + return postList; + } } diff --git a/SimpleBlog/web/WEB-INF/templates/head.xhtml b/SimpleBlog/web/WEB-INF/templates/head.xhtml index 15045ba3..6ed747ef 100644 --- a/SimpleBlog/web/WEB-INF/templates/head.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/head.xhtml @@ -24,7 +24,7 @@ - + + \ No newline at end of file From 391b74995f9bf9fc0f77f960d5654d3778608901 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 09:23:19 +0700 Subject: [PATCH 12/30] Add new post placeholder --- .../wbd/jpa/controller/PostJpaController.java | 2 +- .../informatika/wbd/jsf/PostController.java | 12 +++++- SimpleBlog/web/postNew.xhtml | 37 ++++++++++--------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java index d262bd71..df4d1c67 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java @@ -37,7 +37,7 @@ public void destroy(Long id) { } - public List getPostList() { + public List getAllPosts() { EntityManager em = getEntityManager(); try { Query q = em.createQuery("select object(o) from Post as o"); diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java index 3be8f2c9..463e6d07 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -19,9 +19,19 @@ public PostController() { private PostJpaController jpaController = null; private List postList = null; + public Post getPost() { + if (post == null) { + //post = (post) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentCustomer", converter, null); + } + if (post == null) { + post = new Post(); + } + return post; + } + public List getPostList() { if (postList == null) { - postList = jpaController.getPostList(); + postList = jpaController.getAllPosts(); } return postList; } diff --git a/SimpleBlog/web/postNew.xhtml b/SimpleBlog/web/postNew.xhtml index c628459d..b10d4163 100644 --- a/SimpleBlog/web/postNew.xhtml +++ b/SimpleBlog/web/postNew.xhtml @@ -1,5 +1,6 @@ + template="./WEB-INF/templates/template.xhtml" + xmlns:h="http://xmlns.jcp.org/jsf/html"> New Post @@ -15,22 +16,24 @@

Tambah Post

-
- -
+ + + + + + + + + + + + + + + + + +
From 3322a4eea30773a3644304d769a6780051e21579 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 10:27:00 +0700 Subject: [PATCH 13/30] New Post frontend finish --- SimpleBlog/web/postNew.xhtml | 20 +++++++++----------- SimpleBlog/web/resources/js/simpleblog.js | 23 ++++++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/SimpleBlog/web/postNew.xhtml b/SimpleBlog/web/postNew.xhtml index b10d4163..3a412fc8 100644 --- a/SimpleBlog/web/postNew.xhtml +++ b/SimpleBlog/web/postNew.xhtml @@ -16,22 +16,20 @@

Tambah Post

- + - - + + - - + + - - - - - - + + + +
diff --git a/SimpleBlog/web/resources/js/simpleblog.js b/SimpleBlog/web/resources/js/simpleblog.js index 80537988..36b417fb 100644 --- a/SimpleBlog/web/resources/js/simpleblog.js +++ b/SimpleBlog/web/resources/js/simpleblog.js @@ -44,31 +44,36 @@ function loadComment(url) { xmlhttp.send(); } -function validatePost(post) { - if (isBlank(post.Judul.value)) { +function validatePost() { + console.log("validatePost is called"); + judul = document.getElementById("NewPost:Judul"); + tanggal = document.getElementById("NewPost:Tanggal"); + konten = document.getElementById("NewPost:Konten"); + + if (isBlank(judul.value)) { alert("Judul Tidak Boleh Kosong"); return false; } - if (isBlank(post.Tanggal.value)) { + if (isBlank(tanggal.value)) { alert("Tanggal Tidak Boleh Kosong"); return false; } - if (isBlank(post.Konten.value)) { + if (isBlank(konten.value)) { alert("Konten Tidak Boleh Kosong"); return false; } var regex = /^(\d{1,2})-(\d{1,2})-(\d{4})$/ - if (!regex.test(post.Tanggal.value)) { - alert("Format Tanggal Tidak Valid"); + if (!regex.test(tanggal.value)) { + alert("Format Tanggal Harus dd-mm-yyyy"); return false; } - var dd = post.Tanggal.value.split("-")[0]; - var mm = post.Tanggal.value.split("-")[1]; - var yy = post.Tanggal.value.split("-")[2]; + var dd = tanggal.value.split("-")[0]; + var mm = tanggal.value.split("-")[1]; + var yy = tanggal.value.split("-")[2]; var date = new Date(yy, mm - 1, dd); if ((date.getDate() != dd) || (date.getMonth() + 1 != mm) || (date.getFullYear() != yy)) { alert("Angka Yang Dimasukkan Bukanlah Tanggal"); From f6bc0162f37f488024bc4626d5919febc9ed4511 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 10:27:40 +0700 Subject: [PATCH 14/30] Delete unnecessary files --- assets/css/screen.css | 861 ----------------------------------------- assets/img/favicon.ico | Bin 799 -> 0 bytes assets/img/pre.png | Bin 78 -> 0 bytes index.html | 114 ------ new_post.html | 111 ------ post.html | 140 ------- 6 files changed, 1226 deletions(-) delete mode 100644 assets/css/screen.css delete mode 100644 assets/img/favicon.ico delete mode 100644 assets/img/pre.png delete mode 100644 index.html delete mode 100644 new_post.html delete mode 100644 post.html diff --git a/assets/css/screen.css b/assets/css/screen.css deleted file mode 100644 index 1d8fdf3b..00000000 --- a/assets/css/screen.css +++ /dev/null @@ -1,861 +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 { - 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; -} \ No newline at end of file diff --git a/assets/img/favicon.ico b/assets/img/favicon.ico deleted file mode 100644 index 40b40ed345847af1db325abe295a4d7c33cc51d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 799 zcmZ?wbhEHbRA5kGc$UeqZ{NPZfB)9j)^6Us`Olv}|Ni~^`SWLYcXw)Ps)K`rqod=Z zMT^$0Ti4v&eCN)c-@kvqef!qi+dDKg^!@wyU%q@%RaG@NH($Pd`GN%tl9G}xUc6XR zQu6E9FLibGuV25udiCn{>(}4Ee~*cY`SIh2tE=m-UAqn)I`rbji{9SeckkZKojdp0 zvuEz^?gtJWP*G9YxN+mzvuFMM{GL2{qNu1iW5$g8_wN@K6&V>BZQHi(@#DvNd3lzW zmLEQRxPANf_U+p*UAlDo^y%p6==k{fH*el_bab?~wpLVBeE$47J3IUC-Mhxd#!Hqg z@$m34Gc(J{$+Z^ zfgzJY2V@Q?P8it#H)J+7x3spkcXW1jck-(-hw?JH@v`)EtEXqoo}E5zdY96i*(uFN zj0-Y3q?&aXr)xJUr*kZjNcUQi$uByGv)MHxowvt!Rt9@B(;SH=f#c~~U98q~HZ(=d zNo?X+@6f5SID?ZlQ)UiZror)R3hjJv=A>l?%&`{^ew41l*Dk;$_GoTkf%6J>Eil=TJ#E=(?aY;SM|LZ4G}!4c(8v)yZsj{E+;CCD xp^pWP3S4uv5|&mxacW8Syewc*%yzV+uO-MJ;ZQ - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
- - - -
-
- -
-
- - - -
- - - - - - - - \ No newline at end of file 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?

- -
- -

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 From 264731b0f31ff8175fc6ec438e1aa3b5a14f10cd Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 10:43:50 +0700 Subject: [PATCH 15/30] Add new post backend --- .../wbd/jpa/controller/PostJpaController.java | 15 ++++++++++++++- .../informatika/wbd/jsf/PostController.java | 18 +++++++++++++----- SimpleBlog/web/WEB-INF/faces-config.xml | 7 ++++++- SimpleBlog/web/postNew.xhtml | 2 +- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java index df4d1c67..634dcf72 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jpa/controller/PostJpaController.java @@ -25,8 +25,21 @@ public EntityManager getEntityManager() { return emf.createEntityManager(); } - public void create(Post post) { + public void create(Post post) throws Exception { + EntityManager em = null; + try { + utx.begin(); + em = getEntityManager(); + em.persist(post); + utx.commit(); + } catch (Exception ex) { + utx.rollback(); + } finally { + if (em != null) { + em.close(); + } + } } public void edit(Post post) { diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java index 463e6d07..136e96c2 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -3,12 +3,8 @@ import id.ac.itb.informatika.wbd.jpa.controller.PostJpaController; import id.ac.itb.informatika.wbd.jpa.entities.Post; import java.util.List; -import javax.faces.bean.SessionScoped; import javax.faces.context.FacesContext; -import javax.inject.Named; -@Named -@SessionScoped public class PostController { public PostController() { @@ -19,7 +15,7 @@ public PostController() { private PostJpaController jpaController = null; private List postList = null; - public Post getPost() { + public Post getPost() { if (post == null) { //post = (post) JsfUtil.getObjectFromRequestParameter("jsfcrud.currentCustomer", converter, null); } @@ -35,4 +31,16 @@ public List getPostList() { } return postList; } + + public String newPost() { + try { + jpaController.create(post); + //JsfUtil.addSuccessMessage("Customer was successfully created."); + } catch (Exception e) { + //JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred."); + return null; + } + + return "postList"; + } } diff --git a/SimpleBlog/web/WEB-INF/faces-config.xml b/SimpleBlog/web/WEB-INF/faces-config.xml index 0393e360..f376658c 100644 --- a/SimpleBlog/web/WEB-INF/faces-config.xml +++ b/SimpleBlog/web/WEB-INF/faces-config.xml @@ -3,5 +3,10 @@ xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"> - + + + postController + id.ac.itb.informatika.wbd.jsf.PostController + session + diff --git a/SimpleBlog/web/postNew.xhtml b/SimpleBlog/web/postNew.xhtml index 3a412fc8..5aa71f8b 100644 --- a/SimpleBlog/web/postNew.xhtml +++ b/SimpleBlog/web/postNew.xhtml @@ -29,7 +29,7 @@ - + From 85caa8828f767ea584e314ab1237864bd779319a Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 11:34:18 +0700 Subject: [PATCH 16/30] Half-time --- .gitignore | 4 +++- .../ac/itb/informatika/wbd/jsf/PostController.java | 9 +++++---- SimpleBlog/web/WEB-INF/faces-config.xml | 13 +++++++++++++ SimpleBlog/web/WEB-INF/templates/header.xhtml | 4 ++-- SimpleBlog/web/postList.xhtml | 2 +- SimpleBlog/web/resources/js/simpleblog.js | 2 +- 6 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 15c0816f..9cc36e24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /SimpleBlog/nbproject/private/ /SimpleBlog/build/ -/SimpleBlog/dist/ \ No newline at end of file +/SimpleBlog/dist/ +/JsfJpaCrud/nbproject/private/ +/JsfJpaCrud/build/ \ No newline at end of file diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java index 136e96c2..b736bcee 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -26,7 +26,7 @@ public Post getPost() { } public List getPostList() { - if (postList == null) { + if (postList == null) { postList = jpaController.getAllPosts(); } return postList; @@ -38,9 +38,10 @@ public String newPost() { //JsfUtil.addSuccessMessage("Customer was successfully created."); } catch (Exception e) { //JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred."); - return null; + System.out.println("ERROR"); + return "post_list"; } - - return "postList"; + System.out.println("SUCCESS"); + return "post_list"; } } diff --git a/SimpleBlog/web/WEB-INF/faces-config.xml b/SimpleBlog/web/WEB-INF/faces-config.xml index f376658c..61e91386 100644 --- a/SimpleBlog/web/WEB-INF/faces-config.xml +++ b/SimpleBlog/web/WEB-INF/faces-config.xml @@ -9,4 +9,17 @@ id.ac.itb.informatika.wbd.jsf.PostController session + + + + post_list + postList.xhtml + + + + + post_new + postNew.xhtml + + diff --git a/SimpleBlog/web/WEB-INF/templates/header.xhtml b/SimpleBlog/web/WEB-INF/templates/header.xhtml index 9c6f9842..56467576 100644 --- a/SimpleBlog/web/WEB-INF/templates/header.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/header.xhtml @@ -2,9 +2,9 @@ xmlns:h="http://xmlns.jcp.org/jsf/html"> diff --git a/SimpleBlog/web/postList.xhtml b/SimpleBlog/web/postList.xhtml index 4d012fdb..ea52349c 100644 --- a/SimpleBlog/web/postList.xhtml +++ b/SimpleBlog/web/postList.xhtml @@ -12,7 +12,7 @@
diff --git a/SimpleBlog/web/postNew.xhtml b/SimpleBlog/web/postNew.xhtml index 5aa71f8b..7390e30d 100644 --- a/SimpleBlog/web/postNew.xhtml +++ b/SimpleBlog/web/postNew.xhtml @@ -18,16 +18,16 @@
- + - + - + - + From 736c03265b6a1c33d7d75bd122a074529c31e3d9 Mon Sep 17 00:00:00 2001 From: Ichlasul Amal Date: Tue, 25 Nov 2014 13:17:04 +0700 Subject: [PATCH 18/30] Add error message --- .../ac/itb/informatika/wbd/jsf/JsfUtil.java | 133 ++++++++++++++++++ .../informatika/wbd/jsf/PostController.java | 4 +- SimpleBlog/web/WEB-INF/templates/foot.xhtml | 3 +- SimpleBlog/web/WEB-INF/templates/footer.xhtml | 3 +- SimpleBlog/web/WEB-INF/templates/head.xhtml | 3 +- SimpleBlog/web/WEB-INF/templates/header.xhtml | 3 +- .../web/WEB-INF/templates/template.xhtml | 3 +- SimpleBlog/web/postNew.xhtml | 8 +- 8 files changed, 151 insertions(+), 9 deletions(-) create mode 100644 SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/JsfUtil.java diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/JsfUtil.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/JsfUtil.java new file mode 100644 index 00000000..ae97fb6b --- /dev/null +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/JsfUtil.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2010, Oracle. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of Oracle nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +package id.ac.itb.informatika.wbd.jsf; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.convert.Converter; +import javax.faces.model.SelectItem; + +/** + * + * @author mbohm + */ +public class JsfUtil { + + public static SelectItem[] getSelectItems(List entities, boolean selectOne) { + int size = selectOne ? entities.size() + 1 : entities.size(); + SelectItem[] items = new SelectItem[size]; + int i = 0; + if (selectOne) { + items[0] = new SelectItem("", "---"); + i++; + } + for (Object x : entities) { + items[i++] = new SelectItem(x, x.toString()); + } + return items; + } + + public static void ensureAddErrorMessage(Exception ex, String defaultMsg) { + String msg = ex.getLocalizedMessage(); + if (msg != null && msg.length() > 0) { + addErrorMessage(msg); + } else { + addErrorMessage(defaultMsg); + } + } + + public static void addErrorMessages(List messages) { + for (String message : messages) { + addErrorMessage(message); + } + } + + public static void addErrorMessage(String msg) { + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg); + FacesContext.getCurrentInstance().addMessage(null, facesMsg); + } + + public static void addSuccessMessage(String msg) { + FacesMessage facesMsg = new FacesMessage(FacesMessage.SEVERITY_INFO, msg, msg); + FacesContext.getCurrentInstance().addMessage("successInfo", facesMsg); + } + + public static String getRequestParameter(String key) { + return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(key); + } + + public static Object getObjectFromRequestParameter(String requestParameterName, Converter converter, UIComponent component) { + String theId = JsfUtil.getRequestParameter(requestParameterName); + return converter.getAsObject(FacesContext.getCurrentInstance(), component, theId); + } + + public static Collection arrayToCollection(T[] arr) { + if (arr == null) { + return new ArrayList(); + } + return Arrays.asList(arr); + } + + public static Object[] collectionToArray(Collection c) { + if (c == null) { + return new Object[0]; + } + return c.toArray(); + } + + public static String getAsConvertedString(Object object, Converter converter) { + return converter.getAsString(FacesContext.getCurrentInstance(), null, object); + } + + public static String getAsString(Object object) { + if (object instanceof Collection) { + Collection collection = (Collection)object; + if (collection.size() == 0) { + return "(No Items)"; + } + StringBuffer sb = new StringBuffer(); + int i = 0; + for (Object item : collection) { + if (i > 0) { + sb.append("
"); + } + sb.append(item); + i++; + } + return sb.toString(); + } + return String.valueOf(object); + } +} diff --git a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java index fda94af5..bdb54546 100644 --- a/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java +++ b/SimpleBlog/src/java/id/ac/itb/informatika/wbd/jsf/PostController.java @@ -40,9 +40,9 @@ public int getPostCount() { public String newPost() { try { jpaController.create(postCurrent); - //JsfUtil.addSuccessMessage("Customer was successfully created."); + JsfUtil.addSuccessMessage("Post sudah berhasil dibuat"); } catch (Exception e) { - //JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred."); + JsfUtil.ensureAddErrorMessage(e, "A persistence error occurred."); return "post_list"; } return "post_list"; diff --git a/SimpleBlog/web/WEB-INF/templates/foot.xhtml b/SimpleBlog/web/WEB-INF/templates/foot.xhtml index 74673420..49b15950 100644 --- a/SimpleBlog/web/WEB-INF/templates/foot.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/foot.xhtml @@ -1,4 +1,5 @@ - diff --git a/SimpleBlog/web/WEB-INF/templates/footer.xhtml b/SimpleBlog/web/WEB-INF/templates/footer.xhtml index 45058528..eb369e37 100644 --- a/SimpleBlog/web/WEB-INF/templates/footer.xhtml +++ b/SimpleBlog/web/WEB-INF/templates/footer.xhtml @@ -1,4 +1,5 @@ -