Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tugas 2 IF3110 WBD - Kelompok 46 #17

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
861 changes: 0 additions & 861 deletions assets/css/screen.css

This file was deleted.

Binary file removed assets/img/favicon.ico
Binary file not shown.
Binary file removed assets/img/pre.png
Binary file not shown.
71 changes: 71 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Tugas2" default="default" basedir=".">
<description>Builds, tests, and runs the project Tugas2.</description>
<import file="nbproject/build-impl.xml"/>
<!--

There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:

-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying

Example of pluging an obfuscator after the compilation could look like

<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>

For list of available properties check the imported
nbproject/build-impl.xml file.


Other way how to customize the build is by overriding existing main targets.
The target of interest are:

init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation

Example of overriding the target for project execution could look like

<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>

Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.

-->
</project>
90 changes: 90 additions & 0 deletions build/web/Add_Post.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<h:head>
<title>Add New Post</title>
<meta name="viewport" content="width=device-width"/>
<link rel ="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/resources/style.css" />
</h:head>
<h:body>
<f:event type="preRenderView" listener="#{user.notAdminNotOwnerRedirectToPub()}" />
#{post.makeEmpty()}
<div id="menubar" class="bluegrad">
<div id="menulist">
<ul>
<li><a href="#{facesContext.externalContext.requestContextPath}/">Home</a></li>
<li style="display:#{user.addButton()}"><a href="Add_Post.xhtml">Add Post +</a></li>
<li style="display:#{user.logInButton()}"><a href="#loginModal">Login</a></li>
<li style="display:#{user.logOutButton()}"><a href="#logoutModal">Logout</a></li>
<li><a href=""><h:outputText value="#{user.name}"/></a></li>
</ul>
</div>
</div>
<div id="container" class="postmanip">
<div id="dashmenu">
<div id="title">
<h1>Add Post</h1>
Halaman ini merupakan halaman untuk menambahkan pos ke blog
</div>
<div id="menus">
<h2>Halo, #{user.name}</h2>
Silakan gunakan menu berikut ini,
<ul>
<li><a href="#{facesContext.externalContext.requestContextPath}/">Home</a></li>
<li style="display:#{user.userMgtButton()}"><a href="User_Management.xhtml">User Management</a></li>
<li style="display:block"><a href="Published_Posts.xhtml">Published Posts</a></li>
<li style="display:#{user.unPubButton()}"><a href="Unpublished_Posts.xhtml">Unpublished Posts</a></li>
<li style="display:#{user.logInButton()}"><a href="#loginModal">Login</a></li>
<li style="display:#{user.logOutButton()}"><a href="#logoutModal">Logout</a></li>

