You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(20) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(3) |
Jun
(1) |
Jul
(1) |
Aug
(3) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
(4) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(4) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(14) |
Sep
(9) |
Oct
(9) |
Nov
(15) |
Dec
(5) |
2022 |
Jan
(3) |
Feb
(13) |
Mar
(2) |
Apr
|
May
(3) |
Jun
(4) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
|
Nov
(7) |
Dec
(3) |
2023 |
Jan
(1) |
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
(5) |
Jul
(3) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2024 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <udi...@us...> - 2022-02-18 17:10:12
|
Revision: 1440 http://sourceforge.net/p/j-trac/code/1440 Author: udittmer Date: 2022-02-18 17:10:10 +0000 (Fri, 18 Feb 2022) Log Message: ----------- update documentation for 2.2.1 Modified Paths: -------------- trunk/jtrac/doc/src/index.xml Modified: trunk/jtrac/doc/src/index.xml =================================================================== --- trunk/jtrac/doc/src/index.xml 2022-02-17 17:29:02 UTC (rev 1439) +++ trunk/jtrac/doc/src/index.xml 2022-02-18 17:10:10 UTC (rev 1440) @@ -11,7 +11,7 @@ <bookinfo> <title>JTrac</title> <subtitle>User / Developer Guide</subtitle> - <releaseinfo>2.2.0</releaseinfo> + <releaseinfo>2.2.1</releaseinfo> <authorgroup> <author> <firstname>Peter</firstname> @@ -136,6 +136,43 @@ For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures220">wiki page</ulink> on SourceForge. </para> </sect1> + + <sect1 id="introduction-releasenotes-2_2_1"> + <title>Release Notes: Version 2.2.1</title> + <para> + There are a couple of new database attributes (in the Space and the StoredSearch tables) in 2.2.1. + Instructions on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. + </para> + <para> + There where a number of new features, changes and bugfixes: + <itemizedlist> + <listitem> + <para>Fixed a bug that caused Markdown not to be applied on the search results page.</para> + </listitem> + <listitem> + <para>Stored searches (a.k.a. dashboard links) can optionally be made to open in new tabs, instead of always doing so.</para> + </listitem> + <listitem> + <para>Guard against XSS when using Markdown</para> + </listitem> + <listitem> + <para><ulink url="https://sourceforge.net/p/j-trac/bugs/164/">Fix broken Excel export</ulink></para> + </listitem> + <listitem> + <para><ulink url="https://sourceforge.net/p/j-trac/feature-requests/175/">Make background colors configurable, using HTML5 color input fields</ulink></para> + </listitem> + <listitem> + <para><ulink url="https://sourceforge.net/p/j-trac/bugs/166/">Don't display time for date fields</ulink></para> + </listitem> + <listitem> + <para><ulink url="https://sourceforge.net/p/j-trac/feature-requests/176/">Spaces can be made inactive, so they don't display on the dashboard</ulink></para> + </listitem> + </itemizedlist> + </para> + <para> + For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures221">wiki page</ulink> on SourceForge. + </para> + </sect1> </chapter> <chapter id="features"> @@ -1594,74 +1631,14 @@ <sect1 id="upgrading-database"> <title>Upgrading the Database</title> <para> - If the JTrac release notes mention database schema changes, you need to additionally run an upgrade script - before restarting the webapp-server with the new WAR in place. Upgrade scripts come in the form of + Previously, if the JTrac release notes mention database schema changes, you needed to additionally run an upgrade script + before restarting the webapp-server with the new WAR in place. Upgrade scripts came in the form of <ulink url="https://github.com/beanshell/beanshell">Beanshell</ulink> scripts (*.bsh) and would be always released within the "etc" folder of the JTrac downloadable distribution. </para> <para> - These files are tested on HSQLDB and may need minor changes to work with - other databases. No re-compilation is needed, therefore making it extremely easy for you to tweak them - if required. Of course it is strongly recommended that you backup your old data before an upgrade. - Please use the <ulink url="https://sourceforge.net/p/j-trac/discussion/552477">JTrac forums</ulink> - for help and for helping other users with your experiences. + But starting with version 2.2.1, JTrac is configured to update the database automatically, so nothing needs to be done for this. </para> - <para> - If you are shadowing the development builds you would be able to obtain the latest database upgrade - scripts from here: <ulink url="https://sourceforge.net/p/j-trac/code/HEAD/tree/trunk/jtrac/etc/"/> Look for files - that end with ".bsh" - e.g: "jtrac-hsqldb-2_1-to-2_2.bsh" - </para> - <para> - Steps to follow: - <itemizedlist> - <listitem> - <para> - First, stop the server, JTrac should not be connected to the database. - </para> - </listitem> - <listitem> - <para> - The "java" command should be available on the command line. - </para> - </listitem> - <listitem> - <para> - Get the latest beanshell jar file (~300 KB) from here: <ulink url="https://github.com/beanshell/beanshell/releases/download/2.1.0/bsh-2.1.0.jar"/> - </para> - </listitem> - <listitem> - <para> - Get the right JDBC driver for your database. If you have been using the embedded HSQLDB - database, hsqldb-x-x-x.jar will be available in the jtrac war file within "lib". - </para> - </listitem> - <listitem> - <para> - Edit the connection params (jdbc URL, username, password) to match your database. For HSQLDB, - to make it easier - you can copy the beanshell jar and the hsqldb jar into the "db" folder of - "jtrac.home". The db folder will contain a "jtrac.script" file. There may also be a "jtrac.log" - file. So when you are in the same directory as the HSQLDB data files, the URL is - "jdbc:hsqldb:file:jtrac". Otherwise, replace the "jtrac" part in the URL with the relative or - absolute path of where the "jtrac.script" file exists on your file-system. - </para> - </listitem> - <listitem> - <para> - Execute the beanshell script from the command line. The database driver should be added to the - classpath along with the beanshell jar. This is how the command would look like: - <programlisting> - -java -cp bsh-2.0b5.jar;hsqldb-2.5.2.jar bsh.Interpreter jtrac-hsqldb-2_1-to-2_2.bsh - </programlisting> - </para> - </listitem> - <listitem> - <para> - If there were no errors, you can now upgrade the WAR (don't forget to delete the temporary files) and restart. - </para> - </listitem> - </itemizedlist> - </para> </sect1> <sect1 id="upgrading-jetty"> <title>Upgrading Jetty</title> @@ -1763,7 +1740,7 @@ <title>Download / Extract Source</title> <para> Download the source code from - <ulink url="https://sourceforge.net/projects/j-trac/files/jtrac/2.2.0/">SourceForge</ulink> + <ulink url="https://sourceforge.net/projects/j-trac/files/jtrac/2.2.1/">SourceForge</ulink> and extract it to a convenient location. Note that the source code is a separate download from the main (binary) and the file name will be of the form "jtrac-src-X.Y.Z.zip". </para> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-17 17:29:04
|
Revision: 1439 http://sourceforge.net/p/j-trac/code/1439 Author: udittmer Date: 2022-02-17 17:29:02 +0000 (Thu, 17 Feb 2022) Log Message: ----------- create and initialize new attributes automatically Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/hibernate/HibernateJtracDao.java Modified: trunk/jtrac/src/main/java/info/jtrac/hibernate/HibernateJtracDao.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/hibernate/HibernateJtracDao.java 2022-02-16 13:52:35 UTC (rev 1438) +++ trunk/jtrac/src/main/java/info/jtrac/hibernate/HibernateJtracDao.java 2022-02-17 17:29:02 UTC (rev 1439) @@ -540,15 +540,15 @@ } //========================================================================== - + /** - * note that this is automatically configured to run on startup - * as a spring bean "init-method" + * note that this is automatically configured to run on startup as a spring bean "init-method" */ public void createSchema() { try { getHibernateTemplate().find("from Item item where item.id = 1"); - logger.info("database schema exists, normal startup"); + logger.info("database schema exists, normal startup with updating the schema, if necessary"); + schemaHelper.createSchema(); } catch (Exception e) { logger.warn("expected database schema does not exist, will create. Error is: " + e.getMessage()); schemaHelper.createSchema(); @@ -562,6 +562,11 @@ storeUser(admin); logger.info("schema creation complete"); } + + // default values for new attributes; haven't found a way to set default values when Hibernate creates these + getHibernateTemplate().bulkUpdate("update Space space set space.isActive = true where space.isActive is null"); + getHibernateTemplate().bulkUpdate("update StoredSearch search set search.newWindow = true where search.newWindow is null"); + List<SpaceSequence> ssList = getHibernateTemplate().loadAll(SpaceSequence.class); Map<Long, SpaceSequence> ssMap = new HashMap<Long, SpaceSequence>(ssList.size()); for(SpaceSequence ss : ssList) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-16 13:52:38
|
Revision: 1438 http://sourceforge.net/p/j-trac/code/1438 Author: udittmer Date: 2022-02-16 13:52:35 +0000 (Wed, 16 Feb 2022) Log Message: ----------- #176: Spaces can be made inactive Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/domain/Space.java trunk/jtrac/src/main/java/info/jtrac/domain/UserSpaceRole.java trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.java trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.java trunk/jtrac/src/main/resources/jtrac.hbm.xml trunk/jtrac/src/main/resources/messages.properties trunk/jtrac/src/main/resources/messages_de.properties trunk/jtrac/src/main/resources/messages_en.properties Modified: trunk/jtrac/src/main/java/info/jtrac/domain/Space.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/Space.java 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/java/info/jtrac/domain/Space.java 2022-02-16 13:52:35 UTC (rev 1438) @@ -1,12 +1,12 @@ /* * Copyright 2002-2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,7 +27,7 @@ * space with different access permissions. */ public class Space implements Serializable, Comparable<Space> { - + private long id; private int version; private Integer type; @@ -34,15 +34,16 @@ private String prefixCode; private String name; private String description; - private boolean guestAllowed; + private boolean guestAllowed; + private boolean isActive = true; private Metadata metadata; - + public Space() { metadata = new Metadata(); } - + //======================================================= - + public int getVersion() { return version; } @@ -49,8 +50,8 @@ public void setVersion(int version) { this.version = version; - } - + } + public String getPrefixCode() { return prefixCode; } @@ -65,8 +66,8 @@ public void setName(String name) { this.name = name; - } - + } + public String getDescription() { return description; } @@ -97,16 +98,24 @@ public void setType(Integer type) { this.type = type; - } - + } + public boolean isGuestAllowed() { return guestAllowed; } - public void setGuestAllowed(boolean guestAllowed) { + public void setGuestAllowed (boolean guestAllowed) { this.guestAllowed = guestAllowed; - } - + } + + public boolean getIsActive() { + return isActive; + } + + public void setIsActive (boolean isActive) { + this.isActive = isActive; + } + @Override public String toString() { StringBuffer sb = new StringBuffer(); @@ -115,7 +124,7 @@ sb.append("]"); return sb.toString(); } - + public int compareTo(Space s) { if(s == null) { return 1; @@ -124,7 +133,7 @@ if(name == null) { return 0; } - return 1; + return 1; } if(name == null) { return -1; @@ -131,8 +140,8 @@ } return name.compareTo(s.name); } - - + + @Override public boolean equals(Object o) { if (this == o) { @@ -144,10 +153,10 @@ final Space s = (Space) o; return prefixCode.equals(s.getPrefixCode()); } - + @Override public int hashCode() { return prefixCode.hashCode(); } - + } Modified: trunk/jtrac/src/main/java/info/jtrac/domain/UserSpaceRole.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/UserSpaceRole.java 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/java/info/jtrac/domain/UserSpaceRole.java 2022-02-16 13:52:35 UTC (rev 1438) @@ -1,144 +1,144 @@ -/* - * Copyright 2002-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package info.jtrac.domain; - -import java.io.Serializable; -import org.acegisecurity.GrantedAuthority; - -/** - * Class that exists purely to hold a "ternary" mapping of - * user <--> space <--> role and is also persisted - * the JTrac authorization (access control) scheme works as follows: - * if space is null, that means that this is a "global" JTrac role - * if space is not null, this role applies for the user to that - * space, and the getAuthority() method used by Acegi returns the - * role key appended with ":" + spacePrefixCode - */ -public class UserSpaceRole implements GrantedAuthority, Serializable { - - private long id; - private User user; - private Space space; - private String roleKey; - - public UserSpaceRole() { - // zero arg constructor - } - - public UserSpaceRole(User user, Space space, String roleKey) { - this.user = user; - this.space = space; - this.roleKey = roleKey; - } - - public boolean isAbleToCreateNewItem() { - if (space == null) { - return false; - } - return user.getPermittedTransitions(space, State.NEW).size() > 0; - } - - public boolean isSuperUser() { - return space == null && isAdmin(); - } - - public boolean isSpaceAdmin() { - return space != null && isAdmin(); - } - - public boolean isAdmin() { - return Role.ROLE_ADMIN.equals(roleKey); - } - - public boolean isGuest() { - return Role.ROLE_GUEST.equals(roleKey); - } - - //======== ACEGI GrantedAuthority implementation ============= - - public String getAuthority() { - if (space != null) { - return roleKey + ":" + space.getPrefixCode(); - } - return roleKey; - } - - //============================================================= - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public String getRoleKey() { - return roleKey; - } - - public void setRoleKey(String roleKey) { - this.roleKey = roleKey; - } - - public Space getSpace() { - return space; - } - - public void setSpace(Space space) { - this.space = space; - } - - public long getId() { - return id; - } - - public void setId(long id) { - this.id = id; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (!(o instanceof UserSpaceRole)) { - return false; - } - final UserSpaceRole usr = (UserSpaceRole) o; - return ( - (space == usr.getSpace() || space.equals(usr.getSpace())) - && user.equals(usr.getUser()) - && roleKey.equals(usr.getRoleKey()) - ); - } - - @Override - public int hashCode() { - int hash = 7; - hash = hash * 31 + user.hashCode(); - hash = hash * 31 + (space == null ? 0 : space.hashCode()); - hash = hash * 31 + roleKey.hashCode(); - return hash; - } - - @Override - public String toString() { - return getAuthority(); - } - -} +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package info.jtrac.domain; + +import java.io.Serializable; +import org.acegisecurity.GrantedAuthority; + +/** + * Class that exists purely to hold a "ternary" mapping of + * user <--> space <--> role and is also persisted + * the JTrac authorization (access control) scheme works as follows: + * if space is null, that means that this is a "global" JTrac role + * if space is not null, this role applies for the user to that + * space, and the getAuthority() method used by Acegi returns the + * role key appended with ":" + spacePrefixCode + */ +public class UserSpaceRole implements GrantedAuthority, Serializable { + + private long id; + private User user; + private Space space; + private String roleKey; + + public UserSpaceRole() { + // zero arg constructor + } + + public UserSpaceRole(User user, Space space, String roleKey) { + this.user = user; + this.space = space; + this.roleKey = roleKey; + } + + public boolean isAbleToCreateNewItem() { + if (space == null) { + return false; + } + return user.getPermittedTransitions(space, State.NEW).size() > 0; + } + + public boolean isSuperUser() { + return space == null && isAdmin(); + } + + public boolean isSpaceAdmin() { + return space != null && isAdmin(); + } + + public boolean isAdmin() { + return Role.ROLE_ADMIN.equals(roleKey); + } + + public boolean isGuest() { + return Role.ROLE_GUEST.equals(roleKey); + } + + //======== ACEGI GrantedAuthority implementation ============= + + public String getAuthority() { + if (space != null) { + return roleKey + ":" + space.getPrefixCode(); + } + return roleKey; + } + + //============================================================= + + public User getUser() { + return user; + } + + public void setUser(User user) { + this.user = user; + } + + public String getRoleKey() { + return roleKey; + } + + public void setRoleKey(String roleKey) { + this.roleKey = roleKey; + } + + public Space getSpace() { + return space; + } + + public void setSpace(Space space) { + this.space = space; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof UserSpaceRole)) { + return false; + } + final UserSpaceRole usr = (UserSpaceRole) o; + return ( + (space == usr.getSpace() || space.equals(usr.getSpace())) + && user.equals(usr.getUser()) + && roleKey.equals(usr.getRoleKey()) + ); + } + + @Override + public int hashCode() { + int hash = 7; + hash = hash * 31 + user.hashCode(); + hash = hash * 31 + (space == null ? 0 : space.hashCode()); + hash = hash * 31 + roleKey.hashCode(); + return hash; + } + + @Override + public String toString() { + return getAuthority(); + } + +} Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.java 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.java 2022-02-16 13:52:35 UTC (rev 1438) @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import org.apache.wicket.behavior.SimpleAttributeModifier; import org.apache.wicket.markup.html.WebMarkupContainer; @@ -52,6 +53,11 @@ add(table); add(message); + // remove spaces that are not active + spaceRoles = spaceRoles.stream() + .filter(spaceRole -> spaceRole.getSpace().getIsActive()) + .collect(Collectors.toList()); + if(spaceRoles.size() > 0) { final CountsHolder countsHolder = getJtrac().loadCountsForUser(user); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.html 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.html 2022-02-16 13:52:35 UTC (rev 1438) @@ -1,10 +1,10 @@ <html> <body> <wicket:extend> - <form wicket:id="form"> + <form wicket:id="form"> <div class="heading"> <wicket:message key="space_form.spaceDetails"/> - <input type="submit" wicket:id="delete" wicket:message="value:delete"/> + <input type="submit" wicket:id="delete" wicket:message="value:delete"/> </div> <div wicket:id="feedback"></div> <table class="jtrac"> @@ -12,36 +12,44 @@ <td class="label"> <wicket:message key="space_form.displayName"/> <font color="red">*</font> - </td> + </td> <td> - <input wicket:id="space.name"/> - </td> + <input wicket:id="space.name"/> + </td> </tr> <tr> <td class="label"> <wicket:message key="space_form.spaceKey"/> <font color="red">*</font> - </td> + </td> <td> - <input wicket:id="space.prefixCode" size="10"/> - </td> + <input wicket:id="space.prefixCode" size="10"/> + </td> </tr> <tr> <td class="label"> - <wicket:message key="space_form.description"/> - </td> + <wicket:message key="space_form.description"/> + </td> <td> - <textarea wicket:id="space.description" rows="3" cols="40"></textarea> - </td> + <textarea wicket:id="space.description" rows="3" cols="40"></textarea> + </td> </tr> <tr> <td class="label"> - <wicket:message key="space_form.makePublic"/> - </td> + <wicket:message key="space_form.makePublic"/> + </td> <td> - <input type="checkbox" wicket:id="space.guestAllowed"/> - </td> - </tr> + <input type="checkbox" wicket:id="space.guestAllowed"/> + </td> + </tr> + <tr> + <td class="label"> + <wicket:message key="space_form.isActive"/> + </td> + <td> + <input type="checkbox" wicket:id="space.isActive"/> + </td> + </tr> <tr wicket:id="hide"> <td class="label"> <wicket:message key="space_form.copyExisting"/> @@ -53,9 +61,9 @@ <tr> <td/> <td> - <input type="submit" wicket:message="value:next"/> + <input type="submit" wicket:message="value:next"/> </td> - </tr> + </tr> </table> <a href="#" wicket:id="cancel"><img src="resources/cancel.gif" class="nav-link"/><wicket:message key="cancel"/></a> </form> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.java 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/SpaceFormPage.java 2022-02-16 13:52:35 UTC (rev 1438) @@ -193,6 +193,8 @@ add(new TextArea("space.description")); // guest allowed =================================================== add(new CheckBox("space.guestAllowed")); + // whether the space is active ===================================== + add(new CheckBox("space.isActive")); // hide copy from option if edit =================================== WebMarkupContainer hide = new WebMarkupContainer("hide"); if(space.getId() > 0) { Modified: trunk/jtrac/src/main/resources/jtrac.hbm.xml =================================================================== --- trunk/jtrac/src/main/resources/jtrac.hbm.xml 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/resources/jtrac.hbm.xml 2022-02-16 13:52:35 UTC (rev 1438) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE hibernate-mapping PUBLIC - "-//Hibernate/Hibernate Mapping DTD//EN" +<!DOCTYPE hibernate-mapping PUBLIC + "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="info.jtrac.domain"> @@ -12,7 +12,7 @@ <natural-id> <many-to-one name="space" column="space_id" not-null="true" index="idx_items_space_id"/> <property name="sequenceNum" column="sequence_num" index="idx_items_sequence_num"/> - </natural-id> + </natural-id> <version name="version" column="version"/> <property name="type" column="type"/> <many-to-one name="parent" column="parent_id"/> @@ -21,11 +21,11 @@ <set name="children" order-by="id" cascade="all" inverse="true"> <key column="parent_id"/> <one-to-many class="Item"/> - </set> + </set> <set name="history" order-by="id" cascade="all" inverse="true"> <key column="item_id"/> <one-to-many class="History"/> - </set> + </set> <set name="itemUsers" cascade="all"> <key column="item_id"/> <one-to-many class="ItemUser"/> @@ -37,26 +37,26 @@ <set name="relatingItems" inverse="true"> <key column="related_item_id"/> <one-to-many class="ItemItem"/> - </set> + </set> <set name="itemTags" cascade="all" inverse="true"> <key column="item_id"/> <one-to-many class="ItemTag"/> - </set> + </set> <set name="attachments" cascade="all" inverse="true"> <key column="item_id"/> <one-to-many class="Attachment"/> - </set> + </set> <!-- identical to History (except indexes) --> <many-to-one name="loggedBy" column="logged_by" not-null="true" index="idx_items_logged_by"/> - <many-to-one name="assignedTo" column="assigned_to" index="idx_items_assigned_to"/> - <property name="summary" column="summary"/> + <many-to-one name="assignedTo" column="assigned_to" index="idx_items_assigned_to"/> + <property name="summary" column="summary"/> <property name="detail" column="detail" type="text"/> <property name="status" column="status" index="idx_items_status"/> <property name="severity" column="severity" index="idx_items_severity"/> - <property name="priority" column="priority"/> + <property name="priority" column="priority"/> <property name="cusDbl01" column="cus_dbl_01"/> <property name="cusDbl02" column="cus_dbl_02"/> - <property name="cusDbl03" column="cus_dbl_03"/> + <property name="cusDbl03" column="cus_dbl_03"/> <property name="cusInt01" column="cus_int_01"/> <property name="cusInt02" column="cus_int_02"/> <property name="cusInt03" column="cus_int_03"/> @@ -74,7 +74,7 @@ <property name="cusStr05" column="cus_str_05"/> <property name="cusTim01" column="cus_tim_01"/> <property name="cusTim02" column="cus_tim_02"/> - <property name="cusTim03" column="cus_tim_03"/> + <property name="cusTim03" column="cus_tim_03"/> </class> <class name="ItemUser" table="item_users"> @@ -83,7 +83,7 @@ </id> <many-to-one name="user" column="user_id" not-null="true"/> <property name="type" column="type"/> - </class> + </class> <class name="ItemItem" table="item_items"> <id name="id" column="id"> @@ -92,8 +92,8 @@ <many-to-one name="item" column="item_id" not-null="true"/> <many-to-one name="relatedItem" column="related_item_id" not-null="true"/> <property name="type" column="type"/> - </class> - + </class> + <class name="ItemTag" table="item_tags"> <id name="id" column="id"> <generator class="native"/> @@ -100,8 +100,8 @@ </id> <many-to-one name="tag" column="tag_id" not-null="true"/> <property name="type" column="type"/> - </class> - + </class> + <class name="Tag" table="tags"> <id name="id" column="id"> <generator class="native"/> @@ -108,9 +108,9 @@ </id> <property name="type" column="type"/> <property name="name" column="name" not-null="true" unique="true"/> - <property name="description" column="description" type="text"/> + <property name="description" column="description" type="text"/> </class> - + <class name="History" table="history"> <id name="id" column="id"> <generator class="native"/> @@ -124,15 +124,15 @@ <!-- identical to Item --> <property name="timeStamp" column="time_stamp"/> <many-to-one name="loggedBy" column="logged_by" not-null="true"/> - <many-to-one name="assignedTo" column="assigned_to"/> - <property name="summary" column="summary"/> + <many-to-one name="assignedTo" column="assigned_to"/> + <property name="summary" column="summary"/> <property name="detail" column="detail" type="text"/> <property name="status" column="status"/> <property name="severity" column="severity"/> - <property name="priority" column="priority"/> + <property name="priority" column="priority"/> <property name="cusDbl01" column="cus_dbl_01"/> <property name="cusDbl02" column="cus_dbl_02"/> - <property name="cusDbl03" column="cus_dbl_03"/> + <property name="cusDbl03" column="cus_dbl_03"/> <property name="cusInt01" column="cus_int_01"/> <property name="cusInt02" column="cus_int_02"/> <property name="cusInt03" column="cus_int_03"/> @@ -150,14 +150,14 @@ <property name="cusStr05" column="cus_str_05"/> <property name="cusTim01" column="cus_tim_01"/> <property name="cusTim02" column="cus_tim_02"/> - <property name="cusTim03" column="cus_tim_03"/> - </class> - + <property name="cusTim03" column="cus_tim_03"/> + </class> + <class name="User" table="users"> <id name="id" column="id"> <generator class="native"/> - </id> - <property name="type" column="type"/> + </id> + <property name="type" column="type"/> <many-to-one name="parent" column="parent"/> <property name="loginName" column="login_name" unique="true" not-null="true" index="idx_users_login_name" length="50"/> <property name="name" column="name" length="50"/> @@ -169,7 +169,7 @@ <set name="userSpaceRoles" cascade="all" inverse="true"> <key column="user_id"/> <one-to-many class="UserSpaceRole"/> - </set> + </set> </class> <class name="UserSpaceRole" table="user_space_roles"> @@ -179,8 +179,8 @@ <many-to-one name="user" column="user_id"/> <many-to-one name="space" column="space_id"/> <property name="roleKey" column="role_key" not-null="true"/> - </class> - + </class> + <class name="Space" table="spaces"> <id name="id" column="id"> <generator class="native"/> @@ -190,29 +190,30 @@ <property name="prefixCode" column="prefix_code" unique="true" length="10"/> <property name="name" column="name" length="50"/> <property name="description" column="description" type="text"/> - <property name="guestAllowed" column="guest_allowed"/> - <many-to-one name="metadata" column="metadata_id" cascade="all"/> + <property name="guestAllowed" column="guest_allowed"/> + <property name="isActive" column="is_active" type="boolean"/> + <many-to-one name="metadata" column="metadata_id" cascade="all"/> </class> - + <class name="SpaceSequence" table="space_sequence"> <id name="id" column="id"> - <generator class="assigned"/> - </id> - <property name="nextSeqNum" column="next_seq_num"/> + <generator class="assigned"/> + </id> + <property name="nextSeqNum" column="next_seq_num"/> </class> - + <class name="Metadata" table="metadata"> <id name="id" column="id"> <generator class="native"/> </id> <version name="version" column="version"/> - <property name="type" column="type"/> + <property name="type" column="type"/> <property name="name" column="name" length="50"/> <property name="description" column="description" type="text"/> <many-to-one name="parent" column="parent_id"/> <property name="xmlString" column="xml_string" type="text"/> - </class> - + </class> + <class name="Attachment" table="attachments"> <id name="id" column="id"> <generator class="native"/> @@ -220,12 +221,12 @@ <many-to-one name="previous" column="previous_id"/> <property name="fileName" column="file_name"/> <property name="filePrefix" column="file_prefix"/> - </class> - + </class> + <class name="Config" table="config"> - <id name="param" column="param"/> + <id name="param" column="param"/> <property name="value" column="value"/> - </class> + </class> <class name="StoredSearch" table="storedsearch"> <id name="id" column="id"> Modified: trunk/jtrac/src/main/resources/messages.properties =================================================================== --- trunk/jtrac/src/main/resources/messages.properties 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/resources/messages.properties 2022-02-16 13:52:35 UTC (rev 1438) @@ -345,6 +345,7 @@ space_form.description = Description space_form.makePublic = Make Public space_form.allowGuest = Allow Guest (read only) Access +space_form.isActive = Space is active space_form.copyExisting = Copy Existing Space space_form.createFresh = create from scratch space_form.error.prefixCode.tooShort = Length should be at least 3 characters. Modified: trunk/jtrac/src/main/resources/messages_de.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_de.properties 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/resources/messages_de.properties 2022-02-16 13:52:35 UTC (rev 1438) @@ -343,7 +343,8 @@ space_form.spaceKey = Kurzname space_form.description = Beschreibung space_form.makePublic = \u00D6ffentliches Projekt -space_form.allowGuest = Gast-zugriff erlauben (nur lesen) +space_form.allowGuest = Gast-Zugriff erlauben (nur lesen) +space_form.isActive = Projekt ist aktiv space_form.copyExisting = Bestehendes Projekt kopieren space_form.createFresh = Leeres Projekt erstellen space_form.error.prefixCode.tooShort = L\u00E4nge mindestens 3 Zeichen. Modified: trunk/jtrac/src/main/resources/messages_en.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_en.properties 2022-02-16 10:55:50 UTC (rev 1437) +++ trunk/jtrac/src/main/resources/messages_en.properties 2022-02-16 13:52:35 UTC (rev 1438) @@ -345,6 +345,7 @@ space_form.description = Description space_form.makePublic = Make Public space_form.allowGuest = Allow Guest (read only) Access +space_form.isActive = Space is active space_form.copyExisting = Copy Existing Space space_form.createFresh = create from scratch space_form.error.prefixCode.tooShort = Length should be at least 3 characters. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-16 10:55:52
|
Revision: 1437 http://sourceforge.net/p/j-trac/code/1437 Author: udittmer Date: 2022-02-16 10:55:50 +0000 (Wed, 16 Feb 2022) Log Message: ----------- #166 Timestamp not being logged Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/domain/AbstractItem.java trunk/jtrac/src/main/java/info/jtrac/util/DateUtils.java Modified: trunk/jtrac/src/main/java/info/jtrac/domain/AbstractItem.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/AbstractItem.java 2022-02-14 08:44:23 UTC (rev 1436) +++ trunk/jtrac/src/main/java/info/jtrac/domain/AbstractItem.java 2022-02-16 10:55:50 UTC (rev 1437) @@ -148,7 +148,7 @@ return ""; } if (o instanceof Date) { - return DateUtils.formatTimeStamp((Date) o); + return DateUtils.format((Date) o); } return o.toString(); } Modified: trunk/jtrac/src/main/java/info/jtrac/util/DateUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/DateUtils.java 2022-02-14 08:44:23 UTC (rev 1436) +++ trunk/jtrac/src/main/java/info/jtrac/util/DateUtils.java 2022-02-16 10:55:50 UTC (rev 1437) @@ -57,9 +57,14 @@ } public static String format (Date date) { + //return date == null + // ? "" + // : dateFormat.format(date); return date == null ? "" - : dateFormat.format(date); + : (showPretty() + ? getPrettyTime().format(date) + : dateFormat.format(date)); } public static String formatTimeStamp (Date date) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-14 08:44:25
|
Revision: 1436 http://sourceforge.net/p/j-trac/code/1436 Author: udittmer Date: 2022-02-14 08:44:23 +0000 (Mon, 14 Feb 2022) Log Message: ----------- Maven plugin updates Modified Paths: -------------- trunk/jtrac/pom.xml Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2022-02-14 08:38:55 UTC (rev 1435) +++ trunk/jtrac/pom.xml 2022-02-14 08:44:23 UTC (rev 1436) @@ -463,7 +463,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> + <version>3.9.0</version> <configuration> <source>1.8</source> <target>1.8</target> @@ -514,7 +514,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> - <version>3.9.1</version> + <version>3.10.0</version> <configuration> <templateFile>src/site/resources/template/maven-site.vm</templateFile> </configuration> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-14 08:38:58
|
Revision: 1435 http://sourceforge.net/p/j-trac/code/1435 Author: udittmer Date: 2022-02-14 08:38:55 +0000 (Mon, 14 Feb 2022) Log Message: ----------- made color choices use HTML5 color input fields Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java trunk/jtrac/src/main/java/info/jtrac/util/WebUtils.java trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java Added Paths: ----------- trunk/jtrac/src/main/java/org/apache/wicket/markup/html/form/ColorField.java Modified: trunk/jtrac/src/main/java/info/jtrac/domain/Config.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -33,6 +33,7 @@ private static final Set<String> PARAMS; private static final Set<String> BOOLEAN_PARAMS; private static final Set<String> NUMBER_PARAMS; + private static final Set<String> COLOR_PARAMS; // set up a static set of valid config key names static { @@ -84,6 +85,15 @@ NUMBER_PARAMS.add("attachment.maxsize"); NUMBER_PARAMS.add("pwd.minLength"); NUMBER_PARAMS.add("items.search.num"); + + COLOR_PARAMS = new LinkedHashSet<String>(); + COLOR_PARAMS.add("jtrac.color.gray"); + COLOR_PARAMS.add("jtrac.color.header"); + COLOR_PARAMS.add("jtrac.color.lightblue"); + COLOR_PARAMS.add("jtrac.color.mediumblue"); + COLOR_PARAMS.add("jtrac.color.darkblue"); + COLOR_PARAMS.add("jtrac.color.error"); + COLOR_PARAMS.add("jtrac.color.errorbg"); } public static Set<String> getParams() { @@ -98,6 +108,10 @@ return NUMBER_PARAMS.contains(param); } + public static boolean isColor (String param) { + return COLOR_PARAMS.contains(param); + } + public Config() { // zero arg constructor } Modified: trunk/jtrac/src/main/java/info/jtrac/util/WebUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/WebUtils.java 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/util/WebUtils.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -16,8 +16,15 @@ package info.jtrac.util; +import info.jtrac.Jtrac; +import info.jtrac.wicket.JtracApplication; + import javax.servlet.http.Cookie; +import org.apache.wicket.behavior.HeaderContributor; +import org.apache.wicket.markup.html.IHeaderContributor; +import org.apache.wicket.markup.html.IHeaderResponse; + /** * utilities for http, web related stuff etc */ @@ -33,5 +40,29 @@ + "maxAge: '" + cookie.getMaxAge() + "', " + "comment: '" + cookie.getComment() + "'"; } - + + public static HeaderContributor getColorChangeHeaderContributor() { + Jtrac jtrac = JtracApplication.get().getJtrac(); + String colorGray = jtrac.loadConfig("jtrac.color.gray", "#CCCCCC"); + String colorHeader = jtrac.loadConfig("jtrac.color.header", "#E1ECFE"); + String colorLightBlue = jtrac.loadConfig("jtrac.color.lightblue", "#E1ECFE"); + String colorMediumBlue = jtrac.loadConfig("jtrac.color.mediumblue", "#C3D9FF"); + String colorDarkBlue = jtrac.loadConfig("jtrac.color.darkblue", "#0000D9"); + String colorError = jtrac.loadConfig("jtrac.color.error", "#CC2200"); + String colorErrorBg = jtrac.loadConfig("jtrac.color.errorbg", "#FFB6C1"); + + return new HeaderContributor(new IHeaderContributor() { + public void renderHead(IHeaderResponse response) { + String js = "var r = document.querySelector(':root');\n" + + "r.style.setProperty('--header', '"+colorHeader+"');\n" + + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" + + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" + + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" + + "r.style.setProperty('--error', '"+colorError+"');\n" + + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" + + "r.style.setProperty('--gray', '"+colorGray+"');\n"; + response.renderOnDomReadyJavascript(js); + } + }); + } } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -20,13 +20,12 @@ import info.jtrac.domain.ColumnHeading.Name; import info.jtrac.domain.Space; import info.jtrac.domain.User; +import info.jtrac.util.WebUtils; + import java.util.EnumMap; import java.util.Map; import org.apache.wicket.Component; -import org.apache.wicket.behavior.HeaderContributor; -import org.apache.wicket.markup.html.IHeaderContributor; -import org.apache.wicket.markup.html.IHeaderResponse; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.model.StringResourceModel; @@ -35,11 +34,9 @@ import org.slf4j.LoggerFactory; /** - * base class for all wicket pages, this provides - * a way to access the spring managed service layer - * as well as other convenience common methods - * also takes care of the standard template for all - * pages which is using wicket markup inheritance + * base class for all wicket pages, this provides a way to access the spring managed service layer + * as well as other convenience common methods also takes care of the standard template for all + * pages which are using wicket markup inheritance */ public abstract class BasePage extends WebPage { @@ -81,30 +78,10 @@ } public BasePage() { - String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); - String colorHeader = JtracApplication.get().getJtrac().loadConfig("jtrac.color.header", "#E1ECFE"); - String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); - String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); - String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); - String colorError = JtracApplication.get().getJtrac().loadConfig("jtrac.color.error", "#CC2200"); - String colorErrorBg = JtracApplication.get().getJtrac().loadConfig("jtrac.color.errorbg", "#FFB6C1"); - add(new IndividualHeadPanel().setRenderBodyOnly(true)); add(new HeaderPanel().setRenderBodyOnly(true)); String jtracVersion = getJtrac().getReleaseVersion(); add(new Label("version", jtracVersion)); - add(new HeaderContributor(new IHeaderContributor() { - public void renderHead(IHeaderResponse response) { - String js = "var r = document.querySelector(':root');\n" - + "r.style.setProperty('--header', '"+colorHeader+"');\n" - + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" - + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" - + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" - + "r.style.setProperty('--error', '"+colorError+"');\n" - + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" - + "r.style.setProperty('--gray', '"+colorGray+"');\n"; - response.renderOnDomReadyJavascript(js); - } - })); + add(WebUtils.getColorChangeHeaderContributor()); } } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html 2022-02-14 08:38:55 UTC (rev 1435) @@ -18,6 +18,7 @@ <wicket:fragment wicket:id="textField"><input wicket:id="value"/></wicket:fragment> <wicket:fragment wicket:id="numberField"><input type="number" min="0" size="8" wicket:id="value"/></wicket:fragment> <wicket:fragment wicket:id="booleanField"><input type="hidden" wicket:id="value" id="valueField"/><div class="switch"></div></wicket:fragment> + <wicket:fragment wicket:id="colorField"><input type="color" wicket:id="value"/></wicket:fragment> </wicket:extend> </body> </html> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -23,6 +23,7 @@ import org.apache.wicket.markup.html.IHeaderResponse; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.ColorField; import org.apache.wicket.markup.html.form.HiddenField; import org.apache.wicket.markup.html.form.NumberField; import org.apache.wicket.markup.html.form.TextField; @@ -52,6 +53,7 @@ private String param; private String value; private boolean isBoolean; + private boolean isColor; private boolean isNumber; public String getValue() { return value; } @@ -64,6 +66,7 @@ this.value = value; this.isBoolean = Config.isBoolean(param); this.isNumber = Config.isNumber(param); + this.isColor = Config.isColor(param); final BoundCompoundPropertyModel model = new BoundCompoundPropertyModel(this); setModel(model); @@ -95,6 +98,7 @@ HiddenField hiddenField = new HiddenField("value"); f.add(model.bind(hiddenField)); add(f); + } else if (isNumber) { // only difference is type="number" instead of type="text" Fragment f = new Fragment("field", "numberField", ConfigFormPage.this); @@ -102,6 +106,13 @@ f.add(model.bind(numberField)); add(f); + } else if (isColor) { + // only difference is type="color" instead of type="text" + Fragment f = new Fragment("field", "colorField", ConfigFormPage.this); + ColorField colorField = new ColorField("value"); + f.add(model.bind(colorField)); + add(f); + } else { // regular text input field Fragment f = new Fragment("field", "textField", ConfigFormPage.this); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -18,7 +18,9 @@ import info.jtrac.domain.User; import info.jtrac.util.WebUtils; + import javax.servlet.http.Cookie; + import org.apache.wicket.behavior.HeaderContributor; import org.apache.wicket.markup.html.IHeaderContributor; import org.apache.wicket.markup.html.IHeaderResponse; @@ -31,6 +33,7 @@ import org.apache.wicket.markup.html.form.TextField; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.model.BoundCompoundPropertyModel; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,27 +56,7 @@ add(new LoginForm("form")); String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); add(new Label("version", jtracVersion)); - - String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); - String colorHeader = JtracApplication.get().getJtrac().loadConfig("jtrac.color.header", "#E1ECFE"); - String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); - String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); - String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); - String colorError = JtracApplication.get().getJtrac().loadConfig("jtrac.color.error", "#CC2200"); - String colorErrorBg = JtracApplication.get().getJtrac().loadConfig("jtrac.color.errorbg", "#FFB6C1"); - add(new HeaderContributor(new IHeaderContributor() { - public void renderHead(IHeaderResponse response) { - String js = "var r = document.querySelector(':root');\n" - + "r.style.setProperty('--header', '"+colorHeader+"');\n" - + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" - + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" - + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" - + "r.style.setProperty('--error', '"+colorError+"');\n" - + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" - + "r.style.setProperty('--gray', '"+colorGray+"');\n"; - response.renderOnDomReadyJavascript(js); - } - })); + add(WebUtils.getColorChangeHeaderContributor()); } /** Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java 2022-02-13 12:41:17 UTC (rev 1434) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -16,15 +16,16 @@ package info.jtrac.wicket; +import info.jtrac.util.WebUtils; + import org.apache.wicket.PageParameters; -import org.apache.wicket.behavior.HeaderContributor; -import org.apache.wicket.markup.html.IHeaderContributor; -import org.apache.wicket.markup.html.IHeaderResponse; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.markup.html.basic.Label; + +import org.springframework.util.StringUtils; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; /** * logout page. the session invalidation code is in HeaderPanel @@ -43,26 +44,6 @@ add(new Label("title", getLocalizer().getString("logout.title", null))); String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); add(new Label("version", jtracVersion)); - - String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); - String colorHeader = JtracApplication.get().getJtrac().loadConfig("jtrac.color.header", "#E1ECFE"); - String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); - String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); - String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); - String colorError = JtracApplication.get().getJtrac().loadConfig("jtrac.color.error", "#CC2200"); - String colorErrorBg = JtracApplication.get().getJtrac().loadConfig("jtrac.color.errorbg", "#FFB6C1"); - add(new HeaderContributor(new IHeaderContributor() { - public void renderHead(IHeaderResponse response) { - String js = "var r = document.querySelector(':root');\n" - + "r.style.setProperty('--header', '"+colorHeader+"');\n" - + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" - + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" - + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" - + "r.style.setProperty('--error', '"+colorError+"');\n" - + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" - + "r.style.setProperty('--gray', '"+colorGray+"');\n"; - response.renderOnDomReadyJavascript(js); - } - })); + add(WebUtils.getColorChangeHeaderContributor()); } } Added: trunk/jtrac/src/main/java/org/apache/wicket/markup/html/form/ColorField.java =================================================================== --- trunk/jtrac/src/main/java/org/apache/wicket/markup/html/form/ColorField.java (rev 0) +++ trunk/jtrac/src/main/java/org/apache/wicket/markup/html/form/ColorField.java 2022-02-14 08:38:55 UTC (rev 1435) @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.wicket.markup.html.form; + +import org.apache.wicket.model.IModel; + +/** + * TextField doesn't permit the html <input type='color'> so this is a simple subclass to allow this + * + * @author Ulf Dittmer + */ +public class ColorField extends TextField +{ + private static final long serialVersionUID = 1L; + + /** + * Construct. + * + * @param id + * component id + */ + public ColorField(String id) + { + super(id); + } + + /** + * Construct. + * + * @param id + * component id + * @param type + * the type to use when updating the model for this text field + */ + public ColorField(String id, Class type) + { + super(id, type); + } + + /** + * Construct. + * + * @param id + * see Component + * @param model + * the model + */ + public ColorField(String id, IModel model) + { + super(id, model); + } + + /** + * @param id + * component id + * @param model + * the model + * @param type + * the type to use when updating the model for this text field + * @see org.apache.wicket.Component#Component(String, IModel) + */ + public ColorField(String id, IModel model, Class type) + { + super(id, model, type); + } + + /** + * @see org.apache.wicket.markup.html.form.TextField#getInputType() + */ + protected String getInputType() + { + return "color"; + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-13 12:41:19
|
Revision: 1434 http://sourceforge.net/p/j-trac/code/1434 Author: udittmer Date: 2022-02-13 12:41:17 +0000 (Sun, 13 Feb 2022) Log Message: ----------- more color customizations Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java trunk/jtrac/src/main/resources/messages.properties trunk/jtrac/src/main/resources/messages_de.properties trunk/jtrac/src/main/resources/messages_en.properties trunk/jtrac/src/main/webapp/resources/jtrac.css Modified: trunk/jtrac/src/main/java/info/jtrac/domain/Config.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-13 12:41:17 UTC (rev 1434) @@ -55,6 +55,7 @@ PARAMS.add("jtrac.header.picture"); PARAMS.add("jtrac.header.text"); PARAMS.add("jtrac.color.gray"); + PARAMS.add("jtrac.color.header"); PARAMS.add("jtrac.color.lightblue"); PARAMS.add("jtrac.color.mediumblue"); PARAMS.add("jtrac.color.darkblue"); Modified: trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-13 12:41:17 UTC (rev 1434) @@ -142,7 +142,13 @@ return null; } else { Node document = parser.parse(text); - return renderer.render(document); + String html = renderer.render(document).trim(); + // strip out opening/closing <p> and closing linefeed + if (html.startsWith("<p>")) + html = html.substring(3); + if (html.endsWith("</p>")) + html = html.substring(0, html.length()-4); + return html; } } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html 2022-02-13 12:41:17 UTC (rev 1434) @@ -5,8 +5,8 @@ <link rel="stylesheet" type="text/css" href="resources/jtrac.css"/> <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/> <link rel="icon" type="image/x-icon" href="favicon.ico"/> - </head> - <body> + </head> + <body> <span wicket:id="individuel"></span><br/> <span wicket:id="header"></span><br/> <div style="clear:both"><br/></div> @@ -13,11 +13,11 @@ <wicket:child/> <div><br/></div> <table width="100%" class="jtrac"> - <tr class="alt"> + <tr class="header"> <td align="right"> <i>powered by <a href="http://j-trac.sourceforge.net/" target="_blank">JTrac</a> <span wicket:id="version"></span></i> </td> </tr> - </table> + </table> </body> </html> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-13 12:41:17 UTC (rev 1434) @@ -82,6 +82,7 @@ public BasePage() { String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); + String colorHeader = JtracApplication.get().getJtrac().loadConfig("jtrac.color.header", "#E1ECFE"); String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); @@ -95,6 +96,7 @@ add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { String js = "var r = document.querySelector(':root');\n" + + "r.style.setProperty('--header', '"+colorHeader+"');\n" + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html 2022-02-13 12:41:17 UTC (rev 1434) @@ -1,8 +1,8 @@ <wicket:panel> - <table width="100%" class="jtrac alt" padding="4"> + <table width="100%" class="jtrac header" padding="4"> <tr> <td width="20%" align="left"><img height="55px" wicket:id="icon"/></td> <td align="left"><b><div wicket:id="message">[text goes here]</div></b></td> </tr> </table> -</wicket:panel> \ No newline at end of file +</wicket:panel> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html 2022-02-13 12:41:17 UTC (rev 1434) @@ -39,7 +39,7 @@ </form> <div><br/></div> <table width="100%" class="jtrac"> - <tr class="alt"> + <tr class="header"> <td align="right"> <i>powered by <a href="http://j-trac.sourceforge.net/" target="_blank">JTrac</a> <span wicket:id="version"></span></i> </td> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2022-02-13 12:41:17 UTC (rev 1434) @@ -1,232 +1,253 @@ -/* - * Copyright 2002-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package info.jtrac.wicket; - -import info.jtrac.domain.User; -import info.jtrac.util.WebUtils; -import javax.servlet.http.Cookie; -import org.apache.wicket.behavior.HeaderContributor; -import org.apache.wicket.markup.html.IHeaderContributor; -import org.apache.wicket.markup.html.IHeaderResponse; -import org.apache.wicket.markup.html.WebMarkupContainer; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.markup.html.form.CheckBox; -import org.apache.wicket.markup.html.form.PasswordTextField; -import org.apache.wicket.markup.html.form.StatelessForm; -import org.apache.wicket.markup.html.form.TextField; -import org.apache.wicket.markup.html.panel.FeedbackPanel; -import org.apache.wicket.model.BoundCompoundPropertyModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The JTrac login page. - */ -public class LoginPage extends WebPage { - /** - * Logger object - */ - private static final Logger logger = LoggerFactory.getLogger(LoginPage.class); - - /** - * Default constructor - */ - public LoginPage() { - setVersioned(false); - add(new IndividualHeadPanel().setRenderBodyOnly(true)); - add(new Label("title", getLocalizer().getString("login.title", null))); - add(new LoginForm("form")); - String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); - add(new Label("version", jtracVersion)); - } - - /** - * Wicket form for the login (inner class) - */ - private class LoginForm extends StatelessForm { - /** - * The login name of the user. - */ - private String loginName; - - /** - * The password of the user. - */ - private String password; - - /** - * The flag indicating if the user wants to be remembered or not. - */ - private boolean rememberMe; - - /** - * This method will return the login name of the user. - * - * @return The login name of the user. - */ - public String getLoginName() { - return loginName; - } - - /** - * This method allows to set the login name entered in the form. - * - * @param loginName The login name to set. - */ - public void setLoginName(String loginName) { - this.loginName = loginName; - } - - /** - * This method will return the password of the user. - * - * @return The password of the user. - */ - public String getPassword() { - return password; - } - - /** - * This method allows to set the password entered in the form. - * - * @param password The password to set. - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * This method will return the flag indicating if the user - * want's to be remembered as chosen on the form. - * - * @return The flag indicating if the user wants to be remembered - * (<code>true</code>) or not (<code>false</code>). - */ - public boolean isRememberMe() { - return rememberMe; - } - - /** - * This method allows to set the boolean flag to be remembered as - * checked on the form. - * - * @param rememberMe The boolean flag to set. - */ - public void setRememberMe(boolean rememberMe) { - this.rememberMe = rememberMe; - } - - /** - * Constructor for the login form. - * - * @param id - */ - public LoginForm(String id) { - super(id); - add(new WebMarkupContainer("hide") { - @Override - public boolean isVisible() { - return !LoginForm.this.hasError(); - } - }); - add(new FeedbackPanel("feedback")); - setModel(new BoundCompoundPropertyModel(this)); - final TextField loginNameField = new TextField("loginName"); - loginNameField.setOutputMarkupId(true); - add(loginNameField); - final PasswordTextField passwordField = new PasswordTextField("password"); - passwordField.setRequired(false); - passwordField.setOutputMarkupId(true); - add(passwordField); - - /* - * Intelligently set focus on the appropriate textbox. - */ - add(new HeaderContributor(new IHeaderContributor() { - public void renderHead(IHeaderResponse response) { - String markupId; - if(loginNameField.getConvertedInput() == null) { - markupId = loginNameField.getMarkupId(); - } else { - markupId = passwordField.getMarkupId(); - } - response.renderOnLoadJavascript("document.getElementById('" + markupId + "').focus()"); - } - })); - add(new CheckBox("rememberMe")); - } // end LoginForm(String) - - /** - * This method will process the login after the user hits the submit - * button to login. - */ - @Override - protected void onSubmit() { - if(loginName == null || password == null) { - logger.error("login failed - login name " + - (loginName!=null ? "is set (trimmed length=" + - loginName.trim().length()+")" : "is null") + - " and password " + - (password!=null ? "is set" : "is null") + "."); - error(getLocalizer().getString("login.error", null)); - return; - } - - User user = JtracApplication.get().authenticate(loginName, password); - if (user == null) { - /* - * ================================ - * Login failed! - * ================================ - */ - logger.error("login failed - Authentication for login name '"+ - loginName + "' not successful"); - error(getLocalizer().getString("login.error", null)); - } else { - /* - * ================================ - * Login success! - * ================================ - */ - - /* - * Set Remember me cookie if checkbox is checked on page. - */ - if(rememberMe) { - Cookie cookie = new Cookie("jtrac", loginName + ":" + JtracApplication.get().getJtrac().encodeClearText(password)); - cookie.setMaxAge(30 * 24 * 60 * 60); // 30 days in seconds - String path = getWebRequestCycle().getWebRequest().getHttpServletRequest().getContextPath(); - cookie.setPath(path); - getWebRequestCycle().getWebResponse().addCookie(cookie); - logger.debug("remember me requested, cookie added, " + WebUtils.getDebugStringForCookie(cookie)); - } - - /* - * Setup session with principal - */ - JtracSession.get().setUser(user); - /* - * Proceed to bookmarkable page or default dashboard - */ - if (!continueToOriginalDestination()) { - setResponsePage(DashboardPage.class); - } - } - } // end onSubmit() - } // end inner class LoginForm -} +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package info.jtrac.wicket; + +import info.jtrac.domain.User; +import info.jtrac.util.WebUtils; +import javax.servlet.http.Cookie; +import org.apache.wicket.behavior.HeaderContributor; +import org.apache.wicket.markup.html.IHeaderContributor; +import org.apache.wicket.markup.html.IHeaderResponse; +import org.apache.wicket.markup.html.WebMarkupContainer; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.CheckBox; +import org.apache.wicket.markup.html.form.PasswordTextField; +import org.apache.wicket.markup.html.form.StatelessForm; +import org.apache.wicket.markup.html.form.TextField; +import org.apache.wicket.markup.html.panel.FeedbackPanel; +import org.apache.wicket.model.BoundCompoundPropertyModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The JTrac login page. + */ +public class LoginPage extends WebPage { + /** + * Logger object + */ + private static final Logger logger = LoggerFactory.getLogger(LoginPage.class); + + /** + * Default constructor + */ + public LoginPage() { + setVersioned(false); + add(new IndividualHeadPanel().setRenderBodyOnly(true)); + add(new Label("title", getLocalizer().getString("login.title", null))); + add(new LoginForm("form")); + String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); + add(new Label("version", jtracVersion)); + + String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); + String colorHeader = JtracApplication.get().getJtrac().loadConfig("jtrac.color.header", "#E1ECFE"); + String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); + String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); + String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); + String colorError = JtracApplication.get().getJtrac().loadConfig("jtrac.color.error", "#CC2200"); + String colorErrorBg = JtracApplication.get().getJtrac().loadConfig("jtrac.color.errorbg", "#FFB6C1"); + add(new HeaderContributor(new IHeaderContributor() { + public void renderHead(IHeaderResponse response) { + String js = "var r = document.querySelector(':root');\n" + + "r.style.setProperty('--header', '"+colorHeader+"');\n" + + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" + + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" + + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" + + "r.style.setProperty('--error', '"+colorError+"');\n" + + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" + + "r.style.setProperty('--gray', '"+colorGray+"');\n"; + response.renderOnDomReadyJavascript(js); + } + })); + } + + /** + * Wicket form for the login (inner class) + */ + private class LoginForm extends StatelessForm { + /** + * The login name of the user. + */ + private String loginName; + + /** + * The password of the user. + */ + private String password; + + /** + * The flag indicating if the user wants to be remembered or not. + */ + private boolean rememberMe; + + /** + * This method will return the login name of the user. + * + * @return The login name of the user. + */ + public String getLoginName() { + return loginName; + } + + /** + * This method allows to set the login name entered in the form. + * + * @param loginName The login name to set. + */ + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + /** + * This method will return the password of the user. + * + * @return The password of the user. + */ + public String getPassword() { + return password; + } + + /** + * This method allows to set the password entered in the form. + * + * @param password The password to set. + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * This method will return the flag indicating if the user + * want's to be remembered as chosen on the form. + * + * @return The flag indicating if the user wants to be remembered + * (<code>true</code>) or not (<code>false</code>). + */ + public boolean isRememberMe() { + return rememberMe; + } + + /** + * This method allows to set the boolean flag to be remembered as + * checked on the form. + * + * @param rememberMe The boolean flag to set. + */ + public void setRememberMe(boolean rememberMe) { + this.rememberMe = rememberMe; + } + + /** + * Constructor for the login form. + * + * @param id + */ + public LoginForm(String id) { + super(id); + add(new WebMarkupContainer("hide") { + @Override + public boolean isVisible() { + return !LoginForm.this.hasError(); + } + }); + add(new FeedbackPanel("feedback")); + setModel(new BoundCompoundPropertyModel(this)); + final TextField loginNameField = new TextField("loginName"); + loginNameField.setOutputMarkupId(true); + add(loginNameField); + final PasswordTextField passwordField = new PasswordTextField("password"); + passwordField.setRequired(false); + passwordField.setOutputMarkupId(true); + add(passwordField); + + /* + * Intelligently set focus on the appropriate textbox. + */ + add(new HeaderContributor(new IHeaderContributor() { + public void renderHead(IHeaderResponse response) { + String markupId; + if(loginNameField.getConvertedInput() == null) { + markupId = loginNameField.getMarkupId(); + } else { + markupId = passwordField.getMarkupId(); + } + response.renderOnLoadJavascript("document.getElementById('" + markupId + "').focus()"); + } + })); + add(new CheckBox("rememberMe")); + } // end LoginForm(String) + + /** + * This method will process the login after the user hits the submit + * button to login. + */ + @Override + protected void onSubmit() { + if(loginName == null || password == null) { + logger.error("login failed - login name " + + (loginName!=null ? "is set (trimmed length=" + + loginName.trim().length()+")" : "is null") + + " and password " + + (password!=null ? "is set" : "is null") + "."); + error(getLocalizer().getString("login.error", null)); + return; + } + + User user = JtracApplication.get().authenticate(loginName, password); + if (user == null) { + /* + * ================================ + * Login failed! + * ================================ + */ + logger.error("login failed - Authentication for login name '"+ + loginName + "' not successful"); + error(getLocalizer().getString("login.error", null)); + } else { + /* + * ================================ + * Login success! + * ================================ + */ + + /* + * Set Remember me cookie if checkbox is checked on page. + */ + if(rememberMe) { + Cookie cookie = new Cookie("jtrac", loginName + ":" + JtracApplication.get().getJtrac().encodeClearText(password)); + cookie.setMaxAge(30 * 24 * 60 * 60); // 30 days in seconds + String path = getWebRequestCycle().getWebRequest().getHttpServletRequest().getContextPath(); + cookie.setPath(path); + getWebRequestCycle().getWebResponse().addCookie(cookie); + logger.debug("remember me requested, cookie added, " + WebUtils.getDebugStringForCookie(cookie)); + } + + /* + * Setup session with principal + */ + JtracSession.get().setUser(user); + /* + * Proceed to bookmarkable page or default dashboard + */ + if (!continueToOriginalDestination()) { + setResponsePage(DashboardPage.class); + } + } + } // end onSubmit() + } // end inner class LoginForm +} Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html 2022-02-13 12:41:17 UTC (rev 1434) @@ -28,7 +28,7 @@ </table> <div style="padding-bottom:2em"></div> <table width="100%" class="jtrac"> - <tr class="alt"> + <tr class="header"> <td align="right"> <i>powered by <a href="http://j-trac.sourceforge.net/" target="_blank">JTrac</a> <span wicket:id="version"></span></i> </td> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java 2022-02-13 12:41:17 UTC (rev 1434) @@ -1,45 +1,68 @@ -/* - * Copyright 2002-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package info.jtrac.wicket; - -import org.apache.wicket.PageParameters; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.basic.Label; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.util.StringUtils; - -/** - * logout page. the session invalidation code is in HeaderPanel - */ -public class LogoutPage extends WebPage { - - private static final Logger logger = LoggerFactory.getLogger(LogoutPage.class); - - public LogoutPage(PageParameters params) { - String locale = params.getString("locale"); - if(locale != null) { - getRequestCycle().getSession().setLocale(StringUtils.parseLocaleString(locale)); - } - setVersioned(false); - add(new IndividualHeadPanel().setRenderBodyOnly(true)); - add(new Label("title", getLocalizer().getString("logout.title", null))); - String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); - add(new Label("version", jtracVersion)); - } - -} +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package info.jtrac.wicket; + +import org.apache.wicket.PageParameters; +import org.apache.wicket.behavior.HeaderContributor; +import org.apache.wicket.markup.html.IHeaderContributor; +import org.apache.wicket.markup.html.IHeaderResponse; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + +/** + * logout page. the session invalidation code is in HeaderPanel + */ +public class LogoutPage extends WebPage { + + private static final Logger logger = LoggerFactory.getLogger(LogoutPage.class); + + public LogoutPage(PageParameters params) { + String locale = params.getString("locale"); + if(locale != null) { + getRequestCycle().getSession().setLocale(StringUtils.parseLocaleString(locale)); + } + setVersioned(false); + add(new IndividualHeadPanel().setRenderBodyOnly(true)); + add(new Label("title", getLocalizer().getString("logout.title", null))); + String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); + add(new Label("version", jtracVersion)); + + String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); + String colorHeader = JtracApplication.get().getJtrac().loadConfig("jtrac.color.header", "#E1ECFE"); + String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); + String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); + String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); + String colorError = JtracApplication.get().getJtrac().loadConfig("jtrac.color.error", "#CC2200"); + String colorErrorBg = JtracApplication.get().getJtrac().loadConfig("jtrac.color.errorbg", "#FFB6C1"); + add(new HeaderContributor(new IHeaderContributor() { + public void renderHead(IHeaderResponse response) { + String js = "var r = document.querySelector(':root');\n" + + "r.style.setProperty('--header', '"+colorHeader+"');\n" + + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" + + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" + + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" + + "r.style.setProperty('--error', '"+colorError+"');\n" + + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" + + "r.style.setProperty('--gray', '"+colorGray+"');\n"; + response.renderOnDomReadyJavascript(js); + } + })); + } +} Modified: trunk/jtrac/src/main/resources/messages.properties =================================================================== --- trunk/jtrac/src/main/resources/messages.properties 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/resources/messages.properties 2022-02-13 12:41:17 UTC (rev 1434) @@ -201,7 +201,8 @@ config.jtrac.header.picture = Individual header picture config.jtrac.header.text = Individual header text config.jtrac.color.gray = Background color for labels (Default ist #CCCCCC) -config.jtrac.color.lightblue = Background color for header (Default ist #E1ECFE) +config.jtrac.color.header = Background color for header (Default ist #E1ECFE) +config.jtrac.color.lightblue = Background color (Default ist #E1ECFE) config.jtrac.color.mediumblue = Color for highlighting (Default ist #C3D9FF) config.jtrac.color.darkblue = Color for highlighting (Default ist #0000D9) config.jtrac.color.error = Color for error messages (Default ist #CC2200) Modified: trunk/jtrac/src/main/resources/messages_de.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_de.properties 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/resources/messages_de.properties 2022-02-13 12:41:17 UTC (rev 1434) @@ -201,7 +201,8 @@ config.jtrac.header.picture = Individuelles Bild im Header config.jtrac.header.text = Individueller Text im Header config.jtrac.color.gray = Farbe f\u00fcr \u00dcberschriften (Default ist #CCCCCC) -config.jtrac.color.lightblue = Farbe f\u00fcr Header (Default ist #E1ECFE) +config.jtrac.color.header = Hintergrundfarbe f\u00fcr Header (Default ist #E1ECFE) +config.jtrac.color.lightblue = HIntergrundfarbe (Default ist #E1ECFE) config.jtrac.color.mediumblue = Farbe zum Hervorheben (Default ist #C3D9FF) config.jtrac.color.darkblue = Farbe zum Hervorheben (Default ist #0000D9) config.jtrac.color.error = Farbe f\u00fcr Fehlermeldungen (Default ist #CC2200) Modified: trunk/jtrac/src/main/resources/messages_en.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_en.properties 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/resources/messages_en.properties 2022-02-13 12:41:17 UTC (rev 1434) @@ -201,7 +201,8 @@ config.jtrac.header.picture = Individual header picture config.jtrac.header.text = Individual header text config.jtrac.color.gray = Background color for labels (Default ist #CCCCCC) -config.jtrac.color.lightblue = Background color for header (Default ist #E1ECFE) +config.jtrac.color.header = Background color for header (Default ist #E1ECFE) +config.jtrac.color.lightblue = Background color (Default ist #E1ECFE) config.jtrac.color.mediumblue = Color for highlighting (Default ist #C3D9FF) config.jtrac.color.darkblue = Color for highlighting (Default ist #0000D9) config.jtrac.color.error = Color for error messages (Default ist #CC2200) Modified: trunk/jtrac/src/main/webapp/resources/jtrac.css =================================================================== --- trunk/jtrac/src/main/webapp/resources/jtrac.css 2022-02-11 09:16:05 UTC (rev 1433) +++ trunk/jtrac/src/main/webapp/resources/jtrac.css 2022-02-13 12:41:17 UTC (rev 1434) @@ -1,4 +1,5 @@ :root { + --header: #E1ECFE; --lightblue: #E1ECFE; --mediumblue: #C3D9FF; --darkblue: #0000D9; @@ -23,6 +24,7 @@ .info { color: var(--darkblue); font-weight: bold; } .heading { color: var(--darkblue); font-weight: bold; margin-bottom: 1em; } .alt { background: var(--lightblue); } +.header { background: var(--header); } .selected, table.jtrac .selected { background: var(--mediumblue); } .bdr-bottom, tr.bdr-bottom td { border-bottom: 1px solid var(--gray); } .nav-header { background: var(--gray); padding: 0.1em; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-11 09:16:09
|
Revision: 1433 http://sourceforge.net/p/j-trac/code/1433 Author: udittmer Date: 2022-02-11 09:16:05 +0000 (Fri, 11 Feb 2022) Log Message: ----------- more color customizations Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.html trunk/jtrac/src/main/resources/messages.properties trunk/jtrac/src/main/resources/messages_de.properties trunk/jtrac/src/main/resources/messages_en.properties trunk/jtrac/src/main/webapp/resources/jtrac.css Added Paths: ----------- trunk/jtrac/src/main/webapp/resources/link.png Modified: trunk/jtrac/src/main/java/info/jtrac/domain/Config.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-11 09:16:05 UTC (rev 1433) @@ -23,7 +23,7 @@ /** * Simple name value pair to hold configuration parameters * in the database for JTrac, e.g. SMTP e-mail server, etc. - * TODO better validation, type-safety, masking of mail server password + * TODO better validation, type-safety */ public class Config implements Serializable { @@ -54,8 +54,12 @@ PARAMS.add("jtrac.url.base"); PARAMS.add("jtrac.header.picture"); PARAMS.add("jtrac.header.text"); - PARAMS.add("jtrac.bgcolor.gray"); - PARAMS.add("jtrac.bgcolor.blue"); + PARAMS.add("jtrac.color.gray"); + PARAMS.add("jtrac.color.lightblue"); + PARAMS.add("jtrac.color.mediumblue"); + PARAMS.add("jtrac.color.darkblue"); + PARAMS.add("jtrac.color.error"); + PARAMS.add("jtrac.color.errorbg"); PARAMS.add("jtrac.edit.item"); PARAMS.add("locale.default"); PARAMS.add("session.timeout"); Modified: trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java 2022-02-11 09:16:05 UTC (rev 1433) @@ -262,20 +262,19 @@ } MimeMessage message = sender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, "UTF-8"); - String bgColorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.gray", "#CCCCCC"); + String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); try { helper.setTo(user.getEmail()); helper.setSubject(prefix + " " + fmt("loginMailSubject", locale)); StringBuffer sb = new StringBuffer(); - sb.append("<p>" + fmt("loginMailGreeting", locale) + " " - + user.getName() + ",</p>"); + sb.append("<p>" + fmt("loginMailGreeting", locale) + " " + user.getName() + ",</p>"); sb.append("<p>" + fmt("loginMailLine1", locale) + "</p>"); sb.append("<table class='jtrac'>"); - sb.append("<tr><th style='background: "+bgColorGray+"'>" + sb.append("<tr><th style='background: "+colorGray+"'>" + fmt("loginName", locale) + "</th><td style='border: 1px solid black'>" + user.getLoginName() + "</td></tr>"); - sb.append("<tr><th style='background: "+bgColorGray+"'>" + sb.append("<tr><th style='background: "+colorGray+"'>" + fmt("password", locale) + "</th><td style='border: 1px solid black'>" + clearText + "</td></tr>"); Modified: trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-11 09:16:05 UTC (rev 1433) @@ -193,8 +193,8 @@ private static String getAsHtml (Item item, HttpServletRequest request, HttpServletResponse response, MessageSource ms, Locale loc) { boolean isWeb = request != null && response != null; - String bgColorBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.blue", "#E1ECFE"); - String bgColorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.gray", "#CCCCCC"); + String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); + String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); String tableStyle = " class='jtrac'"; String tdStyle = ""; @@ -207,9 +207,9 @@ String tdCommonStyle = "border: 1px solid black"; tableStyle = " class='jtrac' style='border-collapse: collapse; font-family: Arial; font-size: 75%'"; tdStyle = " style='" + tdCommonStyle + "'"; - thStyle = " style='" + tdCommonStyle + "; background: "+bgColorGray+"'"; - altStyle = " style='background: "+bgColorBlue+"'"; - labelStyle = " style='" + tdCommonStyle + "; background: "+bgColorGray+"; font-weight: bold; text-align: right'"; + thStyle = " style='" + tdCommonStyle + "; background: "+colorGray+"'"; + altStyle = " style='background: "+colorLightBlue+"'"; + labelStyle = " style='" + tdCommonStyle + "; background: "+colorGray+"; font-weight: bold; text-align: right'"; } StringBuffer sb = new StringBuffer(); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-11 09:16:05 UTC (rev 1433) @@ -81,8 +81,12 @@ } public BasePage() { - String bgColorBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.blue", "#E1ECFE"); - String bgColorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.gray", "#CCCCCC"); + String colorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.color.gray", "#CCCCCC"); + String colorLightBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.lightblue", "#E1ECFE"); + String colorMediumBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.mediumblue", "#C3D9FF"); + String colorDarkBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.color.darkblue", "#0000D9"); + String colorError = JtracApplication.get().getJtrac().loadConfig("jtrac.color.error", "#CC2200"); + String colorErrorBg = JtracApplication.get().getJtrac().loadConfig("jtrac.color.errorbg", "#FFB6C1"); add(new IndividualHeadPanel().setRenderBodyOnly(true)); add(new HeaderPanel().setRenderBodyOnly(true)); @@ -91,8 +95,12 @@ add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { String js = "var r = document.querySelector(':root');\n" - + "r.style.setProperty('--blue', '"+bgColorBlue+"');\n" - + "r.style.setProperty('--gray', '"+bgColorGray+"');\n"; + + "r.style.setProperty('--lightblue', '"+colorLightBlue+"');\n" + + "r.style.setProperty('--mediumblue', '"+colorMediumBlue+"');\n" + + "r.style.setProperty('--darkblue', '"+colorDarkBlue+"');\n" + + "r.style.setProperty('--error', '"+colorError+"');\n" + + "r.style.setProperty('--errorbg', '"+colorErrorBg+"');\n" + + "r.style.setProperty('--gray', '"+colorGray+"');\n"; response.renderOnDomReadyJavascript(js); } })); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.html 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/DashboardPage.html 2022-02-11 09:16:05 UTC (rev 1433) @@ -30,7 +30,7 @@ <div class="heading"> <span><wicket:message key="dashboard.links"/></span> </div> - <ul style="list-style-image: url('/jtrac/resources/link.png');"> + <ul style="list-style-image: url('../resources/link.png');"> <li wicket:id="links"><a href="#" wicket:id="externalLink"></a></li> </ul> </wicket:extend> Modified: trunk/jtrac/src/main/resources/messages.properties =================================================================== --- trunk/jtrac/src/main/resources/messages.properties 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/resources/messages.properties 2022-02-11 09:16:05 UTC (rev 1433) @@ -200,8 +200,13 @@ config.jtrac.url.base = Base URL of your JTrac installation ( e.g. http://myserver/jtrac ) required for links in the e-mails to work config.jtrac.header.picture = Individual header picture config.jtrac.header.text = Individual header text -config.jtrac.bgcolor.gray = Background color for labels (default #CCCCCC) -config.jtrac.bgcolor.blue = Background color for header (default #E1ECFE) +config.jtrac.color.gray = Background color for labels (Default ist #CCCCCC) +config.jtrac.color.lightblue = Background color for header (Default ist #E1ECFE) +config.jtrac.color.mediumblue = Color for highlighting (Default ist #C3D9FF) +config.jtrac.color.darkblue = Color for highlighting (Default ist #0000D9) +config.jtrac.color.error = Color for error messages (Default ist #CC2200) +config.jtrac.color.errorbg = Background Color for error messages (Default ist #FFB6C1) + config.jtrac.edit.item = Should the owner of the task edit their items? (set to true, default is false) config.locale.default = Default language used for this JTrac installation e.g. "de" for German config.session.timeout = Time in minutes after which user session expires (default 30 minutes) Modified: trunk/jtrac/src/main/resources/messages_de.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_de.properties 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/resources/messages_de.properties 2022-02-11 09:16:05 UTC (rev 1433) @@ -199,9 +199,13 @@ config.jtrac.url.base = URL dieser Installation (z.B. http://myserver/jtrac) wird ben\u00F6tigt f\u00FCr Links in den Emails config.jtrac.header.picture = Individuelles Bild im Header -config.jtrac.header.text = Individueller Text oim Header -config.jtrac.bgcolor.gray = Hintergrundfarbe \u00dcberschriften (Default ist #CCCCCC) -config.jtrac.bgcolor.blue = Hintergrundfarbe Header (Default ist #E1ECFE) +config.jtrac.header.text = Individueller Text im Header +config.jtrac.color.gray = Farbe f\u00fcr \u00dcberschriften (Default ist #CCCCCC) +config.jtrac.color.lightblue = Farbe f\u00fcr Header (Default ist #E1ECFE) +config.jtrac.color.mediumblue = Farbe zum Hervorheben (Default ist #C3D9FF) +config.jtrac.color.darkblue = Farbe zum Hervorheben (Default ist #0000D9) +config.jtrac.color.error = Farbe f\u00fcr Fehlermeldungen (Default ist #CC2200) +config.jtrac.color.errorbg = Hintergrundfarbe f\u00fcr Fehlermeldungen(Default ist #FFB6C1) config.jtrac.edit.item = Soll der Autor eines Eintrages diesen editieren k\u00f6nnen? (auf true setzen, Default ist false) config.locale.default = Default Sprache, z.B. "de" f\u00FCr Deutsch config.session.timeout = Session Timeout in Minuten (Default 30 Minuten) Modified: trunk/jtrac/src/main/resources/messages_en.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_en.properties 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/resources/messages_en.properties 2022-02-11 09:16:05 UTC (rev 1433) @@ -200,8 +200,13 @@ config.jtrac.url.base = Base URL of your JTrac installation ( e.g. http://myserver/jtrac ) required for links in the e-mails to work config.jtrac.header.picture = Individual header picture config.jtrac.header.text = Individual header text -config.jtrac.bgcolor.gray = Background color for labels (default #CCCCCC) -config.jtrac.bgcolor.blue = Background color for header (default #E1ECFE) +config.jtrac.color.gray = Background color for labels (Default ist #CCCCCC) +config.jtrac.color.lightblue = Background color for header (Default ist #E1ECFE) +config.jtrac.color.mediumblue = Color for highlighting (Default ist #C3D9FF) +config.jtrac.color.darkblue = Color for highlighting (Default ist #0000D9) +config.jtrac.color.error = Color for error messages (Default ist #CC2200) +config.jtrac.color.errorbg = Background Color for error messages (Default ist #FFB6C1) + config.jtrac.edit.item = Should the owner of the task edit their items? (set to true, default is false) config.locale.default = Default language used for this JTrac installation e.g. "de" for German config.session.timeout = Time in minutes after which user session expires (default 30 minutes) Modified: trunk/jtrac/src/main/webapp/resources/jtrac.css =================================================================== --- trunk/jtrac/src/main/webapp/resources/jtrac.css 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/webapp/resources/jtrac.css 2022-02-11 09:16:05 UTC (rev 1433) @@ -1,25 +1,29 @@ :root { - --blue: #E1ECFE; + --lightblue: #E1ECFE; + --mediumblue: #C3D9FF; + --darkblue: #0000D9; --gray: #CCCCCC; + --error: #CC2200; + --errorbg: #FFB6C1; } body { font-family: Arial; background: #FFF; font-size: 80%; } table.jtrac th, table.jtrac td.label { background: var(--gray); padding-left: 0.2em; padding-right: 0.2em; } tr.center td { text-align: center; } .label { font-weight: bold; text-align: right; } -a { color: #0000D9; } +a { color: var(--darkblue); } a:hover { color: black; } img { border: none; vertical-align: middle; } .multiselect { overflow: auto; background: #FFF; text-align: left; border: 1px solid var(--gray); } .scrollable { height: 10em; } -.error-input { border: 1px solid #CC2200; } +.error-input { border: 1px solid var(--error); } div.error-input { float: left; } div.error-input select { border: none; } -.error { color: #CC2200; font-weight: bold; margin-bottom: 1em; } -.error-back { background: #FFB6C1; } -.info { color: #0000D9; font-weight: bold; } -.heading { color: #0000D9; font-weight: bold; margin-bottom: 1em; } -.alt { background: var(--blue); } -.selected, table.jtrac .selected { background: #c3d9ff; } +.error { color: var(--error); font-weight: bold; margin-bottom: 1em; } +.error-back { background: var(--errorbg); } +.info { color: var(--darkblue); font-weight: bold; } +.heading { color: var(--darkblue); font-weight: bold; margin-bottom: 1em; } +.alt { background: var(--lightblue); } +.selected, table.jtrac .selected { background: var(--mediumblue); } .bdr-bottom, tr.bdr-bottom td { border-bottom: 1px solid var(--gray); } .nav-header { background: var(--gray); padding: 0.1em; } .nav-header table, .jtrac-list, .jtrac-view { font-size: 95%; } @@ -26,7 +30,7 @@ .jtrac-view { border: 1px solid var(--gray); } .nav-header img, img.nav-link { margin-top: 1px; margin-right: 0.3em; } .nav-header img, a img.nav-link { vertical-align: top; display: block; float: left; } -.nav-header td, .nav-table td { font-weight: bold; text-align: right; padding: 0 10px 0 10px; background-color: var(--blue); } +.nav-header td, .nav-table td { font-weight: bold; text-align: right; padding: 0 10px 0 10px; background-color: var(--lightblue); } .nav-table td.icon { padding: 0; text-align: center; width: 4em; } .nav-table td a { width: 100%; display: block; } .bdr-collapse { border-collapse: collapse; } @@ -36,17 +40,17 @@ .space-below { padding-bottom: 0.5em; } tr.sortable th { background-position: right; background-repeat: no-repeat; } tr.sortable th.order-none { background-image: url("arrow_off.gif"); } -tr.sortable th.order-up { background-color: #c3d9ff; background-image: url("arrow_up.gif"); } -tr.sortable th.order-down { background-color: #c3d9ff; background-image: url("arrow_down.gif"); } +tr.sortable th.order-up { background-color: var(--mediumblue); background-image: url("arrow_up.gif"); } +tr.sortable th.order-down { background-color: var(--mediumblue); background-image: url("arrow_down.gif"); } tr.sortable a { color: black; } -tr.sortable a:hover { color: #0000D9; } +tr.sortable a:hover { color: var(--darkblue); } /* { list-style-image: url("error.gif"); } */ li.feedbackPanelINFO { list-style-image: url("success.gif"); padding-left: 0.4em; } li.feedbackPanelERROR { list-style-image: url("error.gif"); padding-left: 0.4em; } -.menu-option div { font-weight: bold; background-color: var(--blue); padding-left: 1em; padding-right: 1em; margin-bottom: 1.5em; } +.menu-option div { font-weight: bold; background-color: var(--lightblue); padding-left: 1em; padding-right: 1em; margin-bottom: 1.5em; } .workflow { border-style: solid; border-width: 0 1px 1px 0; border-color: black; } .workflow td { border-style: solid; border-width: 1px 0 0 1px; padding-left: 0.2em; padding-right: 0.2em; } -.state { background: var(--blue); } +.state { background: var(--lightblue); } .mirror { background: var(--gray); } .transition { font-style: italic; } Added: trunk/jtrac/src/main/webapp/resources/link.png =================================================================== (Binary files differ) Index: trunk/jtrac/src/main/webapp/resources/link.png =================================================================== --- trunk/jtrac/src/main/webapp/resources/link.png 2022-02-10 13:57:51 UTC (rev 1432) +++ trunk/jtrac/src/main/webapp/resources/link.png 2022-02-11 09:16:05 UTC (rev 1433) Property changes on: trunk/jtrac/src/main/webapp/resources/link.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-10 13:57:53
|
Revision: 1432 http://sourceforge.net/p/j-trac/code/1432 Author: udittmer Date: 2022-02-10 13:57:51 +0000 (Thu, 10 Feb 2022) Log Message: ----------- make background colors configurable (#175) Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/Jtrac.java trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java trunk/jtrac/src/main/java/info/jtrac/domain/Config.java trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java trunk/jtrac/src/main/java/info/jtrac/wicket/SpacePermissionsPage.html trunk/jtrac/src/main/resources/messages.properties trunk/jtrac/src/main/resources/messages_de.properties trunk/jtrac/src/main/resources/messages_en.properties trunk/jtrac/src/main/webapp/resources/jtrac.css Modified: trunk/jtrac/src/main/java/info/jtrac/Jtrac.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/Jtrac.java 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/Jtrac.java 2022-02-10 13:57:51 UTC (rev 1432) @@ -112,6 +112,7 @@ Map<String, String> loadAllConfig(); void storeConfig(Config config); String loadConfig(String param); + String loadConfig(String param, String defaultValue); //======================================================== void rebuildIndexes(BatchInfo batchInfo); boolean validateTextSearchQuery(String text); Modified: trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/JtracImpl.java 2022-02-10 13:57:51 UTC (rev 1432) @@ -765,6 +765,15 @@ return value; } + public String loadConfig(String param, String defaultValue) { + String val = loadConfig(param); + if (val == null) { + return defaultValue; + } else { + return val; + } + } + //======================================================== public void rebuildIndexes(BatchInfo batchInfo) { Modified: trunk/jtrac/src/main/java/info/jtrac/domain/Config.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/domain/Config.java 2022-02-10 13:57:51 UTC (rev 1432) @@ -54,6 +54,8 @@ PARAMS.add("jtrac.url.base"); PARAMS.add("jtrac.header.picture"); PARAMS.add("jtrac.header.text"); + PARAMS.add("jtrac.bgcolor.gray"); + PARAMS.add("jtrac.bgcolor.blue"); PARAMS.add("jtrac.edit.item"); PARAMS.add("locale.default"); PARAMS.add("session.timeout"); Modified: trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/mail/MailSender.java 2022-02-10 13:57:51 UTC (rev 1432) @@ -20,6 +20,7 @@ import info.jtrac.domain.ItemUser; import info.jtrac.domain.User; import info.jtrac.util.ItemUtils; +import info.jtrac.wicket.JtracApplication; import java.io.File; import java.util.ArrayList; @@ -261,6 +262,7 @@ } MimeMessage message = sender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(message, "UTF-8"); + String bgColorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.gray", "#CCCCCC"); try { helper.setTo(user.getEmail()); helper.setSubject(prefix + " " + fmt("loginMailSubject", locale)); @@ -269,11 +271,11 @@ + user.getName() + ",</p>"); sb.append("<p>" + fmt("loginMailLine1", locale) + "</p>"); sb.append("<table class='jtrac'>"); - sb.append("<tr><th style='background: #CCCCCC'>" + sb.append("<tr><th style='background: "+bgColorGray+"'>" + fmt("loginName", locale) + "</th><td style='border: 1px solid black'>" + user.getLoginName() + "</td></tr>"); - sb.append("<tr><th style='background: #CCCCCC'>" + sb.append("<tr><th style='background: "+bgColorGray+"'>" + fmt("password", locale) + "</th><td style='border: 1px solid black'>" + clearText + "</td></tr>"); Modified: trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-10 13:57:51 UTC (rev 1432) @@ -192,7 +192,9 @@ } private static String getAsHtml (Item item, HttpServletRequest request, HttpServletResponse response, MessageSource ms, Locale loc) { - boolean isWeb = request != null && response != null; + boolean isWeb = request != null && response != null; + String bgColorBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.blue", "#E1ECFE"); + String bgColorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.gray", "#CCCCCC"); String tableStyle = " class='jtrac'"; String tdStyle = ""; @@ -205,9 +207,9 @@ String tdCommonStyle = "border: 1px solid black"; tableStyle = " class='jtrac' style='border-collapse: collapse; font-family: Arial; font-size: 75%'"; tdStyle = " style='" + tdCommonStyle + "'"; - thStyle = " style='" + tdCommonStyle + "; background: #CCCCCC'"; - altStyle = " style='background: #e1ecfe'"; - labelStyle = " style='" + tdCommonStyle + "; background: #CCCCCC; font-weight: bold; text-align: right'"; + thStyle = " style='" + tdCommonStyle + "; background: "+bgColorGray+"'"; + altStyle = " style='background: "+bgColorBlue+"'"; + labelStyle = " style='" + tdCommonStyle + "; background: "+bgColorGray+"; font-weight: bold; text-align: right'"; } StringBuffer sb = new StringBuffer(); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2022-02-10 13:57:51 UTC (rev 1432) @@ -1,85 +1,100 @@ -/* - * Copyright 2002-2005 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package info.jtrac.wicket; - -import info.jtrac.Jtrac; -import info.jtrac.domain.ColumnHeading.Name; -import info.jtrac.domain.Space; -import info.jtrac.domain.User; -import java.util.EnumMap; -import java.util.Map; -import org.apache.wicket.Component; -import org.apache.wicket.markup.html.WebPage; -import org.apache.wicket.markup.html.basic.Label; -import org.apache.wicket.model.StringResourceModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * base class for all wicket pages, this provides - * a way to access the spring managed service layer - * as well as other convenience common methods - * also takes care of the standard template for all - * pages which is using wicket markup inheritance - */ -public abstract class BasePage extends WebPage { - - protected static final Logger logger = LoggerFactory.getLogger(BasePage.class); - - // helper to avoid polluting non-wicket packages (e.g. excel export, import) with Wicket i18n - public static Map<Name, String> getLocalizedLabels(Component c) { - Map<Name, String> map = new EnumMap<Name, String>(Name.class); - for(Name name : Name.values()) { - map.put(name, c.getLocalizer().getString("item_list." + name.getText(), null)); - } - return map; - } - - protected Jtrac getJtrac() { - return JtracApplication.get().getJtrac(); - } - - protected User getPrincipal() { - return JtracSession.get().getUser(); - } - - protected void setCurrentSpace(Space space) { - JtracSession.get().setCurrentSpace(space); - } - - protected Space getCurrentSpace() { - return JtracSession.get().getCurrentSpace(); - } - - protected String localize(String key) { - return getLocalizer().getString(key, null); - } - - protected String localize(String key, Object... params) { - StringResourceModel m = new StringResourceModel(key, null, null, params); - m.setLocalizer(getLocalizer()); - return m.getString(); - } - - public BasePage() { - add(new IndividualHeadPanel().setRenderBodyOnly(true)); - add(new HeaderPanel().setRenderBodyOnly(true)); - String jtracVersion = getJtrac().getReleaseVersion(); - add(new Label("version", jtracVersion)); - } - -} +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package info.jtrac.wicket; + +import info.jtrac.Jtrac; +import info.jtrac.domain.ColumnHeading.Name; +import info.jtrac.domain.Space; +import info.jtrac.domain.User; +import java.util.EnumMap; +import java.util.Map; + +import org.apache.wicket.Component; +import org.apache.wicket.behavior.HeaderContributor; +import org.apache.wicket.markup.html.IHeaderContributor; +import org.apache.wicket.markup.html.IHeaderResponse; +import org.apache.wicket.markup.html.WebPage; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.model.StringResourceModel; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * base class for all wicket pages, this provides + * a way to access the spring managed service layer + * as well as other convenience common methods + * also takes care of the standard template for all + * pages which is using wicket markup inheritance + */ +public abstract class BasePage extends WebPage { + + protected static final Logger logger = LoggerFactory.getLogger(BasePage.class); + + // helper to avoid polluting non-wicket packages (e.g. excel export, import) with Wicket i18n + public static Map<Name, String> getLocalizedLabels(Component c) { + Map<Name, String> map = new EnumMap<Name, String>(Name.class); + for(Name name : Name.values()) { + map.put(name, c.getLocalizer().getString("item_list." + name.getText(), null)); + } + return map; + } + + protected Jtrac getJtrac() { + return JtracApplication.get().getJtrac(); + } + + protected User getPrincipal() { + return JtracSession.get().getUser(); + } + + protected void setCurrentSpace(Space space) { + JtracSession.get().setCurrentSpace(space); + } + + protected Space getCurrentSpace() { + return JtracSession.get().getCurrentSpace(); + } + + protected String localize(String key) { + return getLocalizer().getString(key, null); + } + + protected String localize(String key, Object... params) { + StringResourceModel m = new StringResourceModel(key, null, null, params); + m.setLocalizer(getLocalizer()); + return m.getString(); + } + + public BasePage() { + String bgColorBlue = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.blue", "#E1ECFE"); + String bgColorGray = JtracApplication.get().getJtrac().loadConfig("jtrac.bgcolor.gray", "#CCCCCC"); + + add(new IndividualHeadPanel().setRenderBodyOnly(true)); + add(new HeaderPanel().setRenderBodyOnly(true)); + String jtracVersion = getJtrac().getReleaseVersion(); + add(new Label("version", jtracVersion)); + add(new HeaderContributor(new IHeaderContributor() { + public void renderHead(IHeaderResponse response) { + String js = "var r = document.querySelector(':root');\n" + + "r.style.setProperty('--blue', '"+bgColorBlue+"');\n" + + "r.style.setProperty('--gray', '"+bgColorGray+"');\n"; + response.renderOnDomReadyJavascript(js); + } + })); + } +} Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/SpacePermissionsPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/SpacePermissionsPage.html 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/SpacePermissionsPage.html 2022-02-10 13:57:51 UTC (rev 1432) @@ -1,14 +1,6 @@ <html> <head> - <wicket:head> - <style> - .workflow { border-style: solid; border-width: 0 1px 1px 0; border-color: black; } - .workflow td { border-style: solid; border-width: 1px 0 0 1px; padding-left: 0.2em; padding-right: 0.2em; } - .state { background: #e1ecfe; } - .mirror { background: #CCCCCC; } - .transition { font-style: italic; } - </style> - </wicket:head> + <wicket:head /> </head> <body> <wicket:extend> Modified: trunk/jtrac/src/main/resources/messages.properties =================================================================== --- trunk/jtrac/src/main/resources/messages.properties 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/resources/messages.properties 2022-02-10 13:57:51 UTC (rev 1432) @@ -200,6 +200,8 @@ config.jtrac.url.base = Base URL of your JTrac installation ( e.g. http://myserver/jtrac ) required for links in the e-mails to work config.jtrac.header.picture = Individual header picture config.jtrac.header.text = Individual header text +config.jtrac.bgcolor.gray = Background color for labels (default #CCCCCC) +config.jtrac.bgcolor.blue = Background color for header (default #E1ECFE) config.jtrac.edit.item = Should the owner of the task edit their items? (set to true, default is false) config.locale.default = Default language used for this JTrac installation e.g. "de" for German config.session.timeout = Time in minutes after which user session expires (default 30 minutes) Modified: trunk/jtrac/src/main/resources/messages_de.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_de.properties 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/resources/messages_de.properties 2022-02-10 13:57:51 UTC (rev 1432) @@ -193,13 +193,15 @@ # DKIM properties for additional mail authenticity config.mail.dkim.signingDomain = Dom\u00e4ne f\u00fcr die signiert wird -config.mail.dkim.selector = Selektor (default ist "default") +config.mail.dkim.selector = Selektor (Default ist "default") config.mail.dkim.derFile = Pfad zum DER-kodierten privaten RSA Schl\u00fcssel -config.mail.dkim.identity = Identit\u00e4t (default ist "mail.from") +config.mail.dkim.identity = Identit\u00e4t (Default ist "mail.from") config.jtrac.url.base = URL dieser Installation (z.B. http://myserver/jtrac) wird ben\u00F6tigt f\u00FCr Links in den Emails -config.jtrac.header.picture = Inidividuelles Bild oben auf Seite -config.jtrac.header.text = Individueller Text oben auf Seite +config.jtrac.header.picture = Individuelles Bild im Header +config.jtrac.header.text = Individueller Text oim Header +config.jtrac.bgcolor.gray = Hintergrundfarbe \u00dcberschriften (Default ist #CCCCCC) +config.jtrac.bgcolor.blue = Hintergrundfarbe Header (Default ist #E1ECFE) config.jtrac.edit.item = Soll der Autor eines Eintrages diesen editieren k\u00f6nnen? (auf true setzen, Default ist false) config.locale.default = Default Sprache, z.B. "de" f\u00FCr Deutsch config.session.timeout = Session Timeout in Minuten (Default 30 Minuten) Modified: trunk/jtrac/src/main/resources/messages_en.properties =================================================================== --- trunk/jtrac/src/main/resources/messages_en.properties 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/resources/messages_en.properties 2022-02-10 13:57:51 UTC (rev 1432) @@ -200,6 +200,8 @@ config.jtrac.url.base = Base URL of your JTrac installation ( e.g. http://myserver/jtrac ) required for links in the e-mails to work config.jtrac.header.picture = Individual header picture config.jtrac.header.text = Individual header text +config.jtrac.bgcolor.gray = Background color for labels (default #CCCCCC) +config.jtrac.bgcolor.blue = Background color for header (default #E1ECFE) config.jtrac.edit.item = Should the owner of the task edit their items? (set to true, default is false) config.locale.default = Default language used for this JTrac installation e.g. "de" for German config.session.timeout = Time in minutes after which user session expires (default 30 minutes) Modified: trunk/jtrac/src/main/webapp/resources/jtrac.css =================================================================== --- trunk/jtrac/src/main/webapp/resources/jtrac.css 2022-02-09 10:51:21 UTC (rev 1431) +++ trunk/jtrac/src/main/webapp/resources/jtrac.css 2022-02-10 13:57:51 UTC (rev 1432) @@ -1,42 +1,52 @@ -body { font-family: Arial; background: #FFF; font-size: 80%; } -table.jtrac th, table.jtrac td.label { background: #CCCCCC; padding-left: 0.2em; padding-right: 0.2em; } -tr.center td { text-align: center; } -.label { font-weight: bold; text-align: right; } -a { color: #0000D9; } -a:hover { color: black; } -img { border: none; vertical-align: middle; } -.multiselect { overflow: auto; background: #FFF; text-align: left; border: 1px solid #CCCCCC; } -.scrollable { height: 10em; } -.error-input { border: 1px solid #CC2200; } -div.error-input { float: left; } -div.error-input select { border: none; } -.error { color: #CC2200; font-weight: bold; margin-bottom: 1em; } -.error-back { background: #FFB6C1; } -.info { color: #0000D9; font-weight: bold; } -.heading { color: #0000D9; font-weight: bold; margin-bottom: 1em; } -.alt { background: #e1ecfe; } -.selected, table.jtrac .selected { background: #c3d9ff; } -.bdr-bottom, tr.bdr-bottom td { border-bottom: 1px solid #CCCCCC; } -.nav-header { background: #CCCCCC; padding: 0.1em; } -.nav-header table, .jtrac-list, .jtrac-view { font-size: 95%; } -.jtrac-view { border: 1px solid #CCCCCC; } -.nav-header img, img.nav-link { margin-top: 1px; margin-right: 0.3em; } -.nav-header img, a img.nav-link { vertical-align: top; display: block; float: left; } -.nav-header td, .nav-table td { font-weight: bold; text-align: right; padding: 0 10px 0 10px; background-color: #e1ecfe; } -.nav-table td.icon { padding: 0; text-align: center; width: 4em; } -.nav-table td a { width: 100%; display: block; } -.bdr-collapse { border-collapse: collapse; } -.bdr-collapse td { padding: 0; } -.page-links { font-weight: bold; } -.nav-header td { padding-left: 0.7em; } -.space-below { padding-bottom: 0.5em; } -tr.sortable th { background-position: right; background-repeat: no-repeat; } -tr.sortable th.order-none { background-image: url("arrow_off.gif"); } -tr.sortable th.order-up { background-color: #c3d9ff; background-image: url("arrow_up.gif"); } -tr.sortable th.order-down { background-color: #c3d9ff; background-image: url("arrow_down.gif"); } -tr.sortable a { color: black; } -tr.sortable a:hover { color: #0000D9; } -/* { list-style-image: url("error.gif"); } */ -li.feedbackPanelINFO { list-style-image: url("success.gif"); padding-left: 0.4em; } -li.feedbackPanelERROR { list-style-image: url("error.gif"); padding-left: 0.4em; } -.menu-option div { font-weight: bold; background-color: #e1ecfe; padding-left: 1em; padding-right: 1em; margin-bottom: 1.5em; } +:root { + --blue: #E1ECFE; + --gray: #CCCCCC; +} +body { font-family: Arial; background: #FFF; font-size: 80%; } +table.jtrac th, table.jtrac td.label { background: var(--gray); padding-left: 0.2em; padding-right: 0.2em; } +tr.center td { text-align: center; } +.label { font-weight: bold; text-align: right; } +a { color: #0000D9; } +a:hover { color: black; } +img { border: none; vertical-align: middle; } +.multiselect { overflow: auto; background: #FFF; text-align: left; border: 1px solid var(--gray); } +.scrollable { height: 10em; } +.error-input { border: 1px solid #CC2200; } +div.error-input { float: left; } +div.error-input select { border: none; } +.error { color: #CC2200; font-weight: bold; margin-bottom: 1em; } +.error-back { background: #FFB6C1; } +.info { color: #0000D9; font-weight: bold; } +.heading { color: #0000D9; font-weight: bold; margin-bottom: 1em; } +.alt { background: var(--blue); } +.selected, table.jtrac .selected { background: #c3d9ff; } +.bdr-bottom, tr.bdr-bottom td { border-bottom: 1px solid var(--gray); } +.nav-header { background: var(--gray); padding: 0.1em; } +.nav-header table, .jtrac-list, .jtrac-view { font-size: 95%; } +.jtrac-view { border: 1px solid var(--gray); } +.nav-header img, img.nav-link { margin-top: 1px; margin-right: 0.3em; } +.nav-header img, a img.nav-link { vertical-align: top; display: block; float: left; } +.nav-header td, .nav-table td { font-weight: bold; text-align: right; padding: 0 10px 0 10px; background-color: var(--blue); } +.nav-table td.icon { padding: 0; text-align: center; width: 4em; } +.nav-table td a { width: 100%; display: block; } +.bdr-collapse { border-collapse: collapse; } +.bdr-collapse td { padding: 0; } +.page-links { font-weight: bold; } +.nav-header td { padding-left: 0.7em; } +.space-below { padding-bottom: 0.5em; } +tr.sortable th { background-position: right; background-repeat: no-repeat; } +tr.sortable th.order-none { background-image: url("arrow_off.gif"); } +tr.sortable th.order-up { background-color: #c3d9ff; background-image: url("arrow_up.gif"); } +tr.sortable th.order-down { background-color: #c3d9ff; background-image: url("arrow_down.gif"); } +tr.sortable a { color: black; } +tr.sortable a:hover { color: #0000D9; } +/* { list-style-image: url("error.gif"); } */ +li.feedbackPanelINFO { list-style-image: url("success.gif"); padding-left: 0.4em; } +li.feedbackPanelERROR { list-style-image: url("error.gif"); padding-left: 0.4em; } +.menu-option div { font-weight: bold; background-color: var(--blue); padding-left: 1em; padding-right: 1em; margin-bottom: 1.5em; } + +.workflow { border-style: solid; border-width: 0 1px 1px 0; border-color: black; } +.workflow td { border-style: solid; border-width: 1px 0 0 1px; padding-left: 0.2em; padding-right: 0.2em; } +.state { background: var(--blue); } +.mirror { background: var(--gray); } +.transition { font-style: italic; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-09 10:51:25
|
Revision: 1431 http://sourceforge.net/p/j-trac/code/1431 Author: udittmer Date: 2022-02-09 10:51:21 +0000 (Wed, 09 Feb 2022) Log Message: ----------- fix broken Excel export (#164), update dependencies, bump version to 2.2.1 Modified Paths: -------------- trunk/jtrac/pom.xml trunk/jtrac/src/main/java/info/jtrac/domain/ExcelFile.java trunk/jtrac/src/main/java/info/jtrac/util/ExcelUtils.java Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2022-02-08 08:49:48 UTC (rev 1430) +++ trunk/jtrac/pom.xml 2022-02-09 10:51:21 UTC (rev 1431) @@ -4,7 +4,7 @@ <groupId>info.jtrac</groupId> <artifactId>jtrac</artifactId> <packaging>war</packaging> - <version>2.2.0</version> + <version>2.2.1</version> <name>JTrac</name> <description> JTrac is a generic issue-tracking web-application that can be easily customized by adding custom fields @@ -67,7 +67,7 @@ <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> - <version>2.55.0</version> + <version>2.56.0</version> <scope>test</scope> </dependency> <dependency> @@ -355,7 +355,7 @@ <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> - <version>5.1.0</version> + <version>5.2.0</version> </dependency> <dependency> <groupId>org.tmate</groupId> Modified: trunk/jtrac/src/main/java/info/jtrac/domain/ExcelFile.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/domain/ExcelFile.java 2022-02-08 08:49:48 UTC (rev 1430) +++ trunk/jtrac/src/main/java/info/jtrac/domain/ExcelFile.java 2022-02-09 10:51:21 UTC (rev 1431) @@ -143,6 +143,7 @@ } break; case TIME_STAMP: + case LAST_CHANGED: if(value == null || value instanceof Date) { return true; } Modified: trunk/jtrac/src/main/java/info/jtrac/util/ExcelUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ExcelUtils.java 2022-02-08 08:49:48 UTC (rev 1430) +++ trunk/jtrac/src/main/java/info/jtrac/util/ExcelUtils.java 2022-02-09 10:51:21 UTC (rev 1431) @@ -175,6 +175,7 @@ setText(row, col++, (item.getAssignedTo() == null ? "" : item.getAssignedTo().getName())); break; case TIME_STAMP: + case LAST_CHANGED: setDate(row, col++, item.getTimeStamp()); break; case SPACE: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-02-08 08:49:50
|
Revision: 1430 http://sourceforge.net/p/j-trac/code/1430 Author: udittmer Date: 2022-02-08 08:49:48 +0000 (Tue, 08 Feb 2022) Log Message: ----------- make comment edit field bigger, escape raw HTML when using Markdown Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html Modified: trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-01-21 09:54:10 UTC (rev 1429) +++ trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-02-08 08:49:48 UTC (rev 1430) @@ -93,6 +93,7 @@ }; } }) + .escapeHtml(true) .sanitizeUrls(true) .build(); } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html 2022-01-21 09:54:10 UTC (rev 1429) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html 2022-02-08 08:49:48 UTC (rev 1430) @@ -26,7 +26,7 @@ <wicket:message key="item_view_form.comment"/> <font color="red">*</font> </td> - <td><textarea wicket:id="comment" rows="6" cols="70"></textarea></td> + <td><textarea wicket:id="comment" rows="8" cols="80"></textarea></td> </tr> <tr> <td/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-01-17 13:59:40
|
Revision: 1428 http://sourceforge.net/p/j-trac/code/1428 Author: udittmer Date: 2022-01-17 13:59:38 +0000 (Mon, 17 Jan 2022) Log Message: ----------- handle base URLs correctly whether they end with a {U+201C}/{U+201C} or not Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java Modified: trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-01-12 19:44:50 UTC (rev 1427) +++ trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2022-01-17 13:59:38 UTC (rev 1428) @@ -159,9 +159,14 @@ if (text == null) { return null; } else { + if (baseUrl == null) + baseUrl = "/"; + if (! baseUrl.endsWith("/")) + baseUrl += "/"; + for (Space space : spaces) { text = text.replaceAll("(?i)(?<!/)"+space.getPrefixCode()+"-[0-9]+", - "<a href='"+(baseUrl==null ? "/" : baseUrl)+"app/item/$0' target='_blank'>$0</a>"); + "<a href='"+baseUrl+"app/item/$0' target='_blank'>$0</a>"); } return text; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-01-12 19:44:51
|
Revision: 1427 http://sourceforge.net/p/j-trac/code/1427 Author: udittmer Date: 2022-01-12 19:44:50 +0000 (Wed, 12 Jan 2022) Log Message: ----------- no need for log4j updates - the API jar isn't vulnerable Modified Paths: -------------- trunk/jtrac/pom.xml Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2022-01-12 17:01:00 UTC (rev 1426) +++ trunk/jtrac/pom.xml 2022-01-12 19:44:50 UTC (rev 1427) @@ -356,19 +356,7 @@ <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>5.1.0</version> - <exclusions> - <exclusion> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - </exclusion> - </exclusions> </dependency> - <dependency> - <!-- POI needs this, but pulls in 2.14.1, which is insecure --> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>2.16.0</version> - </dependency> <dependency> <groupId>org.tmate</groupId> <artifactId>javasvn</artifactId> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-01-12 17:01:08
|
Revision: 1426 http://sourceforge.net/p/j-trac/code/1426 Author: udittmer Date: 2022-01-12 17:01:00 +0000 (Wed, 12 Jan 2022) Log Message: ----------- apply markdown to item details on search results page Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java 2021-12-14 15:29:09 UTC (rev 1425) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java 2022-01-12 17:01:00 UTC (rev 1426) @@ -64,5 +64,10 @@ StringResourceModel m = new StringResourceModel(key, null, null, params); m.setLocalizer(getLocalizer()); return m.getString(); - } + } + + protected boolean renderMarkdown() { + String markdown = JtracApplication.get().getJtrac().loadConfig("markdown.enabled"); + return markdown != null && markdown.equalsIgnoreCase("true"); + } } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java 2021-12-14 15:29:09 UTC (rev 1425) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java 2022-01-12 17:01:00 UTC (rev 1426) @@ -268,6 +268,7 @@ protected void populateItem(ListItem listItem) { ColumnHeading ch = (ColumnHeading) listItem.getModelObject(); IModel value = null; + boolean dontEscape = false; if(ch.isField()) { value = new Model(item.getCustomValue(ch.getField().getName())); } else { @@ -310,6 +311,10 @@ listItem.add(detailFrag); return; } else { + if (renderMarkdown()) { + item.setDetail(ItemUtils.renderMarkdown(item.getDetail())); + dontEscape = true; + } value = new PropertyModel(item, "detail"); } break; @@ -349,6 +354,8 @@ } Label label = new Label("column", value); label.setRenderBodyOnly(true); + if (dontEscape) + label.setEscapeModelStrings(false); listItem.add(label); } }; Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2021-12-14 15:29:09 UTC (rev 1425) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2022-01-12 17:01:00 UTC (rev 1426) @@ -73,11 +73,6 @@ addComponents(item); } - protected boolean renderMarkdown() { - String markdown = JtracApplication.get().getJtrac().loadConfig("markdown.enabled"); - return markdown != null && markdown.equalsIgnoreCase("true"); - } - /** * This method allows to add components (items). * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-12-14 15:29:11
|
Revision: 1425 http://sourceforge.net/p/j-trac/code/1425 Author: udittmer Date: 2021-12-14 15:29:09 +0000 (Tue, 14 Dec 2021) Log Message: ----------- doc improvements, log4j dependency updated Modified Paths: -------------- trunk/jtrac/doc/src/index.xml trunk/jtrac/pom.xml Modified: trunk/jtrac/doc/src/index.xml =================================================================== --- trunk/jtrac/doc/src/index.xml 2021-12-14 09:53:14 UTC (rev 1424) +++ trunk/jtrac/doc/src/index.xml 2021-12-14 15:29:09 UTC (rev 1425) @@ -68,7 +68,7 @@ but as of early 2007 (version 2.1.0 onwards) JTrac <ulink url="https://ptrthomas.wordpress.com/2007/03/02/wicket-impressions-moving-from-spring-mvc-webflow/">switched to </ulink> using the <ulink url="https://wicket.apache.org/">Apache Wicket</ulink> framework. - After being dormant for a long time, JTrac development picked up again in 2021, and a new version 2.2 was + After being dormant for a long time, JTrac development picked up again in 2021, and a new version 2.2.0 was released that moved the Java baseline to Java 8. </para> <para> @@ -100,7 +100,7 @@ There where a number of new features, changes and bugfixes: <itemizedlist> <listitem> - <para>The details and comments fields support Markdown syntax.</para> + <para>The details and comments fields support <ulink url="https://commonmark.org/help/">Markdown</ulink> syntax.</para> </listitem> <listitem> <para>All dates and times can optionally be displayed in a "pretty" format like "10 minutes ago", "2 months ago" etc.</para> @@ -110,10 +110,10 @@ </listitem> <listitem> <para>The dashboard can be configured to show a number of links that are relevant to the project, - like saved searches ("All Open Tickets") or to other pages.</para> + like saved searches ("All Open and In-Progress Tickets") or to other pages.</para> </listitem> <listitem> - <para>Outgoing emails can be signed using DKIM.</para> + <para>Outgoing emails can be signed using <ulink url="https://en.wikipedia.org/wiki/DomainKeys_Identified_Mail">DKIM</ulink>.</para> </listitem> <listitem> <para>More items can be configured at runtime under Options -> Manage Settings</para> @@ -127,9 +127,14 @@ <listitem> <para>Some email issues e.g. sending duplicate mails are fixed.</para> </listitem> + <listitem> + <para>Localizations into Ukrainian, Hungarian, Turkish, Arabic, Slovenian, Czech, Korean, Norwegian and Swedish have been added.</para> + </listitem> </itemizedlist> - For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures220">wiki page on SourceForge.</ulink> </para> + <para> + For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures220">wiki page</ulink> on SourceForge. + </para> </sect1> </chapter> Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-12-14 09:53:14 UTC (rev 1424) +++ trunk/jtrac/pom.xml 2021-12-14 15:29:09 UTC (rev 1425) @@ -367,7 +367,7 @@ <!-- POI needs this, but pulls in 2.14.1, which is insecure --> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> - <version>2.15.0</version> + <version>2.16.0</version> </dependency> <dependency> <groupId>org.tmate</groupId> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-12-14 09:53:17
|
Revision: 1424 http://sourceforge.net/p/j-trac/code/1424 Author: udittmer Date: 2021-12-14 09:53:14 +0000 (Tue, 14 Dec 2021) Log Message: ----------- more doc updates Modified Paths: -------------- trunk/jtrac/doc/src/index.xml trunk/jtrac/doc/styles/fopdf.xsl trunk/jtrac/doc/styles/html.css Modified: trunk/jtrac/doc/src/index.xml =================================================================== --- trunk/jtrac/doc/src/index.xml 2021-12-13 19:33:46 UTC (rev 1423) +++ trunk/jtrac/doc/src/index.xml 2021-12-14 09:53:14 UTC (rev 1424) @@ -58,7 +58,7 @@ and you can define custom fields to track almost anything you need. </para> <para> - JTrac development used to be hosted at <ulink url="https://jtrac.dev.java.net"/> but moved to SourceForge + JTrac development used to be hosted at jtrac.dev.java.net, but moved to SourceForge in early 2006. The older working version was based on Spring MVC, Spring JDBC and MS Access and is not being maintained any more. JTrac 2.0 uses Java 5.0 features and was completely re-written to use <ulink url="https://www.hibernate.org/">Hibernate</ulink> for persistence and the @@ -1235,7 +1235,7 @@ <sect1 id="faq-version"> <title>Why start with version 2.0? What about 1.0?</title> <para> - There was an earlier version of JTrac which used to be hosted at <ulink url="https://jtrac.dev.java.net"/> + There was an earlier version of JTrac which used to be hosted at jtrac.dev.java.net. That project was called "jTrac" (with a lowercase 'j') and it was based on Spring JDBC and MS Access. JTrac was completely re-written to use Spring and Hibernate - and the 2.0 version number reflects this. </para> @@ -1256,7 +1256,7 @@ <title>How can I help?</title> <para> We welcome code contributions in the form of patches which you can submit - <ulink url="https://sourceforge.net/tracker/?atid=825943&group_id=162983">here</ulink>. + <ulink url="https://sourceforge.net/p/j-trac/patches/">here</ulink>. JTrac has a detailed <link linkend="dev-guide">developer guide</link> which can get you up and running even if you are new to Java development. </para> @@ -1318,10 +1318,10 @@ <para> <itemizedlist> <listitem> - <para>Bugs: <ulink url="https://sourceforge.net/tracker/?atid=825941&group_id=162983"></ulink></para> + <para>Bugs: <ulink url="https://sourceforge.net/p/j-trac/bugs/"></ulink></para> </listitem> <listitem> - <para>Feature Requests: <ulink url="https://sourceforge.net/tracker/?atid=825944&group_id=162983"></ulink></para> + <para>Feature Requests: <ulink url="https://sourceforge.net/p/j-trac/feature-requests/"></ulink></para> </listitem> </itemizedlist> </para> @@ -1351,7 +1351,7 @@ contributions and with your support JTrac can become better than it is today. </para> <para> - Apart from using the <ulink url="https://sourceforge.net/forum/forum.php?forum_id=552477">forums</ulink> + Apart from using the <ulink url="https://sourceforge.net/p/j-trac/discussion/552477">forums</ulink> you can also consider joining the JTrac <ulink url="https://lists.sourceforge.net/lists/listinfo/j-trac-users">mailing-list</ulink>. </para> @@ -1598,13 +1598,13 @@ These files are tested on HSQLDB and may need minor changes to work with other databases. No re-compilation is needed, therefore making it extremely easy for you to tweak them if required. Of course it is strongly recommended that you backup your old data before an upgrade. - Please use the <ulink url="https://sourceforge.net/forum/forum.php?forum_id=552477">JTrac forums</ulink> + Please use the <ulink url="https://sourceforge.net/p/j-trac/discussion/552477">JTrac forums</ulink> for help and for helping other users with your experiences. </para> <para> If you are shadowing the development builds you would be able to obtain the latest database upgrade - scripts from here: <ulink url="https://j-trac.svn.sourceforge.net/viewvc/j-trac/trunk/jtrac/etc/"/> Look for files - that end with ".bsh" - e.g: "jtrac-hsqldb-2_0rc3-to-2_0.bsh" + scripts from here: <ulink url="https://sourceforge.net/p/j-trac/code/HEAD/tree/trunk/jtrac/etc/"/> Look for files + that end with ".bsh" - e.g: "jtrac-hsqldb-2_1-to-2_2.bsh" </para> <para> Steps to follow: @@ -1646,14 +1646,13 @@ classpath along with the beanshell jar. This is how the command would look like: <programlisting> -java -cp bsh-2.0b4.jar;hsqldb-1.8.0.1.jar bsh.Interpreter jtrac-hsqldb-2_0rc3-to-2_0.bsh +java -cp bsh-2.0b5.jar;hsqldb-2.5.2.jar bsh.Interpreter jtrac-hsqldb-2_1-to-2_2.bsh </programlisting> </para> </listitem> <listitem> <para> - If there were no errors, you can now upgrade the WAR (don't forget to delete the temporary files) - and restart. + If there were no errors, you can now upgrade the WAR (don't forget to delete the temporary files) and restart. </para> </listitem> </itemizedlist> @@ -1745,7 +1744,7 @@ </para> <para> If you get stuck or have any questions about setting up and getting started, feel free to use the - <ulink url="https://sourceforge.net/forum/forum.php?forum_id=552477">JTrac forums</ulink> for help. + <ulink url="https://sourceforge.net/p/j-trac/discussion/552477">JTrac forums</ulink> for help. </para> </sect1> <sect1 id="dev-check-prerequisites"> @@ -1759,7 +1758,7 @@ <title>Download / Extract Source</title> <para> Download the source code from - <ulink url="https://sourceforge.net/project/showfiles.php?group_id=162983&package_id=184104">SourceForge</ulink> + <ulink url="https://sourceforge.net/projects/j-trac/files/jtrac/2.2.0/">SourceForge</ulink> and extract it to a convenient location. Note that the source code is a separate download from the main (binary) and the file name will be of the form "jtrac-src-X.Y.Z.zip". </para> @@ -1768,7 +1767,7 @@ The Subversion URL for the JTrac source code is as follows: <programlisting> -https://j-trac.svn.sourceforge.net/svnroot/j-trac/trunk/jtrac +https://sourceforge.net/p/j-trac/code/HEAD/tree/trunk/jtrac </programlisting> </para> <para> @@ -1929,17 +1928,12 @@ <para> You can also get the latest versions of the "messages_en.properties" as well as the available translations directly from version control at this url: - <ulink url="https://j-trac.svn.sourceforge.net/viewvc/j-trac/trunk/jtrac/src/main/resources/"/> + <ulink url="https://sourceforge.net/p/j-trac/code/HEAD/tree/trunk/jtrac/src/main/resources/"/> Since these may change a lot, it is recommended that you check here as well before submitting a translation. We recommend that you submit translations as attachments on the - <ulink url="https://sourceforge.net/tracker/?atid=825943&group_id=162983">JTrac patches tracker</ulink> + <ulink url="https://sourceforge.net/p/j-trac/patches/">JTrac patches tracker</ulink> where we keep track of code contributions as well. </para> - <para> - You can use this nice open-source tool called <ulink url="https://prbeditor.dev.java.net/">PRBEditor</ulink> - that really helps by showing the English and translated versions side by side on a single screen. It also - takes care of handling special characters. - </para> </sect1> </chapter> Modified: trunk/jtrac/doc/styles/fopdf.xsl =================================================================== --- trunk/jtrac/doc/styles/fopdf.xsl 2021-12-13 19:33:46 UTC (rev 1423) +++ trunk/jtrac/doc/styles/fopdf.xsl 2021-12-14 09:53:14 UTC (rev 1424) @@ -60,7 +60,7 @@ <fo:table-row> <fo:table-cell text-align="center"> <fo:block font-family="Helvetica" font-size="12pt" padding="10mm"> - <xsl:text>Copyright ©right; 2004-2008 </xsl:text> + <xsl:text>Copyright ©right; 2004-2021 </xsl:text> <xsl:for-each select="bookinfo/authorgroup/author"> <xsl:if test="position() > 1"> <xsl:text>, </xsl:text> Modified: trunk/jtrac/doc/styles/html.css =================================================================== --- trunk/jtrac/doc/styles/html.css 2021-12-13 19:33:46 UTC (rev 1423) +++ trunk/jtrac/doc/styles/html.css 2021-12-14 09:53:14 UTC (rev 1424) @@ -1,302 +1,302 @@ -/** - * This CSS file is for styling the HTML generated from docbook XML source. - * It is adapted from the one used by the Spring Framework team. - * We thank and credit the Spring Framework development and documentation team. - * http://springframework.cvs.sourceforge.net/springframework/spring/docs/reference/styles/ - */ - -BODY { - text-align: justify; - margin-right: 2em; - margin-left: 2em; -} - -A[accesskey^="p"] { - font-family: Verdana, Arial, helvetica, sans-serif; - color: #003399; -} - -A[accesskey^="u"] { - font-family: Verdana, Arial, helvetica, sans-serif; - color: #003399; -} - -A[accesskey^="h"] { - font-family: Verdana, Arial, helvetica, sans-serif; - color: #003399; -} - -A[accesskey^="n"] { - font-family: Verdana, Arial, helvetica, sans-serif; - color: #003399; -} - -A { - color: #003399; - font-family: Verdana, Arial, helvetica, sans-serif; -} - -A:active { - color: #003399; -} - -A:visited { - color: #888888; -} - -P { - font-family: Verdana, Arial; -} - -DT { - font-family: Verdana, Arial; - font-size: 12px; -} - -P, DL, DT, DD, BLOCKQUOTE { - color: #000000; - margin-bottom: 3px; - margin-top: 3px; - padding-top: 0px; -} - -OL, UL, P { - margin-top: 6px; - margin-bottom: 6px; -} - -P, BLOCKQUOTE { - font-size: 90%; -} - -P.releaseinfo { - font-size: 100%; - font-weight: bold; - font-family: Verdana, Arial, helvetica, sans-serif; - padding-top: 10px; -} - -P.pubdate { - font-size: 120%; font-weight: bold; - font-family: Verdana, Arial, helvetica, sans-serif; -} - -td { - font-size: 80%; -} - -TD, TH, SPAN { - color: #000000; -} - -TD[width^="40%"] { - font-family: Verdana, Arial, helvetica, sans-serif; - font-size: 12px; - color: #003399; -} - -TABLE[summary^="Navigation header"] tbody tr th[colspan^="3"] { - font-family: Verdana, Arial, helvetica, sans-serif; -} - -BLOCKQUOTE { - margin-right: 0px; -} - -H1, H2, H3, H4, H5, H6 { - color: #000000; - font-weight:500; - margin-top:0px; - padding-top:14px; - font-family: Verdana, Arial, helvetica, sans-serif; - margin-bottom: 0px; -} - -H2.title { - font-weight:800; - margin-bottom: 8px; -} - -H2.subtitle { - font-weight:800; - margin-bottom: 20px; -} - -.firstname, .surname { - font-size: 12px; - font-family: Verdana, Arial, helvetica, sans-serif; -} - -TABLE { - border-collapse: collapse; - border-spacing:0; - border: 1px thin black; - empty-cells: hide; - margin: 10px 0px 30px 50px; - width: 90%; -} - -div.table { - margin: 30px 0 30 0; - border: 1px dashed gray; - padding: 10px; -} - -div.table > p.title { - padding-left: 10px; -} - -table[summary^="Navigation footer"] { - border-collapse: collapse; - border-spacing:0; - border: 1px thin black; - empty-cells: hide; - margin: 0px; - width: 100%; -} - -table[summary^="Note"], table[summary^="Warning"], table[summary^="Tip"] { - border-collapse: collapse; - border-spacing:0; - border: 1px thin black; - empty-cells: hide; - margin: 10px 0 10 -20; - width: 100%; -} - -TD { - padding: 4pt; - font-family: Verdana, Arial, helvetica, sans-serif; -} - -div.warning TD { - text-align: justify; -} - -H1 { - font-size: 150%; -} -H2 { - font-size: 110%; -} -H3 { - font-size: 100%; font-weight: bold; -} -H4 { - font-size: 90%; font-weight: bold; -} -H5 { - font-size: 90%; font-style: italic; -} -H6 { - font-size: 100%; font-style: italic; -} - -TT { - font-size: 110%; - font-family: "Courier New", Courier, monospace; - color: #000000; -} - -.navheader, .navfooter { - border: none; -} - -div.navheader table, div.navfooter table { - border: none; - background-color: #dedeff; -} - -div.navfooter hr { - /**display: none;*/ -} - -PRE { - font-size: 110%; - padding: 5px; - border-style: solid; - border-width: 1px; - border-color: #CCCCCC; - background-color: #F4F4F4; -} - -UL, OL, LI { - list-style: disc; -} - -HR { - width: 100%; - height: 1px; - background-color: #CCCCCC; - border-width: 0px; - padding: 0px; - color: #CCCCCC; -} - -.variablelist { - padding-top: 10; - padding-bottom:10; - margin:0; -} - -.term { - font-weight:bold; -} - -.mediaobject { - padding-top: 30px; - padding-bottom: 30px; -} - -.legalnotice { - font-family: Verdana, Arial, helvetica, sans-serif; - font-size: 12px; - font-style: italic; -} - -.sidebar { - float: right; - margin: 10px 0px 10px 30px; - padding: 10px 20px 20px 20px; - width: 33%; - border: 1px solid black; - background-color: #F4F4F4; - font-size: 14px; -} - -.programlisting * .classname { - font-size: 95%; -} - -.programlisting * .interfacename { - font-size: 95%; -} - -.programlisting * .literal { - font-size: 95%; -} - -.property { - font-family: "Courier New", Courier, monospace; -} - -a code { - font-family: Verdana, Arial; -} - -td code { - font-size: 110%; -} - -div.note * td, div.tip * td, div.warning * td { - text-align: justify; - font-size: 100%; -} - -.programlisting * .lineannotation { - color: green; -} - -.programlisting * .lineannotation .bold { - color: green; -} +/** + * This CSS file is for styling the HTML generated from docbook XML source. + * It is adapted from the one used by the Spring Framework team. + * We thank and credit the Spring Framework development and documentation team. + * http://springframework.cvs.sourceforge.net/springframework/spring/docs/reference/styles/ + */ + +BODY { + text-align: justify; + margin-right: 2em; + margin-left: 2em; +} + +A[accesskey^="p"] { + font-family: Verdana, Arial, helvetica, sans-serif; + color: #003399; +} + +A[accesskey^="u"] { + font-family: Verdana, Arial, helvetica, sans-serif; + color: #003399; +} + +A[accesskey^="h"] { + font-family: Verdana, Arial, helvetica, sans-serif; + color: #003399; +} + +A[accesskey^="n"] { + font-family: Verdana, Arial, helvetica, sans-serif; + color: #003399; +} + +A { + color: #003399; + font-family: Verdana, Arial, helvetica, sans-serif; +} + +A:active { + color: #003399; +} + +A:visited { + color: #888888; +} + +P { + font-family: Verdana, Arial; +} + +DT { + font-family: Verdana, Arial; + font-size: 12px; +} + +P, DL, DT, DD, BLOCKQUOTE { + color: #000000; + margin-bottom: 3px; + margin-top: 3px; + padding-top: 0px; +} + +OL, UL, P { + margin-top: 6px; + margin-bottom: 6px; +} + +P, BLOCKQUOTE { + font-size: 90%; +} + +P.releaseinfo { + font-size: 100%; + font-weight: bold; + font-family: Verdana, Arial, helvetica, sans-serif; + padding-top: 10px; +} + +P.pubdate { + font-size: 120%; font-weight: bold; + font-family: Verdana, Arial, helvetica, sans-serif; +} + +td { + font-size: 80%; +} + +TD, TH, SPAN { + color: #000000; +} + +TD[width^="40%"] { + font-family: Verdana, Arial, helvetica, sans-serif; + font-size: 12px; + color: #003399; +} + +TABLE[summary^="Navigation header"] tbody tr th[colspan^="3"] { + font-family: Verdana, Arial, helvetica, sans-serif; +} + +BLOCKQUOTE { + margin-right: 0px; +} + +H1, H2, H3, H4, H5, H6 { + color: #000000; + font-weight:500; + margin-top:0px; + padding-top:14px; + font-family: Verdana, Arial, helvetica, sans-serif; + margin-bottom: 0px; +} + +H2.title { + font-weight:800; + margin-bottom: 8px; +} + +H2.subtitle { + font-weight:800; + margin-bottom: 20px; +} + +.firstname, .surname { + font-size: 12px; + font-family: Verdana, Arial, helvetica, sans-serif; +} + +TABLE { + border-collapse: collapse; + border-spacing:0; + border: 1px thin black; + empty-cells: hide; + margin: 10px 0px 30px 50px; + width: 90%; +} + +div.table { + margin: 30px 0 30 0; + border: 1px dashed gray; + padding: 10px; +} + +div.table > p.title { + padding-left: 10px; +} + +table[summary^="Navigation footer"] { + border-collapse: collapse; + border-spacing:0; + border: 1px thin black; + empty-cells: hide; + margin: 0px; + width: 100%; +} + +table[summary^="Note"], table[summary^="Warning"], table[summary^="Tip"] { + border-collapse: collapse; + border-spacing:0; + border: 1px thin black; + empty-cells: hide; + margin: 10px 0 10 -20; + width: 100%; +} + +TD { + padding: 4pt; + font-family: Verdana, Arial, helvetica, sans-serif; +} + +div.warning TD { + text-align: justify; +} + +H1 { + font-size: 150%; +} +H2 { + font-size: 110%; +} +H3 { + font-size: 100%; font-weight: bold; +} +H4 { + font-size: 90%; font-weight: bold; +} +H5 { + font-size: 90%; font-style: italic; +} +H6 { + font-size: 100%; font-style: italic; +} + +TT { + font-size: 110%; + font-family: "Courier New", Courier, monospace; + color: #000000; +} + +.navheader, .navfooter { + border: none; +} + +div.navheader table, div.navfooter table { + border: none; + background-color: #dedeff; +} + +div.navfooter hr { + /**display: none;*/ +} + +PRE { + font-size: 110%; + padding: 5px; + border-style: solid; + border-width: 1px; + border-color: #CCCCCC; + background-color: #F4F4F4; +} + +UL, OL, LI { + list-style: disc; +} + +HR { + width: 100%; + height: 1px; + background-color: #CCCCCC; + border-width: 0px; + padding: 0px; + color: #CCCCCC; +} + +.variablelist { + padding-top: 10; + padding-bottom:10; + margin:0; +} + +.term { + font-weight:bold; +} + +.mediaobject { + padding-top: 30px; + padding-bottom: 30px; +} + +.legalnotice { + font-family: Verdana, Arial, helvetica, sans-serif; + font-size: 12px; + font-style: italic; +} + +.sidebar { + float: right; + margin: 10px 0px 10px 30px; + padding: 10px 20px 20px 20px; + width: 33%; + border: 1px solid black; + background-color: #F4F4F4; + font-size: 14px; +} + +.programlisting * .classname { + font-size: 95%; +} + +.programlisting * .interfacename { + font-size: 95%; +} + +.programlisting * .literal { + font-size: 95%; +} + +.property { + font-family: "Courier New", Courier, monospace; +} + +a code { + font-family: Verdana, Arial; +} + +td code { + font-size: 110%; +} + +div.note * td, div.tip * td, div.warning * td { + text-align: justify; + font-size: 100%; +} + +.programlisting * .lineannotation { + color: green; +} + +.programlisting * .lineannotation .bold { + color: green; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-12-13 19:33:49
|
Revision: 1423 http://sourceforge.net/p/j-trac/code/1423 Author: udittmer Date: 2021-12-13 19:33:46 +0000 (Mon, 13 Dec 2021) Log Message: ----------- doc improvements Modified Paths: -------------- trunk/jtrac/doc/src/index.xml Added Paths: ----------- trunk/jtrac/doc/src/images/configure-links.png trunk/jtrac/doc/src/images/dashboard-with-links.png Added: trunk/jtrac/doc/src/images/configure-links.png =================================================================== (Binary files differ) Index: trunk/jtrac/doc/src/images/configure-links.png =================================================================== --- trunk/jtrac/doc/src/images/configure-links.png 2021-12-13 17:02:32 UTC (rev 1422) +++ trunk/jtrac/doc/src/images/configure-links.png 2021-12-13 19:33:46 UTC (rev 1423) Property changes on: trunk/jtrac/doc/src/images/configure-links.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/jtrac/doc/src/images/dashboard-with-links.png =================================================================== (Binary files differ) Index: trunk/jtrac/doc/src/images/dashboard-with-links.png =================================================================== --- trunk/jtrac/doc/src/images/dashboard-with-links.png 2021-12-13 17:02:32 UTC (rev 1422) +++ trunk/jtrac/doc/src/images/dashboard-with-links.png 2021-12-13 19:33:46 UTC (rev 1423) Property changes on: trunk/jtrac/doc/src/images/dashboard-with-links.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Modified: trunk/jtrac/doc/src/index.xml =================================================================== --- trunk/jtrac/doc/src/index.xml 2021-12-13 17:02:32 UTC (rev 1422) +++ trunk/jtrac/doc/src/index.xml 2021-12-13 19:33:46 UTC (rev 1423) @@ -394,6 +394,33 @@ </caption> </mediaobject> </para> + <para> + The Dashboard can also be configured to display a list of links that are relevant to the project, + or shortcuts to saved searches. (Search result pages contain all search parameters in the URL, + so it's possible to bookmark a search like "all open or in-progress tickets"). For easy access + those, but also entirely different links, can be displayed on the Dashboard. The links are + configured under "OPTIONS -> Configure links" as shown below. + </para> + <para> + <mediaobject> + <imageobject role="html"> + <imagedata align="center" fileref="../images/dashboard-with-links.png"/> + </imageobject> + <caption> + <para>A Dashboard displaying a saved search and some external links</para> + </caption> + </mediaobject> + </para> + <para> + <mediaobject> + <imageobject role="html"> + <imagedata align="center" fileref="../images/configure-links.png"/> + </imageobject> + <caption> + <para>The settings for the links shown above</para> + </caption> + </mediaobject> + </para> </sect1> <sect1 id="features-searchall"> <title>Search Across All Projects</title> @@ -400,7 +427,7 @@ <para> In addition to be able to search within a single space (project) JTrac allows for searching across all (or a sub set of) projects that a user is mapped to. For example, in the screenshot of the - dashboard above, there are two projects. The "SEARCH" link at the top of the page (as well as the "search" + dashboard above, there are two projects. The "SEARCH" link at the top of the page (as well as the "search" link on the "totals" row) would bring up the search wizard that can search across all (or a subset of) the spaces assigned to the currently logged in user. </para> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-12-13 17:02:35
|
Revision: 1422 http://sourceforge.net/p/j-trac/code/1422 Author: udittmer Date: 2021-12-13 17:02:32 +0000 (Mon, 13 Dec 2021) Log Message: ----------- work on docs for 2.2.0 Modified Paths: -------------- trunk/jtrac/doc/src/index.xml trunk/jtrac/doc/styles/fopdf.xsl Modified: trunk/jtrac/doc/src/index.xml =================================================================== --- trunk/jtrac/doc/src/index.xml 2021-12-13 10:27:43 UTC (rev 1421) +++ trunk/jtrac/doc/src/index.xml 2021-12-13 17:02:32 UTC (rev 1422) @@ -75,7 +75,7 @@ JTrac is extremely easy to install and the only pre-requisite is a Java 8 (or higher) Runtime Environment. You can be up and running in seconds because JTrac comes bundled with a small-footprint web-application server called <ulink url="https://www.eclipse.org/jetty/">Jetty</ulink> and an embedded database called - <ulink url="https://www.hsqldb.org/">HSQLDB</ulink>. Please refer to the + <ulink url="https://www.hsqldb.org/">HSQLDB</ulink>. Please refer to the <link linkend="installation">installation</link> section of this documentation for details. You can also choose to drop the WAR file into an application server of your choice and start using JTrac right away. </para> @@ -84,7 +84,7 @@ <sect1 id="introduction-releasenotes"> <title>Release Notes: Version 2.1.0</title> <para> - There are no database changes between version 2.0 and 2.1.0. Instructions on how to upgrade are + There are no database changes between version 2.0 and 2.1.0. Instructions on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. The bundled Jetty web-app server has been upgraded from version 6.0.2 to 6.1.1 but it is not mandatory that you upgrade. </para> @@ -93,24 +93,42 @@ <sect1 id="introduction-releasenotes-2_2"> <title>Release Notes: Version 2.2.0</title> <para> - There are no database changes between version 2.1.0 and 2.2.0. Instructions on how to upgrade are - available in the "<link linkend="upgrading">upgrading</link>" section of this document. + There is a new table in the database in 2.2.0 to accommodate the new saved link/bookmark feature. Instructions + on how to upgrade are available in the "<link linkend="upgrading">upgrading</link>" section of this document. </para> <para> - There where some minor changes and bugfixes: + There where a number of new features, changes and bugfixes: <itemizedlist> <listitem> + <para>The details and comments fields support Markdown syntax.</para> + </listitem> + <listitem> + <para>All dates and times can optionally be displayed in a "pretty" format like "10 minutes ago", "2 months ago" etc.</para> + </listitem> + <listitem> + <para>It's now possible to bookmarks searches, as all relevant parameters are part of the URL.</para> + </listitem> + <listitem> + <para>The dashboard can be configured to show a number of links that are relevant to the project, + like saved searches ("All Open Tickets") or to other pages.</para> + </listitem> + <listitem> + <para>Outgoing emails can be signed using DKIM.</para> + </listitem> + <listitem> + <para>More items can be configured at runtime under Options -> Manage Settings</para> + </listitem> + <listitem> <para>It is possible to configure an individual header and an individual logo for your own JTrac.</para> </listitem> <listitem> - <para>Errors that were occured because of missing language ressources are fixed.</para> + <para>Errors that occured because of missing language resources are fixed.</para> </listitem> <listitem> - <para>Some email-issues e.g. sending duplicate mails are fixed.</para> + <para>Some email issues e.g. sending duplicate mails are fixed.</para> </listitem> </itemizedlist> - For details see the <ulink url="https://sourceforge.net/projects/j-trac/">different tracker at - the sourceforge website.</ulink> + For details see this <ulink url="https://sourceforge.net/p/j-trac/wiki/NewFeatures220">wiki page on SourceForge.</ulink> </para> </sect1> </chapter> @@ -179,8 +197,7 @@ </para> <para> The screenshot below shows how creating a new item would look like for the typical - project (space) where 'Severity', 'Module', 'Type' and 'Priority' have been defined - as custom fields. + project (space) where 'Severity', 'Module', 'Type' and 'Priority' have been defined as custom fields. </para> <para> <mediaobject> @@ -317,10 +334,9 @@ </para> <para> Field-level permissions can be mapped to roles which allows for even more flexibility. - For example, you can set a project up so that only a "MANAGER" can change the "Severity" level - after a bug is submitted. JTrac makes it possible for you to define very complex workflows, complete - with both Status and Role dependent field-level permissions, and you can do all this within a - single admin screen. + For example, you can set a project up so that only a "MANAGER" can change the "Severity" level after + a bug is submitted. JTrac makes it possible for you to define very complex workflows, complete with both + Status and Role dependent field-level permissions, and you can do all this within a single admin screen. </para> </sect1> <sect1 id="features-search"> @@ -327,13 +343,11 @@ <title>Search Custom Fields</title> <para> The intuitive search screen (shown below) allows for easy execution of common queries such as - find all items "logged by" or "assigned to" a user (or users). JTrac allows for filtering even - on custom fields. + find all items "logged by" or "assigned to" a user (or users). JTrac allows for filtering even on custom fields. </para> <para> You can navigate back to the search setup screen from the search results screen and have the - search parameters still active. This is useful when trying to tweak complex queries by - trial and error. + search parameters still active. This is useful when trying to tweak complex queries by trial and error. </para> <para> <mediaobject> @@ -465,8 +479,7 @@ <sect1 id="features-guest"> <title>Read-Only Access</title> <para> - When setting up a Space you can define whether this space can be viewed by users without - having to log-in. + When setting up a Space you can define whether this space can be viewed by users without having to log-in. </para> <para> <mediaobject> @@ -598,17 +611,17 @@ </listitem> <listitem> <para> - Polish - pl + Norwegian - no </para> </listitem> <listitem> <para> - Portugese (Brazil) - pt_BR + Polish - pl </para> </listitem> <listitem> <para> - Russian - ru + Portugese (Brazil) - pt_BR </para> </listitem> <listitem> @@ -628,6 +641,16 @@ </listitem> <listitem> <para> + Turkish - tr + </para> + </listitem> + <listitem> + <para> + Ukrainian - uk + </para> + </listitem> + <listitem> + <para> Chinese (China) - zh_CN </para> </listitem> @@ -691,8 +714,7 @@ <listitem> <para> First, download the latest release from - <ulink url="https://sourceforge.net/project/showfiles.php?group_id=162983&package_id=184104"> - the JTrac downloads area</ulink> + <ulink url="https://sourceforge.net/projects/j-trac/files/jtrac/"> the JTrac downloads area</ulink> </para> </listitem> <listitem> @@ -704,7 +726,7 @@ </para> </listitem> <listitem> - <para>Point your web-browser to <ulink url="http://localhost/jtrac"/></para> + <para>Point your web-browser to <ulink url="http://localhost:8888/"/></para> </listitem> <listitem> <para>Sign on with the user name "admin" and password "admin"</para> @@ -715,9 +737,9 @@ </itemizedlist> </para> <para> - You can use the "stop.bat" script to stop the application. The "start.bat" file configures the - Jetty server to use port 80 which you can easily change by editing "start.bat". You may need to do this - if for example JTrac does not start because a web-server (like Apache or IIS) is already running on port 80. + You can use the "stop.bat" script to stop the application. The "start.int" file configures the Jetty server + to use port 8888 which you can easily change by editing "start.int" (search for "jetty.http.port=8888"). + You may need to do this if JTrac does not start because another server (like Apache, IIS or Tomcat) is already running on port 8888. </para> <para> Remote users should be able to access JTrac over the network by using the machine name instead of "localhost" @@ -729,9 +751,8 @@ <para> If you are not on Windows, you may want to rename the start and stop *.bat files to e.g. *.sh for Linux (*.bat is reported to work for Ubuntu). The commands within the batch files will work unchanged as long as - Java has been installed correctly i.e. "java" is in the PATH and it is the expected 1.5 or greater version. + Java has been installed correctly i.e. "java" is in the PATH and it is expecting version 8 or greater. You may need to do things like apply executable permissions to the batch files on Linux, e.g. "chmod +x *.bat". - And also - unless you have "root" permissions, you may face problems starting services on port 80 etc. </para> <para> You can also read this forum thread for more details: <ulink url="https://sourceforge.net/forum/forum.php?thread_id=1971135&forum_id=552477">link</ulink> @@ -866,9 +887,8 @@ <title>Using a different database such as MySQL</title> <para> You can configure the database that JTrac uses by editing the "jtrac.properties" file that JTrac expects - within the "jtrac.home" folder. Note that if JTrac does not find a "jtrac.properties" file in the - expected location, JTrac creates a fresh one which is pre-configured for HSQLDB. The default contents of - this file are as follows: + within the "jtrac.home" folder. Note that if JTrac does not find a "jtrac.properties" file in the expected location, + JTrac creates a fresh one which is pre-configured for HSQLDB. The default contents of this file are as follows: </para> <para> <programlisting> @@ -887,8 +907,7 @@ the driver and URL. You can look up the Hibernate dialect corresponding to your database type from <ulink url="https://www.hibernate.org/hib_docs/reference/en/html/session-configuration.html#configuration-optional-dialects">this list</ulink>. When using a custom database such as MySQL, you have to create an empty database before starting JTrac. - When JTrac starts, it will connect to the configured database and create the schema (database tables) - if not already present. + When JTrac starts, it will connect to the configured database and create the schema (database tables) if not already present. </para> <para> If you edit the "jtrac.properties" file, ensure that there are no trailing spaces in the entries shown above @@ -1083,8 +1102,7 @@ Note that the Java Service Wrapper project supports other operating systems such as Linux or Mac also. </para> <para> - Place some of the files from the Java Service Wrapper distribution into the JTrac folder structure - as follows: + Place some of the files from the Java Service Wrapper distribution into the JTrac folder structure as follows: <itemizedlist> <listitem> <para>From the "bin" folder, copy "wrapper.exe" to the "jtrac" root folder</para> @@ -1310,6 +1328,12 @@ you can also consider joining the JTrac <ulink url="https://lists.sourceforge.net/lists/listinfo/j-trac-users">mailing-list</ulink>. </para> + <para> + Note that this roadmap dates all the way back to the 2.1.0 days, and no longer reflects the priorities of the current + development team. Much of this will likely not be implemented, whereas other features not mentioned here will see + the light of the day. If you're missing something in particular (or found a bug), file a ticket in the + <ulink url="https://sourceforge.net/p/j-trac/_list/tickets">appropriate ticket tracker</ulink>, and we'll take it from there. + </para> <sect1 id="roadmap-hide"> <title>Field-Level "Hide" Permissions</title> <para> @@ -1348,29 +1372,20 @@ <title>Submit By Email</title> <para> JTrac should be able to monitor an e-mail account and incoming e-mail should trigger - creation / updation of items. It would be handy to have attachments submitted through - email also. + creation / updation of items. It would be handy to have attachments submitted through email also. </para> </sect1> - <sect1 id="roadmap-screenshot"> - <title>Screenshot Capture</title> - <para> - Using a Java applet, it should be possible for the user to upload a screenshot directly from the - system clipboard. The user should be able to annotate (e.g. highlight a particular area of) the - image before uploading. - </para> - </sect1> <sect1 id="roadmap-savedsearches"> <title>Saved Searches</title> <para> - It should be possible for users to save search filters and re-use them. + It should be possible for users to save search filters and re-use them. This has been partially implemented in 2.2.0 + with the saved search/bookmark feature. </para> </sect1> <sect1 id="roadmap-wiki"> <title>Wiki Engine</title> <para> - There is a plan to embed a wiki-engine into JTrac. This will supplement the requirements management - road map. + There is a plan to embed a wiki-engine into JTrac. This will supplement the requirements management road map. </para> </sect1> <sect1 id="roadmap-svn"> @@ -1491,8 +1506,7 @@ <listitem> <para> Interim builds are provided only as WAR files. If you are using the embedded Jetty - webapp-server, you have to replace the WAR that came along with the formal - downloadable distribution. + webapp-server, you have to replace the WAR that came along with the formal downloadable distribution. </para> </listitem> <listitem> @@ -1499,8 +1513,7 @@ <para> When you are replacing the WAR file in an existing installation it is best that you delete the contents of the webapp-server temporary / work folder before re-starting. - Details on how to do this are provided in the "<link linkend="upgrading">upgrading</link>" - section of this document. + Details on how to do this are provided in the "<link linkend="upgrading">upgrading</link>" section of this document. </para> </listitem> <listitem> @@ -1670,7 +1683,7 @@ <para> <itemizedlist> <listitem> - <para>JDK 5.0 (or higher)</para> + <para>JDK 8 (or higher)</para> </listitem> <listitem> <para><ulink url="https://maven.apache.org/">Maven 2.X</ulink></para> @@ -1736,8 +1749,7 @@ <ulink url="https://ntlmaps.sourceforge.net/">NTLMAPS</ulink> to check out from Subversion. </para> <para> - If you are using Windows, we recommend <ulink url="https://tortoisesvn.net/">TortoiseSVN</ulink> - as a Subversion client. + If you are using Windows, we recommend <ulink url="https://tortoisesvn.net/">TortoiseSVN</ulink> as a Subversion client. </para> </sect1> <sect1 id="dev-build-properties"> Modified: trunk/jtrac/doc/styles/fopdf.xsl =================================================================== --- trunk/jtrac/doc/styles/fopdf.xsl 2021-12-13 10:27:43 UTC (rev 1421) +++ trunk/jtrac/doc/styles/fopdf.xsl 2021-12-13 17:02:32 UTC (rev 1422) @@ -210,6 +210,7 @@ <xsl:param name="callout.extensions">1</xsl:param> <!-- FOP provide only PDF Bookmarks at the moment --> <xsl:param name="fop.extensions">1</xsl:param> + <xsl:param name="fop1.extensions">1</xsl:param> <!--################################################### Table Of Contents This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-12-13 10:27:44
|
Revision: 1421 http://sourceforge.net/p/j-trac/code/1421 Author: udittmer Date: 2021-12-13 10:27:43 +0000 (Mon, 13 Dec 2021) Log Message: ----------- updated dependencies Modified Paths: -------------- trunk/jtrac/pom.xml Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-11-23 08:12:45 UTC (rev 1420) +++ trunk/jtrac/pom.xml 2021-12-13 10:27:43 UTC (rev 1421) @@ -356,7 +356,19 @@ <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>5.1.0</version> + <exclusions> + <exclusion> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + </exclusion> + </exclusions> </dependency> + <dependency> + <!-- POI needs this, but pulls in 2.14.1, which is insecure --> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-api</artifactId> + <version>2.15.0</version> + </dependency> <dependency> <groupId>org.tmate</groupId> <artifactId>javasvn</artifactId> @@ -375,6 +387,7 @@ <scope>runtime</scope> </dependency> <dependency> + <!-- 2.6.1 would be fine, but is built for Java 11 --> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>2.5.2</version> @@ -397,6 +410,7 @@ </exclusions> </dependency> <dependency> + <!-- 5.0 would probably be fine, but it's built for Java 11 --> <groupId>com.zaxxer</groupId> <artifactId>HikariCP</artifactId> <version>4.0.3</version> @@ -524,6 +538,6 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd HH:mm z</maven.build.timestamp.format> - <commonmark.version>0.18.0</commonmark.version> + <commonmark.version>0.18.1</commonmark.version> </properties> </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-11-23 08:12:48
|
Revision: 1420 http://sourceforge.net/p/j-trac/code/1420 Author: udittmer Date: 2021-11-23 08:12:45 +0000 (Tue, 23 Nov 2021) Log Message: ----------- make Markdown rendering unit-testable Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java Modified: trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2021-11-22 15:17:45 UTC (rev 1419) +++ trunk/jtrac/src/main/java/info/jtrac/util/ItemUtils.java 2021-11-23 08:12:45 UTC (rev 1420) @@ -140,19 +140,20 @@ if (text == null) { return null; } else { - String markdown = JtracApplication.get().getJtrac().loadConfig("markdown.enabled"); - if (markdown==null || markdown.equalsIgnoreCase("true")) { - // apply markdown - Node document = parser.parse(text); - return renderer.render(document); - } else { - // at least auto-link URLs - text = fixWhiteSpace(text); - return text.replaceAll(URL_PATTERN, "<a href='$0' target='_blank'>$0</a>"); - } + Node document = parser.parse(text); + return renderer.render(document); } } + public static String autolinkUrls (String text) { + if (text == null) { + return null; + } else { + text = fixWhiteSpace(text); + return text.replaceAll(URL_PATTERN, "<a href='$0' target='_blank'>$0</a>"); + } + } + // don't link if there's a slash immediately before the item; ignore case, so item-44 is the same as ITEM-44 public static String autolinkTickets (String baseUrl, String text, Set<Space> spaces) { if (text == null) { Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2021-11-22 15:17:45 UTC (rev 1419) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2021-11-23 08:12:45 UTC (rev 1420) @@ -72,7 +72,12 @@ this.hideLinks = hideLinks; addComponents(item); } - + + protected boolean renderMarkdown() { + String markdown = JtracApplication.get().getJtrac().loadConfig("markdown.enabled"); + return markdown != null && markdown.equalsIgnoreCase("true"); + } + /** * This method allows to add components (items). * @@ -192,7 +197,10 @@ add(new Label("assignedTo", new PropertyModel(item, "assignedTo.name"))); add(new Label("summary", new PropertyModel(item, "summary"))); String text = item.getDetail(); - text = ItemUtils.renderMarkdown(text); + if (renderMarkdown()) + text = ItemUtils.renderMarkdown(text); + else + text = ItemUtils.autolinkUrls(text); text = ItemUtils.autolinkTickets(baseUrl, text, getPrincipal().getSpaces()); add(new Label("detail", text).setEscapeModelStrings(false)); @@ -245,7 +253,10 @@ WebMarkupContainer comment = new WebMarkupContainer("comment"); comment.add(new AttachmentLinkPanel("attachment", h.getAttachment())); String text = h.getComment(); - text = ItemUtils.renderMarkdown(text); + if (renderMarkdown()) + text = ItemUtils.renderMarkdown(text); + else + text = ItemUtils.autolinkUrls(text); text = ItemUtils.autolinkTickets(baseUrl, text, getPrincipal().getSpaces()); comment.add(new Label("comment", text).setEscapeModelStrings(false)); listItem.add(comment); Modified: trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java 2021-11-22 15:17:45 UTC (rev 1419) +++ trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java 2021-11-23 08:12:45 UTC (rev 1420) @@ -17,4 +17,15 @@ Assert.assertEquals("Hello World", ItemUtils.fixWhiteSpace("Hello\tWorld")); } + @Test + public void testMarkdown() { + Assert.assertEquals(null, ItemUtils.renderMarkdown(null)); + Assert.assertEquals("", ItemUtils.renderMarkdown("")); + Assert.assertEquals("<p>Hello World</p>\n", ItemUtils.renderMarkdown("Hello World")); + Assert.assertEquals("<p><em>Hello</em> <strong>World</strong></p>\n", ItemUtils.renderMarkdown("*Hello* **World**")); + Assert.assertEquals("<h1>Hello World</h1>\n", ItemUtils.renderMarkdown("# Hello World")); + Assert.assertEquals("<h2>Hello World</h2>\n", ItemUtils.renderMarkdown("## Hello World")); + Assert.assertEquals("<blockquote>\n<p>Hello World</p>\n</blockquote>\n", ItemUtils.renderMarkdown("> Hello World")); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-11-22 15:17:48
|
Revision: 1419 http://sourceforge.net/p/j-trac/code/1419 Author: udittmer Date: 2021-11-22 15:17:45 +0000 (Mon, 22 Nov 2021) Log Message: ----------- added test for stored search links Modified Paths: -------------- trunk/jtrac/pom.xml trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-11-22 13:24:18 UTC (rev 1418) +++ trunk/jtrac/pom.xml 2021-11-22 15:17:45 UTC (rev 1419) @@ -417,22 +417,22 @@ <dependency> <groupId>org.commonmark</groupId> <artifactId>commonmark</artifactId> - <version>0.18.0</version> + <version>${commonmark.version}</version> </dependency> <dependency> <groupId>org.commonmark</groupId> <artifactId>commonmark-ext-gfm-strikethrough</artifactId> - <version>0.18.0</version> + <version>${commonmark.version}</version> </dependency> <dependency> <groupId>org.commonmark</groupId> <artifactId>commonmark-ext-ins</artifactId> - <version>0.18.0</version> + <version>${commonmark.version}</version> </dependency> <dependency> <groupId>org.commonmark</groupId> <artifactId>commonmark-ext-autolink</artifactId> - <version>0.18.0</version> + <version>${commonmark.version}</version> </dependency> </dependencies> @@ -524,5 +524,6 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyy-MM-dd HH:mm z</maven.build.timestamp.format> + <commonmark.version>0.18.0</commonmark.version> </properties> </project> Modified: trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java 2021-11-22 13:24:18 UTC (rev 1418) +++ trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java 2021-11-22 15:17:45 UTC (rev 1419) @@ -107,7 +107,29 @@ } @Test - public void test_H_Logout() throws Exception { + public void test_H_CreateStoredSearch() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'OPTIONS']]")).click(); + WebAssert.assertTextPresent(page, "Options Menu"); + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'Configure Links']]")).click(); + WebAssert.assertTextPresent(page, "Links configuration"); + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'Create a new link']]")).click(); + WebAssert.assertTextPresent(page, "Link details"); + ((HtmlElement) page.getElementByName("name")).type("Test Link"); + ((HtmlElement) page.getElementByName("query")).type("http://localhost:8888/app/item/list?summary=like_test"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Submit']")).click(); + WebAssert.assertTextPresent(page, "Test Link"); + } + + @Test + public void test_I_CheckStoredSearch() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'DASHBOARD']]")).click(); + WebAssert.assertTextPresent(page, "Test Link"); + page = ((HtmlElement) page.getFirstByXPath("//a[contains(@href, 'like_test')]")).click(); + WebAssert.assertTextPresent(page, "1 Record Found"); + } + + @Test + public void test_J_Logout() throws Exception { page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'LOGOUT']]")).click(); WebAssert.assertTextPresent(page, "Logout Successful"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-11-22 13:24:21
|
Revision: 1418 http://sourceforge.net/p/j-trac/code/1418 Author: udittmer Date: 2021-11-22 13:24:18 +0000 (Mon, 22 Nov 2021) Log Message: ----------- move unit tests to JUnit 4, add HtmlUnit test in lieu of the deleted Selenium test Modified Paths: -------------- trunk/jtrac/pom.xml trunk/jtrac/src/test/java/info/jtrac/JtracTest.java trunk/jtrac/src/test/java/info/jtrac/JtracTestBase.java trunk/jtrac/src/test/java/info/jtrac/domain/CountsTest.java trunk/jtrac/src/test/java/info/jtrac/domain/ExcelFileTest.java trunk/jtrac/src/test/java/info/jtrac/domain/FieldTest.java trunk/jtrac/src/test/java/info/jtrac/domain/ItemTest.java trunk/jtrac/src/test/java/info/jtrac/domain/MetadataTest.java trunk/jtrac/src/test/java/info/jtrac/domain/RoleTest.java trunk/jtrac/src/test/java/info/jtrac/domain/UserTest.java trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java trunk/jtrac/src/test/java/info/jtrac/svn/SvnTest.java trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java trunk/jtrac/src/test/java/info/jtrac/util/JtracConfigurerTest.java trunk/jtrac/src/test/java/info/jtrac/util/ValidationUtilsTest.java trunk/jtrac/src/test/java/info/jtrac/util/XmlUtilsTest.java Added Paths: ----------- trunk/jtrac/src/test/java/info/jtrac/htmlunit/ trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java Removed Paths: ------------- trunk/jtrac/src/test/java/info/jtrac/test/ Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/pom.xml 2021-11-22 13:24:18 UTC (rev 1418) @@ -64,6 +64,12 @@ <version>4.13.2</version> <scope>test</scope> </dependency> + <dependency> + <groupId>net.sourceforge.htmlunit</groupId> + <artifactId>htmlunit</artifactId> + <version>2.55.0</version> + <scope>test</scope> + </dependency> <dependency> <groupId>jaxen</groupId> <artifactId>jaxen</artifactId> @@ -474,7 +480,7 @@ <goal>testCompile</goal> </goals> <configuration> - <skip>true</skip> + <skip>false</skip> </configuration> </execution> </executions> @@ -495,10 +501,11 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> - <version>2.22.2</version> + <version>3.0.0-M5</version> <configuration> <excludes> <exclude>info/jtrac/test/**</exclude> + <exclude>info/jtrac/JtracTest</exclude> </excludes> </configuration> </plugin> Modified: trunk/jtrac/src/test/java/info/jtrac/JtracTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/JtracTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/JtracTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -13,6 +13,7 @@ import info.jtrac.domain.State; import info.jtrac.domain.UserSpaceRole; import info.jtrac.util.ItemUtils; + import java.util.HashSet; import java.util.List; import java.util.Map; @@ -21,6 +22,8 @@ import org.acegisecurity.GrantedAuthority; import org.acegisecurity.userdetails.UserDetails; +import org.junit.*; + /** * JUnit test cases for the business implementation as well as the DAO * Tests assume that a database is available, and with HSQLDB around this is not an issue. @@ -62,26 +65,30 @@ //========================================================================== + @Test public void testGeneratedPasswordIsAlwaysDifferent() { String p1 = jtrac.generatePassword(); String p2 = jtrac.generatePassword(); - assertTrue(!p1.equals(p2)); + Assert.assertTrue(!p1.equals(p2)); } + @Test public void testEncodeClearTextPassword() { - assertEquals("21232f297a57a5a743894a0e4a801fc3", jtrac.encodeClearText("admin")); + Assert.assertEquals("21232f297a57a5a743894a0e4a801fc3", jtrac.encodeClearText("admin")); } + @Test public void testMetadataInsertAndLoad() { Metadata m1 = getMetadata(); jtrac.storeMetadata(m1); - assertTrue(m1.getId() > 0); + Assert.assertTrue(m1.getId() > 0); Metadata m2 = jtrac.loadMetadata(m1.getId()); - assertTrue(m2 != null); + Assert.assertTrue(m2 != null); Map<Field.Name, Field> fields = m2.getFields(); - assertTrue(fields.size() == 2); + Assert.assertTrue(fields.size() == 2); } + @Test public void testUserInsertAndLoad() { User user = new User(); user.setLoginName("test"); @@ -88,11 +95,12 @@ user.setEmail("te...@jt..."); jtrac.storeUser(user); User user1 = jtrac.loadUser("test"); - assertTrue(user1.getEmail().equals("te...@jt...")); + Assert.assertTrue(user1.getEmail().equals("te...@jt...")); User user2 = dao.findUsersByEmail("te...@jt...").get(0); - assertTrue(user2.getLoginName().equals("test")); + Assert.assertTrue(user2.getLoginName().equals("test")); } + @Test public void testUserSpaceRolesInsert() { Space space = getSpace(); Metadata metadata = getMetadata(); @@ -109,29 +117,31 @@ User u1 = jtrac.loadUser("test"); GrantedAuthority[] gas = u1.getAuthorities(); - assertEquals(1, gas.length); - assertEquals("ROLE_TEST:TEST", gas[0].getAuthority()); + Assert.assertEquals(1, gas.length); + Assert.assertEquals("ROLE_TEST:TEST", gas[0].getAuthority()); List<UserSpaceRole> userSpaceRoles = jtrac.findUserRolesForSpace(space.getId()); - assertEquals(1, userSpaceRoles.size()); + Assert.assertEquals(1, userSpaceRoles.size()); UserSpaceRole usr = userSpaceRoles.get(0); - assertEquals("test", usr.getUser().getLoginName()); - assertEquals("ROLE_TEST", usr.getRoleKey()); + Assert.assertEquals("test", usr.getUser().getLoginName()); + Assert.assertEquals("ROLE_TEST", usr.getRoleKey()); List<User> users = jtrac.findUsersForUser(u1); - assertEquals(1, users.size()); + Assert.assertEquals(1, users.size()); List<User> users2 = jtrac.findUsersForSpace(space.getId()); - assertEquals(1, users2.size()); + Assert.assertEquals(1, users2.size()); } + @Test public void testConfigStoreAndLoad() { Config config = new Config("testParam", "testValue"); jtrac.storeConfig(config); String value = jtrac.loadConfig("testParam"); - assertEquals("testValue", value); + Assert.assertEquals("testValue", value); } + @Test public void testStoreAndLoadUserWithAdminRole() { User user = new User(); user.setLoginName("test"); @@ -145,10 +155,11 @@ set.add(ga.getAuthority()); } - assertEquals(1, set.size()); - assertTrue(set.contains("ROLE_ADMIN")); + Assert.assertEquals(1, set.size()); + Assert.assertTrue(set.contains("ROLE_ADMIN")); } + @Test public void testDefaultAdminUserHasAdminRole() { UserDetails ud = jtrac.loadUserByUsername("admin"); Set<String> set = new HashSet<String>(); @@ -155,10 +166,11 @@ for (GrantedAuthority ga : ud.getAuthorities()) { set.add(ga.getAuthority()); } - assertEquals(1, set.size()); - assertTrue(set.contains("ROLE_ADMIN")); + Assert.assertEquals(1, set.size()); + Assert.assertTrue(set.contains("ROLE_ADMIN")); } + @Test public void testItemInsertAndCounts() { Space s = getSpace(); jtrac.storeSpace(s); @@ -172,19 +184,20 @@ i.setLoggedBy(u); i.setStatus(State.CLOSED); jtrac.storeItem(i, null); - assertEquals(1, i.getSequenceNum()); + Assert.assertEquals(1, i.getSequenceNum()); CountsHolder ch = jtrac.loadCountsForUser(u); - assertEquals(1, ch.getTotalAssignedToMe()); - assertEquals(1, ch.getTotalLoggedByMe()); - assertEquals(1, ch.getTotalTotal()); + Assert.assertEquals(1, ch.getTotalAssignedToMe()); + Assert.assertEquals(1, ch.getTotalLoggedByMe()); + Assert.assertEquals(1, ch.getTotalTotal()); Counts c = ch.getCounts().get(s.getId()); - assertEquals(1, c.getLoggedByMe()); - assertEquals(1, c.getAssignedToMe()); - assertEquals(1, c.getTotal()); + Assert.assertEquals(1, c.getLoggedByMe()); + Assert.assertEquals(1, c.getAssignedToMe()); + Assert.assertEquals(1, c.getTotal()); } + @Test public void testRemoveSpaceRoleDoesNotOrphanDatabaseRecord() { Space space = getSpace(); jtrac.storeSpace(space); @@ -195,21 +208,23 @@ jtrac.storeUser(user); long id = jdbcTemplate.queryForLong("select id from user_space_roles where space_id = " + spaceId); UserSpaceRole usr = jtrac.loadUserSpaceRole(id); - assertEquals(spaceId, usr.getSpace().getId()); + Assert.assertEquals(spaceId, usr.getSpace().getId()); jtrac.removeUserSpaceRole(usr); setComplete(); endTransaction(); - assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where space_id = " + spaceId)); + Assert.assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where space_id = " + spaceId)); cleanDatabase(); } + @Test public void testFindSpacesWhereGuestAllowed() { Space space = getSpace(); space.setGuestAllowed(true); jtrac.storeSpace(space); - assertEquals(1, jtrac.findSpacesWhereGuestAllowed().size()); + Assert.assertEquals(1, jtrac.findSpacesWhereGuestAllowed().size()); } + @Test public void testRenameSpaceRole() { Space space = getSpace(); jtrac.storeSpace(space); @@ -217,12 +232,13 @@ u.setLoginName("test"); u.addSpaceWithRole(space, "DEFAULT"); jtrac.storeUser(u); - assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); + Assert.assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); jtrac.bulkUpdateRenameSpaceRole(space, "DEFAULT", "NEWDEFAULT"); - assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); - assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'NEWDEFAULT'")); + Assert.assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); + Assert.assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'NEWDEFAULT'")); } + @Test public void testGetItemAsHtmlDoesNotThrowException() { Config config = new Config("mail.server.host", "dummyhost"); jtrac.storeConfig(config); @@ -243,9 +259,10 @@ // next step will internally try to render item as Html for sending e-mail jtrac.storeItem(i, null); String rendered = ItemUtils.getAsXml(i).asXML(); - assertTrue(rendered.contains("<item refId=\"TEST-")); + Assert.assertTrue(rendered.contains("<item refId=\"TEST-")); } + @Test public void testDeleteItemThatHasRelatedItems() { Space s = getSpace(); jtrac.storeSpace(s); @@ -277,12 +294,13 @@ i2.setStatus(State.CLOSED); i2.addRelated(i1, ItemItem.DUPLICATE_OF); jtrac.storeItem(i2, null); - assertEquals(3, jtrac.loadCountOfHistoryInvolvingUser(u)); + Assert.assertEquals(3, jtrac.loadCountOfHistoryInvolvingUser(u)); // can we remove i1? Item temp = jtrac.loadItem(i1.getId()); jtrac.removeItem(temp); } + @Test public void testDeletingUserDeletesItemUsersAlso() { Space s = getSpace(); jtrac.storeSpace(s); @@ -320,11 +338,12 @@ startNewTransaction(); Item dummyItem = jtrac.loadItem(i.getId()); - assertEquals(0, dummyItem.getItemUsers().size()); + Assert.assertEquals(0, dummyItem.getItemUsers().size()); cleanDatabase(); } + @Test public void testLogicToFindNotUsersAndSpacesNotAllocated() { cleanDatabase(); @@ -348,12 +367,12 @@ jtrac.storeUser(u1); List<Space> list = jtrac.findSpacesNotFullyAllocatedToUser(u1.getId()); - assertEquals(2, list.size()); + Assert.assertEquals(2, list.size()); jtrac.storeUserSpaceRole(u1, s1, "ROLE_ADMIN"); List<Space> list2 = jtrac.findSpacesNotFullyAllocatedToUser(u1.getId()); - assertEquals(1, list2.size()); + Assert.assertEquals(1, list2.size()); User u2 = new User(); u2.setLoginName("test2"); @@ -361,26 +380,25 @@ List<User> list3 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); // admin user exists also - assertEquals(2, list3.size()); + Assert.assertEquals(2, list3.size()); jtrac.storeUserSpaceRole(u2, s1, "DEFAULT"); List<User> list4 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); logger.info(list4); - assertEquals(2, list4.size()); + Assert.assertEquals(2, list4.size()); - jtrac.storeUserSpaceRole(u2, s1, "ROLE_ADMIN"); List<User> list5 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); - assertEquals(1, list5.size()); + Assert.assertEquals(1, list5.size()); } + @Test public void testFindSuperUsers() { - List<User> list1 = dao.findSuperUsers(); - assertEquals(1, list1.size()); - assertEquals("admin", list1.get(0).getLoginName()); + Assert.assertEquals(1, list1.size()); + Assert.assertEquals("admin", list1.get(0).getLoginName()); User u1 = new User(); u1.setLoginName("test2"); @@ -389,11 +407,11 @@ jtrac.storeUserSpaceRole(u1, null, "ROLE_ADMIN"); List<User> list2 = dao.findSuperUsers(); - assertEquals(2, list2.size()); + Assert.assertEquals(2, list2.size()); } + @Test public void testLoadSpaceRolesMapForUser() { - User u1 = new User(); u1.setLoginName("test2"); jtrac.storeUser(u1); @@ -401,7 +419,6 @@ jtrac.storeUserSpaceRole(u1, null, "ROLE_ADMIN"); Map<Long, List<UserSpaceRole>> map = jtrac.loadSpaceRolesMapForUser(u1.getId()); - assertEquals(1, map.size()); + Assert.assertEquals(1, map.size()); } - } Modified: trunk/jtrac/src/test/java/info/jtrac/JtracTestBase.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/JtracTestBase.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/JtracTestBase.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,38 +1,38 @@ -package info.jtrac; - -import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; - -/** - * base class for tests that can test either the service layer or dao or both - * using the Spring JUnit helper class with the long name, ensures that - * the applicationContext is only built once - */ -public abstract class JtracTestBase extends AbstractTransactionalDataSourceSpringContextTests { - - protected Jtrac jtrac; - protected JtracDao dao; - - public JtracTestBase(String name) { - super(name); - } - - // magically autowired by Spring JUnit support - public void setDao(JtracDao dao) { - this.dao = dao; - } - - // magically autowired by Spring JUnit support - public void setJtrac(Jtrac jtrac) { - this.jtrac = jtrac; - } - - @Override - protected String[] getConfigLocations() { - System.setProperty("jtrac.home", "target/home"); - return new String[] { - "file:src/main/webapp/WEB-INF/applicationContext.xml", - "file:src/main/webapp/WEB-INF/applicationContext-lucene.xml" - }; - } - -} +package info.jtrac; + +import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; + +/** + * base class for tests that can test either the service layer or dao or both + * using the Spring JUnit helper class with the long name, ensures that + * the applicationContext is only built once + */ +public abstract class JtracTestBase extends AbstractTransactionalDataSourceSpringContextTests { + + protected Jtrac jtrac; + protected JtracDao dao; + + public JtracTestBase(String name) { + super(name); + } + + // magically autowired by Spring JUnit support + public void setDao(JtracDao dao) { + this.dao = dao; + } + + // magically autowired by Spring JUnit support + public void setJtrac(Jtrac jtrac) { + this.jtrac = jtrac; + } + + @Override + protected String[] getConfigLocations() { + System.setProperty("jtrac.home", "target/home"); + return new String[] { + "file:src/main/webapp/WEB-INF/applicationContext.xml", + "file:src/main/webapp/WEB-INF/applicationContext-lucene.xml" + }; + } + +} Modified: trunk/jtrac/src/test/java/info/jtrac/domain/CountsTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/CountsTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/CountsTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,15 +1,17 @@ -package info.jtrac.domain; - -import java.util.HashMap; -import java.util.Map; -import junit.framework.TestCase; - -public class CountsTest extends TestCase { - - public void testCountsLogic() { - Counts c = new Counts(false); - c.add(Counts.ASSIGNED_TO_ME, 1, 5); - assertEquals(0, c.getTotal()); - assertEquals(5, c.getAssignedToMe()); - } -} +package info.jtrac.domain; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.*; + +public class CountsTest { + + @Test + public void testCountsLogic() { + Counts c = new Counts(false); + c.add(Counts.ASSIGNED_TO_ME, 1, 5); + Assert.assertEquals(0, c.getTotal()); + Assert.assertEquals(5, c.getAssignedToMe()); + } +} Modified: trunk/jtrac/src/test/java/info/jtrac/domain/ExcelFileTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/ExcelFileTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/ExcelFileTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,10 +1,12 @@ package info.jtrac.domain; import java.io.FileInputStream; -import junit.framework.TestCase; -public class ExcelFileTest extends TestCase { +import org.junit.*; + +public class ExcelFileTest { + @Test public void testLoadFile() throws Exception { // ExcelFile ef = new ExcelFile(new FileInputStream("src/test/resources/data.xls")); } Modified: trunk/jtrac/src/test/java/info/jtrac/domain/FieldTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/FieldTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/FieldTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -2,49 +2,56 @@ import info.jtrac.domain.Field; import info.jtrac.util.XmlUtils; -import junit.framework.TestCase; + +import org.junit.*; + import org.dom4j.Document; import org.dom4j.Element; -public class FieldTest extends TestCase { +public class FieldTest { + @Test public void testSetValidName() { Field field = new Field(); field.setName("cusInt01"); - assertEquals(field.getName().toString(), "cusInt01"); + Assert.assertEquals(field.getName().toString(), "cusInt01"); } + @Test public void testSetInValidNameFails() { Field field = new Field(); try { field.setName("foo"); - fail("How did we set an invalid name?"); + Assert.fail("How did we set an invalid name?"); } catch (Exception e) { // expected } } + @Test public void testConstructFromXml() { Document d = XmlUtils.parse("<field name='cusInt01' label='Test Label'/>"); Field field = new Field(d.getRootElement()); - assertEquals("cusInt01", field.getName().toString()); - assertEquals("Test Label", field.getLabel()); - assertEquals(field.isOptional(), false); + Assert.assertEquals("cusInt01", field.getName().toString()); + Assert.assertEquals("Test Label", field.getLabel()); + Assert.assertEquals(field.isOptional(), false); } + @Test public void testConstructFromXmlWithOptionalAttribute() { Document d = XmlUtils.parse("<field name='cusInt01' label='Test Label' optional='true'/>"); Field field = new Field(d.getRootElement()); - assertTrue(field.isOptional()); + Assert.assertTrue(field.isOptional()); } + @Test public void testGetAsXml() { Field field = new Field(); field.setName("cusInt01"); field.setLabel("Test Label"); Element e = field.getAsElement(); - assertEquals("cusInt01", e.attributeValue("name")); - assertEquals("Test Label", e.attributeValue("label")); + Assert.assertEquals("cusInt01", e.attributeValue("name")); + Assert.assertEquals("Test Label", e.attributeValue("label")); } } Modified: trunk/jtrac/src/test/java/info/jtrac/domain/ItemTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/ItemTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/ItemTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,14 +1,16 @@ package info.jtrac.domain; import info.jtrac.domain.Item; -import junit.framework.TestCase; -public class ItemTest extends TestCase { +import org.junit.*; +public class ItemTest { + + @Test public void testSetAndGetForCustomInteger() { Item item = new Item(); item.setCusInt01(5); - assertEquals(item.getCusInt01().intValue(), 5); + Assert.assertEquals(item.getCusInt01().intValue(), 5); } } Modified: trunk/jtrac/src/test/java/info/jtrac/domain/MetadataTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/MetadataTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/MetadataTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -5,9 +5,10 @@ import java.util.Map; import java.util.Set; -import junit.framework.TestCase; -public class MetadataTest extends TestCase { +import org.junit.*; + +public class MetadataTest { private Metadata getMetadata() { Metadata metadata = new Metadata(); @@ -19,23 +20,26 @@ return metadata; } + @Test public void testGetFieldByName() { Metadata m = getMetadata(); Field f = m.getField("cusInt01"); - assertEquals("Test Label", f.getLabel()); + Assert.assertEquals("Test Label", f.getLabel()); } + @Test public void testGetFieldsFromXml() { Metadata m = getMetadata(); Map<Field.Name, Field> fields = m.getFields(); - assertTrue(fields.size() == 2); + Assert.assertTrue(fields.size() == 2); Field[] fa = fields.values().toArray(new Field[0]); - assertEquals("cusInt01", fa[0].getName() + ""); - assertEquals("Test Label", fa[0].getLabel()); - assertEquals("cusInt02", fa[1].getName() + ""); - assertEquals("Test Label 2", fa[1].getLabel()); + Assert.assertEquals("cusInt01", fa[0].getName() + ""); + Assert.assertEquals("Test Label", fa[0].getLabel()); + Assert.assertEquals("cusInt02", fa[1].getName() + ""); + Assert.assertEquals("Test Label 2", fa[1].getLabel()); } + @Test public void testMetadataInheritance() { Metadata m1 = getMetadata(); Metadata m2 = new Metadata(); @@ -46,27 +50,29 @@ m2.setXmlString(xmlString); m2.setParent(m1); Map<Field.Name, Field> fields = m2.getFields(); - assertEquals(fields.size(), 4); + Assert.assertEquals(fields.size(), 4); Set<Field.Name> names = m2.getUnusedFieldNames(); - assertEquals(names.contains(Field.Name.CUS_INT_01), false); - assertEquals(names.contains(Field.Name.CUS_INT_04), false); - assertEquals(names.size(), Field.Name.values().length - 4); + Assert.assertEquals(names.contains(Field.Name.CUS_INT_01), false); + Assert.assertEquals(names.contains(Field.Name.CUS_INT_04), false); + Assert.assertEquals(names.size(), Field.Name.values().length - 4); } + @Test public void testInitRolesThenAddRolesAndStates() { Metadata m = new Metadata(); m.initRoles(); - assertEquals("New, Open and Closed available by default", 3, m.getStateCount()); - assertEquals("DEFAULT available by default", 1, m.getRoleCount()); + Assert.assertEquals("New, Open and Closed available by default", 3, m.getStateCount()); + Assert.assertEquals("DEFAULT available by default", 1, m.getRoleCount()); Field f = new Field(Field.Name.CUS_INT_01); m.add(f); - assertEquals(1, m.getFieldCount()); - assertEquals("New", m.getStatusValue(0)); - assertEquals("Open", m.getStatusValue(1)); - assertEquals("Closed", m.getStatusValue(99)); - assertEquals("", m.getStatusValue(50)); + Assert.assertEquals(1, m.getFieldCount()); + Assert.assertEquals("New", m.getStatusValue(0)); + Assert.assertEquals("Open", m.getStatusValue(1)); + Assert.assertEquals("Closed", m.getStatusValue(99)); + Assert.assertEquals("", m.getStatusValue(50)); } + @Test public void testGetEditableFields() { Metadata m = new Metadata(); m.initRoles(); @@ -74,17 +80,16 @@ m.add(f); // query for editable fields across all roles List<Field> fields = m.getEditableFields(); - assertEquals(0, fields.size()); + Assert.assertEquals(0, fields.size()); // query for editable fields for DEFAULT role and when status is OPEN fields = m.getEditableFields("DEFAULT", State.OPEN); - assertEquals(0, fields.size()); + Assert.assertEquals(0, fields.size()); // now make the field editable for given state and role m.switchMask(State.OPEN, "DEFAULT", "cusStr01"); // should now be editable when status is open fields = m.getEditableFields(); - assertEquals(1, fields.size()); + Assert.assertEquals(1, fields.size()); fields = m.getEditableFields("DEFAULT", State.OPEN); - assertEquals(1, fields.size()); - + Assert.assertEquals(1, fields.size()); } } Modified: trunk/jtrac/src/test/java/info/jtrac/domain/RoleTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/RoleTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/RoleTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,41 +1,44 @@ -package info.jtrac.domain; - -import info.jtrac.util.XmlUtils; - -import junit.framework.TestCase; -import org.dom4j.Document; - -public class RoleTest extends TestCase { - - public void testConstructFromXml() { - Document d = XmlUtils.parse("<role name='TESTER'>" + - "<state status='1'>" + - "<transition status='2'/>" + - "<transition status='3'/>" + - "<field name='cusInt01' mask='1'/>" + - "<field name='cusInt02' mask='2'/>" + - "</state>" + - "<state status='2'>" + - "<transition status='3'/>" + - "<field name='cusInt03' mask='1'/>" + - "<field name='cusInt04' mask='2'/>" + - "</state></role>"); - Role role = new Role(d.getRootElement()); - assertEquals("TESTER", role.getName()); - assertEquals(2, role.getStates().size()); - State s1 = role.getStates().get(1); - assertEquals(2, s1.getTransitions().size()); - assertTrue(s1.getTransitions().contains(2)); - assertTrue(s1.getTransitions().contains(3)); - assertEquals(2 , s1.getFields().size()); - assertEquals(new Integer(1), s1.getFields().get(Field.Name.CUS_INT_01)); - assertEquals(new Integer(2), s1.getFields().get(Field.Name.CUS_INT_02)); - } - - public void testForReservedRoleNames() { - assertTrue(Role.isReservedRoleKey("ROLE_ADMIN")); - assertTrue(Role.isReservedRoleKey("ROLE_GUEST")); - assertFalse(Role.isReservedRoleKey("ROLE_FOO")); - } - -} +package info.jtrac.domain; + +import info.jtrac.util.XmlUtils; + +import org.junit.*; + +import org.dom4j.Document; + +public class RoleTest { + + @Test + public void testConstructFromXml() { + Document d = XmlUtils.parse("<role name='TESTER'>" + + "<state status='1'>" + + "<transition status='2'/>" + + "<transition status='3'/>" + + "<field name='cusInt01' mask='1'/>" + + "<field name='cusInt02' mask='2'/>" + + "</state>" + + "<state status='2'>" + + "<transition status='3'/>" + + "<field name='cusInt03' mask='1'/>" + + "<field name='cusInt04' mask='2'/>" + + "</state></role>"); + Role role = new Role(d.getRootElement()); + Assert.assertEquals("TESTER", role.getName()); + Assert.assertEquals(2, role.getStates().size()); + State s1 = role.getStates().get(1); + Assert.assertEquals(2, s1.getTransitions().size()); + Assert.assertTrue(s1.getTransitions().contains(2)); + Assert.assertTrue(s1.getTransitions().contains(3)); + Assert.assertEquals(2 , s1.getFields().size()); + Assert.assertEquals(new Integer(1), s1.getFields().get(Field.Name.CUS_INT_01)); + Assert.assertEquals(new Integer(2), s1.getFields().get(Field.Name.CUS_INT_02)); + } + + @Test + public void testForReservedRoleNames() { + Assert.assertTrue(Role.isReservedRoleKey("ROLE_ADMIN")); + Assert.assertTrue(Role.isReservedRoleKey("ROLE_GUEST")); + Assert.assertFalse(Role.isReservedRoleKey("ROLE_FOO")); + } + +} Modified: trunk/jtrac/src/test/java/info/jtrac/domain/UserTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/domain/UserTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/domain/UserTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,17 +1,16 @@ package info.jtrac.domain; - import java.util.HashSet; import java.util.Set; -import junit.framework.TestCase; +import org.junit.*; import org.acegisecurity.GrantedAuthority; -public class UserTest extends TestCase { +public class UserTest { + @Test public void testGetAuthoritiesFromUserSpaceRoles() { - Space s1 = new Space(); s1.setPrefixCode("SPACE-ONE"); @@ -30,19 +29,19 @@ set.add(ga.getAuthority()); } - assertEquals(3, gas.length); + Assert.assertEquals(3, gas.length); - assertTrue(set.contains("ROLE_ONE-ONE:SPACE-ONE")); - assertTrue(set.contains("ROLE_ONE-TWO:SPACE-ONE")); - assertTrue(set.contains("ROLE_ADMIN")); - + Assert.assertTrue(set.contains("ROLE_ONE-ONE:SPACE-ONE")); + Assert.assertTrue(set.contains("ROLE_ONE-TWO:SPACE-ONE")); + Assert.assertTrue(set.contains("ROLE_ADMIN")); } + @Test public void testCheckIfAdminForAllSpaces() { User u = new User(); u.setLoginName("test"); u.addSpaceWithRole(null, "ROLE_ADMIN"); - assertTrue(u.isSuperUser()); + Assert.assertTrue(u.isSuperUser()); } } Added: trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java (rev 0) +++ trunk/jtrac/src/test/java/info/jtrac/htmlunit/BasicTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -0,0 +1,114 @@ +package info.jtrac.htmlunit; + +import java.io.IOException; + +import org.junit.*; +import org.junit.runners.MethodSorters; + +import com.gargoylesoftware.htmlunit.*; +import com.gargoylesoftware.htmlunit.html.*; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class BasicTest { + + private static WebClient webClient; + private static HtmlPage page; + + @BeforeClass + public static void init() throws Exception { + webClient = new WebClient(); + //webClient.getOptions().setThrowExceptionOnScriptError(false); + } + + @AfterClass + public static void close() throws Exception { + webClient.close(); + } + + @Test + public void test_A_GetLoginPage() throws IOException { + page = webClient.getPage("http://localhost:8888/app/login"); + WebAssert.assertTitleEquals(page, "JTrac Login"); + } + + @Test + public void test_B_SuccessfulLogin() throws IOException { + ((HtmlElement) page.getElementByName("loginName")).type("admin"); + ((HtmlElement) page.getElementByName("password")).type("admin"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Submit']")).click(); + WebAssert.assertTextPresent(page, "DASHBOARD"); + } + + @Test + public void test_C_CreateNewSpaceAndAllocateAdmin() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'OPTIONS']]")).click(); + WebAssert.assertTextPresent(page, "Options Menu"); + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'Manage Spaces']]")).click(); + WebAssert.assertTextPresent(page, "Space List"); + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'Create New Space']]")).click(); + WebAssert.assertTextPresent(page, "Space Details"); + ((HtmlElement) page.getElementByName("space.name")).type("Test Space"); + ((HtmlElement) page.getElementByName("space.prefixCode")).type("TEST"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Next']")).click(); + WebAssert.assertTextPresent(page, "Custom Fields for Space:"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Next']")).click(); + WebAssert.assertTextPresent(page, "Space Roles"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Save']")).click(); + WebAssert.assertTextPresent(page, "Users Allocated To Space"); + ((HtmlCheckBoxInput) page.getFirstByXPath("//input[@name='roleAllocatePanel:checkGroup']")).click(); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Allocate']")).click(); + WebAssert.assertTextPresent(page, "Admin"); + } + + @Test + public void test_D_CreateNewItem() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'DASHBOARD']]")).click(); + WebAssert.assertTextPresent(page, "Test Space"); + page = ((HtmlElement) page.getFirstByXPath("//img[@title='NEW']")).click(); + WebAssert.assertTextPresent(page, "Summary"); + ((HtmlElement) page.getElementByName("summary")).type("Test Summary"); + ((HtmlElement) page.getElementByName("detail")).type("Test Detail"); + ((HtmlSelect) page.getElementByName("hideAssignedTo:border:assignedTo")).getOptionByText("Admin").setSelected(true); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Submit']")).click(); + WebAssert.assertTextPresent(page, "TEST-1"); + } + + @Test + public void test_E_SearchAllContainsItem() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'SEARCH']]")).click(); + WebAssert.assertTextPresent(page, "Show History"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Search']")).click(); + WebAssert.assertTextPresent(page, "1 Record Found"); + page = ((HtmlElement) page.getFirstByXPath("//a[contains(@href, 'TEST-1')]")).click(); + WebAssert.assertTextPresent(page, "History"); + } + + @Test + public void test_F_UpdateHistoryForItem() throws Exception { + ((HtmlSelect) page.getElementByName("status")).setSelectedAttribute("Closed", true); + ((HtmlElement) page.getElementByName("comment")).type("Test Comment"); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Submit']")).click(); + WebAssert.assertTextPresent(page, "Test Comment"); + } + + @Test + public void test_G_CreateNewUser() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'OPTIONS']]")).click(); + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'Manage Users']]")).click(); + WebAssert.assertTextPresent(page, "Users and allocated Spaces"); + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'Create New User']]")).click(); + WebAssert.assertTextPresent(page, "User Details"); + ((HtmlElement) page.getElementByName("user.loginName")).type("testuser"); + ((HtmlElement) page.getElementByName("user.name")).type("Test User"); + ((HtmlElement) page.getElementByName("user.email")).type("fo...@ba..."); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Submit']")).click(); + page = ((HtmlElement) page.getFirstByXPath("//input[@value='Search']")).click(); + WebAssert.assertTextPresent(page, "Test User"); + } + + @Test + public void test_H_Logout() throws Exception { + page = ((HtmlElement) page.getFirstByXPath("//a[text()[normalize-space(.) = 'LOGOUT']]")).click(); + WebAssert.assertTextPresent(page, "Logout Successful"); + } +} Modified: trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,17 +1,20 @@ package info.jtrac.lucene; import info.jtrac.domain.Item; + import java.io.File; import java.util.List; -import junit.framework.TestCase; + import org.springframework.context.ApplicationContext; import org.springframework.context.support.FileSystemXmlApplicationContext; -public class IndexSearcherTest extends TestCase { +import org.junit.*; +public class IndexSearcherTest { + private ApplicationContext context; - @Override + @Before public void setUp() { File home = new File("target/home"); if (!home.exists()) { @@ -29,6 +32,7 @@ context = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext-lucene.xml"); } + @Test public void testFindItemIdsBySearchingWithinSummaryAndDetailFields() throws Exception { Item item = new Item(); item.setId(1); @@ -38,13 +42,14 @@ indexer.index(item); IndexSearcher searcher = (IndexSearcher) context.getBean("indexSearcher"); List list = searcher.findItemIdsContainingText("lazy"); - assertEquals(1, list.size()); + Assert.assertEquals(1, list.size()); list = searcher.findItemIdsContainingText("foo"); - assertEquals(0, list.size()); + Assert.assertEquals(0, list.size()); list = searcher.findItemIdsContainingText("summary"); - assertEquals(1, list.size()); + Assert.assertEquals(1, list.size()); } + @Test public void testIfUmlautsCanBeIndexedAndSearchedFor() { Item item = new Item(); item.setId(1); @@ -54,7 +59,7 @@ indexer.index(item); IndexSearcher searcher = (IndexSearcher) context.getBean("indexSearcher"); List list = searcher.findItemIdsContainingText("\u00fcmlaut"); - assertEquals(1, list.size()); + Assert.assertEquals(1, list.size()); } } Modified: trunk/jtrac/src/test/java/info/jtrac/svn/SvnTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/svn/SvnTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/svn/SvnTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,66 +1,69 @@ -package info.jtrac.svn; - -import java.util.Collection; -import java.util.Iterator; -import junit.framework.TestCase; -import org.tmatesoft.svn.core.SVNDirEntry; -import org.tmatesoft.svn.core.SVNException; -import org.tmatesoft.svn.core.SVNNodeKind; -import org.tmatesoft.svn.core.SVNURL; -import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; -import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; -import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; -import org.tmatesoft.svn.core.wc.SVNWCUtil; - -public class SvnTest extends TestCase { - - public void testNothing() { - - } - - /* - public void testSvn() throws Exception { - String url = "https://adms.satyam.com/svn/jtrac/trunk/jtrac"; - String name = "pt34469"; - String password = ""; - DAVRepositoryFactory.setup(); - SVNRepositoryFactoryImpl.setup(); - SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url)); - ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); - repository.setAuthenticationManager(authManager); - SVNNodeKind nodeKind = repository.checkPath("", -1); - if (nodeKind == SVNNodeKind.NONE) { - System.err.println("There is no entry at '" + url + "'."); - System.exit(1); - } else if (nodeKind == SVNNodeKind.FILE) { - System.err.println("The entry at '" + url + "' is a file while a directory was expected."); - System.exit(1); - } - System.out.println("Repository Root: " + repository.getRepositoryRoot(true)); - System.out.println("Repository UUID: " + repository.getRepositoryUUID()); - listEntries(repository, ""); - long latestRevision = repository.getLatestRevision(); - System.out.println("Repository latest revision: " + latestRevision); - System.exit(0); - } - - private static void listEntries(SVNRepository repository, String path) throws SVNException { - - Collection entries = repository.getDir(path, -1, null, (Collection) null); - Iterator iterator = entries.iterator(); - while (iterator.hasNext()) { - SVNDirEntry entry = (SVNDirEntry) iterator.next(); - System.out.println("/" + (path.equals("") ? "" : path + "/") - + entry.getName() + " (author:" + entry.getAuthor() - + "; revision:" + entry.getRevision() + ")"); - if (entry.getKind() == SVNNodeKind.DIR) { - listEntries(repository, (path.equals("")) ? entry.getName() - : path + "/" + entry.getName()); - } - } - } - */ - -} +package info.jtrac.svn; + +import java.util.Collection; +import java.util.Iterator; + +import org.junit.Test; + +import org.tmatesoft.svn.core.SVNDirEntry; +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNNodeKind; +import org.tmatesoft.svn.core.SVNURL; +import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; +import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; +import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; +import org.tmatesoft.svn.core.io.SVNRepository; +import org.tmatesoft.svn.core.io.SVNRepositoryFactory; +import org.tmatesoft.svn.core.wc.SVNWCUtil; + +public class SvnTest { + + @Test + public void testNothing() { + + } + + /* + @Test + public void testSvn() throws Exception { + String url = "https://adms.satyam.com/svn/jtrac/trunk/jtrac"; + String name = "pt34469"; + String password = ""; + DAVRepositoryFactory.setup(); + SVNRepositoryFactoryImpl.setup(); + SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url)); + ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password); + repository.setAuthenticationManager(authManager); + SVNNodeKind nodeKind = repository.checkPath("", -1); + if (nodeKind == SVNNodeKind.NONE) { + System.err.println("There is no entry at '" + url + "'."); + System.exit(1); + } else if (nodeKind == SVNNodeKind.FILE) { + System.err.println("The entry at '" + url + "' is a file while a directory was expected."); + System.exit(1); + } + System.out.println("Repository Root: " + repository.getRepositoryRoot(true)); + System.out.println("Repository UUID: " + repository.getRepositoryUUID()); + listEntries(repository, ""); + long latestRevision = repository.getLatestRevision(); + System.out.println("Repository latest revision: " + latestRevision); + System.exit(0); + } + + private static void listEntries(SVNRepository repository, String path) throws SVNException { + + Collection entries = repository.getDir(path, -1, null, (Collection) null); + Iterator iterator = entries.iterator(); + while (iterator.hasNext()) { + SVNDirEntry entry = (SVNDirEntry) iterator.next(); + System.out.println("/" + (path.equals("") ? "" : path + "/") + + entry.getName() + " (author:" + entry.getAuthor() + + "; revision:" + entry.getRevision() + ")"); + if (entry.getKind() == SVNNodeKind.DIR) { + listEntries(repository, (path.equals("")) ? entry.getName() + : path + "/" + entry.getName()); + } + } + } + */ +} Modified: trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/util/ItemUtilsTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,19 +1,20 @@ -package info.jtrac.util; - -import junit.framework.TestCase; - -public class ItemUtilsTest extends TestCase { - - public void testHtmlEscaping() { - assertEquals(" ", ItemUtils.fixWhiteSpace(" ")); - assertEquals(" ", ItemUtils.fixWhiteSpace(" \t")); - assertEquals("Hello World", ItemUtils.fixWhiteSpace("Hello World")); - assertEquals("", ItemUtils.fixWhiteSpace("")); - assertEquals("", ItemUtils.fixWhiteSpace(null)); - assertEquals("Hello<br/>World", ItemUtils.fixWhiteSpace("Hello\nWorld")); - assertEquals("Hello<br/> World", ItemUtils.fixWhiteSpace("Hello\n World")); - assertEquals("Hello<br/> World<br/> Everyone", ItemUtils.fixWhiteSpace("Hello\n World\n\tEveryone")); - assertEquals("Hello World", ItemUtils.fixWhiteSpace("Hello\tWorld")); - } - -} +package info.jtrac.util; + +import org.junit.*; + +public class ItemUtilsTest { + + @Test + public void testHtmlEscaping() { + Assert.assertEquals(" ", ItemUtils.fixWhiteSpace(" ")); + Assert.assertEquals(" ", ItemUtils.fixWhiteSpace(" \t")); + Assert.assertEquals("Hello World", ItemUtils.fixWhiteSpace("Hello World")); + Assert.assertEquals("", ItemUtils.fixWhiteSpace("")); + Assert.assertEquals("", ItemUtils.fixWhiteSpace(null)); + Assert.assertEquals("Hello<br/>World", ItemUtils.fixWhiteSpace("Hello\nWorld")); + Assert.assertEquals("Hello<br/> World", ItemUtils.fixWhiteSpace("Hello\n World")); + Assert.assertEquals("Hello<br/> World<br/> Everyone", ItemUtils.fixWhiteSpace("Hello\n World\n\tEveryone")); + Assert.assertEquals("Hello World", ItemUtils.fixWhiteSpace("Hello\tWorld")); + } + +} Modified: trunk/jtrac/src/test/java/info/jtrac/util/JtracConfigurerTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/util/JtracConfigurerTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/util/JtracConfigurerTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,9 +1,10 @@ package info.jtrac.util; -import junit.framework.TestCase; +import org.junit.*; -public class JtracConfigurerTest extends TestCase { +public class JtracConfigurerTest { + @Test public void testUserDir() throws Exception { // TODO } Modified: trunk/jtrac/src/test/java/info/jtrac/util/ValidationUtilsTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/util/ValidationUtilsTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/util/ValidationUtilsTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,52 +1,56 @@ package info.jtrac.util; -import junit.framework.TestCase; +import org.junit.*; -public class ValidationUtilsTest extends TestCase { +public class ValidationUtilsTest { + @Test public void testValidateSpaceKey() { - assertTrue(ValidationUtils.isValidSpaceKey("ABCD")); - assertTrue(ValidationUtils.isValidSpaceKey("AB123CD")); - assertFalse(ValidationUtils.isValidSpaceKey("ABCD-ABCD")); - assertFalse(ValidationUtils.isValidSpaceKey("AB CD")); + Assert.assertTrue(ValidationUtils.isValidSpaceKey("ABCD")); + Assert.assertTrue(ValidationUtils.isValidSpaceKey("AB123CD")); + Assert.assertFalse(ValidationUtils.isValidSpaceKey("ABCD-ABCD")); + Assert.assertFalse(ValidationUtils.isValidSpaceKey("AB CD")); } + @Test public void testValidateRoleKey() { - assertTrue(ValidationUtils.isValidRoleKey("ABCD")); - assertTrue(ValidationUtils.isValidRoleKey("AB123CD")); - assertFalse(ValidationUtils.isValidRoleKey("ABCD-ABCD")); - assertFalse(ValidationUtils.isValidRoleKey("ABcD_ABCD")); - assertFalse(ValidationUtils.isValidRoleKey("AB CD")); - assertTrue(ValidationUtils.isValidRoleKey("ABCD_EFG")); - assertFalse(ValidationUtils.isValidRoleKey("AB1CDE2_")); - assertFalse(ValidationUtils.isValidRoleKey("_ABCDEF")); - assertTrue(ValidationUtils.isValidRoleKey("1ABCD3_EFG2")); + Assert.assertTrue(ValidationUtils.isValidRoleKey("ABCD")); + Assert.assertTrue(ValidationUtils.isValidRoleKey("AB123CD")); + Assert.assertFalse(ValidationUtils.isValidRoleKey("ABCD-ABCD")); + Assert.assertFalse(ValidationUtils.isValidRoleKey("ABcD_ABCD")); + Assert.assertFalse(ValidationUtils.isValidRoleKey("AB CD")); + Assert.assertTrue(ValidationUtils.isValidRoleKey("ABCD_EFG")); + Assert.assertFalse(ValidationUtils.isValidRoleKey("AB1CDE2_")); + Assert.assertFalse(ValidationUtils.isValidRoleKey("_ABCDEF")); + Assert.assertTrue(ValidationUtils.isValidRoleKey("1ABCD3_EFG2")); } + @Test public void testValidateLoginName() { - assertTrue(ValidationUtils.isValidLoginName("abcd")); - assertTrue(ValidationUtils.isValidLoginName("abcd123")); - assertTrue(ValidationUtils.isValidLoginName("ab-cd")); - assertTrue(ValidationUtils.isValidLoginName("ab.cd")); - assertTrue(ValidationUtils.isValidLoginName("ab_cd")); - assertTrue(ValidationUtils.isValidLoginName("Ab-Cd")); - assertTrue(ValidationUtils.isValidLoginName("ab@cd")); - assertTrue(ValidationUtils.isValidLoginName("AB\\cd")); - assertTrue(ValidationUtils.isValidLoginName("AB\\ab...@de...")); - assertFalse(ValidationUtils.isValidLoginName("ab%cd")); - assertFalse(ValidationUtils.isValidLoginName("ab:cd")); - assertFalse(ValidationUtils.isValidLoginName("ab cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("abcd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("abcd123")); + Assert.assertTrue(ValidationUtils.isValidLoginName("ab-cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("ab.cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("ab_cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("Ab-Cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("ab@cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("AB\\cd")); + Assert.assertTrue(ValidationUtils.isValidLoginName("AB\\ab...@de...")); + Assert.assertFalse(ValidationUtils.isValidLoginName("ab%cd")); + Assert.assertFalse(ValidationUtils.isValidLoginName("ab:cd")); + Assert.assertFalse(ValidationUtils.isValidLoginName("ab cd")); } + @Test public void testValidateStateName() { - assertTrue(ValidationUtils.isValidStateName("Abcd")); - assertTrue(ValidationUtils.isValidStateName("Abcd-Efgh")); - assertTrue(ValidationUtils.isValidStateName("Abcd-Efgh-Hijk")); - assertFalse(ValidationUtils.isValidStateName("AbcdEfgh")); - assertFalse(ValidationUtils.isValidStateName("Abcd123")); - assertFalse(ValidationUtils.isValidStateName("8bcd")); - assertFalse(ValidationUtils.isValidStateName("Ab-cd")); - assertFalse(ValidationUtils.isValidStateName("Ab cd")); + Assert.assertTrue(ValidationUtils.isValidStateName("Abcd")); + Assert.assertTrue(ValidationUtils.isValidStateName("Abcd-Efgh")); + Assert.assertTrue(ValidationUtils.isValidStateName("Abcd-Efgh-Hijk")); + Assert.assertFalse(ValidationUtils.isValidStateName("AbcdEfgh")); + Assert.assertFalse(ValidationUtils.isValidStateName("Abcd123")); + Assert.assertFalse(ValidationUtils.isValidStateName("8bcd")); + Assert.assertFalse(ValidationUtils.isValidStateName("Ab-cd")); + Assert.assertFalse(ValidationUtils.isValidStateName("Ab cd")); } } Modified: trunk/jtrac/src/test/java/info/jtrac/util/XmlUtilsTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/util/XmlUtilsTest.java 2021-11-19 11:13:45 UTC (rev 1417) +++ trunk/jtrac/src/test/java/info/jtrac/util/XmlUtilsTest.java 2021-11-22 13:24:18 UTC (rev 1418) @@ -1,31 +1,36 @@ package info.jtrac.util; import info.jtrac.util.XmlUtils; -import junit.framework.TestCase; + +import org.junit.*; + import org.dom4j.Document; -public class XmlUtilsTest extends TestCase { - +public class XmlUtilsTest { + + @Test public void testXmlStringParse() { String s = "<test/>"; Document d = XmlUtils.parse(s); - assertTrue(d.getRootElement().getName().equals("test")); + Assert.assertTrue(d.getRootElement().getName().equals("test")); } + @Test public void testBadXmlParseFails() { String s = "foo"; try { Document d = XmlUtils.parse(s); - fail("How did we parse invalid XML?"); + Assert.fail("How did we parse invalid XML?"); } catch (Exception e) { // expected } } + @Test public void testGetAsPrettyXml() { String s = "<root><node1><node2>data</node2></node1></root>"; String result = XmlUtils.getAsPrettyXml(s); - assertTrue(result.equals("<root>\n <node1>\n <node2>data</node2>\n </node1>\n</root>")); + Assert.assertTrue(result.equals("<root>\n <node1>\n <node2>data</node2>\n </node1>\n</root>")); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-11-19 11:13:48
|
Revision: 1417 http://sourceforge.net/p/j-trac/code/1417 Author: udittmer Date: 2021-11-19 11:13:45 +0000 (Fri, 19 Nov 2021) Log Message: ----------- clean up test cases Modified Paths: -------------- trunk/jtrac/pom.xml trunk/jtrac/src/test/java/info/jtrac/JtracTest.java trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java Removed Paths: ------------- trunk/jtrac/src/test/java/info/jtrac/selenium/ trunk/jtrac/src/test/java/info/jtrac/wicket/ Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-11-19 08:25:43 UTC (rev 1416) +++ trunk/jtrac/pom.xml 2021-11-19 11:13:45 UTC (rev 1417) @@ -4,7 +4,7 @@ <groupId>info.jtrac</groupId> <artifactId>jtrac</artifactId> <packaging>war</packaging> - <version>2.2.0-b3</version> + <version>2.2.0</version> <name>JTrac</name> <description> JTrac is a generic issue-tracking web-application that can be easily customized by adding custom fields @@ -57,23 +57,6 @@ </developer> </developers> - <repositories> - <repository> - <id>openqa.org</id> - <name>selenium snapshot</name> - <url>https://repo.spring.io/plugins-release/</url> - <!-- - <url>http://maven.geomajas.org/</url> - <url>https://maven.onehippo.com/maven2/</url> - --> - <snapshots> - <enabled>true</enabled> - <updatePolicy>always</updatePolicy> - <checksumPolicy>warn</checksumPolicy> - </snapshots> - </repository> - </repositories> - <dependencies> <dependency> <groupId>junit</groupId> @@ -112,6 +95,10 @@ <exclusions> <exclusion> <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> <artifactId>spring-remoting</artifactId> </exclusion> <exclusion> @@ -441,20 +428,6 @@ <artifactId>commonmark-ext-autolink</artifactId> <version>0.18.0</version> </dependency> - <!-- - <dependency> - <groupId>org.openqa.selenium.client-drivers</groupId> - <artifactId>selenium-java-client-driver</artifactId> - <version>0.9.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.openqa.selenium.server</groupId> - <artifactId>selenium-server</artifactId> - <version>0.9.2</version> - <scope>test</scope> - </dependency> - --> </dependencies> <build> @@ -509,7 +482,7 @@ <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> - <version>9.4.43.v20210629</version> + <version>9.4.44.v20210927</version> <configuration> <systemProperties> <systemProperty> @@ -525,7 +498,6 @@ <version>2.22.2</version> <configuration> <excludes> - <exclude>info/jtrac/selenium/**</exclude> <exclude>info/jtrac/test/**</exclude> </excludes> </configuration> Modified: trunk/jtrac/src/test/java/info/jtrac/JtracTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/JtracTest.java 2021-11-19 08:25:43 UTC (rev 1416) +++ trunk/jtrac/src/test/java/info/jtrac/JtracTest.java 2021-11-19 11:13:45 UTC (rev 1417) @@ -1,415 +1,407 @@ -package info.jtrac; - -import info.jtrac.domain.Config; -import info.jtrac.domain.Counts; -import info.jtrac.domain.CountsHolder; -import info.jtrac.domain.Field; -import info.jtrac.domain.Item; -import info.jtrac.domain.ItemItem; -import info.jtrac.domain.ItemUser; -import info.jtrac.domain.Metadata; -import info.jtrac.domain.Space; -import info.jtrac.domain.User; -import info.jtrac.domain.State; -import info.jtrac.domain.UserSpaceRole; -import info.jtrac.util.ItemUtils; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.acegisecurity.GrantedAuthority; -import org.acegisecurity.userdetails.UserDetails; - -/** - * JUnit test cases for the business implementation as well as the DAO - * Tests assume that a database is available, and with HSQLDB around this is not - * an issue. - */ -public class JtracTest extends JtracTestBase { - - public JtracTest(String name) { - super(name); - } - - private Space getSpace() { - Space space = new Space(); - space.setPrefixCode("TEST"); - space.setName("Test Space"); - return space; - } - - private Metadata getMetadata() { - Metadata metadata = new Metadata(); - String xmlString = "<metadata><fields>" - + "<field name='cusInt01' label='Test Label'/>" - + "<field name='cusInt02' label='Test Label 2'/>" - + "</fields></metadata>"; - metadata.setXmlString(xmlString); - return metadata; - } - - private void cleanDatabase() { - jdbcTemplate.execute("delete from user_space_roles where id > 1"); - deleteFromTables(new String[] { - "history", - "items", - "spaces", - "metadata", - "space_sequence" - }); - jdbcTemplate.execute("delete from users where id > 1"); - } - - //========================================================================== - - public void testGeneratedPasswordIsAlwaysDifferent() { - String p1 = jtrac.generatePassword(); - String p2 = jtrac.generatePassword(); - assertTrue(!p1.equals(p2)); - } - - public void testEncodeClearTextPassword() { - assertEquals("21232f297a57a5a743894a0e4a801fc3", jtrac.encodeClearText("admin")); - } - - public void testMetadataInsertAndLoad() { - Metadata m1 = getMetadata(); - jtrac.storeMetadata(m1); - assertTrue(m1.getId() > 0); - Metadata m2 = jtrac.loadMetadata(m1.getId()); - assertTrue(m2 != null); - Map<Field.Name, Field> fields = m2.getFields(); - assertTrue(fields.size() == 2); - } - - public void testUserInsertAndLoad() { - User user = new User(); - user.setLoginName("test"); - user.setEmail("te...@jt..."); - jtrac.storeUser(user); - User user1 = jtrac.loadUser("test"); - assertTrue(user1.getEmail().equals("te...@jt...")); - User user2 = dao.findUsersByEmail("te...@jt...").get(0); - assertTrue(user2.getLoginName().equals("test")); - } - - public void testUserSpaceRolesInsert() { - Space space = getSpace(); - Metadata metadata = getMetadata(); - - space.setMetadata(metadata); - jtrac.storeSpace(space); - - User user = new User(); - user.setLoginName("test"); - - user.addSpaceWithRole(space, "ROLE_TEST"); - jtrac.storeUser(user); - - User u1 = jtrac.loadUser("test"); - - GrantedAuthority[] gas = u1.getAuthorities(); - assertEquals(1, gas.length); - assertEquals("ROLE_TEST:TEST", gas[0].getAuthority()); - - List<UserSpaceRole> userSpaceRoles = jtrac.findUserRolesForSpace(space.getId()); - assertEquals(1, userSpaceRoles.size()); - UserSpaceRole usr = userSpaceRoles.get(0); - assertEquals("test", usr.getUser().getLoginName()); - assertEquals("ROLE_TEST", usr.getRoleKey()); - - List<User> users = jtrac.findUsersForUser(u1); - assertEquals(1, users.size()); - - List<User> users2 = jtrac.findUsersForSpace(space.getId()); - assertEquals(1, users2.size()); - - } - - public void testConfigStoreAndLoad() { - Config config = new Config("testParam", "testValue"); - jtrac.storeConfig(config); - String value = jtrac.loadConfig("testParam"); - assertEquals("testValue", value); - } - - public void testStoreAndLoadUserWithAdminRole() { - User user = new User(); - user.setLoginName("test"); - user.addSpaceWithRole(null, "ROLE_ADMIN"); - jtrac.storeUser(user); - - UserDetails ud = jtrac.loadUserByUsername("test"); - - Set<String> set = new HashSet<String>(); - for (GrantedAuthority ga : ud.getAuthorities()) { - set.add(ga.getAuthority()); - } - - assertEquals(1, set.size()); - assertTrue(set.contains("ROLE_ADMIN")); - - } - - public void testDefaultAdminUserHasAdminRole() { - UserDetails ud = jtrac.loadUserByUsername("admin"); - Set<String> set = new HashSet<String>(); - for (GrantedAuthority ga : ud.getAuthorities()) { - set.add(ga.getAuthority()); - } - assertEquals(1, set.size()); - assertTrue(set.contains("ROLE_ADMIN")); - } - - public void testItemInsertAndCounts() { - Space s = getSpace(); - jtrac.storeSpace(s); - User u = new User(); - u.setLoginName("test"); - u.addSpaceWithRole(s, "DEFAULT"); - jtrac.storeUser(u); - Item i = new Item(); - i.setSpace(s); - i.setAssignedTo(u); - i.setLoggedBy(u); - i.setStatus(State.CLOSED); - jtrac.storeItem(i, null); - assertEquals(1, i.getSequenceNum()); - - CountsHolder ch = jtrac.loadCountsForUser(u); - assertEquals(1, ch.getTotalAssignedToMe()); - assertEquals(1, ch.getTotalLoggedByMe()); - assertEquals(1, ch.getTotalTotal()); - - Counts c = ch.getCounts().get(s.getId()); - assertEquals(1, c.getLoggedByMe()); - assertEquals(1, c.getAssignedToMe()); - assertEquals(1, c.getTotal()); - } - - public void testRemoveSpaceRoleDoesNotOrphanDatabaseRecord() { - Space space = getSpace(); - jtrac.storeSpace(space); - long spaceId = space.getId(); - User user = new User(); - user.setLoginName("test"); - user.addSpaceWithRole(space, "ROLE_ADMIN"); - jtrac.storeUser(user); - long id = jdbcTemplate.queryForLong("select id from user_space_roles where space_id = " + spaceId); - UserSpaceRole usr = jtrac.loadUserSpaceRole(id); - assertEquals(spaceId, usr.getSpace().getId()); - jtrac.removeUserSpaceRole(usr); - setComplete(); - endTransaction(); - assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where space_id = " + spaceId)); - cleanDatabase(); - } - - public void testFindSpacesWhereGuestAllowed() { - Space space = getSpace(); - space.setGuestAllowed(true); - jtrac.storeSpace(space); - assertEquals(1, jtrac.findSpacesWhereGuestAllowed().size()); - } - - public void testRenameSpaceRole() { - Space space = getSpace(); - jtrac.storeSpace(space); - User u = new User(); - u.setLoginName("test"); - u.addSpaceWithRole(space, "DEFAULT"); - jtrac.storeUser(u); - assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); - jtrac.bulkUpdateRenameSpaceRole(space, "DEFAULT", "NEWDEFAULT"); - assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); - assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'NEWDEFAULT'")); - } - - public void testGetItemAsHtmlDoesNotThrowException() { - Config config = new Config("mail.server.host", "dummyhost"); - jtrac.storeConfig(config); - // now email sending is switched on - Space s = getSpace(); - jtrac.storeSpace(s); - User u = new User(); - u.setLoginName("test"); - u.setName("Test User"); - u.setEmail("test"); - u.addSpaceWithRole(s, "DEFAULT"); - jtrac.storeUser(u); - Item i = new Item(); - i.setSpace(s); - i.setAssignedTo(u); - i.setLoggedBy(u); - i.setStatus(State.CLOSED); - // next step will internally try to render item as Html for sending e-mail - jtrac.storeItem(i, null); - String rendered = ItemUtils.getAsXml(i).asXML(); - assertTrue(rendered.contains("<item refId=\"TEST-")); - } - - public void testDeleteItemThatHasRelatedItems() { - Space s = getSpace(); - jtrac.storeSpace(s); - User u = new User(); - u.setLoginName("test"); - u.setEmail("dummy"); - u.addSpaceWithRole(s, "DEFAULT"); - jtrac.storeUser(u); - //======================== - Item i0 = new Item(); - i0.setSpace(s); - i0.setAssignedTo(u); - i0.setLoggedBy(u); - i0.setStatus(State.CLOSED); - jtrac.storeItem(i0, null); - //======================= - Item i1 = new Item(); - i1.setSpace(s); - i1.setAssignedTo(u); - i1.setLoggedBy(u); - i1.setStatus(State.CLOSED); - i1.addRelated(i0, ItemItem.DEPENDS_ON); - jtrac.storeItem(i1, null); - //======================== - Item i2 = new Item(); - i2.setSpace(s); - i2.setAssignedTo(u); - i2.setLoggedBy(u); - i2.setStatus(State.CLOSED); - i2.addRelated(i1, ItemItem.DUPLICATE_OF); - jtrac.storeItem(i2, null); - assertEquals(3, jtrac.loadCountOfHistoryInvolvingUser(u)); - // can we remove i1? - Item temp = jtrac.loadItem(i1.getId()); - jtrac.removeItem(temp); - } - - public void testDeletingUserDeletesItemUsersAlso() { - Space s = getSpace(); - jtrac.storeSpace(s); - User u = new User(); - u.setLoginName("test"); - u.setEmail("dummy"); - u.addSpaceWithRole(s, "DEFAULT"); - jtrac.storeUser(u); - //======================== - Item i = new Item(); - i.setSpace(s); - i.setAssignedTo(u); - i.setLoggedBy(u); - i.setStatus(State.CLOSED); - //======================== - // another user to "watch" this item - User w = new User(); - w.setLoginName("test1"); - w.setEmail("dummy"); - w.addSpaceWithRole(s, "DEFAULT"); - jtrac.storeUser(w); - ItemUser iu = new ItemUser(w); - Set<ItemUser> ius = new HashSet<ItemUser>(); - ius.add(iu); - i.setItemUsers(ius); - //======================== - jtrac.storeItem(i, null); - setComplete(); - endTransaction(); - - startNewTransaction(); - jtrac.removeUser(w); - setComplete(); - endTransaction(); - - startNewTransaction(); - Item dummyItem = jtrac.loadItem(i.getId()); - assertEquals(0, dummyItem.getItemUsers().size()); - - cleanDatabase(); - - } - - public void testLogicToFindNotUsersAndSpacesNotAllocated() { - - cleanDatabase(); - - Space s1 = getSpace(); - Metadata m1 = getMetadata(); - m1.initRoles(); - s1.setMetadata(m1); - jtrac.storeSpace(s1); - - Space s2 = getSpace(); - s2.setPrefixCode("TEST2"); - Metadata m2 = getMetadata(); - m2.initRoles(); - s2.setMetadata(m2); - jtrac.storeSpace(s2); - - User u1 = new User(); - u1.setLoginName("test"); - - u1.addSpaceWithRole(s1, "DEFAULT"); - jtrac.storeUser(u1); - - List<Space> list = jtrac.findSpacesNotFullyAllocatedToUser(u1.getId()); - assertEquals(2, list.size()); - - jtrac.storeUserSpaceRole(u1, s1, "ROLE_ADMIN"); - - List<Space> list2 = jtrac.findSpacesNotFullyAllocatedToUser(u1.getId()); - assertEquals(1, list2.size()); - - User u2 = new User(); - u2.setLoginName("test2"); - jtrac.storeUser(u2); - - List<User> list3 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); - // admin user exists also - assertEquals(2, list3.size()); - - jtrac.storeUserSpaceRole(u2, s1, "DEFAULT"); - - List<User> list4 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); - logger.info(list4); - assertEquals(2, list4.size()); - - - jtrac.storeUserSpaceRole(u2, s1, "ROLE_ADMIN"); - - List<User> list5 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); - assertEquals(1, list5.size()); - - } - - public void testFindSuperUsers() { - - List<User> list1 = dao.findSuperUsers(); - assertEquals(1, list1.size()); - assertEquals("admin", list1.get(0).getLoginName()); - - User u1 = new User(); - u1.setLoginName("test2"); - jtrac.storeUser(u1); - - jtrac.storeUserSpaceRole(u1, null, "ROLE_ADMIN"); - - List<User> list2 = dao.findSuperUsers(); - assertEquals(2, list2.size()); - - } - - public void testLoadSpaceRolesMapForUser() { - - User u1 = new User(); - u1.setLoginName("test2"); - jtrac.storeUser(u1); - - jtrac.storeUserSpaceRole(u1, null, "ROLE_ADMIN"); - - Map<Long, List<UserSpaceRole>> map = jtrac.loadSpaceRolesMapForUser(u1.getId()); - assertEquals(1, map.size()); - - } - -} +package info.jtrac; + +import info.jtrac.domain.Config; +import info.jtrac.domain.Counts; +import info.jtrac.domain.CountsHolder; +import info.jtrac.domain.Field; +import info.jtrac.domain.Item; +import info.jtrac.domain.ItemItem; +import info.jtrac.domain.ItemUser; +import info.jtrac.domain.Metadata; +import info.jtrac.domain.Space; +import info.jtrac.domain.User; +import info.jtrac.domain.State; +import info.jtrac.domain.UserSpaceRole; +import info.jtrac.util.ItemUtils; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.acegisecurity.GrantedAuthority; +import org.acegisecurity.userdetails.UserDetails; + +/** + * JUnit test cases for the business implementation as well as the DAO + * Tests assume that a database is available, and with HSQLDB around this is not an issue. + */ +public class JtracTest extends JtracTestBase { + + public JtracTest(String name) { + super(name); + } + + private Space getSpace() { + Space space = new Space(); + space.setPrefixCode("TEST"); + space.setName("Test Space"); + return space; + } + + private Metadata getMetadata() { + Metadata metadata = new Metadata(); + String xmlString = "<metadata><fields>" + + "<field name='cusInt01' label='Test Label'/>" + + "<field name='cusInt02' label='Test Label 2'/>" + + "</fields></metadata>"; + metadata.setXmlString(xmlString); + return metadata; + } + + private void cleanDatabase() { + jdbcTemplate.execute("delete from user_space_roles where id > 1"); + deleteFromTables(new String[] { + "history", + "items", + "spaces", + "metadata", + "space_sequence" + }); + jdbcTemplate.execute("delete from users where id > 1"); + } + + //========================================================================== + + public void testGeneratedPasswordIsAlwaysDifferent() { + String p1 = jtrac.generatePassword(); + String p2 = jtrac.generatePassword(); + assertTrue(!p1.equals(p2)); + } + + public void testEncodeClearTextPassword() { + assertEquals("21232f297a57a5a743894a0e4a801fc3", jtrac.encodeClearText("admin")); + } + + public void testMetadataInsertAndLoad() { + Metadata m1 = getMetadata(); + jtrac.storeMetadata(m1); + assertTrue(m1.getId() > 0); + Metadata m2 = jtrac.loadMetadata(m1.getId()); + assertTrue(m2 != null); + Map<Field.Name, Field> fields = m2.getFields(); + assertTrue(fields.size() == 2); + } + + public void testUserInsertAndLoad() { + User user = new User(); + user.setLoginName("test"); + user.setEmail("te...@jt..."); + jtrac.storeUser(user); + User user1 = jtrac.loadUser("test"); + assertTrue(user1.getEmail().equals("te...@jt...")); + User user2 = dao.findUsersByEmail("te...@jt...").get(0); + assertTrue(user2.getLoginName().equals("test")); + } + + public void testUserSpaceRolesInsert() { + Space space = getSpace(); + Metadata metadata = getMetadata(); + + space.setMetadata(metadata); + jtrac.storeSpace(space); + + User user = new User(); + user.setLoginName("test"); + + user.addSpaceWithRole(space, "ROLE_TEST"); + jtrac.storeUser(user); + + User u1 = jtrac.loadUser("test"); + + GrantedAuthority[] gas = u1.getAuthorities(); + assertEquals(1, gas.length); + assertEquals("ROLE_TEST:TEST", gas[0].getAuthority()); + + List<UserSpaceRole> userSpaceRoles = jtrac.findUserRolesForSpace(space.getId()); + assertEquals(1, userSpaceRoles.size()); + UserSpaceRole usr = userSpaceRoles.get(0); + assertEquals("test", usr.getUser().getLoginName()); + assertEquals("ROLE_TEST", usr.getRoleKey()); + + List<User> users = jtrac.findUsersForUser(u1); + assertEquals(1, users.size()); + + List<User> users2 = jtrac.findUsersForSpace(space.getId()); + assertEquals(1, users2.size()); + } + + public void testConfigStoreAndLoad() { + Config config = new Config("testParam", "testValue"); + jtrac.storeConfig(config); + String value = jtrac.loadConfig("testParam"); + assertEquals("testValue", value); + } + + public void testStoreAndLoadUserWithAdminRole() { + User user = new User(); + user.setLoginName("test"); + user.addSpaceWithRole(null, "ROLE_ADMIN"); + jtrac.storeUser(user); + + UserDetails ud = jtrac.loadUserByUsername("test"); + + Set<String> set = new HashSet<String>(); + for (GrantedAuthority ga : ud.getAuthorities()) { + set.add(ga.getAuthority()); + } + + assertEquals(1, set.size()); + assertTrue(set.contains("ROLE_ADMIN")); + } + + public void testDefaultAdminUserHasAdminRole() { + UserDetails ud = jtrac.loadUserByUsername("admin"); + Set<String> set = new HashSet<String>(); + for (GrantedAuthority ga : ud.getAuthorities()) { + set.add(ga.getAuthority()); + } + assertEquals(1, set.size()); + assertTrue(set.contains("ROLE_ADMIN")); + } + + public void testItemInsertAndCounts() { + Space s = getSpace(); + jtrac.storeSpace(s); + User u = new User(); + u.setLoginName("test"); + u.addSpaceWithRole(s, "DEFAULT"); + jtrac.storeUser(u); + Item i = new Item(); + i.setSpace(s); + i.setAssignedTo(u); + i.setLoggedBy(u); + i.setStatus(State.CLOSED); + jtrac.storeItem(i, null); + assertEquals(1, i.getSequenceNum()); + + CountsHolder ch = jtrac.loadCountsForUser(u); + assertEquals(1, ch.getTotalAssignedToMe()); + assertEquals(1, ch.getTotalLoggedByMe()); + assertEquals(1, ch.getTotalTotal()); + + Counts c = ch.getCounts().get(s.getId()); + assertEquals(1, c.getLoggedByMe()); + assertEquals(1, c.getAssignedToMe()); + assertEquals(1, c.getTotal()); + } + + public void testRemoveSpaceRoleDoesNotOrphanDatabaseRecord() { + Space space = getSpace(); + jtrac.storeSpace(space); + long spaceId = space.getId(); + User user = new User(); + user.setLoginName("test"); + user.addSpaceWithRole(space, "ROLE_ADMIN"); + jtrac.storeUser(user); + long id = jdbcTemplate.queryForLong("select id from user_space_roles where space_id = " + spaceId); + UserSpaceRole usr = jtrac.loadUserSpaceRole(id); + assertEquals(spaceId, usr.getSpace().getId()); + jtrac.removeUserSpaceRole(usr); + setComplete(); + endTransaction(); + assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where space_id = " + spaceId)); + cleanDatabase(); + } + + public void testFindSpacesWhereGuestAllowed() { + Space space = getSpace(); + space.setGuestAllowed(true); + jtrac.storeSpace(space); + assertEquals(1, jtrac.findSpacesWhereGuestAllowed().size()); + } + + public void testRenameSpaceRole() { + Space space = getSpace(); + jtrac.storeSpace(space); + User u = new User(); + u.setLoginName("test"); + u.addSpaceWithRole(space, "DEFAULT"); + jtrac.storeUser(u); + assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); + jtrac.bulkUpdateRenameSpaceRole(space, "DEFAULT", "NEWDEFAULT"); + assertEquals(0, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'DEFAULT'")); + assertEquals(1, jdbcTemplate.queryForInt("select count(0) from user_space_roles where role_key = 'NEWDEFAULT'")); + } + + public void testGetItemAsHtmlDoesNotThrowException() { + Config config = new Config("mail.server.host", "dummyhost"); + jtrac.storeConfig(config); + // now email sending is switched on + Space s = getSpace(); + jtrac.storeSpace(s); + User u = new User(); + u.setLoginName("test"); + u.setName("Test User"); + u.setEmail("test"); + u.addSpaceWithRole(s, "DEFAULT"); + jtrac.storeUser(u); + Item i = new Item(); + i.setSpace(s); + i.setAssignedTo(u); + i.setLoggedBy(u); + i.setStatus(State.CLOSED); + // next step will internally try to render item as Html for sending e-mail + jtrac.storeItem(i, null); + String rendered = ItemUtils.getAsXml(i).asXML(); + assertTrue(rendered.contains("<item refId=\"TEST-")); + } + + public void testDeleteItemThatHasRelatedItems() { + Space s = getSpace(); + jtrac.storeSpace(s); + User u = new User(); + u.setLoginName("test"); + u.setEmail("dummy"); + u.addSpaceWithRole(s, "DEFAULT"); + jtrac.storeUser(u); + //======================== + Item i0 = new Item(); + i0.setSpace(s); + i0.setAssignedTo(u); + i0.setLoggedBy(u); + i0.setStatus(State.CLOSED); + jtrac.storeItem(i0, null); + //======================= + Item i1 = new Item(); + i1.setSpace(s); + i1.setAssignedTo(u); + i1.setLoggedBy(u); + i1.setStatus(State.CLOSED); + i1.addRelated(i0, ItemItem.DEPENDS_ON); + jtrac.storeItem(i1, null); + //======================== + Item i2 = new Item(); + i2.setSpace(s); + i2.setAssignedTo(u); + i2.setLoggedBy(u); + i2.setStatus(State.CLOSED); + i2.addRelated(i1, ItemItem.DUPLICATE_OF); + jtrac.storeItem(i2, null); + assertEquals(3, jtrac.loadCountOfHistoryInvolvingUser(u)); + // can we remove i1? + Item temp = jtrac.loadItem(i1.getId()); + jtrac.removeItem(temp); + } + + public void testDeletingUserDeletesItemUsersAlso() { + Space s = getSpace(); + jtrac.storeSpace(s); + User u = new User(); + u.setLoginName("test"); + u.setEmail("dummy"); + u.addSpaceWithRole(s, "DEFAULT"); + jtrac.storeUser(u); + //======================== + Item i = new Item(); + i.setSpace(s); + i.setAssignedTo(u); + i.setLoggedBy(u); + i.setStatus(State.CLOSED); + //======================== + // another user to "watch" this item + User w = new User(); + w.setLoginName("test1"); + w.setEmail("dummy"); + w.addSpaceWithRole(s, "DEFAULT"); + jtrac.storeUser(w); + ItemUser iu = new ItemUser(w); + Set<ItemUser> ius = new HashSet<ItemUser>(); + ius.add(iu); + i.setItemUsers(ius); + //======================== + jtrac.storeItem(i, null); + setComplete(); + endTransaction(); + + startNewTransaction(); + jtrac.removeUser(w); + setComplete(); + endTransaction(); + + startNewTransaction(); + Item dummyItem = jtrac.loadItem(i.getId()); + assertEquals(0, dummyItem.getItemUsers().size()); + + cleanDatabase(); + } + + public void testLogicToFindNotUsersAndSpacesNotAllocated() { + cleanDatabase(); + + Space s1 = getSpace(); + Metadata m1 = getMetadata(); + m1.initRoles(); + s1.setMetadata(m1); + jtrac.storeSpace(s1); + + Space s2 = getSpace(); + s2.setPrefixCode("TEST2"); + Metadata m2 = getMetadata(); + m2.initRoles(); + s2.setMetadata(m2); + jtrac.storeSpace(s2); + + User u1 = new User(); + u1.setLoginName("test"); + + u1.addSpaceWithRole(s1, "DEFAULT"); + jtrac.storeUser(u1); + + List<Space> list = jtrac.findSpacesNotFullyAllocatedToUser(u1.getId()); + assertEquals(2, list.size()); + + jtrac.storeUserSpaceRole(u1, s1, "ROLE_ADMIN"); + + List<Space> list2 = jtrac.findSpacesNotFullyAllocatedToUser(u1.getId()); + assertEquals(1, list2.size()); + + User u2 = new User(); + u2.setLoginName("test2"); + jtrac.storeUser(u2); + + List<User> list3 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); + // admin user exists also + assertEquals(2, list3.size()); + + jtrac.storeUserSpaceRole(u2, s1, "DEFAULT"); + + List<User> list4 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); + logger.info(list4); + assertEquals(2, list4.size()); + + + jtrac.storeUserSpaceRole(u2, s1, "ROLE_ADMIN"); + + List<User> list5 = jtrac.findUsersNotFullyAllocatedToSpace(s1.getId()); + assertEquals(1, list5.size()); + } + + public void testFindSuperUsers() { + + List<User> list1 = dao.findSuperUsers(); + assertEquals(1, list1.size()); + assertEquals("admin", list1.get(0).getLoginName()); + + User u1 = new User(); + u1.setLoginName("test2"); + jtrac.storeUser(u1); + + jtrac.storeUserSpaceRole(u1, null, "ROLE_ADMIN"); + + List<User> list2 = dao.findSuperUsers(); + assertEquals(2, list2.size()); + } + + public void testLoadSpaceRolesMapForUser() { + + User u1 = new User(); + u1.setLoginName("test2"); + jtrac.storeUser(u1); + + jtrac.storeUserSpaceRole(u1, null, "ROLE_ADMIN"); + + Map<Long, List<UserSpaceRole>> map = jtrac.loadSpaceRolesMapForUser(u1.getId()); + assertEquals(1, map.size()); + } + +} Modified: trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java =================================================================== --- trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java 2021-11-19 08:25:43 UTC (rev 1416) +++ trunk/jtrac/src/test/java/info/jtrac/lucene/IndexSearcherTest.java 2021-11-19 11:13:45 UTC (rev 1417) @@ -1,60 +1,60 @@ -package info.jtrac.lucene; - -import info.jtrac.domain.Item; -import java.io.File; -import java.util.List; -import junit.framework.TestCase; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.FileSystemXmlApplicationContext; - -public class IndexSearcherTest extends TestCase { - - private ApplicationContext context; - - @Override - public void setUp() { - File home = new File("target/home"); - if (!home.exists()) { - home.mkdir(); - } - File file = new File("target/home/indexes"); - if (!file.exists()) { - file.mkdir(); - } else { - for (File f : file.listFiles()) { - f.delete(); - } - } - System.setProperty("jtrac.home", home.getAbsolutePath()); - context = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext-lucene.xml"); - } - - public void testFindItemIdsBySearchingWithinSummaryAndDetailFields() throws Exception { - Item item = new Item(); - item.setId(1); - item.setSummary("this is a test summary"); - item.setDetail("the quick brown fox jumped over the lazy dogs"); - Indexer indexer = (Indexer) context.getBean("indexer"); - indexer.index(item); - IndexSearcher searcher = (IndexSearcher) context.getBean("indexSearcher"); - List list = searcher.findItemIdsContainingText("lazy"); - assertEquals(1, list.size()); - list = searcher.findItemIdsContainingText("foo"); - assertEquals(0, list.size()); - list = searcher.findItemIdsContainingText("summary"); - assertEquals(1, list.size()); - } - - public void testIfUmlautsCanBeIndexedAndSearchedFor() { - Item item = new Item(); - item.setId(1); - item.setSummary("this does not contain an umlaut"); - item.setDetail("there is an umlaut right here --> \xFCmlaut"); - Indexer indexer = (Indexer) context.getBean("indexer"); - indexer.index(item); - IndexSearcher searcher = (IndexSearcher) context.getBean("indexSearcher"); - List list = searcher.findItemIdsContainingText("\xFCmlaut"); - assertEquals(1, list.size()); - } - -} +package info.jtrac.lucene; + +import info.jtrac.domain.Item; +import java.io.File; +import java.util.List; +import junit.framework.TestCase; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.FileSystemXmlApplicationContext; + +public class IndexSearcherTest extends TestCase { + + private ApplicationContext context; + + @Override + public void setUp() { + File home = new File("target/home"); + if (!home.exists()) { + home.mkdir(); + } + File file = new File("target/home/indexes"); + if (!file.exists()) { + file.mkdir(); + } else { + for (File f : file.listFiles()) { + f.delete(); + } + } + System.setProperty("jtrac.home", home.getAbsolutePath()); + context = new FileSystemXmlApplicationContext("src/main/webapp/WEB-INF/applicationContext-lucene.xml"); + } + + public void testFindItemIdsBySearchingWithinSummaryAndDetailFields() throws Exception { + Item item = new Item(); + item.setId(1); + item.setSummary("this is a test summary"); + item.setDetail("the quick brown fox jumped over the lazy dogs"); + Indexer indexer = (Indexer) context.getBean("indexer"); + indexer.index(item); + IndexSearcher searcher = (IndexSearcher) context.getBean("indexSearcher"); + List list = searcher.findItemIdsContainingText("lazy"); + assertEquals(1, list.size()); + list = searcher.findItemIdsContainingText("foo"); + assertEquals(0, list.size()); + list = searcher.findItemIdsContainingText("summary"); + assertEquals(1, list.size()); + } + + public void testIfUmlautsCanBeIndexedAndSearchedFor() { + Item item = new Item(); + item.setId(1); + item.setSummary("this does not contain an umlaut"); + item.setDetail("there is an umlaut right here --> \u00fcmlaut"); + Indexer indexer = (Indexer) context.getBean("indexer"); + indexer.index(item); + IndexSearcher searcher = (IndexSearcher) context.getBean("indexSearcher"); + List list = searcher.findItemIdsContainingText("\u00fcmlaut"); + assertEquals(1, list.size()); + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-11-19 08:25:45
|
Revision: 1416 http://sourceforge.net/p/j-trac/code/1416 Author: udittmer Date: 2021-11-19 08:25:43 +0000 (Fri, 19 Nov 2021) Log Message: ----------- update dependencies Modified Paths: -------------- trunk/jtrac/pom.xml Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-11-10 14:52:06 UTC (rev 1415) +++ trunk/jtrac/pom.xml 2021-11-19 08:25:43 UTC (rev 1416) @@ -78,7 +78,7 @@ <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <version>3.8.1</version> + <version>4.13.2</version> <scope>test</scope> </dependency> <dependency> @@ -397,6 +397,10 @@ <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> + <exclusion> + <groupId>servletapi</groupId> + <artifactId>servletapi</artifactId> + </exclusion> </exclusions> </dependency> <dependency> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2021-11-10 14:52:07
|
Revision: 1415 http://sourceforge.net/p/j-trac/code/1415 Author: udittmer Date: 2021-11-10 14:52:06 +0000 (Wed, 10 Nov 2021) Log Message: ----------- update JFreeChart dependency Modified Paths: -------------- trunk/jtrac/pom.xml Modified: trunk/jtrac/pom.xml =================================================================== --- trunk/jtrac/pom.xml 2021-11-10 14:41:31 UTC (rev 1414) +++ trunk/jtrac/pom.xml 2021-11-10 14:52:06 UTC (rev 1415) @@ -146,18 +146,12 @@ <version>3.1.0</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.jfree</groupId> + <artifactId>jfreechart</artifactId> + <version>1.5.3</version> + </dependency> <dependency> - <groupId>jfree</groupId> - <artifactId>jfreechart</artifactId> - <version>1.0.13</version> - <exclusions> - <exclusion> - <groupId>gnujaxp</groupId> - <artifactId>gnujaxp</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> <version>3.2.7.ga</version> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |