multitenant
Josef Rokos 11 years ago
commit c7d1c72ce0

@ -1,9 +1,12 @@
package info.bukova.isspst.services.requirement; package info.bukova.isspst.services.requirement;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.Requirement; import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementState;
import java.util.Date; import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -11,11 +14,16 @@ public class RequirementServiceImpl extends
RequirementBaseServiceImpl<Requirement> implements RequirementService, RequirementBaseServiceImpl<Requirement> implements RequirementService,
RequirementBaseService<Requirement> { RequirementBaseService<Requirement> {
@Autowired
private RequirementTypeService reqTypeService;
@Override @Override
protected Requirement createEntity() { protected Requirement createEntity() {
Requirement entity = new Requirement(); Requirement entity = new Requirement();
entity.setReqDate(new Date()); entity.setReqDate(new Date());
entity.setType(reqTypeService.getTypeById(Constants.REQTYPE_ORDER));
entity.setState(RequirementState.NEW);
return entity; return entity;
} }

@ -0,0 +1,51 @@
package info.bukova.isspst.ui;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zul.Window;
public class MainMenu
{
private String contextPath;
private String moduleUrl;
@Init
public void init()
{
this.contextPath = Executions.getCurrent().getContextPath();
this.moduleUrl = Executions.getCurrent().getDesktop().getRequestPath();
}
public String getContextPath()
{
return this.contextPath;
}
public String getModuleUrl()
{
return this.moduleUrl;
}
@Command
public void passwd()
{
Window window = (Window) Executions.createComponents("/app/passwd.zul", null, null);
window.doModal();
}
@Command
public void numSeries()
{
Window window = (Window) Executions.createComponents("/settings/numberSeries.zul", null, null);
window.doModal();
}
@Command
public void globalSettings()
{
Window window = (Window) Executions.createComponents("/settings/globalSettings.zul", null, null);
window.doModal();
}
}

@ -1,72 +0,0 @@
package info.bukova.isspst.ui;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zul.Window;
public class NavigationVM {
private String contextPath;
private String moduleUrl;
@Init
public void init() {
contextPath = Executions.getCurrent().getContextPath();
moduleUrl = Executions.getCurrent().getDesktop().getRequestPath();
}
@Command
public void passwd() {
Window window = (Window)Executions.createComponents("/app/passwd.zul", null, null);
window.doModal();
}
@Command
public void numSeries() {
Window window = (Window)Executions.createComponents("/settings/numberSeries.zul", null, null);
window.doModal();
}
@Command
public void globalSettings() {
Window window = (Window)Executions.createComponents("/settings/globalSettings.zul", null, null);
window.doModal();
}
public String getContextPath() {
return contextPath;
}
public String getModuleUrl() {
return moduleUrl;
}
public boolean isOrders() {
return moduleUrl.contains("orders");
}
public boolean isTrips() {
return moduleUrl.contains("trips");
}
public boolean isSettings() {
return moduleUrl.contains("settings");
}
public boolean isAdmin() {
return moduleUrl.contains("admin");
}
public boolean isUser() {
return moduleUrl.contains("passwd");
}
public boolean isLists() {
return moduleUrl.contains("lists");
}
public boolean isRequirements() {
return moduleUrl.contains("requirements");
}
}

@ -9,22 +9,21 @@ import org.zkoss.bind.annotation.NotifyChange;
public class RequirementSubpage<T extends RequirementBase> extends ListViewModel<T> { public class RequirementSubpage<T extends RequirementBase> extends ListViewModel<T> {
protected RequirementBaseService<T> reqService;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void init() { private RequirementBaseService<T> getReqService()
reqService = (RequirementBaseService<T>) service; {
return (RequirementBaseService<T>) service;
} }
@Override @Override
protected void loadLazyData(T data) { protected void loadLazyData(T data) {
reqService.loadAuthItems(data); this.getReqService().loadAuthItems(data);
} }
@Command @Command
@NotifyChange({"dataBean", "canApprove"}) @NotifyChange({"dataBean", "canApprove"})
public void approve() { public void approve() {
reqService.approve(getDataBean()); this.getReqService().approve(getDataBean());
} }
@Override @Override
@ -35,11 +34,9 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
public boolean isCanApprove() { public boolean isCanApprove() {
if (getDataBean() != null) { if (getDataBean() != null) {
return reqService.canApprove(getDataBean()); return this.getReqService().canApprove(getDataBean());
} }
return false; return false;
} }
} }

@ -32,7 +32,6 @@ public class TripRequirementListAll extends RequirementSubpage<TripRequirement>
allCentres = workgroupService.getCentres(); allCentres = workgroupService.getCentres();
allWorkgroups = workgroupService.getWorkgroups(); allWorkgroups = workgroupService.getWorkgroups();
super.init();
} }
@Override @Override

