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..b1da7e75 --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project Tugas2. + + + diff --git a/build/web/Add_Post.xhtml b/build/web/Add_Post.xhtml new file mode 100644 index 00000000..84a6ea74 --- /dev/null +++ b/build/web/Add_Post.xhtml @@ -0,0 +1,90 @@ + + + + + Add New Post + + + + + + #{post.makeEmpty()} + +
+
+
+

Add Post

+ Halaman ini merupakan halaman untuk menambahkan pos ke blog +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/build/web/Add_User.xhtml b/build/web/Add_User.xhtml new file mode 100644 index 00000000..7fb66d1f --- /dev/null +++ b/build/web/Add_User.xhtml @@ -0,0 +1,96 @@ + + + + + Edit User + + + + + + +
+
+
+

Edit User

+ Halaman ini merupakan halaman untuk menambahkan user baru ke blog +
+ +
+
+
+ + #{user.makeEmptySaved()} +
+
+
+ + + + + +
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+
+ + diff --git a/build/web/Delete_Post.xhtml b/build/web/Delete_Post.xhtml new file mode 100644 index 00000000..f48650c2 --- /dev/null +++ b/build/web/Delete_Post.xhtml @@ -0,0 +1,23 @@ + + + + + + TODO supply a title + + + + + #{dbconnector.deletePost(user, param['pid'])} + #{user.loggedOnRedirectToPub()} + + diff --git a/build/web/Edit_Post.xhtml b/build/web/Edit_Post.xhtml new file mode 100644 index 00000000..1fb234ae --- /dev/null +++ b/build/web/Edit_Post.xhtml @@ -0,0 +1,90 @@ + + + + #{post.copy(dbconnector.selectPost(param['pid']))} + + Edit Post | #{post.judul} + + + + + + +
+
+
+

Edit Post

+ Halaman ini merupakan halaman untuk menyunting pos tertentu +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/build/web/Edit_User.xhtml b/build/web/Edit_User.xhtml new file mode 100644 index 00000000..4c7c2d03 --- /dev/null +++ b/build/web/Edit_User.xhtml @@ -0,0 +1,97 @@ + + + + + Edit Post + + + + + + #{user.copyToSaved(dbconnector.selectUser(param['uid']))} + +
+
+
+

Add User

+ Halaman ini merupakan halaman untuk mengedit user +
+ +
+
+
+ +
+
+
+ + + + + +
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+
+ + diff --git a/build/web/META-INF/MANIFEST.MF b/build/web/META-INF/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/build/web/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/build/web/META-INF/context.xml b/build/web/META-INF/context.xml new file mode 100644 index 00000000..3aec977a --- /dev/null +++ b/build/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/build/web/Post.xhtml b/build/web/Post.xhtml new file mode 100644 index 00000000..640d3986 --- /dev/null +++ b/build/web/Post.xhtml @@ -0,0 +1,105 @@ + + + + + #{dbconnector.verify(user, cookiehandler)} + #{post.copy(dbconnector.selectPost(param['pid']))} + + #{post.judul} + + + + + + +
+
+
+

#{post.judul}

+ #{post.tanggal} + +

+
+

Berikan Komentar

+ + #{comment.setPost_id(param['pid'])} + #{comment.init(user)} +
+
+
+ + + +
+
+ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+ +
+ + diff --git a/build/web/Publish_Post.xhtml b/build/web/Publish_Post.xhtml new file mode 100644 index 00000000..9b4d426e --- /dev/null +++ b/build/web/Publish_Post.xhtml @@ -0,0 +1,18 @@ + + + + + Publish Post + + + + + #{post.copy(dbconnector.selectPost(param['pid']))} + #{dbconnector.publishPost(user,post)} + #{user.loggedOnRedirectToPub()} + + diff --git a/build/web/Published_Posts.xhtml b/build/web/Published_Posts.xhtml new file mode 100644 index 00000000..2c404784 --- /dev/null +++ b/build/web/Published_Posts.xhtml @@ -0,0 +1,107 @@ + + + + + + Home Page | Published Posts + + + + + #{dbconnector.verify(user, cookiehandler)} + + #{postlist.initPostList(dbconnector)} + +
+
+
+

Published Posts

+ Halaman ini menampilkan seluruh post yang sudah dipublish oleh admin maupun editor. +
+ +
+ + +
+
+ +
+

#{item.judul}

+

+

+ Read More


+
+ + Edit Post + + Delete + + Publish +
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/build/web/Restore_Post.xhtml b/build/web/Restore_Post.xhtml new file mode 100644 index 00000000..a7e0c4ef --- /dev/null +++ b/build/web/Restore_Post.xhtml @@ -0,0 +1,23 @@ + + + + + + TODO supply a title + + + + + #{dbconnector.restorePost(user, param['pid'])} + #{user.loggedOnRedirectToUnPub()} + + diff --git a/build/web/Soft_Delete_Post.xhtml b/build/web/Soft_Delete_Post.xhtml new file mode 100644 index 00000000..a7952227 --- /dev/null +++ b/build/web/Soft_Delete_Post.xhtml @@ -0,0 +1,23 @@ + + + + + + TODO supply a title + + + + + #{dbconnector.softDeletePost(user, param['pid'])} + #{user.loggedOnRedirectToPub()} + + diff --git a/build/web/Trash.xhtml b/build/web/Trash.xhtml new file mode 100644 index 00000000..d91bafdc --- /dev/null +++ b/build/web/Trash.xhtml @@ -0,0 +1,107 @@ + + + + + + Trash Page + + + + + + #{dbconnector.verify(user,cookiehandler)} + #{postlist.initPostList(dbconnector)} + +
+
+
+

Trash Posts

+ Halaman ini menampilkan seluruh post yang telah dihapus secara soft delete. +
+ +
+ + +
+
+ + + +
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/build/web/Unpublished_Posts.xhtml b/build/web/Unpublished_Posts.xhtml new file mode 100644 index 00000000..d2228b1a --- /dev/null +++ b/build/web/Unpublished_Posts.xhtml @@ -0,0 +1,108 @@ + + + + + + Home Page | Unpublished Posts + + + + + + #{dbconnector.verify(user,cookiehandler)} + #{user.loggedOffRedirectToInd()} + #{postlist.initPostList(dbconnector)} + +
+
+
+

Unpublished Posts

+ Halaman ini menampilkan seluruh post yang belum dipublish oleh admin maupun editor. +
+ +
+ + +
+
+ +
+

#{item.judul}

+

+

+ Read More


+
+ + Edit Post + + Delete + + Publish +
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/build/web/User_Management.xhtml b/build/web/User_Management.xhtml new file mode 100644 index 00000000..92a7705b --- /dev/null +++ b/build/web/User_Management.xhtml @@ -0,0 +1,107 @@ + + + + + + User Management + + + + + + #{userlist.initUserList(user, dbconnector)} + +
+
+
+

User Management