</ul>
</div>
</div>
<div id="body">
<div id="rightContainer">
<h:form id="inputanpos" onsubmit="return validateForm()">
<h:inputText a:placeholder="Judul Pos" id="Judul" value="#{post.judul}"/><br/>
<h:inputText a:placeholder="yyyy-mm-dd" id="Tanggal" value="#{post.tanggal}"/><br/>
<h:inputTextarea a:placeholder="Konten Pos" id="Konten" value="#{post.konten}"/><br/>
<h:commandButton class="button" id="add" value="Add" action="#{dbconnector.insertPost(user,post)}"/><br/>
<br/>
</h:form>
</div>
</div>
<div id="footer">
<div id="idlist">
<div class="identity left">Andre Susanto - 13512028</div>
<div class="identity">Jeffrey Lingga - 13512059</div>
<div class="identity right">Adhika Sigit - 13512060</div>
</div>
</div>
</div>
<div id="loginModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<p>Masukkan username dan password</p>
<h:form>
<h:inputText a:placeholder="username" id="ipTxt1" value="#{user.name}"/><br/>
<h:inputSecret a:placeholder="password" id="isec" value="#{user.password}"/><br/>
<h:commandButton class="button" id="cBtn2" value="Login" action="Published_Posts?faces-redirect=true"/> <!--?faces-redirect=true-->
<br/>
</h:form>
</div>
</div>
<div id="logoutModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h:form>
<p>Keluar dari sistem ini?</p>
<h:commandButton id="logout" value="Log Out" action="#{user.logOut(cookiehandler)}"/>
</h:form>
</div>
</div>
</h:body>
<script src="#{facesContext.externalContext.requestContextPath}/resources/js/validator.js" type="text/javascript"></script>
</html>
96 changes: 96 additions & 0 deletions build/web/Add_User.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<h:head>
<title>Edit User</title>
<meta name="viewport" content="width=device-width"/>
<link rel ="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/resources/style.css" />
</h:head>
<h:body>
<f:event type="preRenderView" listener="#{user.notAdminRedirectToPub()}" />
<div id="menubar" class="bluegrad">
<div id="menulist">
<ul>
<li><a href="#{facesContext.externalContext.requestContextPath}/">Home</a></li>
<li style="display:#{user.addButton()}"><a href="Add_Post.xhtml">Add Post +</a></li>
<li style="display:#{user.logInButton()}"><a href="#loginModal">Login</a></li>
<li style="display:#{user.logOutButton()}"><a href="#logoutModal">Logout</a></li>
<li><a href=""><h:outputText value="#{user.name}"/></a></li>
</ul>
</div>
</div>
<div id="container" class="postmanip">
<div id="dashmenu">
<div id="title">
<h1>Edit User</h1>
Halaman ini merupakan halaman untuk menambahkan user baru ke blog
</div>
<div id="menus">
<h2>Halo, #{user.name}</h2>
Silakan gunakan menu berikut ini,
<ul>
<li><a href="#{facesContext.externalContext.requestContextPath}/">Home</a></li>
<li style="display:#{user.addButton()}"><a href="Add_Post.xhtml">Add Post +</a></li>
<li style="display:#{user.userMgtButton()}"><a href="User_Management.xhtml">User Management</a></li>
<li style="display:block"><a href="Published_Posts.xhtml">Published Posts</a></li>
<li style="display:#{user.unPubButton()}"><a href="Unpublished_Posts.xhtml">Unpublished Posts</a></li>
<li style="display:#{user.logInButton()}"><a href="#loginModal">Login</a></li>
<li style="display:#{user.logOutButton()}"><a href="#logoutModal">Logout</a></li>

