Merge remote-tracking branch 'origin/jsf' into jsf

# Conflicts:
#	src/main/resources/META-INF/resources/admin/user.xhtml
This commit is contained in:
Anton Romanov 2020-04-24 22:51:45 +04:00
commit 6adb3fec71
4 changed files with 111 additions and 60 deletions

View File

@ -13,6 +13,7 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import java.io.Serializable; import java.io.Serializable;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
@Named @Named
@ -26,6 +27,10 @@ public class PaperView implements Serializable {
private Paper paper; private Paper paper;
private Date newDeadlineDate;
private String newDeadlineDescription;
@PostConstruct @PostConstruct
public void init() { public void init() {
paper = paperService.findPaperById(Integer.valueOf(FacesUtil.getRequestParams().get("id"))); paper = paperService.findPaperById(Integer.valueOf(FacesUtil.getRequestParams().get("id")));
@ -57,4 +62,20 @@ public class PaperView implements Serializable {
FacesUtil.showInfoMessage("Статья сохранена", ""); FacesUtil.showInfoMessage("Статья сохранена", "");
return Page.PAPER_LIST + "?faces-redirect=true"; return Page.PAPER_LIST + "?faces-redirect=true";
} }
public Date getNewDeadlineDate() {
return newDeadlineDate;
}
public void setNewDeadlineDate(Date newDeadlineDate) {
this.newDeadlineDate = newDeadlineDate;
}
public String getNewDeadlineDescription() {
return newDeadlineDescription;
}
public void setNewDeadlineDescription(String newDeadlineDescription) {
this.newDeadlineDescription = newDeadlineDescription;
}
} }

View File

@ -41,15 +41,6 @@
<p:message for="firstName"/> <p:message for="firstName"/>
</p:column> </p:column>
</p:row> </p:row>
<p:row>
<p:column>
<h:outputLabel value="Фамилия"/>
</p:column>
<p:column>
<p:inputText id="lastName" required="true" value="#{userView.user.lastName}"/>
<p:message for="lastName"/>
</p:column>
</p:row>
<p:row> <p:row>
<p:column> <p:column>
<h:outputLabel value="Отчество"/> <h:outputLabel value="Отчество"/>
@ -59,6 +50,15 @@
<p:message for="patr"/> <p:message for="patr"/>
</p:column> </p:column>
</p:row> </p:row>
<p:row>
<p:column>
<h:outputLabel value="Фамилия"/>
</p:column>
<p:column>
<p:inputText id="lastName" required="true" value="#{userView.user.lastName}"/>
<p:message for="lastName"/>
</p:column>
</p:row>
<p:row> <p:row>
<p:column> <p:column>
<h:outputLabel value="Email"/> <h:outputLabel value="Email"/>

View File

