diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..ceaafe72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/dist/ +/build/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..4a6c3a36 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +IF3110-02-Simple-Blog-Java +========================== + +Tugas 2 IF3110 Pengembangan Aplikasi Berbasis Web, membuat Blog Sederhana dengan Teknologi Java + +Dibuat oleh : +Calvin Sadewa +Joshua Bezaleel Abednego +Khoirunnisa Afifah 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 40b40ed3..00000000 Binary files a/assets/img/favicon.ico and /dev/null differ diff --git a/assets/img/pre.png b/assets/img/pre.png deleted file mode 100644 index 7f48517b..00000000 Binary files a/assets/img/pre.png and /dev/null differ diff --git a/build.xml b/build.xml new file mode 100644 index 00000000..222de282 --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project Simple Blog. + + + diff --git a/build/web/Add-Post.xhtml b/build/web/Add-Post.xhtml new file mode 100644 index 00000000..b8519296 --- /dev/null +++ b/build/web/Add-Post.xhtml @@ -0,0 +1,57 @@ + + + +<<<<<<< HEAD + +======= + +>>>>>>> f187f1fdca6e243f3f36a82f6c730f6af75181fc + + Add Post + + + + +
+ + +

-

+ +
+
+

Tambah Post

+ +
+
+ + + + + + + +

+ + + + +
+
+
+
+ +
+
+
> +
+
+ diff --git a/build/web/Delete-Post.xhtml b/build/web/Delete-Post.xhtml new file mode 100644 index 00000000..c627c249 --- /dev/null +++ b/build/web/Delete-Post.xhtml @@ -0,0 +1,16 @@ + + + + + TODO supply a title + + + + +
TODO write content
+ + diff --git a/build/web/Edit-Post.xhtml b/build/web/Edit-Post.xhtml new file mode 100644 index 00000000..906f25c4 --- /dev/null +++ b/build/web/Edit-Post.xhtml @@ -0,0 +1,20 @@ + + + + + + Edit Post + + + + + + + > + + + diff --git a/build/web/List-Post.xhtml b/build/web/List-Post.xhtml new file mode 100644 index 00000000..ee588955 --- /dev/null +++ b/build/web/List-Post.xhtml @@ -0,0 +1,35 @@ + + + + + + List Post + + + + +

List Post

+ +
+
> +
+
+ \ No newline at end of file diff --git a/build/web/List-Unpublish-Post.xhtml b/build/web/List-Unpublish-Post.xhtml new file mode 100644 index 00000000..d905caff --- /dev/null +++ b/build/web/List-Unpublish-Post.xhtml @@ -0,0 +1,35 @@ + + + + + + List Post + + + + +

List Post

+ +
+
> +
+
+ \ No newline at end of file diff --git a/build/web/List-User.xhtml b/build/web/List-User.xhtml new file mode 100644 index 00000000..f1ac9319 --- /dev/null +++ b/build/web/List-User.xhtml @@ -0,0 +1,137 @@ + + + + + + List User + + + + + + +
+
+ +
+ Edit user +
+ + + + +
+
+ + + + +
+
+ + + + + +
+ +
+ + + + +
+ + +
+
+
+
+ +
+ Add user +
+ + + + +
+
+ + + + +
+
+ + + + + +
+ +
+ + + + +
+ + +
+
+
+
+

List User

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ diff --git a/build/web/Login.xhtml b/build/web/Login.xhtml new file mode 100644 index 00000000..2748e210 --- /dev/null +++ b/build/web/Login.xhtml @@ -0,0 +1,44 @@ + + + + + + Login Form + + + + + +
+ Login + +
+ + + + +
+ +
+ + + + +
+ +
+ +
+

Untuk sementara hanya admin yang bisa akses semua page, + role number admin = 2

+
+
+
+
+ \ No newline at end of file diff --git a/build/web/META-INF/MANIFEST.MF b/build/web/META-INF/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/build/web/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/build/web/View-Post.xhtml b/build/web/View-Post.xhtml new file mode 100644 index 00000000..0d96f1d1 --- /dev/null +++ b/build/web/View-Post.xhtml @@ -0,0 +1,70 @@ + + + + + + Post title + + + + +
+
+

#{Post.fetchPost(param['id']).judul}

+ + +
+ +
+

+ #{Post.fetchPost(param['id']).konten} +

+ +
+
+

Komentar

+
+ +
    + +
  • +

    #{komentar.tanggal} | #{komentar.nama}

    +
    + +
  • +
    +
