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/blogjava (2).sql b/blogjava (2).sql new file mode 100644 index 00000000..b76227de --- /dev/null +++ b/blogjava (2).sql @@ -0,0 +1,142 @@ +-- phpMyAdmin SQL Dump +-- version 4.1.6 +-- http://www.phpmyadmin.net +-- +-- Host: 127.0.0.1:3307 +-- Generation Time: 30 Nov 2014 pada 07.24 +-- 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: `blogjava` +-- + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `blogpost` +-- + +CREATE TABLE IF NOT EXISTS `blogpost` ( + `pid` int(5) NOT NULL AUTO_INCREMENT, + `uid` int(11) NOT NULL, + `posttitle` varchar(100) NOT NULL, + `postcontent` text NOT NULL, + `postdate` date NOT NULL, + `published` tinyint(1) NOT NULL DEFAULT '0', + `deleted` tinyint(1) NOT NULL DEFAULT '0', + PRIMARY KEY (`pid`), + KEY `uid` (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=53 ; + +-- +-- Dumping data untuk tabel `blogpost` +-- + +INSERT INTO `blogpost` (`pid`, `uid`, `posttitle`, `postcontent`, `postdate`, `published`, `deleted`) VALUES +(7, 1, 'Post Pertamaku', 'ieu post pertama kuring', '2014-11-25', 1, 0), +(8, 1, 'Post Keduaku', 'ieu post Kedua kuring', '2014-11-25', 1, 0), +(9, 1, 'Post ketigaku', 'isi Post ketiga', '2014-11-25', 0, 0), +(10, 2, 'post pertama nisa', 'nisa dian lalala', '2014-11-26', 1, 0), +(45, 1, 'Post ketigaku - Copy', 'isi Post ketiga', '2014-11-25', 0, 0), +(46, 1, 'ini post buat di hapus', 'sesuai judul', '2014-11-28', 1, 0), +(47, 3, 'ini postnya hayyu', 'tanggalnya sudah benar', '2014-11-29', 1, 0), +(48, 2, 'post pertama nisa - edited', 'nisa dian lilili', '2014-11-29', 1, 0), +(49, 3, 'hayyu luthfi', 'di hati yang ter dalam', '2014-11-29', 1, 0), +(50, 3, 'Post Keduaku', 'ieu post Kedua kuring', '2014-11-25', 1, 0), +(51, 3, 'Post Keduaku', 'ieu post Kedua kuring', '2014-11-25', 1, 0), +(52, 3, 'laksjlkajd', ';lkasja/dskjalkdj', '2014-11-28', 0, 0); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `komentar` +-- + +CREATE TABLE IF NOT EXISTS `komentar` ( + `cid` int(3) NOT NULL AUTO_INCREMENT, + `pid` int(3) NOT NULL, + `komentator` varchar(32) NOT NULL, + `komen` text NOT NULL, + `email` varchar(30) NOT NULL, + `commentdate` date NOT NULL, + PRIMARY KEY (`cid`), + KEY `fk.pid` (`pid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ; + +-- +-- Dumping data untuk tabel `komentar` +-- + +INSERT INTO `komentar` (`cid`, `pid`, `komentator`, `komen`, `email`, `commentdate`) VALUES +(3, 10, 'guest', 'nisa jelek', 'guest@guest.com', '2014-11-28'), +(10, 10, 'ucuplain', 'ucup ganteng loh', 'ucup@gmail.com', '2014-11-28'), +(11, 10, 'ucup-lain', 'ucup ganteng loh broo', 'ucup@gmail.com', '2014-11-28'), +(16, 10, 'lala', 'lilili', 'lali@lali.com', '2014-11-28'), +(17, 10, 'lala', 'lilili', 'lali@lali.com', '2014-11-28'), +(23, 10, 'lala', '', 'lala@lala.lala', '2014-11-28'), +(27, 10, 'guest', 'lalalalala', 'lala.asda', '2014-11-28'), +(28, 51, 'guest', 'llida.adasd', 'lala.aswd', '2014-11-28'), +(29, 10, 'bukan guest', 'harusnya saklah', 'bukan@guest.com', '2014-11-28'), +(30, 10, 'bukan guest', 'harusnya saklah', 'bukan@guest.com', '2014-11-28'), +(31, 10, 'guest syalala bum bunmb ubmbm', 'isinya panjang amat mas', 'panjang@email.com', '2014-11-29'), +(32, 10, 'guest syalala bum bunmb ubmbm', 'isinya panjang amat mas', 'panjang@email.com', '2014-11-29'), +(33, 10, 'guest syalala ', 'isinya panjang amat mas', 'panjang@email.com', '2014-11-29'), +(34, 10, 'guest syalala bum bumnmb', 'isinya panjang amat mas', 'panjang@email.com', '2014-11-29'), +(35, 10, 'guest syalala bum bumnmb', 'isinya panjang amat mas', 'panjang@email.com', '2014-11-29'); + +-- -------------------------------------------------------- + +-- +-- Struktur dari tabel `user` +-- + +CREATE TABLE IF NOT EXISTS `user` ( + `uid` int(3) NOT NULL AUTO_INCREMENT, + `fullname` varchar(32) NOT NULL, + `username` varchar(20) NOT NULL, + `password` varchar(30) NOT NULL, + `role` varchar(10) NOT NULL, + `email` varchar(50) NOT NULL, + PRIMARY KEY (`uid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; + +-- +-- Dumping data untuk tabel `user` +-- + +INSERT INTO `user` (`uid`, `fullname`, `username`, `password`, `role`, `email`) VALUES +(1, 'Yusuf Rahmatullah', 'ucup', 'ucup', 'owner', 'ucup@gmail.com'), +(2, 'Nisa Dian Rachmadi', 'nisa', 'nisa', 'editor', 'nisa@gmail.com'), +(3, 'Hayyu Luthfi Hanifah', 'hayyu', 'hayyu', 'admin', 'hayyu@gmail.com'), +(4, 'dummy man', 'dummyman', 'dummywoman', 'owner', 'dummyman@simpleblog.com'), +(5, 'semarak cinta ', 'semarakcinta', 'cinta', 'editor', 'semarak@cinta.com'); + +-- +-- Ketidakleluasaan untuk tabel pelimpahan (Dumped Tables) +-- + +-- +-- Ketidakleluasaan untuk tabel `blogpost` +-- +ALTER TABLE `blogpost` + ADD CONSTRAINT `fk.uid` FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON DELETE CASCADE ON UPDATE CASCADE; + +-- +-- Ketidakleluasaan untuk tabel `komentar` +-- +ALTER TABLE `komentar` + ADD CONSTRAINT `fk.pid` FOREIGN KEY (`pid`) REFERENCES `blogpost` (`pid`) 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/build.xml b/build.xml new file mode 100644 index 00000000..8fcc10c5 --- /dev/null +++ b/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project simpleblogII. + + + 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..bc17358c --- /dev/null +++ b/build/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/build/web/WEB-INF/classes/.netbeans_automatic_build b/build/web/WEB-INF/classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/.netbeans_update_resources b/build/web/WEB-INF/classes/.netbeans_update_resources new file mode 100644 index 00000000..e69de29b diff --git a/build/web/WEB-INF/classes/UserBeans/BlogPost.class b/build/web/WEB-INF/classes/UserBeans/BlogPost.class new file mode 100644 index 00000000..671a1c9e Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/BlogPost.class differ diff --git a/build/web/WEB-INF/classes/UserBeans/Komentar.class b/build/web/WEB-INF/classes/UserBeans/Komentar.class new file mode 100644 index 00000000..7b1deea3 Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/Komentar.class differ diff --git a/build/web/WEB-INF/classes/UserBeans/MainUserData.class b/build/web/WEB-INF/classes/UserBeans/MainUserData.class new file mode 100644 index 00000000..ceabc7db Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/MainUserData.class differ diff --git a/build/web/WEB-INF/classes/UserBeans/User.class b/build/web/WEB-INF/classes/UserBeans/User.class new file mode 100644 index 00000000..09ad24d7 Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/User.class differ diff --git a/build/web/WEB-INF/classes/UserBeans/UserData.class b/build/web/WEB-INF/classes/UserBeans/UserData.class new file mode 100644 index 00000000..19b8ea51 Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/UserData.class differ diff --git a/build/web/WEB-INF/classes/UserBeans/editPost.class b/build/web/WEB-INF/classes/UserBeans/editPost.class new file mode 100644 index 00000000..0feca8f4 Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/editPost.class differ diff --git a/build/web/WEB-INF/classes/UserBeans/userMgnt.class b/build/web/WEB-INF/classes/UserBeans/userMgnt.class new file mode 100644 index 00000000..86315c1b Binary files /dev/null and b/build/web/WEB-INF/classes/UserBeans/userMgnt.class 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..5bd273ea 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..1f904143 Binary files /dev/null and b/build/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar differ diff --git a/build/web/WEB-INF/sun-web.xml b/build/web/WEB-INF/sun-web.xml new file mode 100644 index 00000000..1ac7af40 --- /dev/null +++ b/build/web/WEB-INF/sun-web.xml @@ -0,0 +1,11 @@ + + + + + + + Keep a copy of the generated servlet class' java code. + + + + diff --git a/build/web/WEB-INF/web.xml b/build/web/WEB-INF/web.xml new file mode 100644 index 00000000..c5e7c738 --- /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/add_post.xhtml b/build/web/add_post.xhtml new file mode 100644 index 00000000..5d5a814e --- /dev/null +++ b/build/web/add_post.xhtml @@ -0,0 +1,131 @@ + + + + + + + New Post- Simple blog + + + + + +
+ + +
+ + +