@ -2,7 +2,8 @@
<html xmlns="http://www.w3.org/1999/xhtml" <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://xmlns.jcp.org/jsf/facelets" xmlns:p="http://primefaces.org/ui"
xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://java.sun.com/jsf/core"> xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
>
<ui:composition template="/basicTemplate.xhtml"> <ui:composition template="/basicTemplate.xhtml">
<ui:define name="header"> <ui:define name="header">
Редактирование статьи Редактирование статьи
@ -32,23 +33,31 @@
</style> </style>
<p:panel id="panel" header="Статья" style="margin-bottom:10px;"> <p:panel id="panel" header="Статья" style="margin-bottom:10px;">
<p:panelGrid cellpadding="5" id="paperPanel"> <p:panelGrid cellpadding="5" id="paperPanel">
<p:row>
<p:column>
</p:panelGrid>
<div class="ui-fluid">
<div class="ui-g">
<div class="ui-md-3 ui-g-12">
<h:outputLabel value="Название:"/> <h:outputLabel value="Название:"/>
</p:column> </div>
<p:column> <div class="ui-md-7 ui-g-12">
<p:inputText id="name" required="true" value="#{paperView.paper.title}"/> <p:inputText id="name" required="true" value="#{paperView.paper.title}"/>
<p:message for="name"/> <p:message for="name"/>
</p:column> </div>
<p:column> <div class="ui-md-2 ui-g-12">
<p:link href="/conference/conferenceList.xhtml" value="Статья участвует в конференции"/> <p:link href="/conference/conferenceList.xhtml?id=paperView.paper.conferences[0].id"
</p:column> value="Статья участвует в конференции"
</p:row> rendered="#{not empty paperView.paper.conferences}"/>
<p:row>
<p:column> <p:commandButton value="Привязать к конференции"
rendered="#{empty paperView.paper.conferences}"
disabled="true"/>
</div>
<div class="ui-md-3 ui-g-12">
<p:outputLabel for="paperStatus" value="Статус:"/> <p:outputLabel for="paperStatus" value="Статус:"/>
</p:column> </div>
<p:column> <div class="ui-md-7 ui-g-12">
<p:panelGrid columns="2" id="paperStatus"> <p:panelGrid columns="2" id="paperStatus">
<p:selectOneMenu id="status" required="true" value="#{paperView.paper.status}" <p:selectOneMenu id="status" required="true" value="#{paperView.paper.status}"
converter="paperStatusConverter"> converter="paperStatusConverter">
@ -63,13 +72,11 @@
<ui:param name="shortMode" value="true"/> <ui:param name="shortMode" value="true"/>
</ui:include> </ui:include>
</p:panelGrid> </p:panelGrid>
</p:column> </div>
</p:row> <div class="ui-md-3 ui-g-12">
<p:row>
<p:column>
<p:outputLabel for="type" value="Тип:"/> <p:outputLabel for="type" value="Тип:"/>
</p:column> </div>
<p:column> <div class="ui-md-7 ui-g-12">
<p:selectOneMenu id="type" value="#{paperView.paper.type}" <p:selectOneMenu id="type" value="#{paperView.paper.type}"
converter="paperTypeConverter"> converter="paperTypeConverter">
<f:selectItems value="#{paperView.paperTypes}" <f:selectItems value="#{paperView.paperTypes}"
@ -77,23 +84,11 @@
itemLabel="#{type.typeName}" itemLabel="#{type.typeName}"
itemValue="#{type}"/> itemValue="#{type}"/>
</p:selectOneMenu> </p:selectOneMenu>
</p:column> </div>
</p:row> <div class="ui-md-3 ui-g-12">
<p:row>
<p:column>
<p:outputLabel for="comment" value="Комментарий:"/>
</p:column>
<p:column>
<p:editor id="comment" widgetVar="editor2" value="#{paperView.paper.comment}" height="300"
style="margin-bottom:10px" placeholder="Комментарий"/>
</p:column>
</p:row>
<p:row>
<p:column>
<p:outputLabel for="authors" value="Авторы:"/> <p:outputLabel for="authors" value="Авторы:"/>
</p:column> </div>
<p:column> <div class="ui-md-7 ui-g-12">
<p:selectCheckboxMenu id="authors" value="#{paperView.paper.authors}" multiple="true" <p:selectCheckboxMenu id="authors" value="#{paperView.paper.authors}" multiple="true"
converter="#{userConverter}"> converter="#{userConverter}">
<f:attribute name="collectionType" value="java.util.HashSet"/> <f:attribute name="collectionType" value="java.util.HashSet"/>
@ -102,16 +97,46 @@
itemLabel="#{author.userAbbreviate}" itemLabel="#{author.userAbbreviate}"
itemValue="#{author}"/> itemValue="#{author}"/>
</p:selectCheckboxMenu> </p:selectCheckboxMenu>
</p:column> </div>
</p:row> <div class="ui-md-3 ui-g-12">
<p:outputLabel for="authors" value="Ключевые даты:"/>
</div>
<div class="ui-md-7 ui-g-12">
<div class="ui-fluid">
<div class="ui-g">
<ui:repeat value="#{paperView.paper.deadlines}" var="deadline">
<div class="ui-md-5 ui-g-12">
<p:datePicker value="#{deadline.date}" pattern="dd.MM.yyyy"/>
</div>
<div class="ui-md-5 ui-g-12">
<p:inputText value="#{deadline.description}"/>
</div>
</ui:repeat>
<div class="ui-md-5 ui-g-12">
<p:datePicker value="#{paperView.newDeadlineDate}" placeholder="Введите дату"
pattern="dd.MM.yyyy"/>
</div>
<div class="ui-md-5 ui-g-12">
<p:inputText value="#{paperView.newDeadlineDescription}"
placeholder="Описание ключевой даты"/>
</div>
</div>
</div>
</div>
<p:row> <div class="ui-md-3 ui-g-12">
<p:column> <p:outputLabel for="comment" value="Комментарий:"/>
</div>
<div class="ui-md-7 ui-g-12">
<p:editor id="comment" widgetVar="editor2" value="#{paperView.paper.comment}" height="300"
style="margin-bottom:10px" placeholder="Комментарий"/>
</div>
<div class="ui-md-5 ui-g-12">
<p:commandButton action="#{paperView.save}" value="Сохранить" ajax="true" process="@form" <p:commandButton action="#{paperView.save}" value="Сохранить" ajax="true" process="@form"
update="messages @form"/> update="messages @form"/>
</p:column> </div>
</p:row> </div>
</p:panelGrid> </div>
</p:panel> </p:panel>
</ui:define> </ui:define>
</ui:composition> </ui:composition>

View File

@ -13,7 +13,10 @@
<div class="ui-fluid"> <div class="ui-fluid">
<div class="ui-g"> <div class="ui-g">
<div class="ui-md-5 ui-g-12"> <div class="ui-md-5 ui-g-12">
<p:inputText placeholder="Создать новую статью" value="#{papersView.newPaperTitle}"/> <p:inputText placeholder="Создать новую статью" id="newPaperName"
value="#{papersView.newPaperTitle}" required="true"
requiredMessage="Введите название новой статьи"/>
<p:message for="newPaperName"/>
</div> </div>
<div class="ui-md-2 ui-g-12"> <div class="ui-md-2 ui-g-12">
<p:commandButton action="#{papersView.create}" value="Создать" ajax="true" process="@form" <p:commandButton action="#{papersView.create}" value="Создать" ajax="true" process="@form"
@ -23,8 +26,9 @@
<div class="ui-md-3 ui-g-12"> <div class="ui-md-3 ui-g-12">
<p:commandButton value="Удалить выделенные" id="papersRemoveButton" <p:commandButton value="Удалить выделенные" id="papersRemoveButton"
disabled="#{papersView.selectedPapers.isEmpty()}" disabled="#{papersView.selectedPapers.isEmpty()}"
action="#{papersView.deleteSelected}" ajax="true" process="@form" action="#{papersView.deleteSelected}" ajax="true"
update="messages @form"> process="mainForm:papersRemoveButton"
update="messages mainForm:papersTable">
<p:confirm header="Подтверждение" message="Удалить выделенные статьи?" <p:confirm header="Подтверждение" message="Удалить выделенные статьи?"
icon="pi pi-exclamation-triangle"/> icon="pi pi-exclamation-triangle"/>
</p:commandButton> </p:commandButton>
@ -32,7 +36,7 @@
<p:confirmDialog global="true" showEffect="fade" hideEffect="fade"> <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
<p:commandButton value="Да" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/> <p:commandButton value="Да" type="button" styleClass="ui-confirmdialog-yes" icon="pi pi-check"/>
<p:commandButton value="Нет" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/> <p:commandButton value="Нет" type="button" styleClass="ui-confirmdialog-no" icon="pi pi-times"/>
</p:confirmDialog>te </p:confirmDialog>
</div> </div>
<p:dataTable value="#{papersView.papers}" var="paper" paginator="true" paginatorPosition="bottom" <p:dataTable value="#{papersView.papers}" var="paper" paginator="true" paginatorPosition="bottom"
@ -46,10 +50,11 @@
placeholder="Строка поиска..."/> placeholder="Строка поиска..."/>
</p:outputPanel> </p:outputPanel>
</f:facet> </f:facet>
<p:ajax event="rowSelect" update="mainForm:papersRemoveButton" process="@form"/> <p:ajax event="rowSelect" update="mainForm:papersRemoveButton" process="mainForm:papersTable"/>
<p:ajax event="rowSelectCheckbox" update="mainForm:papersRemoveButton" process="@form"/> <p:ajax event="rowSelectCheckbox" update="mainForm:papersRemoveButton" process="mainForm:papersTable"/>
<p:ajax event="rowUnselectCheckbox" update="mainForm:papersRemoveButton" process="@form"/> <p:ajax event="rowUnselectCheckbox" update="mainForm:papersRemoveButton"
<p:ajax event="rowUnselect" update="mainForm:papersRemoveButton" process="@form"/> process="mainForm:papersTable"/>
<p:ajax event="rowUnselect" update="mainForm:papersRemoveButton" process="mainForm:papersTable"/>
<p:column selectionMode="multiple" style="width:16px;text-align:center"/> <p:column selectionMode="multiple" style="width:16px;text-align:center"/>
<p:column headerText="Название" filterBy="#{paper.title}" filterMatchMode="contains"> <p:column headerText="Название" filterBy="#{paper.title}" filterMatchMode="contains">
<h:outputLink value="/paper/paper.xhtml"> <h:outputLink value="/paper/paper.xhtml">