+ Halaman ini hanya tersedia untuk administrator, menampilkan data seluruh user, beserta kemampuan untuk melakukan CRUD terhadap user +
+ +
+
+
+ + + + + + + + + + + + + + + +
UsernameEmailTypeEdit
#{item.name}#{item.email}#{item.getTypeName()} Edit
+
+ +
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ 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/lingga/Comment.class b/build/web/WEB-INF/classes/lingga/Comment.class new file mode 100644 index 00000000..cc6386db Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/Comment.class differ diff --git a/build/web/WEB-INF/classes/lingga/CookieHandler.class b/build/web/WEB-INF/classes/lingga/CookieHandler.class new file mode 100644 index 00000000..1c245e34 Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/CookieHandler.class differ diff --git a/build/web/WEB-INF/classes/lingga/DBConnector.class b/build/web/WEB-INF/classes/lingga/DBConnector.class new file mode 100644 index 00000000..8d498596 Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/DBConnector.class differ diff --git a/build/web/WEB-INF/classes/lingga/NavigationController.class b/build/web/WEB-INF/classes/lingga/NavigationController.class new file mode 100644 index 00000000..7e66c0a6 Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/NavigationController.class differ diff --git a/build/web/WEB-INF/classes/lingga/Post.class b/build/web/WEB-INF/classes/lingga/Post.class new file mode 100644 index 00000000..7faa7374 Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/Post.class differ diff --git a/build/web/WEB-INF/classes/lingga/PostList.class b/build/web/WEB-INF/classes/lingga/PostList.class new file mode 100644 index 00000000..11bf8a70 Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/PostList.class differ diff --git a/build/web/WEB-INF/classes/lingga/User.class b/build/web/WEB-INF/classes/lingga/User.class new file mode 100644 index 00000000..e71a3350 Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/User.class differ diff --git a/build/web/WEB-INF/classes/lingga/UserList.class b/build/web/WEB-INF/classes/lingga/UserList.class new file mode 100644 index 00000000..290b72dd Binary files /dev/null and b/build/web/WEB-INF/classes/lingga/UserList.class 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/javax.faces.jar b/build/web/WEB-INF/lib/javax.faces.jar new file mode 100644 index 00000000..95a4504b Binary files /dev/null and b/build/web/WEB-INF/lib/javax.faces.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/lib/mysql-connector-java-5.1.34-bin.jar b/build/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/build/web/WEB-INF/lib/mysql-connector-java-5.1.34-bin.jar differ diff --git a/build/web/WEB-INF/web.xml b/build/web/WEB-INF/web.xml new file mode 100644 index 00000000..a6c450c7 --- /dev/null +++ b/build/web/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/build/web/css/Aventura-Bold.otf b/build/web/css/Aventura-Bold.otf new file mode 100644 index 00000000..3b4166e0 Binary files /dev/null and b/build/web/css/Aventura-Bold.otf differ diff --git a/build/web/css/Biko_Black.otf b/build/web/css/Biko_Black.otf new file mode 100644 index 00000000..1297b76f Binary files /dev/null and b/build/web/css/Biko_Black.otf differ diff --git a/build/web/css/Biko_Bold.otf b/build/web/css/Biko_Bold.otf new file mode 100644 index 00000000..5bd3c436 Binary files /dev/null and b/build/web/css/Biko_Bold.otf differ diff --git a/build/web/css/Biko_Light-Restricted.otf b/build/web/css/Biko_Light-Restricted.otf new file mode 100644 index 00000000..9fb5db89 Binary files /dev/null and b/build/web/css/Biko_Light-Restricted.otf differ diff --git a/build/web/css/Biko_Regular.otf b/build/web/css/Biko_Regular.otf new file mode 100644 index 00000000..da7b16e4 Binary files /dev/null and b/build/web/css/Biko_Regular.otf differ diff --git a/build/web/css/ElegantLux-Mager.otf b/build/web/css/ElegantLux-Mager.otf new file mode 100644 index 00000000..3963e2f3 Binary files /dev/null and b/build/web/css/ElegantLux-Mager.otf differ diff --git a/build/web/css/KiloGram_KG.otf b/build/web/css/KiloGram_KG.otf new file mode 100644 index 00000000..c0d69d71 Binary files /dev/null and b/build/web/css/KiloGram_KG.otf differ diff --git a/build/web/index.xhtml b/build/web/index.xhtml new file mode 100644 index 00000000..e4d013be --- /dev/null +++ b/build/web/index.xhtml @@ -0,0 +1,16 @@ + + + + + + Simple Blog + + + + #{navigationController.moveToPublishedPost()} + + diff --git a/build/web/resources/font/Aventura-Bold.otf b/build/web/resources/font/Aventura-Bold.otf new file mode 100644 index 00000000..3b4166e0 Binary files /dev/null and b/build/web/resources/font/Aventura-Bold.otf differ diff --git a/build/web/resources/font/Biko_Black.otf b/build/web/resources/font/Biko_Black.otf new file mode 100644 index 00000000..1297b76f Binary files /dev/null and b/build/web/resources/font/Biko_Black.otf differ diff --git a/build/web/resources/font/Biko_Bold.otf b/build/web/resources/font/Biko_Bold.otf new file mode 100644 index 00000000..5bd3c436 Binary files /dev/null and b/build/web/resources/font/Biko_Bold.otf differ diff --git a/build/web/resources/font/Biko_Light-Restricted.otf b/build/web/resources/font/Biko_Light-Restricted.otf new file mode 100644 index 00000000..9fb5db89 Binary files /dev/null and b/build/web/resources/font/Biko_Light-Restricted.otf differ diff --git a/build/web/resources/font/Biko_Regular.otf b/build/web/resources/font/Biko_Regular.otf new file mode 100644 index 00000000..da7b16e4 Binary files /dev/null and b/build/web/resources/font/Biko_Regular.otf differ diff --git a/build/web/resources/font/ElegantLux-Mager.otf b/build/web/resources/font/ElegantLux-Mager.otf new file mode 100644 index 00000000..3963e2f3 Binary files /dev/null and b/build/web/resources/font/ElegantLux-Mager.otf differ diff --git a/build/web/resources/font/KiloGram_KG.otf b/build/web/resources/font/KiloGram_KG.otf new file mode 100644 index 00000000..c0d69d71 Binary files /dev/null and b/build/web/resources/font/KiloGram_KG.otf differ diff --git a/build/web/resources/img/header1.jpg b/build/web/resources/img/header1.jpg new file mode 100644 index 00000000..836cb0bf Binary files /dev/null and b/build/web/resources/img/header1.jpg differ diff --git a/build/web/resources/js/deletor.js b/build/web/resources/js/deletor.js new file mode 100644 index 00000000..e99590ea --- /dev/null +++ b/build/web/resources/js/deletor.js @@ -0,0 +1,45 @@ +window.onload = function() { + var a = document.getElementsByClassName("deletebutton"); + for(i in a){ + a[i].onclick = function() { + if(confirm("Apakah Anda yakin menghapus post ini?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Soft_Delete_Post.xhtml?pid=" + pid; + } + return false; + }; + }; + + var hd = document.getElementsByClassName("harddeletebutton"); + for(i in hd){ + hd[i].onclick = function() { + if(confirm("Anda yakin ingin menghapus pos ini secara permanen?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Delete_Post.xhtml?pid=" + pid; + } + return false; + }; + }; + + var rb = document.getElementsByClassName("restorebutton"); + for(i in rb){ + rb[i].onclick = function() { + if(confirm("Yakin merestore post ini ke unpublished post?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Restore_Post.xhtml?pid=" + pid; + } + return false; + }; + }; + + var pb = document.getElementsByClassName("publishbutton"); + for(i in pb){ + pb[i].onclick = function() { + if(confirm("Yakin mempublish pos ini?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Publish_Post.xhtml?pid=" + pid; + } + return false; + }; + }; +}; \ No newline at end of file diff --git a/build/web/resources/js/validator.js b/build/web/resources/js/validator.js new file mode 100644 index 00000000..e455acfb --- /dev/null +++ b/build/web/resources/js/validator.js @@ -0,0 +1,91 @@ +function validateForm(){ + //alert("lala"); + var titlePost = document.inputanpos["inputanpos:Judul"].value; + var contentPost = document.inputanpos["inputanpos:Konten"].value; + var datePost = document.inputanpos["inputanpos:Tanggal"].value; + var dateNow = new Date(); + if(titlePost === null || titlePost === ""){ + alert('Judul pos tidak boleh kosong'); + return false; + } + + if(datePost === null || datePost === ""){ + alert('Tanggal pos tidak boleh kosong'); + return false; + } + else { + datePost = new Date(document.inputanpos["inputanpos:Tanggal"].value + " 23:59:59"); + if (datePost - dateNow < 0){ + alert('Tanggal pos tidak boleh kurang dari tanggal sekarang.'); + return false; + } + } + + if(contentPost === null || contentPost === ""){ + alert('Konten pos tidak boleh kosong'); + return false; + } + + return true; +} + +function validateComment(){ + // validasi komentar + var komentar = document.inputankomentar["inputankomentar:komentar"].value; + var email = document.inputankomentar["inputankomentar:email"].value; + var nama = document.inputankomentar["inputankomentar:nama"].value; + // validasi komentar kosong + if(nama === ""){ + alert('nama tidak boleh kosong'); + return false; + } + // validasi email tidak kosong + else if(email === ""){ + alert('isi email anda untuk berkomentar'); + return false; + } + // validasi email sesuai kaidah + else if(!validateEmail(email)){ + alert("alamat email tidak valid"); + return false; + } + // validasi komentar kosong + else if(komentar === ""){ + alert('komentar tidak boleh kosong'); + return false; + } + return true; +} + +function validateEmail(email){ + var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(email); +} + +function validateEdAddUser(){ + // validasi komentar + var username = document.edadduser["edadduser:username"].value; + var password = document.edadduser["edadduser:password"].value; + var email = document.edadduser["edadduser:email"].value; + // validasi komentar kosong + if(username === ""){ + alert('username tidak boleh kosong'); + return false; + } + // validasi email tidak kosong + else if(email === ""){ + alert('email tidak boleh kosong'); + return false; + } + // validasi email sesuai kaidah + else if(!validateEmail(email)){ + alert("alamat email tidak valid"); + return false; + } + // validasi komentar kosong + else if(password === ""){ + alert('password tidak boleh kosong'); + return false; + } + return true; +} \ No newline at end of file diff --git a/build/web/resources/style.css b/build/web/resources/style.css new file mode 100644 index 00000000..6d9f64b4 --- /dev/null +++ b/build/web/resources/style.css @@ -0,0 +1,428 @@ +/* +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. +*/ +/* + Created on : Nov 26, 2014, 1:45:39 PM + Author : Jelink +*/ + +@font-face{ + font-family: aventura; + src: url(font/Aventura-Bold.otf); +} + +@font-face{ + font-family: biko_regular; + src: url(font/Biko_Regular.otf); +} + +@font-face{ + font-family: biko_bold; + src: url(font/Biko_Bold.otf); +} + +@font-face{ + font-family: kilogram; + src: url(KiloGram_KG.otf); +} + +html, +body { + font-family: 'biko_regular', arial, sans-serif; + margin:0; + padding:0px !important; + height:100%; + color: #555; + font-size: 17px; +} +a{ + color: #6699FF; + text-decoration: none; +} +a:hover{ + color: #77AAFF; +} +#container { + top:60px; + min-height:92.2%; + position:relative; +} +#header { + background:url("img/header1.jpg"); + background-size:auto 200%; + background-position: center -100px ; + height: 490px; + padding:10px; +} +#body { + padding:10px; + padding-bottom:60px; /* Height of the footer */ +} +#footer { + position:absolute; + bottom:0; + width:100%; + height:60px; /* Height of the footer */ + background:#1C222E; + color: white; +} +#menubar { + position: fixed; + height: 60px; + width: 100%; + z-index: 100; + text-transform: uppercase; +} + +#menubar a{ + color:#6699FF; +} + +#menubar a:hover{ + color:white; +} + +#menubar a:click{ + color:yellow; +} + +#menulist { + position: absolute; + right: 0px; + min-width: 40%; +} + +#menulist ul{ + list-style: none; + margin-right: 0px; +} + +#menulist li{ + text-align: center; + display: inline-block; + width: 20%; + min-width: 80px; +} + +.bluegrad { + background: -webkit-linear-gradient(red, blue); /* For Safari 5.1 to 6.0 */ + background: -o-linear-gradient(red, blue); /* For Opera 11.1 to 12.0 */ + background: -moz-linear-gradient(red, blue); /* For Firefox 3.6 to 15 */ + background: linear-gradient( #19356C, #1C222E); /* Standard syntax */ +} + +#dashmenu{ + top: 120px; + left: 100px; + position: absolute; + color: white; + max-width: 400px; +} + +#dashmenu h1, h2, h3{ + margin: 10px 0px 10px 0px; +} + +#dashmenu #title{ + padding: 20px; + background: rgba(0,0,0,0.7); +} + +#dashmenu #menus{ + padding: 20px; + background:#6699FF; +} + +#dashmenu #menus ul{ + padding: 0px; +} + +#dashmenu #menus li{ + list-style: none; + margin-bottom: 2px; +} + +#dashmenu #menus a{ + text-align: center; + padding: 2px; + display:block; + background:#77AAFF; + color: white; +} + +#dashmenu #menus a:hover{ + background:#88BBFF; +} + +#postContainer{ + position: relative; + width:60%; + left:20%; +} + +.onePost{ + margin: 50px 0 50px 0; +} + +.onePost .buttons{ + text-align: right; +} + +.buttons a{ + text-align: center; + padding: 10px; + display:block-inline; + background:#77AAFF; + color: white; +} + +.onePost .buttons a:hover{ + background:#88BBFF; +} + +#footer .identity{ + margin-top: 14px; + padding: 4px; + display: inline-block; + width: 31%; + text-align: center; +} + +#idlist{ + position: relative; + width: 60%; + left: 20%; +} + +#footer .left{ + text-align: left !important; +} + +#footer .right{ + text-align: right !important; +} + +#rightContainer{ + display: box; + position:relative; + margin-top: 6%; + margin-right: 0px; + width:58%; + left: 41%; + right: 0%; +} + +#rightContainer form{ + +} + +#rightContainer form input{ + padding: 5px; + margin-bottom: 5px; + width: 70%; + min-width: 410px; +} + +#rightContainer form label{ + text-align: center; +} + +#rightContainer form textArea{ + width: 70%; + min-height: 300px; + padding: 5px; + margin-bottom: 5px; + min-width: 410px; +} + +.button{ + width: 100px !important; +} + +.postmanip #dashmenu{ + top: 105px; + left: 14%; + display:box; +} + +#rightContainer table{ + overflow: auto; + max-height: 500px; +} + +table{ + border-collapse: collapse; + table-layout: fixed; + min-width: 70%; + max-width: 80%; +} + +table td,th{ + padding: 7px; + margin: 0px; +} + +table td{ + border-bottom: 1px solid #eee; +} + +table .first{ + text-align: left; + background: #77AAFF; + color: white; +} + +#inputankomentar{ + width : 70%; + margin-left : 15%; + margin-bottom: 30px; +} + +#inputankomentar input{ + padding: 5px; + margin-bottom: 5px; + width: 100%; +} + +#inputankomentar textArea{ + width: 100%; + min-height: 100px; + padding: 5px; + margin-bottom: 5px; +} + +.oneComment{ + border-bottom: solid 1px #eee; +} + +#commentStructure{ + table-layout: fixed; + width: 100%; +} + +#commentStructure td{ + min-width: 100% !important; +} + +hr{ + border: 1px solid #eee !important; + margin: 20px 0 20px 0; +} + +#postContainer h2{ + text-align: center; + margin: 10px 0 15px 0; +} + +.modalDialog { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: rgba(0, 0, 0, 0.8); + z-index: 99999; + opacity:0; + -webkit-transition: opacity 400ms ease-in; + -moz-transition: opacity 400ms ease-in; + transition: opacity 400ms ease-in; + pointer-events: none; +} + +.modalDialog:target { + opacity:1; + pointer-events: auto; +} + +.modalDialog input { + width:97%; + padding: 5px; + margin: 5px 0 5px 0; +} + +.modalDialog > div { + width: 400px; + position: relative; + margin: 10% auto; + padding: 10px 20px 10px 20px; + border-radius: 10px; + background: #fff; +} +.close { + background: white; + line-height: 25px; + position: absolute; + right: -12px; + text-align: center; + top: -10px; + width: 24px; + font-weight: bold; + -webkit-border-radius: 12px; + -moz-border-radius: 12px; + border-radius: 12px; + -moz-box-shadow: 1px 1px 3px #000; + -webkit-box-shadow: 1px 1px 3px #000; + box-shadow: 1px 1px 3px #000; +} +.close:hover { + background: yellow; +} + +#edadduser table input{ + width: 20px !important; + min-width: 0px; +} + +@media all and (max-width: 1200px) { + .postmanip #dashmenu{ + left:5%; + } + #postContainer{ + width: 90% !important; + left:5%; + } + #header{ + background-position: center 10% ; + } + #rightContainer{ + left:45%; + } +} + +@media all and (max-width: 1000px){ + #idlist{ + position: relative; + width: 90%; + left: 5%; + font-size: 15px; + } + #idlist .identity{ + padding: 0px; + } + #inputankomentar{ + width: 85%; + margin-left: 7.5%; + } + .postmanip #dashmenu{ + position: relative; + display:block; + } + .postmanip #body #rightContainer{ + margin-top:150px; + margin-bottom:150px; + left:5%; + right:5%; + width:90%; + } +} + +@media all and (max-width: 611px){ + #dashmenu{ + left: 10% !important; + right: 10% !important; + min-width: 80% !important; + } + +} \ No newline at end of file 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/mysql-connector-java-5.1.34-bin.jar b/mysql-connector-java-5.1.34-bin.jar new file mode 100644 index 00000000..0236900b Binary files /dev/null and b/mysql-connector-java-5.1.34-bin.jar differ diff --git a/nbproject/ant-deploy.xml b/nbproject/ant-deploy.xml new file mode 100644 index 00000000..9bc5adf7 --- /dev/null +++ b/nbproject/ant-deploy.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml new file mode 100644 index 00000000..3d86dc93 --- /dev/null +++ b/nbproject/build-impl.xml @@ -0,0 +1,1450 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties new file mode 100644 index 00000000..8b3ecbaf --- /dev/null +++ b/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=fd136739 +build.xml.script.CRC32=ddd08438 +build.xml.stylesheet.CRC32=651128d4@1.65.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=fd136739 +nbproject/build-impl.xml.script.CRC32=f2b0adb2 +nbproject/build-impl.xml.stylesheet.CRC32=d659eb7a@1.65.1.1 diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties new file mode 100644 index 00000000..bdb5e6c8 --- /dev/null +++ b/nbproject/private/private.properties @@ -0,0 +1,4 @@ +deploy.ant.properties.file=C:\\Users\\Jelink\\AppData\\Roaming\\NetBeans\\7.4\\tomcat70.properties +j2ee.server.home=C:/xampp/tomcat +j2ee.server.instance=tomcat70:home=C:\\xampp\\tomcat +user.properties.file=C:\\Users\\Jelink\\AppData\\Roaming\\NetBeans\\7.4\\build.properties diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml new file mode 100644 index 00000000..cd5353b5 --- /dev/null +++ b/nbproject/private/private.xml @@ -0,0 +1,22 @@ + + + + + + file:/C:/Users/Jelink/Documents/WBD/Tugas2/src/java/lingga/DBConnector.java + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Restore_Post.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Trash.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Add_User.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Edit_User.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Publish_Post.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/src/java/lingga/User.java + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/resources/style.css + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Post.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Unpublished_Posts.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/resources/js/validator.js + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/resources/js/deletor.js + file:/C:/Users/Jelink/Documents/WBD/Tugas2/web/Published_Posts.xhtml + file:/C:/Users/Jelink/Documents/WBD/Tugas2/src/java/lingga/Post.java + + + diff --git a/nbproject/project.properties b/nbproject/project.properties new file mode 100644 index 00000000..99396d10 --- /dev/null +++ b/nbproject/project.properties @@ -0,0 +1,90 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=true +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=JSP +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +file.reference.mysql-connector-java-5.1.34-bin.jar=mysql-connector-java-5.1.34-bin.jar +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.6-web +j2ee.platform.classpath=${j2ee.server.home}/lib/annotations-api.jar:${j2ee.server.home}/lib/catalina-ant.jar:${j2ee.server.home}/lib/catalina-ha.jar:${j2ee.server.home}/lib/catalina-tribes.jar:${j2ee.server.home}/lib/catalina.jar:${j2ee.server.home}/lib/ecj-4.2.2.jar:${j2ee.server.home}/lib/el-api.jar:${j2ee.server.home}/lib/jasper-el.jar:${j2ee.server.home}/lib/jasper.jar:${j2ee.server.home}/lib/jsp-api.jar:${j2ee.server.home}/lib/servlet-api.jar:${j2ee.server.home}/lib/tomcat-api.jar:${j2ee.server.home}/lib/tomcat-coyote.jar:${j2ee.server.home}/lib/tomcat-dbcp.jar:${j2ee.server.home}/lib/tomcat-i18n-es.jar:${j2ee.server.home}/lib/tomcat-i18n-fr.jar:${j2ee.server.home}/lib/tomcat-i18n-ja.jar:${j2ee.server.home}/lib/tomcat-jdbc.jar:${j2ee.server.home}/lib/tomcat-util.jar +j2ee.server.type=Tomcat +jar.compress=false +javac.classpath=\ + ${libs.jsf20.classpath}:\ + ${libs.javaee-web-api-7.0.classpath}:\ + ${libs.MySQLDriver.classpath}:\ + ${file.reference.mysql-connector-java-5.1.34-bin.jar} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.6 +javac.target=1.6 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +no.dependencies=false +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=Tugas2.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..4a870330 --- /dev/null +++ b/nbproject/project.xml @@ -0,0 +1,35 @@ + + + org.netbeans.modules.web.project + + + Tugas2 + 1.6.5 + + + ${libs.jsf20.classpath} + WEB-INF/lib + + + ${libs.javaee-web-api-7.0.classpath} + WEB-INF/lib + + + ${libs.MySQLDriver.classpath} + WEB-INF/lib + + + ${file.reference.mysql-connector-java-5.1.34-bin.jar} + 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/simple_blog_db.sql b/simple_blog_db.sql new file mode 100644 index 00000000..734a5fd3 --- /dev/null +++ b/simple_blog_db.sql @@ -0,0 +1,134 @@ +-- phpMyAdmin SQL Dump +-- version 4.1.6 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1 +-- Generation Time: 01 Des 2014 pada 18.57 +-- Versi Server: 5.6.16 +-- PHP Version: 5.5.9 + +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_db` +-- +CREATE DATABASE IF NOT EXISTS `simple_blog_db` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci; +USE `simple_blog_db`; + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `sb_comments` +-- + +CREATE TABLE IF NOT EXISTS `sb_comments` ( + `id_komentar` int(4) NOT NULL AUTO_INCREMENT COMMENT 'id komentar', + `nama` varchar(14) NOT NULL, + `email` varchar(30) NOT NULL, + `komentar` text NOT NULL COMMENT 'konten dari komentar', + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'waktu submit komentar', + `id_post` int(4) NOT NULL, + PRIMARY KEY (`id_komentar`), + KEY `id_post` (`id_post`), + KEY `id_post_2` (`id_post`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ; + +-- +-- Dumping data untuk tabel `sb_comments` +-- + +INSERT INTO `sb_comments` (`id_komentar`, `nama`, `email`, `komentar`, `timestamp`, `id_post`) VALUES +(6, 'Jelink', 'jelink@bin.com', 'ajsd jkab kjsba kjbkjb', '2014-11-25 13:09:10', 84), +(13, 'jeffhorus', 'jeffhorus19@gmail.com', 'Rusuh melulu mahasiswa', '2014-11-26 11:06:54', 83), +(15, 'adminganteng', 'admin@admin.com', 'bagus jok!', '2014-12-01 03:00:42', 82), +(16, 'jeffhorus', 'jeffhorus19@gmail.com', 'lucu ya politik di negeri ini', '2014-12-01 15:08:33', 84), +(17, 'Guest', 'jeje@jeje.com', 'lucu ya', '2014-12-01 15:14:51', 84), +(18, 'jelink', 'jeje@jeje.co', 'wah keren nih', '2014-12-01 15:15:15', 84), +(19, 'Guest', 'jelink@je.ling', 'masuk dong', '2014-12-01 15:36:02', 84), +(20, 'editor', 'editor@gmail.com', 'wah kasian balotelli', '2014-12-01 17:00:25', 88), +(21, 'jeffhorus', 'jeffhorus19@gmail.com', 'sangat sangat gak demokratis. . ckck', '2014-12-01 17:07:18', 87), +(22, 'Guest', 'gu@est.com', 'udah kayak jaman suharto', '2014-12-01 17:07:48', 87), +(23, 'owner', 'owner@gmail.com', 'you had one job. . .', '2014-12-01 17:08:04', 87), +(24, 'editor', 'editor@gmail.com', 'udah jangan pada ribut', '2014-12-01 17:08:24', 87); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `sb_posts` +-- + +CREATE TABLE IF NOT EXISTS `sb_posts` ( + `id_post` int(4) NOT NULL AUTO_INCREMENT COMMENT 'primary key id post', + `judul` varchar(100) NOT NULL COMMENT 'judul post', + `tanggal` date NOT NULL COMMENT 'tanggal publikasi post', + `konten` text NOT NULL COMMENT 'isi post', + `published` tinyint(1) NOT NULL, + PRIMARY KEY (`id_post`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=90 ; + +-- +-- Dumping data untuk tabel `sb_posts` +-- + +INSERT INTO `sb_posts` (`id_post`, `judul`, `tanggal`, `konten`, `published`) VALUES +(82, 'Tinjau Kebakaran Hutan Riau, Jokowi: Kita Selesaikan Masalah Berulang Ini', '2014-10-23', 'Pekanbaru - Presiden Joko Widodo terbang langsung ke titik lokasi kebakaran hutan Riau di Kabupaten Meranti. Dia ingin melihat langsung inti masalah untuk kemudian menyelesaikannya secara cepat.\r\n\r\nJokowi ke lokasi kebakaran hutan itu menggunakan helikopter Super Puma milik TNI AU sekitar pukul 14.20 WIB, Rabu (26/11/2014). Turut mendampingi, Ibu Iriana, Menteri Kehutanan dan Lingkungan Hidup Siti Nurbaya Bakar dan Plt Gubernur Riau Arsyadjuliandi Rachman. \r\n\r\nHadir juga Danpaspampres Mayjen Andika Perkasa serta beberapa staf pengamanan yang berada di dua heli bell milik TNI AD. \r\n\r\nSebelum terbang, Jokowi sempat diwawancarai wartawan. Dia mengatakan, masalah kebakaran hutan di Riau selalu terulang, namun tak pernah ditemukan solusinya.\r\n\r\n"Di situ ada masalah yang setiap tahun berulang yaitu masalah lahan yang terbakar, itu mau kita selesaikan. Kalau masalah di lapangan kita ketahui, menyelesaikannya gampang," kata Jokowi.\r\n\r\nBagaimana dengan perusahaan yang membakar? \r\n\r\n"Itu nanti urusan menteri kehutanan. Tanya langsung ke dia, itu masalah teknis," tambahnya.', 1), +(83, 'Serbu Kampus saat Demo Rusuh di Makassar, 22 Polisi Jalani Sidang Disiplin', '2014-10-15', 'Makassar - Sebanyak 22 anggota Sabhara Polrestabes Makassar menjalani sidang disiplin di Mapolrestabes Makassar, Rabu (26/11/2014). Mereka ditengarai terlibat dalam penyerangan kampus Universitas Negeri Makassar dan pemukulan beberapa orang wartawan, Kamis (13/11) lalu.\r\n\r\nKepala Seksi Profesi dan Pengamanan Polrestabes Makassar Kompol Busran, pada wartawan menyebutkan bahwa ke-22 anggota Sabhara, diperiksa terkait kasus penyerbuan kampus UNM.\r\n"Dalam sidang kode etik ini, kami belum menemukan hasilnya karena mereka rata-rata tidak mengetahui insiden penyerbuan kampus dan pemukulan wartawan, mereka hanya mengejar pelaku pemanah Wakapolres yang masuk ke dalam kampus," ujar Kompol Busran.\r\n\r\nSalah satu anggota Sabhara yang diperiksa, Bripda Akbar mengaku tidak melakukan pemukulan dan perusakan fasilitas kampus UNM.\r\n\r\n"Aksi kami spontan, kami hanya melakukan penyisiran untuk mencari pelaku pembusuran Wakapolres," ujar Akbar singkat.\r\n\r\nSidang disiplin ini dimulai sekitar pukul 09.00 wita. Kemudian agenda ditunda pada pukul 12.00 wita dan hingga batas waktu yang belum ditentukan. \r\n\r\nDalam peristiwa penyerbuan masuk ke dalam kampus UNM, sebelumnya didahului insiden Wakapolrestabes Makassar AKBP Totok Lisdiarto yang terkena anak panah di bawah ketiak kanannya. Pasca insiden ini sontak puluhan anggota polisi menyerbu masuk ke dalam kampus. Sejumlah wartawan yang merekam aksi perusakan polisi mendapat tindak kekerasan\r\nberupa pemukulan dan pengambilan memory card, pada sejumlah wartawan Makassar, seperti Iqbal Lubis, fotografer Tempo, Ikrar Culleng, kamerawan Celebes TV, Waldy, kamerawan Metro TV dan Asep Ikhsan, fotografer koran Rakyat Sulsel.\r\n\r\nHampir semua anggota polisi yang disidang berusia muda, antara 19 tahun hingga 23 tahun.', 0), +(84, 'Tunda Penetapan UU MD3 Masuk Prolegnas, Fahri Hamzah "Ini Jalan Tengah"', '2014-12-02', 'Jakarta- Wakil Ketua DPR Fahri Hamzah yang memimpin sidang paripurna mengetok palu untuk menunda revisi UU MD3 masuk ke Prolegnas 2014. Fahri menyebutnya sebagai suatu jalan tengah.\r\n\r\n"Kalau ditolak itu tidak bisa diajukan kembali dan proses pengajuannya jadi rumit. Jadi kita ambil jalan tengah, kita tunda," kata Fahri usai sidang paripurna di Gedung DPR, Senayan, Jakpus, Rabu (26/11/2014).\r\n\r\nFahri menuturkan bahwa pembahasan ulang revisi UU MD3 ini di Badan Legislasi akan diusahakan secepatnya. Selanjutnya, ia berharap tidak ada lagi perdebatan di paripurna.\r\n\r\n"Biar tidak ada lagi perdebatan di paripurna. (Perdebatannya) soal DPD, soal kekhawatiran di judicial review, dan lain-lain," ujar Wasekjen PKS ini.\r\n\r\nSaat sidang paripurna, anggota DPR mempertanyakan urgensi revisi UU MD3 dimasukkan ke dalam Prolegnas. DPD juga diminta untuk dilibatkan saat pembahasan.\r\n\r\nFraksi-fraksi di KIH sebenarnya sudah menyetujui agar revisi UU MD3 ini masuk ke Prolegnas dan menjadi usul inisiatif DPR. Namun, masih ada perdebatan sehingga Fahri kemudian mengetok palu untuk menunda penetapan.', 1), +(86, 'Kambing', '2014-12-12', 'Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing Muda Enak Sekali Kambing ', 2), +(87, 'Ketua Munas Golkar Pastikan Ical Menang Secara Aklamasi', '2014-12-01', 'Badung - Usai pengunduran diri Airlangga Hartarto, hanya ada calon tunggal untuk menjadi Ketua Umum Golkar yakni Aburizal Bakrie (Ical). Ketua Panitia Munas IX Golkar Ahmadi Noor Supit memastikan Ical menang secara aklamasi.\r\n\r\n"Dalam tata tertib kan sudah jelas, apabila hanya ada satu calon ketua umum saja maka dinyatakan terpilih secara aklamasi," ujar Supit di Westin Hotel, Kawasan Nusa Dua, Bali, Senin (1/12/2014).\r\n\r\nDia mengaku tak bisa menghindari keputusan politik yang diambil para caketum lain yang mundur. Meskipun sebelumnya ada politikus senior Golkar Zainal Bintang yang berniat daftarkan diri.\r\n\r\n"Itu nggak fair dong. Kalau dia bilang Munas ini tak legal lalu dia masuk juga kan tidak fair," imbuh Ketua Banggar DPR ini.\r\n\r\nSupit pun mengaku belum dijanjikan jabatan oleh calon mana pun. Walau tak menolak bila nantinya ada tawaran dari ketua umum terpilih.\r\n\r\n"Sebagai kader kan kita menuruti amanah yang diberikan oleh ketua," pungkas pria berkacamata itu.', 1), +(88, 'Lawan Leicester, Liverpool Masih Tanpa Balotelli', '2014-12-03', 'Liverpool - Liverpool tetap akan mengandalkan Rickie Lambert di lini depan saat menghadapi Leicester City midweek ini, setelah Mario Balotelli masih dalam tahap pemulihan cederanya.\r\n\r\nBalotelli sudah absen sejak mengalami cedera pangkah paha kala membela timnas Italia. Terakhir kali Balotelli main bersama Liverpool adalah saat kalah 1-2 dari Chelsea.\r\n\r\nDi tiga pertandingan terakhir The Reds, Lambert lah yang jadi pengganti Balotelli dan penyerang Inggris itu tampil cukup oke dengan bikin dua gol.\r\n\r\nLambert pun masih bakal jadi andalan Brendan Rodgers untuk mendulang gol, saat tim asal Merseyside itu menyambangi King Power Stadium untuk menghadapi Leicester, Rabu (3/12) dinihari WIB.\r\n\r\nBalotelli disebut masih belum fit dari cedera pangkal paha, sementara itu Mamadou Sakho juga tak akan dibawa mengingat ia baru saja pulih dari cedera paha.\r\n\r\n"Skuat di Leicester kurang lebih sama dengan saat mengalahkan Stoke 1-0 Sabtu lalu," ujar Rodgers seperti dikutip Soccerway.\r\n\r\n"Sakho sudah berlatih kemarin bersama tim utama, tapi dia belum siap untuk bermain. Dan Mario juga masih belum fit," sambung Rodgers.\r\n\r\nLiverpool akan membidik lagi tiga poin demi mendongrak posisi mereka di klasemen, karena saat ini masih ada di urutan ke-11 dengan 17 poin.', 1), +(89, 'Jadi Juru Kunci, Situasi yang Tak Terbayangkan oleh Dortmund', '2014-12-06', 'Frankfurt - Kekalahan dari Eintracht Frankfurt membuat Borussia Dortmund terbenam di dasar klasemen. Mimpi buruk Die Borussien di Bundesliga musim ini tampaknya masih jauh dari kata berakhir.\r\n\r\nKemenangan amat dibutuhkan Dortmund menyusul laju buruk di liga. Namun, saat melawat ke Commerzbank-Arena, Senin (1/12/2014) dinihari WIB, Dortmund dipaksa pulang dengan kekalahan 0-2.\r\n\r\nIni adalah kekalahan kedelapan Dortmund di Bundesliga musim ini. Hasil itu sekaligus membuat Dortmund terperosok ke dasar klasemen atau posisi ke-18 dengan raihan 11 poin dari 13 pertandingan--terpisah 22 poin dari Bayern Munich yang ada di puncak klasemen.\r\n\r\nDalam catatan situs resmi Dortmund, ini adalah kali pertama mereka menjadi juru kunci sejak pekan kedua musim 2007/2008. Sementara menurut Opta, tanpa memasukkan pekan pertama dan pekan kedua, ini adalah kali pertama dalam 29 tahun Dortmund ada di posisi terbawah Bundesliga.\r\n\r\nTak sedikit yang terheran-heran dengan krisis yang tengah dihadapi Dortmund saat ini--termasuk para pemainnya sendiri. Menilik pencapaian Dortmund dalam beberapa musim terakhir, menjadi juru kunci di Bundesliga tentu jauh dari bayangan.\r\n\r\nDalam empat musim terakhir, Dortmund selalu bersaing di papan atas Bundesliga. Usai jadi juara di musim 2010/2011 dan 2011/2012, tim arahan Juergen Klopp itu kemudian finis sebagai runner-up di dua musim berikutnya.\r\n\r\nApalagi laju Dortmund di kompetisi Eropa juga tak buruk. Musim ini, kendati jeblok di liga, Dortmund sudah menggenggam tiket ke babak 16 besar Liga Champions.', 0); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `sb_users` +-- + +CREATE TABLE IF NOT EXISTS `sb_users` ( + `user_id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(14) NOT NULL, + `password` varchar(10) NOT NULL, + `email` varchar(30) NOT NULL, + `type` int(11) NOT NULL, + PRIMARY KEY (`user_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ; + +-- +-- Dumping data untuk tabel `sb_users` +-- + +INSERT INTO `sb_users` (`user_id`, `username`, `password`, `email`, `type`) VALUES +(1, 'jeffhorus', 'pass', 'jeffhorus19@gmail.com', 3), +(4, 'owner', 'pass', 'owner@gmail.com', 1), +(5, 'editor', 'pass', 'editor@gmail.com', 2), +(6, 'adminganteng', '', 'admin@admin.com', 3), +(7, 'adhika', 'adhika', 'adhika@sigit.ram', 3), +(9, 'jelink19', 'pass', 'jeje@jeje.com', 2), +(10, 'jeje', 'pass', 'pass@pass.com', 3), +(11, 'owner2', 'pass', '13131@ajsbfajf.com', 1), +(14, 'haha', 'haha', 'hahaha', 1), +(20, 'jelo', 'wewa', 'jelo@jelo.com', 3), +(22, 'jemaat', 'jejeje', 'jelink@je.com', 1), +(24, 'kiki', 'kaka', 'koko@keke.kuku', 1); + +-- +-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables) +-- + +-- +-- Ketidakleluasaan untuk tabel `sb_comments` +-- +ALTER TABLE `sb_comments` + ADD CONSTRAINT `sb_comments_ibfk_1` FOREIGN KEY (`id_post`) REFERENCES `sb_posts` (`id_post`) ON DELETE CASCADE ON UPDATE CASCADE; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF 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/lingga/Comment.java b/src/java/lingga/Comment.java new file mode 100644 index 00000000..682aa186 --- /dev/null +++ b/src/java/lingga/Comment.java @@ -0,0 +1,96 @@ +/* + * 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 lingga; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * + * @author Jelink + */ + +@ManagedBean(name="comment",eager=true) +@SessionScoped +public class Comment { + int id_komentar; + String nama; + String email; + String komentar; + String timestamp; + int post_id; + + public Comment(){ + + } + + public Comment(int id_komentar, String nama, String email, String komentar, String timestamp, int post_id) { + this.id_komentar = id_komentar; + this.nama = nama; + this.email = email; + this.komentar = komentar; + this.timestamp = timestamp; + } + + public void init(User pengguna) { + nama = pengguna.getName(); + email = pengguna.getEmail(); + komentar = ""; + } + + public int getPost_id() { + return post_id; + } + + public void setPost_id(int post_id) { + this.post_id = post_id; + } + + public String getTimestamp() { + return timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } + + public int getId_komentar() { + return id_komentar; + } + + public void setId_komentar(int id_komentar) { + this.id_komentar = id_komentar; + } + + public String getNama() { + return nama; + } + + public void setNama(String name) { + this.nama = name; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getKomentar() { + return komentar; + } + + public void setKomentar(String komentar) { + this.komentar = komentar; + } + + public void print(){ + System.out.println("cetak cetak"); + } +} diff --git a/src/java/lingga/CookieHandler.java b/src/java/lingga/CookieHandler.java new file mode 100644 index 00000000..25c7f0c0 --- /dev/null +++ b/src/java/lingga/CookieHandler.java @@ -0,0 +1,80 @@ +package lingga; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author Jelink + */ +@ManagedBean(name="cookiehandler",eager=true) +@SessionScoped +public class CookieHandler { + public void setCookie(String name, String value, int expire) { + 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); + } + else{ + cookie = new Cookie(name, value); + cookie.setPath(request.getContextPath()); + } + + cookie.setMaxAge(expire); + cookie.setPath("/"); + + 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){ + FacesContext facesContext = FacesContext.getCurrentInstance(); + HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); + HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse(); + Cookie[] cookies = request.getCookies(); + if (cookies != null) { // Yes, this can return null! The for loop would otherwise throw NPE. + for (Cookie cookie : cookies) { + if (cookie.getName().equals(name)) { + System.out.println("ada sb uid di " + cookie.getPath()); + cookie.setMaxAge(0); + cookie.setPath("/"); + response.addCookie(cookie); + break; + } + } + } + } + +} \ No newline at end of file diff --git a/src/java/lingga/DBConnector.java b/src/java/lingga/DBConnector.java new file mode 100644 index 00000000..a6f58eaf --- /dev/null +++ b/src/java/lingga/DBConnector.java @@ -0,0 +1,436 @@ +/* + * 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 lingga; + +/** + * + * @author Jelink + */ +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +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.SessionScoped; + +@ManagedBean(name="dbconnector",eager=true) +@SessionScoped +public class DBConnector { + String url = "jdbc:mysql://localhost:3306/simple_blog_db"; + String user = "root"; + String password = ""; + Connection con = null; + Statement st = null; + ResultSet rs = null; + PreparedStatement pst = null; + String driver = "com.mysql.jdbc.Driver"; + + public DBConnector(){ + try{ + Class.forName(driver); + con = DriverManager.getConnection(url, user, password); + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (ClassNotFoundException e){ + e.printStackTrace(); + } + } + + //Verifikasi Login + public String verify(User pengguna, CookieHandler ch){ + try { + st = con.createStatement(); + String username = pengguna.getName(); + String userpass = pengguna.getPassword(); + String query = "SELECT * FROM `sb_users` WHERE username='" + username + "' && password='" + userpass + "';"; + System.out.println(query); + rs = st.executeQuery(query); + if (rs.next()) { + // Handle user + pengguna.setUserid(rs.getInt("user_id")); + pengguna.setLoggedon(true); + pengguna.setName(username); + pengguna.setType(rs.getInt("type")); + pengguna.setEmail(rs.getString("email")); + //System.out.println("masuk"); + // Handle cookie + + ch.setCookie("if3110_sb_uid", Integer.toString(pengguna.getUserid()), 3600); + return ""; + } + else if(ch.getCookie("if3110_sb_uid")!=null){ + int sb_uid = Integer.parseInt(ch.getCookie("if3110_sb_uid").getValue()); + //System.out.println("uid : " + sb_uid); + pengguna.copy(selectUser(sb_uid)); + pengguna.setLoggedon(true); + return ""; + } + else { + pengguna.setLoggedon(true); + pengguna.setName("Guest"); + pengguna.setEmail(""); + pengguna.setType(4); + return ""; + } + + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + return "Gagal Masuk SQLException"; + + } catch (Throwable e){ + return "Gagal Masuk Driver"; + } + } + + /* Mengambil salah satu isi post */ + public Post selectPost(int pid){ + try { + st = con.createStatement(); + String query = "SELECT * FROM `sb_posts` WHERE `id_post`=" + pid; + rs = st.executeQuery(query); + rs.next(); + String judul = rs.getString("judul"); + String tanggal = rs.getString("tanggal"); + String konten = rs.getString("konten"); + boolean published = (rs.getInt("published")==1); + return new Post(pid,judul,tanggal,konten,published); + + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + lgr.log(Level.SEVERE, "nana", "lala"); + return null; + + } catch (Throwable e){ + return null; + } + } + + /* Mengambil salah satu user */ + public User selectUser(int uid){ + try { + st = con.createStatement(); + String query = "SELECT * FROM `sb_users` WHERE `user_id`=" + uid; + System.out.println(query); + rs = st.executeQuery(query); + if(rs.next()){ + String username = rs.getString("username"); + String userpass = rs.getString("password"); + String email = rs.getString("email"); + int type = rs.getInt("type"); + System.out.println("select "+username+" "+userpass+" "+email+" "+type); + return new User(uid,username,userpass,email,type); + } + else return null; + + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + lgr.log(Level.SEVERE, "nana", "lala"); + return null; + + } catch (Throwable e){ + return null; + } + } + + /* Menambahkan Post ke Database */ + public String insertPost(User pengguna, Post p){ + if(pengguna.isLoggedon() && (pengguna.getType()==1 || pengguna.getType()==3)){ + try { + String query = "INSERT INTO `sb_posts`(`judul`, `tanggal`, `konten`, `published`) VALUES ('" + p.getJudul() + "','" + p.getTanggal() + "','" + p.getKonten() + "','0')"; + int userrole = pengguna.getType(); + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "Unpublished_Posts.xhtml?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Menambahkan User ke Database */ + public String insertUser(User pengguna, User p){ + if(pengguna.isLoggedon() && pengguna.getType()==3){ + try { + st = con.createStatement(); + String query = "SELECT COUNT(username) AS c FROM `sb_users` WHERE `username`='" + p.getName() + "'"; + //System.out.println(query); + rs = st.executeQuery(query); + rs.next(); + System.out.println(" >>" + rs.getString("c") + "<<"); + if(rs.getString("c").equals("0")){ + query = "INSERT INTO `sb_users`(`username`, `password`, `email`, `type`) VALUES ('" + p.getName() + "','" + p.getPassword() + "','" + p.getEmail() + "','" + p.getType() + "')"; + + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "User_Management.xhtml?faces-redirect=true"; + } + else return "?faces-redirect=true&success=no"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + System.out.println("bocor"); + } + return null; + } + + /* Menambahkan Komentar ke Database */ + public void insertComment(User pengguna, Comment c){ + try { + String query = "INSERT INTO `sb_comments`(`nama`, `email`, `komentar`, `id_post`) VALUES ('" + c.getNama() + "','" + c.getEmail() + "','" + c.getKomentar() + "','" + c.getPost_id() + "')"; + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + //return "Post.xhtml?pid=" + c.getPost_id() + "&faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + System.out.println("sqlex"); + } catch (Throwable e){ + System.out.println("throw"); + } + c.init(pengguna); + //return null; + } + + /* Mengupdate Post di Database */ + public String updatePost(User pengguna, Post p){ + if(pengguna.isLoggedon() && pengguna.getType()<=3){ + try { + String query = "UPDATE `sb_posts` SET `judul`='" + p.judul +"', `tanggal`='" + p.tanggal + "', `konten`='" + p.konten + "' WHERE `id_post`=" + p.id_post + ";"; + System.out.println(query); + int userrole = pengguna.getType(); + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "Published_Posts?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Mengupdate User di Database */ + public String updateUser(User admin, User p){ + if(admin.isLoggedon() && admin.getType()==3){ + try { + String query = "UPDATE `sb_users` SET `username`='" + p.getName() +"', `password`='" + p.getPassword() +"', `email`='" + p.getEmail() + "', `type`='" + p.getType() + "' WHERE `user_id`=" + p.getUserid() + ";"; + //System.out.println(query); + //System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "faces/User_Management.xhtml?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Mendelete User di Database */ + public String deleteUser(User admin, User p){ + if(admin.isLoggedon() && admin.getType()==3){ + try { + String query = "DELETE FROM `sb_users` where `user_id`='" + p.getUserid() + "';"; + System.out.println(query); + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "faces/User_Management.xhtml?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Mendelete Post di Database */ + public String deletePost(User pengguna, int pid){ + if(pengguna.isLoggedon() && pengguna.getType()<=3){ + try { + String query = "DELETE FROM `sb_posts` where `id_post`='" + pid + "';"; + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "faces/Published_Posts.xhtml?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Mempublish Post */ + public String publishPost(User pengguna, Post p){ + if(pengguna.isLoggedon() && (pengguna.getType()==3 || pengguna.getType()==2)){ + try { + String query = "UPDATE `sb_posts` SET `published`=1 WHERE `id_post`=" + p.id_post + ";"; + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "Published_Posts?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* SoftDelete Post */ + public String softDeletePost(User pengguna, int pid){ + if(pengguna.getType()!=4){ + try { + String query = "UPDATE `sb_posts` SET `published`=2 WHERE `id_post`=" + pid + ";"; + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "Published_Posts?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Restore Post */ + public String restorePost(User pengguna, int pid){ + if(pengguna.getType()==3){ + try { + String query = "UPDATE `sb_posts` SET `published`=0 WHERE `id_post`=" + pid + ";"; + System.out.println(query); + pst = con.prepareStatement(query); + pst.executeUpdate(); + return "Published_Posts?faces-redirect=true"; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + } catch (Throwable e){ + } + } + return null; + } + + /* Mengambil seluruh isi post */ + public ArrayList listPost(String pub){ + try { + st = con.createStatement(); + int pubs=0; + if(pub=="true") pubs=1; + else if(pub=="false") pubs=0; + else if(pub=="deleted") pubs=2; + String query = "SELECT * FROM `sb_posts` WHERE `published`=" + pubs + " ORDER BY `tanggal` DESC"; + System.out.println(query); + rs = st.executeQuery(query); + ArrayList retval = new ArrayList(); + while (rs.next()) { + int id_post = rs.getInt("id_post"); + String judul = rs.getString("judul"); + String tanggal = rs.getString("tanggal"); + String konten = rs.getString("konten"); + boolean published = (rs.getInt("published")==1); + retval.add(new Post(id_post, judul, tanggal, konten, published)); + } + return retval; + + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + lgr.log(Level.SEVERE, "nana", "lala"); + return null; + + } catch (Throwable e){ + return null; + } + } + + /* Mengambil seluruh isi komentar pos ini */ + public ArrayList listComment(int pid){ + try { + st = con.createStatement(); + String query = "SELECT * FROM `sb_comments` WHERE `id_post`=" + pid + " ORDER BY `timestamp` DESC"; + //System.out.println(query); + rs = st.executeQuery(query); + ArrayList retval = new ArrayList(); + while (rs.next()) { + int id_komentar = rs.getInt("id_komentar"); + String nama = rs.getString("nama"); + String email = rs.getString("email"); + String komentar = rs.getString("komentar"); + String timestamp = rs.getString("timestamp"); + retval.add(new Comment(id_komentar, nama, email, komentar, timestamp, pid)); + } + return retval; + + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + lgr.log(Level.SEVERE, "nana", "lala"); + return null; + + } catch (Throwable e){ + return null; + } + } + + /* Crud */ + public ArrayList listUser(User pengguna){ + if(pengguna.isLoggedon() && pengguna.getType()==3){ + if(pengguna.getType()==3){ + try { + st = con.createStatement(); + String query = "SELECT * FROM `sb_users`"; + System.out.println(query); + rs = st.executeQuery(query); + ArrayList retval = new ArrayList(); + while (rs.next()) { + int userid = rs.getInt("user_id"); + String name = rs.getString("username"); + String pass = rs.getString("password"); + String email = rs.getString("email"); + int type = rs.getInt("type"); + retval.add(new User(userid, name, pass, email, type)); + } + return retval; + } catch (SQLException ex) { + Logger lgr = Logger.getLogger(DBConnector.class.getName()); + lgr.log(Level.SEVERE, ex.getMessage(), ex); + System.out.println("sqlex"); + } catch (Throwable e){ + System.out.println("e"); + } + } + } + return null; + } +} \ No newline at end of file diff --git a/src/java/lingga/NavigationController.java b/src/java/lingga/NavigationController.java new file mode 100644 index 00000000..5acbeaeb --- /dev/null +++ b/src/java/lingga/NavigationController.java @@ -0,0 +1,32 @@ +/* + * 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 lingga; + +import java.io.IOException; +import java.io.Serializable; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + +/** + * + * @author Jelink + */ +@ManagedBean(name = "navigationController", eager = true) +@RequestScoped +public class NavigationController implements Serializable { + public void moveToPublishedPost(){ + try{ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Published_Posts.xhtml"); + } + catch(IOException e){ + e.printStackTrace(); + } + } +} diff --git a/src/java/lingga/Post.java b/src/java/lingga/Post.java new file mode 100644 index 00000000..7746438d --- /dev/null +++ b/src/java/lingga/Post.java @@ -0,0 +1,158 @@ +package lingga; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * + * @author Jelink + */ +@ManagedBean(name="post",eager=true) +@SessionScoped +public class Post { + int id_post; + String judul; + String tanggal; + String konten; + boolean published; + boolean isReadMore=false; + + public Post(){ + + } + + public void copy(Post p){ + id_post = p.id_post; + judul = p.judul; + tanggal = p.tanggal; + konten = p.konten; + published = p.published; + } + + public void makeEmpty(){ + judul = tanggal = konten = null; + published = false; + } + + public Post(int id_post, String judul, String tanggal, String konten, boolean published) { + this.id_post = id_post; + this.judul = judul; + this.tanggal = tanggal; + this.konten = konten; + this.published = published; + } + + public int getId_post() { + return id_post; + } + + public void setId_post(int id_post) { + this.id_post = id_post; + } + + public String getJudul() { + return judul; + } + + public void setJudul(String judul) { + this.judul = judul; + } + + public String getTanggal() { + return tanggal; + } + + /*public void setTanggal(Date tanggal) { + this.tanggal = tanggal; + }*/ + + public void setTanggal(String tanggal){ + this.tanggal = tanggal; + } + + public String getKonten() { + return konten; + } + + public String getExcerptHTML(int n) { + List l = new ArrayList(); + int pos = 0; + boolean br = false; + while (l.size() < n && !br) { + int excerpt = konten.indexOf(' ', pos); + if (excerpt == -1) { + l.add(konten.substring(pos)); + br=true; + } + if(!br){ + l.add(konten.substring(pos, excerpt)); + pos = excerpt + 1; + } + } + String retval=""; + for(String word : l){ + retval = retval + ' ' + word; + } + //System.out.println(">>>"+l.size()+" " + n); + if(l.size()"); + } + + public void setKonten(String konten) { + this.konten = konten; + } + + public boolean isPublished() { + return published; + } + + public void setPublished(boolean published) { + this.published = published; + } + + public String editButton(int role){ + if (!(role==2 || role==3 || (role==1 && published))) return "none"; + else return "block-inline"; + } + + public String publishButton(int role){ + if(published || role==1 || role==4) return "none"; + else return "block-inline"; + } + + public String deleteButton(int role){ + if(role==4) return "none"; + else return "block-inline"; + } + + public String hardDeleteButton(int role){ + if(role==3) return "block-inline"; + else return "none"; + } + + public String readMoreButton(){ + + if(!isReadMore){ + System.out.println("none"); + return "none"; + } + else{ + return "block-inline"; + } + } + +} \ No newline at end of file diff --git a/src/java/lingga/PostList.java b/src/java/lingga/PostList.java new file mode 100644 index 00000000..dac7350c --- /dev/null +++ b/src/java/lingga/PostList.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 lingga; + +import java.util.ArrayList; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * + * @author Jelink + */ + +@ManagedBean(name="postlist",eager=true) +@SessionScoped +public class PostList { + private ArrayList listPos; + private ArrayList unlistPos; + private ArrayList trashPos; + + public void initPostList(DBConnector dbc){ + listPos = new ArrayList(dbc.listPost("true")); + unlistPos = new ArrayList(dbc.listPost("false")); + trashPos = new ArrayList(dbc.listPost("deleted")); + } + + public Post getPost(int n){ + return listPos.get(n); + } + + public ArrayList getListPos(User us) { + return listPos; + } + + public ArrayList getUnlistPos(User us) { + if(us.getType()==2 || us.getType()==3){ + return unlistPos; + } + else{ + return null; + } + } + + public ArrayList getTrashPos(User us) { + if(us.getType()==3){ + return trashPos; + } + else{ + return null; + } + } +} diff --git a/src/java/lingga/User.java b/src/java/lingga/User.java new file mode 100644 index 00000000..97671d29 --- /dev/null +++ b/src/java/lingga/User.java @@ -0,0 +1,239 @@ +package lingga; + +import java.io.IOException; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.ExternalContext; +import javax.faces.context.FacesContext; + +/** + * + * @author Jelink + */ +@ManagedBean(name="user",eager=true) +@SessionScoped +public class User { + private int userid; + private String name; + private String password; + private String output_msg; + private String email; + private int type; + private boolean loggedon=false; + private User saved; + + public User(){ + + } + + public User(User p) { + this.userid = p.userid; + this.name = p.name; + this.password = p.password; + this.email = p.email; + this.type = p.type; + this.loggedon = p.loggedon; + saved = new User(); + } + + public void copy(User p) { + this.userid = p.userid; + this.name = p.name; + this.password = p.password; + this.email = p.email; + this.type = p.type; + this.loggedon = p.loggedon; + saved = new User(); + } + + public User(int userid, String name, String password, String email, int type) { + this.userid = userid; + this.name = name; + this.password = password; + this.email = email; + this.type = type; + this.loggedon = false; + this.output_msg = "lala"; + saved = new User(); + } + + public void copyToSaved(User p){ + System.out.println("lalalalala " + p.userid); + saved = new User(p); + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User getSaved() { + return saved; + } + + public void setSaved(User saved) { + this.saved = saved; + } + + public int getUserid() { + return userid; + } + + public void setUserid(int userid) { + this.userid = userid; + } + + public int getType() { + return type; + } + + public String getTypeName() { + String retval=null; + switch(type){ + case 1 : retval = "Owner"; break; + case 2 : retval = "Editor"; break; + case 3 : retval = "Admin"; break; + } + return retval; + } + + public void setType(int type) { + this.type = type; + } + + public boolean isLoggedon() { + if(type==4) loggedon=false; + else loggedon=true; + return loggedon; + } + + public void setLoggedon(boolean loggedon) { + this.loggedon = loggedon; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getOutput_msg() { + return output_msg; + } + + public void setOutput_msg(String output_msg) { + this.output_msg = output_msg; + } + + public void loggedOnRedirectToPub() throws IOException { + if(loggedon){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Published_Posts.xhtml"); + } + } + + public void loggedOnRedirectToUnPub() throws IOException { + if(loggedon){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Unpublished_Posts.xhtml"); + } + } + + public void notAdminRedirectToPub() throws IOException { + if(type!=3){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Published_Posts.xhtml"); + } + } + + public void notAdminNotOwnerRedirectToPub() throws IOException { + if(type!=3 && type!=1){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Published_Posts.xhtml"); + } + } + + public void notAdminNotEditorRedirectToPub() throws IOException { + if(type!=3 && type!=2){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Published_Posts.xhtml"); + } + } + + public void loggedOffRedirectToPub() throws IOException { + if(!isLoggedon()){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/faces/Published_Posts.xhtml"); + } + } + + public void loggedOffRedirectToInd() throws IOException { + if(!isLoggedon()){ + ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext(); + ec.redirect(ec.getRequestContextPath() + "/"); + } + } + + public String addButton(){ + if (!(loggedon && (type==1 || type==3))) return "none"; + else return "block-inline"; + } + + public String unPubButton(){ + if(loggedon && (type==2 || type==3)) return "block-inline"; + else return "none"; + } + + public String logInButton(){ + if(type==4) return "block-inline"; + else return "none"; + } + + public String logOutButton(){ + if(type==4) return "none"; + else return "block-inline"; + } + + public String userMgtButton(){ + if(loggedon && type==3) return "block-inline"; + else return "none"; + } + + public String logOut(CookieHandler co){ + //user + name = ""; + password = ""; + loggedon = false; + type = 4; //jadikan guest + + //cookie + co.deleteCookie("if3110_sb_uid"); + + //action + return "Published_Posts?faces-redirect=true"; + } + + public void makeEmptySaved(){ + saved = new User(); + saved.name = ""; + saved.password = ""; + saved.email = ""; + saved.type = 1; + saved.loggedon = false; + saved.output_msg = ""; + } +} + \ No newline at end of file diff --git a/src/java/lingga/UserList.java b/src/java/lingga/UserList.java new file mode 100644 index 00000000..d23ba0c8 --- /dev/null +++ b/src/java/lingga/UserList.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package lingga; + +import java.util.ArrayList; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * + * @author Jelink + */ + +@ManagedBean(name="userlist",eager=true) +@SessionScoped +public class UserList { + private ArrayList listUser; + + public void initUserList(User pengguna, DBConnector dbc){ + listUser = new ArrayList(dbc.listUser(pengguna)); + } + + public User getUser(int n){ + return listUser.get(n); + } + + public ArrayList getListUser(User us) { + if(us.getType()==3){ + return listUser; + } + else{ + return null; + } + } +} diff --git a/web/Add_Post.xhtml b/web/Add_Post.xhtml new file mode 100644 index 00000000..84a6ea74 --- /dev/null +++ b/web/Add_Post.xhtml @@ -0,0 +1,90 @@ + + + + + Add New Post + + + + + + #{post.makeEmpty()} + +
+
+
+