@ -33,7 +33,6 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
dataFilter = new TripRequirementFilter(getFilterTemplate()); dataFilter = new TripRequirementFilter(getFilterTemplate());
myCentres = workgroupService.getUserCentres(userService.getCurrent()); myCentres = workgroupService.getUserCentres(userService.getCurrent());
super.init();
} }
@Override @Override

@ -35,7 +35,6 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
myCentres = workgroupService.getUserCentres(userService.getCurrent()); myCentres = workgroupService.getUserCentres(userService.getCurrent());
myWorkgroups = workgroupService.getUserWorkgroups(userService.getCurrent()); myWorkgroups = workgroupService.getUserWorkgroups(userService.getCurrent());
super.init();
} }
@Override @Override

@ -1,13 +1,6 @@
# Default file # Default file
AppName=Objednávkový systém SPŠ Třebíč AppName=Objednávkový systém SPŠ Třebíč
MenuRequirements=Požadavky
MenuOrders=Objednávky
MenuLists=Seznamy
MenuSettings=Nastavení
MenuAdministration=Administrace
MenuUser=Uživatel
AgendaActRequirements=Aktuální požadavky AgendaActRequirements=Aktuální požadavky
AgendaRequirementsHistory=Ukončené požadavky AgendaRequirementsHistory=Ukončené požadavky
RequirementsFormTitle=Požadavek RequirementsFormTitle=Požadavek
@ -65,8 +58,6 @@ BuildingsGridColumnDescription=Popis
BuildingsGridRooms=Místnosti: BuildingsGridRooms=Místnosti:
AgendaRooms=Místnosti
AgendaRights=Práva AgendaRights=Práva
RightsFormTitle=Práva RightsFormTitle=Práva
RightsGridRole=Role RightsGridRole=Role
@ -140,7 +131,6 @@ LimitFormTitle=Limit pro schválení
Limit=Limit: Limit=Limit:
OverLimit=Pouze nadlimitní OverLimit=Pouze nadlimitní
NumberSeriesFormTitle=Číselné řady
Number=Číslo: Number=Číslo:
Prefix=Prefix: Prefix=Prefix:
@ -162,8 +152,6 @@ AccountNumber=Číslo účtu
CentresForRequirements=Střediska, pro která lze vkládat požadavky CentresForRequirements=Střediska, pro která lze vkládat požadavky
WorkgroupMembership=Členství v komisích WorkgroupMembership=Členství v komisích
LogedInUser=Přihlášený uživatel: LogedInUser=Přihlášený uživatel:
InfoReview=Přehled
Info=Informace
ButtonStorno=Storno ButtonStorno=Storno
ButtonSave=Uložit ButtonSave=Uložit
@ -205,9 +193,25 @@ DbValidationError=Chyba validace
true=Ano true=Ano
false=Ne false=Ne
Information=Informace
Requirements=Požadavky
Orders=Objednávky
BussinessTrips=Služební cesty
Lists=Seznamy
Settings=Nastavení
Administration=Administrace
Permissions=Práva
NumberSeries=Číselné řady
User=Uživatel
ChangePassword=Změnit heslo
Logout=Odhlásit
DateFormat=dd. MM. yyyy DateFormat=dd. MM. yyyy
AddItem=Přidat položku... AddItem=Přidat položku
RemoveItem=Smazat RemoveItem=Smazat
Amount=Částka Amount=Částka

@ -25,7 +25,7 @@
<textbox <textbox
value="@bind(vm.dataBean.username)" value="@bind(vm.dataBean.username)"
instant="true" instant="true"
disabled="@load(vm.edit)" disabled="@load(vm.editRec)"
onChange="@command('checkLogin')" /> onChange="@command('checkLogin')" />
<label <label
value="Login je obsazený" value="Login je obsazený"

@ -2,7 +2,7 @@
<zk> <zk>
<window border="normal" apply="org.zkoss.bind.BindComposer" <window border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.dashboard.DashBoardVM')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.dashboard.DashBoardVM')">
<caption zclass="form-caption" label="${labels.Info}" /> <caption zclass="form-caption" label="${labels.Information}" />
<vbox> <vbox>
<hbox> <hbox>
<label value="${labels.LogedInUser}"/> <image src="/img/user-small.png"/> <label value="@load(vm.user)"/> <label value="${labels.LogedInUser}"/> <image src="/img/user-small.png"/> <label value="@load(vm.user)"/>

@ -0,0 +1,89 @@
<?page title="Main Menu" contentType="text/html;charset=UTF-8"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?taglib uri="/WEB-INF/security.tld" prefix="sec"?>
<zk xmlns:n="native">
<menubar
id="menubar"
apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.MainMenu')"
autodrop="true">
<menuitem
label="${labels.Information}"
href="/" />
<menuseparator />
<menuitem
label="${labels.Requirements}"
href="/requirements/actual" />
<!-- menuitem
label="${labels.Orders}"
href="/orders/actual" /-->
<menuitem
label="${labels.BussinessTrips}"
href="/trips/requirement" />
<menuseparator />
<menu label="${labels.Lists}">
<menupopup>
<menuitem
label="${labels.AgendaMaterial}"
href="/lists/material"
disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}" />
<menuitem
label="${labels.AgendaServices}"
href="/lists/service"
disabled="${not sec:isAllGranted('PERM_READ_SERVICES')}" />
<menuitem
label="${labels.AgendaSuppliers}"
href="/lists/addressbook"
disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}" />
<menuitem
label="${labels.AgendaBuildings}"
href="/lists/buildings"
disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" />
<menuitem
label="${labels.AgendaMUnits}"
href="/lists/munits"
disabled="${not sec:isAllGranted('PERM_READ_MUNITS')}" />
</menupopup>
</menu>
<menu label="${labels.Settings}">
<menupopup>
<menuitem
label="${labels.GlobalSettings}…"
onClick="@command('globalSettings')" />
<menuitem
label="${labels.AgendaWorkflow}"
href="/settings/workflow"
disabled="${not sec:isAllGranted('PERM_EDIT_WORKFLOW')}" />
<menuitem
label="${labels.NumberSeries}…"
onClick="@command('numSeries')" />
<menu label="${labels.Administration}">
<menupopup>
<menuitem
label="${labels.AgendaUsers}"
href="/admin/users"
disabled="${not sec:isAllGranted('PERM_READ_USERS')}" />
<menuitem
label="${labels.Permissions}"
href="/admin/permissions"
disabled="${not sec:isAllGranted('PERM_READ_PERMISSIONS')}" />
<menuitem
label="${labels.AgendaWorkgroups}"
href="/admin/workgroups"
disabled="${not sec:isAllGranted('PERM_READ_WORKGROUPS')}" />
</menupopup>
</menu>
</menupopup>
</menu>
<menu label="${labels.User}">
<menupopup>
<menuitem
label="${labels.ChangePassword}…"
onClick="@command('passwd')" />
<menuitem
label="${labels.Logout}"
href="/j_spring_security_logout" />
</menupopup>
</menu>
</menubar>
</zk>

@ -1,70 +0,0 @@
<?page title="menu" contentType="text/html;charset=UTF-8"?>
<zk xmlns:n="native">
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<?taglib uri="/WEB-INF/security.tld" prefix="sec"?>
<tabbox mold="accordion" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.NavigationVM')">
<tabs>
<tab id="requirements" label="${labels.MenuRequirements}" selected="@load(vm.requirements)"/>
<tab id="orders" label="${labels.MenuOrders}" selected="@load(vm.orders)"/>
<tab id="trips" label="Služební cesty" selected="@load(vm.trips)"/>
<tab id="lists" label="${labels.MenuLists}" selected="@load(vm.lists)"/>
<tab id="settings" label="${labels.MenuSettings}" selected="@load(vm.settings)"/>
<tab id="admin" label="${labels.MenuAdministration}" selected="@load(vm.admin)"/>
<tab id="user" label="${labels.MenuUser}" selected="@load(vm.user)"/>
</tabs>
<tabpanels hflex="1">
<tabpanel>
<menubar orient="vertical">
<menuitem label="${labels.AgendaActRequirements}" href="/requirements/actual" />
<menuitem label="${labels.AgendaRequirementsHistory}" href="/requirements/history" />
</menubar>
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="${labels.AgendaMyOrders}" href="/orders/actual" />
<menuitem label="${labels.AgendaOrdersHistory}" href="/orders/history" />
</menubar>
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="Požadavky" href="/trips/requirement" />
<menuitem label="${labels.AgendaOrdersHistory}"/>
</menubar>
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="${labels.AgendaSuppliers}" href="/lists/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/>
<menuitem label="${labels.AgendaMaterial}" href="/lists/material" disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}"/>
<menuitem label="${labels.AgendaServices}" href="/lists/service" disabled="${not sec:isAllGranted('PERM_READ_SERVICES')}"/>
<menuitem label="${labels.AgendaMUnits}" href="/lists/munits" disabled="${not sec:isAllGranted('PERM_READ_MUNITS')}" width="120px"/>
<menuitem label="${labels.AgendaBuildings}" href="/lists/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" />
<!-- <menuitem label="${labels.AgendaRooms}" href="/lists/rooms" disabled="${not sec:isAllGranted('PERM_READ_ROOMS')}" /> -->
</menubar>
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="${labels.AgendaWorkflow}" href="/settings/workflow" disabled="${not sec:isAllGranted('PERM_EDIT_WORKFLOW')}"/>
<menuitem label="Číselné řady" onClick="@command('numSeries')"/>
<menuitem label="Limity částek"/>
<menuitem label="${labels.GlobalSettings}" onClick="@command('globalSettings')"/>
</menubar>
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="${labels.AgendaUsers}" href="/admin/users" disabled="${not sec:isAllGranted('PERM_READ_USERS')}" width="120px"/>
<menuitem label="Práva" href="/admin/permissions" disabled="${not sec:isAllGranted('PERM_READ_PERMISSIONS')}"/>
<menuitem label="${labels.AgendaWorkgroups}" href="/admin/workgroups" disabled="${not sec:isAllGranted('PERM_READ_WORKGROUPS')}"/>
</menubar>
</tabpanel>
<tabpanel>
<menubar orient="vertical">
<menuitem label="Změnit heslo" width="120px" onClick="@command('passwd')"/>
<menuitem label="Odhlásit" href="/j_spring_security_logout"/>
</menubar>
</tabpanel>
</tabpanels>
</tabbox>
</zk>

