Commit 5ae54e65 by Tuomas Riihimäki

Merge branch 'eventmgmt' into 'master'

Eventmgmt

Tapahtumienhallintaprojektin pohja.

Kääntyy ja näyttää etusivun. Ei vielä sisällä mitään toiminnallisuutta.

Aloitus issueen #2
2 parents db1ef059 34291704
Showing with 1810 additions and 20 deletions
......@@ -25,12 +25,12 @@ import fi.codecrew.moya.util.MailMessage;
* Message-Driven Bean implementation class for: MailMessageBean
*
*/
@MessageDriven(activationConfig = {
@ActivationConfigProperty(
propertyName = "destinationType",
propertyValue = "javax.jms.Queue")
},
mappedName = "jms/moyaMailQueue")
@MessageDriven(mappedName = "jms/moyaMailQueue",
activationConfig = {
@ActivationConfigProperty(
propertyName = "destinationType",
propertyValue = "javax.jms.Queue")
})
public class MailMessageBean implements MessageListener {
@Resource(name = "mail/moya")
......
......@@ -38,9 +38,6 @@
<dependent-module archiveName="httpcore-4.3-beta2.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/apache/httpcomponents/httpcore/4.3-beta2/httpcore-4.3-beta2.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-logging-1.1.1.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-codec-1.6.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-codec/commons-codec/1.6/commons-codec-1.6.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
......@@ -65,5 +62,17 @@
<dependent-module archiveName="jrobin-1.5.9.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/jrobin/jrobin/1.5.9/jrobin-1.5.9.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="moya-mgmt-web-0.2.0.war" deploy-path="/" handle="module:/resource/MoyaEventMgmtWeb/MoyaEventMgmtWeb">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-digester-2.1.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-digester/commons-digester/2.1/commons-digester-2.1.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-beanutils-1.8.3.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-beanutils/commons-beanutils/1.8.3/commons-beanutils-1.8.3.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="commons-logging-1.1.1.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
</wb-module>
</project-modules>
......@@ -13,7 +13,11 @@
<context-root>/MoyaWeb</context-root>
</web>
</module>
<!-- <module> <web> <web-uri>MoyaEventMgmtWeb.war</web-uri> <context-root>EventMgmt</context-root>
</web> </module> -->
<module>
<web>
<web-uri>moya-mgmt-web-0.2.0.war</web-uri>
<context-root>/EventMgmt</context-root>
</web>
</module>
<library-directory>lib</library-directory>
</application>
\ No newline at end of file
......@@ -85,8 +85,18 @@
<version>1.5.9</version>
</dependency>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-mgmt-web</artifactId>
<version>0.2.0</version>
<type>war</type>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
<repositories>
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="oracle.eclipse.tools.glassfish.lib.system">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MoyaEventMgmtWeb</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<system-libraries>
<library path="/Users/tuomari/bin/glassfish4/glassfish/modules/javax.faces.jar" source="/Users/tuomari/.m2/repository/org/glassfish/javax.faces/2.2.0/javax.faces-2.2.0-sources.jar"/>
</system-libraries>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="MoyaEventMgmtWeb">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="java-output-path" value="/MoyaEventMgmtWeb/build/classes"/>
<property name="context-root" value="moya-mgmt-web"/>
<property name="component.inclusion.patterns" value="WEB-INF/lib/javamelody-core*,WEB-INF/lib/primefaces*,**/*.xml,**/*.xhtml,**/*.properties,**/*.class,**/*.png,**/*.css,**/*.js,resources/*"/>
</wb-module>
</project-modules>
<root>
<facet id="jst.jsf">
<node name="libprov">
<attribute name="provider-id" value="GlassFish-4-SystemLibrary-JSF"/>
</node>
</facet>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="GlassFish 4.0"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.1"/>
<installed facet="glassfish.web" version="4.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="jst.jsf" version="2.2"/>
<installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
disabled=06target
eclipse.preferences.version=1
<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
<application>
<resource-bundle>
<base-name>fi.codecrew.moyamgmt.resources.i18n</base-name>
<var>i18n</var>
</resource-bundle>
<message-bundle>fi.codecrew.moyamgmt.resources.i18n</message-bundle>
<locale-config>
<default-locale>fi</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
<factory>
<exception-handler-factory>fi.codecrew.moyamgmt.exceptions.BortalExceptionHandlerFactory</exception-handler-factory>
</factory>
</faces-config>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN"
"http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app error-url="">
<resource-ref>
<res-ref-name>jsf/ProjectStage</res-ref-name>
<jndi-name>javax.faces.PROJECT_STAGE</jndi-name>
</resource-ref>
<class-loader delegate="true" />
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class java code.</description>
</property>
</jsp-config>
<parameter-encoding default-charset="UTF-8" />
</glassfish-web-app>
<pretty-config xmlns="http://ocpsoft.org/prettyfaces/3.3.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ocpsoft.org/prettyfaces/3.3.3">
<!--
// Tell prettyfaces to use this bean when the pattern matches and show the manageUsers page. Also support a Query Param (cid).
@URLMapping(id = "manageUsers", pattern = "/us2ers/manage", viewId = "/pages/users/manageUsers.xhtml")
...
@SuppressWarnings("unused")
@URLQueryParameter("cid")
private String cid;
TAI
<url-mapping id="some-page">
<pattern value="/some/page" />
<query-param name="cid">#{convid.cid}</query-param>
<view-id value="/some/page.xhtml" />
</url-mapping>
-->
<url-mapping id="index">
<pattern value="/index" />
<view-id value="/index.xhtml" />
</url-mapping>
</pretty-config>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>MoyaEventMgmtWeb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsf</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.wtf</welcome-file>
</welcome-file-list>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<!-- Asetetaan PROJwECT_STAGE JNDI:llä, ja fallbackataan arvoon Development -->
<resource-ref>
<res-ref-name>jsf/ProjectStage</res-ref-name>
<res-type>java.lang.String</res-type>
</resource-ref>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<filter>
<display-name>PrimefacesFileupload</display-name>
<filter-name>PrimefacesFileupload</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsf</location>
</error-page>
<security-constraint>
<display-name>Forbidden resource</display-name>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>*.xhtml</url-pattern>
<url-pattern>/layout/*</url-pattern>
<url-pattern>/resources/tools/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>Thou shall not read the sources or use utils directly
</description>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<realm-name>moyaRealm</realm-name>
<form-login-config>
<form-login-page>/auth/login.jsf</form-login-page>
<form-error-page>/auth/loginError.jsf</form-error-page>
</form-login-config>
</login-config>
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>PrimefacesFileupload</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
<dispatcher>ASYNC</dispatcher>
</filter-mapping>
</web-app>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title></title>
</h:head>
<h:body>
<ui:composition template="#{mgmtSessionHandler.template}">
<f:metadata>
<f:event type="preRenderView" listener="#{frontpageView.initIndexView}" />
</f:metadata>
<ui:define name="content">
<h:outputLabel rendered="#{mgmtSessionHandler.isInDevelopmentMode()}">
Development-tilassa.
Täällä voit huoletta rikkoa.
</h:outputLabel>
Hurrdurr. #{frontpageView.content}
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta http-equiv="refresh" content="1;url=#{request.contextPath}/frontpage.jsf" />
<script type="text/javascript">
window.location.href = "#{request.contextPath}/frontpage.jsf"
</script>
<title></title>
</h:head>
<h:body>
Redirecting to <a href="#{request.contextPath}/frontpage.jsf">Frontpage</a>
</h:body>
</html>
\ No newline at end of file
/* General css, use for non-layout purposes for general elements */
/* userlistview popup */
.userdata_popup {
position: absolute;
border: 1px solid black;
background: white;
border-radius: 3px;
display: none;
width: 300px;
height: 150px;
}
/* general class for hoverable usage */
.hoverable {
}
.hidden {
display: none;
}
#webcamcontainer {
}
#shopItems {
}
.ui-panel-title {
text-overflow: clip;
}
.shopItem {
float: left;
width: 72px;
height: 72px;
background: burlywood;
border: 1px solid black;
margin: 2px;
}
a.shopItem {
color: black !important;
}
a.shopItem div {
position: absolute;
height: 72px;
width: 72px;
text-align: center;
/* Firefox */
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-pack: center;
-moz-box-align: center;
/* Safari and Chrome */
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
/* W3C */
display: box;
box-orient: horizontal;
box-pack: center;
box-align: center;
clip: rect(0, 72px, 72px, 0);
}
}
a.shopItem:hover {
background: darkgoldenrod;
}
a.shopItem:active {
background: red;
}
.prime-menu-selected div
{
display:block;
}
\ No newline at end of file
/* ==========================================================================
HTML5 Boilerplate styles - h5bp.com (generated via initializr.com)
========================================================================== */
html,
button,
input,
select,
textarea {
color: #222;
}
body {
font-size: 1em;
line-height: 1.4;
}
::-moz-selection {
background: #b3d4fc;
text-shadow: none;
}
::selection {
background: #b3d4fc;
text-shadow: none;
}
hr {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #ccc;
margin: 1em 0;
padding: 0;
}
img {
vertical-align: middle;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
textarea {
resize: vertical;
}
.chromeframe {
margin: 0.2em 0;
background: #ccc;
color: #000;
padding: 0.2em 0;
}
/* ==========================================================================
Author's custom styles
========================================================================== */
/* ==========================================================================
Media Queries
========================================================================== */
@media only screen and (min-width: 35em) {
}
@media print,
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 120dpi) {
}
/* ==========================================================================
Helper classes
========================================================================== */
.ir {
background-color: transparent;
border: 0;
overflow: hidden;
*text-indent: -9999px;
}
.ir:before {
content: "";
display: block;
width: 0;
height: 150%;
}
.hidden {
display: none !important;
visibility: hidden;
}
.visuallyhidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
width: 1px;
}
.visuallyhidden.focusable:active,
.visuallyhidden.focusable:focus {
clip: auto;
height: auto;
margin: 0;
overflow: visible;
position: static;
width: auto;
}
.invisible {
visibility: hidden;
}
.clearfix:before,
.clearfix:after {
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1;
}
/* ==========================================================================
Print styles
========================================================================== */
@media print {
* {
background: transparent !important;
color: #000 !important; /* Black prints faster: h5bp.com/s */
box-shadow: none !important;
text-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
/*
* Don't show links for images, or javascript/internal links
*/
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group; /* h5bp.com/t */
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page {
margin: 0.5cm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
\ No newline at end of file
/*! normalize.css v1.1.2 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:'';content:none}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;*overflow:visible}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;*height:13px;*width:13px}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}
\ No newline at end of file
.ui-widget,.ui-widget .ui-widget,.ui-button-text,.ui-wizard-step-title {
font-size: 90% !important;
}
.ui-panelmenu-header {
font-size: 80% !important;
}
#menu {
padding: 1em;
}
#aside {
margin: 1em;
width: 200px;
}
#main h1 {
font-family: Oxygen, Calibri;
font-size: 14pt;
border-bottom: 1px solid #B1B7AF;
color: #101D27;
font-weight: lighter;
padding-left: 0.5em;
}
#main h2 {
font-family: Oxygen, Calibri;
font-size: 12pt;
border-bottom: 1px solid #B1B7AF;
color: #101D27;
font-weight: lighter;
padding-left: 0.5em;
}
#main h3 {
font-family: Oxygen, Calibri;
font-size: 11pt;
color: #101D27;
font-weight: lighter;
}
#main {
font-family: Oxygen, Calibri;
font-size: 10pt;
padding-right: 1em;
}
#main p {
padding-left: 5em;
}
aside {
font-family: Oxygen !important;
font-weight: 100;
font-size: 10pt;
}
#main form label {
}
#main form input {
}
label {
color: #000;
font-weight: 100;
font-family: Oxygen;
font-size: 10pt;
padding-left: 10px;
}
input,textarea {
padding: 3px;
border: solid 1px #E5E5E5;
outline: 0;
font: normal 13px/100% Verdana, Tahoma, sans-serif;
margin: 0.25em 0;
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF),
color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
-moz-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
-webkit-box-shadow: rgba(0, 0, 0, 0.1) 0px 0px 8px;
}
textarea {
width: 400px;
max-width: 400px;
height: 150px;
line-height: 150%;
}
input:hover,textarea:hover,input:focus,textarea:focus {
border-color: #C9C9C9;
-webkit-box-shadow: rgba(0, 0, 0, 0.15) 0px 0px 8px;
}
@font-face {
font-family: Oxygen;
src: url('Oxygen-Regular.ttf');
}
body,html {
margin: 0;
padding: 0;
background: url("../img/bg.png");
}
h1 {
font-family: Oxygen, Calibri;
font-size: 18pt;
}
.box {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
#header_left {
width: 300px;
}
.flex1 {
-webkit-box-flex: 1; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 1; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 1; /* Chrome */
-ms-flex: 1; /* IE 10 */
flex: 1; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
.flex2 {
-webkit-box-flex: 3; /* OLD - iOS 6-, Safari 3.1-6 */
-moz-box-flex: 3; /* OLD - Firefox 19- */
width: 20%; /* For old syntax, otherwise collapses. */
-webkit-flex: 3; /* Chrome */
-ms-flex: 3; /* IE 10 */
flex: 3; /* NEW, Spec - Opera 12.1, Firefox 20+ */
}
#header_right {
width: 200px;
}
nav {
min-width: 200px;
background: white;
min-height: 400px;
border-bottom: 1px solid #aaa;
}
#main {
min-width: 810px;
min-height: 400px; background : white;
margin-right: 1em;
border-right: 1px solid #aaa;
border-bottom: 1px solid #aaa;
background: white;
}
aside {
min-width: 250px;
}
#side {
width: 175px;
}
#main h1 {
color: black;
}
#main a {
color: #2694e8;
}
#header a {
color: white;
text-decoration: none;
}
#header_right {
text-align: right;
}
th, td {
padding: 5px;
}
#edit { float: left; width:100%; border-bottom: 1px solid black; }
#usertabnav { font-size: 90%; }
ul#usertabnav { float:left; width: 100%; border:1px solid rgba(200,200,200,0); background:rgba(200,200,200,0); border-radius: 16px 16px 0 0; }
ul#usertabnav li {display:inline; list-style:none; }
ul#usertabnav li a {display:block; line-height: 1.7em; float:left; padding:2px 5px 2px 5px; color:rgb(125,125,125); text-decoration:none; font-size:120%; background-color:rgba(100,100,100,0.3); color: rgba(0,0,0,1); border-radius: 12px 12px 0 0; border: 1px solid rgba(0,0,0,0.1); border-bottom: none;}
ul#usertabnava:hover {text-decoration:none; color:rgb(50,50,50);}
ul#usertabnav li.active {font-weight: bold; background-color:rgba(250,250,250,0.4); color: rgba(0,0,0,1); border-radius: 12px 12px 0 0; border: 1px solid black; border-bottom: none }
#edit {
clear: both;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html class="no-js" xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:login="http://java.sun.com/jsf/composite/tools/login"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">
<f:view contentType="text/html" locale="#{sessionHandler.locale}">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title><h:outputText value="#{layoutView.getHeader()}" /></title>
<meta name="description" content="Lippukauppa" />
<meta name="author" content="CodeCrew ry" />
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Language" content="#{sessionHandler.locale}" />
<link rel="icon" href="#{request.contextPath}/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="#{request.contextPath}/resources/templates/template1/css/normalize.min.css" />
<link rel="stylesheet" href="#{request.contextPath}/resources/templates/template1/css//main.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/template1/css/style.css" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/templates/template1/css/general.css" />
<script src="#{request.contextPath}/resources/templates/template1/js/modernizr-2.6.2.min.js"></script>
<h:outputStylesheet>
.bgColor1 {
background-color: #{layoutView.getLayoutProperty1('#68A3C2')};
}
</h:outputStylesheet>
<ui:insert name="headerdata" />
</h:head>
<h:body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->
<header class="bgColor1 box">
<div id="header_left">
<h:link outcome="/index">
<c:choose>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<img src="#{request.contextPath}/resources/templates/insomnia2/img/devel_logo.png" />
</c:when>
<c:otherwise>
<p:graphicImage rendered="#{!empty layoutView.headerimage}" value="#{layoutView.headerimage}" />
<ui:fragment rendered="#{empty layoutView.headerimage}">
<h1>
<h:outputText value="#{layoutView.headertext}" />
</h1>
</ui:fragment>
</c:otherwise>
</c:choose>
</h:link>
</div>
<div id="header_center" class="flex1"></div>
<div id="header_right">
<a href="http://www.codecrew.fi"><img src="#{request.contextPath}/resources/templates/template1/img/moya_logo.png" />
</a>
</div>
</header>
<section class="box">
<nav>
<div id="menu">
<p:panelMenu model="#{primeMenuView.menuModel}" />
<!-- <ui:fragment rendered="#{menuView.getMenu(2).size() > 1}">
<div id="right">
<ul>
<ui:repeat var="menuitem" value="#{menuView.getMenu(2)}">
<h:outputText rendered="#{!empty menuitem.header}" value="&lt;/ul>&lt;h1>#{i18n[menuitem.header]}&lt;/h1>&lt;ul>" escape="false" />
<li><h:link outcome="#{menuitem.outcome}" value="#{i18n[menuitem.navigation.key]}" styleClass="#{menuitem.selected?'active':''}" /></li>
</ui:repeat>
</ul>
</div>
</ui:fragment>
-->
</div>
</nav>
<section id="main" class="flex2">
<div class="container top">
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editTop']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:top" />
</h:link>
</div>
<ui:insert name="title" />
<p:messages severity="info" />
<ui:insert name="edittab" />
<!-- <h:messages /> -->
<ui:repeat var="cont1" value="#{menuView.getPagecontent('top')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<ui:insert name="content" />
<ui:repeat var="cont1" value="#{menuView.getPagecontent('bottom')}">
<h:outputText value="#{cont1.content}" escape="false" />
</ui:repeat>
<h:link rendered="#{layoutView.manageContent}" styleClass="editorlink" value="#{i18n['layout.editBottom']}" outcome="/pages/manage">
<f:param name="pagename" value="#{layoutView.pagepath}:bottom" />
</h:link>
</section>
<aside class="flex1">
<div id="aside">
<div class="ui-widget-header">Login</div>
<div class="ui-widget-content" style="text-align: center">
<ui:fragment rendered="#{sessionHandler.loggedIn}">
<h:outputText value="#{i18n['template.loggedInAs']}" />
<br />
<b><h:outputText value="#{sessionHandler.currentUser.nick}" /></b>
</ui:fragment>
<div>
<login:loginLogout />
</div>
</div>
<br />
<ui:fragment rendered="#{menuView.renderTopmenuChanger}">
<div class="ui-widget-header">Select Mode</div>
<div class="ui-widget-content" style="text-align: center">
<h:form>
<p:selectOneMenu value="#{menuView.menuChange}">
<p:ajax listener="#{menuView.menuChangeEvent}" />
<f:selectItems var="menuitem" value="#{menuView.viewChangeTopmenu}" itemLabel="#{i18n[menuitem.navigation.key]}" itemValue="#{menuitem.outcome}" />
</p:selectOneMenu>
</h:form>
</div>
</ui:fragment>
</div>
</aside>
</section>
<footer class="bgColor1"> </footer>
</h:body>
</f:view>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui"
>
<composite:interface>
<composite:attribute name="isOneliner" required="false" />
<composite:attribute name="onError" required="false" />
</composite:interface>
<composite:implementation>
<h:form id="login">
<c:choose>
<c:when test="#{not empty cc.attrs.isOneliner}">
<p:inputText styleClass="form" id="linelogin" value="#{authView.login}" />
<p:password styleClass="form" id="linepwd" value="#{authView.password}" />
<p:commandButton styleClass="button" id="onelinesubmit" action="#{authView.executeLoginAction}" ajax="false" value="#{i18n['login.submit']}" />
</c:when>
<c:otherwise>
<h:panelGrid columns="2">
<h:outputLabel for="gridLogin" value="#{i18n['login.username']}" />
<p:inputText id="gridLogin" value="#{authView.login}" />
<h:outputLabel for="gridPwd" value="#{i18n['login.password']}" />
<p:password id="gridPwd" value="#{authView.password}" />
</h:panelGrid>
<p:commandButton id="gridsubmit" actionListener="#{authView.executeLogin(cc.attrs.onerror)}" ajax="false" value="#{i18n['login.submit']}" />
</c:otherwise>
</c:choose>
</h:form>
</composite:implementation>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/tools/login"
xmlns:p="http://primefaces.org/ui"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<c:choose>
<c:when test='#{sessionHandler.isLoggedIn() }'>
<h:form>
<p:commandLink actionListener="#{authView.doLogout}" ajax="false">
<h:outputText value="#{i18n['login.logout']}" />
</p:commandLink>
</h:form>
</c:when>
<c:otherwise>
<login:login isOneliner="true" />
<br/>
<h:link value="#{i18n['submenu.user.create']}" outcome="/user/create" />
<br/>
<h:link value="#{i18n['submenu.auth.sendResetMail']}" outcome="/auth/sendResetMail" />
</c:otherwise>
</c:choose>
</composite:implementation>
</html>
\ No newline at end of file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-mgmt-web</artifactId>
<version>0.2.0</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingIncludes>WEB-INF/lib/prettyfaces-core*,WEB-INF/lib/javamelody-core*,WEB-INF/lib/primefaces*,**/*.xml,**/*.xhtml,**/*.properties,**/*.class,**/*.png,**/*.css,**/*.js,resources/*</packagingIncludes>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>iudex</id>
<url>http://iudex.fi/maven/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-beans-client</artifactId>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-core</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package fi.codecrew.moyamgmt;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Named
@RequestScoped
public class FrontpageView extends GenericView {
private static final long serialVersionUID = -3187538351756262504L;
private static final Logger logger = LoggerFactory.getLogger(FrontpageView.class);
public void initIndexView()
{
logger.info("Initializing index view");
}
public String getContent()
{
return "asdasdasd";
}
}
package fi.codecrew.moyamgmt;
import java.io.Serializable;
import javax.ejb.EJB;
import javax.enterprise.context.Conversation;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.enums.apps.IAppPermission;
import fi.codecrew.moya.utilities.I18n;
import fi.codecrew.moyamgmt.handler.NavigationHandler;
public abstract class GenericView implements Serializable {
private static final long serialVersionUID = -4000065015178815761L;
@Inject
private Conversation conversation;
private static final Logger logger = LoggerFactory.getLogger(GenericView.class);
@Inject
protected NavigationHandler navihandler;
@EJB
protected PermissionBeanLocal permbean;
@EJB
private EventBeanLocal eventbean;
public void beginConversation() {
if (conversation.isTransient()) {
conversation.begin();
}
}
public void endConversation() {
if (!conversation.isTransient())
conversation.end();
}
public boolean hasPermission(IAppPermission perm) {
// boolean ret =
// FacesContext.getCurrentInstance().getExternalContext().isUserInRole(perm.getFullName());
return permbean.hasPermission(perm);
}
protected boolean requirePermissions(IAppPermission perm, boolean... externalChecks) {
boolean ret = requirePermissions(hasPermission(perm));
if (ret && externalChecks.length > 0) {
ret = requirePermissions(externalChecks);
}
if (!ret) {
logger.info("Permission required failed for {} Permission: {} (or extrachecks)", perm.getFullName(), perm);
}
return ret;
}
protected boolean requirePermissions(boolean... externalChecks) {
boolean ret = true;
for (boolean check : externalChecks) {
if (!check) {
ret = false;
break;
}
}
if (!ret) {
FacesContext fcont = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest) fcont.getExternalContext().getRequest();
StringBuilder viewidbuilder = new StringBuilder().append(req.getContextPath()).append(req.getServletPath());
if (req.getQueryString() != null) {
viewidbuilder.append("?").append(req.getQueryString());
}
navihandler.saveDestination(viewidbuilder.toString());
logger.debug("Permission denied. Saving navi {} for later use", viewidbuilder.toString());
// navihandler.navigateTo("/permissionDenied");
fcont.getApplication().getNavigationHandler().handleNavigation(fcont, null, "/permissionDenied?faces-redirect=true");
}
return ret;
}
protected void addFaceMessage(String string, Object... params) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(I18n.get(string, params)));
}
}
package fi.codecrew.moyamgmt.exceptions;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.AccessLocalException;
import javax.ejb.EJBAccessException;
import javax.faces.FacesException;
import javax.faces.application.NavigationHandler;
import javax.faces.application.ViewExpiredException;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerWrapper;
import javax.faces.context.FacesContext;
import javax.faces.event.ExceptionQueuedEvent;
import javax.faces.event.ExceptionQueuedEventContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BortalExceptionHandler extends ExceptionHandlerWrapper {
private static final Logger logger = LoggerFactory.getLogger(BortalExceptionHandler.class);
private final ExceptionHandler wrapped;
public BortalExceptionHandler(ExceptionHandler wrapped) {
this.wrapped = wrapped;
}
@Override
public ExceptionHandler getWrapped() {
return wrapped;
}
@Override
public void handle() throws FacesException {
Iterator<ExceptionQueuedEvent> i = getUnhandledExceptionQueuedEvents().iterator();
while (i.hasNext()) {
ExceptionQueuedEvent event = i.next();
ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event.getSource();
Throwable t = context.getException();
logger.debug("Found exception! handing it: {}", t.getClass().toString());
if (t instanceof ViewExpiredException) {
errorpage(i, t, "viewExpired");
}
Throwable cause = t.getCause();
for (int loop = 0; loop < 20 && cause != null; ++loop) {
logger.debug("Cause not null, but {}: {}, checking" + cause.getClass(), cause.getMessage());
if (cause instanceof EJBAccessException ||
cause instanceof AccessLocalException) {
logger.debug("Found Permission Denied cause: {}, {}", cause.getClass(), cause.getMessage());
// errorpage(i, t, "permissionDenied");
}
cause = cause.getCause();
}
}
// At this point, the queue will not contain any ViewExpiredEvents.
// Therefore, let the parent handle them.
getWrapped().handle();
}
private void errorpage(Iterator<ExceptionQueuedEvent> i, Throwable t, String navigateTo) {
logger.info("navigating to {} because root exception: {}", navigateTo, t.getClass());
ViewExpiredException vee = null;
if (t instanceof ViewExpiredException) {
vee = (ViewExpiredException) t;
}
FacesContext fc = FacesContext.getCurrentInstance();
Map<String, Object> requestMap = fc.getExternalContext().getRequestMap();
NavigationHandler nav = fc.getApplication().getNavigationHandler();
try {
// Push some useful stuff to the request scope for
// use in the page
if (vee != null) {
requestMap.put("currentViewId", vee.getViewId());
}
nav.handleNavigation(fc, null, navigateTo);
fc.renderResponse();
} finally {
i.remove();
}
}
}
package fi.codecrew.moyamgmt.exceptions;
import javax.faces.context.ExceptionHandler;
import javax.faces.context.ExceptionHandlerFactory;
public class BortalExceptionHandlerFactory extends ExceptionHandlerFactory {
private ExceptionHandlerFactory parent;
public BortalExceptionHandlerFactory() {
super();
}
public BortalExceptionHandlerFactory(ExceptionHandlerFactory parent) {
this.parent = parent;
}
@Override
public ExceptionHandler getExceptionHandler() {
ExceptionHandler result = parent.getExceptionHandler();
result = new BortalExceptionHandler(result);
return result;
}
}
package fi.codecrew.moyamgmt.handler;
import java.io.IOException;
import java.io.Serializable;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ConversationScoped
public class NavigationHandler implements Serializable {
private static final long serialVersionUID = -5985927646178070598L;
private static final Logger logger = LoggerFactory.getLogger(NavigationHandler.class);
private String destNavi;
@Inject
private transient Conversation conversation;
public void saveNavigation(String navigation)
{
FacesContext fcont = FacesContext.getCurrentInstance();
HttpServletRequest req = (HttpServletRequest) fcont.getExternalContext().getRequest();
// TODO: Parse navigation correctly
StringBuilder viewidbuilder = new StringBuilder().append(req.getContextPath()).append(navigation);
viewidbuilder.append(".jsf");
saveDestination(viewidbuilder.toString());
}
public void saveDestination(String pageid) {
if (conversation.isTransient()) {
conversation.begin();
}
this.destNavi = pageid;
}
public void redirectToSaved() {
if (destNavi == null || destNavi.isEmpty()) {
HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
destNavi = req.getContextPath();
}
redirectNavigation(destNavi);
}
public void redirectNavigation(String destinationUrl) {
try {
FacesContext.getCurrentInstance().getExternalContext().redirect(destinationUrl);
} catch (IOException e) {
logger.warn("Redirect failed!", e);
}
}
public void forward(String navigation) {
FacesContext fcont = FacesContext.getCurrentInstance();
javax.faces.application.NavigationHandler navihand = fcont.getApplication().getNavigationHandler();
navihand.handleNavigation(fcont, null, navigation);
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.codecrew.moyamgmt.handler;
import java.util.EnumMap;
import java.util.Locale;
import java.util.TimeZone;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.RoleBeanLocal;
import fi.codecrew.moya.clientutils.BortalLocalContextHolder;
import fi.codecrew.moya.enums.apps.IAppPermission;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
/**
*
* @author tuukka
*/
@Named("mgmtSessionHandler")
@RequestScoped
public class SessionHandler {
private static final Logger logger = LoggerFactory.getLogger(SessionHandler.class);
//
// @Inject
// private HttpServletRequest httprequest;
//
@EJB
private RoleBeanLocal rolebean;
@EJB
private EventBeanLocal eventbean;
@EJB
private PermissionBeanLocal permbean;
@Inject
private SessionStore sessionStore;
private String template;
public TimeZone getTimezone() {
return TimeZone.getTimeZone("Europe/Helsinki");
}
public String getLocale() {
Locale ret = sessionStore.getLocale();
String retStr = "fi_FI";
if (ret != null) {
retStr = ret.toLanguageTag();
logger.info("Got langtag {}", retStr);
}
return retStr;
}
public String getFullscreen() {
template = "blipview";
return template;
}
public String getAdduserfullscreen() {
template = "adduser";
return template;
}
public String getTemplateName()
{
if (template == null) {
template = eventbean.getPropertyString(LanEventPropertyKey.EVENT_LAYOUT);
}
if (template == null) {
template = "insomnia2";
}
return template;
}
public String getTemplatePath()
{
return "/resources/templates/" + getTemplateName();
}
public String getTemplate() {
return getTemplatePath() + "/template.xhtml";
}
private EnumMap<LanEventPropertyKey, Boolean> boolPropertyCache = new EnumMap<>(LanEventPropertyKey.class);
public boolean isEventBoolProperty(String property)
{
LanEventPropertyKey prop = LanEventPropertyKey.valueOf(property);
if (!prop.isBoolean()) {
throw new RuntimeException("Trying to fetch boolean value for non-boolean property!");
}
boolean value = false;
if (boolPropertyCache.containsKey(prop)) {
value = boolPropertyCache.get(prop);
} else {
LanEventProperty propertyValue = eventbean.getProperty(prop);
if (propertyValue == null) {
if (prop.getDefaultvalue() != null && prop.getDefaultvalue().equals("1"))
value = true;
} else {
value = propertyValue.isBooleanValue();
}
boolPropertyCache.put(prop, value);
}
return value;
}
// public boolean hasPermission(String target, String permission) {
// RolePermission perm = RolePermission.valueOf(permission.toUpperCase());
// // RolePermission perm = null;
// // if (permission.equalsIgnoreCase("read")) {
// // perm = RolePermission.READ;
// // } else if (permission.equals("write")) {
// // perm = RolePermission.WRITE;
// // } else if (permission.equals("execute")) {
// // perm = RolePermission.EXECUTE;
// // }else {
// // throw new RuntimeException("permission " + permission +
// // " does not match any")
// // }
// if (perm == null) {
// logger.warn("Permission {} does not have matching value in RolePermission enum!");
// throw new
// RuntimeException("Matching role permission could not be found!");
// }
//
// return hasPermission(target, perm);
// }
//
// private HttpSession getHttpSession() {
// FacesContext ctx = FacesContext.getCurrentInstance();
// HttpSession sess = (HttpSession)
// ctx.getExternalContext().getSession(false);
// return sess;
// }
// public boolean hasPermission(String perm) {
// return permbean.hasPermission(perm);
// }
public String getDateFormat()
{
return "dd.MM.yyyy";
}
public String getDatetimeFormat()
{
return "dd.MM.yyyy HH:mm";
}
public String getShortDatetimeFormat()
{
return "dd.MM HH:MM:ss";
}
public boolean hasPermission(IAppPermission permission) {
if (permission == null) {
logger.warn("permission is null");
throw new RuntimeException("Empty target or permission!");
}
boolean ret = permbean.hasPermission(permission);
return ret;
}
public boolean isLoggedIn() {
boolean ret = permbean.isLoggedIn();
return ret;
}
public boolean isSuperadmin() {
return permbean.getCurrentUser().getUser().isSuperadmin();
}
public EventUser getCurrentUser() {
return permbean.getCurrentUser();
}
public String flushCache() {
return eventbean.flushCache();
}
public String navigateTo(String url) {
return url;
}
private String preurlString;
public String getRequestPreUrl()
{
if (preurlString == null)
{
Object ext = FacesContext.getCurrentInstance().getExternalContext().getRequest();
if (ext instanceof HttpServletRequest)
{
StringBuffer url = ((HttpServletRequest) ext).getRequestURL();
preurlString = url.substring(0, url.indexOf("/", 8));
} else {
preurlString = "";
}
}
return preurlString;
}
public boolean isInDevelopmentMode() {
return BortalLocalContextHolder.isInDevelopmentMode();
}
public SessionStore getSessionStore() {
return sessionStore;
}
public void setSessionStore(SessionStore sessionStore) {
this.sessionStore = sessionStore;
}
}
package fi.codecrew.moyamgmt.handler;
import java.io.Serializable;
import java.util.Locale;
import javax.ejb.EJB;
import javax.enterprise.context.SessionScoped;
import javax.faces.context.FacesContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
@SessionScoped
public class SessionStore implements Serializable {
private static final long serialVersionUID = 594517648650107916L;
private static final Locale DEFAULT_LOCALE = new Locale("fi");
@EJB
private EventBeanLocal eventbean;
private Locale locale;
private boolean manageContentLinks = false;
private static final Logger logger = LoggerFactory.getLogger(SessionStore.class);
public Locale getLocale() {
Locale ret = locale;
if (ret == null)
{
String retStr = eventbean.getCurrentEvent().getOrganiser().getBundleCountry();
if (retStr != null && !retStr.isEmpty()) {
try {
ret = Locale.forLanguageTag(retStr);
} catch (Throwable t) {
logger.warn("Error setting locale from current event for {}", retStr);
ret = null;
}
}
if (ret == null) {
ret = DEFAULT_LOCALE;
}
locale = ret;
}
return ret;
}
public void setLocale(Locale locale)
{
this.locale = locale;
FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);
}
public boolean isManageContentLinks() {
return manageContentLinks;
}
public void setManageContentLinks(boolean manageContentLinks) {
this.manageContentLinks = manageContentLinks;
}
}
......@@ -4,4 +4,9 @@
<attribute name="provider-id" value="jsf-no-op-library-provider"/>
</node>
</facet>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>
......@@ -8,4 +8,5 @@
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.jsf" version="2.0"/>
<installed facet="jst.jaxrs" version="2.0"/>
</faceted-project>
......@@ -9,14 +9,9 @@
<var>i18n</var>
</resource-bundle>
<message-bundle>fi.codecrew.moya.resources.i18n</message-bundle>
<!-- Legal Country codes: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm -->
<!-- Assigned Country codes: -->
<!-- Insomnia: IN (INDIA) -->
<!-- Stream: ST (SAO TOME AND PRINCIPE ) -->
<!-- Vector VE (VENEZUELA, BOLIVARIAN REPUBLIC OF) -->
<locale-config>
<default-locale>fi_FI</default-locale>
<supported-locale>en_UK</supported-locale>
<locale-config>
<default-locale>fi</default-locale>
<supported-locale>en</supported-locale>
</locale-config>
</application>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!