Add Post

+ Halaman ini merupakan halaman untuk menambahkan pos ke blog +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/web/Add_User.xhtml b/web/Add_User.xhtml new file mode 100644 index 00000000..7fb66d1f --- /dev/null +++ b/web/Add_User.xhtml @@ -0,0 +1,96 @@ + + + + + Edit User + + + + + + +
+
+
+

Edit User

+ Halaman ini merupakan halaman untuk menambahkan user baru ke blog +
+ +
+
+
+ + #{user.makeEmptySaved()} +
+
+
+ + + + + +
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+
+ + diff --git a/web/Delete_Post.xhtml b/web/Delete_Post.xhtml new file mode 100644 index 00000000..f48650c2 --- /dev/null +++ b/web/Delete_Post.xhtml @@ -0,0 +1,23 @@ + + + + + + TODO supply a title + + + + + #{dbconnector.deletePost(user, param['pid'])} + #{user.loggedOnRedirectToPub()} + + diff --git a/web/Edit_Post.xhtml b/web/Edit_Post.xhtml new file mode 100644 index 00000000..1fb234ae --- /dev/null +++ b/web/Edit_Post.xhtml @@ -0,0 +1,90 @@ + + + + #{post.copy(dbconnector.selectPost(param['pid']))} + + Edit Post | #{post.judul} + + + + + + +
+
+
+

