diff --git a/pom.xml b/pom.xml index 19cf8307..91c454d4 100644 --- a/pom.xml +++ b/pom.xml @@ -302,6 +302,12 @@ DynamicJasper 5.0.0 + + + ar.com.fdvs + DynamicJasper-core-fonts + 1.0 + diff --git a/src/main/java/info/bukova/isspst/sort/CzechSortListheader.java b/src/main/java/info/bukova/isspst/sort/CzechSortListheader.java new file mode 100644 index 00000000..bed92a0a --- /dev/null +++ b/src/main/java/info/bukova/isspst/sort/CzechSortListheader.java @@ -0,0 +1,25 @@ +package info.bukova.isspst.sort; + +import org.zkoss.zul.Listheader; + +@SuppressWarnings("serial") +public class CzechSortListheader extends Listheader { + + @Override + public void setSort(String type) { + + if (type.startsWith("auto")) + { + // czech(propertyName) + String propertyName = type.substring("auto(".length(), type.length() - 1); + this.setSortAscending(new CzechStringComparator(propertyName, true)); + this.setSortDescending(new CzechStringComparator(propertyName, false)); + } + else + { + // auto(propertyName) + super.setSort(type); + } + } + +} diff --git a/src/main/java/info/bukova/isspst/sort/CzechStringComparator.java b/src/main/java/info/bukova/isspst/sort/CzechStringComparator.java new file mode 100644 index 00000000..99b536f7 --- /dev/null +++ b/src/main/java/info/bukova/isspst/sort/CzechStringComparator.java @@ -0,0 +1,115 @@ +package info.bukova.isspst.sort; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.text.Collator; +import java.text.ParseException; +import java.text.RuleBasedCollator; +import java.util.Comparator; + +public class CzechStringComparator implements Comparator { + private String m_rule; + private final String m_property; + private final boolean m_ascending; + private Method m_getter; + private Comparator m_comparator; + + public CzechStringComparator(String property, boolean ascending) { + m_rule = ""; + m_rule += "< A,a < Á,á < Ä,ä "; + m_rule += "< B,b "; + m_rule += "< C,c < Ć,ć < Č,č "; + m_rule += "< D,d < Ď,ď "; + m_rule += "< E,e < É,é < Ë,ë "; + m_rule += "< F,f "; + m_rule += "< G,g "; + m_rule += "< H,h "; + m_rule += "< CH,Ch,ch "; + m_rule += "< I,i < Í,í "; + m_rule += "< J,j "; + m_rule += "< K,k "; + m_rule += "< L,l < Ľ,ľ < Ĺ,ĺ "; + m_rule += "< M,m "; + m_rule += "< N,n < Ń,ń < Ň,ň "; + m_rule += "< O,o < Ó,ó < Ö,ö "; + m_rule += "< P,p "; + m_rule += "< Q,q "; + m_rule += "< R,r < Ŕ,ŕ < Ř,ř "; + m_rule += "< S,s < ß < Ś,ś < Š,š "; + m_rule += "< T,t < Ť,ť "; + m_rule += "< U,u < Ú,ú < Ů,ů < Ü,ü "; + m_rule += "< V,v "; + m_rule += "< W,w "; + m_rule += "< X,x "; + m_rule += "< Y,y < Ý,ý "; + m_rule += "< Z,z < Ź,ź < Ž,ž "; + + m_property = property; + m_ascending = ascending; + } + + @Override + public int compare(Object argL, Object argR) { + + try { + return this.internalCompare(argL, argR); + + } catch (ParseException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalArgumentException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return 0; + } + + private int internalCompare(Object argL, Object argR) + throws ParseException, IllegalAccessException, + IllegalArgumentException, InvocationTargetException { + if (m_getter == null) { + m_getter = ReflectionTools.getGetterMethod(argL, m_property); + } + + if (m_comparator == null) { + Collator c = new RuleBasedCollator(m_rule); + c.setStrength(Collator.TERTIARY); + m_comparator = c; + } + + Object valL = m_getter.invoke(argL); + Object valR = m_getter.invoke(argR); + boolean isNullValL = (valL == null); + boolean isNullValR = (valR == null); + + int result = 0; + + if (isNullValL || isNullValR) + { + if (isNullValL && isNullValR) + { + result = 0; + } + else if (isNullValL) + { + result = -1; + } + else + { + result = 1; + } + } + else + { + result = m_comparator.compare(valL, valR); + } + + return (m_ascending ? result : -result); + } +} diff --git a/src/main/java/info/bukova/isspst/sort/ReflectionTools.java b/src/main/java/info/bukova/isspst/sort/ReflectionTools.java new file mode 100644 index 00000000..5a2902e6 --- /dev/null +++ b/src/main/java/info/bukova/isspst/sort/ReflectionTools.java @@ -0,0 +1,49 @@ +package info.bukova.isspst.sort; + +import java.lang.reflect.Method; + +public class ReflectionTools { + + private static String capitalizeFirstLetter(String string) + { + String result = string.substring(0,1).toUpperCase() + string.substring(1, string.length()); + return result; + } + + public static String getGetterName(String propertyName) + { + String getterName = "get" + ReflectionTools.capitalizeFirstLetter(propertyName); + return getterName; + } + + public static String getBoolGetterName(String propertyName) + { + String getterName = "is" + ReflectionTools.capitalizeFirstLetter(propertyName); + return getterName; + } + + public static Method getGetterMethod(Object bean, String propertyName) + { + Class beanClass = bean.getClass(); + + try + { + return beanClass.getMethod(ReflectionTools.getGetterName(propertyName)); + } + catch(Throwable t) + { + // ignore + } + + try + { + return beanClass.getMethod(ReflectionTools.getBoolGetterName(propertyName)); + } + catch(Throwable t) + { + // ignore + } + + throw new IllegalArgumentException("Not getter method found for '" + propertyName + "', bean: " + bean); + } +} diff --git a/src/main/webapp/WEB-INF/jdbc.properties b/src/main/webapp/WEB-INF/jdbc.properties index 658408f0..e203125f 100644 --- a/src/main/webapp/WEB-INF/jdbc.properties +++ b/src/main/webapp/WEB-INF/jdbc.properties @@ -1,5 +1,5 @@ jdbc.driverClassName=com.mysql.jdbc.Driver jdbc.dialect=org.hibernate.dialect.MySQLDialect -jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=utf8 +jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=latin2 jdbc.username=root jdbc.password=xsacfgd \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/lang-addons/CzechSortListheader.xml b/src/main/webapp/WEB-INF/lang-addons/CzechSortListheader.xml new file mode 100644 index 00000000..a3ced572 --- /dev/null +++ b/src/main/webapp/WEB-INF/lang-addons/CzechSortListheader.xml @@ -0,0 +1,11 @@ + + + + CzechSortListheader + xul/html + + listheader + listheader + info.bukova.isspst.sort.CzechSortListheader + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/zk-label.properties b/src/main/webapp/WEB-INF/zk-label.properties index 57d14bfb..f9857d69 100644 --- a/src/main/webapp/WEB-INF/zk-label.properties +++ b/src/main/webapp/WEB-INF/zk-label.properties @@ -2,19 +2,67 @@ AppName=Objednávkový systém SPŠ Třebíč AgendaBuildings=Budovy - +BuildingsFormTitle=Budova BuildingsFormCode=Kód BuildingsFormName=Název BuildingsFormDescription=Popis - BuildingsGridColumnCode=Kód BuildingsGridColumnName=Název BuildingsGridColumnDescription=Popis +AgendaRights=Práva +RightsFormTitle=Práva +RightsGridRole=Role +RightsGridModules=Práva modulů + +AgendaSuppliers=Dodavatelé +SuppliersFormTitle=Dodavatel +SuppliersFormCompany=Název firmy +SuppliersFormFindInARES=Hledat v ARESu +SuppliersFormIC=IČ +SuppliersFormDIC=DIČ +SuppliersFormDepartment=Oddělení +SuppliersFormContact=Kontaktní osoba +SuppliersFormStreet=Ulice +SuppliersFormNo=Číslo domu +SuppliersFormCity=Město +SuppliersFormZIP=PSČ +SuppliersFormPhone=Telefon +SuppliersFormEmail=E-mail +SuppliersFormWWW=Web +SuppliersFormNote=Poznámka +SuppliersGridColumnCompany=Firma +SuppliersGridColumnIC=IČ +SuppliersGridColumnContact=Kontaktní osoba +SuppliersGridColumnStreet=Ulice +SuppliersGridColumnNo=Číslo domu +SuppliersGridColumnCity=Město +SuppliersGridColumnDetail=Detail +SuppliersGridColumnDepartment=Oddělení +SuppliersGridColumnPhone=Telefon +SuppliersGridColumnEmail=E-mail +SuppliersGridColumnWWW=Web +SuppliersGridColumnNote=Poznámka + +AgendaUsers=Uživatelé +UsersFormTitle=Uživatel +UsersFormLogin=Login +UsersFormPersonalID=Osobní číslo +UsersFormFirstName=Jméno +UsersFormSureName=Příjmení +UsersFormEmail=E-mail +UsersFormSendNotify=Zasílat upozornění +UsersFormPassword=Heslo +UsersFormRepeatPassword=Znovu heslo +UsersFormActive=Aktivní +UsersGridColumnLogin=Login +UsersGridColumnPersonalID=Osobní číslo +UsersGridColumnFirstName=Jméno +UsersGridColumnSureName=Příjmení + ButtonStorno=Storno ButtonSave=Uložit -FormBuilding=Budova HeaderText=Hlavička @@ -22,6 +70,7 @@ ToolbarRecNew=Nový záznam ToolbarRecEdit=Úprava aktuálního záznamu ToolbarRecDelete=Odstranit aktuální záznam ToolbarRecFilter=Filtr záznamů +ToolbarPrint=Tisk ReportReport=Sestava ReportSend=Odeslat diff --git a/src/main/webapp/WEB-INF/zk.xml b/src/main/webapp/WEB-INF/zk.xml index f67fd971..57f1355d 100644 --- a/src/main/webapp/WEB-INF/zk.xml +++ b/src/main/webapp/WEB-INF/zk.xml @@ -21,6 +21,7 @@ /WEB-INF/mapa-lang-addon.xml /WEB-INF/ckez-bind-lang-addon.xml + /WEB-INF/lang-addons/CzechSortListheader.xml diff --git a/src/main/webapp/admin/addressbook/address.zul b/src/main/webapp/admin/addressbook/address.zul index 50b5cb50..ad41213b 100644 --- a/src/main/webapp/admin/addressbook/address.zul +++ b/src/main/webapp/admin/addressbook/address.zul @@ -1,71 +1,84 @@ - + - - - - - - - - - - - -