+
+
+
> + +
+
+ diff --git a/build/web/WEB-INF/classes/.netbeans_automatic_build b/build/web/WEB-INF/classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/.netbeans_update_resources b/build/web/WEB-INF/classes/.netbeans_update_resources new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/DAO/CommentDAO.class b/build/web/WEB-INF/classes/DAO/CommentDAO.class new file mode 100644 index 00000000..999c587c Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/CommentDAO.class differ diff --git a/build/web/WEB-INF/classes/DAO/CommentDAOJDBC.class b/build/web/WEB-INF/classes/DAO/CommentDAOJDBC.class new file mode 100644 index 00000000..e1b07891 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/CommentDAOJDBC.class differ diff --git a/build/web/WEB-INF/classes/DAO/DAO.properties b/build/web/WEB-INF/classes/DAO/DAO.properties new file mode 100644 index 00000000..6c52ad3e --- /dev/null +++ b/build/web/WEB-INF/classes/DAO/DAO.properties @@ -0,0 +1,8 @@ +# 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. +javabase.jdbc.url = jdbc:mysql://localhost:3306/simple_blog_2 +javabase.jdbc.driver = com.mysql.jdbc.Driver +javabase.jdbc.username = root +javabase.jdbc.password = + diff --git a/build/web/WEB-INF/classes/DAO/DAOConfigurationException.class b/build/web/WEB-INF/classes/DAO/DAOConfigurationException.class new file mode 100644 index 00000000..cc18f830 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DAOConfigurationException.class differ diff --git a/build/web/WEB-INF/classes/DAO/DAOException.class b/build/web/WEB-INF/classes/DAO/DAOException.class new file mode 100644 index 00000000..620c02b1 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DAOException.class differ diff --git a/build/web/WEB-INF/classes/DAO/DAOFactory.class b/build/web/WEB-INF/classes/DAO/DAOFactory.class new file mode 100644 index 00000000..747c0e84 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DAOFactory.class differ diff --git a/build/web/WEB-INF/classes/DAO/DAOProperties.class b/build/web/WEB-INF/classes/DAO/DAOProperties.class new file mode 100644 index 00000000..16738db8 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DAOProperties.class differ diff --git a/build/web/WEB-INF/classes/DAO/DAOUtil.class b/build/web/WEB-INF/classes/DAO/DAOUtil.class new file mode 100644 index 00000000..f3110bc4 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DAOUtil.class differ diff --git a/build/web/WEB-INF/classes/DAO/DataSourceDAOFactory.class b/build/web/WEB-INF/classes/DAO/DataSourceDAOFactory.class new file mode 100644 index 00000000..6c2488d5 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DataSourceDAOFactory.class differ diff --git a/build/web/WEB-INF/classes/DAO/DataSourceWithLoginDAOFactory.class b/build/web/WEB-INF/classes/DAO/DataSourceWithLoginDAOFactory.class new file mode 100644 index 00000000..491c5a7c Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DataSourceWithLoginDAOFactory.class differ diff --git a/build/web/WEB-INF/classes/DAO/DriverManagerDAOFactory.class b/build/web/WEB-INF/classes/DAO/DriverManagerDAOFactory.class new file mode 100644 index 00000000..195faeb6 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/DriverManagerDAOFactory.class differ diff --git a/build/web/WEB-INF/classes/DAO/PostDAO.class b/build/web/WEB-INF/classes/DAO/PostDAO.class new file mode 100644 index 00000000..d0b57cab Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/PostDAO.class differ diff --git a/build/web/WEB-INF/classes/DAO/PostDAOJDBC.class b/build/web/WEB-INF/classes/DAO/PostDAOJDBC.class new file mode 100644 index 00000000..3bbbe76f Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/PostDAOJDBC.class differ diff --git a/build/web/WEB-INF/classes/DAO/UserDAO.class b/build/web/WEB-INF/classes/DAO/UserDAO.class new file mode 100644 index 00000000..d87efa64 Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/UserDAO.class differ diff --git a/build/web/WEB-INF/classes/DAO/UserDAOJDBC.class b/build/web/WEB-INF/classes/DAO/UserDAOJDBC.class new file mode 100644 index 00000000..fd6de22a Binary files /dev/null and b/build/web/WEB-INF/classes/DAO/UserDAOJDBC.class differ diff --git a/build/web/WEB-INF/classes/filter/AuthenticationFilter.class b/build/web/WEB-INF/classes/filter/AuthenticationFilter.class new file mode 100644 index 00000000..b3be330c Binary files /dev/null and b/build/web/WEB-INF/classes/filter/AuthenticationFilter.class differ diff --git a/build/web/WEB-INF/classes/model/AddUserBean.class b/build/web/WEB-INF/classes/model/AddUserBean.class new file mode 100644 index 00000000..7283cedb Binary files /dev/null and b/build/web/WEB-INF/classes/model/AddUserBean.class differ diff --git a/build/web/WEB-INF/classes/model/AllUserBean.class b/build/web/WEB-INF/classes/model/AllUserBean.class new file mode 100644 index 00000000..5da21e8b Binary files /dev/null and b/build/web/WEB-INF/classes/model/AllUserBean.class differ diff --git a/build/web/WEB-INF/classes/model/DeleteUserBean.class b/build/web/WEB-INF/classes/model/DeleteUserBean.class new file mode 100644 index 00000000..8bcd4126 Binary files /dev/null and b/build/web/WEB-INF/classes/model/DeleteUserBean.class differ diff --git a/build/web/WEB-INF/classes/model/EditUserBean.class b/build/web/WEB-INF/classes/model/EditUserBean.class new file mode 100644 index 00000000..a021c5ee Binary files /dev/null and b/build/web/WEB-INF/classes/model/EditUserBean.class differ diff --git a/build/web/WEB-INF/classes/model/Komentar.class b/build/web/WEB-INF/classes/model/Komentar.class new file mode 100644 index 00000000..eadc581d Binary files /dev/null and b/build/web/WEB-INF/classes/model/Komentar.class differ diff --git a/build/web/WEB-INF/classes/model/ListPost.class b/build/web/WEB-INF/classes/model/ListPost.class new file mode 100644 index 00000000..b2d6a298 Binary files /dev/null and b/build/web/WEB-INF/classes/model/ListPost.class differ diff --git a/build/web/WEB-INF/classes/model/LoginBean.class b/build/web/WEB-INF/classes/model/LoginBean.class new file mode 100644 index 00000000..675a0bed Binary files /dev/null and b/build/web/WEB-INF/classes/model/LoginBean.class differ diff --git a/build/web/WEB-INF/classes/model/NavigationController.class b/build/web/WEB-INF/classes/model/NavigationController.class new file mode 100644 index 00000000..144b2de7 Binary files /dev/null and b/build/web/WEB-INF/classes/model/NavigationController.class differ diff --git a/build/web/WEB-INF/classes/model/Post.class b/build/web/WEB-INF/classes/model/Post.class new file mode 100644 index 00000000..247cf3fa Binary files /dev/null and b/build/web/WEB-INF/classes/model/Post.class differ diff --git a/build/web/WEB-INF/classes/model/UserBean.class b/build/web/WEB-INF/classes/model/UserBean.class new file mode 100644 index 00000000..bfaa26e1 Binary files /dev/null and b/build/web/WEB-INF/classes/model/UserBean.class differ diff --git a/build/web/WEB-INF/classes/model/jjhj.class b/build/web/WEB-INF/classes/model/jjhj.class new file mode 100644 index 00000000..60fdee2a Binary files /dev/null and b/build/web/WEB-INF/classes/model/jjhj.class differ diff --git a/build/web/WEB-INF/classes/resource/person.png b/build/web/WEB-INF/classes/resource/person.png new file mode 100644 index 00000000..e4ba27cf Binary files /dev/null and b/build/web/WEB-INF/classes/resource/person.png differ diff --git a/build/web/WEB-INF/classes/resource/simple_blog_2.sql b/build/web/WEB-INF/classes/resource/simple_blog_2.sql new file mode 100644 index 00000000..83654eee --- /dev/null +++ b/build/web/WEB-INF/classes/resource/simple_blog_2.sql @@ -0,0 +1,113 @@ +-- phpMyAdmin SQL Dump +-- version 4.2.7.1 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Generation Time: Nov 26, 2014 at 03:23 AM +-- Server version: 5.6.20 +-- PHP Version: 5.5.15 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `simple_blog_2` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `entries` +-- + +CREATE TABLE IF NOT EXISTS `entries` ( +`PID` int(11) NOT NULL, + `JUDUL` text NOT NULL, + `TANGGAL` date NOT NULL, + `KONTEN` text NOT NULL, + `PUBLISHED` tinyint(1) NOT NULL, + `AUTHOR` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `entries` +-- + +INSERT INTO `entries` (`PID`, `JUDUL`, `TANGGAL`, `KONTEN`, `PUBLISHED`, `AUTHOR`) VALUES +(1, 'Everything You Need to Know About Grunt', '2014-11-25', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 1, 'blah blah'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `komentar` +-- + +CREATE TABLE IF NOT EXISTS `komentar` ( + `PID` int(11) NOT NULL, +`KID` int(11) NOT NULL, + `NAMA` varchar(50) NOT NULL, + `EMAIL` varchar(50) NOT NULL, + `TANGGAL` date NOT NULL, + `KOMENTAR` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `USERNAME` varchar(20) NOT NULL, + `PASSWORD` varchar(20) NOT NULL, + `ROLE` int(11) NOT NULL, + `EMAIL` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO `user` (`USERNAME`, `PASSWORD`, `ROLE`, `EMAIL`) VALUES +('budi', 'kuyup_hujan', '2', 'budi@kecil.co.id'); +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `entries` +-- +ALTER TABLE `entries` + ADD PRIMARY KEY (`PID`), ADD UNIQUE KEY `PID` (`PID`); + +-- +-- Indexes for table `komentar` +-- +ALTER TABLE `komentar` + ADD PRIMARY KEY (`KID`), ADD UNIQUE KEY `KID` (`KID`); + +-- +-- Indexes for table `user` +-- +ALTER TABLE `user` + ADD PRIMARY KEY (`USERNAME`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `entries` +-- +ALTER TABLE `entries` +MODIFY `PID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; +-- +-- AUTO_INCREMENT for table `komentar` +-- +ALTER TABLE `komentar` +MODIFY `KID` int(11) NOT NULL AUTO_INCREMENT; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/build/web/WEB-INF/classes/validator/EmailValidator.class b/build/web/WEB-INF/classes/validator/EmailValidator.class new file mode 100644 index 00000000..e768aa55 Binary files /dev/null and b/build/web/WEB-INF/classes/validator/EmailValidator.class differ diff --git a/build/web/WEB-INF/classes/validator/PasswordValidator.class b/build/web/WEB-INF/classes/validator/PasswordValidator.class new file mode 100644 index 00000000..b2dd34df Binary files /dev/null and b/build/web/WEB-INF/classes/validator/PasswordValidator.class differ diff --git a/build/web/WEB-INF/classes/validator/UsernameValidator.class b/build/web/WEB-INF/classes/validator/UsernameValidator.class new file mode 100644 index 00000000..f3adb5cb Binary files /dev/null and b/build/web/WEB-INF/classes/validator/UsernameValidator.class differ diff --git a/build/web/WEB-INF/faces-config.xml b/build/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..ca506aa9 --- /dev/null +++ b/build/web/WEB-INF/faces-config.xml @@ -0,0 +1,74 @@ + + + + userBean + model.UserBean + session + + + Post + model.Post + request + + + NavigationController + model.NavigationController + request + + + ListPost + model.ListPost + request + + + loginBean + model.LoginBean + request + + user + model.UserBean + #{userBean} + + + + allUserBean + model.AllUserBean + request + + + editUserBean + model.EditUserBean + request + + + addUserBean + model.AddUserBean + request + + + usernameValidator + validator.UsernameValidator + + + passwordValidator + validator.PasswordValidator + + + emailValidator + validator.EmailValidator + + + komentar + model.Komentar + request + + + deleteUserBean + model.DeleteUserBean + request + + + \ No newline at end of file diff --git a/build/web/WEB-INF/glassfish-web.xml b/build/web/WEB-INF/glassfish-web.xml new file mode 100644 index 00000000..4f5a531d --- /dev/null +++ b/build/web/WEB-INF/glassfish-web.xml @@ -0,0 +1,11 @@ + + + + /Simple_Blog + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/build/web/WEB-INF/lib/._mysql-connector-java-5.1.23-bin.jar5489273015966658315.tmp b/build/web/WEB-INF/lib/._mysql-connector-java-5.1.23-bin.jar5489273015966658315.tmp new file mode 100644 index 00000000..1f904143 Binary files /dev/null and b/build/web/WEB-INF/lib/._mysql-connector-java-5.1.23-bin.jar5489273015966658315.tmp differ diff --git a/build/web/WEB-INF/lib/javaee-web-api-7.0.jar b/build/web/WEB-INF/lib/javaee-web-api-7.0.jar new file mode 100644 index 00000000..c90828fb Binary files /dev/null and b/build/web/WEB-INF/lib/javaee-web-api-7.0.jar differ diff --git a/build/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar b/build/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar new file mode 100644 index 00000000..dd2585e0 Binary files /dev/null and b/build/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar differ diff --git a/build/web/WEB-INF/sun-web.xml b/build/web/WEB-INF/sun-web.xml new file mode 100644 index 00000000..1ac7af40 --- /dev/null +++ b/build/web/WEB-INF/sun-web.xml @@ -0,0 +1,11 @@ + + + + + + + Keep a copy of the generated servlet class' java code. + + + + diff --git a/build/web/WEB-INF/web.xml b/build/web/WEB-INF/web.xml new file mode 100644 index 00000000..2fb929e5 --- /dev/null +++ b/build/web/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + AuthenticationFilter + filter.AuthenticationFilter + + + AuthenticationFilter + /faces/* + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/build/web/css/blog-old-ie.css b/build/web/css/blog-old-ie.css new file mode 100644 index 00000000..73ef4587 --- /dev/null +++ b/build/web/css/blog-old-ie.css @@ -0,0 +1,191 @@ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +a { + text-decoration: none; + color: rgb(61, 146, 201); +} + +a:hover, +a:focus { + text-decoration: underline; +} + +h3 { + font-weight: 100; +} + +/* LAYOUT CSS */ + +.pure-img-responsive { + max-width: 100%; + height: auto; +} + +#layout { + padding: 0; +} + +.header { + text-align: center; + top: auto; + margin: 3em auto; +} + +.sidebar { + background: rgb(61, 79, 93); + color: #fff; +} + +.brand-title, +.brand-tagline { + margin: 0; +} + +.brand-title { + text-transform: uppercase; +} + +.brand-tagline { + font-weight: 300; + color: rgb(176, 202, 219); +} + +.nav-list { + margin: 0; + padding: 0; + list-style: none; +} + +.nav-item { + display: inline-block; + *display: inline; + zoom: 1; +} + +.nav-item a { + background: transparent; + border: 2px solid rgb(176, 202, 219); + color: #fff; + margin-top: 1em; + letter-spacing: 0.05em; + text-transform: uppercase; + font-size: 85%; +} + +.nav-item a:hover, +.nav-item a:focus { + border: 2px solid rgb(61, 146, 201); + text-decoration: none; +} + +.content-subhead { + text-transform: uppercase; + color: #aaa; + border-bottom: 1px solid #eee; + padding: 0.4em 0; + font-size: 80%; + font-weight: 500; + letter-spacing: 0.1em; +} + +.content { + padding: 2em 1em 0; +} + +.post { + padding-bottom: 2em; +} + +.post-title { + font-size: 2em; + color: #222; + margin-bottom: 0.2em; +} + +.post-avatar { + border-radius: 50px; + float: right; + margin-left: 1em; +} + +.post-description { + font-family: Georgia, "Cambria", serif; + color: #444; + line-height: 1.8em; +} + +.post-meta { + color: #999; + font-size: 90%; + margin: 0; +} + +.post-category { + margin: 0 0.1em; + padding: 0.3em 1em; + color: #fff; + background: #999; + font-size: 80%; +} + +.post-category-design { + background: #5aba59; +} + +.post-category-pure { + background: #4d85d1; +} + +.post-category-yui { + background: #8156a7; +} + +.post-category-js { + background: #df2d4f; +} + +.post-images { + margin: 1em 0; +} + +.post-image-meta { + margin-top: -3.5em; + margin-left: 1em; + color: #fff; + text-shadow: 0 1px 1px #333; +} + +.footer { + text-align: center; + padding: 1em 0; +} + +.footer a { + color: #ccc; + font-size: 80%; +} + +.footer .pure-menu a:hover, +.footer .pure-menu a:focus { + background: none; +} + +.content { + padding: 2em 3em 0; + margin-left: 25%; +} + +.header { + margin: 80% 2em 0; + text-align: right; +} + +.sidebar { + position: fixed; + top: 0; + bottom: 0; +} \ No newline at end of file diff --git a/build/web/css/blog.css b/build/web/css/blog.css new file mode 100644 index 00000000..a5ab86aa --- /dev/null +++ b/build/web/css/blog.css @@ -0,0 +1,517 @@ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +a { + text-decoration: none; + color: rgb(61, 146, 201); +} +a:hover, +a:focus { + text-decoration: underline; +} + +h3 { + font-weight: 100; +} + +/* LAYOUT CSS */ +.pure-img-responsive { + max-width: 100%; + height: auto; +} + +#layout { + padding: 0; +} + +.header { + text-align: center; + top: auto; + margin: 3em auto; + width: 300px; +} + +.upper-menu { + margin-left: 600px; + height: 80px; + font-size: 14px; +} + +.upper-menu .pure-button { + background: rgb(61, 79, 93) !important; + color: white; + margin-left: 10px; +} + +.upper-menu .img-role { + border-radius: 20px; + margin-left: 10px; +} +.sidebar { + background: rgb(61, 79, 93); + color: #fff; +} + +.brand-title, +.brand-tagline { + margin: 0; +} +.brand-title { + text-transform: uppercase; +} +.brand-tagline { + font-weight: 300; + color: rgb(176, 202, 219); +} + +.nav-list { + margin: 0; + padding: 0; + list-style: none; +} +.nav-item { + display: inline-block; + *display: inline; + zoom: 1; +} +.nav-item img { + display: block; +} +.nav-item a { + background: transparent; + border: 2px solid rgb(176, 202, 219); + color: #fff; + letter-spacing: 0.05em; + text-transform: uppercase; + font-size: 85%; +} +.nav-item a:hover, +.nav-item a:focus { + border: 2px solid rgb(61, 146, 201); + text-decoration: none; +} + +.content-subhead { + text-transform: uppercase; + color: #aaa; + border-bottom: 1px solid #eee; + padding: 0.4em 0; + font-size: 80%; + font-weight: 500; + letter-spacing: 0.1em; +} + +.content { + padding: 2em 1em 0; + height: auto; + min-height: 100%; + margin: 0 auto -50px; +} +.posts { + padding-left: 1cm; +} + +.post { + padding-bottom: 2em; +} +.post-title { + font-size: 2em; + color: #222; + margin-bottom: 0.2em; +} +.post-avatar { + border-radius: 50px; + float: right; + margin-left: 1em; +} +.post-description { + font-family: Georgia, "Cambria", serif; + color: #444; + line-height: 1.8em; +} +.post-meta { + color: #999; + font-size: 90%; + margin: 0; +} + +.post-category { + margin: 0 0.1em; + padding: 0.3em 1em; + color: #fff; + background: #999; + font-size: 80%; +} +.post-category-design { + background: #5aba59; +} +.post-category-pure { + background: #4d85d1; +} +.post-category-yui { + background: #8156a7; +} +.post-category-js { + background: #df2d4f; +} + +.post-images { + margin: 1em 0; +} +.post-image-meta { + margin-top: -3.5em; + margin-left: 1em; + color: #fff; + text-shadow: 0 1px 1px #333; +} + +.footer { + text-align: center; + padding: 1em 0; + height: 50px; +} +.footer a { + color: #ccc; + font-size: 80%; +} +.footer .pure-menu a:hover, +.footer .pure-menu a:focus { + background: none; +} +/* HORIZONTAL MENU CODE */ + +/* Initial menus should be inline-block so that they are horizontal */ +.pure-menu-horizontal li { + display: inline-block; + *display: inline; + zoom: 1; + vertical-align: middle; + margin-left: 20px; +} + +/* Submenus should still be display: block; */ +.pure-menu-horizontal li li { + display: block; +} + +/* Content after should be down arrow */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label:after { + content: "\25BE"; +} +/*Add extra padding to elements that have the arrow so that the hover looks nice */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label { + padding-right: 30px; +} + +/* Adjusting separator for vertical menus */ +.pure-menu-horizontal li.pure-menu-separator { + height: 50%; + width: 1px; + margin: 0 7px; +} + +/* Submenus should be horizontal separator again */ +.pure-menu-horizontal li li.pure-menu-separator { + height: 1px; + width: auto; + margin: 7px 2px; +} + + +/*csslint adjoining-classes:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + +/* MAIN MENU STYLING */ +.pure-menu-horizontal{ + margin-left: 300px; +} + +.pure-menu.pure-menu-open, +.pure-menu.pure-menu-horizontal li .pure-menu-children { + background: #fff; /* Old browsers */ + border: 1px solid #b7b7b7; +} + +/* remove borders for horizontal menus */ +.pure-menu.pure-menu-horizontal, +.pure-menu.pure-menu-horizontal .pure-menu-heading { + border: none; +} + + +/*Button*/ +.pure-button { + /* Structure */ + display: inline-block; + *display: inline; /*IE 6/7*/ + zoom: 1; + line-height: normal; + white-space: nowrap; + vertical-align: baseline; + text-align: center; + cursor: pointer; + -webkit-user-drag: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + + +.pure-button { + font-family: inherit; + font-size: 100%; + *font-size: 90%; /*IE 6/7 - To reduce IE's oversized button text*/ + *overflow: visible; /*IE 6/7 - Because of IE's overly large left/right padding on buttons */ + padding: 0.5em 1em; + color: #444; /* rgba not supported (IE 8) */ + color: rgba(0, 0, 0, 0.80); /* rgba supported */ + *color: #444; /* IE 6 & 7 */ + border: 1px solid #999; /*IE 6/7/8*/ + border: none rgba(0, 0, 0, 0); /*IE9 + everything else*/ + background-color: #E6E6E6; + text-decoration: none; + border-radius: 2px; +} + +.pure-button-hover, +.pure-button:hover, +.pure-button:focus { + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000',GradientType=0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); + background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); + background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); +} +.pure-button:focus { + outline: 0; +} +.pure-button-active, +.pure-button:active { + box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset; +} + +.pure-button[disabled], +.pure-button-disabled, +.pure-button-disabled:hover, +.pure-button-disabled:focus, +.pure-button-disabled:active { + border: none; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + filter: alpha(opacity=40); + -khtml-opacity: 0.40; + -moz-opacity: 0.40; + opacity: 0.40; + cursor: not-allowed; + box-shadow: none; +} + +.pure-button-hidden { + display: none; +} + +/* Firefox: Get rid of the inner focus border */ +.pure-button::-moz-focus-inner{ + padding: 0; + border: 0; +} + +/** FORM **/ + +.pure-form input[type="text"], +.pure-form input[type="password"], +.pure-form input[type="email"], +.pure-form input[type="url"], +.pure-form input[type="date"], +.pure-form input[type="month"], +.pure-form input[type="time"], +.pure-form input[type="datetime"], +.pure-form input[type="datetime-local"], +.pure-form input[type="week"], +.pure-form input[type="number"], +.pure-form input[type="search"], +.pure-form input[type="tel"], +.pure-form input[type="color"], +.pure-form select, +.pure-form textarea { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]) { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + + +/* Chrome (as of v.32/34 on OS X) needs additional room for color to display. */ +/* May be able to remove this tweak as color inputs become more standardized across browsers. */ +.pure-form input[type="color"] { + padding: 0.2em 0.5em; +} + + +.pure-form input[type="text"]:focus, +.pure-form input[type="password"]:focus, +.pure-form input[type="email"]:focus, +.pure-form input[type="url"]:focus, +.pure-form input[type="date"]:focus, +.pure-form input[type="month"]:focus, +.pure-form input[type="time"]:focus, +.pure-form input[type="datetime"]:focus, +.pure-form input[type="datetime-local"]:focus, +.pure-form input[type="week"]:focus, +.pure-form input[type="number"]:focus, +.pure-form input[type="search"]:focus, +.pure-form input[type="tel"]:focus, +.pure-form input[type="color"]:focus, +.pure-form select:focus, +.pure-form textarea:focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]):focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +.pure-form input[type="file"]:focus, +.pure-form input[type="radio"]:focus, +.pure-form input[type="checkbox"]:focus { + outline: thin dotted #333; + outline: 1px auto #129FEA; +} +.pure-form .pure-checkbox, +.pure-form .pure-radio { + margin: 0.5em 0; + display: block; +} + +.pure-form input[type="text"][disabled], +.pure-form input[type="password"][disabled], +.pure-form input[type="email"][disabled], +.pure-form input[type="url"][disabled], +.pure-form input[type="date"][disabled], +.pure-form input[type="month"][disabled], +.pure-form input[type="time"][disabled], +.pure-form input[type="datetime"][disabled], +.pure-form input[type="datetime-local"][disabled], +.pure-form input[type="week"][disabled], +.pure-form input[type="number"][disabled], +.pure-form input[type="search"][disabled], +.pure-form input[type="tel"][disabled], +.pure-form input[type="color"][disabled], +.pure-form select[disabled], +.pure-form textarea[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type])[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} +.pure-form input[readonly], +.pure-form select[readonly], +.pure-form textarea[readonly] { + background: #eee; /* menu hover bg color */ + color: #777; /* menu text color */ + border-color: #ccc; +} + +.pure-form input:focus:invalid, +.pure-form textarea:focus:invalid, +.pure-form select:focus:invalid { + color: #b94a48; + border-color: #ee5f5b; +} +.pure-form input:focus:invalid:focus, +.pure-form textarea:focus:invalid:focus, +.pure-form select:focus:invalid:focus { + border-color: #e9322d; +} +.pure-form input[type="file"]:focus:invalid:focus, +.pure-form input[type="radio"]:focus:invalid:focus, +.pure-form input[type="checkbox"]:focus:invalid:focus { + outline-color: #e9322d; +} +.pure-form select { + border: 1px solid #ccc; + background-color: white; +} +.pure-form select[multiple] { + height: auto; +} +.pure-form label { + margin: 0.5em 0 0.2em; +} +.pure-form fieldset { + margin: 0; + padding: 0.35em 0 0.75em; + border: 0; +} +.pure-form legend { + display: block; + width: 100%; + padding: 0.3em 0; + margin-bottom: 0.3em; + color: #333; + border-bottom: 1px solid #e5e5e5; +} + +.komentar{ + padding-left: 20px; +} + +@media(min-width: 48em) { + .content { + padding: 2em 3em 0; + margin-left: 25%; + padding-left: 2cm; + } + + .header { + margin: 80% 2em 0; + text-align: right; + } + + .sidebar { + position: fixed; + top: 0; + bottom: 0; + } +} diff --git a/build/web/css/pure.css b/build/web/css/pure.css new file mode 100644 index 00000000..abe7598a --- /dev/null +++ b/build/web/css/pure.css @@ -0,0 +1,1664 @@ +/*! +Pure v0.5.0 +Copyright 2014 Yahoo! Inc. All rights reserved. +Licensed under the BSD License. +https://github.com/yui/pure/blob/master/LICENSE.md +*/ +/*! +normalize.css v1.1.3 | MIT License | git.io/normalize +Copyright (c) Nicolas Gallagher and Jonathan Neal +*/ +/*! normalize.css v1.1.3 | MIT License | git.io/normalize */ + +/* ========================================================================== + HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. + * Known issue: no IE 6 support. + */ + +[hidden] { + display: none; +} + +/* ========================================================================== + Base + ========================================================================== */ + +/** + * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using + * `em` units. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-size: 100%; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Address `font-family` inconsistency between `textarea` and other form + * elements. + */ + +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} + +/** + * Address margins handled incorrectly in IE 6/7. + */ + +body { + margin: 0; +} + +/* ========================================================================== + Links + ========================================================================== */ + +/** + * Address `outline` inconsistency between Chrome and other browsers. + */ + +a:focus { + outline: thin dotted; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* ========================================================================== + Typography + ========================================================================== */ + +/** + * Address font sizes and margins set differently in IE 6/7. + * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, + * and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} + +h3 { + font-size: 1.17em; + margin: 1em 0; +} + +h4 { + font-size: 1em; + margin: 1.33em 0; +} + +h5 { + font-size: 0.83em; + margin: 1.67em 0; +} + +h6 { + font-size: 0.67em; + margin: 2.33em 0; +} + +/** + * Address styling not present in IE 7/8/9, Safari 5, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +blockquote { + margin: 1em 40px; +} + +/** + * Address styling not present in Safari 5 and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address differences between Firefox and other browsers. + * Known issue: no IE 6/7 normalization. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Address styling not present in IE 6/7/8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address margins set differently in IE 6/7. + */ + +p, +pre { + margin: 1em 0; +} + +/** + * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; +} + +/** + * Improve readability of pre-formatted text in all browsers. + */ + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +/** + * Address CSS quotes not supported in IE 6/7. + */ + +q { + quotes: none; +} + +/** + * Address `quotes` property not supported in Safari 4. + */ + +q:before, +q:after { + content: ''; + content: none; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* ========================================================================== + Lists + ========================================================================== */ + +/** + * Address margins set differently in IE 6/7. + */ + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +/** + * Address paddings set differently in IE 6/7. + */ + +menu, +ol, +ul { + padding: 0 0 0 40px; +} + +/** + * Correct list images handled incorrectly in IE 7. + */ + +nav ul, +nav ol { + list-style: none; + list-style-image: none; +} + +/* ========================================================================== + Embedded content + ========================================================================== */ + +/** + * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. + * 2. Improve image quality when scaled in IE 7. + */ + +img { + border: 0; /* 1 */ + -ms-interpolation-mode: bicubic; /* 2 */ +} + +/** + * Correct overflow displayed oddly in IE 9. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* ========================================================================== + Figures + ========================================================================== */ + +/** + * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. + */ + +figure { + margin: 0; +} + +/* ========================================================================== + Forms + ========================================================================== */ + +/** + * Correct margin displayed oddly in IE 6/7. + */ + +form { + margin: 0; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct color not being inherited in IE 6/7/8/9. + * 2. Correct text not wrapping in Firefox 3. + * 3. Correct alignment displayed oddly in IE 6/7. + */ + +legend { + border: 0; /* 1 */ + padding: 0; + white-space: normal; /* 2 */ + *margin-left: -7px; /* 3 */ +} + +/** + * 1. Correct font size not being inherited in all browsers. + * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, + * and Chrome. + * 3. Improve appearance and consistency in all browsers. + */ + +button, +input, +select, +textarea { + font-size: 100%; /* 1 */ + margin: 0; /* 2 */ + vertical-align: baseline; /* 3 */ + *vertical-align: middle; /* 3 */ +} + +/** + * Address Firefox 3+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +button, +input { + line-height: normal; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. + * Correct `select` style inheritance in Firefox 4+ and Opera. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + * 4. Remove inner spacing in IE 7 without affecting normal text inputs. + * Known issue: inner spacing remains in IE 6. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ + *overflow: visible; /* 4 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * 1. Address box sizing set to content-box in IE 8/9. + * 2. Remove excess padding in IE 8/9. + * 3. Remove excess padding in IE 7. + * Known issue: excess padding remains in IE 6. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + *height: 13px; /* 3 */ + *width: 13px; /* 3 */ +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari 5 and Chrome + * on OS X. + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Remove inner padding and border in Firefox 3+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * 1. Remove default vertical scrollbar in IE 6/7/8/9. + * 2. Improve readability and alignment in all browsers. + */ + +textarea { + overflow: auto; /* 1 */ + vertical-align: top; /* 2 */ +} + +/* ========================================================================== + Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +/*csslint important:false*/ + +/* ========================================================================== + Pure Base Extras + ========================================================================== */ + +/** + * Extra rules that Pure adds on top of Normalize.css + */ + +/** + * Always hide an element when it has the `hidden` HTML attribute. + */ + +[hidden] { + display: none !important; +} + +/** + * Add this class to an image to make it fit within it's fluid parent wrapper while maintaining + * aspect ratio. + */ +.pure-img { + max-width: 100%; + height: auto; + display: block; +} + +/*csslint regex-selectors:false, known-properties:false, duplicate-properties:false*/ + +.pure-g { + letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ + *letter-spacing: normal; /* reset IE < 8 */ + *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ + text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ + + /* + Sets the font stack to fonts known to work properly with the above letter + and word spacings. See: https://github.com/yui/pure/issues/41/ + + The following font stack makes Pure Grids work on all known environments. + + * FreeSans: Ships with many Linux distros, including Ubuntu + + * Arimo: Ships with Chrome OS. Arimo has to be defined before Helvetica and + Arial to get picked up by the browser, even though neither is available + in Chrome OS. + + * Droid Sans: Ships with all versions of Android. + + * Helvetica, Arial, sans-serif: Common font stack on OS X and Windows. + */ + font-family: FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; + + /* + Use flexbox when possible to avoid `letter-spacing` side-effects. + + NOTE: Firefox (as of 25) does not currently support flex-wrap, so the + `-moz-` prefix version is omitted. + */ + + display: -webkit-flex; + -webkit-flex-flow: row wrap; + + /* IE10 uses display: flexbox */ + display: -ms-flexbox; + -ms-flex-flow: row wrap; +} + +/* Opera as of 12 on Windows needs word-spacing. + The ".opera-only" selector is used to prevent actual prefocus styling + and is not required in markup. +*/ +.opera-only :-o-prefocus, +.pure-g { + word-spacing: -0.43em; +} + +.pure-u { + display: inline-block; + *display: inline; /* IE < 8: fake inline-block */ + zoom: 1; + letter-spacing: normal; + word-spacing: normal; + vertical-align: top; + text-rendering: auto; +} + +/* +Resets the font family back to the OS/browser's default sans-serif font, +this the same font stack that Normalize.css sets for the `body`. +*/ +.pure-g [class *= "pure-u"] { + font-family: sans-serif; +} + +.pure-u-1, +.pure-u-1-1, +.pure-u-1-2, +.pure-u-1-3, +.pure-u-2-3, +.pure-u-1-4, +.pure-u-3-4, +.pure-u-1-5, +.pure-u-2-5, +.pure-u-3-5, +.pure-u-4-5, +.pure-u-5-5, +.pure-u-1-6, +.pure-u-5-6, +.pure-u-1-8, +.pure-u-3-8, +.pure-u-5-8, +.pure-u-7-8, +.pure-u-1-12, +.pure-u-5-12, +.pure-u-7-12, +.pure-u-11-12, +.pure-u-1-24, +.pure-u-2-24, +.pure-u-3-24, +.pure-u-4-24, +.pure-u-5-24, +.pure-u-6-24, +.pure-u-7-24, +.pure-u-8-24, +.pure-u-9-24, +.pure-u-10-24, +.pure-u-11-24, +.pure-u-12-24, +.pure-u-13-24, +.pure-u-14-24, +.pure-u-15-24, +.pure-u-16-24, +.pure-u-17-24, +.pure-u-18-24, +.pure-u-19-24, +.pure-u-20-24, +.pure-u-21-24, +.pure-u-22-24, +.pure-u-23-24, +.pure-u-24-24 { + display: inline-block; + *display: inline; + zoom: 1; + letter-spacing: normal; + word-spacing: normal; + vertical-align: top; + text-rendering: auto; +} + +.pure-u-1-24 { + width: 4.1667%; + *width: 4.1357%; +} + +.pure-u-1-12, +.pure-u-2-24 { + width: 8.3333%; + *width: 8.3023%; +} + +.pure-u-1-8, +.pure-u-3-24 { + width: 12.5000%; + *width: 12.4690%; +} + +.pure-u-1-6, +.pure-u-4-24 { + width: 16.6667%; + *width: 16.6357%; +} + +.pure-u-1-5 { + width: 20%; + *width: 19.9690%; +} + +.pure-u-5-24 { + width: 20.8333%; + *width: 20.8023%; +} + +.pure-u-1-4, +.pure-u-6-24 { + width: 25%; + *width: 24.9690%; +} + +.pure-u-7-24 { + width: 29.1667%; + *width: 29.1357%; +} + +.pure-u-1-3, +.pure-u-8-24 { + width: 33.3333%; + *width: 33.3023%; +} + +.pure-u-3-8, +.pure-u-9-24 { + width: 37.5000%; + *width: 37.4690%; +} + +.pure-u-2-5 { + width: 40%; + *width: 39.9690%; +} + +.pure-u-5-12, +.pure-u-10-24 { + width: 41.6667%; + *width: 41.6357%; +} + +.pure-u-11-24 { + width: 45.8333%; + *width: 45.8023%; +} + +.pure-u-1-2, +.pure-u-12-24 { + width: 50%; + *width: 49.9690%; +} + +.pure-u-13-24 { + width: 54.1667%; + *width: 54.1357%; +} + +.pure-u-7-12, +.pure-u-14-24 { + width: 58.3333%; + *width: 58.3023%; +} + +.pure-u-3-5 { + width: 60%; + *width: 59.9690%; +} + +.pure-u-5-8, +.pure-u-15-24 { + width: 62.5000%; + *width: 62.4690%; +} + +.pure-u-2-3, +.pure-u-16-24 { + width: 66.6667%; + *width: 66.6357%; +} + +.pure-u-17-24 { + width: 70.8333%; + *width: 70.8023%; +} + +.pure-u-3-4, +.pure-u-18-24 { + width: 75%; + *width: 74.9690%; +} + +.pure-u-19-24 { + width: 79.1667%; + *width: 79.1357%; +} + +.pure-u-4-5 { + width: 80%; + *width: 79.9690%; +} + +.pure-u-5-6, +.pure-u-20-24 { + width: 83.3333%; + *width: 83.3023%; +} + +.pure-u-7-8, +.pure-u-21-24 { + width: 87.5000%; + *width: 87.4690%; +} + +.pure-u-11-12, +.pure-u-22-24 { + width: 91.6667%; + *width: 91.6357%; +} + +.pure-u-23-24 { + width: 95.8333%; + *width: 95.8023%; +} + +.pure-u-1, +.pure-u-1-1, +.pure-u-5-5, +.pure-u-24-24 { + width: 100%; +} +.pure-button { + /* Structure */ + display: inline-block; + *display: inline; /*IE 6/7*/ + zoom: 1; + line-height: normal; + white-space: nowrap; + vertical-align: baseline; + text-align: center; + cursor: pointer; + -webkit-user-drag: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* Firefox: Get rid of the inner focus border */ +.pure-button::-moz-focus-inner { + padding: 0; + border: 0; +} + +/*csslint outline-none:false*/ + +.pure-button { + font-family: inherit; + font-size: 100%; + *font-size: 90%; /*IE 6/7 - To reduce IE's oversized button text*/ + *overflow: visible; /*IE 6/7 - Because of IE's overly large left/right padding on buttons */ + padding: 0.5em 1em; + color: #444; /* rgba not supported (IE 8) */ + color: rgba(0, 0, 0, 0.80); /* rgba supported */ + *color: #444; /* IE 6 & 7 */ + border: 1px solid #999; /*IE 6/7/8*/ + border: none rgba(0, 0, 0, 0); /*IE9 + everything else*/ + background-color: #E6E6E6; + text-decoration: none; + border-radius: 2px; +} + +.pure-button-hover, +.pure-button:hover, +.pure-button:focus { + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000',GradientType=0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); + background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); + background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); +} +.pure-button:focus { + outline: 0; +} +.pure-button-active, +.pure-button:active { + box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset; +} + +.pure-button[disabled], +.pure-button-disabled, +.pure-button-disabled:hover, +.pure-button-disabled:focus, +.pure-button-disabled:active { + border: none; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + filter: alpha(opacity=40); + -khtml-opacity: 0.40; + -moz-opacity: 0.40; + opacity: 0.40; + cursor: not-allowed; + box-shadow: none; +} + +.pure-button-hidden { + display: none; +} + +/* Firefox: Get rid of the inner focus border */ +.pure-button::-moz-focus-inner{ + padding: 0; + border: 0; +} + +.pure-button-primary, +.pure-button-selected, +a.pure-button-primary, +a.pure-button-selected { + background-color: rgb(0, 120, 231); + color: #fff; +} + +.pure-form input[type="text"], +.pure-form input[type="password"], +.pure-form input[type="email"], +.pure-form input[type="url"], +.pure-form input[type="date"], +.pure-form input[type="month"], +.pure-form input[type="time"], +.pure-form input[type="datetime"], +.pure-form input[type="datetime-local"], +.pure-form input[type="week"], +.pure-form input[type="number"], +.pure-form input[type="search"], +.pure-form input[type="tel"], +.pure-form input[type="color"], +.pure-form select, +.pure-form textarea { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]) { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + + +/* Chrome (as of v.32/34 on OS X) needs additional room for color to display. */ +/* May be able to remove this tweak as color inputs become more standardized across browsers. */ +.pure-form input[type="color"] { + padding: 0.2em 0.5em; +} + + +.pure-form input[type="text"]:focus, +.pure-form input[type="password"]:focus, +.pure-form input[type="email"]:focus, +.pure-form input[type="url"]:focus, +.pure-form input[type="date"]:focus, +.pure-form input[type="month"]:focus, +.pure-form input[type="time"]:focus, +.pure-form input[type="datetime"]:focus, +.pure-form input[type="datetime-local"]:focus, +.pure-form input[type="week"]:focus, +.pure-form input[type="number"]:focus, +.pure-form input[type="search"]:focus, +.pure-form input[type="tel"]:focus, +.pure-form input[type="color"]:focus, +.pure-form select:focus, +.pure-form textarea:focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]):focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +.pure-form input[type="file"]:focus, +.pure-form input[type="radio"]:focus, +.pure-form input[type="checkbox"]:focus { + outline: thin dotted #333; + outline: 1px auto #129FEA; +} +.pure-form .pure-checkbox, +.pure-form .pure-radio { + margin: 0.5em 0; + display: block; +} + +.pure-form input[type="text"][disabled], +.pure-form input[type="password"][disabled], +.pure-form input[type="email"][disabled], +.pure-form input[type="url"][disabled], +.pure-form input[type="date"][disabled], +.pure-form input[type="month"][disabled], +.pure-form input[type="time"][disabled], +.pure-form input[type="datetime"][disabled], +.pure-form input[type="datetime-local"][disabled], +.pure-form input[type="week"][disabled], +.pure-form input[type="number"][disabled], +.pure-form input[type="search"][disabled], +.pure-form input[type="tel"][disabled], +.pure-form input[type="color"][disabled], +.pure-form select[disabled], +.pure-form textarea[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type])[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} +.pure-form input[readonly], +.pure-form select[readonly], +.pure-form textarea[readonly] { + background: #eee; /* menu hover bg color */ + color: #777; /* menu text color */ + border-color: #ccc; +} + +.pure-form input:focus:invalid, +.pure-form textarea:focus:invalid, +.pure-form select:focus:invalid { + color: #b94a48; + border-color: #ee5f5b; +} +.pure-form input:focus:invalid:focus, +.pure-form textarea:focus:invalid:focus, +.pure-form select:focus:invalid:focus { + border-color: #e9322d; +} +.pure-form input[type="file"]:focus:invalid:focus, +.pure-form input[type="radio"]:focus:invalid:focus, +.pure-form input[type="checkbox"]:focus:invalid:focus { + outline-color: #e9322d; +} +.pure-form select { + border: 1px solid #ccc; + background-color: white; +} +.pure-form select[multiple] { + height: auto; +} +.pure-form label { + margin: 0.5em 0 0.2em; +} +.pure-form fieldset { + margin: 0; + padding: 0.35em 0 0.75em; + border: 0; +} +.pure-form legend { + display: block; + width: 100%; + padding: 0.3em 0; + margin-bottom: 0.3em; + color: #333; + border-bottom: 1px solid #e5e5e5; +} + +.pure-form-stacked input[type="text"], +.pure-form-stacked input[type="password"], +.pure-form-stacked input[type="email"], +.pure-form-stacked input[type="url"], +.pure-form-stacked input[type="date"], +.pure-form-stacked input[type="month"], +.pure-form-stacked input[type="time"], +.pure-form-stacked input[type="datetime"], +.pure-form-stacked input[type="datetime-local"], +.pure-form-stacked input[type="week"], +.pure-form-stacked input[type="number"], +.pure-form-stacked input[type="search"], +.pure-form-stacked input[type="tel"], +.pure-form-stacked input[type="color"], +.pure-form-stacked select, +.pure-form-stacked label, +.pure-form-stacked textarea { + display: block; + margin: 0.25em 0; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form-stacked input:not([type]) { + display: block; + margin: 0.25em 0; +} +.pure-form-aligned input, +.pure-form-aligned textarea, +.pure-form-aligned select, +/* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ +.pure-form-aligned .pure-help-inline, +.pure-form-message-inline { + display: inline-block; + *display: inline; + *zoom: 1; + vertical-align: middle; +} +.pure-form-aligned textarea { + vertical-align: top; +} + +/* Aligned Forms */ +.pure-form-aligned .pure-control-group { + margin-bottom: 0.5em; +} +.pure-form-aligned .pure-control-group label { + text-align: right; + display: inline-block; + vertical-align: middle; + width: 10em; + margin: 0 1em 0 0; +} +.pure-form-aligned .pure-controls { + margin: 1.5em 0 0 10em; +} + +/* Rounded Inputs */ +.pure-form input.pure-input-rounded, +.pure-form .pure-input-rounded { + border-radius: 2em; + padding: 0.5em 1em; +} + +/* Grouped Inputs */ +.pure-form .pure-group fieldset { + margin-bottom: 10px; +} +.pure-form .pure-group input { + display: block; + padding: 10px; + margin: 0; + border-radius: 0; + position: relative; + top: -1px; +} +.pure-form .pure-group input:focus { + z-index: 2; +} +.pure-form .pure-group input:first-child { + top: 1px; + border-radius: 4px 4px 0 0; +} +.pure-form .pure-group input:last-child { + top: -2px; + border-radius: 0 0 4px 4px; +} +.pure-form .pure-group button { + margin: 0.35em 0; +} + +.pure-form .pure-input-1 { + width: 100%; +} +.pure-form .pure-input-2-3 { + width: 66%; +} +.pure-form .pure-input-1-2 { + width: 50%; +} +.pure-form .pure-input-1-3 { + width: 33%; +} +.pure-form .pure-input-1-4 { + width: 25%; +} + +/* Inline help for forms */ +/* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ +.pure-form .pure-help-inline, +.pure-form-message-inline { + display: inline-block; + padding-left: 0.3em; + color: #666; + vertical-align: middle; + font-size: 0.875em; +} + +/* Block help for forms */ +.pure-form-message { + display: block; + color: #666; + font-size: 0.875em; +} + +@media only screen and (max-width : 480px) { + .pure-form button[type="submit"] { + margin: 0.7em 0 0; + } + + .pure-form input:not([type]), + .pure-form input[type="text"], + .pure-form input[type="password"], + .pure-form input[type="email"], + .pure-form input[type="url"], + .pure-form input[type="date"], + .pure-form input[type="month"], + .pure-form input[type="time"], + .pure-form input[type="datetime"], + .pure-form input[type="datetime-local"], + .pure-form input[type="week"], + .pure-form input[type="number"], + .pure-form input[type="search"], + .pure-form input[type="tel"], + .pure-form input[type="color"], + .pure-form label { + margin-bottom: 0.3em; + display: block; + } + + .pure-group input:not([type]), + .pure-group input[type="text"], + .pure-group input[type="password"], + .pure-group input[type="email"], + .pure-group input[type="url"], + .pure-group input[type="date"], + .pure-group input[type="month"], + .pure-group input[type="time"], + .pure-group input[type="datetime"], + .pure-group input[type="datetime-local"], + .pure-group input[type="week"], + .pure-group input[type="number"], + .pure-group input[type="search"], + .pure-group input[type="tel"], + .pure-group input[type="color"] { + margin-bottom: 0; + } + + .pure-form-aligned .pure-control-group label { + margin-bottom: 0.3em; + text-align: left; + display: block; + width: 100%; + } + + .pure-form-aligned .pure-controls { + margin: 1.5em 0 0 0; + } + + /* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ + .pure-form .pure-help-inline, + .pure-form-message-inline, + .pure-form-message { + display: block; + font-size: 0.75em; + /* Increased bottom padding to make it group with its related input element. */ + padding: 0.2em 0 0.8em; + } +} + +/*csslint adjoining-classes:false, outline-none:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + +.pure-menu ul { + position: absolute; + visibility: hidden; +} + +.pure-menu.pure-menu-open { + visibility: visible; + z-index: 2; + width: 100%; +} + +.pure-menu ul { + left: -10000px; + list-style: none; + margin: 0; + padding: 0; + top: -10000px; + z-index: 1; +} + +.pure-menu > ul { position: relative; } + +.pure-menu-open > ul { + left: 0; + top: 0; + visibility: visible; +} + +.pure-menu-open > ul:focus { + outline: 0; +} + +.pure-menu li { position: relative; } + +.pure-menu a, +.pure-menu .pure-menu-heading { + display: block; + color: inherit; + line-height: 1.5em; + padding: 5px 20px; + text-decoration: none; + white-space: nowrap; +} + +.pure-menu.pure-menu-horizontal > .pure-menu-heading { + display: inline-block; + *display: inline; + zoom: 1; + margin: 0; + vertical-align: middle; +} +.pure-menu.pure-menu-horizontal > ul { + display: inline-block; + *display: inline; + zoom: 1; + vertical-align: middle; +} + +.pure-menu li a { padding: 5px 20px; } + +.pure-menu-can-have-children > .pure-menu-label:after { + content: '\25B8'; + float: right; + /* These specific fonts have the Unicode char we need. */ + font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', sans-serif; + margin-right: -20px; + margin-top: -1px; +} + +.pure-menu-can-have-children > .pure-menu-label { + padding-right: 30px; +} + +.pure-menu-separator { + background-color: #dfdfdf; + display: block; + height: 1px; + font-size: 0; + margin: 7px 2px; + overflow: hidden; +} + +.pure-menu-hidden { + display: none; +} + +/* FIXED MENU */ +.pure-menu-fixed { + position: fixed; + top: 0; + left: 0; + width: 100%; +} + + +/* HORIZONTAL MENU CODE */ + +/* Initial menus should be inline-block so that they are horizontal */ +.pure-menu-horizontal li { + display: inline-block; + *display: inline; + zoom: 1; + vertical-align: middle; +} + +/* Submenus should still be display: block; */ +.pure-menu-horizontal li li { + display: block; +} + +/* Content after should be down arrow */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label:after { + content: "\25BE"; +} +/*Add extra padding to elements that have the arrow so that the hover looks nice */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label { + padding-right: 30px; +} + +/* Adjusting separator for vertical menus */ +.pure-menu-horizontal li.pure-menu-separator { + height: 50%; + width: 1px; + margin: 0 7px; +} + +/* Submenus should be horizontal separator again */ +.pure-menu-horizontal li li.pure-menu-separator { + height: 1px; + width: auto; + margin: 7px 2px; +} + + +/*csslint adjoining-classes:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + +/* MAIN MENU STYLING */ + +.pure-menu.pure-menu-open, +.pure-menu.pure-menu-horizontal li .pure-menu-children { + background: #fff; /* Old browsers */ + border: 1px solid #b7b7b7; +} + +/* remove borders for horizontal menus */ +.pure-menu.pure-menu-horizontal, +.pure-menu.pure-menu-horizontal .pure-menu-heading { + border: none; +} + + +/* LINK STYLES */ + +.pure-menu a { + border: 1px solid transparent; + border-left: none; + border-right: none; + +} + +.pure-menu a, +.pure-menu .pure-menu-can-have-children > li:after { + color: #777; +} + +.pure-menu .pure-menu-can-have-children > li:hover:after { + color: #fff; +} + +/* Focus style for a dropdown menu-item when the parent has been opened */ +.pure-menu .pure-menu-open { + background: #dedede; +} + + +.pure-menu li a:hover, +.pure-menu li a:focus { + background: #eee; +} + +/* DISABLED STATES */ +.pure-menu li.pure-menu-disabled a:hover, +.pure-menu li.pure-menu-disabled a:focus { + background: #fff; + color: #bfbfbf; +} + +.pure-menu .pure-menu-disabled > a { + background-image: none; + border-color: transparent; + cursor: default; +} + +.pure-menu .pure-menu-disabled > a, +.pure-menu .pure-menu-can-have-children.pure-menu-disabled > a:after { + color: #bfbfbf; +} + +/* HEADINGS */ +.pure-menu .pure-menu-heading { + color: #565d64; + text-transform: uppercase; + font-size: 90%; + margin-top: 0.5em; + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: #dfdfdf; +} + +/* ACTIVE MENU ITEM */ +.pure-menu .pure-menu-selected a { + color: #000; +} + +/* FIXED MENU */ +.pure-menu.pure-menu-open.pure-menu-fixed { + border: none; + border-bottom: 1px solid #b7b7b7; +} + +/*csslint box-model:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + + +.pure-paginator { + + /* `pure-g` Grid styles */ + letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ + *letter-spacing: normal; /* reset IE < 8 */ + *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ + text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ + + /* `pure-paginator` Specific styles */ + list-style: none; + margin: 0; + padding: 0; +} +.opera-only :-o-prefocus, +.pure-paginator { + word-spacing: -0.43em; +} + +/* `pure-u` Grid styles */ +.pure-paginator li { + display: inline-block; + *display: inline; /* IE < 8: fake inline-block */ + zoom: 1; + letter-spacing: normal; + word-spacing: normal; + vertical-align: top; + text-rendering: auto; +} + + +.pure-paginator .pure-button { + border-radius: 0; + padding: 0.8em 1.4em; + vertical-align: top; + height: 1.1em; +} +.pure-paginator .pure-button:focus, +.pure-paginator .pure-button:active { + outline-style: none; +} +.pure-paginator .prev, +.pure-paginator .next { + color: #C0C1C3; + text-shadow: 0 -1px 0 rgba(0,0,0, 0.45); +} +.pure-paginator .prev { + border-radius: 2px 0 0 2px; +} +.pure-paginator .next { + border-radius: 0 2px 2px 0; +} + +@media (max-width: 480px) { + .pure-menu-horizontal { + width: 100%; + } + + .pure-menu-children li { + display: block; + border-bottom: 1px solid black; + } +} + +.pure-table { + /* Remove spacing between table cells (from Normalize.css) */ + border-collapse: collapse; + border-spacing: 0; + empty-cells: show; + border: 1px solid #cbcbcb; +} + +.pure-table caption { + color: #000; + font: italic 85%/1 arial, sans-serif; + padding: 1em 0; + text-align: center; +} + +.pure-table td, +.pure-table th { + border-left: 1px solid #cbcbcb;/* inner column border */ + border-width: 0 0 0 1px; + font-size: inherit; + margin: 0; + overflow: visible; /*to make ths where the title is really long work*/ + padding: 0.5em 1em; /* cell padding */ +} +.pure-table td:first-child, +.pure-table th:first-child { + border-left-width: 0; +} + +.pure-table thead { + background: #e0e0e0; + color: #000; + text-align: left; + vertical-align: bottom; +} + +/* +striping: + even - #fff (white) + odd - #f2f2f2 (light gray) +*/ +.pure-table td { + background-color: transparent; +} +.pure-table-odd td { + background-color: #f2f2f2; +} + +/* nth-child selector for modern browsers */ +.pure-table-striped tr:nth-child(2n-1) td { + background-color: #f2f2f2; +} + +/* BORDERED TABLES */ +.pure-table-bordered td { + border-bottom: 1px solid #cbcbcb; +} +.pure-table-bordered tbody > tr:last-child td, +.pure-table-horizontal tbody > tr:last-child td { + border-bottom-width: 0; +} + + +/* HORIZONTAL BORDERED TABLES */ + +.pure-table-horizontal td, +.pure-table-horizontal th { + border-width: 0 0 1px 0; + border-bottom: 1px solid #cbcbcb; +} +.pure-table-horizontal tbody > tr:last-child td { + border-bottom-width: 0; +} diff --git a/build/web/gfv3ee6.dpf b/build/web/gfv3ee6.dpf new file mode 100644 index 00000000..4f5a531d --- /dev/null +++ b/build/web/gfv3ee6.dpf @@ -0,0 +1,11 @@ + + + + /Simple_Blog + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/build/web/index.xhtml b/build/web/index.xhtml new file mode 100644 index 00000000..f9f5224a --- /dev/null +++ b/build/web/index.xhtml @@ -0,0 +1,166 @@ + + + + + + + + + Blog – + + + + + + + + + + + + + +
+ + +
+
+ +
+

