Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9a399aa3
authored
Apr 06, 2012
by
Juho Juopperi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of dev.insomnia.fi:/data/bortal
2 parents
38151724
41ad7f7f
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
119 additions
and
73 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/Menubean.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/MenuNavigationFacade.java
code/LanBortalDatabase/src/fi/insomnia/bortal/model/MenuNavigation.java
code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogMessageView.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/JsfMenuitem.java
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/MenuView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/beans/Menubean.java
View file @
9a399aa
package
fi
.
insomnia
.
bortal
.
beans
;
package
fi
.
insomnia
.
bortal
.
beans
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
javax.annotation.security.DeclareRoles
;
import
javax.annotation.security.DeclareRoles
;
...
@@ -11,6 +8,9 @@ import javax.ejb.EJB;
...
@@ -11,6 +8,9 @@ import javax.ejb.EJB;
import
javax.ejb.LocalBean
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
javax.ejb.Stateless
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.enums.apps.BillPermission
;
import
fi.insomnia.bortal.enums.apps.BillPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.MapPermission
;
import
fi.insomnia.bortal.enums.apps.PollPermission
;
import
fi.insomnia.bortal.enums.apps.PollPermission
;
...
@@ -19,7 +19,6 @@ import fi.insomnia.bortal.enums.apps.UserPermission;
...
@@ -19,7 +19,6 @@ import fi.insomnia.bortal.enums.apps.UserPermission;
import
fi.insomnia.bortal.facade.MenuNavigationFacade
;
import
fi.insomnia.bortal.facade.MenuNavigationFacade
;
import
fi.insomnia.bortal.facade.MenuitemFacade
;
import
fi.insomnia.bortal.facade.MenuitemFacade
;
import
fi.insomnia.bortal.model.MenuNavigation
;
import
fi.insomnia.bortal.model.MenuNavigation
;
import
fi.insomnia.bortal.model.Menuitem
;
/**
/**
* Session Bean implementation class Menubean
* Session Bean implementation class Menubean
...
@@ -44,30 +43,36 @@ public class Menubean implements MenubeanLocal {
...
@@ -44,30 +43,36 @@ public class Menubean implements MenubeanLocal {
@EJB
@EJB
private
PermissionBeanLocal
permbean
;
private
PermissionBeanLocal
permbean
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Menubean
.
class
);
@Override
@Override
public
MenuNavigation
getMenuNavigation
(
String
url
)
{
public
MenuNavigation
getMenuNavigation
(
String
url
)
{
return
navifacade
.
find
(
url
,
eventbean
.
getCurrentEvent
());
MenuNavigation
ret
=
navifacade
.
find
(
url
,
eventbean
.
getCurrentEvent
());
logger
.
warn
(
"Children at bean: {}"
,
ret
.
getChildren
());
return
ret
;
}
}
@Override
@Override
public
List
<
MenuNavigation
>
getTopnavigations
()
{
public
List
<
MenuNavigation
>
getTopnavigations
()
{
HashMap
<
Menuitem
,
MenuNavigation
>
ret
=
new
HashMap
<
Menuitem
,
MenuNavigation
>();
return
navifacade
.
findToplevels
();
for
(
MenuNavigation
navi
:
navifacade
.
findToplevels
())
// HashMap<Menuitem, MenuNavigation> ret = new HashMap<Menuitem,
{
// MenuNavigation>();
if
((
navi
.
getEvent
()
==
null
&&
ret
.
containsKey
(
navi
.
getItem
())))
//
continue
;
// for (MenuNavigation navi : )
// {
ret
.
put
(
navi
.
getItem
(),
navi
);
//
}
// ret.put(navi.getItem(), navi);
ArrayList
<
MenuNavigation
>
retlist
=
new
ArrayList
<
MenuNavigation
>(
ret
.
values
());
// }
if
(
retlist
.
isEmpty
())
// ArrayList<MenuNavigation> retlist = new
{
// ArrayList<MenuNavigation>(ret.values());
initializeMenu
();
// if (retlist.isEmpty())
}
// {
Collections
.
sort
(
retlist
);
// initializeMenu();
return
retlist
;
// }
// logger.info("Returning topmenus: {}", retlist);
// Collections.sort(retlist);
// return retlist;
}
}
...
...
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/MenuNavigationFacade.java
View file @
9a399aa
...
@@ -120,7 +120,7 @@ public class MenuNavigationFacade extends GenericFacade<Integer, MenuNavigation>
...
@@ -120,7 +120,7 @@ public class MenuNavigationFacade extends GenericFacade<Integer, MenuNavigation>
Root
<
MenuNavigation
>
root
=
cq
.
from
(
MenuNavigation
.
class
);
Root
<
MenuNavigation
>
root
=
cq
.
from
(
MenuNavigation
.
class
);
Path
<
LanEvent
>
eventpath
=
root
.
get
(
MenuNavigation_
.
event
);
Path
<
LanEvent
>
eventpath
=
root
.
get
(
MenuNavigation_
.
event
);
cq
.
where
(
cb
.
isNull
(
root
.
get
(
MenuNavigation_
.
parent
)),
cb
.
or
(
cb
.
equal
(
eventpath
,
eventbean
.
getCurrentEvent
()),
cb
.
isNull
(
eventpath
)));
cq
.
where
(
cb
.
isNull
(
root
.
get
(
MenuNavigation_
.
parent
)),
cb
.
or
(
cb
.
equal
(
eventpath
,
eventbean
.
getCurrentEvent
()),
cb
.
isNull
(
eventpath
))
,
cb
.
isTrue
(
root
.
get
(
MenuNavigation_
.
visible
))
);
return
em
.
createQuery
(
cq
).
getResultList
();
return
em
.
createQuery
(
cq
).
getResultList
();
}
}
...
...
code/LanBortalDatabase/src/fi/insomnia/bortal/model/MenuNavigation.java
View file @
9a399aa
...
@@ -8,6 +8,7 @@ import java.util.List;
...
@@ -8,6 +8,7 @@ import java.util.List;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Entity
;
import
javax.persistence.FetchType
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.JoinColumn
;
import
javax.persistence.Lob
;
import
javax.persistence.Lob
;
import
javax.persistence.ManyToOne
;
import
javax.persistence.ManyToOne
;
...
@@ -63,10 +64,10 @@ public class MenuNavigation extends GenericEntity implements Comparable<MenuNavi
...
@@ -63,10 +64,10 @@ public class MenuNavigation extends GenericEntity implements Comparable<MenuNavi
@JoinColumn
(
nullable
=
true
)
@JoinColumn
(
nullable
=
true
)
private
MenuNavigation
parent
;
private
MenuNavigation
parent
;
@OneToMany
(
mappedBy
=
"parent"
,
cascade
=
ALL
)
@OneToMany
(
mappedBy
=
"parent"
,
cascade
=
ALL
,
fetch
=
FetchType
.
EAGER
)
@PrivateOwned
@PrivateOwned
@OrderBy
(
"sort"
)
@OrderBy
(
"sort"
)
private
List
<
MenuNavigation
>
children
;
private
List
<
MenuNavigation
>
children
=
new
ArrayList
<
MenuNavigation
>()
;
@Transient
@Transient
transient
private
IAppPermission
privatePerm
;
transient
private
IAppPermission
privatePerm
;
...
...
code/LanBortalWeb/WebContent/actionlog/messagelist.xhtml
View file @
9a399aa
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
<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:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:users=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:p=
"http://primefaces.prime.com.tr/ui"
>
>
<h:body>
<h:body>
...
@@ -45,39 +46,41 @@
...
@@ -45,39 +46,41 @@
<div
class=
"clearfix"
></div>
<div
class=
"clearfix"
></div>
<h2>
#{i18n['actionlog.tasklist.header']}
</h2>
<h2>
#{i18n['actionlog.tasklist.header']}
</h2>
<div
id=
"actionlog"
>
<div
id=
"actionlog"
>
<h:dataTable
styleClass=
"bordertable"
rowClasses=
"roweven,rowodd"
id=
"actionlogtable"
value=
"#{actionLogMessageView.messages}"
var=
"message"
>
<h:form
id=
"refresh"
>
<h:column>
<p:poll
interval=
"1"
update=
"actionlogtable"
/>
<f:facet
name=
"header"
>
<h:dataTable
styleClass=
"bordertable"
rowClasses=
"roweven,rowodd"
id=
"actionlogtable"
value=
"#{actionLogMessageView.messages}"
var=
"message"
>
<h:outputText
value=
"#{i18n['actionlog.time']}"
/>
<h:column>
</f:facet>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{message.time}"
>
<h:outputText
value=
"#{i18n['actionlog.time']}"
/>
<f:convertDateTime
type=
"both"
pattern=
"dd.MM.yyyy HH:mm"
/>
</f:facet>
<!-- <f:convertDateTime type="both" dateStyle="HH:mm" /> -->
<h:outputText
value=
"#{message.time}"
>
</h:outputText>
<f:convertDateTime
type=
"both"
pattern=
"dd.MM.yyyy HH:mm"
/>
</h:column>
</h:outputText>
<h:column>
</h:column>
<f:facet
name=
"header"
>
<h:column>
<h:outputText
value=
"#{i18n['actionlog.user']}"
/>
<f:facet
name=
"header"
>
</f:facet>
<h:outputText
value=
"#{i18n['actionlog.user']}"
/>
<h:outputText
value=
"#{message.user.nick}"
/>
</f:facet>
</h:column>
<h:outputText
value=
"#{message.user.nick}"
/>
<h:column>
</h:column>
<f:facet
name=
"header"
>
<h:column>
<h:outputText
value=
"#{i18n['actionlog.crew']}"
/>
<f:facet
name=
"header"
>
</f:facet>
<h:outputText
value=
"#{i18n['actionlog.crew']}"
/>
<h:outputText
value=
"#{message.crew.name}"
/>
</f:facet>
</h:column>
<h:outputText
value=
"#{message.crew.name}"
/>
<h:column>
</h:column>
<h:column>
<f:facet
name=
"header"
>
<h:outputText
value=
"#{i18n['actionlog.message']}"
/>
<f:facet
name=
"header"
>
</f:facet>
<h:outputText
value=
"#{i18n['actionlog.message']}"
/>
<h:outputText
value=
"#{message.message}"
/>
</f:facet>
</h:column>
<h:outputText
value=
"#{message.message}"
/>
<h:column>
</h:column>
x
<h:column>
</h:column>
x
</h:dataTable>
</h:column>
</h:dataTable>
</h:form>
</div>
</div>
</ui:define>
</ui:define>
</ui:composition>
</ui:composition>
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/resources/i18n_fi.properties
View file @
9a399aa
...
@@ -233,7 +233,7 @@ sidebar.user.list=K\u00e4ytt\u00e4j\u00e4t
...
@@ -233,7 +233,7 @@ sidebar.user.list=K\u00e4ytt\u00e4j\u00e4t
sidebar.users
=
K
\u
00e4ytt
\u
00e4j
\u
00e4t
sidebar.users
=
K
\u
00e4ytt
\u
00e4j
\u
00e4t
sidebar.utils.flushCache
=
Flush Cache
sidebar.utils.flushCache
=
Flush Cache
sidebar.utils.testdata
=
Testdata
sidebar.utils.testdata
=
Testdata
top
menu
.adminfront
=
Admintavaraa
top
navi
.adminfront
=
Admintavaraa
menu.poll.index
=
Kyselyt
menu.poll.index
=
Kyselyt
menu.index
=
Etusivu
menu.index
=
Etusivu
...
@@ -267,9 +267,13 @@ submenu.role.create=Luo rooli
...
@@ -267,9 +267,13 @@ submenu.role.create=Luo rooli
submenu.user.listCardTemplates
=
Korttiryhm
\u
00e4t
submenu.user.listCardTemplates
=
Korttiryhm
\u
00e4t
submenu.user.createCardTemplate
=
Luo korttiryhm
\u
00e4
submenu.user.createCardTemplate
=
Luo korttiryhm
\u
00e4
topmenu.game
=
Insomnia Game
topnavi.frontpage
=
Etusivu
topmenu.poll
=
Kyselyt
topnavi.placemap
=
Paikkakartta
topmenu.rfidshop
=
Staffshop
topnavi.shop
=
Kauppa
topnavi.user
=
topnavi.game
=
Insomnia Game
topnavi.poll
=
Kyselyt
topnavi.rfidshop
=
Staffshop
user.accountBalance
=
Tilin saldo
user.accountBalance
=
Tilin saldo
user.accountEventHeader
=
Tilitapahtumat
user.accountEventHeader
=
Tilitapahtumat
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/actionlog/ActionLogMessageView.java
View file @
9a399aa
...
@@ -15,9 +15,19 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
...
@@ -15,9 +15,19 @@ import fi.insomnia.bortal.web.cdiview.GenericCDIView;
public
class
ActionLogMessageView
extends
GenericCDIView
{
public
class
ActionLogMessageView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
boolean
updateEnabled
=
true
;
@EJB
@EJB
private
ActionLogBeanLocal
actionLogBean
;
private
ActionLogBeanLocal
actionLogBean
;
public
boolean
getUpdateEnabled
()
{
return
updateEnabled
;
}
public
void
setUpdateEnabled
(
boolean
updateEnabled
)
{
this
.
updateEnabled
=
updateEnabled
;
}
public
List
<
ActionLogMessage
>
getMessages
()
{
public
List
<
ActionLogMessage
>
getMessages
()
{
return
actionLogBean
.
getAllActionLogEvents
();
return
actionLogBean
.
getAllActionLogEvents
();
}
}
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/JsfMenuitem.java
View file @
9a399aa
...
@@ -23,6 +23,15 @@ public class JsfMenuitem {
...
@@ -23,6 +23,15 @@ public class JsfMenuitem {
// item = new Menuitem("/page/?id=" + sitepage.getId(), null, null);
// item = new Menuitem("/page/?id=" + sitepage.getId(), null, null);
// text = sitepage.getName();
// text = sitepage.getName();
// }
// }
public
String
hetFooter
()
{
return
navigation
.
getFooter
();
}
public
String
getHeader
()
{
return
navigation
.
getHeader
();
}
public
void
setSelected
()
{
public
void
setSelected
()
{
selected
=
true
;
selected
=
true
;
...
...
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/menu/MenuView.java
View file @
9a399aa
...
@@ -25,7 +25,6 @@ public class MenuView {
...
@@ -25,7 +25,6 @@ public class MenuView {
private
String
pagename
;
private
String
pagename
;
private
List
<
JsfMenuitem
>
submenu
;
private
List
<
JsfMenuitem
>
submenu
;
private
List
<
JsfMenuitem
>
topmenu
;
private
List
<
JsfMenuitem
>
topmenu
;
private
MenuNavigation
currentPage
;
@Inject
@Inject
private
FacesContext
context
;
private
FacesContext
context
;
...
@@ -37,6 +36,7 @@ public class MenuView {
...
@@ -37,6 +36,7 @@ public class MenuView {
@EJB
@EJB
private
SitePageBeanLocal
sitepagebean
;
private
SitePageBeanLocal
sitepagebean
;
private
ArrayList
<
MenuNavigation
>
menupath
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MenuView
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MenuView
.
class
);
public
String
getPagename
()
{
public
String
getPagename
()
{
...
@@ -54,18 +54,26 @@ public class MenuView {
...
@@ -54,18 +54,26 @@ public class MenuView {
{
{
if
(
submenu
==
null
)
if
(
submenu
==
null
)
{
{
getTopmenu
();
MenuNavigation
topPage
=
menupath
.
get
(
menupath
.
size
()
-
1
);
submenu
=
new
ArrayList
<
JsfMenuitem
>();
submenu
=
new
ArrayList
<
JsfMenuitem
>();
for
(
MenuNavigation
item
:
menubean
.
getMenuNavigation
(
getPagename
()).
getChildren
())
{
if
(
permbean
.
hasPermission
(
item
.
getPermission
()))
{
for
(
MenuNavigation
navi
:
topPage
.
getChildren
())
{
JsfMenuitem
thisitem
=
new
JsfMenuitem
(
item
);
logger
.
info
(
"Trying to add item {}"
,
navi
.
getKey
());
if
(
permbean
.
hasPermission
(
navi
.
getPermission
()))
{
JsfMenuitem
thisitem
=
new
JsfMenuitem
(
navi
);
submenu
.
add
(
thisitem
);
submenu
.
add
(
thisitem
);
if
(
currentPage
.
equals
(
item
))
{
if
(
menupath
.
contains
(
navi
))
{
thisitem
.
setSelected
();
thisitem
.
setSelected
();
}
}
}
}
}
}
logger
.
info
(
"Initialized submenu {}"
,
submenu
);
}
}
return
submenu
;
return
submenu
;
}
}
...
@@ -77,14 +85,21 @@ public class MenuView {
...
@@ -77,14 +85,21 @@ public class MenuView {
// if there are no results!
// if there are no results!
List
<
MenuNavigation
>
menuitems
=
menubean
.
getTopnavigations
();
List
<
MenuNavigation
>
menuitems
=
menubean
.
getTopnavigations
();
currentPage
=
menubean
.
getMenuNavigation
(
getPagename
());
menupath
=
new
ArrayList
<
MenuNavigation
>();
MenuNavigation
topPage
=
currentPage
;
MenuNavigation
currentPage
=
menubean
.
getMenuNavigation
(
getPagename
());
while
(
topPage
.
getParent
()
!=
null
)
while
(
currentPage
!=
null
)
{
{
topPage
=
topPage
.
getParent
();
menupath
.
add
(
currentPage
);
currentPage
=
currentPage
.
getParent
();
}
}
for
(
MenuNavigation
m
:
menuitems
)
{
for
(
MenuNavigation
m
:
menuitems
)
{
if
(
m
.
getPermission
()
!=
null
&&
!
permbean
.
hasPermission
(
m
.
getPermission
()))
{
continue
;
}
JsfMenuitem
thisitem
=
new
JsfMenuitem
(
m
);
JsfMenuitem
thisitem
=
new
JsfMenuitem
(
m
);
if
(
m
.
getItem
()
==
null
&&
m
.
getSitepage
()
==
null
)
if
(
m
.
getItem
()
==
null
&&
m
.
getSitepage
()
==
null
)
{
{
...
@@ -99,12 +114,11 @@ public class MenuView {
...
@@ -99,12 +114,11 @@ public class MenuView {
}
}
}
}
logger
.
info
(
"Trying to add topmenu {}"
,
m
.
getKey
());
if
(
thisitem
.
getOutcome
()
!=
null
)
if
(
thisitem
.
getOutcome
()
!=
null
)
{
{
topmenu
.
add
(
thisitem
);
topmenu
.
add
(
thisitem
);
if
(
m
.
equals
(
topPage
))
{
if
(
m
enupath
.
contains
(
m
))
{
thisitem
.
setSelected
();
thisitem
.
setSelected
();
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment