Commit 807d5b31 by Antti Tonkyra

Merge branch 'devel' of codecrew.fi:bortal into devel

2 parents 79149978 51984c35
...@@ -14,16 +14,35 @@ ...@@ -14,16 +14,35 @@
<h1>#{i18n['user.edit.title']}</h1> <h1>#{i18n['user.edit.title']}</h1>
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
<h:form> <h:form>
<h:outputText value="#{userCartView.current+1}" /> / <h:outputText value="#{userCartView.userCartSize}" /> <h:outputText value="#{userCartView.current+1}" /> / <h:outputText value="#{userCartView.userCartSize}" />
<h:commandButton action="#{userCartView.prev()}" value="#{i18n['usercart.prev']}" rendered="#{userCartView.current > 0}" /> <h:commandButton action="#{userCartView.prev()}" value="#{i18n['usercart.prev']}" rendered="#{userCartView.current > 0}" />
<h:commandButton action="#{userCartView.removeCurrent()}" value="#{i18n['usercart.removeCurrent']}" /> <h:commandButton action="#{userCartView.removeCurrent()}" value="#{i18n['usercart.removeCurrent']}" />
<h:commandButton action="#{userCartView.next()}" value="#{i18n['usercart.next']}" rendered="#{userCartView.userCartSize > (userCartView.current+1)}" /></h:form> <h:commandButton action="#{userCartView.next()}" value="#{i18n['usercart.next']}" rendered="#{userCartView.userCartSize > (userCartView.current+1)}" />
<h:link outcome="/card/massprint" value="Mass Print"> </h:form>
<f:param name="cid" value="#{javax.enterprise.context.conversation.id}"/>
</h:link> <ui:fragment rendered="#{userView.hasPrintedCard}">
<h2>Card</h2>
<h:form>
<p:panelGrid columns="2">
<h:outputText value="#{i18n[card.name]}" />
<h:outputText value="#{userView.printedCard.template.name}" />
<h:selectOneMenu value="#{userView.printedCard.cardState}">
<f:selectItems value="#{userView.printedCardStates}" />
</h:selectOneMenu>
<h:commandButton action="#{userView.setCardState()}" value="#{i18n['printedCard.setState']}" />
</p:panelGrid>
</h:form>
</ui:fragment>
<h:link outcome="/card/massprint" value="Mass Print">
<f:param name="cid" value="#{javax.enterprise.context.conversation.id}" />
</h:link>
<p> <p>
...@@ -46,11 +65,11 @@ ...@@ -46,11 +65,11 @@
</div> </div>
<h:commandButton action="#{userView.saveRoles}" value="#{i18n['user.saveRoles']}" /> <h:commandButton action="#{userView.saveRoles}" value="#{i18n['user.saveRoles']}" />
</h:form> </h:form>
<h:form> <h:form>
<p:imageCropper value="#{userView.croppedImage}" aspectRatio="0.7317073170731707" image="/dydata/userimage/#{userView.user.currentImage.id}.jpg" /> <p:imageCropper value="#{userView.croppedImage}" aspectRatio="0.7317073170731707" image="/dydata/userimage/#{userView.user.currentImage.id}.jpg" />
<h:commandButton action="#{userView.crop}" value="#{i18n['user.cropImage']}" /> <h:commandButton action="#{userView.crop}" value="#{i18n['user.cropImage']}" />
</h:form> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
...@@ -2,12 +2,11 @@ package fi.codecrew.moya.rest.pojo; ...@@ -2,12 +2,11 @@ package fi.codecrew.moya.rest.pojo;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class CardRoot { public class CardRoot {
@XmlElementWrapper(name = "cards") //@XmlElementWrapper(name = "cards")
private List<PrintedCardRestPojo> cards; private List<PrintedCardRestPojo> cards;
public List<PrintedCardRestPojo> getCards() { public List<PrintedCardRestPojo> getCards() {
......
...@@ -2,27 +2,26 @@ package fi.codecrew.moya.rest.pojo; ...@@ -2,27 +2,26 @@ package fi.codecrew.moya.rest.pojo;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class ReaderEventRestRoot { public class ReaderEventRestRoot {
@XmlElementWrapper(name = "readerEvents") // @XmlElementWrapper(name = "readerEvents")
private List<ReaderEventRestPojo> readers; private List<ReaderEventRestPojo> readerEvents;
public ReaderEventRestRoot() { public ReaderEventRestRoot() {
} }
public ReaderEventRestRoot(List<ReaderEventRestPojo> parsed) { public ReaderEventRestRoot(List<ReaderEventRestPojo> parsed) {
readers = parsed; setReaderEvents(parsed);
} }
public List<ReaderEventRestPojo> getReaders() { public List<ReaderEventRestPojo> getReaderEvents() {
return readers; return readerEvents;
} }
public void setReaders(List<ReaderEventRestPojo> readers) { public void setReaderEvents(List<ReaderEventRestPojo> readerEvents) {
this.readers = readers; this.readerEvents = readerEvents;
} }
} }
...@@ -2,12 +2,11 @@ package fi.codecrew.moya.rest.pojo; ...@@ -2,12 +2,11 @@ package fi.codecrew.moya.rest.pojo;
import java.util.List; import java.util.List;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement @XmlRootElement
public class ReaderRestRoot { public class ReaderRestRoot {
@XmlElementWrapper(name = "readers") //@XmlElementWrapper(name = "readers")
private List<ReaderRestPojo> readers; private List<ReaderRestPojo> readers;
public ReaderRestRoot() { public ReaderRestRoot() {
......
...@@ -33,7 +33,7 @@ public class UserCartView extends GenericCDIView { ...@@ -33,7 +33,7 @@ public class UserCartView extends GenericCDIView {
@Inject @Inject
private UserView userview; private UserView userview;
@Inject @Inject
private UserOverviewView userOverviewView; private UserOverviewView userOverviewView;
...@@ -124,7 +124,7 @@ public class UserCartView extends GenericCDIView { ...@@ -124,7 +124,7 @@ public class UserCartView extends GenericCDIView {
userOverviewView.initView(); userOverviewView.initView();
return "/useradmin/overview"; return "/useradmin/overview";
} }
public String saveUser() { public String saveUser() {
userview.saveUser(); userview.saveUser();
return null; return null;
...@@ -142,6 +142,7 @@ public class UserCartView extends GenericCDIView { ...@@ -142,6 +142,7 @@ public class UserCartView extends GenericCDIView {
if (u != null) { if (u != null) {
userview.setUserid(u.getUser().getId()); userview.setUserid(u.getUser().getId());
userview.setUser(null); userview.setUser(null);
userview.setPrintedCard(null);
userview.initView(); userview.initView();
} }
} }
......
...@@ -264,7 +264,7 @@ public class UserView extends GenericCDIView { ...@@ -264,7 +264,7 @@ public class UserView extends GenericCDIView {
if (user != null && userid != null && !user.getId().equals(userid)) { if (user != null && userid != null && !user.getId().equals(userid)) {
user = null; user = null;
} }
printedCard = null;
if (super.requirePermissions(UserPermission.VIEW_SELF) && user == null) { if (super.requirePermissions(UserPermission.VIEW_SELF) && user == null) {
getSelectedUser(); getSelectedUser();
canSave = getCurrentUser().equals(user) || permbean.hasPermission(UserPermission.MODIFY); canSave = getCurrentUser().equals(user) || permbean.hasPermission(UserPermission.MODIFY);
...@@ -325,6 +325,11 @@ public class UserView extends GenericCDIView { ...@@ -325,6 +325,11 @@ public class UserView extends GenericCDIView {
return permbean.isCurrentUser(user); return permbean.isCurrentUser(user);
} }
public boolean isHasPrintedCard()
{
return getPrintedCard() != null;
}
public String setCardState() public String setCardState()
{ {
printedCard = cardBean.saveCard(printedCard); printedCard = cardBean.saveCard(printedCard);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!