Commit 3f10c80c by Tuomas Riihimäki Committed by Tuukka Kivilahti

Tunkh!

- Remove moya-mgmt-web
- add moya-mgmt
- Update maven plugin versions
1 parent 0c0734ed
Showing with 831 additions and 1675 deletions
......@@ -2,7 +2,77 @@
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>
<artifactId>moya-angular</artifactId>
<groupId>fi.codecrew.moya.angular</groupId>
<version>0.001</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${war-plugin-version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>%regex[WEB-INF/lib/(?!rewrite-.*\.jar)(?!moya-restpojo.*\.jar).*]</packagingExcludes>
<webResources>
<resource>
<directory>./dist/</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>${eirslett.frontend.version}</version>
<executions>
<execution>
<!-- optional: you don't really need execution ids,
but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${js.node.version}</nodeVersion>
<npmVersion>${js.npm.version}</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-beans-client</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
</dependencies>
<parent>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-parent</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../moya-parent/pom.xml</relativePath>
</parent>
</project>
......@@ -17,7 +17,7 @@
<plugins>
<plugin>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.4</version>
<version>${ejb-plugin-version}</version>
<configuration>
<ejbVersion>3.2</ejbVersion>
</configuration>
......
......@@ -19,7 +19,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
......
......@@ -8,7 +8,7 @@
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9.1</version>
<version>2.10.1</version>
<configuration>
<applicationName>Moya</applicationName>
<earSourceDirectory>EarContent</earSourceDirectory>
......@@ -38,7 +38,7 @@
</webModule>
<webModule>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-mgmt-web</artifactId>
<artifactId>moya-mgmt</artifactId>
<contextRoot>/mgmt</contextRoot>
</webModule>
<webModule>
......@@ -72,7 +72,7 @@
</dependency>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-mgmt-web</artifactId>
<artifactId>moya-mgmt</artifactId>
<version>1.2-SNAPSHOT</version>
<type>war</type>
</dependency>
......
<?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>
<?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>
<!-- Java melody monitoring -->
<filter>
<filter-name>javamelody</filter-name>
<filter-class>net.bull.javamelody.MonitoringFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>javamelody</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>net.bull.javamelody.SessionListener</listener-class>
</listener>
<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-mapping>
<filter-name>PrimefacesFileupload</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</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;
}
<?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
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
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";
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
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)));
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
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();
}
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
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;
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
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);
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
/*
* 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;
}
}
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
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;
}
}
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "moya-mgmt"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
/node
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db
# MoyaMgmt
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.3.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
import { MoyaMgmtPage } from './app.po';
describe('moya-mgmt App', () => {
let page: MoyaMgmtPage;
beforeEach(() => {
page = new MoyaMgmtPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
import { browser, by, element } from 'protractor';
export class MoyaMgmtPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"node"
]
}
}
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
{
"name": "moya-mgmt",
"version": "0.0.0",
"license": "UNLICENSED",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/platform-browser": "^4.0.0",
"@angular/platform-browser-dynamic": "^4.0.0",
"@angular/router": "^4.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.1.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.3",
"@angular/compiler-cli": "^4.0.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~4.5.0",
"typescript": "~2.2.0"
}
}
<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>
<artifactId>moya-mgmt-web</artifactId>
<artifactId>moya-mgmt</artifactId>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<version>${war-plugin-version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingExcludes>%regex[WEB-INF/lib/(?!rewrite-.*\.jar)(?!moya-restpojo.*\.jar)(?!primefaces.*\.jar)(?!all-themes.*\.jar).*]</packagingExcludes>
<packagingExcludes>%regex[WEB-INF/lib/(?!rewrite-.*\.jar)(?!moya-restpojo.*\.jar).*]</packagingExcludes>
<webResources>
<resource>
<directory>./dist/</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<!-- optional: you don't really need execution ids,
but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>${js.node.version}</nodeVersion>
<npmVersion>${js.npm.version}</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
......@@ -23,13 +68,6 @@
<artifactId>moya-beans-client</artifactId>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
</dependencies>
<parent>
<groupId>fi.codecrew.moya</groupId>
......
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'app works!';
}
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
export const environment = {
production: true
};
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false
};
No preview for this file type
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>MoyaMgmt</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';
/* You can add global styles to this file, and also import other style files */
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [
true,
"rxjs"
],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [
true,
"ignore-params"
],
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}
......@@ -14,7 +14,7 @@
<module>../moya-beans-client</module>
<module>../moya-beans</module>
<module>../moya-web</module>
<module>../moya-mgmt-web</module>
<module>../moya-mgmt</module>
<module>../moya-terminal-web</module>
<module>../moya-ear</module>
<module>../moya-angular</module>
......
......@@ -25,6 +25,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
......
......@@ -8,7 +8,7 @@
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<version>${war-plugin-version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
......
......@@ -8,7 +8,7 @@
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.1.10</version>
<version>2.2.2</version>
<executions>
<execution>
<goals>
......
......@@ -8,7 +8,7 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<version>${war-plugin-version}</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
......
......@@ -7,6 +7,9 @@
<name>Moya Online Youth Accumulator</name>
<packaging>pom</packaging>
<version>1.2-SNAPSHOT</version>
<prerequisites>
<maven>3.1.0</maven>
</prerequisites>
<modules>
<module>moya-parent</module>
......@@ -18,11 +21,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.8</java-version>
<!-- plugin versions -->
<ejb-plugin-version>2.3</ejb-plugin-version>
<war-plugin-version>2.4</war-plugin-version>
<ejb-plugin-version>2.5.1</ejb-plugin-version>
<war-plugin-version>3.1.0</war-plugin-version>
<ear-plugin-version>2.9</ear-plugin-version>
<compiler-plugin-version>3.2</compiler-plugin-version>
<compiler-plugin-version>3.6.1</compiler-plugin-version>
<!-- dependency versions -->
<javaee-api-version>7.0</javaee-api-version>
<!-- EJB spec version -->
......@@ -44,6 +47,9 @@
<rewriteservlet.version>3.4.1.Final</rewriteservlet.version>
<iudex.standalone>1.0.23</iudex.standalone>
<js.node.version>v7.10.0</js.node.version>
<js.npm.version>4.1.0</js.npm.version>
<eirslett.frontend.version>1.4</eirslett.frontend.version>
</properties>
<url>http://codecrew.fi</url>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!