@ -45,14 +45,12 @@
<div id="header"> <div id="header">
<u:include src="/app/header.zul" /> <u:include src="/app/header.zul" />
</div> </div>
<div id="leftcolumn"> <div id="mainMenu">
<u:button label="${labels.InfoReview}" href="/" width="100%"/> <u:include src="/app/mainMenu.zul" />
<u:include src="/app/navigation.zul" />
</div> </div>
<div id="maincolumn"> <div id="maincolumn">
<u:include src="${gridZul}" /> <u:include src="${gridZul}" />
</div> </div>
<div id="footer">Footer</div> <div id="footer">Josef Rokos &amp; František Přibyl</div>
</div> </div>
</html> </html>

@ -17,29 +17,27 @@ html {
} }
#leftcolumn {
width: 140px;
padding: 10px;
float: left;
}
#navbar { #navbar {
border: 1px solid #ccc; border: 1px solid #ccc;
} }
#maincolumn { #maincolumn {
padding: 10px; padding-top: 5px;
padding-bottom: 20px; /* Height of the footer */ padding-bottom: 25px; /* Height of the footer */
margin: 0px 0px 0px 160px; margin: 0px 0px 0px 0px;
} }
#footer { #footer {
width: 100%;
clear: both; clear: both;
position: absolute; position: absolute;
bottom: 0; bottom: 5px;
width: 100%;
height: 20px; /* Height of the footer */ height: 20px; /* Height of the footer */
border: 1px solid #ccc; border: 1px solid #ccc;
text-align: center;
vertical-align: center;
font-size: 10px;
color: gray;
} }
.form-caption { .form-caption {
@ -49,24 +47,7 @@ html {
text-shadow: 2px 2px 2px #888888; text-shadow: 2px 2px 2px #888888;
padding-left: 5px; padding-left: 5px;
} }
/*aaa*/
.form-caption-content { .form-caption-content {
float: left; float: left;
} }
/*
a:link,a:visited {
font-size: 12px;
color: #0000A0;
background-color: #FFFFFF;
text-decoration: none;
target-new: none;
}
a:hover {
font-size: 12px;
color: #0000A0;
background-color: #a3d3f8;
text-decoration: none;
target-new: none;
}*/

@ -1,10 +1,9 @@
<?page title="NumberSeriesFormTitle" contentType="text/html;charset=UTF-8"?> <?page title="NumberSeries" contentType="text/html;charset=UTF-8"?>
<zk> <zk>
<window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer" <window id="editWin" border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.NumberSeriesVM')" closable="true" width="400px" viewModel="@id('vm') @init('info.bukova.isspst.ui.settings.NumberSeriesVM')" closable="true" width="400px"
binder="@init(queueName='numSeries')"> binder="@init(queueName='numSeries')">
<caption zclass="form-caption" label="${labels.NumberSeriesFormTitle}" /> <caption zclass="form-caption" label="${labels.NumberSeries}" />
<!-- <combobox></combobox> -->
<grid model="@load(vm.numberSeriesList)"> <grid model="@load(vm.numberSeriesList)">
<columns> <columns>
<column hflex="min"/> <column hflex="min"/>

Loading…
Cancel
Save