Pinned Post

+ + +
+
+ Tilo Mitra's avatar + +

Introducing Pure

+ + +
+ +
+

+ Yesterday at CSSConf, we launched Pure – a new CSS library. Phew! Here are the slides from the presentation. Although it looks pretty minimalist, we’ve been working on Pure for several months. After many iterations, we have released Pure as a set of small, responsive, CSS modules that you can use in every web project. +

+
+
+
+ +
+

Recent Posts

+ +
+
+ Eric Ferraiuolo's avatar + +

Everything You Need to Know About Grunt

+ + +
+ +
+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +

+
+
+ +
+
+ Reid Burke's avatar + +

Photos from CSSConf and JSConf

+ + +
+ +
+
+
+ + Photo of someone working poolside at a resort + + +
+

CSSConf Photos

+
+
+ +
+ + Photo of the sunset on the beach + + +
+

JSConf Photos

+
+
+
+
+
+ +
+
+ Andrew Wooldridge's avatar + +

YUI 3.10.2 Released

+ + +
+ +
+

+ We are happy to announce the release of YUI 3.10.2! You can find it now on the Yahoo! CDN, download it directly, or pull it in via npm. We’ve also updated the YUI Library website with the latest documentation. +

+
+
+
+ + +
+
+
+ + + diff --git a/build/web/template/basis.xhtml b/build/web/template/basis.xhtml new file mode 100644 index 00000000..48a72163 --- /dev/null +++ b/build/web/template/basis.xhtml @@ -0,0 +1,73 @@ + + + + + + + + + Simple–Blog + + + + + + + + + + + + + +
+
+ +
+ +
+ Main Content +
+ +
+ + + diff --git a/index.html b/index.html deleted file mode 100644 index 07cff0ba..00000000 --- a/index.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog - - - - - -
- - - -
-
- -
-
- - - -
- - - - - - - - \ No newline at end of file diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 00000000..2d5f8778 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 00000000..adb02ec2 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1446 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/customs.json b/nbproject/customs.json new file mode 100644 index 00000000..330d9676 --- /dev/null +++ b/nbproject/customs.json @@ -0,0 +1,10 @@ +{ + "attributes": { + "action": { + "context": "a" + } + }, + "elements": { + "h:head": {} + } +} \ No newline at end of file diff --git a/nbproject/faces-config.NavData b/nbproject/faces-config.NavData new file mode 100644 index 00000000..298bfc50 --- /dev/null +++ b/nbproject/faces-config.NavData @@ -0,0 +1,6 @@ + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 00000000..39b2ba03 --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=e4a5e16b +build.xml.script.CRC32=3bca006e +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=e4a5e16b +nbproject/build-impl.xml.script.CRC32=03ab8623 +nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 00000000..4dc57af5 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,20 @@ +<<<<<<< HEAD +deploy.ant.properties.file=C:\\Users\\pc asus\\AppData\\Roaming\\NetBeans\\8.0\\config\\GlassFishEE6\\Properties\\gfv31883287466.properties +j2ee.platform.is.jsr109=true +j2ee.server.domain=C:/Users/pc asus/AppData/Roaming/NetBeans/8.0/config/GF_4.0/domain1 +j2ee.server.home=C:/Program Files/glassfish-4.0/glassfish +j2ee.server.instance=[C:\\Program Files\\glassfish-4.0\\glassfish;C:\\Program Files\\glassfish-4.0\\glassfish\\domains\\domain1]deployer:gfv3ee6:localhost:4848 +j2ee.server.middleware=C:/Program Files/glassfish-4.0 +user.properties.file=C:\\Users\\pc asus\\AppData\\Roaming\\NetBeans\\8.0\\build.properties +======= +deploy.ant.properties.file=C:\\Users\\Afik\\AppData\\Roaming\\NetBeans\\8.0\\config\\GlassFishEE6\\Properties\\gfv3-968141306.properties +j2ee.platform.is.jsr109=true +j2ee.server.domain=C:/Users/Afik/AppData/Roaming/NetBeans/8.0/config/GF_4.0/domain1 +j2ee.server.home=C:/Program Files/glassfish-4.0/glassfish +j2ee.server.instance=[C:\\Program Files\\glassfish-4.0\\glassfish;C:\\Program Files\\glassfish-4.0\\glassfish\\domains\\domain1]deployer:gfv3ee6:localhost:4848 +j2ee.server.middleware=C:/Program Files/glassfish-4.0 +javac.debug=true +javadoc.preview=true +selected.browser=default +user.properties.file=C:\\Users\\Afik\\AppData\\Roaming\\NetBeans\\8.0\\build.properties +>>>>>>> f187f1fdca6e243f3f36a82f6c730f6af75181fc diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..2e87752a --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,99 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css +auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options= +auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=false +auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets +auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js/libs +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +file.reference.=..\\..\\..\\..\\ +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7-web +j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv3ee6 +jar.compress=false +javac.classpath=\ + ${libs.MySQLDriver.classpath}:\ + ${libs.javaee-web-api-7.0.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=Simple_Blog.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/nbproject/project.xml b/nbproject/project.xml new file mode 100644 index 00000000..1b85cfba --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,27 @@ + + + org.netbeans.modules.web.project + + + Simple Blog + 1.6.5 + + + ${libs.MySQLDriver.classpath} + WEB-INF/lib + + + ${libs.javaee-web-api-7.0.classpath} + WEB-INF/lib + + + + + + + + + + + + diff --git a/new_post.html b/new_post.html deleted file mode 100644 index fc4e18ee..00000000 --- a/new_post.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Simple Blog | Tambah Post - - - - - -
- - - -
- - -

-

- -
-
-

Tambah Post

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

Apa itu Simple Blog?

-

-
-
- -
-
-
-

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

-

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

- -
- -

Komentar

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

    Jems

    -
    2 menit lalu
    -
    -

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

    -
  • - -
  • -
    -

    Kave

    -
    1 jam lalu
    -
    -

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

    -
  • -
-
-
- -
- - - -
- - - - - - - - \ No newline at end of file diff --git a/readme.md b/readme.md deleted file mode 100644 index 5e7e48f5..00000000 --- a/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# Simple Blog Java - -Tugas 2 IF3110. - -![Simple Blog](http://i655.photobucket.com/albums/uu275/sonnylazuardi/ss-5.jpg) - -## Deskripsi - -Gunakan template ini untuk membuat sebuah blog sederhana dengan menggunakan bahasa pemrograman PHP. - -## Spesifikasi - -Spesifikasi untuk Tugas II IF3110 dapat diakses pada pranala berikut: - -https://www.dropbox.com/sh/ig1hf108ad9fqxi/AAA2PMjPFICSFo3ypdrHl39La?dl=0 - -## Deliverable - -Tiap-tiap Kelompok Membuat Organizationnya masing-masing, dengan langkah: - -1. Klik tanda Tambah disamping username pada Github, Pilih Create New Organization - -2. Buat Organisasi dengan Nama : IF3110-II-Nomor_Kelompok . Nomor Kelompok dapat diakses [disini](https://docs.google.com/spreadsheets/d/1Y-FGJ_feIVYNRv-o0ycBXyfAiKMFXKA17cvw3Mhjd1A/edit?usp=sharing) - -3. Masukkan email address salah satu anggota untuk billing email ( bebas ). - -4. Undang anggota kelompok untuk menjadi anggota Organisasi. - -5. Lakukan Fork Repository ini ke Organisasi yang baru dibentuk - -6. Setelah selesai mengerjakan, lakukan Pull Request. - -## Lisensi - -© 2014 Asisten IF3110 - -Yogi | [Sonny](http://github.com/sonnylazuardi) | Fathan | Renusa | Kelvin | Yanuar - -Dosen: [Yudistira Dwi Wardhana](http://github.com/yudis) \ No newline at end of file diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/java/DAO/CommentDAO.java b/src/java/DAO/CommentDAO.java new file mode 100644 index 00000000..5dc5cd01 --- /dev/null +++ b/src/java/DAO/CommentDAO.java @@ -0,0 +1,30 @@ +/* + * 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 DAO; + +//Isi sama JavaBeans kalian di package Model +import java.util.List; +import model.Komentar; + +/** + * + * @author pc asus + */ +public interface CommentDAO { + // Actions ------------------------------------------------------------------------------------ + + + public Komentar find(int ID) throws DAOException; + + + public List list(int PID) throws DAOException; + + + public void create(Komentar komentar) throws IllegalArgumentException, DAOException; + + +} \ No newline at end of file diff --git a/src/java/DAO/CommentDAOJDBC.java b/src/java/DAO/CommentDAOJDBC.java new file mode 100644 index 00000000..f3bccdb0 --- /dev/null +++ b/src/java/DAO/CommentDAOJDBC.java @@ -0,0 +1,138 @@ +/* + * 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 DAO; + +import static DAO.DAOUtil.*; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import model.Komentar; +/** + * + * @author pc asus + */ +public class CommentDAOJDBC implements CommentDAO { + + // Constants ---------------------------------------------------------------------------------- + + private static final String SQL_FIND_BY_KID = + "SELECT * FROM komentar WHERE KID = ?"; + private static final String SQL_FIND_BY_PID = + "SELECT * FROM komentar WHERE PID = ? ORDER BY TANGGAL DESC"; + private static final String SQL_INSERT = + "INSERT INTO komentar (PID, NAMA, EMAIL, TANGGAL, KOMENTAR) VALUES (?, ?, ?, ?, ?)"; + + // Vars --------------------------------------------------------------------------------------- + + private DAOFactory daoFactory; + + // Constructors ------------------------------------------------------------------------------- + + CommentDAOJDBC(DAOFactory daoFactory) { + this.daoFactory = daoFactory; + } + + // Actions ------------------------------------------------------------------------------------ + + @Override + public Komentar find(int PID) throws DAOException { + return find(SQL_FIND_BY_KID, PID); + } + + private Komentar find(String sql, Object... values) throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + Komentar komentar = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, sql, false, values); + resultSet = preparedStatement.executeQuery(); + + if (resultSet.next()) { + komentar = map(resultSet); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return komentar; + } + + @Override + public List list(int PID) throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + List komentar = new ArrayList(); + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_FIND_BY_PID, false, PID); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + komentar.add(map(resultSet)); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return komentar; + } + + @Override + public void create(Komentar komentar) throws DAOException { + + Object[] values = { + komentar.getPID(), + komentar.getNama(), + komentar.getEmail(), + komentar.getTanggal(), + komentar.getKomentar() + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet generatedKeys = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_INSERT, true, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0) { + throw new DAOException("Creating comment failed, no rows affected."); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, generatedKeys); + } + } + + + // Helpers ------------------------------------------------------------------------------------ + static Komentar map(ResultSet resultSet) throws SQLException { + Komentar komentar = new Komentar(); + komentar.setPID(resultSet.getInt("PID")); + komentar.setKID(resultSet.getInt("KID")); + komentar.setNama(resultSet.getString("Nama")); + komentar.setTanggal(resultSet.getString("Tanggal")); + komentar.setEmail(resultSet.getString("Email")); + komentar.setKomentar(resultSet.getString("Komentar")); + return komentar; + } +} diff --git a/src/java/DAO/DAO.properties b/src/java/DAO/DAO.properties new file mode 100644 index 00000000..6c52ad3e --- /dev/null +++ b/src/java/DAO/DAO.properties @@ -0,0 +1,8 @@ +# 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. +javabase.jdbc.url = jdbc:mysql://localhost:3306/simple_blog_2 +javabase.jdbc.driver = com.mysql.jdbc.Driver +javabase.jdbc.username = root +javabase.jdbc.password = + diff --git a/src/java/DAO/DAOConfigurationException.java b/src/java/DAO/DAOConfigurationException.java new file mode 100644 index 00000000..d91577fa --- /dev/null +++ b/src/java/DAO/DAOConfigurationException.java @@ -0,0 +1,44 @@ +/* + * 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 DAO; + +/** + * + * @author pc asus + */ +public class DAOConfigurationException extends RuntimeException { + // Constants ---------------------------------------------------------------------------------- + + private static final long serialVersionUID = 1L; + + // Constructors ------------------------------------------------------------------------------- + + /** + * Constructs a DAOConfigurationException with the given detail message. + * @param message The detail message of the DAOConfigurationException. + */ + public DAOConfigurationException(String message) { + super(message); + } + + /** + * Constructs a DAOConfigurationException with the given root cause. + * @param cause The root cause of the DAOConfigurationException. + */ + public DAOConfigurationException(Throwable cause) { + super(cause); + } + + /** + * Constructs a DAOConfigurationException with the given detail message and root cause. + * @param message The detail message of the DAOConfigurationException. + * @param cause The root cause of the DAOConfigurationException. + */ + public DAOConfigurationException(String message, Throwable cause) { + super(message,cause); + } +} diff --git a/src/java/DAO/DAOException.java b/src/java/DAO/DAOException.java new file mode 100644 index 00000000..42393e38 --- /dev/null +++ b/src/java/DAO/DAOException.java @@ -0,0 +1,45 @@ +/* + * 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 DAO; + +/** + * + * @author pc asus + */ +public class DAOException extends RuntimeException { + // Constants ---------------------------------------------------------------------------------- + + private static final long serialVersionUID = 1L; + + // Constructors ------------------------------------------------------------------------------- + + /** + * Constructs a DAOException with the given detail message. + * @param message The detail message of the DAOException. + */ + public DAOException(String message) { + super(message); + } + + /** + * Constructs a DAOException with the given root cause. + * @param cause The root cause of the DAOException. + */ + public DAOException(Throwable cause) { + super(cause); + } + + /** + * Constructs a DAOException with the given detail message and root cause. + * @param message The detail message of the DAOException. + * @param cause The root cause of the DAOException. + */ + public DAOException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/src/java/DAO/DAOFactory.java b/src/java/DAO/DAOFactory.java new file mode 100644 index 00000000..6262b14c --- /dev/null +++ b/src/java/DAO/DAOFactory.java @@ -0,0 +1,163 @@ +/* + * 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 DAO; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.sql.DataSource; +/** + * + * @author pc asus + */ +public abstract class DAOFactory { + // Constants ---------------------------------------------------------------------------------- + + private static final String PROPERTY_URL = "url"; + private static final String PROPERTY_DRIVER = "driver"; + private static final String PROPERTY_USERNAME = "username"; + private static final String PROPERTY_PASSWORD = "password"; + + // Actions ------------------------------------------------------------------------------------ + + /** + * Returns a new DAOFactory instance for the given database name. + * @param name The database name to return a new DAOFactory instance for. + * @return A new DAOFactory instance for the given database name. + * @throws DAOConfigurationException If the database name is null, or if the properties file is + * missing in the classpath or cannot be loaded, or if a required property is missing in the + * properties file, or if either the driver cannot be loaded or the datasource cannot be found. + */ + public static DAOFactory getInstance(String name) throws DAOConfigurationException { + if (name == null) { + throw new DAOConfigurationException("Database name is null."); + } + + DAOProperties properties = new DAOProperties(name); + String url = properties.getProperty(PROPERTY_URL, true); + String driverClassName = properties.getProperty(PROPERTY_DRIVER, false); + String password = properties.getProperty(PROPERTY_PASSWORD, false); + String username = properties.getProperty(PROPERTY_USERNAME, password != null); + DAOFactory instance; + + // If driver is specified, then load it to let it register itself with DriverManager. + if (driverClassName != null) { + try { + Class.forName(driverClassName); + } catch (ClassNotFoundException e) { + throw new DAOConfigurationException( + "Driver class '" + driverClassName + "' is missing in classpath.", e); + } + instance = new DriverManagerDAOFactory(url, username, password); + } + + // Else assume URL as DataSource URL and lookup it in the JNDI. + else { + DataSource dataSource; + try { + dataSource = (DataSource) new InitialContext().lookup(url); + } catch (NamingException e) { + throw new DAOConfigurationException( + "DataSource '" + url + "' is missing in JNDI.", e); + } + if (username != null) { + instance = new DataSourceWithLoginDAOFactory(dataSource, username, password); + } else { + instance = new DataSourceDAOFactory(dataSource); + } + } + + return instance; + } + + /** + * Returns a connection to the database. Package private so that it can be used inside the DAO + * package only. + * @return A connection to the database. + * @throws SQLException If acquiring the connection fails. + */ + abstract Connection getConnection() throws SQLException; + + // DAO implementation getters ----------------------------------------------------------------- + + /** + * Returns the User DAO associated with the current DAOFactory. + * @return The User DAO associated with the current DAOFactory. + */ + public UserDAO getUserDAO() { + return new UserDAOJDBC(this); + } + + public PostDAO getPostDAO() { + return new PostDAOJDBC(this); + } + + public CommentDAO getKomentarDAO(){ + return new CommentDAOJDBC(this); + } + +} + +// Default DAOFactory implementations ------------------------------------------------------------- + +/** + * The DriverManager based DAOFactory. + */ +class DriverManagerDAOFactory extends DAOFactory { + private String url; + private String username; + private String password; + + DriverManagerDAOFactory(String url, String username, String password) { + this.url = url; + this.username = username; + this.password = password; + } + + @Override + Connection getConnection() throws SQLException { + return DriverManager.getConnection(url, username, password); + } +} + +/** + * The DataSource based DAOFactory. + */ +class DataSourceDAOFactory extends DAOFactory { + private DataSource dataSource; + + DataSourceDAOFactory(DataSource dataSource) { + this.dataSource = dataSource; + } + + @Override + Connection getConnection() throws SQLException { + return dataSource.getConnection(); + } +} + +/** + * The DataSource-with-Login based DAOFactory. + */ +class DataSourceWithLoginDAOFactory extends DAOFactory { + private DataSource dataSource; + private String username; + private String password; + + DataSourceWithLoginDAOFactory(DataSource dataSource, String username, String password) { + this.dataSource = dataSource; + this.username = username; + this.password = password; + } + + @Override + Connection getConnection() throws SQLException { + return dataSource.getConnection(username, password); + } +} diff --git a/src/java/DAO/DAOProperties.java b/src/java/DAO/DAOProperties.java new file mode 100644 index 00000000..399b419e --- /dev/null +++ b/src/java/DAO/DAOProperties.java @@ -0,0 +1,84 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package DAO; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; +/** + * + * @author pc asus + */ +public class DAOProperties { + // Constants ---------------------------------------------------------------------------------- + + private static final String PROPERTIES_FILE = "DAO/DAO.properties"; + private static final Properties PROPERTIES = new Properties(); + + static { + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + InputStream propertiesFile = classLoader.getResourceAsStream(PROPERTIES_FILE); + + if (propertiesFile == null) { + throw new DAOConfigurationException( + classLoader+ + "Properties file '" + PROPERTIES_FILE + "' is missing in classpath."); + } + + try { + PROPERTIES.load(propertiesFile); + } catch (IOException e) { + throw new DAOConfigurationException( + "Cannot load properties file '" + PROPERTIES_FILE + "'.", e); + } + } + + // Vars --------------------------------------------------------------------------------------- + + private String specificKey; + + // Constructors ------------------------------------------------------------------------------- + + /** + * Construct a DAOProperties instance for the given specific key which is to be used as property + * key prefix of the DAO properties file. + * @param specificKey The specific key which is to be used as property key prefix. + * @throws DAOConfigurationException During class initialization if the DAO properties file is + * missing in the classpath or cannot be loaded. + */ + public DAOProperties(String specificKey) throws DAOConfigurationException { + this.specificKey = specificKey; + } + + // Actions ------------------------------------------------------------------------------------ + + /** + * Returns the DAOProperties instance specific property value associated with the given key with + * the option to indicate whether the property is mandatory or not. + * @param key The key to be associated with a DAOProperties instance specific value. + * @param mandatory Sets whether the returned property value should not be null nor empty. + * @return The DAOProperties instance specific property value associated with the given key. + * @throws DAOConfigurationException If the returned property value is null or empty while + * it is mandatory. + */ + public String getProperty(String key, boolean mandatory) throws DAOConfigurationException { + String fullKey = specificKey + "." + key; + String property = PROPERTIES.getProperty(fullKey); + + if (property == null || property.trim().length() == 0) { + if (mandatory) { + throw new DAOConfigurationException("Required property '" + fullKey + "'" + + " is missing in properties file '" + PROPERTIES_FILE + "'."); + } else { + // Make empty value null. Empty Strings are evil. + property = null; + } + } + + return property; + } + +} diff --git a/src/java/DAO/DAOUtil.java b/src/java/DAO/DAOUtil.java new file mode 100644 index 00000000..6f4d5bd3 --- /dev/null +++ b/src/java/DAO/DAOUtil.java @@ -0,0 +1,136 @@ +/* + * 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 DAO; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +/** + * + * @author pc asus + */ +public final class DAOUtil { + + // Constructors ------------------------------------------------------------------------------- + + private DAOUtil() { + // Utility class, hide constructor. + } + + // Actions ------------------------------------------------------------------------------------ + + /** + * Returns a PreparedStatement of the given connection, set with the given SQL query and the + * given parameter values. + * @param connection The Connection to create the PreparedStatement from. + * @param sql The SQL query to construct the PreparedStatement with. + * @param returnGeneratedKeys Set whether to return generated keys or not. + * @param values The parameter values to be set in the created PreparedStatement. + * @throws SQLException If something fails during creating the PreparedStatement. + */ + public static PreparedStatement prepareStatement + (Connection connection, String sql, boolean returnGeneratedKeys, Object... values) + throws SQLException + { + PreparedStatement preparedStatement = connection.prepareStatement(sql, + returnGeneratedKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS); + setValues(preparedStatement, values); + return preparedStatement; + } + + /** + * Set the given parameter values in the given PreparedStatement. + * @param connection The PreparedStatement to set the given parameter values in. + * @param values The parameter values to be set in the created PreparedStatement. + * @throws SQLException If something fails during setting the PreparedStatement values. + */ + public static void setValues(PreparedStatement preparedStatement, Object... values) + throws SQLException + { + for (int i = 0; i < values.length; i++) { + preparedStatement.setObject(i + 1, values[i]); + } + } + + /** + * Converts the given java.util.Date to java.sql.Date. + * @param date The java.util.Date to be converted to java.sql.Date. + * @return The converted java.sql.Date. + */ + public static Date toSqlDate(java.util.Date date) { + return (date != null) ? new Date(date.getTime()) : null; + } + + /** + * Quietly close the Connection. Any errors will be printed to the stderr. + * @param connection The Connection to be closed quietly. + */ + public static void close(Connection connection) { + if (connection != null) { + try { + connection.close(); + } catch (SQLException e) { + System.err.println("Closing Connection failed: " + e.getMessage()); + e.printStackTrace(); + } + } + } + + /** + * Quietly close the Statement. Any errors will be printed to the stderr. + * @param statement The Statement to be closed quietly. + */ + public static void close(Statement statement) { + if (statement != null) { + try { + statement.close(); + } catch (SQLException e) { + System.err.println("Closing Statement failed: " + e.getMessage()); + e.printStackTrace(); + } + } + } + + /** + * Quietly close the ResultSet. Any errors will be printed to the stderr. + * @param resultSet The ResultSet to be closed quietly. + */ + public static void close(ResultSet resultSet) { + if (resultSet != null) { + try { + resultSet.close(); + } catch (SQLException e) { + System.err.println("Closing ResultSet failed: " + e.getMessage()); + e.printStackTrace(); + } + } + } + + /** + * Quietly close the Connection and Statement. Any errors will be printed to the stderr. + * @param connection The Connection to be closed quietly. + * @param statement The Statement to be closed quietly. + */ + public static void close(Connection connection, Statement statement) { + close(statement); + close(connection); + } + + /** + * Quietly close the Connection, Statement and ResultSet. Any errors will be printed to the stderr. + * @param connection The Connection to be closed quietly. + * @param statement The Statement to be closed quietly. + * @param resultSet The ResultSet to be closed quietly. + */ + public static void close(Connection connection, Statement statement, ResultSet resultSet) { + close(resultSet); + close(statement); + close(connection); + } +} diff --git a/src/java/DAO/PostDAO.java b/src/java/DAO/PostDAO.java new file mode 100644 index 00000000..d871864a --- /dev/null +++ b/src/java/DAO/PostDAO.java @@ -0,0 +1,51 @@ +/* + * 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 DAO; +import java.util.List; +import model.Post; + +/** + * + * @author pc asus + */ +public interface PostDAO { + + /** + * Returns the user from the database matching the given username, otherwise null. + * @param username username of the user + * @return The user from the database matching the given username, otherwise null. + * @throws DAOException If something fails at database level. + */ + public Post find(int PID) throws DAOException; + /** + * + * @return all user in database + * @throws DAOException if something fails at database level + */ + public List listPublish() throws DAOException; + + public List listUnPublish() throws DAOException; + + public void create(Post post) throws IllegalArgumentException, DAOException; + + /** + * Update the given user in the database. The username, otherwise it will throw + * IllegalArgumentException. + * @param user The user to be updated in the database. + * @throws IllegalArgumentException If the username is null. + * @throws DAOException If something fails at database level. + */ + public void update(Post post) throws IllegalArgumentException, DAOException; + + /** + * Delete the given user from the database. After deleting, the DAO will set the user to null + * + * @param user The user to be deleted from the database. + * @throws DAOException If something fails at database level. + */ + public void delete(Post post) throws DAOException; +} diff --git a/src/java/DAO/PostDAOJDBC.java b/src/java/DAO/PostDAOJDBC.java new file mode 100644 index 00000000..846190ee --- /dev/null +++ b/src/java/DAO/PostDAOJDBC.java @@ -0,0 +1,237 @@ +/* + * 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 DAO; + +import static DAO.DAOUtil.*; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import model.Post; + +/** + * + * @author pc asus + */ +public class PostDAOJDBC implements PostDAO{ + // Constants ---------------------------------------------------------------------------------- + + private static final String SQL_FIND_BY_ID = + "SELECT * FROM entries WHERE PID = ?"; + + private static final String SQL_LIST_ORDER_BY_PID= + "SELECT * FROM entries ORDER BY PID"; + + private static final String SQL_LIST_PUBLISHED_POST= + "SELECT * FROM entries WHERE PUBLISHED=1 ORDER BY TANGGAL DESC"; + private static final String SQL_LIST_UNPUBLISHED_POST= + "SELECT * FROM entries WHERE PUBLISHED=0 ORDER BY TANGGAL DESC"; + + private static final String SQL_INSERT = + "INSERT INTO Entries (judul,konten,tanggal,author,pid,published) VALUES (?, ?, ?, ?,?,?)"; + private static final String SQL_UPDATE = + "UPDATE Entries SET judul = ?, konten = ?, tanggal = ?, published = ? WHERE pid = ?"; + private static final String SQL_DELETE = + "DELETE FROM Entries WHERE pid = ?"; + + // Vars --------------------------------------------------------------------------------------- + + private DAOFactory daoFactory; + + // Constructors ------------------------------------------------------------------------------- + + /** + * Construct an User DAO for the given DAOFactory. Package private so that it can be constructed + * inside the DAO package only. + * @param daoFactory The DAOFactory to construct this User DAO for. + */ + PostDAOJDBC(DAOFactory daoFactory) { + this.daoFactory = daoFactory; + } + + // Actions ------------------------------------------------------------------------------------ + @Override + public Post find(int PID) throws DAOException { + return find(SQL_FIND_BY_ID, PID); + } + /** + * Returns the user from the database matching the given SQL query with the given values. + * @param sql The SQL query to be executed in the database. + * @param values The PreparedStatement values to be set. + * @return The user from the database matching the given SQL query with the given values. + * @throws DAOException If something fails at database level. + */ + private Post find(String sql, Object... values) throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + Post user = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, sql, false, values); + resultSet = preparedStatement.executeQuery(); + + if (resultSet.next()) { + user = map(resultSet); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return user; + } + + @Override + public List listPublish() throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + List posts = new ArrayList(); + + try { + connection = daoFactory.getConnection(); + preparedStatement = connection.prepareStatement(SQL_LIST_PUBLISHED_POST); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + posts.add(map(resultSet)); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return posts; + } + + @Override + public List listUnPublish() throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + List posts = new ArrayList(); + + try { + connection = daoFactory.getConnection(); + preparedStatement = connection.prepareStatement(SQL_LIST_UNPUBLISHED_POST); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + posts.add(map(resultSet)); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return posts; + } + + @Override +public void create(Post post) throws IllegalArgumentException, DAOException { + Object[] values = { + post.getJudul(), + post.getKonten(), + post.getDate(), + post.getAuthor(), + post.getPID(), + 0 + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet generatedKeys = null; + try{ + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_INSERT, true, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0){ + throw new DAOException("Creating user failed, no rows affected."); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, generatedKeys); + } +} + +@Override +public void update(Post post) throws DAOException { + Object[] values = { + post.getJudul(), + post.getKonten(), + post.getDate(), + post.isPublished(), + post.getPID() + + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet generatedKeys = null; + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_UPDATE, false, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0) { + throw new DAOException("Updating user failed, no rows affected."); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement,generatedKeys); + } +} + + @Override + public void delete(Post post) throws DAOException { + Object[] values = { + post.getPID() + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_DELETE, false, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0) { + throw new DAOException("Deleting user failed, no rows affected."); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement); + } + } + // Helpers ------------------------------------------------------------------------------------ + + /** + * Map the current row of the given ResultSet to an User. + * @param resultSet The ResultSet of which the current row is to be mapped to an User. + * @return The mapped User from the current row of the given ResultSet. + * @throws SQLException If something fails at database level. + */ + private static Post map(ResultSet resultSet) throws SQLException { + Post post = new Post(); + post.setJudul(resultSet.getString("judul")); + post.setKonten(resultSet.getString("konten")); + post.setDate(resultSet.getString("tanggal")); + post.setAuthor(resultSet.getString("author")); + post.setPID(resultSet.getInt("pid")); + post.setPublished(resultSet.getBoolean("published")); + return post; + } +} diff --git a/src/java/DAO/UserDAO.java b/src/java/DAO/UserDAO.java new file mode 100644 index 00000000..c6ffb9b0 --- /dev/null +++ b/src/java/DAO/UserDAO.java @@ -0,0 +1,62 @@ +/* + * 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 DAO; +import java.util.List; + +//Isi sama JavaBeans kalian di package Model +import model.UserBean; + +/** + * + * @author pc asus + */ +public interface UserDAO { + // Actions ------------------------------------------------------------------------------------ + + /** + * Returns the user from the database matching the given username, otherwise null. + * @param username username of the user + * @return The user from the database matching the given username, otherwise null. + * @throws DAOException If something fails at database level. + */ + public UserBean find(String username) throws DAOException; + + /** + * + * @return all user in database + * @throws DAOException if something fails at database level + */ + public List list() throws DAOException; + + /** + * Create the given user in the database. The username must not be null, otherwise it will throw + * IllegalArgumentException. After creating, the DAO will set the obtained username in the given user. + * @param user The user to be created in the database. + * @throws IllegalArgumentException If the username is null. + * @throws DAOException If something fails at database level. + */ + public void create(UserBean user) throws IllegalArgumentException, DAOException; + + /** + * Update the given user in the database. The username, otherwise it will throw + * IllegalArgumentException. + * @param user The user to be updated in the database. + * @throws IllegalArgumentException If the username is null. + * @throws DAOException If something fails at database level. + */ + public void update(UserBean user) throws IllegalArgumentException, DAOException; + + /** + * Delete the given user from the database. After deleting, the DAO will set the user to null + * + * @param user The user to be deleted from the database. + * @throws DAOException If something fails at database level. + */ + public void delete(UserBean user) throws DAOException; + + +} diff --git a/src/java/DAO/UserDAOJDBC.java b/src/java/DAO/UserDAOJDBC.java new file mode 100644 index 00000000..086d5c68 --- /dev/null +++ b/src/java/DAO/UserDAOJDBC.java @@ -0,0 +1,217 @@ +/* + * 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 DAO; + +import static DAO.DAOUtil.*; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import model.UserBean; +import model.AllUserBean; +import model.LoginBean; +/** + * + * @author pc asus + */ +public class UserDAOJDBC implements UserDAO { + + // Constants ---------------------------------------------------------------------------------- + + private static final String SQL_FIND_BY_NAME = + "SELECT * FROM user WHERE username = ?"; + private static final String SQL_LIST_ORDER_BY_NAME= + "SELECT * FROM User ORDER BY username"; + private static final String SQL_INSERT = + "INSERT INTO User (username, password, role, email) VALUES (?, ?, ?, ?)"; + private static final String SQL_UPDATE = + "UPDATE User SET password = ?, role = ?, email =? WHERE username = ?"; + private static final String SQL_DELETE = + "DELETE FROM User WHERE username = ?"; + + // Vars --------------------------------------------------------------------------------------- + + private DAOFactory daoFactory; + + // Constructors ------------------------------------------------------------------------------- + + /** + * Construct an User DAO for the given DAOFactory. Package private so that it can be constructed + * inside the DAO package only. + * @param daoFactory The DAOFactory to construct this User DAO for. + */ + UserDAOJDBC(DAOFactory daoFactory) { + this.daoFactory = daoFactory; + } + + // Actions ------------------------------------------------------------------------------------ + + @Override + public UserBean find(String username) throws DAOException { + return find(SQL_FIND_BY_NAME, username); + } + + /** + * Returns the user from the database matching the given SQL query with the given values. + * @param sql The SQL query to be executed in the database. + * @param values The PreparedStatement values to be set. + * @return The user from the database matching the given SQL query with the given values. + * @throws DAOException If something fails at database level. + */ + private UserBean find(String sql, Object... values) throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + UserBean user = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, sql, false, values); + resultSet = preparedStatement.executeQuery(); + + if (resultSet.next()) { + user = map(resultSet); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return user; + } + + @Override + public List list() throws DAOException { + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet resultSet = null; + List users = new ArrayList(); + + try { + connection = daoFactory.getConnection(); + preparedStatement = connection.prepareStatement(SQL_LIST_ORDER_BY_NAME); + resultSet = preparedStatement.executeQuery(); + while (resultSet.next()) { + users.add(map(resultSet)); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, resultSet); + } + + return users; + } + + @Override + public void create(UserBean user) throws IllegalArgumentException, DAOException { + if (user.getUsername()== null) { + throw new IllegalArgumentException("User is already created, the user ID is not null."); + } + + Object[] values = { + user.getUsername(), + user.getPassword(), + user.getRole(), + user.getEmail() + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + ResultSet generatedKeys = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_INSERT, true, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0) { + throw new DAOException("Creating user failed, no rows affected."); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement, generatedKeys); + } + } + + @Override + public void update(UserBean user) throws DAOException { + if (user.getUsername() == null) { + throw new IllegalArgumentException("User is not created yet, the user ID is null."); + } + + Object[] values = { + user.getPassword(), + user.getRole(), + user.getEmail(), + user.getUsername() + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_UPDATE, false, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0) { + throw new DAOException("Updating user failed, no rows affected."); + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement); + } + } + + @Override + public void delete(UserBean user) throws DAOException { + Object[] values = { + user.getUsername() + }; + + Connection connection = null; + PreparedStatement preparedStatement = null; + + try { + connection = daoFactory.getConnection(); + preparedStatement = prepareStatement(connection, SQL_DELETE, false, values); + int affectedRows = preparedStatement.executeUpdate(); + if (affectedRows == 0) { + throw new DAOException("Deleting user failed, no rows affected."); + } else { + user = null; + } + } catch (SQLException e) { + throw new DAOException(e); + } finally { + close(connection, preparedStatement); + } + } + + // Helpers ------------------------------------------------------------------------------------ + + /** + * Map the current row of the given ResultSet to an User. + * @param resultSet The ResultSet of which the current row is to be mapped to an User. + * @return The mapped User from the current row of the given ResultSet. + * @throws SQLException If something fails at database level. + */ + private static UserBean map(ResultSet resultSet) throws SQLException { + UserBean user = new UserBean(); + user.setUsername(resultSet.getString("username")); + user.setPassword(resultSet.getString("password")); + user.setEmail(resultSet.getString("email")); + user.setRole(resultSet.getInt("role")); + return user; + } +} diff --git a/src/java/filter/AuthenticationFilter.java b/src/java/filter/AuthenticationFilter.java new file mode 100644 index 00000000..45759c10 --- /dev/null +++ b/src/java/filter/AuthenticationFilter.java @@ -0,0 +1,268 @@ +/* + * 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 filter; + +import java.io.IOException; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import model.NavigationController; +import model.UserBean; + +/** + * + * @author calvin-pc + */ +public class AuthenticationFilter implements Filter { + + private static final boolean debug = true; + + // The filter configuration object we are associated with. If + // this value is null, this filter instance is not currently + // configured. + private FilterConfig filterConfig = null; + + public AuthenticationFilter() { + } + + private void doBeforeProcessing(ServletRequest request, ServletResponse response) + throws IOException, ServletException { + if (debug) { + log("AuthenticationFilter:DoBeforeProcessing"); + } + + // Write code here to process the request and/or response before + // the rest of the filter chain is invoked. + // For example, a logging filter might log items on the request object, + // such as the parameters. + /* + for (Enumeration en = request.getParameterNames(); en.hasMoreElements(); ) { + String name = (String)en.nextElement(); + String values[] = request.getParameterValues(name); + int n = values.length; + StringBuffer buf = new StringBuffer(); + buf.append(name); + buf.append("="); + for(int i=0; i < n; i++) { + buf.append(values[i]); + if (i < n-1) + buf.append(","); + } + log(buf.toString()); + } + */ + } + + private void doAfterProcessing(ServletRequest request, ServletResponse response) + throws IOException, ServletException { + if (debug) { + log("AuthenticationFilter:DoAfterProcessing"); + } + + // Write code here to process the request and/or response after + // the rest of the filter chain is invoked. + // For example, a logging filter might log the attributes on the + // request object after the request has been processed. + /* + for (Enumeration en = request.getAttributeNames(); en.hasMoreElements(); ) { + String name = (String)en.nextElement(); + Object value = request.getAttribute(name); + log("attribute: " + name + "=" + value.toString()); + + } + */ + // For example, a filter might append something to the response. + /* + PrintWriter respOut = new PrintWriter(response.getWriter()); + respOut.println("

This has been appended by an intrusive filter."); + */ + } + + /** + * + * @param request The servlet request we are processing + * @param response The servlet response we are creating + * @param chain The filter chain we are processing + * + * @exception IOException if an input/output error occurs + * @exception ServletException if a servlet error occurs + */ + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) + throws IOException, ServletException { + + if (debug) { + log("AuthenticationFilter:doFilter()"); + } + + doBeforeProcessing(request, response); + + Throwable problem = null; + try { + + // check whether session variable is set + HttpServletRequest req = (HttpServletRequest) request; + HttpServletResponse res = (HttpServletResponse) response; + HttpSession ses = req.getSession(); + UserBean user; + NavigationController nc = new NavigationController(); + user = (UserBean)ses.getAttribute("userBean"); + // allow user to proccede if url is Login.xhtml or List-Post.xhtml or View-Post.xhtml + // TODO ganti ini dengan navigation bean kalau navigation bean sudah selesai + String reqURI = req.getRequestURI(); + reqURI = reqURI.substring(reqURI.indexOf("/faces/")+"/faces/".length()); + if (reqURI.startsWith(nc.gotoLogin()) + || reqURI.startsWith(nc.gotoListPost()) + || reqURI.startsWith("css/") + || reqURI.startsWith(nc.gotoViewPost()) + || reqURI.startsWith("javax.faces.resource/")) + chain.doFilter(request, response); + else if (user==null) + res.sendRedirect(req.getContextPath() +"/faces/" +nc.gotoLogin()); // Anonymous user. Redirect to login page + else if ((user.getRole() == UserBean.getOwner()) + && (reqURI.startsWith(nc.gotoEditPost()) + || reqURI.startsWith(nc.gotoAddPost()) + ) + ) + chain.doFilter(request, response); + else if ((user.getRole() == UserBean.getEditor()) + && (reqURI.startsWith(nc.gotoEditPost()) + || reqURI.startsWith(nc.gotoUnpublishedPost()) + || reqURI.startsWith(nc.gotoViewUnpublished()) + ) + ) + chain.doFilter(request, response); + else if (user.getRole() == UserBean.getAdmin()) + chain.doFilter(request, response); + else { + res.sendRedirect(req.getContextPath() +"/faces/" +nc.gotoLogin()); // Anonymous user. Redirect to login page + } + } + catch(Throwable t) { + System.out.println( t.getMessage()); + } + + doAfterProcessing(request, response); + + // If there was a problem, we want to rethrow it if it is + // a known type, otherwise log it. + if (problem != null) { + if (problem instanceof ServletException) { + throw (ServletException) problem; + } + if (problem instanceof IOException) { + throw (IOException) problem; + } + sendProcessingError(problem, response); + } + } + + /** + * Return the filter configuration object for this filter. + */ + public FilterConfig getFilterConfig() { + return (this.filterConfig); + } + + /** + * Set the filter configuration object for this filter. + * + * @param filterConfig The filter configuration object + */ + public void setFilterConfig(FilterConfig filterConfig) { + this.filterConfig = filterConfig; + } + + /** + * Destroy method for this filter + */ + public void destroy() { + } + + /** + * Init method for this filter + */ + public void init(FilterConfig filterConfig) { + this.filterConfig = filterConfig; + if (filterConfig != null) { + if (debug) { + log("AuthenticationFilter:Initializing filter"); + } + } + } + + /** + * Return a String representation of this object. + */ + @Override + public String toString() { + if (filterConfig == null) { + return ("AuthenticationFilter()"); + } + StringBuffer sb = new StringBuffer("AuthenticationFilter("); + sb.append(filterConfig); + sb.append(")"); + return (sb.toString()); + } + + private void sendProcessingError(Throwable t, ServletResponse response) { + String stackTrace = getStackTrace(t); + + if (stackTrace != null && !stackTrace.equals("")) { + try { + response.setContentType("text/html"); + PrintStream ps = new PrintStream(response.getOutputStream()); + PrintWriter pw = new PrintWriter(ps); + pw.print("\n\nError\n\n\n"); //NOI18N + + // PENDING! Localize this for next official release + pw.print("

The resource did not process correctly

\n
\n");                
+                pw.print(stackTrace);                
+                pw.print("
\n"); //NOI18N + pw.close(); + ps.close(); + response.getOutputStream().close(); + } catch (Exception ex) { + } + } else { + try { + PrintStream ps = new PrintStream(response.getOutputStream()); + t.printStackTrace(ps); + ps.close(); + response.getOutputStream().close(); + } catch (Exception ex) { + } + } + } + + public static String getStackTrace(Throwable t) { + String stackTrace = null; + try { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + t.printStackTrace(pw); + pw.close(); + sw.close(); + stackTrace = sw.getBuffer().toString(); + } catch (Exception ex) { + } + return stackTrace; + } + + public void log(String msg) { + filterConfig.getServletContext().log(msg); + } + +} diff --git a/src/java/model/AddKomentar.java b/src/java/model/AddKomentar.java new file mode 100644 index 00000000..0747b393 --- /dev/null +++ b/src/java/model/AddKomentar.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.Date; +/** + * + * @author Afik + */ +public class AddKomentar { + + // TODO semua, sambungin ke List-User.xhtml, dao, dan teman - teman + + private UserBean user; + public AddKomentar() { + + } + + public void add(Komentar komentar) throws IOException { + if (user.getRole()!=UserBean.getGuest()) { + komentar.setNama(user.getUsername()); + komentar.setEmail(user.getEmail()); + } + String Tanggal = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); + komentar.setTanggal(Tanggal); + System.out.println("FLAG : "+komentar.getPID()); + DAO.CommentDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getKomentarDAO(); + DB.create(komentar); + } + + public String submit(Komentar komentar) throws IOException{ + add(komentar); + return "succes?faces-redirect=true&includeViewParams=true"; + + } + + /** + * @return the user + */ + public UserBean getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(UserBean user) { + this.user = user; + } +} diff --git a/src/java/model/AddUserBean.java b/src/java/model/AddUserBean.java new file mode 100644 index 00000000..5fd592bc --- /dev/null +++ b/src/java/model/AddUserBean.java @@ -0,0 +1,49 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package model; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +/** + * + * @author calvin-pc + */ +public class AddUserBean { + // TODO semua, sambungin ke List-User.xhtml, dao, dan teman - teman + private UserBean user; + /** + * Creates a new instance of AddUserBean + */ + public AddUserBean() { + user = new UserBean(); + } + + /** + * @return the user + */ + public UserBean getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(UserBean user) { + this.user = user; + } + + public void add() { + DAO.UserDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getUserDAO(); + if (DB.find(getUser().getUsername()) != null) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage("Username already exists!")); + } + else { + DB.create(getUser()); + } + } +} diff --git a/src/java/model/AllKomentar.java b/src/java/model/AllKomentar.java new file mode 100644 index 00000000..6fa23a94 --- /dev/null +++ b/src/java/model/AllKomentar.java @@ -0,0 +1,43 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import java.util.ArrayList; + +/** + * + * @author Afik + */ +public class AllKomentar { + + private int PID; + private ArrayList allKomentar; + + /** + * Creates a new instance of AllKomentar + */ + public AllKomentar() { + } + + public int getPID(){ + return PID; + } + + public ArrayList getAllKomentar() { + allKomentar = new ArrayList (DAO.DAOFactory.getInstance("javabase.jdbc").getKomentarDAO().list(PID)); + System.out.println("flag : " + PID); + return allKomentar; + } + + public void setPID(int PID) { + this.PID = PID; + } + + public void setAllKomentar(ArrayList allKomentar) { + this.allKomentar = allKomentar; + } +} diff --git a/src/java/model/AllPostBean.java b/src/java/model/AllPostBean.java new file mode 100644 index 00000000..d387a7aa --- /dev/null +++ b/src/java/model/AllPostBean.java @@ -0,0 +1,53 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import java.util.ArrayList; + +/** + * + * @author Afik + */ +public class AllPostBean { + private ArrayList publishedPost; + private ArrayList unPublishedPost; + /** + * Creates a new instance of AllPostBean + */ + public AllPostBean() { + } + + /** + * @return the allPost + */ + public ArrayList getPublishedPost() { + publishedPost = new ArrayList (DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO().listPublish()); + return publishedPost; + } + + /** + * @param publishedPost the publishedPost to set + */ + public void setPublishedPost(ArrayList publishedPost) { + this.publishedPost = publishedPost; + } + + /** + * @return the unPublishedPost + */ + public ArrayList getUnPublishedPost() { + unPublishedPost = new ArrayList (DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO().listUnPublish()); + return unPublishedPost; + } + + /** + * @param unPublishedPost the unPublishedPost to set + */ + public void setUnPublishedPost(ArrayList unPublishedPost) { + this.unPublishedPost = unPublishedPost; + } +} diff --git a/src/java/model/AllUserBean.java b/src/java/model/AllUserBean.java new file mode 100644 index 00000000..dcbe47e3 --- /dev/null +++ b/src/java/model/AllUserBean.java @@ -0,0 +1,38 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package model; + +import java.util.ArrayList; + +/** + * + * @author calvin-pc + */ +public class AllUserBean { + + private ArrayList allUser; + /** + * Creates a new instance of AllUserBean + */ + public AllUserBean() { + } + + /** + * @return the allUser + */ + public ArrayList getAllUser() { + allUser = new ArrayList (DAO.DAOFactory.getInstance("javabase.jdbc").getUserDAO().list()); + return allUser; + } + + /** + * @param allUser the allUser to set + */ + public void setAllUser(ArrayList allUser) { + this.allUser = allUser; + } + +} diff --git a/src/java/model/CookieHelper.java b/src/java/model/CookieHelper.java new file mode 100644 index 00000000..df487524 --- /dev/null +++ b/src/java/model/CookieHelper.java @@ -0,0 +1,73 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package model; + +import javax.faces.context.FacesContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author calvin-pc + */ +public class CookieHelper { + + public void setCookie(String name, String value,int expiry) { + + FacesContext facesContext = FacesContext.getCurrentInstance(); + + HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); + Cookie cookie = null; + + Cookie[] userCookies = request.getCookies(); + if (userCookies != null && userCookies.length > 0 ) { + for (int i = 0; i < userCookies.length; i++) { + if (userCookies[i].getName().equals(name)) { + cookie = userCookies[i]; + break; + } + } + } + + if (cookie != null) { + cookie.setValue(value); + cookie.setPath("/"); + } else { + cookie = new Cookie(name, value); + cookie.setPath("/"); + } + + cookie.setMaxAge(expiry); + + HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); + response.addCookie(cookie); + } + + public Cookie getCookie(String name) { + + FacesContext facesContext = FacesContext.getCurrentInstance(); + + HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); + Cookie cookie = null; + + Cookie[] userCookies = request.getCookies(); + if (userCookies != null && userCookies.length > 0 ) { + for (int i = 0; i < userCookies.length; i++) { + if (userCookies[i].getName().equals(name)) { + cookie = userCookies[i]; + return cookie; + } + } + } + return null; + } + + public void deleteCookie (String name) { + HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); + setCookie(name,null,0); + } +} \ No newline at end of file diff --git a/src/java/model/DeleteUserBean.java b/src/java/model/DeleteUserBean.java new file mode 100644 index 00000000..070e2be9 --- /dev/null +++ b/src/java/model/DeleteUserBean.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 model; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +/** + * + * @author calvin-pc + */ +public class DeleteUserBean { + + /** + * Creates a new instance of DeleteUserBean + */ + public DeleteUserBean() { + } + + public void delete(String username) { + DAO.UserDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getUserDAO(); + if (DB.find(username) == null) { + // TODO sambungin dengan error message + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage("Username doesn't exists!")); + } + else { + UserBean deleted = new UserBean(); + deleted.setUsername(username); + DB.delete(deleted); + } + } + +} diff --git a/src/java/model/EditUserBean.java b/src/java/model/EditUserBean.java new file mode 100644 index 00000000..ba7bd96b --- /dev/null +++ b/src/java/model/EditUserBean.java @@ -0,0 +1,50 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package model; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +/** + * + * @author calvin-pc + */ +public class EditUserBean { + + private UserBean edited; + /** + * Creates a new instance of EditUserBean + */ + public EditUserBean() { + edited = new UserBean(); + } + + /** + * @return the edited + */ + public UserBean getEdited() { + return edited; + } + + /** + * @param edited the edited to set + */ + public void setEdited(UserBean edited) { + this.edited = edited; + } + + public void edit() { + DAO.UserDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getUserDAO(); + if (DB.find(edited.getUsername()) == null) { + // TODO sambungin dengan error message + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage("Username doesn't exists!")); + } + else { + DB.update(edited); + } + } +} diff --git a/src/java/model/Komentar.java b/src/java/model/Komentar.java new file mode 100644 index 00000000..63dbb951 --- /dev/null +++ b/src/java/model/Komentar.java @@ -0,0 +1,144 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.ViewScoped; + +/** + * + * @author Afik + */ +@ManagedBean +@ViewScoped +public class Komentar { + + /** + * Creates a new instance of Komentar + */ + + private UserBean user; + private int PID; + private int KID; + private String Nama; + private String Email; + private String Tanggal; + private String Komentar; + + public Komentar() { + PID = 0; + KID = 0; + if (user == null || user.getRole()==UserBean.getGuest()) { + Nama = new String(); + Email = new String(); + } + else { + Nama = user.getUsername(); + Email = user.getEmail(); + } + Tanggal = new String(); + Komentar = new String(); + } + + /** + * @return the PID + */ + public int getPID() { + return PID; + } + + /** + * @param PID the PID to set + */ + public void setPID(int PID) { + this.PID = PID; + } + + /** + * @return the KID + */ + public int getKID() { + return KID; + } + + /** + * @param KID the KID to set + */ + public void setKID(int KID) { + this.KID = KID; + } + + /** + * @return the Nama + */ + public String getNama() { + return Nama; + } + + /** + * @param Nama the Nama to set + */ + public void setNama(String Nama) { + this.Nama = Nama; + } + + /** + * @return the Email + */ + public String getEmail() { + return Email; + } + + /** + * @param Email the Email to set + */ + public void setEmail(String Email) { + this.Email = Email; + } + + /** + * @return the Tanggal + */ + public String getTanggal() { + return Tanggal; + } + + /** + * @param Tanggal the Tanggal to set + */ + public void setTanggal(String Tanggal) { + this.Tanggal = Tanggal; + } + + /** + * @return the Komentar + */ + public String getKomentar() { + return Komentar; + } + + /** + * @param Komentar the Komentar to set + */ + public void setKomentar(String Komentar) { + this.Komentar = Komentar; + } + + /** + * @return the user + */ + public UserBean getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(UserBean user) { + this.user = user; + } +} \ No newline at end of file diff --git a/src/java/model/ListPost.java b/src/java/model/ListPost.java new file mode 100644 index 00000000..7b5c4cc6 --- /dev/null +++ b/src/java/model/ListPost.java @@ -0,0 +1,89 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +/** + * + * @author Afik + */ +@ManagedBean +@RequestScoped +public class ListPost { + + ArrayList listPost= new ArrayList(); + ArrayList unpublishedPost = new ArrayList(); + /** + * Creates a new instance of ListPost + * @return Post + * @throws java.sql.SQLException + */ + + public ArrayList fetchPublishedPost() throws SQLException { + try { + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/simple_blog_2", "root", ""); + Statement sta = conn.createStatement(); + String Sql = "select * from entries where PUBLISHED=true"; + ResultSet rs = sta.executeQuery(Sql); + while(rs.next()) { + Post p = new Post(); + p.setJudul(rs.getString(2)); + p.setDate(rs.getString(3)); + p.setKonten(rs.getString(4)); + p.setPID(rs.getInt(1)); + p.setAuthor(rs.getString(6)); + p.setPublished(rs.getBoolean(5)); + listPost.add(p); + System.out.println("fdfsf"); + } + conn.close(); + return listPost; + } catch (ClassNotFoundException ex) { + if (1==1)throw new SQLException("ggal"); + Logger.getLogger(ListPost.class.getName()).log(Level.SEVERE, null, ex); + return null; + } + } + + public ArrayList fetchUnpublishPost() throws SQLException{ + try { + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/simple_blog_2", "root", ""); + Statement sta = conn.createStatement(); + String Sql = "select * from entries where PUBLISHED=false"; + ResultSet rs = sta.executeQuery(Sql); + while(rs.next()) { + Post p = new Post(); + p.setJudul(rs.getString(2)); + p.setDate(rs.getString(3)); + p.setKonten(rs.getString(4)); + p.setPID(rs.getInt(1)); + p.setAuthor(rs.getString(6)); + p.setPublished(rs.getBoolean(5)); + listPost.add(p); + } + conn.close(); + return listPost; + } catch (ClassNotFoundException ex) { + if (1==1)throw new SQLException("ggal"); + Logger.getLogger(ListPost.class.getName()).log(Level.SEVERE, null, ex); + return null; + } + } + + +} diff --git a/src/java/model/LoginBean.java b/src/java/model/LoginBean.java new file mode 100644 index 00000000..371fa007 --- /dev/null +++ b/src/java/model/LoginBean.java @@ -0,0 +1,97 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package model; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +/** + * + * @author calvin-pc + */ +public class LoginBean { + + private String username; + private String password; + private UserBean user; + /** + * Creates a new instance of LoginBean + */ + public LoginBean() { + CookieHelper ck = new CookieHelper(); + username = new String(); + password = new String(); + if (ck.getCookie("username") != null) { + username = ck.getCookie("username").getValue(); + } + if (ck.getCookie("password") != null) { + password = ck.getCookie("password").getValue(); + } + } + + public String login() { + NavigationController nb = new NavigationController(); + UserBean finded = DAO.DAOFactory.getInstance("javabase.jdbc").getUserDAO().find(username); + if (finded == null || !finded.getPassword().equals(password)) { + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage("Username atau Password salah")); + return nb.gotoLogin() ; + } + else { + CookieHelper ck = new CookieHelper(); + int expiry = 60*60*24*30; //30 hari + user.setUsername(finded.getUsername()); + user.setPassword(finded.getPassword()); + user.setRole(finded.getRole()); + user.setEmail(finded.getEmail()); + ck.setCookie("username", username, expiry); + ck.setCookie("password", password, expiry); + return nb.gotoListPost() + "?faces-redirect=true"; + } + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the user + */ + public UserBean getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(UserBean user) { + this.user = user; + } +} diff --git a/src/java/model/NavigationController.java b/src/java/model/NavigationController.java new file mode 100644 index 00000000..1f9c24f5 --- /dev/null +++ b/src/java/model/NavigationController.java @@ -0,0 +1,78 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import java.io.Serializable; +import javax.faces.bean.RequestScoped; +import javax.faces.bean.ManagedBean; +/** + * + * @author Afik + */ +@ManagedBean(name = "NavigationController" , eager = true) +@RequestScoped +public class NavigationController implements Serializable{ + + /** + * Creates a new instance of NavigationController + */ + public NavigationController() { + } + + public String gotoLogin() { + return "Login.xhtml"; + } + + public String gotoListUser(){ + return "List-User.xhtml"; + } + + public String gotoListPost() { + return "List-Post.xhtml"; + } + + public String gotoAddPost() { + return "Add-Post.xhtml"; + } + + public String gotoUnpublishedPost() { + return "List-Unpublish-Post.xhtml"; + } + + public String gotoEditPost(int post_id) { + return "Edit-Post.xhtml?id=" + post_id; + } + + public String gotoDeletePost(int post_id) { + return "Delete-Post.xhtml?id=" + post_id; + } + + public String gotoViewPost(int post_id) { + System.out.println("klik here:" +post_id); + return "View-Post_2.xhtml?id=" + post_id; + } + + public String gotoViewUnpublished(int post_id) { + return "View-Post_unpublished.xhtml?id=" + post_id; + } + + public String gotoViewUnpublished() { + return "View-Post_unpublished.xhtml"; + } + + public String gotoEditPost() { + return "Edit-Post.xhtml"; + } + + public String gotoDeletePost() { + return "Delete-Post.xhtml"; + } + + public String gotoViewPost(){ + return "View-Post_2.xhtml"; + } +} \ No newline at end of file diff --git a/src/java/model/Post.java b/src/java/model/Post.java new file mode 100644 index 00000000..f6f72362 --- /dev/null +++ b/src/java/model/Post.java @@ -0,0 +1,144 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.faces.bean.ManagedProperty; + +/** + * + * @author Afik + */ +public class Post { + + /** + * Creates a new instance of Post + */ + private String Judul; + private String Konten; + private String Date; + private String Author; + private boolean Published; + @ManagedProperty(value="#{id}") + private int PID; + + public Post() { + + } + + /** + * @return the Judul + */ + public String getJudul() { + return Judul; + } + + /** + * @param Judul the Judul to set + */ + public void setJudul(String Judul) { + this.Judul = Judul; + } + + /** + * @return the Konten + */ + public String getKonten() { + return Konten; + } + + /** + * @param Konten the Konten to set + */ + public void setKonten(String Konten) { + this.Konten = Konten; + } + + /** + * @return the Date + */ + public String getDate() { + return Date; + } + + /** + * @param Date the Date to set + */ + public void setDate(String Date) { + this.Date = Date; + } + + /** + * @return the Author + */ + public String getAuthor() { + return Author; + } + + /** + * @param Author the Author to set + */ + public void setAuthor(String Author) { + this.Author = Author; + } + + /** + * @return the Published + */ + public boolean isPublished() { + return Published; + } + + /** + * @param Published the Published to set + */ + public void setPublished(boolean Published) { + this.Published = Published; + } + + /** + * @return the PID + */ + public int getPID() { + return PID; + } + + /** + * @param PID the PID to set + */ + public void setPID(int PID) { + this.PID = PID; + } + public Post fetchPost(int id) throws SQLException { + try { + Class.forName("com.mysql.jdbc.Driver"); + Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/simple_blog_2", "root", ""); + Statement sta = conn.createStatement(); + String Sql = "select * from entries where PID="+id; + ResultSet rs = sta.executeQuery(Sql); + rs.next(); + this.setJudul(rs.getString(2)); + this.setDate(rs.getString(3)); + this.setKonten(rs.getString(4)); + this.setPID(rs.getInt(1)); + this.setAuthor(rs.getString(6)); + this.setPublished(rs.getBoolean(5)); + conn.close(); + return this; + } catch (ClassNotFoundException ex) { + if (1==1)throw new SQLException("ggal"); + Logger.getLogger(ListPost.class.getName()).log(Level.SEVERE, null, ex); + return null; + } + } +} diff --git a/src/java/model/PostAddBean.java b/src/java/model/PostAddBean.java new file mode 100644 index 00000000..68164f41 --- /dev/null +++ b/src/java/model/PostAddBean.java @@ -0,0 +1,60 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; +/** + * + * @author pc asus + */ +public class PostAddBean { + + private UserBean user; + // TODO semua, sambungin ke List-User.xhtml, dao, dan teman - teman + private Post post; + /** + * Creates a new instance of AddUserBean + */ + public PostAddBean() { + post = new Post(); + } + + /** + * @return the user + */ + public Post getPost() { + return post; + } + + /** + * @param user the user to set + */ + public void setPost(Post post) { + this.post = post; + } + + public String add() { + NavigationController nb = new NavigationController(); + post.setAuthor(getUser().getUsername()); + DAO.PostDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO(); + DB.create(post); + return nb.gotoListPost()+ "?faces-redirect=true"; + } + + /** + * @return the user + */ + public UserBean getUser() { + return user; + } + + /** + * @param user the user to set + */ + public void setUser(UserBean user) { + this.user = user; + } + } + diff --git a/src/java/model/PostDeleteBean.java b/src/java/model/PostDeleteBean.java new file mode 100644 index 00000000..39b5676c --- /dev/null +++ b/src/java/model/PostDeleteBean.java @@ -0,0 +1,52 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; +/** + * + * @author pc asus + */ +public class PostDeleteBean { + /** + * Creates a new instance of DeleteUserBean + */ + private Post deleted; + public PostDeleteBean() { + deleted = new Post(); + } + + /** + * @return the edited + */ + public Post getEdited() { + return deleted; + } + + /** + * @param edited the edited to set + */ + public void setDeleted(Post delted) { + this.deleted = deleted; + } + public String delete(int PID) { + NavigationController nb = new NavigationController(); + DAO.PostDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO(); + System.out.println("Joshua"+PID); + if (DB.find(PID) == null) { + // TODO sambungin dengan error message + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage("Username doesn't exists!")); + } + else { + Post deleted = new Post(); + deleted.setPID(PID); + DB.delete(deleted); + } + return nb.gotoListPost()+ "?faces-redirect=true"; + } +} diff --git a/src/java/model/PostEditBean.java b/src/java/model/PostEditBean.java new file mode 100644 index 00000000..6dcf08db --- /dev/null +++ b/src/java/model/PostEditBean.java @@ -0,0 +1,58 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + + +/** + * + * @author pc asus + */ +public class PostEditBean { + + private Post edited; + /** + * Creates a new instance of EditUserBean + */ + public PostEditBean() { + edited = new Post(); + edited.setPublished(false); + } + + public void reload() { + DAO.PostDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO(); + if (DB.find(edited.getPID()) != null) { + Post X; + X = DB.find(edited.getPID()); + edited = X; + System.out.println("X="+X.getPID()); + } + } + + /** + * @return the edited + */ + public Post getEdited() { + return edited; + } + + /** + * @param edited the edited to set + */ + public void setEdited(Post edited) { + this.edited = edited; + } + + public String edit() { + System.out.println("EDIT:"+edited.getPID()); + System.out.println("Published:"+edited.isPublished()); + + NavigationController nb = new NavigationController(); + DAO.PostDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO(); + DB.update(edited); + return nb.gotoListPost()+ "?faces-redirect=true"; + } +} diff --git a/src/java/model/PostPublishBean.java b/src/java/model/PostPublishBean.java new file mode 100644 index 00000000..b998728f --- /dev/null +++ b/src/java/model/PostPublishBean.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; + +/** + * + * @author pc asus + */ +public class PostPublishBean { + private UserBean user; + // TODO semua, sambungin ke List-User.xhtml, dao, dan teman - teman + private Post post; + /** + * Creates a new instance of AddUserBean + */ + public PostPublishBean() { + post = new Post(); + } + + /** + * @return the user + */ + public Post getPost() { + return post; + } + + /** + * @param user the user to set + */ + public void setPost(Post post) { + this.post = post; + } + public String publish(int PID) { + NavigationController nb = new NavigationController(); + DAO.PostDAO DB = DAO.DAOFactory.getInstance("javabase.jdbc").getPostDAO(); + + if (DB.find(PID) == null) { + // TODO sambungin dengan error message + FacesContext.getCurrentInstance().addMessage(null, + new FacesMessage("Username doesn't exists!")); + } + else { + Post published = DB.find(PID); + published.setPublished(true); + DB.update(published); + } + return nb.gotoListPost()+ "?faces-redirect=true"; + } +} diff --git a/src/java/model/UserBean.java b/src/java/model/UserBean.java new file mode 100644 index 00000000..40f6d0a2 --- /dev/null +++ b/src/java/model/UserBean.java @@ -0,0 +1,135 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package model; + +/** + * + * @author calvin-pc + */ +public class UserBean { + // TODO Tambah nama user dan email dan kawan - kawan + private static final int owner = 1; + private static final int admin = 2; + private static final int editor = 3; + private static final int guest = 4; + + private String username; + private String password; + private String email; + /** + * @return the owner + */ + public static int getOwner() { + return owner; + } + + /** + * @return the admin + */ + public static int getAdmin() { + return admin; + } + + /** + * @return the editor + */ + public static int getEditor() { + return editor; + } + + /** + * @return the guest + */ + public static int getGuest() { + return guest; + } + + private int role; + /** + * Creates a new instance of UserBean + */ + public UserBean() { + role = guest; + username = new String(); + password = new String(); + } + + /** + * @return the role + */ + public int getRole() { + return role; + } + + /** + * @param role the role to set + */ + public void setRole(int role) { + this.role = role; + } + + public String getRoleName() { + if (role == owner) return "owner"; + else if (role == admin) return "admin"; + else if (role == editor) return "editor"; + else return "guest"; + } + + /** + * @return the username + */ + public String getUsername() { + return username; + } + + /** + * @param username the username to set + */ + public void setUsername(String username) { + this.username = username; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + public String logout () { + NavigationController nc = new NavigationController(); + this.username = new String(); + this.password = new String(); + this.role = guest; + + //Delete Cookies + CookieHelper ck = new CookieHelper(); + ck.deleteCookie("username"); + ck.deleteCookie("password"); + return nc.gotoLogin() + "?faces-redirect=true"; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } +} diff --git a/src/java/model/jjhj.java b/src/java/model/jjhj.java new file mode 100644 index 00000000..566ad2e8 --- /dev/null +++ b/src/java/model/jjhj.java @@ -0,0 +1,17 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package model; + +/** + * + * @author Afik + */ +public class jjhj { + public int getX() { + return 1; + } +} diff --git a/src/java/resource/person.png b/src/java/resource/person.png new file mode 100644 index 00000000..e4ba27cf Binary files /dev/null and b/src/java/resource/person.png differ diff --git a/src/java/resource/simple_blog_2.sql b/src/java/resource/simple_blog_2.sql new file mode 100644 index 00000000..83654eee --- /dev/null +++ b/src/java/resource/simple_blog_2.sql @@ -0,0 +1,113 @@ +-- phpMyAdmin SQL Dump +-- version 4.2.7.1 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Generation Time: Nov 26, 2014 at 03:23 AM +-- Server version: 5.6.20 +-- PHP Version: 5.5.15 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; + +-- +-- Database: `simple_blog_2` +-- + +-- -------------------------------------------------------- + +-- +-- Table structure for table `entries` +-- + +CREATE TABLE IF NOT EXISTS `entries` ( +`PID` int(11) NOT NULL, + `JUDUL` text NOT NULL, + `TANGGAL` date NOT NULL, + `KONTEN` text NOT NULL, + `PUBLISHED` tinyint(1) NOT NULL, + `AUTHOR` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; + +-- +-- Dumping data for table `entries` +-- + +INSERT INTO `entries` (`PID`, `JUDUL`, `TANGGAL`, `KONTEN`, `PUBLISHED`, `AUTHOR`) VALUES +(1, 'Everything You Need to Know About Grunt', '2014-11-25', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.', 1, 'blah blah'); + +-- -------------------------------------------------------- + +-- +-- Table structure for table `komentar` +-- + +CREATE TABLE IF NOT EXISTS `komentar` ( + `PID` int(11) NOT NULL, +`KID` int(11) NOT NULL, + `NAMA` varchar(50) NOT NULL, + `EMAIL` varchar(50) NOT NULL, + `TANGGAL` date NOT NULL, + `KOMENTAR` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `USERNAME` varchar(20) NOT NULL, + `PASSWORD` varchar(20) NOT NULL, + `ROLE` int(11) NOT NULL, + `EMAIL` text NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTO `user` (`USERNAME`, `PASSWORD`, `ROLE`, `EMAIL`) VALUES +('budi', 'kuyup_hujan', '2', 'budi@kecil.co.id'); +-- +-- Indexes for dumped tables +-- + +-- +-- Indexes for table `entries` +-- +ALTER TABLE `entries` + ADD PRIMARY KEY (`PID`), ADD UNIQUE KEY `PID` (`PID`); + +-- +-- Indexes for table `komentar` +-- +ALTER TABLE `komentar` + ADD PRIMARY KEY (`KID`), ADD UNIQUE KEY `KID` (`KID`); + +-- +-- Indexes for table `user` +-- +ALTER TABLE `user` + ADD PRIMARY KEY (`USERNAME`); + +-- +-- AUTO_INCREMENT for dumped tables +-- + +-- +-- AUTO_INCREMENT for table `entries` +-- +ALTER TABLE `entries` +MODIFY `PID` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2; +-- +-- AUTO_INCREMENT for table `komentar` +-- +ALTER TABLE `komentar` +MODIFY `KID` int(11) NOT NULL AUTO_INCREMENT; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/src/java/validator/DateValidator.java b/src/java/validator/DateValidator.java new file mode 100644 index 00000000..700a408f --- /dev/null +++ b/src/java/validator/DateValidator.java @@ -0,0 +1,55 @@ +/* + * 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 validator; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +/** + * + * @author Afik + */ +public class DateValidator implements Validator{ + + private Date Tanggal; + + + public DateValidator(){ + Tanggal = new Date(); + } + + @Override + public void validate(FacesContext context, UIComponent component, Object value) + throws ValidatorException + { + DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + formatter.setLenient(false); + Date tanggal; + try { + tanggal = formatter.parse((String) value); + if (Tanggal.compareTo(tanggal)>-1) { + FacesMessage msg = + new FacesMessage(" Date validation failed.", + "Please put newer date"); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + + throw new ValidatorException(msg); + } + } catch (ParseException ex) { + Logger.getLogger(DateValidator.class.getName()).log(Level.SEVERE, null, ex); + } + } +} diff --git a/src/java/validator/EmailValidator.java b/src/java/validator/EmailValidator.java new file mode 100644 index 00000000..c91c5501 --- /dev/null +++ b/src/java/validator/EmailValidator.java @@ -0,0 +1,45 @@ +/* + * 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 validator; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +/** + * + * @author calvin-pc + */ +public class EmailValidator implements Validator{ + private Pattern pattern; + private Matcher matcher; + + private static final String EMAIL_PATTERN = "^[\\w-_\\.+]*[\\w-_\\.]\\" + + "@([\\w]+\\.)+[\\w]+[\\w]$"; + + public EmailValidator(){ + pattern = Pattern.compile(EMAIL_PATTERN); + } + + @Override + public void validate(FacesContext context, UIComponent component, Object value) + throws ValidatorException { + String email = (String) value; + matcher = pattern.matcher(email); + if (!matcher.matches()) { + FacesMessage msg = + new FacesMessage(" Email validation failed.", + "Please provide valid Email"); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + + throw new ValidatorException(msg); + } + } +} diff --git a/src/java/validator/PasswordValidator.java b/src/java/validator/PasswordValidator.java new file mode 100644 index 00000000..d543b771 --- /dev/null +++ b/src/java/validator/PasswordValidator.java @@ -0,0 +1,44 @@ +/* + * 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 validator; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +/** + * + * @author calvin-pc + */ +public class PasswordValidator implements Validator{ + private Pattern pattern; + private Matcher matcher; + + private static final String PASSWORD_PATTERN = "^[a-z0-9_-]{6,20}$"; + + public PasswordValidator(){ + pattern = Pattern.compile(PASSWORD_PATTERN); + } + + @Override + public void validate(FacesContext context, UIComponent component, Object value) + throws ValidatorException { + String password = (String) value; + matcher = pattern.matcher(password); + if (!matcher.matches()) { + FacesMessage msg = + new FacesMessage(" Password validation failed.", + "Please provide password using a-z,0-9,,_,- character with length 6-20"); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + + throw new ValidatorException(msg); + } + } +} diff --git a/src/java/validator/UsernameValidator.java b/src/java/validator/UsernameValidator.java new file mode 100644 index 00000000..f4a0fb9a --- /dev/null +++ b/src/java/validator/UsernameValidator.java @@ -0,0 +1,46 @@ +/* + * 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 validator; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.faces.application.FacesMessage; +import javax.faces.component.UIComponent; +import javax.faces.context.FacesContext; +import javax.faces.validator.Validator; +import javax.faces.validator.ValidatorException; + +/** + * + * @author calvin-pc + */ +public class UsernameValidator implements Validator{ + + + private Pattern pattern; + private Matcher matcher; + + private static final String USERNAME_PATTERN = "^[a-z0-9_-]{3,15}$"; + + public UsernameValidator(){ + pattern = Pattern.compile(USERNAME_PATTERN); + } + + @Override + public void validate(FacesContext context, UIComponent component, Object value) + throws ValidatorException { + String username = (String) value; + matcher = pattern.matcher(username); + if (!matcher.matches()) { + FacesMessage msg = + new FacesMessage(" Username validation failed.", + "Please provide username using a-z,0-9,,_,- character with length 3-15"); + msg.setSeverity(FacesMessage.SEVERITY_ERROR); + + throw new ValidatorException(msg); + } + } +} diff --git a/web/Add-Post.xhtml b/web/Add-Post.xhtml new file mode 100644 index 00000000..f60a8d03 --- /dev/null +++ b/web/Add-Post.xhtml @@ -0,0 +1,45 @@ + + + + + + Add Post + + + + +

Add Post

+
+ +
+ + +

+
+ + + + +

+ +

+ + +
+ +
+
+
+
> +
+
+ diff --git a/web/Edit-Post.xhtml b/web/Edit-Post.xhtml new file mode 100644 index 00000000..1a018ce4 --- /dev/null +++ b/web/Edit-Post.xhtml @@ -0,0 +1,49 @@ + + + + + + Edit Post + + + + + + + +

Edit Post

+
+ +
+ +

+
+ + + + +

+

+ + +
+ + + + +
+
+
+
> +
+
+ diff --git a/web/List-Post.xhtml b/web/List-Post.xhtml new file mode 100644 index 00000000..41773600 --- /dev/null +++ b/web/List-Post.xhtml @@ -0,0 +1,47 @@ + + + + + + List Post + + + + +

List Post

+
    + +
  • +
    +

    #{item.judul}

    +
    + + + + + + + + +
    +
  • +
    +
+
+
> +
+
+ \ No newline at end of file diff --git a/web/List-Unpublish-Post.xhtml b/web/List-Unpublish-Post.xhtml new file mode 100644 index 00000000..cc8ec604 --- /dev/null +++ b/web/List-Unpublish-Post.xhtml @@ -0,0 +1,51 @@ + + + + + + List Unpublished Post + + + + +

List Unpublished Post

+
    + +
  • +
    +

    #{item.judul}

    +
    + + + + + + + + + + + + +
    +
  • +
    +
+
+
> +
+
+ \ No newline at end of file diff --git a/web/List-User.xhtml b/web/List-User.xhtml new file mode 100644 index 00000000..c3980061 --- /dev/null +++ b/web/List-User.xhtml @@ -0,0 +1,137 @@ + + + + + + List User + + + + + + +
+
+ +
+

Edit User

+
+ + + + +
+
+ + + + +
+
+ + + + + +
+ +
+ + + + +
+ + +
+
+
+
+ +
+

Add User

+
+ + + + +
+
+ + + + +
+
+ + + + + +
+ +
+ + + + +
+ + +
+
+
+
+

List User

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ diff --git a/web/Login.xhtml b/web/Login.xhtml new file mode 100644 index 00000000..48e14432 --- /dev/null +++ b/web/Login.xhtml @@ -0,0 +1,43 @@ + + + + + + Login Form + + + + + +
+ Login + +
+ + + + +

+ +
+ + + + +

+ +
+ +
+ +
+
+
+
+ \ No newline at end of file diff --git a/web/View-Post_2.xhtml b/web/View-Post_2.xhtml new file mode 100644 index 00000000..9b3a7053 --- /dev/null +++ b/web/View-Post_2.xhtml @@ -0,0 +1,84 @@ + + + + + + Post title + + + + + + + + + +
+
+

#{Post.fetchPost(param['id']).judul}

+ + +
+ +
+

+ #{Post.fetchPost(param['id']).konten} +

+ +
+
+

Komentar

+
+ + + +

+ + + + + +

+ +
+ +

+ + + +

+
+
    + +
  • +

    #{komentar.tanggal} | #{komentar.nama}

    + +

    + #{komentar.komentar} +

    +
  • +
    +
+
+
+ +
+ +
+
> +
+
+ diff --git a/web/View-Post_unpublished.xhtml b/web/View-Post_unpublished.xhtml new file mode 100644 index 00000000..34c19cfb --- /dev/null +++ b/web/View-Post_unpublished.xhtml @@ -0,0 +1,45 @@ + + + + + + Post title + + + + + + + + + +
+
+

#{Post.fetchPost(param['id']).judul}

+ + +
+ +
+

+ #{Post.fetchPost(param['id']).konten} +

+ +
+
+
+
> +
+
+ diff --git a/web/WEB-INF/faces-config.xml b/web/WEB-INF/faces-config.xml new file mode 100644 index 00000000..3637df13 --- /dev/null +++ b/web/WEB-INF/faces-config.xml @@ -0,0 +1,127 @@ + + + + userBean + model.UserBean + session + + + Post + model.Post + request + + + NavigationController + model.NavigationController + request + + + ListPost + model.ListPost + request + + + loginBean + model.LoginBean + request + + user + model.UserBean + #{userBean} + + + + allUserBean + model.AllUserBean + request + + + editUserBean + model.EditUserBean + request + + + addUserBean + model.AddUserBean + request + + + usernameValidator + validator.UsernameValidator + + + passwordValidator + validator.PasswordValidator + + + emailValidator + validator.EmailValidator + + + dateValidator + validator.DateValidator + + + komentar + model.Komentar + view + + user + model.UserBean + #{userBean} + + + + deleteUserBean + model.DeleteUserBean + request + + + allKomentar + model.AllKomentar + view + + + addKomentar + model.AddKomentar + view + + user + model.UserBean + #{userBean} + + + + postAddBean + model.PostAddBean + request + + user + model.UserBean + #{userBean} + + + + postEditBean + model.PostEditBean + view + + + postDeleteBean + model.PostDeleteBean + request + + + postPublishBean + model.PostPublishBean + request + + + allPostBean + model.AllPostBean + request + + \ No newline at end of file diff --git a/web/WEB-INF/glassfish-web.xml b/web/WEB-INF/glassfish-web.xml new file mode 100644 index 00000000..4f5a531d --- /dev/null +++ b/web/WEB-INF/glassfish-web.xml @@ -0,0 +1,11 @@ + + + + /Simple_Blog + + + + Keep a copy of the generated servlet class' java code. + + + diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 00000000..209349be --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,29 @@ + + + + + AuthenticationFilter + filter.AuthenticationFilter + + + AuthenticationFilter + /faces/* + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/web/css/blog-old-ie.css b/web/css/blog-old-ie.css new file mode 100644 index 00000000..73ef4587 --- /dev/null +++ b/web/css/blog-old-ie.css @@ -0,0 +1,191 @@ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +a { + text-decoration: none; + color: rgb(61, 146, 201); +} + +a:hover, +a:focus { + text-decoration: underline; +} + +h3 { + font-weight: 100; +} + +/* LAYOUT CSS */ + +.pure-img-responsive { + max-width: 100%; + height: auto; +} + +#layout { + padding: 0; +} + +.header { + text-align: center; + top: auto; + margin: 3em auto; +} + +.sidebar { + background: rgb(61, 79, 93); + color: #fff; +} + +.brand-title, +.brand-tagline { + margin: 0; +} + +.brand-title { + text-transform: uppercase; +} + +.brand-tagline { + font-weight: 300; + color: rgb(176, 202, 219); +} + +.nav-list { + margin: 0; + padding: 0; + list-style: none; +} + +.nav-item { + display: inline-block; + *display: inline; + zoom: 1; +} + +.nav-item a { + background: transparent; + border: 2px solid rgb(176, 202, 219); + color: #fff; + margin-top: 1em; + letter-spacing: 0.05em; + text-transform: uppercase; + font-size: 85%; +} + +.nav-item a:hover, +.nav-item a:focus { + border: 2px solid rgb(61, 146, 201); + text-decoration: none; +} + +.content-subhead { + text-transform: uppercase; + color: #aaa; + border-bottom: 1px solid #eee; + padding: 0.4em 0; + font-size: 80%; + font-weight: 500; + letter-spacing: 0.1em; +} + +.content { + padding: 2em 1em 0; +} + +.post { + padding-bottom: 2em; +} + +.post-title { + font-size: 2em; + color: #222; + margin-bottom: 0.2em; +} + +.post-avatar { + border-radius: 50px; + float: right; + margin-left: 1em; +} + +.post-description { + font-family: Georgia, "Cambria", serif; + color: #444; + line-height: 1.8em; +} + +.post-meta { + color: #999; + font-size: 90%; + margin: 0; +} + +.post-category { + margin: 0 0.1em; + padding: 0.3em 1em; + color: #fff; + background: #999; + font-size: 80%; +} + +.post-category-design { + background: #5aba59; +} + +.post-category-pure { + background: #4d85d1; +} + +.post-category-yui { + background: #8156a7; +} + +.post-category-js { + background: #df2d4f; +} + +.post-images { + margin: 1em 0; +} + +.post-image-meta { + margin-top: -3.5em; + margin-left: 1em; + color: #fff; + text-shadow: 0 1px 1px #333; +} + +.footer { + text-align: center; + padding: 1em 0; +} + +.footer a { + color: #ccc; + font-size: 80%; +} + +.footer .pure-menu a:hover, +.footer .pure-menu a:focus { + background: none; +} + +.content { + padding: 2em 3em 0; + margin-left: 25%; +} + +.header { + margin: 80% 2em 0; + text-align: right; +} + +.sidebar { + position: fixed; + top: 0; + bottom: 0; +} \ No newline at end of file diff --git a/web/css/blog.css b/web/css/blog.css new file mode 100644 index 00000000..ddb474d2 --- /dev/null +++ b/web/css/blog.css @@ -0,0 +1,514 @@ +* { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +a { + text-decoration: none; + color: rgb(61, 146, 201); +} +a:hover, +a:focus { + text-decoration: underline; +} + +h3 { + font-weight: 100; +} + +/* LAYOUT CSS */ +.pure-img-responsive { + max-width: 100%; + height: auto; +} + +#layout { + padding: 0; +} + +.header { + text-align: center; + top: auto; + margin: 3em auto; + width: 300px; +} + +.upper-menu { + float:right; + margin-left: 2em; + height: 80px; + font-size: 14px; + margin-bottom:1cm; +} + +.upper-menu .pure-button { + background: rgb(61, 79, 93) !important; + color: white; + margin-left: 10px; +} + +.upper-menu .img-role { + border-radius: 20px; + margin-left: 10px; +} +.sidebar { + background: rgb(61, 79, 93); + color: #fff; +} + +.brand-title, +.brand-tagline { + margin: 0; +} +.brand-title { + text-transform: uppercase; +} +.brand-tagline { + font-weight: 300; + color: rgb(176, 202, 219); +} +.list-nama { + text-align: right; +} + +.list-post pure-button { + display : inline; +} + +.list-post-title { + font-size: 28px; + color: rgb(61, 79, 93); + margin-bottom: 0.1em; +} + + +.nav-list { + margin: 0; + padding: 0; + list-style: none; + +} +.nav-item { + + display: inline-block; + *display: inline; + zoom: 1; +} +.nav-item img { + display: block; +} +.nav-item a { + background: transparent; + border: 2px solid rgb(176, 202, 219); + color: #fff; + letter-spacing: 0.05em; + text-transform: uppercase; + font-size: 85%; +} +.nav-item a:hover, +.nav-item a:focus { + border: 2px solid rgb(61, 146, 201); + text-decoration: none; +} + +.content-subhead { + text-transform: uppercase; + color: #aaa; + border-bottom: 1px solid #eee; + padding: 0.4em 0; + font-size: 80%; + font-weight: 500; + letter-spacing: 0.1em; +} + +.content { + padding: 2em 1em 0; + height: auto; + min-height: 100%; + margin: 0 auto -4em; + +} +.posts { + padding-left: 1cm; +} + +.post { + padding-bottom: 2em; +} +.post-title { + font-size: 42px; + color: rgb(61, 79, 93); + margin-bottom: 0.1em;} + +.post-description { + font-family: Georgia, "Cambria", serif; + color: #444; + line-height: 1.8em; +} +.post-meta { + color: #999; + font-size: 16px; +} + +.error_message{ + color :red; +} + +.komentar-title { + font-size: 20px; + color: rgb(61, 79, 93); +} + +.komentar-meta { + color: #999; + font-size: 16px; +} + +.footer { + height:4em; + position: absolute; + left:350px; + top:600px; +} +.footer a { + color: #ccc; + font-size: 80%; +} +.footer .pure-menu a:hover, +.footer .pure-menu a:focus { + background: none; +} +/* HORIZONTAL MENU CODE */ + +/* Initial menus should be inline-block so that they are horizontal */ +.pure-menu-horizontal li { + display: inline-block; + *display: inline; + zoom: 1; + vertical-align: middle; + margin-left: 20px; +} + +/* Submenus should still be display: block; */ +.pure-menu-horizontal li li { + display: block; +} + +/* Content after should be down arrow */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label:after { + content: "\25BE"; +} +/*Add extra padding to elements that have the arrow so that the hover looks nice */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label { + padding-right: 30px; +} + +/* Adjusting separator for vertical menus */ +.pure-menu-horizontal li.pure-menu-separator { + height: 50%; + width: 1px; + margin: 0 7px; +} + +/* Submenus should be horizontal separator again */ +.pure-menu-horizontal li li.pure-menu-separator { + height: 1px; + width: auto; + margin: 7px 2px; +} + + +/*csslint adjoining-classes:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + +/* MAIN MENU STYLING */ +.pure-menu-horizontal{ + margin-left: 300px; +} + +.pure-menu.pure-menu-open, +.pure-menu.pure-menu-horizontal li .pure-menu-children { + background: #fff; /* Old browsers */ + border: 1px solid #b7b7b7; +} + +/* remove borders for horizontal menus */ +.pure-menu.pure-menu-horizontal, +.pure-menu.pure-menu-horizontal .pure-menu-heading { + border: none; +} + + +/*Button*/ +.pure-button { + /* Structure */ + display: inline-block; + *display: inline; /*IE 6/7*/ + zoom: 1; + line-height: normal; + white-space: nowrap; + vertical-align: baseline; + text-align: center; + cursor: pointer; + -webkit-user-drag: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + background: rgb(61, 79, 93) !important; + color: white !important; + margin-left: 10px; +} + + +.pure-button { + font-family: inherit; + font-size: 100%; + *font-size: 90%; /*IE 6/7 - To reduce IE's oversized button text*/ + *overflow: visible; /*IE 6/7 - Because of IE's overly large left/right padding on buttons */ + padding: 0.5em 1em; + border: 1px solid #999; /*IE 6/7/8*/ + border: none rgba(0, 0, 0, 0); /*IE9 + everything else*/ + background-color: #E6E6E6; + text-decoration: none; + border-radius: 2px; +} + +.pure-button-hover, +.pure-button:hover, +.pure-button:focus { + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000',GradientType=0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); + background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); + background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); +} +.pure-button:focus { + outline: 0; +} +.pure-button-active, +.pure-button:active { + box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset; +} + +.pure-button[disabled], +.pure-button-disabled, +.pure-button-disabled:hover, +.pure-button-disabled:focus, +.pure-button-disabled:active { + border: none; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + filter: alpha(opacity=40); + -khtml-opacity: 0.40; + -moz-opacity: 0.40; + opacity: 0.40; + cursor: not-allowed; + box-shadow: none; +} + +.pure-button-hidden { + display: none; +} + +/* Firefox: Get rid of the inner focus border */ +.pure-button::-moz-focus-inner{ + padding: 0; + border: 0; +} + +/** FORM **/ + +.pure-form input[type="text"], +.pure-form input[type="password"], +.pure-form input[type="email"], +.pure-form input[type="url"], +.pure-form input[type="date"], +.pure-form input[type="month"], +.pure-form input[type="time"], +.pure-form input[type="datetime"], +.pure-form input[type="datetime-local"], +.pure-form input[type="week"], +.pure-form input[type="number"], +.pure-form input[type="search"], +.pure-form input[type="tel"], +.pure-form input[type="color"], +.pure-form select, +.pure-form textarea { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]) { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + + +/* Chrome (as of v.32/34 on OS X) needs additional room for color to display. */ +/* May be able to remove this tweak as color inputs become more standardized across browsers. */ +.pure-form input[type="color"] { + padding: 0.2em 0.5em; +} + + +.pure-form input[type="text"]:focus, +.pure-form input[type="password"]:focus, +.pure-form input[type="email"]:focus, +.pure-form input[type="url"]:focus, +.pure-form input[type="date"]:focus, +.pure-form input[type="month"]:focus, +.pure-form input[type="time"]:focus, +.pure-form input[type="datetime"]:focus, +.pure-form input[type="datetime-local"]:focus, +.pure-form input[type="week"]:focus, +.pure-form input[type="number"]:focus, +.pure-form input[type="search"]:focus, +.pure-form input[type="tel"]:focus, +.pure-form input[type="color"]:focus, +.pure-form select:focus, +.pure-form textarea:focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]):focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +.pure-form input[type="file"]:focus, +.pure-form input[type="radio"]:focus, +.pure-form input[type="checkbox"]:focus { + outline: thin dotted #333; + outline: 1px auto #129FEA; +} +.pure-form .pure-checkbox, +.pure-form .pure-radio { + margin: 0.5em 0; + display: block; +} + +.pure-form input[type="text"][disabled], +.pure-form input[type="password"][disabled], +.pure-form input[type="email"][disabled], +.pure-form input[type="url"][disabled], +.pure-form input[type="date"][disabled], +.pure-form input[type="month"][disabled], +.pure-form input[type="time"][disabled], +.pure-form input[type="datetime"][disabled], +.pure-form input[type="datetime-local"][disabled], +.pure-form input[type="week"][disabled], +.pure-form input[type="number"][disabled], +.pure-form input[type="search"][disabled], +.pure-form input[type="tel"][disabled], +.pure-form input[type="color"][disabled], +.pure-form select[disabled], +.pure-form textarea[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type])[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} +.pure-form input[readonly], +.pure-form select[readonly], +.pure-form textarea[readonly] { + background: #eee; /* menu hover bg color */ + color: #777; /* menu text color */ + border-color: #ccc; +} + +.pure-form input:focus:invalid, +.pure-form textarea:focus:invalid, +.pure-form select:focus:invalid { + color: #b94a48; + border-color: #ee5f5b; +} +.pure-form input:focus:invalid:focus, +.pure-form textarea:focus:invalid:focus, +.pure-form select:focus:invalid:focus { + border-color: #e9322d; +} +.pure-form input[type="file"]:focus:invalid:focus, +.pure-form input[type="radio"]:focus:invalid:focus, +.pure-form input[type="checkbox"]:focus:invalid:focus { + outline-color: #e9322d; +} +.pure-form select { + border: 1px solid #ccc; + background-color: white; +} +.pure-form select[multiple] { + height: auto; +} +.pure-form label { + margin: 0.5em 0 0.2em; +} +.pure-form fieldset { + margin: 0; + padding: 0.35em 0 0.75em; + border: 0; +} +.pure-form legend { + display: block; + width: 100%; + padding: 0.3em 0; + margin-bottom: 0.3em; + color: #333; + border-bottom: 1px solid #e5e5e5; +} + +.komentar{ + padding-left: 10px; +} + +@media(min-width: 48em) { + .content { + padding: 2em 3em 0; + margin-left: 25%; + padding-left: 2cm; + } + + .header { + margin: 80% 2em 0; + text-align: right; + } + + .sidebar { + position: fixed; + top: 0; + bottom: 0; + } +} diff --git a/web/css/pure.css b/web/css/pure.css new file mode 100644 index 00000000..abe7598a --- /dev/null +++ b/web/css/pure.css @@ -0,0 +1,1664 @@ +/*! +Pure v0.5.0 +Copyright 2014 Yahoo! Inc. All rights reserved. +Licensed under the BSD License. +https://github.com/yui/pure/blob/master/LICENSE.md +*/ +/*! +normalize.css v1.1.3 | MIT License | git.io/normalize +Copyright (c) Nicolas Gallagher and Jonathan Neal +*/ +/*! normalize.css v1.1.3 | MIT License | git.io/normalize */ + +/* ========================================================================== + HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +nav, +section, +summary { + display: block; +} + +/** + * Correct `inline-block` display not defined in IE 6/7/8/9 and Firefox 3. + */ + +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address styling not present in IE 7/8/9, Firefox 3, and Safari 4. + * Known issue: no IE 6 support. + */ + +[hidden] { + display: none; +} + +/* ========================================================================== + Base + ========================================================================== */ + +/** + * 1. Correct text resizing oddly in IE 6/7 when body `font-size` is set using + * `em` units. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-size: 100%; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Address `font-family` inconsistency between `textarea` and other form + * elements. + */ + +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} + +/** + * Address margins handled incorrectly in IE 6/7. + */ + +body { + margin: 0; +} + +/* ========================================================================== + Links + ========================================================================== */ + +/** + * Address `outline` inconsistency between Chrome and other browsers. + */ + +a:focus { + outline: thin dotted; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* ========================================================================== + Typography + ========================================================================== */ + +/** + * Address font sizes and margins set differently in IE 6/7. + * Address font sizes within `section` and `article` in Firefox 4+, Safari 5, + * and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} + +h3 { + font-size: 1.17em; + margin: 1em 0; +} + +h4 { + font-size: 1em; + margin: 1.33em 0; +} + +h5 { + font-size: 0.83em; + margin: 1.67em 0; +} + +h6 { + font-size: 0.67em; + margin: 2.33em 0; +} + +/** + * Address styling not present in IE 7/8/9, Safari 5, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 3+, Safari 4/5, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +blockquote { + margin: 1em 40px; +} + +/** + * Address styling not present in Safari 5 and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address differences between Firefox and other browsers. + * Known issue: no IE 6/7 normalization. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Address styling not present in IE 6/7/8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address margins set differently in IE 6/7. + */ + +p, +pre { + margin: 1em 0; +} + +/** + * Correct font family set oddly in IE 6, Safari 4/5, and Chrome. + */ + +code, +kbd, +pre, +samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; +} + +/** + * Improve readability of pre-formatted text in all browsers. + */ + +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} + +/** + * Address CSS quotes not supported in IE 6/7. + */ + +q { + quotes: none; +} + +/** + * Address `quotes` property not supported in Safari 4. + */ + +q:before, +q:after { + content: ''; + content: none; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* ========================================================================== + Lists + ========================================================================== */ + +/** + * Address margins set differently in IE 6/7. + */ + +dl, +menu, +ol, +ul { + margin: 1em 0; +} + +dd { + margin: 0 0 0 40px; +} + +/** + * Address paddings set differently in IE 6/7. + */ + +menu, +ol, +ul { + padding: 0 0 0 40px; +} + +/** + * Correct list images handled incorrectly in IE 7. + */ + +nav ul, +nav ol { + list-style: none; + list-style-image: none; +} + +/* ========================================================================== + Embedded content + ========================================================================== */ + +/** + * 1. Remove border when inside `a` element in IE 6/7/8/9 and Firefox 3. + * 2. Improve image quality when scaled in IE 7. + */ + +img { + border: 0; /* 1 */ + -ms-interpolation-mode: bicubic; /* 2 */ +} + +/** + * Correct overflow displayed oddly in IE 9. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* ========================================================================== + Figures + ========================================================================== */ + +/** + * Address margin not present in IE 6/7/8/9, Safari 5, and Opera 11. + */ + +figure { + margin: 0; +} + +/* ========================================================================== + Forms + ========================================================================== */ + +/** + * Correct margin displayed oddly in IE 6/7. + */ + +form { + margin: 0; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct color not being inherited in IE 6/7/8/9. + * 2. Correct text not wrapping in Firefox 3. + * 3. Correct alignment displayed oddly in IE 6/7. + */ + +legend { + border: 0; /* 1 */ + padding: 0; + white-space: normal; /* 2 */ + *margin-left: -7px; /* 3 */ +} + +/** + * 1. Correct font size not being inherited in all browsers. + * 2. Address margins set differently in IE 6/7, Firefox 3+, Safari 5, + * and Chrome. + * 3. Improve appearance and consistency in all browsers. + */ + +button, +input, +select, +textarea { + font-size: 100%; /* 1 */ + margin: 0; /* 2 */ + vertical-align: baseline; /* 3 */ + *vertical-align: middle; /* 3 */ +} + +/** + * Address Firefox 3+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +button, +input { + line-height: normal; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Chrome, Safari 5+, and IE 6+. + * Correct `select` style inheritance in Firefox 4+ and Opera. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + * 4. Remove inner spacing in IE 7 without affecting normal text inputs. + * Known issue: inner spacing remains in IE 6. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ + *overflow: visible; /* 4 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * 1. Address box sizing set to content-box in IE 8/9. + * 2. Remove excess padding in IE 8/9. + * 3. Remove excess padding in IE 7. + * Known issue: excess padding remains in IE 6. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ + *height: 13px; /* 3 */ + *width: 13px; /* 3 */ +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari 5 and Chrome + * on OS X. + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Remove inner padding and border in Firefox 3+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * 1. Remove default vertical scrollbar in IE 6/7/8/9. + * 2. Improve readability and alignment in all browsers. + */ + +textarea { + overflow: auto; /* 1 */ + vertical-align: top; /* 2 */ +} + +/* ========================================================================== + Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +/*csslint important:false*/ + +/* ========================================================================== + Pure Base Extras + ========================================================================== */ + +/** + * Extra rules that Pure adds on top of Normalize.css + */ + +/** + * Always hide an element when it has the `hidden` HTML attribute. + */ + +[hidden] { + display: none !important; +} + +/** + * Add this class to an image to make it fit within it's fluid parent wrapper while maintaining + * aspect ratio. + */ +.pure-img { + max-width: 100%; + height: auto; + display: block; +} + +/*csslint regex-selectors:false, known-properties:false, duplicate-properties:false*/ + +.pure-g { + letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ + *letter-spacing: normal; /* reset IE < 8 */ + *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ + text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ + + /* + Sets the font stack to fonts known to work properly with the above letter + and word spacings. See: https://github.com/yui/pure/issues/41/ + + The following font stack makes Pure Grids work on all known environments. + + * FreeSans: Ships with many Linux distros, including Ubuntu + + * Arimo: Ships with Chrome OS. Arimo has to be defined before Helvetica and + Arial to get picked up by the browser, even though neither is available + in Chrome OS. + + * Droid Sans: Ships with all versions of Android. + + * Helvetica, Arial, sans-serif: Common font stack on OS X and Windows. + */ + font-family: FreeSans, Arimo, "Droid Sans", Helvetica, Arial, sans-serif; + + /* + Use flexbox when possible to avoid `letter-spacing` side-effects. + + NOTE: Firefox (as of 25) does not currently support flex-wrap, so the + `-moz-` prefix version is omitted. + */ + + display: -webkit-flex; + -webkit-flex-flow: row wrap; + + /* IE10 uses display: flexbox */ + display: -ms-flexbox; + -ms-flex-flow: row wrap; +} + +/* Opera as of 12 on Windows needs word-spacing. + The ".opera-only" selector is used to prevent actual prefocus styling + and is not required in markup. +*/ +.opera-only :-o-prefocus, +.pure-g { + word-spacing: -0.43em; +} + +.pure-u { + display: inline-block; + *display: inline; /* IE < 8: fake inline-block */ + zoom: 1; + letter-spacing: normal; + word-spacing: normal; + vertical-align: top; + text-rendering: auto; +} + +/* +Resets the font family back to the OS/browser's default sans-serif font, +this the same font stack that Normalize.css sets for the `body`. +*/ +.pure-g [class *= "pure-u"] { + font-family: sans-serif; +} + +.pure-u-1, +.pure-u-1-1, +.pure-u-1-2, +.pure-u-1-3, +.pure-u-2-3, +.pure-u-1-4, +.pure-u-3-4, +.pure-u-1-5, +.pure-u-2-5, +.pure-u-3-5, +.pure-u-4-5, +.pure-u-5-5, +.pure-u-1-6, +.pure-u-5-6, +.pure-u-1-8, +.pure-u-3-8, +.pure-u-5-8, +.pure-u-7-8, +.pure-u-1-12, +.pure-u-5-12, +.pure-u-7-12, +.pure-u-11-12, +.pure-u-1-24, +.pure-u-2-24, +.pure-u-3-24, +.pure-u-4-24, +.pure-u-5-24, +.pure-u-6-24, +.pure-u-7-24, +.pure-u-8-24, +.pure-u-9-24, +.pure-u-10-24, +.pure-u-11-24, +.pure-u-12-24, +.pure-u-13-24, +.pure-u-14-24, +.pure-u-15-24, +.pure-u-16-24, +.pure-u-17-24, +.pure-u-18-24, +.pure-u-19-24, +.pure-u-20-24, +.pure-u-21-24, +.pure-u-22-24, +.pure-u-23-24, +.pure-u-24-24 { + display: inline-block; + *display: inline; + zoom: 1; + letter-spacing: normal; + word-spacing: normal; + vertical-align: top; + text-rendering: auto; +} + +.pure-u-1-24 { + width: 4.1667%; + *width: 4.1357%; +} + +.pure-u-1-12, +.pure-u-2-24 { + width: 8.3333%; + *width: 8.3023%; +} + +.pure-u-1-8, +.pure-u-3-24 { + width: 12.5000%; + *width: 12.4690%; +} + +.pure-u-1-6, +.pure-u-4-24 { + width: 16.6667%; + *width: 16.6357%; +} + +.pure-u-1-5 { + width: 20%; + *width: 19.9690%; +} + +.pure-u-5-24 { + width: 20.8333%; + *width: 20.8023%; +} + +.pure-u-1-4, +.pure-u-6-24 { + width: 25%; + *width: 24.9690%; +} + +.pure-u-7-24 { + width: 29.1667%; + *width: 29.1357%; +} + +.pure-u-1-3, +.pure-u-8-24 { + width: 33.3333%; + *width: 33.3023%; +} + +.pure-u-3-8, +.pure-u-9-24 { + width: 37.5000%; + *width: 37.4690%; +} + +.pure-u-2-5 { + width: 40%; + *width: 39.9690%; +} + +.pure-u-5-12, +.pure-u-10-24 { + width: 41.6667%; + *width: 41.6357%; +} + +.pure-u-11-24 { + width: 45.8333%; + *width: 45.8023%; +} + +.pure-u-1-2, +.pure-u-12-24 { + width: 50%; + *width: 49.9690%; +} + +.pure-u-13-24 { + width: 54.1667%; + *width: 54.1357%; +} + +.pure-u-7-12, +.pure-u-14-24 { + width: 58.3333%; + *width: 58.3023%; +} + +.pure-u-3-5 { + width: 60%; + *width: 59.9690%; +} + +.pure-u-5-8, +.pure-u-15-24 { + width: 62.5000%; + *width: 62.4690%; +} + +.pure-u-2-3, +.pure-u-16-24 { + width: 66.6667%; + *width: 66.6357%; +} + +.pure-u-17-24 { + width: 70.8333%; + *width: 70.8023%; +} + +.pure-u-3-4, +.pure-u-18-24 { + width: 75%; + *width: 74.9690%; +} + +.pure-u-19-24 { + width: 79.1667%; + *width: 79.1357%; +} + +.pure-u-4-5 { + width: 80%; + *width: 79.9690%; +} + +.pure-u-5-6, +.pure-u-20-24 { + width: 83.3333%; + *width: 83.3023%; +} + +.pure-u-7-8, +.pure-u-21-24 { + width: 87.5000%; + *width: 87.4690%; +} + +.pure-u-11-12, +.pure-u-22-24 { + width: 91.6667%; + *width: 91.6357%; +} + +.pure-u-23-24 { + width: 95.8333%; + *width: 95.8023%; +} + +.pure-u-1, +.pure-u-1-1, +.pure-u-5-5, +.pure-u-24-24 { + width: 100%; +} +.pure-button { + /* Structure */ + display: inline-block; + *display: inline; /*IE 6/7*/ + zoom: 1; + line-height: normal; + white-space: nowrap; + vertical-align: baseline; + text-align: center; + cursor: pointer; + -webkit-user-drag: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +/* Firefox: Get rid of the inner focus border */ +.pure-button::-moz-focus-inner { + padding: 0; + border: 0; +} + +/*csslint outline-none:false*/ + +.pure-button { + font-family: inherit; + font-size: 100%; + *font-size: 90%; /*IE 6/7 - To reduce IE's oversized button text*/ + *overflow: visible; /*IE 6/7 - Because of IE's overly large left/right padding on buttons */ + padding: 0.5em 1em; + color: #444; /* rgba not supported (IE 8) */ + color: rgba(0, 0, 0, 0.80); /* rgba supported */ + *color: #444; /* IE 6 & 7 */ + border: 1px solid #999; /*IE 6/7/8*/ + border: none rgba(0, 0, 0, 0); /*IE9 + everything else*/ + background-color: #E6E6E6; + text-decoration: none; + border-radius: 2px; +} + +.pure-button-hover, +.pure-button:hover, +.pure-button:focus { + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000',GradientType=0); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(transparent), color-stop(40%, rgba(0,0,0, 0.05)), to(rgba(0,0,0, 0.10))); + background-image: -webkit-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: -moz-linear-gradient(top, rgba(0,0,0, 0.05) 0%, rgba(0,0,0, 0.10)); + background-image: -o-linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); + background-image: linear-gradient(transparent, rgba(0,0,0, 0.05) 40%, rgba(0,0,0, 0.10)); +} +.pure-button:focus { + outline: 0; +} +.pure-button-active, +.pure-button:active { + box-shadow: 0 0 0 1px rgba(0,0,0, 0.15) inset, 0 0 6px rgba(0,0,0, 0.20) inset; +} + +.pure-button[disabled], +.pure-button-disabled, +.pure-button-disabled:hover, +.pure-button-disabled:focus, +.pure-button-disabled:active { + border: none; + background-image: none; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + filter: alpha(opacity=40); + -khtml-opacity: 0.40; + -moz-opacity: 0.40; + opacity: 0.40; + cursor: not-allowed; + box-shadow: none; +} + +.pure-button-hidden { + display: none; +} + +/* Firefox: Get rid of the inner focus border */ +.pure-button::-moz-focus-inner{ + padding: 0; + border: 0; +} + +.pure-button-primary, +.pure-button-selected, +a.pure-button-primary, +a.pure-button-selected { + background-color: rgb(0, 120, 231); + color: #fff; +} + +.pure-form input[type="text"], +.pure-form input[type="password"], +.pure-form input[type="email"], +.pure-form input[type="url"], +.pure-form input[type="date"], +.pure-form input[type="month"], +.pure-form input[type="time"], +.pure-form input[type="datetime"], +.pure-form input[type="datetime-local"], +.pure-form input[type="week"], +.pure-form input[type="number"], +.pure-form input[type="search"], +.pure-form input[type="tel"], +.pure-form input[type="color"], +.pure-form select, +.pure-form textarea { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]) { + padding: 0.5em 0.6em; + display: inline-block; + border: 1px solid #ccc; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + + +/* Chrome (as of v.32/34 on OS X) needs additional room for color to display. */ +/* May be able to remove this tweak as color inputs become more standardized across browsers. */ +.pure-form input[type="color"] { + padding: 0.2em 0.5em; +} + + +.pure-form input[type="text"]:focus, +.pure-form input[type="password"]:focus, +.pure-form input[type="email"]:focus, +.pure-form input[type="url"]:focus, +.pure-form input[type="date"]:focus, +.pure-form input[type="month"]:focus, +.pure-form input[type="time"]:focus, +.pure-form input[type="datetime"]:focus, +.pure-form input[type="datetime-local"]:focus, +.pure-form input[type="week"]:focus, +.pure-form input[type="number"]:focus, +.pure-form input[type="search"]:focus, +.pure-form input[type="tel"]:focus, +.pure-form input[type="color"]:focus, +.pure-form select:focus, +.pure-form textarea:focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type]):focus { + outline: 0; + outline: thin dotted \9; /* IE6-9 */ + border-color: #129FEA; +} + +.pure-form input[type="file"]:focus, +.pure-form input[type="radio"]:focus, +.pure-form input[type="checkbox"]:focus { + outline: thin dotted #333; + outline: 1px auto #129FEA; +} +.pure-form .pure-checkbox, +.pure-form .pure-radio { + margin: 0.5em 0; + display: block; +} + +.pure-form input[type="text"][disabled], +.pure-form input[type="password"][disabled], +.pure-form input[type="email"][disabled], +.pure-form input[type="url"][disabled], +.pure-form input[type="date"][disabled], +.pure-form input[type="month"][disabled], +.pure-form input[type="time"][disabled], +.pure-form input[type="datetime"][disabled], +.pure-form input[type="datetime-local"][disabled], +.pure-form input[type="week"][disabled], +.pure-form input[type="number"][disabled], +.pure-form input[type="search"][disabled], +.pure-form input[type="tel"][disabled], +.pure-form input[type="color"][disabled], +.pure-form select[disabled], +.pure-form textarea[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form input:not([type])[disabled] { + cursor: not-allowed; + background-color: #eaeded; + color: #cad2d3; +} +.pure-form input[readonly], +.pure-form select[readonly], +.pure-form textarea[readonly] { + background: #eee; /* menu hover bg color */ + color: #777; /* menu text color */ + border-color: #ccc; +} + +.pure-form input:focus:invalid, +.pure-form textarea:focus:invalid, +.pure-form select:focus:invalid { + color: #b94a48; + border-color: #ee5f5b; +} +.pure-form input:focus:invalid:focus, +.pure-form textarea:focus:invalid:focus, +.pure-form select:focus:invalid:focus { + border-color: #e9322d; +} +.pure-form input[type="file"]:focus:invalid:focus, +.pure-form input[type="radio"]:focus:invalid:focus, +.pure-form input[type="checkbox"]:focus:invalid:focus { + outline-color: #e9322d; +} +.pure-form select { + border: 1px solid #ccc; + background-color: white; +} +.pure-form select[multiple] { + height: auto; +} +.pure-form label { + margin: 0.5em 0 0.2em; +} +.pure-form fieldset { + margin: 0; + padding: 0.35em 0 0.75em; + border: 0; +} +.pure-form legend { + display: block; + width: 100%; + padding: 0.3em 0; + margin-bottom: 0.3em; + color: #333; + border-bottom: 1px solid #e5e5e5; +} + +.pure-form-stacked input[type="text"], +.pure-form-stacked input[type="password"], +.pure-form-stacked input[type="email"], +.pure-form-stacked input[type="url"], +.pure-form-stacked input[type="date"], +.pure-form-stacked input[type="month"], +.pure-form-stacked input[type="time"], +.pure-form-stacked input[type="datetime"], +.pure-form-stacked input[type="datetime-local"], +.pure-form-stacked input[type="week"], +.pure-form-stacked input[type="number"], +.pure-form-stacked input[type="search"], +.pure-form-stacked input[type="tel"], +.pure-form-stacked input[type="color"], +.pure-form-stacked select, +.pure-form-stacked label, +.pure-form-stacked textarea { + display: block; + margin: 0.25em 0; +} + +/* +Need to separate out the :not() selector from the rest of the CSS 2.1 selectors +since IE8 won't execute CSS that contains a CSS3 selector. +*/ +.pure-form-stacked input:not([type]) { + display: block; + margin: 0.25em 0; +} +.pure-form-aligned input, +.pure-form-aligned textarea, +.pure-form-aligned select, +/* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ +.pure-form-aligned .pure-help-inline, +.pure-form-message-inline { + display: inline-block; + *display: inline; + *zoom: 1; + vertical-align: middle; +} +.pure-form-aligned textarea { + vertical-align: top; +} + +/* Aligned Forms */ +.pure-form-aligned .pure-control-group { + margin-bottom: 0.5em; +} +.pure-form-aligned .pure-control-group label { + text-align: right; + display: inline-block; + vertical-align: middle; + width: 10em; + margin: 0 1em 0 0; +} +.pure-form-aligned .pure-controls { + margin: 1.5em 0 0 10em; +} + +/* Rounded Inputs */ +.pure-form input.pure-input-rounded, +.pure-form .pure-input-rounded { + border-radius: 2em; + padding: 0.5em 1em; +} + +/* Grouped Inputs */ +.pure-form .pure-group fieldset { + margin-bottom: 10px; +} +.pure-form .pure-group input { + display: block; + padding: 10px; + margin: 0; + border-radius: 0; + position: relative; + top: -1px; +} +.pure-form .pure-group input:focus { + z-index: 2; +} +.pure-form .pure-group input:first-child { + top: 1px; + border-radius: 4px 4px 0 0; +} +.pure-form .pure-group input:last-child { + top: -2px; + border-radius: 0 0 4px 4px; +} +.pure-form .pure-group button { + margin: 0.35em 0; +} + +.pure-form .pure-input-1 { + width: 100%; +} +.pure-form .pure-input-2-3 { + width: 66%; +} +.pure-form .pure-input-1-2 { + width: 50%; +} +.pure-form .pure-input-1-3 { + width: 33%; +} +.pure-form .pure-input-1-4 { + width: 25%; +} + +/* Inline help for forms */ +/* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ +.pure-form .pure-help-inline, +.pure-form-message-inline { + display: inline-block; + padding-left: 0.3em; + color: #666; + vertical-align: middle; + font-size: 0.875em; +} + +/* Block help for forms */ +.pure-form-message { + display: block; + color: #666; + font-size: 0.875em; +} + +@media only screen and (max-width : 480px) { + .pure-form button[type="submit"] { + margin: 0.7em 0 0; + } + + .pure-form input:not([type]), + .pure-form input[type="text"], + .pure-form input[type="password"], + .pure-form input[type="email"], + .pure-form input[type="url"], + .pure-form input[type="date"], + .pure-form input[type="month"], + .pure-form input[type="time"], + .pure-form input[type="datetime"], + .pure-form input[type="datetime-local"], + .pure-form input[type="week"], + .pure-form input[type="number"], + .pure-form input[type="search"], + .pure-form input[type="tel"], + .pure-form input[type="color"], + .pure-form label { + margin-bottom: 0.3em; + display: block; + } + + .pure-group input:not([type]), + .pure-group input[type="text"], + .pure-group input[type="password"], + .pure-group input[type="email"], + .pure-group input[type="url"], + .pure-group input[type="date"], + .pure-group input[type="month"], + .pure-group input[type="time"], + .pure-group input[type="datetime"], + .pure-group input[type="datetime-local"], + .pure-group input[type="week"], + .pure-group input[type="number"], + .pure-group input[type="search"], + .pure-group input[type="tel"], + .pure-group input[type="color"] { + margin-bottom: 0; + } + + .pure-form-aligned .pure-control-group label { + margin-bottom: 0.3em; + text-align: left; + display: block; + width: 100%; + } + + .pure-form-aligned .pure-controls { + margin: 1.5em 0 0 0; + } + + /* NOTE: pure-help-inline is deprecated. Use .pure-form-message-inline instead. */ + .pure-form .pure-help-inline, + .pure-form-message-inline, + .pure-form-message { + display: block; + font-size: 0.75em; + /* Increased bottom padding to make it group with its related input element. */ + padding: 0.2em 0 0.8em; + } +} + +/*csslint adjoining-classes:false, outline-none:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + +.pure-menu ul { + position: absolute; + visibility: hidden; +} + +.pure-menu.pure-menu-open { + visibility: visible; + z-index: 2; + width: 100%; +} + +.pure-menu ul { + left: -10000px; + list-style: none; + margin: 0; + padding: 0; + top: -10000px; + z-index: 1; +} + +.pure-menu > ul { position: relative; } + +.pure-menu-open > ul { + left: 0; + top: 0; + visibility: visible; +} + +.pure-menu-open > ul:focus { + outline: 0; +} + +.pure-menu li { position: relative; } + +.pure-menu a, +.pure-menu .pure-menu-heading { + display: block; + color: inherit; + line-height: 1.5em; + padding: 5px 20px; + text-decoration: none; + white-space: nowrap; +} + +.pure-menu.pure-menu-horizontal > .pure-menu-heading { + display: inline-block; + *display: inline; + zoom: 1; + margin: 0; + vertical-align: middle; +} +.pure-menu.pure-menu-horizontal > ul { + display: inline-block; + *display: inline; + zoom: 1; + vertical-align: middle; +} + +.pure-menu li a { padding: 5px 20px; } + +.pure-menu-can-have-children > .pure-menu-label:after { + content: '\25B8'; + float: right; + /* These specific fonts have the Unicode char we need. */ + font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'DejaVu Sans', sans-serif; + margin-right: -20px; + margin-top: -1px; +} + +.pure-menu-can-have-children > .pure-menu-label { + padding-right: 30px; +} + +.pure-menu-separator { + background-color: #dfdfdf; + display: block; + height: 1px; + font-size: 0; + margin: 7px 2px; + overflow: hidden; +} + +.pure-menu-hidden { + display: none; +} + +/* FIXED MENU */ +.pure-menu-fixed { + position: fixed; + top: 0; + left: 0; + width: 100%; +} + + +/* HORIZONTAL MENU CODE */ + +/* Initial menus should be inline-block so that they are horizontal */ +.pure-menu-horizontal li { + display: inline-block; + *display: inline; + zoom: 1; + vertical-align: middle; +} + +/* Submenus should still be display: block; */ +.pure-menu-horizontal li li { + display: block; +} + +/* Content after should be down arrow */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label:after { + content: "\25BE"; +} +/*Add extra padding to elements that have the arrow so that the hover looks nice */ +.pure-menu-horizontal > .pure-menu-children > .pure-menu-can-have-children > .pure-menu-label { + padding-right: 30px; +} + +/* Adjusting separator for vertical menus */ +.pure-menu-horizontal li.pure-menu-separator { + height: 50%; + width: 1px; + margin: 0 7px; +} + +/* Submenus should be horizontal separator again */ +.pure-menu-horizontal li li.pure-menu-separator { + height: 1px; + width: auto; + margin: 7px 2px; +} + + +/*csslint adjoining-classes:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + +/* MAIN MENU STYLING */ + +.pure-menu.pure-menu-open, +.pure-menu.pure-menu-horizontal li .pure-menu-children { + background: #fff; /* Old browsers */ + border: 1px solid #b7b7b7; +} + +/* remove borders for horizontal menus */ +.pure-menu.pure-menu-horizontal, +.pure-menu.pure-menu-horizontal .pure-menu-heading { + border: none; +} + + +/* LINK STYLES */ + +.pure-menu a { + border: 1px solid transparent; + border-left: none; + border-right: none; + +} + +.pure-menu a, +.pure-menu .pure-menu-can-have-children > li:after { + color: #777; +} + +.pure-menu .pure-menu-can-have-children > li:hover:after { + color: #fff; +} + +/* Focus style for a dropdown menu-item when the parent has been opened */ +.pure-menu .pure-menu-open { + background: #dedede; +} + + +.pure-menu li a:hover, +.pure-menu li a:focus { + background: #eee; +} + +/* DISABLED STATES */ +.pure-menu li.pure-menu-disabled a:hover, +.pure-menu li.pure-menu-disabled a:focus { + background: #fff; + color: #bfbfbf; +} + +.pure-menu .pure-menu-disabled > a { + background-image: none; + border-color: transparent; + cursor: default; +} + +.pure-menu .pure-menu-disabled > a, +.pure-menu .pure-menu-can-have-children.pure-menu-disabled > a:after { + color: #bfbfbf; +} + +/* HEADINGS */ +.pure-menu .pure-menu-heading { + color: #565d64; + text-transform: uppercase; + font-size: 90%; + margin-top: 0.5em; + border-bottom-width: 1px; + border-bottom-style: solid; + border-bottom-color: #dfdfdf; +} + +/* ACTIVE MENU ITEM */ +.pure-menu .pure-menu-selected a { + color: #000; +} + +/* FIXED MENU */ +.pure-menu.pure-menu-open.pure-menu-fixed { + border: none; + border-bottom: 1px solid #b7b7b7; +} + +/*csslint box-model:false*/ +/*TODO: Remove this lint rule override after a refactor of this code.*/ + + +.pure-paginator { + + /* `pure-g` Grid styles */ + letter-spacing: -0.31em; /* Webkit: collapse white-space between units */ + *letter-spacing: normal; /* reset IE < 8 */ + *word-spacing: -0.43em; /* IE < 8: collapse white-space between units */ + text-rendering: optimizespeed; /* Webkit: fixes text-rendering: optimizeLegibility */ + + /* `pure-paginator` Specific styles */ + list-style: none; + margin: 0; + padding: 0; +} +.opera-only :-o-prefocus, +.pure-paginator { + word-spacing: -0.43em; +} + +/* `pure-u` Grid styles */ +.pure-paginator li { + display: inline-block; + *display: inline; /* IE < 8: fake inline-block */ + zoom: 1; + letter-spacing: normal; + word-spacing: normal; + vertical-align: top; + text-rendering: auto; +} + + +.pure-paginator .pure-button { + border-radius: 0; + padding: 0.8em 1.4em; + vertical-align: top; + height: 1.1em; +} +.pure-paginator .pure-button:focus, +.pure-paginator .pure-button:active { + outline-style: none; +} +.pure-paginator .prev, +.pure-paginator .next { + color: #C0C1C3; + text-shadow: 0 -1px 0 rgba(0,0,0, 0.45); +} +.pure-paginator .prev { + border-radius: 2px 0 0 2px; +} +.pure-paginator .next { + border-radius: 0 2px 2px 0; +} + +@media (max-width: 480px) { + .pure-menu-horizontal { + width: 100%; + } + + .pure-menu-children li { + display: block; + border-bottom: 1px solid black; + } +} + +.pure-table { + /* Remove spacing between table cells (from Normalize.css) */ + border-collapse: collapse; + border-spacing: 0; + empty-cells: show; + border: 1px solid #cbcbcb; +} + +.pure-table caption { + color: #000; + font: italic 85%/1 arial, sans-serif; + padding: 1em 0; + text-align: center; +} + +.pure-table td, +.pure-table th { + border-left: 1px solid #cbcbcb;/* inner column border */ + border-width: 0 0 0 1px; + font-size: inherit; + margin: 0; + overflow: visible; /*to make ths where the title is really long work*/ + padding: 0.5em 1em; /* cell padding */ +} +.pure-table td:first-child, +.pure-table th:first-child { + border-left-width: 0; +} + +.pure-table thead { + background: #e0e0e0; + color: #000; + text-align: left; + vertical-align: bottom; +} + +/* +striping: + even - #fff (white) + odd - #f2f2f2 (light gray) +*/ +.pure-table td { + background-color: transparent; +} +.pure-table-odd td { + background-color: #f2f2f2; +} + +/* nth-child selector for modern browsers */ +.pure-table-striped tr:nth-child(2n-1) td { + background-color: #f2f2f2; +} + +/* BORDERED TABLES */ +.pure-table-bordered td { + border-bottom: 1px solid #cbcbcb; +} +.pure-table-bordered tbody > tr:last-child td, +.pure-table-horizontal tbody > tr:last-child td { + border-bottom-width: 0; +} + + +/* HORIZONTAL BORDERED TABLES */ + +.pure-table-horizontal td, +.pure-table-horizontal th { + border-width: 0 0 1px 0; + border-bottom: 1px solid #cbcbcb; +} +.pure-table-horizontal tbody > tr:last-child td { + border-bottom-width: 0; +} diff --git a/web/index.xhtml b/web/index.xhtml new file mode 100644 index 00000000..f9f5224a --- /dev/null +++ b/web/index.xhtml @@ -0,0 +1,166 @@ + + + + + + + + + Blog – + + + + + + + + + + + + + +
+ + +
+
+ +
+

Pinned Post

+ + +
+
+ Tilo Mitra's avatar + +

Introducing Pure

+ + +
+ +
+

+ Yesterday at CSSConf, we launched Pure – a new CSS library. Phew! Here are the slides from the presentation. Although it looks pretty minimalist, we’ve been working on Pure for several months. After many iterations, we have released Pure as a set of small, responsive, CSS modules that you can use in every web project. +

+
+
+
+ +
+

Recent Posts

+ +
+
+ Eric Ferraiuolo's avatar + +

Everything You Need to Know About Grunt

+ + +
+ +
+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. +

+
+
+ +
+
+ Reid Burke's avatar + +

Photos from CSSConf and JSConf

+ + +
+ +
+
+
+ + Photo of someone working poolside at a resort + + +
+

CSSConf Photos

+
+
+ +
+ + Photo of the sunset on the beach + + +
+

JSConf Photos

+
+
+
+
+
+ +
+
+ Andrew Wooldridge's avatar + +

YUI 3.10.2 Released

+ + +
+ +
+

+ We are happy to announce the release of YUI 3.10.2! You can find it now on the Yahoo! CDN, download it directly, or pull it in via npm. We’ve also updated the YUI Library website with the latest documentation. +

+
+
+
+ + +
+
+
+ + + diff --git a/web/template/basis.xhtml b/web/template/basis.xhtml new file mode 100644 index 00000000..d08c38f3 --- /dev/null +++ b/web/template/basis.xhtml @@ -0,0 +1,85 @@ + + + + + + + + + Simple–Blog + + + + + + + + + + + + + +
+
+ +
+ +
+
+ Main Content +
+ +
+ + +