</ul>
</div>
</div>
<div id="body">
<div id="rightContainer">
<h:form id="edadduser">
#{user.makeEmptySaved()}
<h:inputText id="username" a:placeholder="username" value="#{user.saved.name}"/><br/>
<h:inputSecret id="password" a:placeholder="password" value="#{user.saved.password}"/><br/>
<h:inputText id="email" a:placeholder="email" value="#{user.saved.email}"/><br/>
<h:selectOneRadio value="#{user.saved.type}">
<f:selectItem itemValue="1" itemLabel="Owner" />
<f:selectItem itemValue="2" itemLabel="Editor" />
<f:selectItem itemValue="3" itemLabel="Administrator" />
</h:selectOneRadio>
<h:commandButton onclick="return validateEdAddUser()" class="button" id="insert" value="Add User" action="#{dbconnector.insertUser(user,user.saved)}"/><br/>
<br/>
</h:form>
</div>
<div id="footer">
<div id="idlist">
<div class="identity left">Andre Susanto - 13512028</div>
<div class="identity">Jeffrey Lingga - 13512059</div>
<div class="identity right">Adhika Sigit - 13512060</div>
</div>
</div>
</div>
<div id="loginModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<p>Masukkan username dan password</p>
<h:form>
<h:inputText a:placeholder="username" id="ipTxt1" value="#{user.name}"/><br/>
<h:inputSecret a:placeholder="password" id="isec" value="#{user.password}"/><br/>
<h:commandButton class="button" id="cBtn2" value="Login" action="Published_Posts?faces-redirect=true"/> <!--?faces-redirect=true-->
<br/>
</h:form>
</div>
</div>
<div id="logoutModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h:form>
<p>Keluar dari sistem ini?</p>
<h:commandButton id="logout" value="Log Out" action="#{user.logOut(cookiehandler)}"/>
</h:form>
</div>
</div>
</div>
</h:body>
<script src="#{facesContext.externalContext.requestContextPath}/resources/js/validator.js" type="text/javascript"></script>
</html>
23 changes: 23 additions & 0 deletions build/web/Delete_Post.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<head>
<title>TODO supply a title</title>
<meta name="viewport" content="width=device-width"/>
<link rel ="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/resources/style.css" />
</head>
<h:body>
#{dbconnector.deletePost(user, param['pid'])}
#{user.loggedOnRedirectToPub()}
</h:body>
</html>
90 changes: 90 additions & 0 deletions build/web/Edit_Post.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
#{post.copy(dbconnector.selectPost(param['pid']))}
<h:head>
<title>Edit Post | #{post.judul}</title>
<meta name="viewport" content="width=device-width"/>
<link rel ="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/resources/style.css" />
</h:head>
<h:body>
<f:event type="preRenderView" listener="#{user.loggedOffRedirectToPub()}" />
<div id="menubar" class="bluegrad">
<div id="menulist">
<ul>
<li><a href="#{facesContext.externalContext.requestContextPath}/">Home</a></li>
<li style="display:#{user.addButton()}"><a href="Add_Post.xhtml">Add Post +</a></li>
<li style="display:#{user.logInButton()}"><a href="#loginModal">Login</a></li>
<li style="display:#{user.logOutButton()}"><a href="#logoutModal">Logout</a></li>
<li><a href=""><h:outputText value="#{user.name}"/></a></li>
</ul>
</div>
</div>
<div id="container" class="postmanip">
<div id="dashmenu">
<div id="title">
<h1>Edit Post</h1>
Halaman ini merupakan halaman untuk menyunting pos tertentu
</div>
<div id="menus">
<h2>Halo, #{user.name}</h2>
Silakan gunakan menu berikut ini,
<ul>
<li><a href="#{facesContext.externalContext.requestContextPath}/">Home</a></li>
<li style="display:#{user.addButton()}"><a href="Add_Post.xhtml">Add Post +</a></li>
<li style="display:#{user.userMgtButton()}"><a href="User_Management.xhtml">User Management</a></li>
<li style="display:#{user.unPubButton()}"><a href="Unpublished_Posts.xhtml">Unpublished Posts</a></li>
<li style="display:#{user.logInButton()}"><a href="#loginModal">Login</a></li>
<li style="display:#{user.logOutButton()}"><a href="#logoutModal">Logout</a></li>

</ul>
</div>
</div>
<div id="body">
<div id="rightContainer">
<h:form id="inputanpos" onsubmit="return validateForm()">
<h:inputText a:placeholder="Judul Pos" id="Judul" value="#{post.judul}"/><br/>
<h:inputText a:placeholder="yyyy-mm-dd" id="Tanggal" value="#{post.tanggal}"/><br/>
<h:inputTextarea a:placeholder="Konten Pos" id="Konten" value="#{post.konten}"/><br/>
<h:commandButton class="button" id="update" value="Update" action="#{dbconnector.updatePost(user,post)}"/><br/>
<br/>
</h:form>
</div>
</div>
<div id="footer">
<div id="idlist">
<div class="identity left">Andre Susanto - 13512028</div>
<div class="identity">Jeffrey Lingga - 13512059</div>
<div class="identity right">Adhika Sigit - 13512060</div>
</div>
</div>
</div>
<div id="loginModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<p>Masukkan username dan password</p>
<h:form>
<h:inputText a:placeholder="username" id="ipTxt1" value="#{user.name}"/><br/>
<h:inputSecret a:placeholder="password" id="isec" value="#{user.password}"/><br/>
<h:commandButton class="button" id="cBtn2" value="Login" action="Published_Posts?faces-redirect=true"/> <!--?faces-redirect=true-->
<br/>
</h:form>
</div>
</div>
<div id="logoutModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<h:form>
<p>Keluar dari sistem ini?</p>
<h:commandButton id="logout" value="Log Out" action="#{user.logOut(cookiehandler)}"/>
</h:form>
</div>
</div>
</h:body>
<script src="#{facesContext.externalContext.requestContextPath}/resources/js/validator.js" type="text/javascript"></script>
</html>
Loading