Edit Post

+ Halaman ini merupakan halaman untuk menyunting pos tertentu +
+ +
+
+
+ +
+
+
+
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/web/Edit_User.xhtml b/web/Edit_User.xhtml new file mode 100644 index 00000000..4c7c2d03 --- /dev/null +++ b/web/Edit_User.xhtml @@ -0,0 +1,97 @@ + + + + + Edit Post + + + + + + #{user.copyToSaved(dbconnector.selectUser(param['uid']))} + +
+
+
+

Add User

+ Halaman ini merupakan halaman untuk mengedit user +
+ +
+
+
+ +
+
+
+ + + + + +
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+
+ + diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml new file mode 100644 index 00000000..3aec977a --- /dev/null +++ b/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/Post.xhtml b/web/Post.xhtml new file mode 100644 index 00000000..640d3986 --- /dev/null +++ b/web/Post.xhtml @@ -0,0 +1,105 @@ + + + + + #{dbconnector.verify(user, cookiehandler)} + #{post.copy(dbconnector.selectPost(param['pid']))} + + #{post.judul} + + + + + + +
+
+
+

#{post.judul}

+ #{post.tanggal} + +

+
+

Berikan Komentar

+ + #{comment.setPost_id(param['pid'])} + #{comment.init(user)} +
+
+
+ + + +
+
+ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+ +
+ + diff --git a/web/Publish_Post.xhtml b/web/Publish_Post.xhtml new file mode 100644 index 00000000..9b4d426e --- /dev/null +++ b/web/Publish_Post.xhtml @@ -0,0 +1,18 @@ + + + + + Publish Post + + + + + #{post.copy(dbconnector.selectPost(param['pid']))} + #{dbconnector.publishPost(user,post)} + #{user.loggedOnRedirectToPub()} + + diff --git a/web/Published_Posts.xhtml b/web/Published_Posts.xhtml new file mode 100644 index 00000000..2c404784 --- /dev/null +++ b/web/Published_Posts.xhtml @@ -0,0 +1,107 @@ + + + + + + Home Page | Published Posts + + + + + #{dbconnector.verify(user, cookiehandler)} + + #{postlist.initPostList(dbconnector)} + +
+
+
+