-

+ +
+
+

Tambah Post

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

Apa itu Simple Blog?

-

-
-
- -
-
-
-

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

-

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

- -
- -

Komentar

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

    Jems

    -
    2 menit lalu
    -
    -

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

    -
  • - -
  • -
    -

    Kave

    -
    1 jam lalu
    -
    -

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

    -
  • -
-
-
- -
- - - -
- - - - - - - - \ No newline at end of file diff --git a/readme.md b/readme.md deleted file mode 100644 index 5e7e48f5..00000000 --- a/readme.md +++ /dev/null @@ -1,39 +0,0 @@ -# Simple Blog Java - -Tugas 2 IF3110. - -![Simple Blog](http://i655.photobucket.com/albums/uu275/sonnylazuardi/ss-5.jpg) - -## Deskripsi - -Gunakan template ini untuk membuat sebuah blog sederhana dengan menggunakan bahasa pemrograman PHP. - -## Spesifikasi - -Spesifikasi untuk Tugas II IF3110 dapat diakses pada pranala berikut: - -https://www.dropbox.com/sh/ig1hf108ad9fqxi/AAA2PMjPFICSFo3ypdrHl39La?dl=0 - -## Deliverable - -Tiap-tiap Kelompok Membuat Organizationnya masing-masing, dengan langkah: - -1. Klik tanda Tambah disamping username pada Github, Pilih Create New Organization - -2. Buat Organisasi dengan Nama : IF3110-II-Nomor_Kelompok . Nomor Kelompok dapat diakses [disini](https://docs.google.com/spreadsheets/d/1Y-FGJ_feIVYNRv-o0ycBXyfAiKMFXKA17cvw3Mhjd1A/edit?usp=sharing) - -3. Masukkan email address salah satu anggota untuk billing email ( bebas ). - -4. Undang anggota kelompok untuk menjadi anggota Organisasi. - -5. Lakukan Fork Repository ini ke Organisasi yang baru dibentuk - -6. Setelah selesai mengerjakan, lakukan Pull Request. - -## Lisensi - -© 2014 Asisten IF3110 - -Yogi | [Sonny](http://github.com/sonnylazuardi) | Fathan | Renusa | Kelvin | Yanuar - -Dosen: [Yudistira Dwi Wardhana](http://github.com/yudis) \ No newline at end of file diff --git a/simpleblog/build.xml b/simpleblog/build.xml new file mode 100644 index 00000000..0378698a --- /dev/null +++ b/simpleblog/build.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + Builds, tests, and runs the project simpleblog. + + + diff --git a/simpleblog/build/web/META-INF/MANIFEST.MF b/simpleblog/build/web/META-INF/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/simpleblog/build/web/META-INF/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/simpleblog/build/web/META-INF/context.xml b/simpleblog/build/web/META-INF/context.xml new file mode 100644 index 00000000..bc17358c --- /dev/null +++ b/simpleblog/build/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/simpleblog/build/web/WEB-INF/classes/.netbeans_automatic_build b/simpleblog/build/web/WEB-INF/classes/.netbeans_automatic_build new file mode 100644 index 00000000..e69de29b diff --git a/simpleblog/build/web/WEB-INF/classes/.netbeans_update_resources b/simpleblog/build/web/WEB-INF/classes/.netbeans_update_resources new file mode 100644 index 00000000..e69de29b diff --git a/simpleblog/build/web/WEB-INF/classes/assets/style.css b/simpleblog/build/web/WEB-INF/classes/assets/style.css new file mode 100644 index 00000000..df0c0041 --- /dev/null +++ b/simpleblog/build/web/WEB-INF/classes/assets/style.css @@ -0,0 +1,863 @@ +@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: url(assets/img/green-splash.png); +} + +/* 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: 0px; + font-weight: 500; + float:right; +} +#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: relative; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: left; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} \ No newline at end of file diff --git a/simpleblog/build/web/WEB-INF/classes/userMgnt.class b/simpleblog/build/web/WEB-INF/classes/userMgnt.class new file mode 100644 index 00000000..cce7ba1f Binary files /dev/null and b/simpleblog/build/web/WEB-INF/classes/userMgnt.class differ diff --git a/simpleblog/build/web/WEB-INF/lib/javax.faces.jar b/simpleblog/build/web/WEB-INF/lib/javax.faces.jar new file mode 100644 index 00000000..81df198a Binary files /dev/null and b/simpleblog/build/web/WEB-INF/lib/javax.faces.jar differ diff --git a/simpleblog/build/web/WEB-INF/sun-web.xml b/simpleblog/build/web/WEB-INF/sun-web.xml new file mode 100644 index 00000000..1ac7af40 --- /dev/null +++ b/simpleblog/build/web/WEB-INF/sun-web.xml @@ -0,0 +1,11 @@ + + + + + + + Keep a copy of the generated servlet class' java code. + + + + diff --git a/simpleblog/build/web/WEB-INF/web.xml b/simpleblog/build/web/WEB-INF/web.xml new file mode 100644 index 00000000..c5e7c738 --- /dev/null +++ b/simpleblog/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/simpleblog/build/web/add_post.xhtml b/simpleblog/build/web/add_post.xhtml new file mode 100644 index 00000000..134a2f94 --- /dev/null +++ b/simpleblog/build/web/add_post.xhtml @@ -0,0 +1,90 @@ + + + + + + New Post- Simple blog + + + + + +
+ + +
+ + +

-

+ +
+
+

Tambah Post

+ +
+ + + + + + + +

