Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cb29725f
authored
Jan 30, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'infomap' into 'master'
Map stuff into info Info mapstuff See merge request
!242
2 parents
dd068d5b
9020ad43
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
241 additions
and
23 deletions
code/moya-beans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
code/moya-restpojo/pom.xml
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/placemap/v1/SimplePlacePojo.java
code/moya-web/WebContent/info/usermapsearch.xhtml
code/moya-web/WebContent/info/viplist.xhtml
code/moya-web/WebContent/resources/seatjs/d3-tip.js
code/moya-web/WebContent/resources/seatjs/seatmap.js
code/moya-web/WebContent/resources/templates/infoview/css/style.css
code/moya-web/pom.xml
code/moya-web/src/main/java/fi/codecrew/moya/rest/PojoUtils.java
code/moya-web/src/main/java/fi/codecrew/moya/rest/placemap/v1/PlacemapRestViewV1.java
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/AjaxMapView.java
code/moya-web/src/main/java/fi/codecrew/moya/web/flow/UserMapSearchView.java
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n.properties
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_en.properties
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_fi.properties
code/moya-beans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
cb29725
...
...
@@ -358,6 +358,7 @@ public class MenuBean implements MenuBeanLocal {
infonavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/info/cardlessIncoming"
),
TerminalPermission
.
INFO
);
infonavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/info/shop"
),
TerminalPermission
.
INFO
);
infonavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/info/foodwave/foodwaveshop"
),
TerminalPermission
.
INFO
);
infonavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/info/usermapsearch"
),
TerminalPermission
.
INFO
);
infonavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/info/viplist"
),
TerminalPermission
.
INFO
);
infonavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/info/foodwave/foodwaveProducts"
),
TerminalPermission
.
INFO
).
setVisible
(
false
);
...
...
code/moya-restpojo/pom.xml
View file @
cb29725
...
...
@@ -3,7 +3,7 @@
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
moya-restpojo
</artifactId>
<groupId>
fi.codecrew.moya
</groupId>
<version>
1.0.
6
</version>
<version>
1.0.
7
</version>
<build>
<plugins>
<plugin>
...
...
code/moya-restpojo/src/main/java/fi/codecrew/moya/rest/pojo/placemap/v1/SimplePlacePojo.java
View file @
cb29725
...
...
@@ -11,6 +11,8 @@ public class SimplePlacePojo {
private
Integer
y
;
private
Integer
width
;
private
Integer
height
;
private
String
userDescription
;
public
SimplePlacePojo
()
{
super
();
...
...
@@ -80,4 +82,11 @@ public class SimplePlacePojo {
this
.
height
=
height
;
}
public
String
getUserDescription
()
{
return
userDescription
;
}
public
void
setUserDescription
(
String
userDescription
)
{
this
.
userDescription
=
userDescription
;
}
}
code/moya-web/WebContent/info/usermapsearch.xhtml
0 → 100644
View file @
cb29725
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.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"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
xmlns:p=
"http://primefaces.org/ui"
xmlns:shop=
"http://java.sun.com/jsf/composite/cditools/shop"
xmlns:reader=
"http://java.sun.com/jsf/composite/cditools/reader"
xmlns:tools=
"http://java.sun.com/jsf/composite/cditools"
xmlns:user=
"http://java.sun.com/jsf/composite/cditools/user"
xmlns:infoview=
"http://java.sun.com/jsf/composite/cditools/infoview"
>
<h:body>
<ui:composition
template=
"/resources/templates/#{sessionHandler.infoscreen}/template.xhtml"
>
<ui:param
name=
"ignorenavigationleft"
value=
"true"
/>
<f:metadata>
<f:viewParam
name=
"userid"
value=
"#{userView.userid}"
/>
<f:event
type=
"preRenderView"
listener=
"#{cardlessIncomingView.initView}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<reader:backendReader
selectvalue=
"#{i18n['barcodeReader.readBarcode']}"
selectaction=
"#{cardlessIncomingView.polledRead}"
/>
<br
/><br
/>
<infoview:usermultisearch
/>
<br
/><br
/>
<h1>
Showing places to user: #{userView.selectedUser.user.nick}
</h1>
<br
/><br
/>
<h:outputScript
target=
"head"
library=
"seatjs"
name=
"d3.min.js"
/>
<h:outputScript
target=
"head"
library=
"seatjs"
name=
"d3-tip.js"
/>
<h:outputScript
target=
"head"
library=
"seatjs"
name=
"seatmap.js"
/>
<h:outputStylesheet
library=
"seatjs"
name=
"placemap.css"
/>
<svg
id=
"seatmap"
style=
"margin: auto; border: 1px solid black;"
width=
"#{ajaxMapView.map.width}px"
height=
"#{ajaxMapView.map.height}px"
/>
<script
type=
"text/javascript"
>
// If queue is enabled, do not allow clicking of places.
px
=
placemap
({
element
:
document
.
getElementById
(
"seatmap"
),
moyaurl
:
"#{request.contextPath}"
,
map_id
:
#
{
ajaxMapView
.
map
.
id
},
placereserve
:
false
,
onclick
:
function
(
d
)
{},
hilightUser
:
#
{
userView
.
selectedUser
.
user
.
id
},
tooltip
:
function
(
d
)
{
return
'<span style="font-size: 180%; font-weight: bold;">'
+
d
.
name
+
"</span><br /><br />"
+
((
d
.
userDescription
)?
d
.
userDescription
:
" - "
)
;
}
});
</script>
</ui:define>
<ui:define
name=
"sidebar"
>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/moya-web/WebContent/info/viplist.xhtml
View file @
cb29725
...
...
@@ -22,7 +22,8 @@
</p:outputPanel>
</f:facet>
<p:column
headerText=
"#{i18n['vip.hostsName']}"
filterBy=
"#{vip.host.wholeName}"
filterMatchMode=
"contains"
>
<h:outputText
value=
"#{vip.host.wholeName}"
/>
<h:outputText
id=
"viphostsname"
value=
"#{vip.host.wholeName}"
/>
<p:tooltip
id=
"viphostsnamephone"
for=
"viphostsname"
value=
"#{vip.host.phone}"
/>
</p:column>
<p:column
headerText=
"#{i18n['vip.description']}"
filterBy=
"#{vip.description}"
filterMatchMode=
"contains"
>
<h:outputText
id=
"vipdescr"
value=
"#{vip.shortDisplayDescr}"
title=
"#{vip.description}"
/>
...
...
code/moya-web/WebContent/resources/seatjs/d3-tip.js
View file @
cb29725
...
...
@@ -42,6 +42,7 @@
// Returns a tip
tip
.
show
=
function
()
{
var
args
=
Array
.
prototype
.
slice
.
call
(
arguments
)
if
(
args
[
args
.
length
-
1
]
instanceof
SVGElement
)
target
=
args
.
pop
()
var
content
=
html
.
apply
(
this
,
args
),
...
...
@@ -57,6 +58,7 @@
.
style
({
opacity
:
1
,
'pointer-events'
:
'all'
})
while
(
i
--
)
nodel
.
classed
(
directions
[
i
],
false
)
coords
=
direction_callbacks
.
get
(
dir
).
apply
(
this
)
nodel
.
classed
(
dir
,
true
).
style
({
top
:
(
coords
.
top
+
poffset
[
0
])
+
scrollTop
+
'px'
,
...
...
code/moya-web/WebContent/resources/seatjs/seatmap.js
View file @
cb29725
...
...
@@ -35,6 +35,14 @@ function placemap(opts)
{
opts
.
placereserve
=
false
;
}
if
(
opts
.
tooltip
===
undefined
)
{
opts
.
tooltip
=
function
(
d
)
{
return
"<strong>"
+
d
.
name
+
"</strong>"
;
};
}
if
(
opts
.
hilightUser
===
undefined
)
{
opts
.
hilightUser
=
false
;
}
// px is returned object
...
...
@@ -109,17 +117,13 @@ function placemap(opts)
var
tip
=
d3
.
tip
()
.
attr
(
'class'
,
'place-tooltip'
)
.
offset
([
-
10
,
0
])
.
html
(
function
(
d
)
{
return
"<strong>"
+
d
.
name
+
"</strong>"
;
});
.
html
(
opts
.
tooltip
);
// TODO: Fix this tip layout
var
tip_updown
=
d3
.
tip
().
direction
(
"s"
)
.
attr
(
'class'
,
'place-tooltip-upside'
)
.
offset
([
10
,
0
])
.
html
(
function
(
d
)
{
return
"<strong>"
+
d
.
name
+
"</strong>"
;
});
.
html
(
opts
.
tooltip
);
function
draw_guides
(
x1
,
y1
,
x2
,
y2
,
fade
)
{
...
...
@@ -212,6 +216,8 @@ function placemap(opts)
function
show_tooltip
(
d
,
i
)
{
var
object
=
{
x
:
d3
.
select
(
this
).
attr
(
'x'
),
y
:
d3
.
select
(
this
).
attr
(
'y'
),
...
...
@@ -403,7 +409,13 @@ function placemap(opts)
}
px
.
update
=
function
()
{
d3
.
json
(
px
.
moyaurl
+
"/rest/placemap/v1/"
+
px
.
map_id
+
"/places"
,
function
(
data
)
{
var
url
=
px
.
moyaurl
+
"/rest/placemap/v1/"
+
px
.
map_id
+
"/places"
;
if
(
opts
.
hilightUser
)
{
url
=
px
.
moyaurl
+
"/rest/placemap/v1/"
+
px
.
map_id
+
"/hilightedPlaces/"
+
opts
.
hilightUser
;
}
d3
.
json
(
url
,
function
(
data
)
{
draw_places
(
data
.
places
,
true
);
});
};
...
...
@@ -432,7 +444,7 @@ function placemap(opts)
else
if
(
data
.
places
[
0
].
state
==
"T"
)
{
// tän korjaus sotki ehkä jotain, otetaan poies
//PF("messages_growl").show([{"summary":px.locales[
p
x.locale].success_reserve, "detail":"", "severity":"info"}]);
//PF("messages_growl").show([{"summary":px.locales[x.locale].success_reserve, "detail":"", "severity":"info"}]);
px
.
selected_count
++
;
}
else
if
(
data
.
places
[
0
].
state
==
"F"
)
{
...
...
code/moya-web/WebContent/resources/templates/infoview/css/style.css
View file @
cb29725
...
...
@@ -318,5 +318,9 @@ label {
padding
:
10px
;
}
.place-tooltip
{
text-align
:
center
;
}
\ No newline at end of file
code/moya-web/pom.xml
View file @
cb29725
...
...
@@ -45,7 +45,7 @@
<dependency>
<groupId>
fi.codecrew.moya
</groupId>
<artifactId>
moya-restpojo
</artifactId>
<version>
1.0.
6
</version>
<version>
1.0.
7
</version>
</dependency>
</dependencies>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/PojoUtils.java
View file @
cb29725
...
...
@@ -219,47 +219,66 @@ public class PojoUtils {
}
public
static
SimplePlacelistRoot
parseSimplePlaces
(
List
<
Place
>
places
,
EventUser
user
)
public
static
SimplePlacelistRoot
parseSimplePlaces
(
List
<
Place
>
places
,
EventUser
user
,
boolean
hasPermissionViewAllusers
)
{
return
parseSimplePlaces
(
places
,
user
,
hasPermissionViewAllusers
,
false
);
}
public
static
SimplePlacelistRoot
parseSimplePlaces
(
List
<
Place
>
places
,
EventUser
user
,
boolean
hasPermissionViewAllusers
,
boolean
onlyHilightPlaces
)
{
SimplePlacelistRoot
ret
=
new
SimplePlacelistRoot
();
ArrayList
<
SimplePlacePojo
>
placeList
=
new
ArrayList
<
SimplePlacePojo
>();
ArrayList
<
SimplePlacePojo
>
placeList
=
new
ArrayList
<>();
ret
.
setPlaces
(
placeList
);
for
(
Place
p
:
places
)
{
placeList
.
add
(
initSimplePlacePojo
(
p
,
user
));
placeList
.
add
(
initSimplePlacePojo
(
p
,
user
,
hasPermissionViewAllusers
,
onlyHilightPlaces
));
}
return
ret
;
}
private
static
SimplePlacePojo
initSimplePlacePojo
(
Place
p
,
EventUser
user
)
{
private
static
SimplePlacePojo
initSimplePlacePojo
(
Place
p
,
EventUser
user
,
boolean
hasPermissionViewAllusers
,
boolean
onlyHilightPlaces
)
{
SimplePlacePojo
ret
=
new
SimplePlacePojo
();
ret
.
setId
(
p
.
getId
());
ret
.
setName
(
p
.
getName
());
String
state
=
null
;
if
(
hasPermissionViewAllusers
)
{
if
(
p
.
getPlaceReserver
()
!=
null
)
{
if
(
p
.
getPlaceReserver
().
getUser
()
!=
null
)
{
ret
.
setUserDescription
(
p
.
getPlaceReserver
().
getUser
().
getUser
().
getShortUserDescriptor
());
}
else
if
(
p
.
getPlaceReserver
().
getPlaceGroup
()
!=
null
&&
p
.
getPlaceReserver
().
getPlaceGroup
().
getCreator
()
!=
null
)
{
ret
.
setUserDescription
(
p
.
getPlaceReserver
().
getPlaceGroup
().
getCreator
().
getUser
().
getShortUserDescriptor
());
}
}
}
switch
(
p
.
getState
(
user
))
{
case
DISABLED:
state
=
"D"
;
state
=
(
onlyHilightPlaces
)?
"F"
:
"D"
;
break
;
case
FREE:
state
=
"F"
;
break
;
case
LOCKED:
state
=
"L"
;
state
=
(
onlyHilightPlaces
)?
"F"
:
"L"
;
break
;
case
MY_PLACE:
state
=
"P"
;
break
;
case
RESERVED:
state
=
"R"
;
state
=
(
onlyHilightPlaces
)?
"F"
:
"R"
;
break
;
case
TEMP_RESERVED_FORME:
state
=
"T"
;
state
=
(
onlyHilightPlaces
)?
"F"
:
"T"
;
break
;
default
:
break
;
}
if
(
onlyHilightPlaces
)
{
}
ret
.
setState
(
state
);
ret
.
setX
(
p
.
getMapX
());
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/placemap/v1/PlacemapRestViewV1.java
View file @
cb29725
...
...
@@ -17,6 +17,8 @@ import javax.ws.rs.core.MediaType;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response.ResponseBuilder
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -94,6 +96,28 @@ public class PlacemapRestViewV1 {
}
@GET
@Path
(
"{id}/hilightedPlaces/{userid}"
)
public
Response
getHilightedPlaces
(
@PathParam
(
"id"
)
Integer
mapId
,
@PathParam
(
"userid"
)
Integer
userId
)
{
EventMap
map
=
placebean
.
findMap
(
mapId
);
if
(!
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
))
{
return
Response
.
status
(
Response
.
Status
.
FORBIDDEN
).
entity
(
"Try to login first!"
).
build
();
}
EventUser
user
=
userbean
.
findByUserId
(
userId
,
false
);
if
(
user
==
null
)
{
return
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
).
entity
(
"No User found for id: "
+
userId
).
build
();
}
return
Response
.
ok
(
PojoUtils
.
parseSimplePlaces
(
map
.
getPlaces
(),
user
,
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
),
true
)).
build
();
}
@GET
@Path
(
"{id}/places"
)
public
SimplePlacelistRoot
getPlaces
(
@PathParam
(
"id"
)
Integer
mapId
)
...
...
@@ -104,16 +128,16 @@ public class PlacemapRestViewV1 {
if
(
userView
!=
null
)
{
user
=
userView
.
getSelectedUser
();
}
return
PojoUtils
.
parseSimplePlaces
(
map
.
getPlaces
(),
user
);
return
PojoUtils
.
parseSimplePlaces
(
map
.
getPlaces
(),
user
,
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
)
);
}
@GET
@Path
(
"/place/{place}"
)
public
SimplePlacelistRoot
getPlace
(
@PathParam
(
"place"
)
Integer
placeId
)
{
List
<
Place
>
thisplace
=
new
ArrayList
<
Place
>();
List
<
Place
>
thisplace
=
new
ArrayList
<>();
thisplace
.
add
(
placebean
.
find
(
placeId
));
return
PojoUtils
.
parseSimplePlaces
(
thisplace
,
permbean
.
getCurrentUser
());
return
PojoUtils
.
parseSimplePlaces
(
thisplace
,
permbean
.
getCurrentUser
()
,
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
)
);
}
@GET
...
...
@@ -169,7 +193,7 @@ public class PlacemapRestViewV1 {
p
=
placebean
.
find
(
placeId
);
List
<
Place
>
thisplace
=
new
ArrayList
<
Place
>();
thisplace
.
add
(
p
);
resp
=
Response
.
ok
(
PojoUtils
.
parseSimplePlaces
(
thisplace
,
user
));
resp
=
Response
.
ok
(
PojoUtils
.
parseSimplePlaces
(
thisplace
,
user
,
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
)
));
}
else
{
resp
=
Response
.
status
(
Response
.
Status
.
FORBIDDEN
);
}
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/cdiview/map/AjaxMapView.java
View file @
cb29725
...
...
@@ -255,6 +255,9 @@ public class AjaxMapView extends GenericCDIView {
}
public
EventMap
getMap
()
{
if
(
map
==
null
)
return
initMap
();
return
map
;
}
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/flow/UserMapSearchView.java
0 → 100644
View file @
cb29725
/*
* 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
.
moya
.
web
.
flow
;
import
fi.codecrew.moya.beans.PlaceBeanLocal
;
import
fi.codecrew.moya.beans.PlaceGroupBeanLocal
;
import
fi.codecrew.moya.beans.ProductBeanLocal
;
import
fi.codecrew.moya.beans.TicketBeanLocal
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.GroupMembership
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.model.ReaderEvent
;
import
fi.codecrew.moya.utilities.I18n
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.map.AjaxMapView
;
import
fi.codecrew.moya.web.cdiview.reader.ReaderView
;
import
fi.codecrew.moya.web.cdiview.user.UserView
;
import
fi.codecrew.moya.web.helpers.ProductSummaryWrapper
;
import
org.primefaces.event.SelectEvent
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.faces.application.FacesMessage
;
import
javax.faces.context.FacesContext
;
import
javax.faces.model.ListDataModel
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
java.util.ArrayList
;
import
java.util.List
;
@Named
@ConversationScoped
public
class
UserMapSearchView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
-
715517L
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserMapSearchView
.
class
);
@Inject
private
UserView
userview
;
@Inject
private
InfoView
infoView
;
@Inject
private
AjaxMapView
ajaxMapView
;
boolean
initialized
=
false
;
public
void
initView
()
{
if
(!
initialized
)
{
super
.
beginConversation
();
initialized
=
true
;
}
ajaxMapView
.
initViewMap
();
}
}
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n.properties
View file @
cb29725
...
...
@@ -510,3 +510,4 @@ vipProduct.quantity = Lukum\u00E4\u00E4r\u00E4
yes
=
Kyll
\u
00E4
vip.backToList
=
Takaisin listaukseen
submenu.info.viplist
=
Vippilista
submenu.info.usermapsearch
=
Karttahaku
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_en.properties
View file @
cb29725
...
...
@@ -1727,3 +1727,4 @@ voting.create.voteStart = Voting start
yes
=
Yes
vip.backToList
=
Back to viplist list
submenu.info.viplist
=
Viplist
submenu.info.usermapsearch
=
Mapsearch
code/moya-web/src/main/resources/fi/codecrew/moya/resources/i18n_fi.properties
View file @
cb29725
...
...
@@ -1710,3 +1710,4 @@ voting.create.voteStart = \u00C4\u00E4nestys auki
yes
=
Kyll
\u
00E4
vip.backToList
=
Takaisin listaukseen
submenu.info.viplist
=
Vippilista
submenu.info.usermapsearch
=
Karttahaku
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