Published Posts

+ Halaman ini menampilkan seluruh post yang sudah dipublish oleh admin maupun editor. +
+ +
+ + +
+
+ +
+

#{item.judul}

+

+

+ Read More


+
+ + Edit Post + + Delete + + Publish +
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/web/Restore_Post.xhtml b/web/Restore_Post.xhtml new file mode 100644 index 00000000..a7e0c4ef --- /dev/null +++ b/web/Restore_Post.xhtml @@ -0,0 +1,23 @@ + + + + + + TODO supply a title + + + + + #{dbconnector.restorePost(user, param['pid'])} + #{user.loggedOnRedirectToUnPub()} + + diff --git a/web/Soft_Delete_Post.xhtml b/web/Soft_Delete_Post.xhtml new file mode 100644 index 00000000..a7952227 --- /dev/null +++ b/web/Soft_Delete_Post.xhtml @@ -0,0 +1,23 @@ + + + + + + TODO supply a title + + + + + #{dbconnector.softDeletePost(user, param['pid'])} + #{user.loggedOnRedirectToPub()} + + diff --git a/web/Trash.xhtml b/web/Trash.xhtml new file mode 100644 index 00000000..d91bafdc --- /dev/null +++ b/web/Trash.xhtml @@ -0,0 +1,107 @@ + + + + + + Trash Page + + + + + + #{dbconnector.verify(user,cookiehandler)} + #{postlist.initPostList(dbconnector)} + +
+
+
+

Trash Posts

+ Halaman ini menampilkan seluruh post yang telah dihapus secara soft delete. +
+ +
+ + +
+
+ + + +
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/web/Unpublished_Posts.xhtml b/web/Unpublished_Posts.xhtml new file mode 100644 index 00000000..d2228b1a --- /dev/null +++ b/web/Unpublished_Posts.xhtml @@ -0,0 +1,108 @@ + + + + + + Home Page | Unpublished Posts + + + + + + #{dbconnector.verify(user,cookiehandler)} + #{user.loggedOffRedirectToInd()} + #{postlist.initPostList(dbconnector)} + +
+
+
+

Unpublished Posts

+ Halaman ini menampilkan seluruh post yang belum dipublish oleh admin maupun editor. +
+ +
+ + +
+
+ +
+

#{item.judul}

+

+

+ Read More


+
+ + Edit Post + + Delete + + Publish +
+
+
+
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ + diff --git a/web/User_Management.xhtml b/web/User_Management.xhtml new file mode 100644 index 00000000..92a7705b --- /dev/null +++ b/web/User_Management.xhtml @@ -0,0 +1,107 @@ + + + + + + User Management + + + + + + #{userlist.initUserList(user, dbconnector)} + +
+
+
+

User Management

+ Halaman ini hanya tersedia untuk administrator, menampilkan data seluruh user, beserta kemampuan untuk melakukan CRUD terhadap user +
+ +
+
+
+ + + + + + + + + + + + + + + +
UsernameEmailTypeEdit
#{item.name}#{item.email}#{item.getTypeName()} Edit
+
+ +
+
+ +
+
+
+ X +