+ + + +
+
+
+
+ +
+ +
+ +
+ + + +
+ diff --git a/assets/css/screen.css b/simpleblog/build/web/assets/style.css similarity index 99% rename from assets/css/screen.css rename to simpleblog/build/web/assets/style.css index 1d8fdf3b..ba38c573 100644 --- a/assets/css/screen.css +++ b/simpleblog/build/web/assets/style.css @@ -122,7 +122,7 @@ a:hover { .wrapper { max-width: 1500px; margin: 0 auto; - background: #fff; + background: url(assets/img/green-splash.png); } /* Containers to keep content to a set width */ @@ -233,7 +233,7 @@ div.cover > img { } /* Contains the time, title and subtitle for an article */ .art-header-inner { - position: fixed; + position: relative; top: 300px; left: 50%; margin-left: -490px; diff --git a/simpleblog/build/web/gfv3ee6.dpf b/simpleblog/build/web/gfv3ee6.dpf new file mode 100644 index 00000000..e69de29b diff --git a/simpleblog/build/web/index.xhtml b/simpleblog/build/web/index.xhtml new file mode 100644 index 00000000..3999b5d5 --- /dev/null +++ b/simpleblog/build/web/index.xhtml @@ -0,0 +1,80 @@ + + + + + Home - Simple blog + + + + + +
+ + +
+
+ +
+
+ +
+ +
+ + + + +
+ + diff --git a/simpleblog/build/web/post.xhtml b/simpleblog/build/web/post.xhtml new file mode 100644 index 00000000..96966c6b --- /dev/null +++ b/simpleblog/build/web/post.xhtml @@ -0,0 +1,117 @@ + + + + + + Apa itu Simple blog? - Simple blog + + + + + +
+ + +
+ +
+
+ +

Apa itu Simple Blog?

+

+
+
+
+
+
+

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

+

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

+ +
+ +

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!

    +
  • +
+
+
+
+
+ +
+ + + +
+ diff --git a/simpleblog/nbproject/ant-deploy.xml b/simpleblog/nbproject/ant-deploy.xml new file mode 100644 index 00000000..2d5f8778 --- /dev/null +++ b/simpleblog/nbproject/ant-deploy.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/simpleblog/nbproject/build-impl.xml b/simpleblog/nbproject/build-impl.xml new file mode 100644 index 00000000..f03d7121 --- /dev/null +++ b/simpleblog/nbproject/build-impl.xml @@ -0,0 +1,1444 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set build.web.dir + Must set build.generated.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.war + + + + + + + + + +The Java EE server classpath is not correctly set up - server home directory is missing. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Dj2ee.server.home=<app_server_installation_directory> + + +The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}. +Either open the project in the IDE and assign the server or setup the server classpath manually. +For example like this: + ant -Duser.properties.file=<path_to_property_file> (where you put the property "j2ee.platform.classpath" in a .properties file) +or ant -Dj2ee.platform.classpath=<server_classpath> (where no properties file is used) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The libs.CopyLibs.classpath property is not set up. +This property must point to +org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part +of NetBeans IDE installation and is usually located at +<netbeans_installation>/java<version>/ant/extra folder. +Either open the project in the IDE and make sure CopyLibs library +exists or setup the property manually. For example like this: + ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + Must select a file in the IDE or set jsp.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable. + + + Launching ${browse.url} + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/simpleblog/nbproject/genfiles.properties b/simpleblog/nbproject/genfiles.properties new file mode 100644 index 00000000..8126881b --- /dev/null +++ b/simpleblog/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=637b9997 +build.xml.script.CRC32=90a126cc +build.xml.stylesheet.CRC32=651128d4@1.68.1.1 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=637b9997 +nbproject/build-impl.xml.script.CRC32=52e9dad0 +nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1 diff --git a/simpleblog/nbproject/private/private.properties b/simpleblog/nbproject/private/private.properties new file mode 100644 index 00000000..2ce0f592 --- /dev/null +++ b/simpleblog/nbproject/private/private.properties @@ -0,0 +1,10 @@ +deploy.ant.properties.file=C:\\Users\\user\\AppData\\Roaming\\NetBeans\\8.0.1\\config\\GlassFishEE6\\Properties\\gfv32001291291.properties +j2ee.platform.is.jsr109=true +j2ee.server.domain=C:/Program Files (x86)/glassfish-4.0/glassfish/domains/domain1 +j2ee.server.home=C:/Program Files (x86)/glassfish-4.0/glassfish +j2ee.server.instance=[C:\\Program Files (x86)\\glassfish-4.0\\glassfish;C:\\Program Files (x86)\\glassfish-4.0\\glassfish\\domains\\domain1]deployer:gfv3ee6:localhost:4848 +j2ee.server.middleware=C:/Program Files (x86)/glassfish-4.0 +javac.debug=true +javadoc.preview=true +selected.browser=default +user.properties.file=C:\\Users\\user\\AppData\\Roaming\\NetBeans\\8.0.1\\build.properties diff --git a/simpleblog/nbproject/private/private.xml b/simpleblog/nbproject/private/private.xml new file mode 100644 index 00000000..9efed6ee --- /dev/null +++ b/simpleblog/nbproject/private/private.xml @@ -0,0 +1,10 @@ + + + + + + file:/D:/SEMESTER%205/Web%20Based%20Development/tugas%20besar%202/simpleblog/src/java/userMgnt.java + file:/D:/SEMESTER%205/Web%20Based%20Development/tugas%20besar%202/simpleblog/web/index.xhtml + + + diff --git a/simpleblog/nbproject/project.properties b/simpleblog/nbproject/project.properties new file mode 100644 index 00000000..0d836fcd --- /dev/null +++ b/simpleblog/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=Facelets +build.classes.dir=${build.web.dir}/WEB-INF/classes +build.classes.excludes=**/*.java,**/*.form +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +build.web.dir=${build.dir}/web +build.web.excludes=${build.classes.excludes} +client.urlPart= +compile.jsps=false +conf.dir=${source.root}/conf +debug.classpath=${build.classes.dir}:${javac.classpath} +debug.test.classpath=\ + ${run.test.classpath} +display.browser=true +# Files to be excluded from distribution war +dist.archive.excludes= +dist.dir=dist +dist.ear.war=${dist.dir}/${war.ear.name} +dist.javadoc.dir=${dist.dir}/javadoc +dist.war=${dist.dir}/${war.name} +endorsed.classpath=\ + ${libs.javaee-endorsed-api-6.0.classpath} +excludes= +includes=** +j2ee.compile.on.save=true +j2ee.copy.static.files.on.save=true +j2ee.deploy.on.save=true +j2ee.platform=1.7-web +j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar +j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar +j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar +j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar +j2ee.platform.wsit.classpath= +j2ee.server.type=gfv3ee6 +jar.compress=false +javac.classpath=\ + ${libs.jsf20.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.debug=true +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.preview=true +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +lib.dir=${web.docbase.dir}/WEB-INF/lib +persistence.xml.dir=${conf.dir} +platform.active=default_platform +resource.dir=setup +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +# Space-separated list of JVM arguments used when running a class with a main method or a unit test +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value): +runmain.jvmargs= +source.encoding=UTF-8 +source.root=src +src.dir=${source.root}/java +test.src.dir=test +war.content.additional= +war.ear.name=${war.name} +war.name=simpleblog.war +web.docbase.dir=web +webinf.dir=web/WEB-INF diff --git a/simpleblog/nbproject/project.xml b/simpleblog/nbproject/project.xml new file mode 100644 index 00000000..024cbacb --- /dev/null +++ b/simpleblog/nbproject/project.xml @@ -0,0 +1,23 @@ + + + org.netbeans.modules.web.project + + + simpleblog + 1.6.5 + + + ${libs.jsf20.classpath} + WEB-INF/lib + + + + + + + + + + + + diff --git a/simpleblog/src/conf/MANIFEST.MF b/simpleblog/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/simpleblog/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/simpleblog/src/java/assets/style.css b/simpleblog/src/java/assets/style.css new file mode 100644 index 00000000..df0c0041 --- /dev/null +++ b/simpleblog/src/java/assets/style.css @@ -0,0 +1,863 @@ +@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: url(assets/img/green-splash.png); +} + +/* 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: 0px; + font-weight: 500; + float:right; +} +#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: relative; + top: 300px; + left: 50%; + margin-left: -490px; +} +.art-time, +.art-title, +.art-subtitle { + text-align: center; + text-transform: uppercase; +} +.art-time { + font-size: 14px; + line-height: 1.8; + letter-spacing: 4px; +} +.art-title { + font-size: 100px; + line-height: .9; + letter-spacing: -2px; + width: 100%; +} +.art-subtitle { + margin-top: 4px; + font-size: 14px; + line-height: 1.3; + letter-spacing: 4px; +} + +/* If small header, make few adjustments */ +.small .art-title { + font-size: 70px; + line-height: 65px; +} +.small.art-header-inner { + top: 320px; +} + +/* Body */ +.art-body { + position: relative; + width: 100%; + background: #fff; + z-index: 100; + -webkit-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + -moz-box-shadow: 0 -3px 3px rgba(0,0,0,.2); + box-shadow: 0 -3px 3px rgba(0,0,0,.2); +} +.art-body-inner { + font-family: Georgia,Cambria,"Times New Roman",Times,serif; + max-width: 640px; + padding: 80px 0 50px; + letter-spacing: 0.01rem; + font-weight: 400; + font-style: normal; + font-size: 21px; + line-height: 1.5; +} +.art-body-inner a:hover { + border-bottom: 1px solid #F40034; + padding-bottom:2px; +} +.art-body-inner ul, +.art-body-inner ol { /* For lists in the article body */ + margin-bottom: 26px; +} +.art-body-inner ul li { + list-style: disc; +} + +.art-body-inner mark { + background-color: #fdffb6; + padding: 2px; + -webkit-box-shadow: #fdffb6 0 0 5px; + -moz-box-shadow: #fdffb6 0 0 5px; + box-shadow: #fdffb6 0 0 5px; +} + +.art-body-inner blockquote { + font-size: 16px; + background: #f9f9f9; + border-left: 10px solid #ccc; + margin: 1.5em 10px; + padding: 0.5em 10px; + quotes: "\201C""\201D""\2018""\2019"; +} + +.art-body-inner blockquote p:first-child:before { + color: #ccc; + content: "“"; + font-size: 4em; + line-height: 0.1em; + margin-right: 0.25em; + vertical-align: -0.4em; +} + +.art-body-inner blockquote p { + margin-bottom: 1.5em; +} + +.art-body-inner blockquote p:last-child { + margin-bottom: 0; +} + + +.dropcap { /* First character on articles */ + float: left; + margin: 47px 10px 20px 0; + font-size: 100px; + line-height: 0; +} +.art-subhead { /* Subheads are used to break up sections of an article */ + margin: 60px 0 15px; + font-size: 20px; + line-height: 28px; + letter-spacing: 3px; +} +.callout { /* Callouts are like large pullquotes */ + font-weight: bold; +} +.art-body-inner img { + max-width: 100%; + max-height: 600px; + margin-bottom: 26px; +} +.art-body-inner img.center { + display: block; + margin-left: auto; + margin-right: auto; +} +.art-body-inner .art-reference { + font-size: 80%; + color: #999; + margin-top: 50px; +} + +/* For simple, white background posts */ +.simple .art-body { + background: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + box-shadow: none; +} + + +/* List of Articles +================================================== */ +.art-list { + padding: 120px 0 0; +} +.art-list-body { + position: relative; + overflow: hidden; +} +.art-list-item { + padding: 40px 0; + list-style: none; + overflow: hidden; + border-bottom: 1px solid #ccc; +} +.art-list-item:last-child { + border-bottom: none; +} +.art-list-title { + font-size: 26px; + line-height: 26px; + font-weight: 700; +} +.art-list-item-title-and-time { + float: left; + width: 30%; + margin-bottom: 10px; +} +.art-list-time { + font-size: 12px; + line-height: 20px; + letter-spacing: 2px; + text-transform: uppercase; + color: #999; +} +.art-list-title a { + color: #000; +} +.art-list-title a:hover { + color: #F40034; +} +.art-list-item p { + width: 65%; + float: left; + margin-left: 5%; + margin-bottom: 0; + font-size: 16px; + line-height: 24px; +} + + +/* Footer +================================================== */ +.footer { + padding: 30px 0 40px; + overflow: hidden; + border-top: 1px solid #ccc; +} +.footer, +.footer a { + font-family: "proxima-nova", "helvetica neue", "helvetica", sans-serif; + font-size: 13px; + text-transform: uppercase; + color: #777; +} +.footer a:hover { + color: #000; +} +.back-to-top, +.footer-nav, +.offsite-links { + width: 45%; + float: left; +} +.psi { + width:10%; + float:left; + text-align: center; +} +.footer-nav { + text-align: center; +} +.offsite-links { + text-align: right; +} +.footer .twitter-link:hover { + color: #0084B4; +} +.footer .instagram-link:hover { + color: #3F729B; +} +.footer .github-link:hover { + color: #c5376d; +} +.footer .caffein8-link:hover{ + color: black; +} +.footer .rss-link:hover { + color: #e85d24; +} +/* Remove prev & next links on loop */ +.art-list + .footer .footer-nav, +.abt + .footer .footer-nav { + text-indent: -9999px; + text-align: left; +} + + +/* White Reverse Theme +================================================== */ +/* Nav */ +.nav.white { + border-bottom-color: #fff; + border-bottom-color: rgba(255,255,255,.3); +} +.nav.white li a, +.nav.white li, +.nav.white #logo h1 { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} +.nav.white #logo h1 { + background-position: top center; +} + +nav.pagination{ + text-align: right; + padding-bottom: 25px; +} +/* Art header */ +.art-header.white { + background-color: #111; +} +.art-header.white .art-time, +.art-header.white .art-title, +.art-header.white .art-subtitle { + color: #fff; + text-shadow: 0 0 8px rgba(0,0,0,.5); +} + + +/* About page +================================================== */ +.abt { + padding: 200px 0 100px; + list-style: none; +} +.abt .abt-header { + font-size: 140px; + line-height: 1; + text-transform: none; +} +.abt .abt-subheader { + font-size: 24px; + font-style: italic; + text-transform: none; + color: #777; +} +.abt-body { + -moz-column-count: 2; + -moz-column-gap: 20px; + -webkit-column-count: 2; + -webkit-column-gap: 20px; + margin-bottom: 28px; +} +.abt-signoff { + line-height: 1.3; + font-style: italic; + color: #777; +} + +/* 404 page +================================================== */ +.fourohfour { + padding: 240px 0 100px; + text-align: center; +} + +/* Code +================================================== */ + +code, tt { +background: #ededee; +color: #3C4043; +font-size: 90%; +padding: 1px 3px; +} + +pre { + width: 92%; + overflow: auto; + margin: 2rem 0; + padding: 1rem 0.8rem 1rem 1.2rem; + color: #3f3b36; + border: 1px solid #ccc; + border-left: 1rem solid #ccc; + font: lighter 1.2rem/2rem monospace; + background: url(/assets/img/pre.png) repeat 0 -0.9rem; + background-size: 1px 4rem; +} + +pre code, tt { +font-size: inherit; +white-space: -moz-pre-wrap; +white-space: pre-wrap; +background: transparent; +border: none; +padding: 0; +} + + +.gist { + font-size: 14px; +} + + +/* Responsive +================================================== */ +@media only screen and (max-width: 1080px) { + /* Set all of the 980 containers to flexible width */ + .nav, + .art-body-inner, + .art-header-inner, + .footer, + .art-list, + .abt, + .fourohfour { + width: 90%; + } + .nav, + .art-header-inner { + margin-left: -45%; + } +} + +@media only screen and (max-width: 1024px) { + /* Everything becomes scrolling and non-fading */ + .nav, + .nav.fixed { + position: relative; + opacity: 1 !important; /* Important to override JS values */ + display: inline-block; + } + .art-header-inner { + position: relative; + top: 0 !important; /* Important to override JS values */ + margin-top: 240px !important; /* Important to override JS values */ + opacity: 1 !important; /* Important to override JS values */ + } + /* Articles no longer have fixed heights */ + .art-header { + height: auto; + padding-bottom: 100px; + background-size: cover !important; + background-attachment: scroll; + } + /* Remove bottom space out if articles doesn't have a background */ + .simple .art-header { + padding-bottom: 0; + } + .art-list { + padding-top: 0; + } + .abt { + padding: 40px 0; + } + .fourohfour { + padding: 80px 0 60px; + } +} + +@media only screen and (max-width: 780px) { + .art-body-inner ul, + .art-body-inner ol { + margin-left: 20px; + } + .art-title { + letter-spacing: 0; + } + .art-subtitle, + .art-time { + font-size: 12px; + } + .nav { + padding-top: 25px; + height: 55px; + } + .art-list-item-title-and-time, + .art-list-item p { + float: none; + width: auto; + margin-left: 0; + } + .abt-body { + -moz-column-count: 1; + -webkit-column-count: 1; + } +} + +@media only screen and (max-width: 500px) { + .nav-primary li { + margin-left: 10px; + } + .nav #logo h1 { + font-size: 16px; + letter-spacing: -1px; + } + .nav li a { + font-size: 12px; + } + .art-header { + padding-bottom: 50px; + } + .art-header-inner { + margin-top: 190px !important; + } + .art-body-inner { + padding-top: 30px; + } + body { + font-size: 15px; + line-height: 24px; + } + p { + margin-bottom: 24px; + } + .footer { + padding: 10px 0 20px; + } + .back-to-top, + .footer-nav { + width: 50%; + } + .back-to-top { + text-align: left; + } + .footer-nav { + text-align: right; + } + .offsite-links { + float: left; + width: 100%; + text-align: left; + } + .offsite-links a { + font-size: 12px; + } + .art-list + .footer .footer-nav { + display: none; + } + .abt .abt-header { + font-size: 80px; + } + .abt .abt-subheader { + font-size: 18px; + } +} + + +/* Misc +================================================== */ +::selection { + background: #000; + color: #fff; +} +::-moz-selection { + background: #000; + color: #fff; +} +img.left { + float: left; + margin-right: 20px; +} +img.right { + float: right; + margin-left: 20px; +} +/* Clearfixing pile */ +.nav:before, +.art-body-inner:before, +.footer:before, +.art-list:before { + content:""; + display:table; +} +.nav:after, +.art-body-inner:after, +.footer:after, +.art-list:after { + clear:both; +} +.nav, +.art-body-inner, +.footer, +.art-list { + zoom:1; /* For IE 6/7 (trigger hasLayout) */ +} + + +@-webkit-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} +@-moz-keyframes le-fade { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } +} + +.art-header-inner { + -webkit-animation: le-fade .5s 0 1 ease-out; + -moz-animation: le-fade .5s 0 1 ease-out; +} + +.art-list, +.nav, +.abt, +.art-body { + -webkit-animation: le-fade .5s 0s 1 ease-out; + -moz-animation: le-fade .5s 0s 1 ease-out; +} + +hr.featured-article { + padding: 0; + border: none; + border-top: medium double #bbb; + color: #bbb; + text-align: center; +} +hr.featured-article:after { + content: "✭ Featured Article ✭"; + display: inline-block; + position: relative; + top: -0.8em; + font-size: 1.2em; + padding: 0 0.6em; + background: white; +} + +/* FORM */ + +#contact-area { + width: 600px; + margin-top: 25px; +} + +#contact-area input, #contact-area textarea { + padding: 5px; + width: 471px; + font-family: Helvetica, sans-serif; + margin: 0px 0px 10px 0px; + border: 2px solid #ccc; +} + +#contact-area textarea { + height: 90px; +} + +#contact-area textarea:focus, #contact-area input:focus { + border: 2px solid #900; +} + +#contact-area input.submit-button { + width: 100px; + +} + +label { + float: left; + text-align: right; + margin-right: 15px; + width: 100px; + padding-top: 5px; +} \ No newline at end of file diff --git a/simpleblog/src/java/userMgnt.java b/simpleblog/src/java/userMgnt.java new file mode 100644 index 00000000..ec77092d --- /dev/null +++ b/simpleblog/src/java/userMgnt.java @@ -0,0 +1,138 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +import javax.faces.bean.ManagedBean; +import javax.faces.bean.RequestScoped; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.faces.view.facelets.FaceletContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.PageContext; + +/** + * + * @author user + */ +@ManagedBean(name = "User",eager = true) +@SessionScoped +public class userMgnt{ + + /** + * Creates a new instance of userMgnt + */ + private String NameUser; + private String Username; + private String Password; + private String Messege; + private String Role; + private String Email; + private Cookie cookie; + //nanti ditambah-tambah informasi user yang mau ditampilin + public userMgnt() { + NameUser="guest"; + Username="guest"; + Password="pass"; + Messege="tidak ada"; + Role="geust"; + Email="geust@simple-blog.com"; + cookie= new Cookie("Username",null); + cookie.setMaxAge(120); + } + public void login(){ + String user="nisa"; + String pass="nisadian"; + if(user.equals(Username)){ + if(pass.equals(Password)){ + NameUser="Nisa"; + Role="Admin";//dari data base + Email="nisa@simple-blog.com";//data base + cookie.setValue(Username); + FacesContext facesContex = FacesContext.getCurrentInstance(); + HttpServletResponse response = (HttpServletResponse) facesContex.getExternalContext().getResponse(); + response.addCookie(cookie); + } + else{ + Messege="Password salah"; + } + } + else{ + Messege="Username not found"; + } + } + public void Logout(){ + reset(); + Messege="tidak ada"; + cookie.setValue(null); + cookie.setMaxAge(0); + FacesContext facesContex = FacesContext.getCurrentInstance(); + HttpServletResponse response = (HttpServletResponse) facesContex.getExternalContext().getResponse(); + response.addCookie(cookie); + } + public void reset(){ + NameUser="guest"; + Username="guest"; + Password="pass"; + } + + //validator + public boolean isLogin(){ + return cookie.getValue()!=null; + } + public boolean activeMessege(){ + return !Messege.equals("tidak ada") && !isLogin(); + } + //getter + public String getName(){ + return NameUser; + } + public String getUsername(){ + return Username; + } + public String getPassword(){ + return Password; + } + public String getMessege(){ + return Messege; + } + public String getRole(){ + return Role; + } + public String getEmail(){ + return Email; + } + //setter + public void setName(String S){ + NameUser=S; + } + public void setUsername(String S){ + Username=S; + } + public void setPassword(String S){ + Password=S; + } + public void setMessege(String S){ + Messege=S; + } + public Cookie getCookie() { + FacesContext facesContext = FacesContext.getCurrentInstance(); + + HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); + Cookie cook = null; + + Cookie[] userCookies = request.getCookies(); + if (userCookies != null && userCookies.length > 0 ) { + for (int i = 0; i < userCookies.length; i++) { + if (userCookies[i].getName().equals("Username")) { + cook = userCookies[i]; + return cook; + } + } + } + return null; + } +} + \ No newline at end of file diff --git a/simpleblog/web/META-INF/context.xml b/simpleblog/web/META-INF/context.xml new file mode 100644 index 00000000..bc17358c --- /dev/null +++ b/simpleblog/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/simpleblog/web/WEB-INF/web.xml b/simpleblog/web/WEB-INF/web.xml new file mode 100644 index 00000000..c5e7c738 --- /dev/null +++ b/simpleblog/web/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/simpleblog/web/add_post.xhtml b/simpleblog/web/add_post.xhtml new file mode 100644 index 00000000..134a2f94 --- /dev/null +++ b/simpleblog/web/add_post.xhtml @@ -0,0 +1,90 @@ + + + + + + New Post- Simple blog + + + + + +
+ + +
+ + +

-

+ +
+
+

Tambah Post

+ +
+ + + + + + + +

+ + + +
+
+
+
+ +
+ +
+ +
+ + + +
+ diff --git a/simpleblog/web/index.xhtml b/simpleblog/web/index.xhtml new file mode 100644 index 00000000..3999b5d5 --- /dev/null +++ b/simpleblog/web/index.xhtml @@ -0,0 +1,80 @@ + + + + + Home - Simple blog + + + + + +
+ + +
+
+ +
+
+ +
+ +
+ + + + +
+ + diff --git a/simpleblog/web/post.xhtml b/simpleblog/web/post.xhtml new file mode 100644 index 00000000..96966c6b --- /dev/null +++ b/simpleblog/web/post.xhtml @@ -0,0 +1,117 @@ + + + + + + Apa itu Simple blog? - Simple blog + + + + + +
+ + +
+ +
+
+ +

Apa itu Simple Blog?

+

+
+
+
+
+
+

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

+

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

+ +
+ +

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!

    +
  • +
+
+
+
+
+ +
+ + + +
+ diff --git a/src/conf/MANIFEST.MF b/src/conf/MANIFEST.MF new file mode 100644 index 00000000..59499bce --- /dev/null +++ b/src/conf/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 + diff --git a/src/java/UserBeans/BlogPost.java b/src/java/UserBeans/BlogPost.java new file mode 100644 index 00000000..94feec21 --- /dev/null +++ b/src/java/UserBeans/BlogPost.java @@ -0,0 +1,144 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package UserBeans; + +import java.util.Date; + + +/** + * + * @author Yusuf + */ +public class BlogPost { + + private int pid; + private int uid; + private String username; + private String posttitle; + private String postcontent; + private String postdate; + private boolean ispublished; + private boolean isdeleted; + + public BlogPost() { + pid = 0; + uid = 0; + posttitle = ""; + postcontent = ""; + username = ""; + ispublished = false; + isdeleted = false; + Date date = new Date(); + postdate = String.valueOf(date.getMonth()+1)+"/"+String.valueOf(date.getDate())+"/"+String.valueOf(date.getYear()+1900); + } + + public void reset(){ + pid = 0; + uid = 0; + posttitle = ""; + postcontent = ""; + username = ""; + ispublished = false; + isdeleted = false; + Date date = new Date(); + postdate = String.valueOf(date.getMonth()+1)+"/"+String.valueOf(date.getDate())+"/"+String.valueOf(date.getYear()+1900); + } + + public int getPid() { + return pid; + } + + public int getUid() { + return uid; + } + + public String getUsername() { + return username; + } + + public String getPosttitle() { + return posttitle; + } + + public String getPostcontent() { + return postcontent; + } + + public String getPostContentWithLimit(int limit) { + String content = postcontent; + if (content.length() > limit) { + content = postcontent.substring(0, limit); + } + return content; + } + + public String getPostdate() { + return postdate; + } + + public boolean getPublished() { + return ispublished; + } + + public boolean getDeleted() { + return isdeleted; + } + + public int publishedToInt(){ + int ret = 0; + if(ispublished) + ret = 1; + return ret; + } + + public int deletedToInt(){ + int ret = 0; + if(isdeleted) + ret = 1; + return ret; + } + + public void setPid(int Pid) { + pid = Pid; + } + + public void setUid(int userID) { + uid = userID; + } + + public void setUsername(String username) { + this.username = username; + } + + public void setPosttitle(String PostTitle) { + posttitle = PostTitle; + } + + public void setPostcontent(String PostContent) { + postcontent = PostContent; + } + + /** + * + * @param PostDate date format : mm/dd/yyyy + */ + public void setPostdate(String PostDate) { + postdate = PostDate; + } + + + public void setPublished(boolean Published) { + ispublished = Published; + } + + + + public void setDeleted(boolean Deleted) { + isdeleted = Deleted; + } + + +} diff --git a/src/java/UserBeans/Komentar.java b/src/java/UserBeans/Komentar.java new file mode 100644 index 00000000..5440c360 --- /dev/null +++ b/src/java/UserBeans/Komentar.java @@ -0,0 +1,80 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package UserBeans; + +import java.sql.Date; + +/** + * + * @author Yusuf + */ +public class Komentar { + + private int cid; + private int pid; + private String komentator; + private String komen; + private String email; + private String commentDate; + + public Komentar() { + cid=0; + pid=0; + komentator="guest"; + komen=""; + email=""; + java.util.Date date = new java.util.Date(); + commentDate = String.valueOf(date.getYear()+1900)+"-"+String.valueOf(date.getMonth()+1)+"-"+String.valueOf(date.getDate()); + } + + public int getCid() { + return cid; + } + + public void setCid(int commentID) { + cid = commentID; + } + + public int getPid() { + return pid; + } + + public void setPid(int postID) { + pid = postID; + } + + public String getKomentator() { + return komentator; + } + + public void setKomentator(String komentator) { + this.komentator = komentator; + } + + public String getKomen() { + return komen; + } + + public void setKomen(String Komen) { + komen = Komen; + } + + public String getEmail() { + return email; + } + + public void setEmail(String Email) { + email = Email; + } + + public String getCommentDate() { + return commentDate; + } + + public void setCommentDate(String CommentDate) { + commentDate = CommentDate; + } +} diff --git a/src/java/UserBeans/MainUserData.java b/src/java/UserBeans/MainUserData.java new file mode 100644 index 00000000..bc0a00d3 --- /dev/null +++ b/src/java/UserBeans/MainUserData.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package UserBeans; + + +import java.util.ArrayList; + +/** + * + * @author Yusuf + */ +public class MainUserData { + public static void main(String[] args){ + /* + UserData ud = new UserData(); + User user = ud.getUser("ucup"); + System.out.println("nama : "+user.getFullname()); + System.out.println("user : "+user.getUsername()); + System.out.println("password : "+user.getPassword()); + */ + + /* + userMgnt um = new userMgnt(); + BlogPost post = new BlogPost(); + post.setPostcontent("lalala2"); + post.setPosttitle("dadada2"); + post.setPostdate("12/01/2014"); + post.setUid(2); + um.setPost(post); + um.submitPost(); + */ + + userMgnt um = new userMgnt(); + um.publishPost(9); + } +} diff --git a/src/java/UserBeans/User.java b/src/java/UserBeans/User.java new file mode 100644 index 00000000..cae5046f --- /dev/null +++ b/src/java/UserBeans/User.java @@ -0,0 +1,77 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package UserBeans; + +/** + * + * @author Yusuf + */ +public class User { + + private int uid; + private String fullname; + private String username; + private String password; + private String role; + private String email; + + public User() { + uid = 0; + username = "guest"; + password = "pass"; + role = "guest"; + email = ""; + fullname = "guest"; + } + + public int getUid() { + return uid; + } + + public String getUsername() { + return username; + } + + public String getPassword() { + return password; + } + + public String getRole() { + return role; + } + + public String getEmail() { + return email; + } + + public String getFullname(){ + return fullname; + } + + public void setFullname(String fullName){ + this.fullname = fullName; + } + + public void setUid(int uid) { + this.uid = uid; + } + + public void setUsername(String username) { + this.username = username; + } + + public void setPassword(String password) { + this.password = password; + } + + public void setRole(String role) { + this.role = role; + } + + public void setEmail(String email){ + this.email = email; + } +} diff --git a/src/java/UserBeans/UserData.java b/src/java/UserBeans/UserData.java new file mode 100644 index 00000000..b3143d1b --- /dev/null +++ b/src/java/UserBeans/UserData.java @@ -0,0 +1,447 @@ +/*;; + + + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package UserBeans; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.Statement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Yusuf + */ +public class UserData { + + public UserData(){ + } + + public User getUser(int uid) { + User user = null; + Connection con = getConnection(); + String sql = "SELECT * FROM user WHERE uid=" + uid; + try { + Statement pst = con.createStatement(); + ResultSet rs = pst.executeQuery(sql); + con.close(); + user = new User(); + while (rs.next()) { + user.setUid(rs.getInt("uid")); + user.setFullname(rs.getString("fullname")); + user.setUsername(rs.getString("username")); + user.setPassword(rs.getString("password")); + user.setRole(rs.getString("role")); + user.setEmail(rs.getString("email")); + } + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return user; + } + + public User getUser(String username) { + User user = null; + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT * FROM user WHERE username='" + username + "'"; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + user = new User(); + while (rs.next()) { + user.setUid(rs.getInt("uid")); + user.setFullname(rs.getString("fullname")); + user.setUsername(rs.getString("username")); + user.setPassword(rs.getString("password")); + user.setRole(rs.getString("role")); + user.setEmail(rs.getString("email")); + } + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return user; + } + + public ArrayList getListUser(){ + ArrayList records = new ArrayList(); + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT * FROM user"; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + while (rs.next()) { + User user = new User(); + user.setEmail(rs.getString("email")); + user.setFullname(rs.getString("fullname")); + user.setPassword(rs.getString("password")); + user.setRole(rs.getString("role")); + user.setUid(rs.getInt("uid")); + user.setUsername(rs.getString("username")); + records.add(user); + } + con.close(); + } catch (SQLException ex) { + String exex = ex.getMessage(); + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return records; + } + + public void writeKomentar(Komentar komentar) { + ResultSet rs = null; + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "INSERT INTO `blogjava`.`komentar` (`cid`, `pid`, `komentator`, `komen`, `email`, `commentdate`) VALUES (NULL, " + "'" + komentar.getPid() + + "', '" + komentar.getKomentator() + "', '" + + komentar.getKomen() + "', '" + + komentar.getEmail() + "', '" + + komentar.getCommentDate() + "')"; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + String exex = ex.getMessage(); + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void writeKomentar(int Pid, String komentator, + String komen, String email, Date commentDate) { + ResultSet rs = null; + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "INSERT INTO komentar VALUES (NULL, " + "'" + Pid + + "', '" + komentator + "', '" + + komen + "', '" + + email + "', '" + + commentDate + "')"; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + String exe = ex.getMessage(); + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public Komentar getKomentar(int cid) { + Komentar komentar = null; + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT * FROM komentar WHERE cid=" + cid; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + con.close(); + + komentar = new Komentar(); + while (rs.next()) { + komentar.setCid(rs.getInt("cid")); + komentar.setPid(rs.getInt("pid")); + komentar.setKomentator(rs.getString("komentator")); + komentar.setKomen(rs.getString("komen")); + komentar.setEmail(rs.getString("email")); + komentar.setCommentDate(rs.getString("commentdate")); + } + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return komentar; + } + + public ArrayList getListKomentar(int pid) { + ArrayList records = new ArrayList(); + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT * FROM komentar WHERE pid=" + pid+" ORDER BY cid ASC"; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + while (rs.next()) { + Komentar komentar = new Komentar(); + komentar.setCid(rs.getInt("cid")); + komentar.setPid(rs.getInt("pid")); + komentar.setKomentator(rs.getString("komentator")); + komentar.setKomen(rs.getString("komen")); + komentar.setEmail(rs.getString("email")); + komentar.setCommentDate(rs.getString("commentdate")); + records.add(komentar); + } + con.close(); + } catch (SQLException ex) { + String exex = ex.getMessage(); + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return records; + } + + public void writeBlogPost(BlogPost blogPost) { + + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "INSERT INTO blogpost VALUES (NULL, '"+ blogPost.getUid() + + "', '" + blogPost.getPosttitle() + + "', '" + blogPost.getPostcontent() + "', '" + + blogPost.getPostdate() + "', '" + + blogPost.publishedToInt() + "', '" + + blogPost.deletedToInt() + "')"; + + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public BlogPost getBlogPost(int pid) { + BlogPost blogPost = null; + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + //String sql = "select * from blogpost where pid=1"; + String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND blogpost.pid=" + pid; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + blogPost = new BlogPost(); + rs.first(); + blogPost.setUsername(rs.getString("fullname")); + blogPost.setPid(rs.getInt("pid")); + blogPost.setUid(rs.getInt("uid")); + blogPost.setPosttitle(rs.getString("posttitle")); + blogPost.setPostcontent(rs.getString("postcontent")); + blogPost.setPostdate(rs.getString("postdate")); + blogPost.setPublished(rs.getBoolean("published")); + blogPost.setDeleted(rs.getBoolean("deleted")); + con.close(); + } catch (SQLException ex) { + String logg = ex.getMessage(); + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return blogPost; + } + + public ArrayList getAllBlogPost() { + ArrayList records = new ArrayList(); + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND published=1 ORDER BY blogpost.postdate DESC"; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + while (rs.next()) { + BlogPost blogPost = new BlogPost(); + blogPost.setPid(rs.getInt("pid")); + blogPost.setUid(rs.getInt("uid")); + blogPost.setUsername(rs.getString("fullname")); + blogPost.setPosttitle(rs.getString("posttitle")); + blogPost.setPostcontent(rs.getString("postcontent")); + blogPost.setPostdate(rs.getDate("postdate").toString()); + blogPost.setPublished(rs.getBoolean("published")); + blogPost.setDeleted(rs.getBoolean("deleted")); + records.add(blogPost); + } + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return records; + } + + public ArrayList getAllUnpublishedBlogPost(){ + ArrayList records = new ArrayList(); + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND published=0 ORDER BY blogpost.postdate DESC"; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + while (rs.next()) { + BlogPost blogPost = new BlogPost(); + blogPost.setPid(rs.getInt("pid")); + blogPost.setUid(rs.getInt("uid")); + blogPost.setUsername(rs.getString("fullname")); + blogPost.setPosttitle(rs.getString("posttitle")); + blogPost.setPostcontent(rs.getString("postcontent")); + blogPost.setPostdate(rs.getDate("postdate").toString()); + blogPost.setPublished(rs.getBoolean("published")); + blogPost.setDeleted(rs.getBoolean("deleted")); + records.add(blogPost); + } + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return records; + } + + public ArrayList getDeletedPosts(){ + ArrayList records = new ArrayList(); + ResultSet rs = null; + Statement pst = null; + Connection con = getConnection(); + String sql = "SELECT blogpost.*, user.fullname FROM blogpost NATURAL JOIN user WHERE blogpost.uid = user.uid AND deleted=1 ORDER BY blogpost.postdate DESC"; + try { + pst = con.createStatement(); + rs = pst.executeQuery(sql); + + while (rs.next()) { + BlogPost blogPost = new BlogPost(); + blogPost.setPid(rs.getInt("pid")); + blogPost.setUid(rs.getInt("uid")); + blogPost.setUsername(rs.getString("fullname")); + blogPost.setPosttitle(rs.getString("posttitle")); + blogPost.setPostcontent(rs.getString("postcontent")); + blogPost.setPostdate(rs.getDate("postdate").toString()); + blogPost.setPublished(rs.getBoolean("published")); + blogPost.setDeleted(rs.getBoolean("deleted")); + records.add(blogPost); + } + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + return records; + } + + public Connection getConnection() { + Connection con = null; + String url = "jdbc:mysql://localhost:3306/blogjava"; + String user = "root"; + String password = ""; + + try { + Class.forName("com.mysql.jdbc.Driver"); + } catch (ClassNotFoundException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + + + try { + con = DriverManager.getConnection(url, user, password); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } finally { + } + + return con; + } + + public void publishPost(int pid){ + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "UPDATE blogpost SET published = 1 WHERE pid=" + pid; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void deletePost(int pid){ + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "DELETE FROM blogpost WHERE pid=" + pid; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void softDeletePost(int pid){ + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "UPDATE blogpost SET deleted = 1, published = 0 WHERE pid=" + pid; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void updateUserDB(User updUser){ + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "UPDATE user SET fullname='"+updUser.getFullname() + +"', username='"+updUser.getUsername() + +"', password='"+updUser.getPassword() + +"', role='"+updUser.getRole() + +"', email='"+updUser.getEmail() + +"' WHERE uid="+updUser.getUid(); + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void createUserDB(User newUser){ + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "INSERT INTO user VALUES (NULL, '" + +newUser.getFullname() + +"', '"+newUser.getUsername() + +"', '"+newUser.getPassword() + +"', '"+newUser.getRole() + +"', '"+newUser.getEmail() + +"')"; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public void restorePost(int pid){ + PreparedStatement pst = null; + Connection con = getConnection(); + String sql = "UPDATE blogpost SET deleted = 0, published = 1 WHERE pid=" + pid; + try { + pst = con.prepareStatement(sql); + pst.execute(); + con.close(); + } catch (SQLException ex) { + Logger.getLogger(UserData.class.getName()).log(Level.SEVERE, null, ex); + } + } + +} diff --git a/src/java/UserBeans/editPost.java b/src/java/UserBeans/editPost.java new file mode 100644 index 00000000..77342e70 --- /dev/null +++ b/src/java/UserBeans/editPost.java @@ -0,0 +1,59 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package UserBeans; + +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; + +/** + * + * @author Yusuf + */ +@ManagedBean(name = "edit", eager = true) +@SessionScoped +public class editPost { + + + private int pid; + private BlogPost post; + + /** + * Creates a new instance of editPost + */ + public editPost() { + post = new BlogPost(); + pid = 0; + } + + public String initiate(int ppid){ + UserData ud = new UserData(); + pid = ppid; + post = ud.getBlogPost(ppid); + BlogPost dummy = ud.getBlogPost(ppid); + return "faces/edit_post.xhtml"; + } + + public BlogPost getPost(){ + return post; + } + + public void setPost(BlogPost post){ + this.post.setDeleted(post.getDeleted()); + this.post.setPid(post.getPid()); + this.post.setPostcontent(post.getPostcontent()); + this.post.setPostdate(post.getPostdate()); + this.post.setPosttitle(post.getPosttitle()); + this.post.setPublished(post.getPublished()); + this.post.setUid(post.getUid()); + this.post.setUsername(post.getUsername()); + } + + public String submitPost(){ + UserData ud = new UserData(); + ud.writeBlogPost(post); + return "faces/index.xhtml"; + } +} diff --git a/src/java/UserBeans/userMgnt.java b/src/java/UserBeans/userMgnt.java new file mode 100644 index 00000000..e4734f23 --- /dev/null +++ b/src/java/UserBeans/userMgnt.java @@ -0,0 +1,300 @@ +package UserBeans; + +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +import java.io.Serializable; +import java.util.ArrayList; +import javax.faces.bean.ManagedBean; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + * @author user + */ +@ManagedBean(name = "beans", eager = true) +@SessionScoped +public class userMgnt implements Serializable { + + /** + * Creates a new instance of userMgnt + */ + private String Message; + private Cookie cookie; + private User user; + private User newUser; + private BlogPost post; + private BlogPost lihatpost; + private ArrayList allPosts; + private ArrayList unpublishedPosts; + private ArrayList comments; + private Komentar komen; + private int pid; + private ArrayList users; + private ArrayList deletedPosts; + + public userMgnt() { + user = new User(); + post = new BlogPost(); + Message = "tidak ada"; + cookie = new Cookie("Username", null); + cookie.setMaxAge(120); + post = new BlogPost(); + FacesContext facesContext = FacesContext.getCurrentInstance(); + String passedParam = (String) facesContext.getExternalContext().getRequestParameterMap().get("pid"); + if(passedParam != null) + pid = Integer.parseInt(passedParam); + + komen = new Komentar(); + newUser = new User(); + } + + public void login() { + UserData ud = new UserData(); + User userValidator = ud.getUser(user.getUsername()); + if (userValidator != null) { + if (user.getPassword().compareTo(userValidator.getPassword()) == 0) { + user.setUid(userValidator.getUid()); + user.setFullname(userValidator.getFullname()); + user.setRole(userValidator.getRole()); + user.setEmail(userValidator.getEmail()); + cookie.setValue(user.getUsername()); + FacesContext facesContex = FacesContext.getCurrentInstance(); + HttpServletResponse response = (HttpServletResponse) facesContex.getExternalContext().getResponse(); + response.addCookie(cookie); + + komen.setEmail(userValidator.getEmail()); + komen.setKomentator(userValidator.getFullname()); + } else { + Message = "Password is wrong"; + } + } else { + Message = "Username not found"; + } + } + + public String Logout() { + reset(); + Message = "tidak ada"; + cookie.setValue(null); + cookie.setMaxAge(0); + FacesContext facesContex = FacesContext.getCurrentInstance(); + HttpServletResponse response = (HttpServletResponse) facesContex.getExternalContext().getResponse(); + response.addCookie(cookie); + return "faces/index.xhtml"; + } + + public void reset() { + user.setFullname("guest"); + user.setUsername("guest"); + user.setPassword("pass"); + user.setEmail(""); + user.setRole("guest"); + user.setUid(0); + } + + public boolean isLogin() { + return user.getUsername().compareTo("guest") != 0 && cookie.getValue() != null; + } + + public boolean isAdmin(){ + return user.getRole().compareTo("admin")==0; + } + + public boolean isOwner(){ + return user.getRole().compareTo("owner")==0; + } + + public boolean isEditor(){ + return user.getRole().compareTo("editor")==0; + } + + public boolean activeMessage() { + return !Message.equals("tidak ada") && !isLogin(); + } + + public void submitPost(){ + UserData ud = new UserData(); + post.setUid(user.getUid()); + post.setUsername(user.getFullname()); + ud.writeBlogPost(post); + post.reset(); + } + + public void publishPost(int pid){ + UserData ud = new UserData(); + ud.publishPost(pid); + } + + public void softDeletePost(int ppid){ + UserData ud = new UserData(); + ud.softDeletePost(ppid); + } + + public void deletedPost(int ppid){ + UserData ud = new UserData(); + ud.deletePost(ppid); + } + + public void writeComment(){ + UserData ud = new UserData(); + komen.setPid(post.getPid()); + ud.writeKomentar(komen); + } + + public ArrayList getComments(){ + UserData ud = new UserData(); + comments = ud.getListKomentar(post.getPid()); + return comments; + } + + public Komentar getKomen(){ + return komen; + } + + public void setKomen(Komentar komen){ + this.komen.setCid(komen.getCid()); + this.komen.setCommentDate(komen.getCommentDate()); + this.komen.setEmail(komen.getEmail()); + this.komen.setKomen(komen.getKomen()); + this.komen.setKomentator(komen.getKomentator()); + this.komen.setPid(komen.getPid()); + } + + public ArrayList getUnpublishedPosts(){ + UserData ud = new UserData(); + return ud.getAllUnpublishedBlogPost(); + } + + public void setUnpublishedPosts(ArrayList unpublishedPostSet){ + unpublishedPosts.clear(); + for (BlogPost unpublishedPostSet1 : unpublishedPostSet) { + unpublishedPosts.add(unpublishedPostSet1); + } + } + + public User getUser() { + return this.user; + } + + public void setUser(User newUser) { + user.setEmail(newUser.getEmail()); + user.setFullname(newUser.getFullname()); + user.setPassword(newUser.getPassword()); + user.setRole(newUser.getRole()); + user.setUid(newUser.getUid()); + user.setUsername(newUser.getUsername()); + } + + public ArrayList getAllPosts() { + UserData ud = new UserData(); + return ud.getAllBlogPost(); + } + + public void setAllPosts(ArrayList postSet) { + allPosts.clear(); + for (BlogPost postSet1 : postSet) { + allPosts.add(postSet1); + } + } + + public BlogPost getPost(){ + return post; + } + + public void setPost(BlogPost post){ + this.post.setPid(post.getPid()); + this.post.setUid(post.getUid()); + this.post.setUsername(post.getUsername()); + this.post.setPosttitle(post.getPosttitle()); + this.post.setPostcontent(post.getPostcontent()); + this.post.setPostdate(post.getPostdate()); + this.post.setPublished(post.getPublished()); + this.post.setDeleted(post.getDeleted()); + } + + public String getMessage() { + return Message; + } + + public ArrayList getUsers(){ + UserData ud = new UserData(); + users = ud.getListUser(); + return users; + } + + public void setMessage(String S) { + Message = S; + } + + public Cookie getCookie() { + FacesContext facesContext = FacesContext.getCurrentInstance(); + + HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest(); + Cookie cook = null; + + Cookie[] userCookies = request.getCookies(); + if (userCookies != null && userCookies.length > 0) { + for (int i = 0; i < userCookies.length; i++) { + if (userCookies[i].getName().equals("Username")) { + cook = userCookies[i]; + return cook; + } + } + } + return null; + } + + public String genEditLink(int editPid){ + return "faces/edit_post.xhtml?pid="+editPid; + } + + public String genPostLink(int ppid){ + UserData ud = new UserData(); + lihatpost = ud.getBlogPost(ppid); + return "faces/post.xhtml"; + } + + public String updateUserOption(int usersIndex){ + if(users.size() >= usersIndex){ + UserData ud = new UserData(); + ud.updateUserDB(users.get(usersIndex)); + return "alert('update berhasil');"; + } + return "alert('update gagal');"; + } + + public ArrayList getDeletedPosts(){ + UserData ud = new UserData(); + return ud.getDeletedPosts(); + } + + public void restoreDeletedPost(int delPid){ + UserData ud = new UserData(); + ud.restorePost(delPid); + } + + public String genAddPostLink(){ + post.reset(); + return "faces/add_post.xhtml"; + } + + public User getNewUser(){ + return newUser; + } + + public void createNewUser(){ + UserData ud = new UserData(); + ud.createUserDB(newUser); + } + + public BlogPost getLihatpost(){ + return lihatpost; + } +} diff --git a/web/META-INF/context.xml b/web/META-INF/context.xml new file mode 100644 index 00000000..bc17358c --- /dev/null +++ b/web/META-INF/context.xml @@ -0,0 +1,2 @@ + + diff --git a/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar b/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar new file mode 100644 index 00000000..1f904143 Binary files /dev/null and b/web/WEB-INF/lib/mysql-connector-java-5.1.23-bin.jar differ diff --git a/web/WEB-INF/web.xml b/web/WEB-INF/web.xml new file mode 100644 index 00000000..c5e7c738 --- /dev/null +++ b/web/WEB-INF/web.xml @@ -0,0 +1,24 @@ + + + + javax.faces.PROJECT_STAGE + Development + + + Faces Servlet + javax.faces.webapp.FacesServlet + 1 + + + Faces Servlet + /faces/* + + + + 30 + + + + faces/index.xhtml + + diff --git a/web/add_post.xhtml b/web/add_post.xhtml new file mode 100644 index 00000000..5d5a814e --- /dev/null +++ b/web/add_post.xhtml @@ -0,0 +1,131 @@ + + + + + + + New Post- Simple blog + + + + + +
+ + +
+ + +

-

+ +
+
+

Tambah Post

+
+ + Judul: + + Tanggal: + + Konten: +