Commit c0260079 by Tuomas Riihimäki

Add width and height for map svg

1 parent ae1af53c
......@@ -40,7 +40,7 @@
<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="1200px" height="800px" />
width="#{ajaxMapView.map.width}px" height="#{ajaxMapView.map.width}px" />
<script type="text/javascript">
px = placemap({
element : document.getElementById("seatmap"),
......
......@@ -19,8 +19,16 @@
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['eventmap.name']}:" />
<h:inputText value="#{mapManageView.map.name}" />
<h:outputLabel value="#{i18n['eventmap.width']}:" />
<h:inputText value="#{mapManageView.map.width}" />
<h:outputLabel value="#{i18n['eventmap.height']}:" />
<h:inputText value="#{mapManageView.map.height}" />
<h:outputLabel value="#{i18n['eventmap.notes']}:" />
<h:inputTextarea cols="40" rows="5" value="#{mapManageView.map.notes}" />
<h:outputLabel value="#{i18n['eventmap.active']}:" />
<h:selectBooleanCheckbox value="#{mapManageView.map.active}" />
......
package fi.codecrew.moya.web.cdiview.map;
import java.util.List;
import java.util.Map;
import javax.ejb.EJB;
......@@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PlaceBeanLocal;
import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.Place;
......@@ -22,30 +24,63 @@ import fi.codecrew.moya.web.cdiview.GenericCDIView;
@ConversationScoped
public class AjaxMapView extends GenericCDIView {
/**
*
*/
private static final long serialVersionUID = 8203589456357519480L;
@Inject
private PlaceView placeview;
private static final Logger logger = LoggerFactory.getLogger(AjaxMapView.class);;
private String testVal = "Testval1";
@EJB
private EventBeanLocal eventbean;
private transient EventBeanLocal eventbean;
@EJB
private PlaceBeanLocal placebean;
private transient PlaceBeanLocal placebean;
@Inject
private transient FacesContext context;
private EventMap map;
private Place place;
private Integer mapId;
public void initReserveMap() {
initMap();
map = placebean.findMap(mapId);
}
public void initViewMap() {
initMap();
}
private void initMap() {
if (mapId != null) {
map = placebean.findMap(mapId);
}
if (map == null) {
List<EventMap> maps = placebean.getMaps();
if (maps != null && !maps.isEmpty()) {
for (EventMap m : maps) {
if (m.isActive()) {
this.map = m;
break;
}
}
}
}
}
public void initMap() {
LanEvent e = eventbean.getCurrentEvent();
setMap(e.getEventMaps().get(0));
public boolean isMgmtPermission()
{
return permbean.hasPermission(MapPermission.MANAGE_OTHERS);
}
public void placeClicked()
{
FacesContext context = FacesContext.getCurrentInstance();
Map<String, String> vmap = context.getExternalContext().getRequestParameterMap();
logger.info("placeid {}", vmap.get("pl aceId"));
Map<String, String> vmap = context.getExternalContext().getRequestParameterMap();
int placeId = Integer.parseInt(vmap.get("placeId"));
place = placebean.find(placeId);
logger.info("Found place {} with placeid {}", place, placeId);
......@@ -74,4 +109,12 @@ public class AjaxMapView extends GenericCDIView {
public void setPlace(Place place) {
this.place = place;
}
public FacesContext getContext() {
return context;
}
public void setContext(FacesContext context) {
this.context = context;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!