Masukkan username dan password

+ +
+
+ +
+
+
+
+
+
+ X + +

Keluar dari sistem ini?

+ +
+
+
+
+ diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 00000000..a6c450c7 --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/web/index.xhtml b/web/index.xhtml new file mode 100644 index 00000000..e4d013be --- /dev/null +++ b/web/index.xhtml @@ -0,0 +1,16 @@ + + + + + + Simple Blog + + + + #{navigationController.moveToPublishedPost()} + + diff --git a/web/resources/font/Aventura-Bold.otf b/web/resources/font/Aventura-Bold.otf new file mode 100644 index 00000000..3b4166e0 Binary files /dev/null and b/web/resources/font/Aventura-Bold.otf differ diff --git a/web/resources/font/Biko_Black.otf b/web/resources/font/Biko_Black.otf new file mode 100644 index 00000000..1297b76f Binary files /dev/null and b/web/resources/font/Biko_Black.otf differ diff --git a/web/resources/font/Biko_Bold.otf b/web/resources/font/Biko_Bold.otf new file mode 100644 index 00000000..5bd3c436 Binary files /dev/null and b/web/resources/font/Biko_Bold.otf differ diff --git a/web/resources/font/Biko_Light-Restricted.otf b/web/resources/font/Biko_Light-Restricted.otf new file mode 100644 index 00000000..9fb5db89 Binary files /dev/null and b/web/resources/font/Biko_Light-Restricted.otf differ diff --git a/web/resources/font/Biko_Regular.otf b/web/resources/font/Biko_Regular.otf new file mode 100644 index 00000000..da7b16e4 Binary files /dev/null and b/web/resources/font/Biko_Regular.otf differ diff --git a/web/resources/font/ElegantLux-Mager.otf b/web/resources/font/ElegantLux-Mager.otf new file mode 100644 index 00000000..3963e2f3 Binary files /dev/null and b/web/resources/font/ElegantLux-Mager.otf differ diff --git a/web/resources/font/KiloGram_KG.otf b/web/resources/font/KiloGram_KG.otf new file mode 100644 index 00000000..c0d69d71 Binary files /dev/null and b/web/resources/font/KiloGram_KG.otf differ diff --git a/web/resources/img/header1.jpg b/web/resources/img/header1.jpg new file mode 100644 index 00000000..836cb0bf Binary files /dev/null and b/web/resources/img/header1.jpg differ diff --git a/web/resources/js/deletor.js b/web/resources/js/deletor.js new file mode 100644 index 00000000..e99590ea --- /dev/null +++ b/web/resources/js/deletor.js @@ -0,0 +1,45 @@ +window.onload = function() { + var a = document.getElementsByClassName("deletebutton"); + for(i in a){ + a[i].onclick = function() { + if(confirm("Apakah Anda yakin menghapus post ini?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Soft_Delete_Post.xhtml?pid=" + pid; + } + return false; + }; + }; + + var hd = document.getElementsByClassName("harddeletebutton"); + for(i in hd){ + hd[i].onclick = function() { + if(confirm("Anda yakin ingin menghapus pos ini secara permanen?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Delete_Post.xhtml?pid=" + pid; + } + return false; + }; + }; + + var rb = document.getElementsByClassName("restorebutton"); + for(i in rb){ + rb[i].onclick = function() { + if(confirm("Yakin merestore post ini ke unpublished post?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Restore_Post.xhtml?pid=" + pid; + } + return false; + }; + }; + + var pb = document.getElementsByClassName("publishbutton"); + for(i in pb){ + pb[i].onclick = function() { + if(confirm("Yakin mempublish pos ini?")){ + var pid = this.id.substring(3).toString(); + window.location.href = "Publish_Post.xhtml?pid=" + pid; + } + return false; + }; + }; +}; \ No newline at end of file diff --git a/web/resources/js/validator.js b/web/resources/js/validator.js new file mode 100644 index 00000000..e455acfb --- /dev/null +++ b/web/resources/js/validator.js @@ -0,0 +1,91 @@ +function validateForm(){ + //alert("lala"); + var titlePost = document.inputanpos["inputanpos:Judul"].value; + var contentPost = document.inputanpos["inputanpos:Konten"].value; + var datePost = document.inputanpos["inputanpos:Tanggal"].value; + var dateNow = new Date(); + if(titlePost === null || titlePost === ""){ + alert('Judul pos tidak boleh kosong'); + return false; + } + + if(datePost === null || datePost === ""){ + alert('Tanggal pos tidak boleh kosong'); + return false; + } + else { + datePost = new Date(document.inputanpos["inputanpos:Tanggal"].value + " 23:59:59"); + if (datePost - dateNow < 0){ + alert('Tanggal pos tidak boleh kurang dari tanggal sekarang.'); + return false; + } + } + + if(contentPost === null || contentPost === ""){ + alert('Konten pos tidak boleh kosong'); + return false; + } + + return true; +} + +function validateComment(){ + // validasi komentar + var komentar = document.inputankomentar["inputankomentar:komentar"].value; + var email = document.inputankomentar["inputankomentar:email"].value; + var nama = document.inputankomentar["inputankomentar:nama"].value; + // validasi komentar kosong + if(nama === ""){ + alert('nama tidak boleh kosong'); + return false; + } + // validasi email tidak kosong + else if(email === ""){ + alert('isi email anda untuk berkomentar'); + return false; + } + // validasi email sesuai kaidah + else if(!validateEmail(email)){ + alert("alamat email tidak valid"); + return false; + } + // validasi komentar kosong + else if(komentar === ""){ + alert('komentar tidak boleh kosong'); + return false; + } + return true; +} + +function validateEmail(email){ + var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(email); +} + +function validateEdAddUser(){ + // validasi komentar + var username = document.edadduser["edadduser:username"].value; + var password = document.edadduser["edadduser:password"].value; + var email = document.edadduser["edadduser:email"].value; + // validasi komentar kosong + if(username === ""){ + alert('username tidak boleh kosong'); + return false; + } + // validasi email tidak kosong + else if(email === ""){ + alert('email tidak boleh kosong'); + return false; + } + // validasi email sesuai kaidah + else if(!validateEmail(email)){ + alert("alamat email tidak valid"); + return false; + } + // validasi komentar kosong + else if(password === ""){ + alert('password tidak boleh kosong'); + return false; + } + return true; +} \ No newline at end of file diff --git a/web/resources/style.css b/web/resources/style.css new file mode 100644 index 00000000..6d9f64b4 --- /dev/null +++ b/web/resources/style.css @@ -0,0 +1,428 @@ +/* +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. +*/ +/* + Created on : Nov 26, 2014, 1:45:39 PM + Author : Jelink +*/ + +@font-face{ + font-family: aventura; + src: url(font/Aventura-Bold.otf); +} + +@font-face{ + font-family: biko_regular; + src: url(font/Biko_Regular.otf); +} + +@font-face{ + font-family: biko_bold; + src: url(font/Biko_Bold.otf); +} + +@font-face{ + font-family: kilogram; + src: url(KiloGram_KG.otf); +} + +html, +body { + font-family: 'biko_regular', arial, sans-serif; + margin:0; + padding:0px !important; + height:100%; + color: #555; + font-size: 17px; +} +a{ + color: #6699FF; + text-decoration: none; +} +a:hover{ + color: #77AAFF; +} +#container { + top:60px; + min-height:92.2%; + position:relative; +} +#header { + background:url("img/header1.jpg"); + background-size:auto 200%; + background-position: center -100px ; + height: 490px; + padding:10px; +} +#body { + padding:10px; + padding-bottom:60px; /* Height of the footer */ +} +#footer { + position:absolute; + bottom:0; + width:100%; + height:60px; /* Height of the footer */ + background:#1C222E; + color: white; +} +#menubar { + position: fixed; + height: 60px; + width: 100%; + z-index: 100; + text-transform: uppercase; +} + +#menubar a{ + color:#6699FF; +} + +#menubar a:hover{ + color:white; +} + +#menubar a:click{ + color:yellow; +} + +#menulist { + position: absolute; + right: 0px; + min-width: 40%; +} + +#menulist ul{ + list-style: none; + margin-right: 0px; +} + +#menulist li{ + text-align: center; + display: inline-block; + width: 20%; + min-width: 80px; +} + +.bluegrad { + background: -webkit-linear-gradient(red, blue); /* For Safari 5.1 to 6.0 */ + background: -o-linear-gradient(red, blue); /* For Opera 11.1 to 12.0 */ + background: -moz-linear-gradient(red, blue); /* For Firefox 3.6 to 15 */ + background: linear-gradient( #19356C, #1C222E); /* Standard syntax */ +} + +#dashmenu{ + top: 120px; + left: 100px; + position: absolute; + color: white; + max-width: 400px; +} + +#dashmenu h1, h2, h3{ + margin: 10px 0px 10px 0px; +} + +#dashmenu #title{ + padding: 20px; + background: rgba(0,0,0,0.7); +} + +#dashmenu #menus{ + padding: 20px; + background:#6699FF; +} + +#dashmenu #menus ul{ + padding: 0px; +} + +#dashmenu #menus li{ + list-style: none; + margin-bottom: 2px; +} + +#dashmenu #menus a{ + text-align: center; + padding: 2px; + display:block; + background:#77AAFF; + color: white; +} + +#dashmenu #menus a:hover{ + background:#88BBFF; +} + +#postContainer{ + position: relative; + width:60%; + left:20%; +} + +.onePost{ + margin: 50px 0 50px 0; +} + +.onePost .buttons{ + text-align: right; +} + +.buttons a{ + text-align: center; + padding: 10px; + display:block-inline; + background:#77AAFF; + color: white; +} + +.onePost .buttons a:hover{ + background:#88BBFF; +} + +#footer .identity{ + margin-top: 14px; + padding: 4px; + display: inline-block; + width: 31%; + text-align: center; +} + +#idlist{ + position: relative; + width: 60%; + left: 20%; +} + +#footer .left{ + text-align: left !important; +} + +#footer .right{ + text-align: right !important; +} + +#rightContainer{ + display: box; + position:relative; + margin-top: 6%; + margin-right: 0px; + width:58%; + left: 41%; + right: 0%; +} + +#rightContainer form{ + +} + +#rightContainer form input{ + padding: 5px; + margin-bottom: 5px; + width: 70%; + min-width: 410px; +} + +#rightContainer form label{ + text-align: center; +} + +#rightContainer form textArea{ + width: 70%; + min-height: 300px; + padding: 5px; + margin-bottom: 5px; + min-width: 410px; +} + +.button{ + width: 100px !important; +} + +.postmanip #dashmenu{ + top: 105px; + left: 14%; + display:box; +} + +#rightContainer table{ + overflow: auto; + max-height: 500px; +} + +table{ + border-collapse: collapse; + table-layout: fixed; + min-width: 70%; + max-width: 80%; +} + +table td,th{ + padding: 7px; + margin: 0px; +} + +table td{ + border-bottom: 1px solid #eee; +} + +table .first{ + text-align: left; + background: #77AAFF; + color: white; +} + +#inputankomentar{ + width : 70%; + margin-left : 15%; + margin-bottom: 30px; +} + +#inputankomentar input{ + padding: 5px; + margin-bottom: 5px; + width: 100%; +} + +#inputankomentar textArea{ + width: 100%; + min-height: 100px; + padding: 5px; + margin-bottom: 5px; +} + +.oneComment{ + border-bottom: solid 1px #eee; +} + +#commentStructure{ + table-layout: fixed; + width: 100%; +} + +#commentStructure td{ + min-width: 100% !important; +} + +hr{ + border: 1px solid #eee !important; + margin: 20px 0 20px 0; +} + +#postContainer h2{ + text-align: center; + margin: 10px 0 15px 0; +} + +.modalDialog { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: rgba(0, 0, 0, 0.8); + z-index: 99999; + opacity:0; + -webkit-transition: opacity 400ms ease-in; + -moz-transition: opacity 400ms ease-in; + transition: opacity 400ms ease-in; + pointer-events: none; +} + +.modalDialog:target { + opacity:1; + pointer-events: auto; +} + +.modalDialog input { + width:97%; + padding: 5px; + margin: 5px 0 5px 0; +} + +.modalDialog > div { + width: 400px; + position: relative; + margin: 10% auto; + padding: 10px 20px 10px 20px; + border-radius: 10px; + background: #fff; +} +.close { + background: white; + line-height: 25px; + position: absolute; + right: -12px; + text-align: center; + top: -10px; + width: 24px; + font-weight: bold; + -webkit-border-radius: 12px; + -moz-border-radius: 12px; + border-radius: 12px; + -moz-box-shadow: 1px 1px 3px #000; + -webkit-box-shadow: 1px 1px 3px #000; + box-shadow: 1px 1px 3px #000; +} +.close:hover { + background: yellow; +} + +#edadduser table input{ + width: 20px !important; + min-width: 0px; +} + +@media all and (max-width: 1200px) { + .postmanip #dashmenu{ + left:5%; + } + #postContainer{ + width: 90% !important; + left:5%; + } + #header{ + background-position: center 10% ; + } + #rightContainer{ + left:45%; + } +} + +@media all and (max-width: 1000px){ + #idlist{ + position: relative; + width: 90%; + left: 5%; + font-size: 15px; + } + #idlist .identity{ + padding: 0px; + } + #inputankomentar{ + width: 85%; + margin-left: 7.5%; + } + .postmanip #dashmenu{ + position: relative; + display:block; + } + .postmanip #body #rightContainer{ + margin-top:150px; + margin-bottom:150px; + left:5%; + right:5%; + width:90%; + } +} + +@media all and (max-width: 611px){ + #dashmenu{ + left: 10% !important; + right: 10% !important; + min-width: 80% !important; + } + +} \ No newline at end of file