You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(217) |
Nov
(180) |
Dec
(71) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(58) |
Feb
(370) |
Mar
(105) |
Apr
(165) |
May
(93) |
Jun
(37) |
Jul
|
Aug
(21) |
Sep
(131) |
Oct
(40) |
Nov
(113) |
Dec
(401) |
| 2007 |
Jan
(180) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
| 2008 |
Jan
(163) |
Feb
(78) |
Mar
|
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(96) |
Oct
(189) |
Nov
(413) |
Dec
(121) |
| 2009 |
Jan
(34) |
Feb
(18) |
Mar
(24) |
Apr
(16) |
May
(3) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(13) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(3) |
Oct
(16) |
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
(35) |
Jun
|
Jul
(17) |
Aug
(7) |
Sep
|
Oct
(9) |
Nov
|
Dec
|
|
From: <cli...@us...> - 2009-04-20 14:01:37
|
Revision: 2203
http://itracker.svn.sourceforge.net/itracker/?rev=2203&view=rev
Author: clim1219
Date: 2009-04-20 14:01:33 +0000 (Mon, 20 Apr 2009)
Log Message:
-----------
Doing a harmless test commit.
Signed-off-by: Chris Lim <chr...@gm...>
Modified Paths:
--------------
itracker/branches/spring_refactoring/pom.xml
Modified: itracker/branches/spring_refactoring/pom.xml
===================================================================
--- itracker/branches/spring_refactoring/pom.xml 2009-04-20 06:47:48 UTC (rev 2202)
+++ itracker/branches/spring_refactoring/pom.xml 2009-04-20 14:01:33 UTC (rev 2203)
@@ -846,4 +846,4 @@
</build>
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <cli...@us...> - 2009-04-20 06:47:49
|
Revision: 2202
http://itracker.svn.sourceforge.net/itracker/?rev=2202&view=rev
Author: clim1219
Date: 2009-04-20 06:47:48 +0000 (Mon, 20 Apr 2009)
Log Message:
-----------
This branch is an attempt to cleanup the action classes by using dependency injection for the services instead of the traditional lookup mechanism. Later on it will be easier for us to migrate to other recent mvc technology. Should the cleanup be successful the codes in this branch will eventually be integrated to the trunk.
Added Paths:
-----------
itracker/branches/spring_refactoring/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-21 20:37:56
|
Revision: 2201
http://itracker.svn.sourceforge.net/itracker/?rev=2201&view=rev
Author: ranks
Date: 2009-03-21 20:37:52 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
fixing datepicker localization of dateformat integrating scal javascript datepicker
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/model/CustomField.java
itracker/trunk/src/main/java/org/itracker/model/IssueField.java
itracker/trunk/src/main/java/org/itracker/web/taglib/FormatCustomFieldTag.java
itracker/trunk/src/main/java/org/itracker/web/taglib/FormatDateTag.java
itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp
itracker/trunk/src/main/webapp/module-searchissues/search_issues_form.jsp
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/header.jsp
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/scripts.js
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/styles.css
itracker/trunk/src/test/java/org/itracker/model/CustomFieldTest.java
itracker/trunk/src/test/java/org/itracker/model/IssueFieldTest.java
itracker/trunk/src/test/java/org/itracker/persistence/dao/CustomFieldDAOImplTest.java
itracker/trunk/src/test/resources/dataset/customfieldbean_dataset.xml
Modified: itracker/trunk/src/main/java/org/itracker/model/CustomField.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/model/CustomField.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/java/org/itracker/model/CustomField.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -358,10 +358,11 @@
case DATE:
if (this.dateFormat != CustomFieldUtilities.DATE_FORMAT_UNKNOWN) {
- SimpleDateFormat format = DEFAULT_DATE_FORMAT;
-// new SimpleDateFormat(bundle
-// .getString("itracker.dateformat." + this.dateFormat),
-// locale);
+ SimpleDateFormat format =
+ // DEFAULT_DATE_FORMAT;
+ new SimpleDateFormat(bundle
+ .getString("itracker.dateformat." + this.dateFormat),
+ locale);
try {
format.parse(value);
Modified: itracker/trunk/src/main/java/org/itracker/model/IssueField.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/model/IssueField.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/java/org/itracker/model/IssueField.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -49,14 +49,13 @@
private static transient final Logger log = Logger
.getLogger(IssueField.class);
-
private Issue issue;
private CustomField customField;
private String stringValue;
- private int intValue;
+ private Integer intValue;
private Date dateValue;
@@ -77,7 +76,6 @@
setCustomField(field);
}
-
public Issue getIssue() {
return issue;
}
@@ -101,6 +99,13 @@
}
public String getStringValue() {
+ if (null != this.getCustomField() && Type.DATE == this.getCustomField().getFieldType()) {
+ this.stringValue = "";
+ if (null != this.dateValue) {
+ String stringValue = formatDate(ITrackerResources.getBundle(ITrackerResources.BASE_LOCALE));
+ this.stringValue = stringValue;
+ }
+ }
return stringValue;
}
@@ -108,11 +113,11 @@
this.stringValue = stringValue;
}
- public int getIntValue() {
+ public Integer getIntValue() {
return intValue;
}
- public void setIntValue(int intValue) {
+ public void setIntValue(Integer intValue) {
this.intValue = intValue;
}
@@ -123,10 +128,12 @@
}
public void setDateValue(Date dateValue) {
- if (null == dateValue)
+ if (null == dateValue) {
this.dateValue = null;
- else
+ } else {
this.dateValue = new Date(dateValue.getTime());
+ this.stringValue = formatDate(ITrackerResources.getBundle());
+ }
}
/**
@@ -144,7 +151,7 @@
return String.valueOf(getIntValue());
}
return getStringValue();
-
+
}
/**
@@ -177,7 +184,6 @@
*/
public String getValue(ResourceBundle bundle) {
-
// skip this code, it's not approved
Locale locale = bundle.getLocale();
@@ -193,7 +199,7 @@
.debug("getValue: type was INTEGER, value: "
+ this.intValue);
}
- return Integer.toString(this.intValue);
+ return String.valueOf(this.intValue);
case DATE:
if (log.isDebugEnabled()) {
@@ -206,42 +212,45 @@
}
return null;
}
- SimpleDateFormat sdf = CustomField.DEFAULT_DATE_FORMAT;
- // FIXME: Fall back to a default date format or make date format mandatory!
-// String dateFormat = "dd/MM/yyyy";
-// (customField.getDateFormat()
-// .equalsIgnoreCase(CustomFieldUtilities.DATE_FORMAT_UNKNOWN)) ? CustomFieldUtilities.DATE_FORMAT_DATEONLY
-// : customField.getDateFormat();
+ if (this.dateValue == null) {
+ this.dateValue = new Date();
+ }
+ return formatDate(bundle);
+ default:
+ return this.stringValue;
+ }
-// if (log.isDebugEnabled()) {
-// log.debug("getValue: " + dateFormat + " (original was "
-// + customField.getDateFormat() + ")");
-// }
-// dateFormat = bundle.getString("itracker.dateformat." + dateFormat);
+ }
+
+ private String formatDate(ResourceBundle bundle) {
+ assert (dateValue!= null): "dateValue failed";
+ try {
+
+ SimpleDateFormat sdf =
+ new SimpleDateFormat(bundle
+ .getString("itracker.dateformat."
+ + customField.getDateFormat()), bundle.getLocale());
+
if (log.isDebugEnabled()) {
log.debug("getValue: dateFormat from itracker configuration "
+ sdf.toPattern());
}
- try {
-// sdf = new SimpleDateFormat(dateFormat, locale);
- String formattedDate = sdf.format(this.dateValue);
- if (log.isDebugEnabled()) {
- log.debug("getValue: formated date " + this.dateValue
- + " to " + formattedDate);
- }
- return formattedDate;
- } catch (NullPointerException ne) {
- log.debug("getValue: ", ne);
- if (dateValue == null) {
- log.warn("getValue: failed to format date, null for "
- + customField);
- return sdf.format(new Date());
- }
+
+ // sdf = new SimpleDateFormat(dateFormat, locale);
+ String formattedDate = sdf.format(this.dateValue);
+ if (log.isDebugEnabled()) {
+ log.debug("getValue: formated date " + this.dateValue
+ + " to " + formattedDate);
}
- default:
- return this.stringValue;
+ return formattedDate;
+ } catch (NullPointerException ne) {
+ log.debug("getValue: ", ne);
+ if (dateValue == null) {
+ log.warn("getValue: failed to format date, null for "
+ + customField);
+ }
+ return "";
}
-
}
/**
@@ -262,14 +271,20 @@
* the ResourceBundle used for any string formatting
* @throws IssueException
* represents an error formatting or parsing the value
- *
- * @deprecated locale is redundant set, in bundle and as separate parameter. use {@link IssueField#setValue(String, ResourceBundle)} instead
+ *
+ * @deprecated locale is redundant set, in bundle and as separate parameter.
+ * use {@link IssueField#setValue(String, ResourceBundle)}
+ * instead
*/
public void setValue(String value, Locale locale, ResourceBundle bundle)
throws IssueException {
+ this.stringValue = null;
+ this.intValue = 0;
+ this.dateValue = null;
+
if (value != null && value.trim().length() > 0) {
switch (customField.getFieldType()) {
-
+
case INTEGER:
setStringValue(value);
try {
@@ -283,27 +298,26 @@
case DATE:
setStringValue(value);
try {
-// if (customField.getDateFormat() != CustomFieldUtilities.DATE_FORMAT_UNKNOWN) {
- // FIXME: since the datepicker does not support different date format, always use the english date-only.
- SimpleDateFormat sdf = CustomField.DEFAULT_DATE_FORMAT;
-// new SimpleDateFormat(
-// "dd/MM/yyyy",
-// bundle
-// .getString("itracker.dateformat."
-// + CustomFieldUtilities.DATE_FORMAT_DATEONLY),
- //customField.getDateFormat()),
-// Locale.ENGLISH);
- Date dateValue = sdf.parse(value);
- if (dateValue != null) {
- setDateValue(dateValue);
- } else {
- log.error("setValue: caught exception for date " + value);
- throw new IssueException("Invalid date.",
- IssueException.TYPE_CF_PARSE_DATE);
- }
-// }
+ if (null == locale) {
+ locale = bundle.getLocale();
+ }
+ SimpleDateFormat sdf = // CustomField.DEFAULT_DATE_FORMAT;
+ new SimpleDateFormat(bundle
+ .getString("itracker.dateformat."
+ + customField.getDateFormat()), locale);
+
+ Date dateValue = sdf.parse(value);
+ if (dateValue != null) {
+ setDateValue(dateValue);
+ } else {
+ log.error("setValue: caught exception for date "
+ + value);
+ throw new IssueException("Invalid date.",
+ IssueException.TYPE_CF_PARSE_DATE);
+ }
} catch (Exception ex) {
- log.error("setValue: caught exception for date " + value, ex);
+ log.error("setValue: caught exception for date " + value,
+ ex);
throw new IssueException("Invalid date format.",
IssueException.TYPE_CF_PARSE_DATE);
}
@@ -314,12 +328,13 @@
}
} else {
-// reset value
+ // reset value
setStringValue("");
setDateValue(null);
setIntValue(0);
}
}
+
/**
* Sets the custom field value.
*
@@ -336,17 +351,17 @@
* the ResourceBundle used for any string formatting
* @throws IssueException
* represents an error formatting or parsing the value
- *
+ *
*/
- public void setValue(String value, ResourceBundle bundle) throws IssueException {
+ public void setValue(String value, ResourceBundle bundle)
+ throws IssueException {
setValue(value, bundle.getLocale(), bundle);
}
@Override
public String toString() {
- return new ToStringBuilder(this).append("id", getId())
- .append("issue", getIssue()).append("customField", getCustomField())
- .toString();
+ return new ToStringBuilder(this).append("id", getId()).append("issue",
+ getIssue()).append("customField", getCustomField()).toString();
}
}
Modified: itracker/trunk/src/main/java/org/itracker/web/taglib/FormatCustomFieldTag.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/taglib/FormatCustomFieldTag.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/java/org/itracker/web/taglib/FormatCustomFieldTag.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -18,10 +18,17 @@
package org.itracker.web.taglib;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.ResourceBundle;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
@@ -29,161 +36,325 @@
import org.apache.log4j.Logger;
import org.apache.struts.taglib.TagUtils;
+import org.itracker.core.resources.ITrackerResources;
import org.itracker.model.CustomField;
import org.itracker.model.CustomFieldValue;
import org.itracker.model.NameValuePair;
import org.itracker.services.util.CustomFieldUtilities;
+import org.itracker.services.util.HTMLUtilities;
import org.itracker.web.util.LoginUtilities;
import org.itracker.web.util.ServletContextUtils;
-
public final class FormatCustomFieldTag extends TagSupport {
- /**
+ /**
*
*/
- private static final long serialVersionUID = 1L;
- public static final String DISPLAY_TYPE_EDIT = "edit";
- public static final String DISPLAY_TYPE_VIEW = "view";
-
- private static final Logger logger = Logger.getLogger(FormatCustomFieldTag.class);
-
- private CustomField field;
- private String currentValue;
- private String displayType;
- private String formName;
- private Map<Integer,List<NameValuePair>> listOptions;
-
- public CustomField getField() {
- return field;
- }
-
- public void setField(CustomField value) {
- field = value;
- }
-
- public String getCurrentValue() {
- return currentValue;
- }
-
- public void setCurrentValue(String value) {
- currentValue = value;
- }
-
- public String getDisplayType() {
- return displayType;
- }
-
- public void setDisplayType(String value) {
- displayType = value;
- }
-
- public String getFormName() {
- return formName;
- }
-
- public void setFormName(String value) {
- formName = value;
- }
-
- public Map<Integer, List<NameValuePair>> getListOptions() {
- return (listOptions == null ? new HashMap<Integer, List<NameValuePair>>() : listOptions);
- }
-
- public void setListOptions(Map<Integer, List<NameValuePair>> value) {
- listOptions = value;
- }
-
- public int doStartTag() throws JspException {
- return SKIP_BODY;
- }
- public int doEndTag() throws JspException {
- Locale locale = null;
-
- if(field != null) {
- locale = LoginUtilities.getCurrentLocale((HttpServletRequest)pageContext.getRequest());
-
- StringBuffer buf = new StringBuffer();
- buf.append("<td class=\"" + (DISPLAY_TYPE_VIEW.equalsIgnoreCase(displayType) ? "editColumnTitle" : "editColumnTitle") +"\">");
- buf.append(CustomFieldUtilities.getCustomFieldName(field.getId(), locale) + ": ");
- buf.append("</td>\n");
- buf.append("<td align=\"left\" class=\"editColumnText\">");
- if(DISPLAY_TYPE_VIEW.equalsIgnoreCase(displayType)) {
- if(currentValue != null) {
-// buf.append((field.getFieldType() == CustomField.Type.LIST ? field.getOptionNameByValue(currentValue) : currentValue));
+ private static final long serialVersionUID = 1L;
+ public static final String DISPLAY_TYPE_EDIT = "edit";
+ public static final String DISPLAY_TYPE_VIEW = "view";
- if (field.getFieldType().equals(CustomField.Type.LIST)) {
- buf.append(CustomFieldUtilities.getCustomFieldOptionName(getField(), currentValue, locale));
-
- } else {
- buf.append(currentValue);
- }
- }
- } else {
- // Object requestValue = RequestUtils.lookup(pageContext, org.apache.struts.taglib.html.Constants.BEAN_KEY, "customFields(" + field.getId() + ")", null);
- Object requestValue = TagUtils.getInstance().lookup(pageContext, org.apache.struts.taglib.html.Constants.BEAN_KEY, "customFields(" + field.getId() + ")", null);
- if(currentValue == null && requestValue != null) {
- currentValue = requestValue.toString();
- }
-
- if(field.getFieldType() == CustomField.Type.LIST) {
- List<CustomFieldValue> options = field.getOptions();
-// WorkflowUtilities.getListOptions(getListOptions(), field.getId());
+ private static final Logger logger = Logger
+ .getLogger(FormatCustomFieldTag.class);
- buf.append("<select name=\"customFields(" + field.getId() + ")\" class=\"editColumnText\">\n");
- for(int i = 0; i < options.size(); i++) {
- // TODO: why not work with option-id here? if value contains quotes, problem.
- buf.append("<option value=\"" + options.get(i).getValue() + "\"");
- buf.append((currentValue != null && currentValue.equals(options.get(i).getValue()) ? " selected=\"selected\"" : ""));
- buf.append(" class=\"editColumnText\">");
- buf.append(CustomFieldUtilities.getCustomFieldOptionName(options.get(i), locale));
-// buf.append(options.get(i).getName());
- buf.append("</option>\n");
- }
- buf.append("</select>\n");
- } else if(field.getFieldType() == CustomField.Type.DATE) {
-
+ private CustomField field;
+ private String currentValue;
+ private String displayType;
+ private String formName;
+ private Map<Integer, List<NameValuePair>> listOptions;
- buf.append("<input type=\"text\" name=\"customFields(" + field.getId() +")\"");
- buf.append((currentValue != null && ! currentValue.equals("") ? " value=\"" + currentValue + "\"" : ""));
- buf.append(" class=\"editColumnText\"> ");
- buf.append("<img "toggleDatePicker('cf").append(field.getId()).append("','").append(formName).append(".customFields(").append(field.getId()).append(")')\" ");
- buf.append("id=cf").append(field.getId()).append("Pos name=cf").append(field.getId()).append("Pos width=19 height=19 src=\"");
-// try {
- // buf.append(RequestUtils.computeURL(pageContext, null, null, "/images/calendar.gif", null, null, null, false));
- buf.append(ServletContextUtils.getItrackerServices().getConfigurationService().getSystemBaseURL());
- buf.append("/themes/defaulttheme/images/calendar.gif");
-// buf.append(TagUtils.getInstance().computeURL(pageContext, null, null, "/images/calendar.gif", null, null, null, null, false));
-
-// } catch(MalformedURLException murle) {
-// buf.append("images/calendar.gif");
-// }
- buf.append("\" align=\"top\" border=\"0\">");
- buf.append("<div id=\"cf").append(field.getId()).append("\" style=\"position:absolute;\"></div>");
- } else {
- buf.append("<input type=\"text\" name=\"customFields(").append(field.getId()).append(")\"");
- buf.append((currentValue != null && ! currentValue.equals("") ? " value=\"" + currentValue + "\"" : ""));
- buf.append(" class=\"editColumnText\">");
- }
- }
- buf.append("</td>\n");
-
- //ResponseUtils.write(pageContext, buf.toString());
- TagUtils.getInstance().write(pageContext, buf.toString());
- }
-
- clearState();
- return (EVAL_PAGE);
- }
-
-
+ public CustomField getField() {
+ return field;
+ }
+ public void setField(CustomField value) {
+ field = value;
+ }
+
+ public String getCurrentValue() {
+ return currentValue;
+ }
+
+ public void setCurrentValue(String value) {
+ currentValue = value;
+ }
+
+ public String getDisplayType() {
+ return displayType;
+ }
+
+ public void setDisplayType(String value) {
+ displayType = value;
+ }
+
+ public String getFormName() {
+ return formName;
+ }
+
+ public void setFormName(String value) {
+ formName = value;
+ }
+
+ public Map<Integer, List<NameValuePair>> getListOptions() {
+ return (listOptions == null ? new HashMap<Integer, List<NameValuePair>>()
+ : listOptions);
+ }
+
+ public void setListOptions(Map<Integer, List<NameValuePair>> value) {
+ listOptions = value;
+ }
+
+ public int doStartTag() throws JspException {
+ return SKIP_BODY;
+ }
+
+ public int doEndTag() throws JspException {
+ Locale locale = null;
+
+ if (field != null) {
+ locale = LoginUtilities
+ .getCurrentLocale((HttpServletRequest) pageContext
+ .getRequest());
+
+ StringBuffer buf = new StringBuffer();
+ buf
+ .append("<td class=\""
+ + (DISPLAY_TYPE_VIEW.equalsIgnoreCase(displayType) ? "editColumnTitle"
+ : "editColumnTitle") + "\">");
+ buf.append(CustomFieldUtilities.getCustomFieldName(field.getId(),
+ locale)
+ + ": ");
+ buf.append("</td>\n");
+ buf.append("<td align=\"left\" class=\"editColumnText\">");
+ if (DISPLAY_TYPE_VIEW.equalsIgnoreCase(displayType)) {
+ if (currentValue != null) {
+ // buf.append((field.getFieldType() == CustomField.Type.LIST
+ // ? field.getOptionNameByValue(currentValue) :
+ // currentValue));
+
+ if (field.getFieldType() == CustomField.Type.LIST) {
+ buf.append(CustomFieldUtilities
+ .getCustomFieldOptionName(getField(),
+ currentValue, locale));
+
+ } else {
+
+ buf.append(currentValue);
+ }
+ }
+ } else {
+ // Object requestValue = RequestUtils.lookup(pageContext,
+ // org.apache.struts.taglib.html.Constants.BEAN_KEY,
+ // "customFields(" + field.getId() + ")", null);
+ Object requestValue = TagUtils.getInstance().lookup(
+ pageContext,
+ org.apache.struts.taglib.html.Constants.BEAN_KEY,
+ "customFields(" + field.getId() + ")", null);
+ if (currentValue == null && requestValue != null) {
+ currentValue = requestValue.toString();
+ }
+
+ if (field.getFieldType() == CustomField.Type.LIST) {
+ List<CustomFieldValue> options = field.getOptions();
+ // WorkflowUtilities.getListOptions(getListOptions(),
+ // field.getId());
+
+ buf.append("<select name=\"customFields(").append(
+ field.getId()).append(
+ ")\" class=\"editColumnText\">\n");
+ for (int i = 0; i < options.size(); i++) {
+ // TODO: why not work with option-id here? if value
+ // contains quotes, problem.
+ buf.append("<option value=\"").append(
+ HTMLUtilities.escapeTags(options.get(i)
+ .getValue())).append("\"");
+ if (currentValue != null
+ && currentValue.equals(options.get(i)
+ .getValue())) {
+ buf.append(" selected=\"selected\"");
+ }
+ buf.append(" class=\"editColumnText\">");
+ buf.append(CustomFieldUtilities
+ .getCustomFieldOptionName(options.get(i),
+ locale));
+ // buf.append(options.get(i).getName());
+ buf.append("</option>\n");
+ }
+ buf.append("</select>\n");
+
+
+
+ } else if (field.getFieldType() == CustomField.Type.DATE) {
+ String df = ITrackerResources.getString(
+ "itracker.dateformat.dateonly", locale);
+ if (field.getDateFormat().equals("full")) {
+ df = ITrackerResources.getString(
+ "itracker.dateformat.full", locale);
+ }
+
+ String fieldName = "customFields(" + field.getId() + ")";
+ String cf = "cf" + field.getId();
+ buf.append("<input type=\"text\" name=\"")
+ .append(fieldName).append("\" id=\"")
+ .append(fieldName).append("\"");
+ buf.append((currentValue != null
+ && !currentValue.equals("") ? " value=\""
+ + currentValue + "\"" : ""));
+// buf.append(" "onDateChange(this, " + cf + ")\"");
+ buf.append(" class=\"editColumnText\" /> ");
+ buf.append("<img "toggleCalendar(" + cf + ")\"");
+ buf.append("id=\"").append(cf).append(
+ "Pos\" name=\"").append(cf).append(
+ "Pos\" width=\"19\" height=\"19\" src=\"");
+ buf.append(ServletContextUtils.getItrackerServices()
+ .getConfigurationService().getSystemBaseURL());
+ buf.append("/themes/defaulttheme/images/calendar.gif");
+ buf.append("\" align=\"top\" border=\"0\" />");
+ buf.append("<div class=\"scal tinyscal\" id=\"").append(cf).append(
+ "\"></div>");
+
+ SimpleDateFormat monthDf = new SimpleDateFormat("MMMMM", locale);
+ SimpleDateFormat dayDf = new SimpleDateFormat("E", locale);
+ Calendar cal = new GregorianCalendar(locale);
+ cal.set(Calendar.MONTH, 0);
+ cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
+
+ Date date = null;
+ try {
+ DateFormat df1 = new SimpleDateFormat(df);
+ date = df1.parse(currentValue);
+ } catch (ParseException e) {
+
+ } catch (RuntimeException e) {
+
+ }
+
+ buf.append(" <script type=\"text/javascript\" language=\"javascript\">");
+ buf.append(" /* <![CDATA[*/\n");
+ buf.append("Object.extend(Date.prototype, {");
+ buf.append("monthnames: [\"");
+ for (int i = 0; i < 12; i++) {
+ cal.set(Calendar.MONTH, i);
+ buf.append(monthDf.format(cal.getTime()));
+ if (i == 11) {
+ buf.append("\"]");
+ } else {
+ buf.append("\",\n \"");
+ }
+ }
+ buf.append(",\n");
+ buf.append("daynames: [\"");
+ for (int i = 1; i < 8; i++) {
+ cal.set(Calendar.DAY_OF_WEEK, i);
+ buf.append(dayDf.format(cal.getTime()));
+ if (i == 7) {
+ buf.append("\"]");
+ } else {
+ buf.append("\",\n \"");
+ }
+ }
+ buf.append("});\n");
+
+ buf.append(" var options = Object.extend({\n");
+ buf.append(" titleformat:'mmmm yyyy',\n");
+// buf.append(" updateformat:'mm/dd/yyyy',\n");
+ buf.append(" updateformat:'" + HTMLUtilities.getJSDateFormat(df) + "',\n");
+ buf.append(" dayheadlength:2,\n");
+ buf.append(" weekdaystart:1,\n");
+ buf.append(" tabular: true,\n");
+ buf.append(" closebutton:'x',\n");
+ buf.append(" planner: false,\n");
+// custom expanded option
+ buf.append(" expanded: false\n");
+ buf.append(" });\n");
+// buf.append("\nvar updateyear = function(d){ $('"+ fieldName + "').value = d.format('" + HTMLUtilities.getJSDateFormat(df) + "'); };");
+ buf.append("\nvar " + cf + " = new scal('" + cf + "', '"+ fieldName + "', options);");
+
+ if (null != date) {
+ Calendar cal1 = GregorianCalendar.getInstance();
+ cal1.setTime(date);
+ buf.append("\n " + cf + ".setCurrentDate(new Date(" + cal1.get(Calendar.YEAR) + ", " + cal1.get(Calendar.MONTH) + ", " + cal1.get(Calendar.DAY_OF_MONTH) + "));");
+ }
+
+// buf.append("\n$('" + cf + "').cf=" + cf + ";");
+ buf.append("// ]]>");
+ buf.append("</script>");
+
+// // try {
+// // buf.append(RequestUtils.computeURL(pageContext, null,
+// // null, "/images/calendar.gif", null, null, null, false));
+// buf.append(ServletContextUtils.getItrackerServices()
+// .getConfigurationService().getSystemBaseURL());
+// buf.append("/themes/defaulttheme/images/calendar.gif");
+// // buf.append(TagUtils.getInstance().computeURL(pageContext,
+// // null, null, "/images/calendar.gif", null, null, null,
+// // null, false));
+//
+// // } catch(MalformedURLException murle) {
+// // buf.append("images/calendar.gif");
+// // }
+
+ } else {
+ buf.append("<input type=\"text\" name=\"customFields(")
+ .append(field.getId()).append(")\"");
+ buf.append((currentValue != null
+ && !currentValue.equals("") ? " value=\""
+ + currentValue + "\"" : ""));
+ buf.append(" class=\"editColumnText\">");
+ }
+ }
+ buf.append("</td>\n");
+
+ // ResponseUtils.write(pageContext, buf.toString());
+ TagUtils.getInstance().write(pageContext, buf.toString());
+ }
+
+ clearState();
+ return (EVAL_PAGE);
+ }
+
public void release() {
- super.release();
- clearState();
- }
-
- private void clearState() {
- field = null;
- currentValue = null;
- }
+ super.release();
+ clearState();
+ }
+
+ private void clearState() {
+ field = null;
+ currentValue = null;
+ displayType = null;
+ listOptions = null;
+ formName = null;
+ }
+
+
+ private String formatDate(Date dateValue, ResourceBundle bundle) {
+ // TODO Auto-generated method stub
+
+ try {
+
+ SimpleDateFormat sdf =
+ new SimpleDateFormat(bundle
+ .getString("itracker.dateformat."
+ + field.getDateFormat()), bundle.getLocale());
+
+// if (log.isDebugEnabled()) {
+// log.debug("getValue: dateFormat from itracker configuration "
+// + sdf.toPattern());
+// }
+
+ // sdf = new SimpleDateFormat(dateFormat, locale);
+ String formattedDate = sdf.format(dateValue);
+// if (log.isDebugEnabled()) {
+// log.debug("getValue: formated date " + this.dateValue
+// + " to " + formattedDate);
+// }
+ return formattedDate;
+ } catch (Exception ne) {
+// log.debug("getValue: ", ne);
+// if (dateValue == null) {
+// log.warn("getValue: failed to format date, null for "
+// + customField);
+// }
+ return "";
+ }
+ }
}
Modified: itracker/trunk/src/main/java/org/itracker/web/taglib/FormatDateTag.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/taglib/FormatDateTag.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/java/org/itracker/web/taglib/FormatDateTag.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -22,13 +22,16 @@
import java.util.Date;
import java.util.Locale;
+import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.taglib.TagUtils;
import org.itracker.core.resources.ITrackerResources;
+import org.itracker.services.util.UserUtilities;
import org.itracker.web.util.Constants;
+import org.itracker.web.util.LoginUtilities;
public class FormatDateTag extends TagSupport {
/**
@@ -76,16 +79,13 @@
String value = "";
SimpleDateFormat sdf;
Locale locale = null;
-
- HttpSession session = pageContext.getSession();
- if (session != null) {
- locale = (Locale) session.getAttribute(Constants.LOCALE_KEY);
+ if (pageContext.getRequest() instanceof HttpServletRequest) {
+ locale = LoginUtilities.getCurrentLocale((HttpServletRequest)pageContext.getRequest());
}
-
if (locale == null) {
locale = ITrackerResources.getLocale();
}
-
+
if (date == null) {
value = ITrackerResources.getString(emptyKey, locale);
} else {
Modified: itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp
===================================================================
--- itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp 2009-03-21 20:37:52 UTC (rev 2201)
@@ -187,7 +187,7 @@
<c:when test="${ hasFullEdit }">
<html:select property="severity" styleClass="editColumnText">
<c:forEach items="${ fieldSeverity }" var="severity" varStatus="status">
- <html:option value="${ severity.value }"styleClass="editColumnText">
+ <html:option value="${ severity.value }" styleClass="editColumnText">
${ severity.name }
</html:option>
</c:forEach>
@@ -252,7 +252,7 @@
</td>
<c:if test="${not empty targetVersions}">
- <td valign="top" class="editColumnTitle" style="white-space: nowrap;" nowrap>
+ <td valign="top" class="editColumnTitle" style="white-space: nowrap;">
<it:message key="itracker.web.attr.target"/>: </td>
<td valign="top" class="editColumnText">
Modified: itracker/trunk/src/main/webapp/module-searchissues/search_issues_form.jsp
===================================================================
--- itracker/trunk/src/main/webapp/module-searchissues/search_issues_form.jsp 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/webapp/module-searchissues/search_issues_form.jsp 2009-03-21 20:37:52 UTC (rev 2201)
@@ -306,7 +306,9 @@
}
if(issues.size() == 0) {
%>
- <tr class="listRowUnshaded" align="left"><td colspan="10" align="left"><it:message key="itracker.web.error.noissues"/></td></tr>
+ <tr class="listRowUnshaded" align="left">
+ <td colspan="10" align="left"><it:message key="itracker.web.error.noissues"/>
+ </td></tr>
<% } else { %>
<%-- TODO: fix reports
Modified: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/header.jsp
===================================================================
--- itracker/trunk/src/main/webapp/themes/defaulttheme/includes/header.jsp 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/webapp/themes/defaulttheme/includes/header.jsp 2009-03-21 20:37:52 UTC (rev 2201)
@@ -1,77 +1,92 @@
-<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ page contentType="text/html;charset=UTF-8"%>
-<%@ taglib uri="/tags/itracker" prefix="it" %>
-<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
-<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
-<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
-<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
+<%@ taglib uri="/tags/itracker" prefix="it"%>
+<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
+<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
+<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
+<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html>
- <head>
- <title><it:message key="itracker.web.generic.itracker"/>: <it:message key="${pageTitleKey}" arg0="${pageTitleArg}"/>
- </title>
- <link rel="STYLESHEET" type="text/css" href="${contextPath}/themes/defaulttheme/includes/styles.css" />
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <meta http-equiv="Expires" content="Tue, 01 Jan 1980 1:00:00 GMT"/>
- <meta http-equiv="Pragma" content="no-cache"/>
- <script type="text/javascript" src="${contextPath}/themes/defaulttheme/includes/calendar.js"></script>
+<head>
+<title><it:message key="itracker.web.generic.itracker" />: <it:message
+ key="${pageTitleKey}" arg0="${pageTitleArg}" /></title>
+<link rel="STYLESHEET" type="text/css"
+ href="${contextPath}/themes/defaulttheme/includes/styles.css" />
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<meta http-equiv="Expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
+<meta http-equiv="Pragma" content="no-cache" />
+<!-- script type="text/javascript"
+ src="${contextPath}/themes/defaulttheme/includes/calendar.js"></script -->
- <script type="text/javascript" src="${contextPath}/themes/defaulttheme/includes/scripts.js"></script>
- </head>
+<!-- Include calendar resources -->
+ <script src="${contextPath}/themes/defaulttheme/includes/calendar/javascripts/prototype.js" type="text/javascript"></script>
+ <script src="${contextPath}/themes/defaulttheme/includes/calendar/javascripts/effects.js" type="text/javascript"></script>
+ <script src="${contextPath}/themes/defaulttheme/includes/calendar/javascripts/scal.js" type="text/javascript"></script>
+ <link rel="stylesheet" href="${contextPath}/themes/defaulttheme/includes/calendar/styles/scaltables.css" type="text/css" media="screen"/>
- <body>
-
- <table border="0" cellspacing="1" cellspacing="0" width="100%">
- <tr>
- <td class="headerText">
- <%-- TODO: temp. removed logo code, fix again <% if(alternateLogo != null && ! alternateLogo.equals("")) { %>
+<script type="text/javascript"
+ src="${contextPath}/themes/defaulttheme/includes/scripts.js"></script>
+</head>
+
+<body>
+
+<table border="0" cellspacing="1" cellspacing="0" width="100%">
+ <tr>
+ <td class="headerText"><%-- TODO: temp. removed logo code, fix again <% if(alternateLogo != null && ! alternateLogo.equals("")) { %>
<!-- <img src="<%= alternateLogo %>"> itracker.org<br>
<% } else { %>
<!-- <html:img page="/themes/defaulttheme/images/logo.gif"/> itracker.org<br>
- <% } %> --%>
- </td>
- <td class="headerTextPageTitle"><h1><it:message key="${pageTitleKey}" arg0="${pageTitleArg}"/></h1></td>
- <td class="headerTextWelcome">
- <it:message key="itracker.web.header.welcome"/>
- <c:choose>
- <c:when test="${ currUser != null}">${ currUser.firstName } ${ currUser.lastName } (<em>${ currUser.login }</em>)</c:when>
- <c:otherwise><em><it:message key="itracker.web.header.guest"/></em></c:otherwise>
- </c:choose>
- </td>
- </tr>
- <tr><td colspan="3" class="top_ruler"><hr /></td></tr>
- </table>
- <table border="0" cellspacing="0" cellspacing="0" width="100%">
- <tr>
- <td class="headerLinks" align="left">
- <c:if test="${currUser != null}">
-
- <form name="lookupForm" action="<html:rewrite module="/module-projects" forward="viewissue"/>">
- <input type="text" name="id" size="5" class="lookupBox" >
- </form>
- </c:if>
- </td>
- <td class="headerLinks" align="right">
+ <% } %> --%></td>
+ <td class="headerTextPageTitle">
+ <h1><it:message key="${pageTitleKey}" arg0="${pageTitleArg}" /></h1>
+ </td>
+ <td class="headerTextWelcome"><it:message
+ key="itracker.web.header.welcome" /> <c:choose>
+ <c:when test="${ currUser != null}">${ currUser.firstName } ${ currUser.lastName } (<em>${
+ currUser.login }</em>)</c:when>
+ <c:otherwise>
+ <em><it:message key="itracker.web.header.guest" /></em>
+ </c:otherwise>
+ </c:choose></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="top_ruler">
+ <hr />
+ </td>
+ </tr>
+</table>
+<table border="0" cellspacing="0" cellspacing="0" width="100%">
+ <tr>
+ <td class="headerLinks" align="left"><c:if
+ test="${currUser != null}">
- <c:if test="${currUser != null}">
-
- <html:link styleClass="headerLinks" titleKey="itracker.web.header.menu.home.alt" module="/" action="/portalhome">
- <it:message key="itracker.web.header.menu.home"/></html:link>
+ <form name="lookupForm"
+ action="<html:rewrite module="/module-projects" forward="viewissue"/>">
+ <input type="text" name="id" size="5" class="lookupBox"
+ ></form>
+ </c:if></td>
+ <td class="headerLinks" align="right"><c:if
+ test="${currUser != null}">
+
+ <html:link styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.home.alt" module="/"
+ action="/portalhome">
+ <it:message key="itracker.web.header.menu.home" />
+ </html:link>
- | <html:link
- linkName="listprojects" styleClass="headerLinks"
- titleKey="itracker.web.header.menu.projectlist.alt"
- module="/module-projects" action="/list_projects">
- <it:message key="itracker.web.header.menu.projectlist" />
- </html:link>
+ | <html:link linkName="listprojects" styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.projectlist.alt"
+ module="/module-projects" action="/list_projects">
+ <it:message key="itracker.web.header.menu.projectlist" />
+ </html:link>
| <html:link forward="searchissues" module="/module-searchissues"
- styleClass="headerLinks"
- titleKey="itracker.web.header.menu.search.alt">
- <it:message key="itracker.web.header.menu.search" />
- </html:link>
- <%-- TODO: fix reports-section
+ styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.search.alt">
+ <it:message key="itracker.web.header.menu.search" />
+ </html:link>
+ <%-- TODO: fix reports-section
<c:if
test="<%=UserUtilities.hasPermission(permissions,
UserUtilities.PERMISSION_VIEW_ALL)%>">
@@ -83,57 +98,57 @@
</html:link>
</c:if>
--%>
- <c:if
- test="${hasPermissionUserAdmin}">
+ <c:if test="${hasPermissionUserAdmin}">
|
<html:link styleClass="headerLinks"
- titleKey="itracker.web.header.menu.admin.alt"
- module="/module-admin" action="/adminhome">
- <it:message key="itracker.web.header.menu.admin" />
- </html:link>
- </c:if>
- <c:if
- test="${hasPermissionProductAdmin}">
+ titleKey="itracker.web.header.menu.admin.alt"
+ module="/module-admin" action="/adminhome">
+ <it:message key="itracker.web.header.menu.admin" />
+ </html:link>
+ </c:if>
+ <c:if test="${hasPermissionProductAdmin}">
| <html:link styleClass="headerLinks"
- titleKey="itracker.web.header.menu.projectadmin.alt"
- module="/module-admin" action="/listprojectsadmin">
- <it:message key="itracker.web.header.menu.projectadmin" />
- </html:link>
- </c:if>
+ titleKey="itracker.web.header.menu.projectadmin.alt"
+ module="/module-admin" action="/listprojectsadmin">
+ <it:message key="itracker.web.header.menu.projectadmin" />
+ </html:link>
+ </c:if>
| <html:link module="/module-preferences"
- forward="editpreferences" styleClass="headerLinks"
- titleKey="itracker.web.header.menu.preferences.alt">
- <it:message key="itracker.web.header.menu.preferences" />
- </html:link>
+ forward="editpreferences" styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.preferences.alt">
+ <it:message key="itracker.web.header.menu.preferences" />
+ </html:link>
| <html:link forward="help" styleClass="headerLinks"
- titleKey="itracker.web.header.menu.help.alt" module="/module-help">
- <it:message key="itracker.web.header.menu.help" />
+ titleKey="itracker.web.header.menu.help.alt" module="/module-help">
+ <it:message key="itracker.web.header.menu.help" />
+ </html:link>
+ | <html:link linkName="logoff" action="/logoff"
+ styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.logout.alt" module="/">
+ <it:message key="itracker.web.header.menu.logout" />
+ </html:link>
+ </c:if> <c:if test="${currUser == null}">
+ <%-- <nitrox:var name="allowForgotPassword" type="java.lang.Boolean"/> --%>
+ <c:if test="${allowForgotPassword}">
+
+ <html:link linkName="forgotpassword" forward="forgotpassword"
+ styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.forgotpass.alt">
+ <it:message key="itracker.web.header.menu.forgotpass" />
</html:link>
- | <html:link linkName="logoff" action="/logoff" styleClass="headerLinks"
- titleKey="itracker.web.header.menu.logout.alt" module="/">
- <it:message key="itracker.web.header.menu.logout" />
+ </c:if>
+ <%-- <nitrox:var name="allowSelfRegister" type="java.lang.Boolean"/> --%>
+ <c:if test="${allowSelfRegister}">
+ | <html:link forward="selfregistration"
+ styleClass="headerLinks"
+ titleKey="itracker.web.header.menu.selfreg.alt">
+ <it:message key="itracker.web.header.menu.selfreg" />
</html:link>
- </c:if>
- <c:if test="${currUser == null}">
- <%-- <nitrox:var name="allowForgotPassword" type="java.lang.Boolean"/> --%>
- <c:if test="${allowForgotPassword}">
-
- <html:link linkName="forgotpassword" forward="forgotpassword" styleClass="headerLinks" titleKey="itracker.web.header.menu.forgotpass.alt"> <it:message key="itracker.web.header.menu.forgotpass"/></html:link>
- </c:if>
- <%-- <nitrox:var name="allowSelfRegister" type="java.lang.Boolean"/> --%>
- <c:if test="${allowSelfRegister}">
- | <html:link forward="selfregistration" styleClass="headerLinks" titleKey="itracker.web.header.menu.selfreg.alt">
- <it:message key="itracker.web.header.menu.selfreg"/></html:link>
- </c:if>
- </c:if>
- </td>
- </tr>
- </table>
-
- <p class="pageHeader"><%-- TODO: temp. removed code, fix this: <it:message key="<%= pageTitleKey %>" arg0="<%= pageTitleArg %>"/>--%></p>
-
+ </c:if>
+ </c:if></td>
+ </tr>
+</table>
-
-
\ No newline at end of file
+<p class="pageHeader"><%-- TODO: temp. removed code, fix this: <it:message key="<%= pageTitleKey %>" arg0="<%= pageTitleArg %>"/>--%></p>
\ No newline at end of file
Modified: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/scripts.js
===================================================================
--- itracker/trunk/src/main/webapp/themes/defaulttheme/includes/scripts.js 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/webapp/themes/defaulttheme/includes/scripts.js 2009-03-21 20:37:52 UTC (rev 2201)
@@ -16,4 +16,11 @@
form.elements[i].checked = clicked.checked;
}
}
- }
\ No newline at end of file
+ }
+
+
+ function toggleCalendar(cal) {
+
+ cal.toggleCalendar();
+ }
+
Modified: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/styles.css
===================================================================
--- itracker/trunk/src/main/webapp/themes/defaulttheme/includes/styles.css 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/main/webapp/themes/defaulttheme/includes/styles.css 2009-03-21 20:37:52 UTC (rev 2201)
@@ -321,4 +321,17 @@
.smalltext {
font-family: Verdana, Arial, sans-serif;
font-size: small;
-}
\ No newline at end of file
+}
+
+/**
+Calender Styles
+*********************/
+
+.cal_table {
+ background-color: white;
+ opacity: .8;
+
+}
+.tinyscal {
+ position: absolute;
+}
Modified: itracker/trunk/src/test/java/org/itracker/model/CustomFieldTest.java
===================================================================
--- itracker/trunk/src/test/java/org/itracker/model/CustomFieldTest.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/test/java/org/itracker/model/CustomFieldTest.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -1,4 +1,6 @@
package org.itracker.model;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import java.util.Locale;
import org.itracker.AbstractDependencyInjectionTest;
@@ -42,10 +44,19 @@
} catch (IssueException e){
assertTrue(true);
}
+ //test type is date
cust.setFieldType(CustomField.Type.DATE);
+ cust.setDateFormat(CustomField.DateFormat.DATE.code);
+ SimpleDateFormat sdf =
+ new SimpleDateFormat(ITrackerResources.getBundle(en)
+ .getString("itracker.dateformat."
+ + cust.getDateFormat()), en);
+ final Date date = new Date(100000);
+ final String dateString = sdf.format(date);
+
try{
- cust.checkAssignable("12/25/2008", en, ITrackerResources.getBundle(en));
- cust.checkAssignable("2008-12-25", en, ITrackerResources.getBundle(en));
+ cust.checkAssignable(dateString, en, ITrackerResources.getBundle(en));
+ cust.checkAssignable("abdcd" + dateString, en, ITrackerResources.getBundle(en));
} catch (IssueException e){
assertTrue(true);
}
Modified: itracker/trunk/src/test/java/org/itracker/model/IssueFieldTest.java
===================================================================
--- itracker/trunk/src/test/java/org/itracker/model/IssueFieldTest.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/test/java/org/itracker/model/IssueFieldTest.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -63,9 +63,17 @@
assertEquals("int value 23", "23", iss.getValue(en));
cust.setFieldType(CustomField.Type.DATE);
- Date date = new Date(10000);
+ cust.setDateFormat(CustomField.DateFormat.DATE.code);
+ SimpleDateFormat sdf =
+ new SimpleDateFormat(ITrackerResources.getBundle(en)
+ .getString("itracker.dateformat."
+ + cust.getDateFormat()), en);
+
+ final Date date = new Date(10000);
+ final String dateString = sdf.format(date);
+
iss.setDateValue(date);
- assertEquals("date value","01/01/1970", iss.getValue(en));
+ assertEquals("date value",dateString, iss.getValue(en));
cust.setRequired(false);
iss.setDateValue(null);
@@ -113,42 +121,40 @@
}
//test type is date
- cust.setFieldType(CustomField.Type.DATE);
+ cust.setFieldType(CustomField.Type.DATE);
+ cust.setDateFormat(CustomField.DateFormat.DATE.code);
+ SimpleDateFormat sdf =
+ new SimpleDateFormat(ITrackerResources.getBundle(en)
+ .getString("itracker.dateformat."
+ + cust.getDateFormat()), en);
+
+ final String dateString = sdf.format(new Date(0));
+
try {
- iss.setValue("01/01/1970",ITrackerResources.getBundle(en));
+ iss.setValue(dateString,ITrackerResources.getBundle(en));
} catch (IssueException e) {
fail("throw IssueException" + e);
}
- SimpleDateFormat sdf = CustomField.DEFAULT_DATE_FORMAT;
try {
- assertEquals("date value",sdf.parseObject("01/01/1970"), iss.getDateValue());
+ assertEquals("date value",sdf.parseObject(dateString), iss.getDateValue());
} catch (ParseException e) {
fail("throw ParseException" + e);
}
//test wrong date
try {
- iss.setValue("xxxx01/01/1970",ITrackerResources.getBundle(en));
+ iss.setValue("xxxx" + dateString,ITrackerResources.getBundle(en));
} catch (Exception e) {
assertTrue(true);
}
+
- //test value is null
- try {
- iss.setValue(null,ITrackerResources.getBundle(en));
- assertEquals("", iss.getStringValue());
- assertNull(iss.getDateValue());
- assertEquals(0, iss.getIntValue());
- } catch (IssueException e) {
- fail("throw IssueException" + e);
- }
-
//test value is empty
try {
iss.setValue(null,ITrackerResources.getBundle(en));
assertEquals("", iss.getStringValue());
assertNull(iss.getDateValue());
- assertEquals(0, iss.getIntValue());
+ assertEquals(Integer.valueOf(0), iss.getIntValue());
} catch (IssueException e) {
fail("throw IssueException" + e);
}
Modified: itracker/trunk/src/test/java/org/itracker/persistence/dao/CustomFieldDAOImplTest.java
===================================================================
--- itracker/trunk/src/test/java/org/itracker/persistence/dao/CustomFieldDAOImplTest.java 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/test/java/org/itracker/persistence/dao/CustomFieldDAOImplTest.java 2009-03-21 20:37:52 UTC (rev 2201)
@@ -17,7 +17,7 @@
assertNotNull(customField);
assertEquals(CustomField.Type.STRING, customField.getFieldType());
- assertEquals("mm-dd-yyyy", customField.getDateFormat());
+ assertEquals("dateonly", customField.getDateFormat());
assertEquals(true, customField.isRequired());
assertEquals(true, customField.isSortOptionsByName());
}
@@ -32,7 +32,7 @@
assertEquals(1, customField.getId().intValue());
assertEquals(CustomField.Type.STRING, customField.getFieldType());
- assertEquals("mm-dd-yyyy", customField.getDateFormat());
+ assertEquals("dateonly", customField.getDateFormat());
assertEquals(true, customField.isRequired());
assertEquals(true, customField.isSortOptionsByName());
}
Modified: itracker/trunk/src/test/resources/dataset/customfieldbean_dataset.xml
===================================================================
--- itracker/trunk/src/test/resources/dataset/customfieldbean_dataset.xml 2009-03-21 19:19:58 UTC (rev 2200)
+++ itracker/trunk/src/test/resources/dataset/customfieldbean_dataset.xml 2009-03-21 20:37:52 UTC (rev 2201)
@@ -14,7 +14,7 @@
<value>1</value>
<!-- 1: Text-Type -->
<value>1</value>
- <value>mm-dd-yyyy</value>
+ <value>dateonly</value>
<value>1</value>
<value>1</value>
<value>2008-01-01</value>
@@ -25,7 +25,7 @@
<value>2</value>
<!-- 2: Integer-Type -->
<value>2</value>
- <value>mm-dd-yyyy</value>
+ <value>dateonly</value>
<value>1</value>
<value>1</value>
<value>2008-01-01</value>
@@ -36,7 +36,7 @@
<value>3</value>
<!-- 3: Date-Type -->
<value>3</value>
- <value>mm-dd-yyyy</value>
+ <value>dateonly</value>
<value>1</value>
<value>1</value>
<value>2008-01-01</value>
@@ -47,7 +47,7 @@
<value>4</value>
<!-- 4: List-Type -->
<value>4</value>
- <value>mm-dd-yyyy</value>
+ <value>dateonly</value>
<value>1</value>
<value>0</value>
<value>2008-01-01</value>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-21 19:20:00
|
Revision: 2200
http://itracker.svn.sourceforge.net/itracker/?rev=2200&view=rev
Author: ranks
Date: 2009-03-21 19:19:58 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
increasing to new 3.0.2 snapshot version, increasing mysql connector version
Modified Paths:
--------------
itracker/trunk/pom.xml
Modified: itracker/trunk/pom.xml
===================================================================
--- itracker/trunk/pom.xml 2009-03-21 19:18:29 UTC (rev 2199)
+++ itracker/trunk/pom.xml 2009-03-21 19:19:58 UTC (rev 2200)
@@ -5,7 +5,7 @@
<artifactId>itracker</artifactId>
<packaging>war</packaging>
<name>itracker</name>
- <version>3.0.1</version>
+ <version>3.0.2-SNAPSHOT</version>
<url>" rel="nofollow">http://itracker.sourceforge.net/</url>
<properties>
<clover.maven.charset>UTF-8</clover.maven.charset>
@@ -55,7 +55,7 @@
<id>ranks</id>
<name>Marco Glur</name>
<email>ra...@ro...</email>
- <organization>R.Ø.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
+ <organization>R.√ò.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
<organizationUrl>" rel="nofollow">http://rosa.com/</organizationUrl>
<roles>
<role>Developer</role>
@@ -66,7 +66,7 @@
<id>MarkyGoldstein</id>
<name>Marky Goldstein</name>
<email>re...@ro...</email>
- <organization>R.Ø.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
+ <organization>R.√ò.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
<organizationUrl>http://www.rosa.com</organizationUrl>
<timezone>1</timezone>
<roles>
@@ -369,11 +369,6 @@
<version>1.3.0</version>
</dependency>
<dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.0.3</version>
- </dependency>
- <dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.3.2.1</version>
@@ -429,12 +424,12 @@
<version>1.8.0.7</version>
<scope>test</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>quartz</groupId>
<artifactId>quartz</artifactId>
<version>1.5.2</version>
@@ -456,14 +451,12 @@
<version>1.4</version>
<scope>provided</scope>
</dependency>
-
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
</dependency>
-
- <dependency>
+ <dependency>
<groupId>org.openqa.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>1.0-beta-1</version>
@@ -475,6 +468,17 @@
<version>1.6</version>
<scope>test</scope>
</dependency>
+<!-- <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ <scope>test</scope>
+ </dependency>-->
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>5.1.6</version>
+ </dependency>
</dependencies>
<reporting>
<plugins>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-21 19:18:36
|
Revision: 2199
http://itracker.svn.sourceforge.net/itracker/?rev=2199&view=rev
Author: ranks
Date: 2009-03-21 19:18:29 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
adding new calendar scal for adding localizition in datepicker
Added Paths:
-----------
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blackback.jpg
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blueback.jpg
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blueline.jpg
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/bullet_red.gif
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/close.gif
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/next.gif
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/nexty.gif
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/prev.gif
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/prevy.gif
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blackback.jpg
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blackback.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blueback.jpg
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blueback.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blueline.jpg
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/blueline.jpg
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/bullet_red.gif
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/bullet_red.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/close.gif
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/close.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/next.gif
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/next.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/nexty.gif
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/nexty.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/prev.gif
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/prev.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/prevy.gif
===================================================================
(Binary files differ)
Property changes on: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/prevy.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-21 19:16:00
|
Revision: 2198
http://itracker.svn.sourceforge.net/itracker/?rev=2198&view=rev
Author: ranks
Date: 2009-03-21 19:15:57 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
adding new calendar scal for adding localizition in datepicker
Added Paths:
-----------
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/effects.js
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/prototype.js
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/scal.js
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/scalplanner.js
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/unittest.js
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/images/
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/scal.css
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/scaltables.css
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/stylemain.css
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/styles/test.css
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/effects.js
===================================================================
--- itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/effects.js (rev 0)
+++ itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/effects.js 2009-03-21 19:15:57 UTC (rev 2198)
@@ -0,0 +1,1117 @@
+// script.aculo.us effects.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+// Contributors:
+// Justin Palmer (http://encytemedia.com/)
+// Mark Pilgrim (http://diveintomark.org/)
+// Martin Bialasinki
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+// converts rgb() and #xxx to #xxxxxx format,
+// returns self (or first argument) if not convertable
+String.prototype.parseColor = function() {
+ var color = '#';
+ if (this.slice(0,4) == 'rgb(') {
+ var cols = this.slice(4,this.length-1).split(',');
+ var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
+ } else {
+ if (this.slice(0,1) == '#') {
+ if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
+ if (this.length==7) color = this.toLowerCase();
+ }
+ }
+ return (color.length==7 ? color : (arguments[0] || this));
+};
+
+/*--------------------------------------------------------------------------*/
+
+Element.collectTextNodes = function(element) {
+ return $A($(element).childNodes).collect( function(node) {
+ return (node.nodeType==3 ? node.nodeValue :
+ (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
+ }).flatten().join('');
+};
+
+Element.collectTextNodesIgnoreClass = function(element, className) {
+ return $A($(element).childNodes).collect( function(node) {
+ return (node.nodeType==3 ? node.nodeValue :
+ ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
+ Element.collectTextNodesIgnoreClass(node, className) : ''));
+ }).flatten().join('');
+};
+
+Element.setContentZoom = function(element, percent) {
+ element = $(element);
+ element.setStyle({fontSize: (percent/100) + 'em'});
+ if (Prototype.Browser.WebKit) window.scrollBy(0,0);
+ return element;
+};
+
+Element.getInlineOpacity = function(element){
+ return $(element).style.opacity || '';
+};
+
+Element.forceRerendering = function(element) {
+ try {
+ element = $(element);
+ var n = document.createTextNode(' ');
+ element.appendChild(n);
+ element.removeChild(n);
+ } catch(e) { }
+};
+
+/*--------------------------------------------------------------------------*/
+
+var Effect = {
+ _elementDoesNotExistError: {
+ name: 'ElementDoesNotExistError',
+ message: 'The specified DOM element does not exist, but is required for this effect to operate'
+ },
+ Transitions: {
+ linear: Prototype.K,
+ sinoidal: function(pos) {
+ return (-Math.cos(pos*Math.PI)/2) + 0.5;
+ },
+ reverse: function(pos) {
+ return 1-pos;
+ },
+ flicker: function(pos) {
+ var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
+ return pos > 1 ? 1 : pos;
+ },
+ wobble: function(pos) {
+ return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
+ },
+ pulse: function(pos, pulses) {
+ pulses = pulses || 5;
+ return (
+ ((pos % (1/pulses)) * pulses).round() == 0 ?
+ ((pos * pulses * 2) - (pos * pulses * 2).floor()) :
+ 1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
+ );
+ },
+ spring: function(pos) {
+ return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
+ },
+ none: function(pos) {
+ return 0;
+ },
+ full: function(pos) {
+ return 1;
+ }
+ },
+ DefaultOptions: {
+ duration: 1.0, // seconds
+ fps: 100, // 100= assume 66fps max.
+ sync: false, // true for combining
+ from: 0.0,
+ to: 1.0,
+ delay: 0.0,
+ queue: 'parallel'
+ },
+ tagifyText: function(element) {
+ var tagifyStyle = 'position:relative';
+ if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
+
+ element = $(element);
+ $A(element.childNodes).each( function(child) {
+ if (child.nodeType==3) {
+ child.nodeValue.toArray().each( function(character) {
+ element.insertBefore(
+ new Element('span', {style: tagifyStyle}).update(
+ character == ' ' ? String.fromCharCode(160) : character),
+ child);
+ });
+ Element.remove(child);
+ }
+ });
+ },
+ multiple: function(element, effect) {
+ var elements;
+ if (((typeof element == 'object') ||
+ Object.isFunction(element)) &&
+ (element.length))
+ elements = element;
+ else
+ elements = $(element).childNodes;
+
+ var options = Object.extend({
+ speed: 0.1,
+ delay: 0.0
+ }, arguments[2] || { });
+ var masterDelay = options.delay;
+
+ $A(elements).each( function(element, index) {
+ new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
+ });
+ },
+ PAIRS: {
+ 'slide': ['SlideDown','SlideUp'],
+ 'blind': ['BlindDown','BlindUp'],
+ 'appear': ['Appear','Fade']
+ },
+ toggle: function(element, effect) {
+ element = $(element);
+ effect = (effect || 'appear').toLowerCase();
+ var options = Object.extend({
+ queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
+ }, arguments[2] || { });
+ Effect[element.visible() ?
+ Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
+ }
+};
+
+Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
+
+/* ------------- core effects ------------- */
+
+Effect.ScopedQueue = Class.create(Enumerable, {
+ initialize: function() {
+ this.effects = [];
+ this.interval = null;
+ },
+ _each: function(iterator) {
+ this.effects._each(iterator);
+ },
+ add: function(effect) {
+ var timestamp = new Date().getTime();
+
+ var position = Object.isString(effect.options.queue) ?
+ effect.options.queue : effect.options.queue.position;
+
+ switch(position) {
+ case 'front':
+ // move unstarted effects after this effect
+ this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
+ e.startOn += effect.finishOn;
+ e.finishOn += effect.finishOn;
+ });
+ break;
+ case 'with-last':
+ timestamp = this.effects.pluck('startOn').max() || timestamp;
+ break;
+ case 'end':
+ // start effect after last queued effect has finished
+ timestamp = this.effects.pluck('finishOn').max() || timestamp;
+ break;
+ }
+
+ effect.startOn += timestamp;
+ effect.finishOn += timestamp;
+
+ if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
+ this.effects.push(effect);
+
+ if (!this.interval)
+ this.interval = setInterval(this.loop.bind(this), 15);
+ },
+ remove: function(effect) {
+ this.effects = this.effects.reject(function(e) { return e==effect });
+ if (this.effects.length == 0) {
+ clearInterval(this.interval);
+ this.interval = null;
+ }
+ },
+ loop: function() {
+ var timePos = new Date().getTime();
+ for(var i=0, len=this.effects.length;i<len;i++)
+ this.effects[i] && this.effects[i].loop(timePos);
+ }
+});
+
+Effect.Queues = {
+ instances: $H(),
+ get: function(queueName) {
+ if (!Object.isString(queueName)) return queueName;
+
+ if (!this.instances[queueName])
+ this.instances[queueName] = new Effect.ScopedQueue();
+
+ return this.instances[queueName];
+ }
+};
+Effect.Queue = Effect.Queues.get('global');
+
+Effect.Base = Class.create();
+Effect.Base.prototype = {
+ position: null,
+ start: function(options) {
+ function codeForEvent(options,eventName){
+ return (
+ (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
+ (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
+ );
+ }
+ if (options && options.transition === false) options.transition = Effect.Transitions.linear;
+ this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
+ this.currentFrame = 0;
+ this.state = 'idle';
+ this.startOn = this.options.delay*1000;
+ this.finishOn = this.startOn+(this.options.duration*1000);
+ this.fromToDelta = this.options.to-this.options.from;
+ this.totalTime = this.finishOn-this.startOn;
+ this.totalFrames = this.options.fps*this.options.duration;
+
+ eval('this.render = function(pos){ '+
+ 'if (this.state=="idle"){this.state="running";'+
+ codeForEvent(this.options,'beforeSetup')+
+ (this.setup ? 'this.setup();':'')+
+ codeForEvent(this.options,'afterSetup')+
+ '};if (this.state=="running"){'+
+ 'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
+ 'this.position=pos;'+
+ codeForEvent(this.options,'beforeUpdate')+
+ (this.update ? 'this.update(pos);':'')+
+ codeForEvent(this.options,'afterUpdate')+
+ '}}');
+
+ this.event('beforeStart');
+ if (!this.options.sync)
+ Effect.Queues.get(Object.isString(this.options.queue) ?
+ 'global' : this.options.queue.scope).add(this);
+ },
+ loop: function(timePos) {
+ if (timePos >= this.startOn) {
+ if (timePos >= this.finishOn) {
+ this.render(1.0);
+ this.cancel();
+ this.event('beforeFinish');
+ if (this.finish) this.finish();
+ this.event('afterFinish');
+ return;
+ }
+ var pos = (timePos - this.startOn) / this.totalTime,
+ frame = (pos * this.totalFrames).round();
+ if (frame > this.currentFrame) {
+ this.render(pos);
+ this.currentFrame = frame;
+ }
+ }
+ },
+ cancel: function() {
+ if (!this.options.sync)
+ Effect.Queues.get(Object.isString(this.options.queue) ?
+ 'global' : this.options.queue.scope).remove(this);
+ this.state = 'finished';
+ },
+ event: function(eventName) {
+ if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
+ if (this.options[eventName]) this.options[eventName](this);
+ },
+ inspect: function() {
+ var data = $H();
+ for(property in this)
+ if (!Object.isFunction(this[property])) data[property] = this[property];
+ return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
+ }
+};
+
+Effect.Parallel = Class.create(Effect.Base, {
+ initialize: function(effects) {
+ this.effects = effects || [];
+ this.start(arguments[1]);
+ },
+ update: function(position) {
+ this.effects.invoke('render', position);
+ },
+ finish: function(position) {
+ this.effects.each( function(effect) {
+ effect.render(1.0);
+ effect.cancel();
+ effect.event('beforeFinish');
+ if (effect.finish) effect.finish(position);
+ effect.event('afterFinish');
+ });
+ }
+});
+
+Effect.Tween = Class.create(Effect.Base, {
+ initialize: function(object, from, to) {
+ object = Object.isString(object) ? $(object) : object;
+ var args = $A(arguments), method = args.last(),
+ options = args.length == 5 ? args[3] : null;
+ this.method = Object.isFunction(method) ? method.bind(object) :
+ Object.isFunction(object[method]) ? object[method].bind(object) :
+ function(value) { object[method] = value };
+ this.start(Object.extend({ from: from, to: to }, options || { }));
+ },
+ update: function(position) {
+ this.method(position);
+ }
+});
+
+Effect.Event = Class.create(Effect.Base, {
+ initialize: function() {
+ this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
+ },
+ update: Prototype.emptyFunction
+});
+
+Effect.Opacity = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ // make this work on IE on elements without 'layout'
+ if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+ this.element.setStyle({zoom: 1});
+ var options = Object.extend({
+ from: this.element.getOpacity() || 0.0,
+ to: 1.0
+ }, arguments[1] || { });
+ this.start(options);
+ },
+ update: function(position) {
+ this.element.setOpacity(position);
+ }
+});
+
+Effect.Move = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ x: 0,
+ y: 0,
+ mode: 'relative'
+ }, arguments[1] || { });
+ this.start(options);
+ },
+ setup: function() {
+ this.element.makePositioned();
+ this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
+ this.originalTop = parseFloat(this.element.getStyle('top') || '0');
+ if (this.options.mode == 'absolute') {
+ this.options.x = this.options.x - this.originalLeft;
+ this.options.y = this.options.y - this.originalTop;
+ }
+ },
+ update: function(position) {
+ this.element.setStyle({
+ left: (this.options.x * position + this.originalLeft).round() + 'px',
+ top: (this.options.y * position + this.originalTop).round() + 'px'
+ });
+ }
+});
+
+// for backwards compatibility
+Effect.MoveBy = function(element, toTop, toLeft) {
+ return new Effect.Move(element,
+ Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
+};
+
+Effect.Scale = Class.create(Effect.Base, {
+ initialize: function(element, percent) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ scaleX: true,
+ scaleY: true,
+ scaleContent: true,
+ scaleFromCenter: false,
+ scaleMode: 'box', // 'box' or 'contents' or { } with provided values
+ scaleFrom: 100.0,
+ scaleTo: percent
+ }, arguments[2] || { });
+ this.start(options);
+ },
+ setup: function() {
+ this.restoreAfterFinish = this.options.restoreAfterFinish || false;
+ this.elementPositioning = this.element.getStyle('position');
+
+ this.originalStyle = { };
+ ['top','left','width','height','fontSize'].each( function(k) {
+ this.originalStyle[k] = this.element.style[k];
+ }.bind(this));
+
+ this.originalTop = this.element.offsetTop;
+ this.originalLeft = this.element.offsetLeft;
+
+ var fontSize = this.element.getStyle('font-size') || '100%';
+ ['em','px','%','pt'].each( function(fontSizeType) {
+ if (fontSize.indexOf(fontSizeType)>0) {
+ this.fontSize = parseFloat(fontSize);
+ this.fontSizeType = fontSizeType;
+ }
+ }.bind(this));
+
+ this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
+
+ this.dims = null;
+ if (this.options.scaleMode=='box')
+ this.dims = [this.element.offsetHeight, this.element.offsetWidth];
+ if (/^content/.test(this.options.scaleMode))
+ this.dims = [this.element.scrollHeight, this.element.scrollWidth];
+ if (!this.dims)
+ this.dims = [this.options.scaleMode.originalHeight,
+ this.options.scaleMode.originalWidth];
+ },
+ update: function(position) {
+ var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
+ if (this.options.scaleContent && this.fontSize)
+ this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
+ this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
+ },
+ finish: function(position) {
+ if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
+ },
+ setDimensions: function(height, width) {
+ var d = { };
+ if (this.options.scaleX) d.width = width.round() + 'px';
+ if (this.options.scaleY) d.height = height.round() + 'px';
+ if (this.options.scaleFromCenter) {
+ var topd = (height - this.dims[0])/2;
+ var leftd = (width - this.dims[1])/2;
+ if (this.elementPositioning == 'absolute') {
+ if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
+ if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
+ } else {
+ if (this.options.scaleY) d.top = -topd + 'px';
+ if (this.options.scaleX) d.left = -leftd + 'px';
+ }
+ }
+ this.element.setStyle(d);
+ }
+});
+
+Effect.Highlight = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
+ this.start(options);
+ },
+ setup: function() {
+ // Prevent executing on elements not in the layout flow
+ if (this.element.getStyle('display')=='none') { this.cancel(); return; }
+ // Disable background image during the effect
+ this.oldStyle = { };
+ if (!this.options.keepBackgroundImage) {
+ this.oldStyle.backgroundImage = this.element.getStyle('background-image');
+ this.element.setStyle({backgroundImage: 'none'});
+ }
+ if (!this.options.endcolor)
+ this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
+ if (!this.options.restorecolor)
+ this.options.restorecolor = this.element.getStyle('background-color');
+ // init color calculations
+ this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
+ this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
+ },
+ update: function(position) {
+ this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
+ return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
+ },
+ finish: function() {
+ this.element.setStyle(Object.extend(this.oldStyle, {
+ backgroundColor: this.options.restorecolor
+ }));
+ }
+});
+
+Effect.ScrollTo = function(element) {
+ var options = arguments[1] || { },
+ scrollOffsets = document.viewport.getScrollOffsets(),
+ elementOffsets = $(element).cumulativeOffset(),
+ max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
+
+ if (options.offset) elementOffsets[1] += options.offset;
+
+ return new Effect.Tween(null,
+ scrollOffsets.top,
+ elementOffsets[1] > max ? max : elementOffsets[1],
+ options,
+ function(p){ scrollTo(scrollOffsets.left, p.round()) }
+ );
+};
+
+/* ------------- combination effects ------------- */
+
+Effect.Fade = function(element) {
+ element = $(element);
+ var oldOpacity = element.getInlineOpacity();
+ var options = Object.extend({
+ from: element.getOpacity() || 1.0,
+ to: 0.0,
+ afterFinishInternal: function(effect) {
+ if (effect.options.to!=0) return;
+ effect.element.hide().setStyle({opacity: oldOpacity});
+ }
+ }, arguments[1] || { });
+ return new Effect.Opacity(element,options);
+};
+
+Effect.Appear = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
+ to: 1.0,
+ // force Safari to render floated elements properly
+ afterFinishInternal: function(effect) {
+ effect.element.forceRerendering();
+ },
+ beforeSetup: function(effect) {
+ effect.element.setOpacity(effect.options.from).show();
+ }}, arguments[1] || { });
+ return new Effect.Opacity(element,options);
+};
+
+Effect.Puff = function(element) {
+ element = $(element);
+ var oldStyle = {
+ opacity: element.getInlineOpacity(),
+ position: element.getStyle('position'),
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height
+ };
+ return new Effect.Parallel(
+ [ new Effect.Scale(element, 200,
+ { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
+ Object.extend({ duration: 1.0,
+ beforeSetupInternal: function(effect) {
+ Position.absolutize(effect.effects[0].element)
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().setStyle(oldStyle); }
+ }, arguments[1] || { })
+ );
+};
+
+Effect.BlindUp = function(element) {
+ element = $(element);
+ element.makeClipping();
+ return new Effect.Scale(element, 0,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
+ restoreAfterFinish: true,
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping();
+ }
+ }, arguments[1] || { })
+ );
+};
+
+Effect.BlindDown = function(element) {
+ element = $(element);
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: 0,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.undoClipping();
+ }
+ }, arguments[1] || { }));
+};
+
+Effect.SwitchOff = function(element) {
+ element = $(element);
+ var oldOpacity = element.getInlineOpacity();
+ return new Effect.Appear(element, Object.extend({
+ duration: 0.4,
+ from: 0,
+ transition: Effect.Transitions.flicker,
+ afterFinishInternal: function(effect) {
+ new Effect.Scale(effect.element, 1, {
+ duration: 0.3, scaleFromCenter: true,
+ scaleX: false, scaleContent: false, restoreAfterFinish: true,
+ beforeSetup: function(effect) {
+ effect.element.makePositioned().makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
+ }
+ })
+ }
+ }, arguments[1] || { }));
+};
+
+Effect.DropOut = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.getStyle('top'),
+ left: element.getStyle('left'),
+ opacity: element.getInlineOpacity() };
+ return new Effect.Parallel(
+ [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
+ new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
+ Object.extend(
+ { duration: 0.5,
+ beforeSetup: function(effect) {
+ effect.effects[0].element.makePositioned();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
+ }
+ }, arguments[1] || { }));
+};
+
+Effect.Shake = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.getStyle('top'),
+ left: element.getStyle('left') };
+ return new Effect.Move(element,
+ { x: 20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: 40, y: 0, duration: 0.1, afterFinishInternal: function(effect) {
+ new Effect.Move(effect.element,
+ { x: -20, y: 0, duration: 0.05, afterFinishInternal: function(effect) {
+ effect.element.undoPositioned().setStyle(oldStyle);
+ }}) }}) }}) }}) }}) }});
+};
+
+Effect.SlideDown = function(element) {
+ element = $(element).cleanWhitespace();
+ // SlideDown need to have the content of the element wrapped in a container element with fixed height!
+ var oldInnerBottom = element.down().getStyle('bottom');
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, 100, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ scaleFrom: window.opera ? 0 : 1,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makePositioned();
+ effect.element.down().makePositioned();
+ if (window.opera) effect.element.setStyle({top: ''});
+ effect.element.makeClipping().setStyle({height: '0px'}).show();
+ },
+ afterUpdateInternal: function(effect) {
+ effect.element.down().setStyle({bottom:
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.undoClipping().undoPositioned();
+ effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
+ }, arguments[1] || { })
+ );
+};
+
+Effect.SlideUp = function(element) {
+ element = $(element).cleanWhitespace();
+ var oldInnerBottom = element.down().getStyle('bottom');
+ var elementDimensions = element.getDimensions();
+ return new Effect.Scale(element, window.opera ? 0 : 1,
+ Object.extend({ scaleContent: false,
+ scaleX: false,
+ scaleMode: 'box',
+ scaleFrom: 100,
+ scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
+ restoreAfterFinish: true,
+ afterSetup: function(effect) {
+ effect.element.makePositioned();
+ effect.element.down().makePositioned();
+ if (window.opera) effect.element.setStyle({top: ''});
+ effect.element.makeClipping().show();
+ },
+ afterUpdateInternal: function(effect) {
+ effect.element.down().setStyle({bottom:
+ (effect.dims[0] - effect.element.clientHeight) + 'px' });
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().undoPositioned();
+ effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
+ }
+ }, arguments[1] || { })
+ );
+};
+
+// Bug in opera makes the TD containing this element expand for a instance after finish
+Effect.Squish = function(element) {
+ return new Effect.Scale(element, window.opera ? 1 : 0, {
+ restoreAfterFinish: true,
+ beforeSetup: function(effect) {
+ effect.element.makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping();
+ }
+ });
+};
+
+Effect.Grow = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ direction: 'center',
+ moveTransition: Effect.Transitions.sinoidal,
+ scaleTransition: Effect.Transitions.sinoidal,
+ opacityTransition: Effect.Transitions.full
+ }, arguments[1] || { });
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: element.getInlineOpacity() };
+
+ var dims = element.getDimensions();
+ var initialMoveX, initialMoveY;
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ initialMoveX = initialMoveY = moveX = moveY = 0;
+ break;
+ case 'top-right':
+ initialMoveX = dims.width;
+ initialMoveY = moveY = 0;
+ moveX = -dims.width;
+ break;
+ case 'bottom-left':
+ initialMoveX = moveX = 0;
+ initialMoveY = dims.height;
+ moveY = -dims.height;
+ break;
+ case 'bottom-right':
+ initialMoveX = dims.width;
+ initialMoveY = dims.height;
+ moveX = -dims.width;
+ moveY = -dims.height;
+ break;
+ case 'center':
+ initialMoveX = dims.width / 2;
+ initialMoveY = dims.height / 2;
+ moveX = -dims.width / 2;
+ moveY = -dims.height / 2;
+ break;
+ }
+
+ return new Effect.Move(element, {
+ x: initialMoveX,
+ y: initialMoveY,
+ duration: 0.01,
+ beforeSetup: function(effect) {
+ effect.element.hide().makeClipping().makePositioned();
+ },
+ afterFinishInternal: function(effect) {
+ new Effect.Parallel(
+ [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
+ new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
+ new Effect.Scale(effect.element, 100, {
+ scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
+ sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
+ ], Object.extend({
+ beforeSetup: function(effect) {
+ effect.effects[0].element.setStyle({height: '0px'}).show();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
+ }
+ }, options)
+ )
+ }
+ });
+};
+
+Effect.Shrink = function(element) {
+ element = $(element);
+ var options = Object.extend({
+ direction: 'center',
+ moveTransition: Effect.Transitions.sinoidal,
+ scaleTransition: Effect.Transitions.sinoidal,
+ opacityTransition: Effect.Transitions.none
+ }, arguments[1] || { });
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ height: element.style.height,
+ width: element.style.width,
+ opacity: element.getInlineOpacity() };
+
+ var dims = element.getDimensions();
+ var moveX, moveY;
+
+ switch (options.direction) {
+ case 'top-left':
+ moveX = moveY = 0;
+ break;
+ case 'top-right':
+ moveX = dims.width;
+ moveY = 0;
+ break;
+ case 'bottom-left':
+ moveX = 0;
+ moveY = dims.height;
+ break;
+ case 'bottom-right':
+ moveX = dims.width;
+ moveY = dims.height;
+ break;
+ case 'center':
+ moveX = dims.width / 2;
+ moveY = dims.height / 2;
+ break;
+ }
+
+ return new Effect.Parallel(
+ [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
+ new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
+ new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
+ ], Object.extend({
+ beforeStartInternal: function(effect) {
+ effect.effects[0].element.makePositioned().makeClipping();
+ },
+ afterFinishInternal: function(effect) {
+ effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
+ }, options)
+ );
+};
+
+Effect.Pulsate = function(element) {
+ element = $(element);
+ var options = arguments[1] || { };
+ var oldOpacity = element.getInlineOpacity();
+ var transition = options.transition || Effect.Transitions.sinoidal;
+ var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
+ reverser.bind(transition);
+ return new Effect.Opacity(element,
+ Object.extend(Object.extend({ duration: 2.0, from: 0,
+ afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
+ }, options), {transition: reverser}));
+};
+
+Effect.Fold = function(element) {
+ element = $(element);
+ var oldStyle = {
+ top: element.style.top,
+ left: element.style.left,
+ width: element.style.width,
+ height: element.style.height };
+ element.makeClipping();
+ return new Effect.Scale(element, 5, Object.extend({
+ scaleContent: false,
+ scaleX: false,
+ afterFinishInternal: function(effect) {
+ new Effect.Scale(element, 1, {
+ scaleContent: false,
+ scaleY: false,
+ afterFinishInternal: function(effect) {
+ effect.element.hide().undoClipping().setStyle(oldStyle);
+ } });
+ }}, arguments[1] || { }));
+};
+
+Effect.Morph = Class.create(Effect.Base, {
+ initialize: function(element) {
+ this.element = $(element);
+ if (!this.element) throw(Effect._elementDoesNotExistError);
+ var options = Object.extend({
+ style: { }
+ }, arguments[1] || { });
+
+ if (!Object.isString(options.style)) this.style = $H(options.style);
+ else {
+ if (options.style.include(':'))
+ this.style = options.style.parseStyle();
+ else {
+ this.element.addClassName(options.style);
+ this.style = $H(this.element.getStyles());
+ this.element.removeClassName(options.style);
+ var css = this.element.getStyles();
+ this.style = this.style.reject(function(style) {
+ return style.value == css[style.key];
+ });
+ options.afterFinishInternal = function(effect) {
+ effect.element.addClassName(effect.options.style);
+ effect.transforms.each(function(transform) {
+ effect.element.style[transform.style] = '';
+ });
+ }
+ }
+ }
+ this.start(options);
+ },
+
+ setup: function(){
+ function parseColor(color){
+ if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
+ color = color.parseColor();
+ return $R(0,2).map(function(i){
+ return parseInt( color.slice(i*2+1,i*2+3), 16 )
+ });
+ }
+ this.transforms = this.style.map(function(pair){
+ var property = pair[0], value = pair[1], unit = null;
+
+ if (value.parseColor('#zzzzzz') != '#zzzzzz') {
+ value = value.parseColor();
+ unit = 'color';
+ } else if (property == 'opacity') {
+ value = parseFloat(value);
+ if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
+ this.element.setStyle({zoom: 1});
+ } else if (Element.CSS_LENGTH.test(value)) {
+ var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
+ value = parseFloat(components[1]);
+ unit = (components.length == 3) ? components[2] : null;
+ }
+
+ var originalValue = this.element.getStyle(property);
+ return {
+ style: property.camelize(),
+ originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
+ targetValue: unit=='color' ? parseColor(value) : value,
+ unit: unit
+ };
+ }.bind(this)).reject(function(transform){
+ return (
+ (transform.originalValue == transform.targetValue) ||
+ (
+ transform.unit != 'color' &&
+ (isNaN(transform.originalValue) || isNaN(transform.targetValue))
+ )
+ )
+ });
+ },
+ update: function(position) {
+ var style = { }, transform, i = this.transforms.length;
+ while(i--)
+ style[(transform = this.transforms[i]).style] =
+ transform.unit=='color' ? '#'+
+ (Math.round(transform.originalValue[0]+
+ (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
+ (Math.round(transform.originalValue[1]+
+ (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
+ (Math.round(transform.originalValue[2]+
+ (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
+ (transform.originalValue +
+ (transform.targetValue - transform.originalValue) * position).toFixed(3) +
+ (transform.unit === null ? '' : transform.unit);
+ this.element.setStyle(style, true);
+ }
+});
+
+Effect.Transform = Class.create({
+ initialize: function(tracks){
+ this.tracks = [];
+ this.options = arguments[1] || { };
+ this.addTracks(tracks);
+ },
+ addTracks: function(tracks){
+ tracks.each(function(track){
+ var data = $H(track).values().first();
+ this.tracks.push($H({
+ ids: $H(track).keys().first(),
+ effect: Effect.Morph,
+ options: { style: data }
+ }));
+ }.bind(this));
+ return this;
+ },
+ play: function(){
+ return new Effect.Parallel(
+ this.tracks.map(function(track){
+ var elements = [$(track.ids) || $$(track.ids)].flatten();
+ return elements.map(function(e){ return new track.effect(e, Object.extend({ sync:true }, track.options)) });
+ }).flatten(),
+ this.options
+ );
+ }
+});
+
+Element.CSS_PROPERTIES = $w(
+ 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
+ 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
+ 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
+ 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
+ 'fontSize fontWeight height left letterSpacing lineHeight ' +
+ 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
+ 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
+ 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
+ 'right textIndent top width wordSpacing zIndex');
+
+Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
+
+String.__parseStyleElement = document.createElement('div');
+String.prototype.parseStyle = function(){
+ var style, styleRules = $H();
+ if (Prototype.Browser.WebKit)
+ style = new Element('div',{style:this}).style;
+ else {
+ String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
+ style = String.__parseStyleElement.childNodes[0].style;
+ }
+
+ Element.CSS_PROPERTIES.each(function(property){
+ if (style[property]) styleRules[property] = style[property];
+ });
+
+ if (Prototype.Browser.IE && this.include('opacity'))
+ styleRules.opacity = this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1];
+
+ return styleRules;
+};
+
+if (document.defaultView && document.defaultView.getComputedStyle) {
+ Element.getStyles = function(element) {
+ var css = document.defaultView.getComputedStyle($(element), null);
+ return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
+ styles[property] = css[property];
+ return styles;
+ });
+ };
+} else {
+ Element.getStyles = function(element) {
+ element = $(element);
+ var css = element.currentStyle, styles;
+ styles = Element.CSS_PROPERTIES.inject({ }, function(hash, property) {
+ hash[property] = css[property];
+ return hash;
+ });
+ if (!styles.opacity) styles.opacity = element.getOpacity();
+ return styles;
+ };
+};
+
+Effect.Methods = {
+ morph: function(element, style) {
+ element = $(element);
+ new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
+ return element;
+ },
+ visualEffect: function(element, effect, options) {
+ element = $(element)
+ var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
+ new Effect[klass](element, options);
+ return element;
+ },
+ highlight: function(element, options) {
+ element = $(element);
+ new Effect.Highlight(element, options);
+ return element;
+ }
+};
+
+$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
+ 'pulsate shake puff squish switchOff dropOut').each(
+ function(effect) {
+ Effect.Methods[effect] = function(element, options){
+ element = $(element);
+ Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
+ return element;
+ }
+ }
+);
+
+$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
+ function(f) { Effect.Methods[f] = Element[f]; }
+);
+
+Element.addMethods(Effect.Methods);
\ No newline at end of file
Added: itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/prototype.js
===================================================================
--- itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/prototype.js (rev 0)
+++ itracker/trunk/src/main/webapp/themes/defaulttheme/includes/calendar/javascripts/prototype.js 2009-03-21 19:15:57 UTC (rev 2198)
@@ -0,0 +1,4184 @@
+/* Prototype JavaScript framework, version 1.6.0
+ * (c) 2005-2007 Sam Stephenson
+ *
+ * Prototype is freely distributable under the terms of an MIT-style license.
+ * For details, see the Prototype web site: http://www.prototypejs.org/
+ *
+ *--------------------------------------------------------------------------*/
+
+var Prototype = {
+ Version: '1.6.0',
+
+ Browser: {
+ IE: !!(window.attachEvent && !window.opera),
+ Opera: !!window.opera,
+ WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
+ Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1,
+ MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
+ },
+
+ BrowserFeatures: {
+ XPath: !!document.evaluate,
+ ElementExtensions: !!window.HTMLElement,
+ SpecificElementExtensions:
+ document.createElement('div').__proto__ &&
+ document.createElement('div').__proto__ !==
+ document.createElement('form').__proto__
+ },
+
+ ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
+ JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
+
+ emptyFunction: function() { },
+ K: function(x) { return x }
+};
+
+if (Prototype.Browser.MobileSafari)
+ Prototype.BrowserFeatures.SpecificElementExtensions = false;
+
+if (Prototype.Browser.WebKit)
+ Prototype.BrowserFeatures.XPath = false;
+
+/* Based on Alex Arnell's inheritance implementation. */
+var Class = {
+ create: function() {
+ var parent = null, properties = $A(arguments);
+ if (Object.isFunction(properties[0]))
+ parent = properties.shift();
+
+ function klass() {
+ this.initialize.apply(this, arguments);
+ }
+
+ Object.extend(klass, Class.Methods);
+ klass.superclass = parent;
+ klass.subclasses = [];
+
+ if (parent) {
+ var subclass = function() { };
+ subclass.prototype = parent.prototype;
+ klass.prototype = new subclass;
+ parent.subclasses.push(klass);
+ }
+
+ for (var i = 0; i < properties.length; i++)
+ klass.addMethods(properties[i]);
+
+ if (!klass.prototype.initialize)
+ klass.prototype.initialize = Prototype.emptyFunction;
+
+ klass.prototype.constructor = klass;
+
+ return klass;
+ }
+};
+
+Class.Methods = {
+ addMethods: function(source) {
+ var ancestor = this.superclass && this.superclass.prototype;
+ var properties = Object.keys(source);
+
+ if (!Object.keys({ toString: true }).length)
+ properties.push("toString", "valueOf");
+
+ for (var i = 0, length = properties.length; i < length; i++) {
+ var property = properties[i], value = source[property];
+ if (ancestor && Object.isFunction(value) &&
+ value.argumentNames().first() == "$super") {
+ var method = value, value = Object.extend((function(m) {
+ return function() { return ancestor[m].apply(this, arguments) };
+ })(property).wrap(method), {
+ valueOf: function() { return method },
+ toString: function() { return method.toString() }
+ });
+ }
+ this.prototype[property] = value;
+ }
+
+ return this;
+ }
+};
+
+var Abstract = { };
+
+Object.extend = function(destination, source) {
+ for (var property in source)
+ destination[property] = source[property];
+ return destination;
+};
+
+Object.extend(Object, {
+ inspect: function(object) {
+ try {
+ if (object === undefined) return 'undefined';
+ if (object === null) return 'null';
+ return object.inspect ? object.inspect() : object.toString();
+ } catch (e) {
+ if (e instanceof RangeError) return '...';
+ throw e;
+ }
+ },
+
+ toJSON: function(object) {
+ var type = typeof object;
+ switch (type) {
+ case 'undefined':
+ case 'function':
+ case 'unknown': return;
+ case 'boolean': return object.toString();
+ }
+
+ if (object === null) return 'null';
+ if (object.toJSON) return object.toJSON();
+ if (Object.isElement(object)) return;
+
+ var results = [];
+ for (var property in object) {
+ var value = Object.toJSON(object[property]);
+ if (value !== undefined)
+ results.push(property.toJSON() + ': ' + value);
+ }
+
+ return '{' + results.join(', ') + '}';
+ },
+
+ toQueryString: function(object) {
+ return $H(object).toQueryString();
+ },
+
+ toHTML: function(object) {
+ return object && object.toHTML ? object.toHTML() : String.interpret(object);
+ },
+
+ keys: function(object) {
+ var keys = [];
+ for (var property in object)
+ keys.push(property);
+ return keys;
+ },
+
+ values: function(object) {
+ var values = [];
+ for (var property in object)
+ values.push(object[property]);
+ return values;
+ },
+
+ clone: function(object) {
+ return Object.extend({ }, object);
+ },
+
+ isElement: function(object) {
+ return object && object.nodeType == 1;
+ },
+
+ isArray: function(object) {
+ return object && object.constructor === Array;
+ },
+
+ isHash: function(object) {
+ return object instanceof Hash;
+ },
+
+ isFunction: function(object) {
+ return typeof object == "function";
+ },
+
+ isString: function(object) {
+ return typeof object == "string";
+ },
+
+ isNumber: function(object) {
+ return typeof object == "number";
+ },
+
+ isUndefined: function(object) {
+ return typeof object == "undefined";
+ }
+});
+
+Object.extend(Function.prototype, {
+ argumentNames: function() {
+ var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip");
+ return names.length == 1 && !names[0] ? [] : names;
+ },
+
+ bind: function() {
+ if (arguments.length < 2 && arguments[0] === undefined) return this;
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function() {
+ return __method.apply(object, args.concat($A(arguments)));
+ }
+ },
+
+ bindAsEventListener: function() {
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function(event) {
+ return __method.apply(object, [event || window.event].concat(args));
+ }
+ },
+
+ curry: function() {
+ if (!arguments.length) return this;
+ var __method = this, args = $A(arguments);
+ return function() {
+ return __method.apply(this, args.concat($A(arguments)));
+ }
+ },
+
+ delay: function() {
+ var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
+ return window.setTimeout(function() {
+ return __method.apply(__method, args);
+ }, timeout);
+ },
+
+ wrap: function(wrapper) {
+ var __method = this;
+ return function() {
+ return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
+ }
+ },
+
+ methodize: function() {
+ if (this._methodized) return this._methodized;
+ var __method = this;
+ return this._methodized = function() {
+ return __method.apply(null, [this].concat($A(arguments)));
+ };
+ }
+});
+
+Function.prototype.defer = Function.prototype.delay.curry(0.01);
+
+Date.prototype.toJSON = function() {
+ return '"' + this.getUTCFullYear() + '-' +
+ (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
+ this.getUTCDate().toPaddedString(2) + 'T' +
+ this.getUTCHours().toPaddedString(2) + ':' +
+ this.getUTCMinutes().toPaddedString(2) + ':' +
+ this.getUTCSeconds().toPaddedString(2) + 'Z"';
+};
+
+var Try = {
+ these: function() {
+ var returnValue;
+
+ for (var i = 0, length = arguments.length; i < length; i++) {
+ var lambda = arguments[i];
+ try {
+ returnValue = lambda();
+ break;
+ } catch (e) { }
+ }
+
+ return returnValue;
+ }
+};
+
+RegExp.prototype.match = RegExp.prototype.test;
+
+RegExp.escape = function(str) {
+ return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
+};
+
+/*--------------------------------------------------------------------------*/
+
+var PeriodicalExecuter = Class.create({
+ initialize: function(callback, frequency) {
+ this.callback = callback;
+ this.frequency = frequency;
+ this.currentlyExecuting = false;
+
+ this.registerCallback();
+ },
+
+ registerCallback: function() {
+ this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
+ },
+
+ execute: function() {
+ this.callback(this);
+ },
+
+ stop: function() {
+ if (!this.timer) return;
+ clearInterval(this.timer);
+ this.timer = null;
+ },
+
+ onTimerEvent: function() {
+ if (!this.currentlyExecuting) {
+ try {
+ this.currentlyExecuting = true;
+ this.execute();
+ } finally {
+ this.currentlyExecuting = false;
+ }
+ }
+ }
+});
+Object.extend(String, {
+ interpret: function(value) {
+ return value == null ? '' : String(value);
+ },
+ specialChar: {
+ '\b': '\\b',
+ '\t': '\\t',
+ '\n': '\\n',
+ '\f': '\\f',
+ '\r': '\\r',
+ '\\': '\\\\'
+ }
+});
+
+Object.extend(String.prototype, {
+ gsub: function(pattern, replacement) {
+ var result = '', source = this, match;
+ replacement = arguments.callee.prepareReplacement(replacement);
+
+ while (source.length > 0) {
+ if (match = source.match(pattern)) {
+ result += source.slice(0, match.index);
+ result += String.interpret(replacement(match));
+ source = source.slice(match.index + match[0].length);
+ } else {
+ result += source, source = '';
+ }
+ }
+ return result;
+ },
+
+ sub: function(pattern, replacement, count) {
+ replacement = this.gsub.prepareReplacement(replacement);
+ count = count === undefined ? 1 : count;
+
+ return this.gsub(pattern, function(match) {
+ if (--count < 0) return match[0];
+ return replacement(match);
+ });
+ },
+
+ scan: function(pattern, iterator) {
+ this.gsub(pattern, iterator);
+ return String(this);
+ },
+
+ truncate: function(length, truncation) {
+ length = length || 30;
+ truncation = truncation === undefined ? '...' : truncation;
+ return this.length > length ?
+ this.slice(0, length - truncation.length) + truncation : String(this);
+ },
+
+ strip: function() {
+ return this.replace(/^\s+/, '').replace(/\s+$/, '');
+ },
+
+ stripTags: function() {
+ return this.replace(/<\/?[^>]+>/gi, '');
+ },
+
+ stripScripts: function() {
+ return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
+ },
+
+ extractScripts: function() {
+ var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
+ var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
+ return (this.match(matchAll) || []).map(function(scriptTag) {
+ return (scriptTag.match(matchOne) || ['', ''])[1];
+ });
+ },
+
+ evalScripts: function() {
+ return this.extractScripts().map(function(script) { return eval(script) });
+ },
+
+ escapeHTML: function() {
+ var self = arguments.callee;
+ self.text.data = this;
+ return self.div.innerHTML;
+ },
+
+ unescapeHTML: function() {
+ var div = new Element('div');
+ div.innerHTML = this.stripTags();
+ return div.childNodes[0] ? (div.childNodes.length > 1 ?
+ $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
+ div.childNodes[0].nodeValue) : '';
+ },
+
+ toQueryParams: function(separator) {
+ var match = this.strip().match(/([^?#]*)(#.*)?$/);
+ if (!match) return { };
+
+ return match[1].split(separator || '&').inject({ }, function(hash, pair) {
+ if ((pair = pair.split('='))[0]) {
+ var key = decodeURIComponent(pair.shift());
+ var value = pair.length > 1 ? pair.join('=') : pair[0];
+ if (value != undefined) value = decodeURIComponent(value);
+
+ if (key in hash) {
+ if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
+ hash[key].push(value);
+ }
+ else hash[key] = value;
+ }
+ return hash;
+ });
+ },
+
+ toArray: function() {
+ return this.split('');
+ },
+
+ succ: function() {
+ return this.slice(0, this.length - 1) +
+ String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
+ },
+
+ times: function(count) {
+ return count < 1 ? '' : new Array(count + 1).join(this);
+ },
+
+ camelize: function() {
+ var parts = this.split('-'), len = parts.length;
+ if (len == 1) return parts[0];
+
+ var camelized = this.charAt(0) == '-'
+ ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
+ : parts[0];
+
+ for (var i = 1; i < len; i++)
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
+
+ return camelized;
+ },
+
+ capitalize: function() {
+ return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
+ },
+
+ underscore: function() {
+ return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
+ },
+
+ dasherize: function() {
+ return this.gsub(/_/,'-');
+ },
+
+ inspect: function(useDoubleQuotes) {
+ var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
+ var character = String.specialChar[match[0]];
+ return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
+ });
+ if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
+ return "'" + escapedString.replace(/'/g, '\\\'') + "'";
+ },
+
+ toJSON: function() {
+ return this.inspect(true);
+ },
+
+ unfilterJSON: function(filter) {
+ return this.sub(filter || Prototype.JSONFilter, '#{1}');
+ },
+
+ isJSON: function() {
+ var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
+ return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
+ },
+
+ evalJSON: function(sanitize) {
+ var json = this.unfilterJSON();
+ try {
+ if (!sanitize || json.isJSON()) return eval('(' + json + ')');
+ } catch (e) { }
+ throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
+ },
+
+ include: function(pattern) {
+ return this.indexOf(pattern) > -1;
+ },
+
+ startsWith: function(pattern) {
+ return this.indexOf(pattern) === 0;
+ },
+
+ endsWith: function(pattern) {
+ var d = this.length - pattern.length;
+ return d >= 0 && this.lastIndexOf(pattern) === d;
+ },
+
+ empty: function() {
+ return this == '';
+ },
+
+ blank: function() {
+ return /^\s*$/.test(this);
+ },
+
+ interpolate: function(object, pattern) {
+ return new Template(this, pattern).evaluate(object);
+ }
+});
+
+if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
+ escapeHTML: function() {
+ return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+ },
+ unescapeHTML: function() {
+ return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
+ }
+});
+
+String.prototype.gsub.prepareReplacement = function(replacement) {
+ if (Object.isFunction(replacement)) return replacement;
+ var template = new Template(replacement);
+ return function(match) { return template.evaluate(match) };
+};
+
+String.prototype.parseQuery = String.prototype.toQueryParams;
+
+Object.extend(String.prototype.escapeHTML, {
+ div: document.createElement('div'),
+ text: document.createTextNode('')
+});
+
+with (String.prototype.escapeHTML) div.appendChild(text);
+
+var Template = Class.create({
+ initialize: function(template, pattern) {
+ this.template = template.toString();
+ this.pattern = pattern || Template.Pattern;
+ },
+
+ evaluate: function(object) {
+ if (Object.isFunction(object.toTemplateReplacements))
+ object = object.toTemplateReplacements();
+
+ return this.template.gsub(this.pattern, function(match) {
+ if (object == null) return '';
+
+ var before = match[1] || '';
+ if (before == '\\') return match[2];
+
+ var ctx = object, expr = match[3];
+ var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr);
+ if (match == null) return before;
+
+ while (match != null) {
+ var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
+ ctx = ctx[comp];
+ if (null == ctx || '' == match[3]) break;
+ expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
+ match = pattern.exec(expr);
+ }
+
+ return before + String.interpret(ctx);
+ }.bind(this));
+ }
+});
+Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
+
+var $break = { };
+
+var Enumerable = {
+ each: function(iterator, context) {
+ var index = 0;
+ iterator = iterator.bind(context);
+ try {
+ this._each(function(value) {
+ iterator(value, index++);
+ });
+ } catch (e) {
+ if (e != $break) throw e;
+ }
+ return this;
+ },
+
+ eachSlice: function(number, iterator, context) {
+ iterator = iterator ? iterator.bind(context) : Prototype.K;
+ var index = -number, slices = [], array = this.toArray();
+ while ((index += number) < array.length)
+ slices.push(array.slice(index, index+number));
+ return slices.collect(iterator, context);
+ },
+
+ all: function(iterator, context) {
+ iterator = iterator ? iterator.bind(context) : Prototype.K;
+ var result = true;
+ this.each(function(value, index) {
+ result = result && !!iterator(value, index);
+ if (!result) throw $break;
+ });
+ return result;
+ },
+
+ any: function(iterator, context) {
+ iterator = iterator ? iterator.bind(context) : Prototype.K;
+ var result = false;
+ this.each(function(value, index) {
+ if (result = !!iterator(value, index))
+ throw $break;
+ });
+ return result;
+ },
+
+ collect: function(iterator, context) {
+ iterator = iterator ? iterator.bind(context) : Prototype.K;
+ var results = [];
+ this.each(function(value, index) {
+ results.push(iterator(value, index));
+ });
+ return results;
+ },
+
+ detect: function(iterator, context) {
+ iterator = iterator.bind(context);
+ var result;
+ this.each(function(value, index) {
+ if (iterator(value, index)) {
+ result = value;
+ throw $break;
+ }
+ });
+ return result;
+ },
+
+ findAll: function(iterator, context) {
+ iterator = iterator.bind(context);
+ var results = [];
+ this.each(function(value, index) {
+ if (iterator(value, index))
+ results.push(value);
+ });
+ return results;
+ },
+
+ grep: function(filter, iterator, context) {...
[truncated message content] |
|
From: <ra...@us...> - 2009-03-21 18:05:39
|
Revision: 2197
http://itracker.svn.sourceforge.net/itracker/?rev=2197&view=rev
Author: ranks
Date: 2009-03-21 18:05:30 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
tagging final itracker 3.0.1 release
Added Paths:
-----------
itracker/tags/itracker-3.0.1/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-21 18:01:53
|
Revision: 2196
http://itracker.svn.sourceforge.net/itracker/?rev=2196&view=rev
Author: ranks
Date: 2009-03-21 18:01:36 +0000 (Sat, 21 Mar 2009)
Log Message:
-----------
final 3.0.1 changes
fixing admin home, selenium tests, code cleanums
Modified Paths:
--------------
itracker/trunk/pom.xml
itracker/trunk/src/main/java/org/itracker/core/ApplicationInitialization.java
itracker/trunk/src/main/java/org/itracker/services/IssueService.java
itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java
itracker/trunk/src/main/java/org/itracker/services/implementations/IssueServiceImpl.java
itracker/trunk/src/main/java/org/itracker/services/util/HTMLUtilities.java
itracker/trunk/src/main/java/org/itracker/web/actions/admin/AdminHomeAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueActionUtil.java
itracker/trunk/src/main/webapp/module-admin/admin_configuration/edit_customfield.jsp
itracker/trunk/src/main/webapp/module-admin/adminhome.jsp
itracker/trunk/src/site/apt/site.apt
itracker/trunk/src/site/site.xml
itracker/trunk/src/site/xdoc/configuration.xml
itracker/trunk/src/site/xdoc/index.xml
itracker/trunk/src/site/xdoc/install.xml
itracker/trunk/src/site/xdoc/migration/migrate2.4-3.0.xml
itracker/trunk/src/site/xdoc/release-notes/index.xml
itracker/trunk/src/site/xdoc/release-notes/itracker-3.0-rc1.xml
itracker/trunk/src/site/xdoc/release-notes/itracker-3.0-rc2.xml
itracker/trunk/src/site/xdoc/release-notes/itracker-3.0-rc3.xml
itracker/trunk/src/site/xdoc/release-notes/itracker-3.0-stable.xml
itracker/trunk/src/site/xdoc/screenshots/screenshots.xml
itracker/trunk/src/test/java/org/itracker/core/resources/ITrackerResourcesTest.java
itracker/trunk/src/test/java/org/itracker/selenium/CreateIssueTest.java
itracker/trunk/src/test/java/org/itracker/services/implementations/IssueServiceTest.java
itracker/trunk/src/test/resources/configuration.properties
Added Paths:
-----------
itracker/trunk/src/site/xdoc/release-notes/itracker-3.0.1.xml
Property Changed:
----------------
itracker/trunk/
itracker/trunk/src/main/webapp/META-INF/
Property changes on: itracker/trunk
___________________________________________________________________
Added: svn:ignore
+ .settings
target
.classpath
.project
Modified: itracker/trunk/pom.xml
===================================================================
--- itracker/trunk/pom.xml 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/pom.xml 2009-03-21 18:01:36 UTC (rev 2196)
@@ -5,7 +5,7 @@
<artifactId>itracker</artifactId>
<packaging>war</packaging>
<name>itracker</name>
- <version>3.0.1-SNAPSHOT</version>
+ <version>3.0.1</version>
<url>" rel="nofollow">http://itracker.sourceforge.net/</url>
<properties>
<clover.maven.charset>UTF-8</clover.maven.charset>
@@ -55,7 +55,7 @@
<id>ranks</id>
<name>Marco Glur</name>
<email>ra...@ro...</email>
- <organization>R.√ò.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
+ <organization>R.Ø.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
<organizationUrl>" rel="nofollow">http://rosa.com/</organizationUrl>
<roles>
<role>Developer</role>
@@ -66,7 +66,7 @@
<id>MarkyGoldstein</id>
<name>Marky Goldstein</name>
<email>re...@ro...</email>
- <organization>R.√ò.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
+ <organization>R.Ø.S.A. Creation. Technology. Intelligence. AG, Zurich</organization>
<organizationUrl>http://www.rosa.com</organizationUrl>
<timezone>1</timezone>
<roles>
Modified: itracker/trunk/src/main/java/org/itracker/core/ApplicationInitialization.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/core/ApplicationInitialization.java 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/src/main/java/org/itracker/core/ApplicationInitialization.java 2009-03-21 18:01:36 UTC (rev 2196)
@@ -1,165 +1,117 @@
-/*
- * This software was designed and created by Jason Carroll.
- * Copyright (c) 2002, 2003, 2004 Jason Carroll.
- * The author can be reached at jca...@co...
- * ITracker website: http://www.cowsultants.com
- * ITracker forums: http://www.cowsultants.com/phpBB/index.php
- *
- * This program is free software; you can redistribute it and/or modify
- * it only under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-package org.itracker.core;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-
-import org.apache.log4j.Logger;
-import org.itracker.core.resources.ITrackerResources;
-import org.itracker.model.User;
-import org.itracker.persistence.dao.NoSuchEntityException;
-import org.itracker.services.ConfigurationService;
-import org.itracker.services.IssueService;
-import org.itracker.services.ReportService;
-import org.itracker.services.UserService;
-import org.itracker.services.exceptions.PasswordException;
-import org.itracker.services.exceptions.UserException;
-import org.itracker.services.util.SystemConfigurationUtilities;
-import org.itracker.services.util.UserUtilities;
-
-
-/**
- * TODO: Add Javadocs here: please comment this for documentation reasons. What is this Class used for?
- *
- * It seems like this gets started when the application starts up...
- *
- * What's the general idea?
- *
- * Why is processAttachmentFiles commented and therefore not used currently?
- * Where does itracker store its attachments?
- * What's the idea behind the attachment_dir ?
- *
- * @author ready
- *
- */
-
-public class ApplicationInitialization {
-
- private final Logger logger;
- private UserService userService;
- private ConfigurationService configurationService;
-
- public ApplicationInitialization(UserService userService, ConfigurationService configurationService, ReportService reportService) {
- this.userService = userService;
- this.configurationService = configurationService;
- this.logger = Logger.getLogger(getClass());
- init();
- }
-
- public void init() {
- try {
- ITrackerResources.setDefaultLocale(configurationService.getProperty("default_locale", ITrackerResources.DEFAULT_LOCALE));
- logger.info("Set system default locale to '" + ITrackerResources.getDefaultLocale() + "'");
-
- logger.info("Checking and initializing languages in the database.");
- SystemConfigurationUtilities.initializeAllLanguages(configurationService, false);
-
- logger.info("Checking and initializing default system configuration in the database.");
- configurationService.initializeConfiguration();
-
-// logger.info("Checking for issue attachment files.");
-// processAttachmentFiles(configurationService.getProperty("attachment_dir", IssueAttachmentUtilities.DEFAULT_ATTACHMENT_DIR));
-
- logger.info("Setting up cached configuration entries");
- configurationService.resetConfigurationCache();
-
- // Preinitialize all of the PDF fonts available. Do it in a
- // separate thread to speed up the rest of the startup.
- // TODO: I think this should be removed... why do we need to pre-init ? (rjst)
- // old code to pre-init fonts for jfree reports. make sure we can delete it
- // BaseFontFactory fontFactory = BaseFontFactory.getFontFactory();
- // fontFactory.registerDefaultFontPath();
-
- // check for and create admin user, if so configured
- createAdminUser(configurationService);
- } catch (PasswordException pe) {
- logger.info("Unable to create admin user. Error: " + pe.getMessage());
- } catch (UserException ue) {
- logger.warn("Exception while creating admin user.", ue);
- }
- }
-
- /**
- * Check if we should create the admin user, if so, do it.
- *
- * @param configurationService
- * @throws PasswordException
- * @throws UserException
- */
- private void createAdminUser(ConfigurationService configurationService) throws PasswordException, UserException {
- boolean createAdmin = configurationService.getBooleanProperty("create_super_user", false);
- if (createAdmin) {
- logger.info("Create default admin user option set to true. Checking for existing admin user.");
- try {
- userService.getUserByLogin("admin");
- } catch (NoSuchEntityException e) {
- logger.debug("Attempting to create admin user.");
- User adminUser = new User("admin", UserUtilities.encryptPassword("admin"), "Super", "User",
- "", true);
- userService.createUser(adminUser);
- }
- }
- }
-
- @SuppressWarnings("unused")
- private void processAttachmentFiles(String attachmentDirectory) {
- if (attachmentDirectory == null || attachmentDirectory.equals("")) {
- return;
- }
-
- try {
- File directory = new File(attachmentDirectory.replace('/', File.separatorChar));
- if (directory == null || !directory.isDirectory()) {
- throw new Exception("Invalid attachment directory.");
- }
- File[] attachments = directory.listFiles();
-
- IssueService issueService = null;
-
- for (int i = 0; i < attachments.length; i++) {
- try {
- if (attachments[i].length() > Integer.MAX_VALUE) {
- throw new IOException("File too large to load.");
- }
- byte[] data = new byte[(int) attachments[i].length()];
- FileInputStream fis = new FileInputStream(attachments[i]);
- int bytesRead = fis.read(data);
- fis.close();
- if (bytesRead != data.length) {
- throw new IOException(
- "The number of bytes read from the file, did not match the size of the file.");
- }
- //FIXME: Null pointer access: The variable issueService can only be null at this location.
- if (issueService.setIssueAttachmentData(attachments[i].getName(), data)) {
- // attachments[i].delete();
- logger.debug("Successfully moved attachment " + attachments[i].getName()
- + " to the database.");
- }
- } catch (IOException ioe) {
- logger.error("Unable to save attachment: " + ioe.getMessage());
- }
- }
- } catch (Exception e) {
- logger.error("Unable to check for existing file attachments: " + e.getMessage());
- }
- }
-
-}
+/*
+ * This software was designed and created by Jason Carroll.
+ * Copyright (c) 2002, 2003, 2004 Jason Carroll.
+ * The author can be reached at jca...@co...
+ * ITracker website: http://www.cowsultants.com
+ * ITracker forums: http://www.cowsultants.com/phpBB/index.php
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it only under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+package org.itracker.core;
+
+import org.apache.log4j.Logger;
+import org.itracker.core.resources.ITrackerResources;
+import org.itracker.model.User;
+import org.itracker.persistence.dao.NoSuchEntityException;
+import org.itracker.services.ConfigurationService;
+import org.itracker.services.ReportService;
+import org.itracker.services.UserService;
+import org.itracker.services.exceptions.PasswordException;
+import org.itracker.services.exceptions.UserException;
+import org.itracker.services.util.SystemConfigurationUtilities;
+import org.itracker.services.util.UserUtilities;
+
+
+/**
+ * TODO: Add Javadocs here: please comment this for documentation reasons. What is this Class used for?
+ *
+ * It seems like this gets started when the application starts up...
+ *
+ * What's the general idea?
+ *
+ * Why is processAttachmentFiles commented and therefore not used currently?
+ * Where does itracker store its attachments?
+ * What's the idea behind the attachment_dir ?
+ *
+ * @author ready
+ *
+ */
+
+public class ApplicationInitialization {
+
+ private final Logger logger;
+ private UserService userService;
+ private ConfigurationService configurationService;
+
+ public ApplicationInitialization(UserService userService, ConfigurationService configurationService, ReportService reportService) {
+ this.userService = userService;
+ this.configurationService = configurationService;
+ this.logger = Logger.getLogger(getClass());
+ init();
+ }
+
+ public void init() {
+ try {
+ ITrackerResources.setDefaultLocale(configurationService.getProperty("default_locale", ITrackerResources.DEFAULT_LOCALE));
+ logger.info("Set system default locale to '" + ITrackerResources.getDefaultLocale() + "'");
+
+ logger.info("Checking and initializing languages in the database.");
+ SystemConfigurationUtilities.initializeAllLanguages(configurationService, false);
+
+ logger.info("Checking and initializing default system configuration in the database.");
+ configurationService.initializeConfiguration();
+
+// logger.info("Checking for issue attachment files.");
+// processAttachmentFiles(configurationService.getProperty("attachment_dir", IssueAttachmentUtilities.DEFAULT_ATTACHMENT_DIR));
+
+ logger.info("Setting up cached configuration entries");
+ configurationService.resetConfigurationCache();
+
+ // Preinitialize all of the PDF fonts available. Do it in a
+ // separate thread to speed up the rest of the startup.
+ // TODO: I think this should be removed... why do we need to pre-init ? (rjst)
+ // old code to pre-init fonts for jfree reports. make sure we can delete it
+ // BaseFontFactory fontFactory = BaseFontFactory.getFontFactory();
+ // fontFactory.registerDefaultFontPath();
+
+ // check for and create admin user, if so configured
+ createAdminUser(configurationService);
+ } catch (PasswordException pe) {
+ logger.info("Unable to create admin user. Error: " + pe.getMessage());
+ } catch (UserException ue) {
+ logger.warn("Exception while creating admin user.", ue);
+ }
+ }
+
+ /**
+ * Check if we should create the admin user, if so, do it.
+ *
+ * @param configurationService
+ * @throws PasswordException
+ * @throws UserException
+ */
+ private void createAdminUser(ConfigurationService configurationService) throws PasswordException, UserException {
+ boolean createAdmin = configurationService.getBooleanProperty("create_super_user", false);
+ if (createAdmin) {
+ logger.info("Create default admin user option set to true. Checking for existing admin user.");
+ try {
+ userService.getUserByLogin("admin");
+ } catch (NoSuchEntityException e) {
+ logger.debug("Attempting to create admin user.");
+ User adminUser = new User("admin", UserUtilities.encryptPassword("admin"), "Super", "User",
+ "", true);
+ userService.createUser(adminUser);
+ }
+ }
+ }
+
+}
Modified: itracker/trunk/src/main/java/org/itracker/services/IssueService.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/services/IssueService.java 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/src/main/java/org/itracker/services/IssueService.java 2009-03-21 18:01:36 UTC (rev 2196)
@@ -1,324 +1,327 @@
-/*
- * This software was designed and created by Jason Carroll.
- * Copyright (c) 2002, 2003, 2004 Jason Carroll.
- * The author can be reached at jca...@co...
- * ITracker website: http://www.cowsultants.com
- * ITracker forums: http://www.cowsultants.com/phpBB/index.php
- *
- * This program is free software; you can redistribute it and/or modify
- * it only under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-package org.itracker.services;
-
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.itracker.model.Component;
-import org.itracker.model.Issue;
-import org.itracker.model.IssueActivity;
-import org.itracker.model.IssueAttachment;
-import org.itracker.model.IssueField;
-import org.itracker.model.IssueHistory;
-import org.itracker.model.IssueRelation;
-import org.itracker.model.IssueSearchQuery;
-import org.itracker.model.PermissionType;
-import org.itracker.model.Project;
-import org.itracker.model.User;
-import org.itracker.model.Version;
-import org.itracker.services.exceptions.IssueSearchException;
-import org.itracker.services.exceptions.ProjectException;
-
-public interface IssueService {
-
- Issue getIssue(Integer issueId);
-
- /**
- * @deprecated Don't use due to EXPENSIVE memory use.
- * @return
- */
- List<Issue> getAllIssues();
-
-
- Long getNumberIssues();
-
- /**
- * Returns an array of issues that are currently at the given status.
- * @param status the status to search for
- * @return an array of issues with the given status
- */
- List<Issue> getIssuesWithStatus(int status);
-
- /**
- * Returns an array of issues that are currently at the given status or a status
- * less than the given status.
- * @param status the status to search for
- * @return an array of issues with the given status or lower
- */
- List<Issue> getIssuesWithStatusLessThan(int status);
-
- /**
- * Returns an array of issues that are currently at the given severity.
- * @param severity the severity to search for
- * @return an array of issues with the given severity
- */
- List<Issue> getIssuesWithSeverity(int severity);
-
- List<Issue> getIssuesByProjectId(Integer projectId);
-
- List<Issue> getIssuesByProjectId(Integer projectId, int status);
-
- List<Issue> getIssuesCreatedByUser(Integer userId);
-
- List<Issue> getIssuesCreatedByUser(Integer userId, boolean availableProjectsOnly);
-
- List<Issue> getIssuesOwnedByUser(Integer userId);
-
- List<Issue> getIssuesOwnedByUser(Integer userId, boolean availableProjectsOnly);
-
- List<Issue> getIssuesWatchedByUser(Integer userId);
-
- List<Issue> getIssuesWatchedByUser(Integer userId, boolean availableProjectsOnly);
-
- List<Issue> getUnassignedIssues();
-
- List<Issue> getUnassignedIssues(boolean availableProjectsOnly);
- /**
- * Creates a new issue in a project.
- * @param model an Issue representing the new issue information
- * @param projectId the projectId the issue belongs to
- * @param userId the id of registered creator of the new issue
- * @param createdById the id of the actual creator of the issue. This would normally be the same as the userId.
- * @return an Issue containing the newly created issue, or null if the create failed
- */
- Issue createIssue(Issue issue, Integer projectId, Integer userId, Integer createdById)
- throws ProjectException;
-
- /**
- * Save a modified issue to the persistence layer
- *
- * @param issueDirty the changed, unsaved issue to update on persistency layer
- * @param userId the user-id of the changer
- *
- */
- Issue updateIssue(Issue issue, Integer userId) throws ProjectException;
- Issue systemUpdateIssue(Issue issue, Integer userId) throws ProjectException;
-
- /**
- * Moves an issues from its current project to a new project.
- * @param issue an Issue of the issue to move
- * @param projectId the id of the target project
- * @param userId the id of the user that is moving the issue
- * @return an Issue of the issue after it has been moved
- */
- Issue moveIssue(Issue issue, Integer projectId, Integer userId);
-
- /**
- *
- * @param issueId
- * @param userId
- * @return
- */
- boolean assignIssue(Integer issueId, Integer userId);
-
- /**
- *
- * @param issueId
- * @param userId
- * @param assignedByUserId
- * @return
- */
- boolean assignIssue(Integer issueId, Integer userId, Integer assignedByUserId);
-
- /**
- * TODO: Add Javadocs here: document this whole class.describe what is the use for this method.
- * @param issueId
- * @param fields
- * @return
- */
- boolean setIssueFields(Integer issueId, List<IssueField> fields);
-
- boolean setIssueComponents(Integer issueId, HashSet<Integer> componentIds, Integer userId);
-
- boolean setIssueVersions(Integer issueId, HashSet<Integer> versionIds, Integer userId);
-
- boolean addIssueHistory(IssueHistory history);
-
- boolean addIssueRelation(Integer issueId, Integer relatedIssueId, int relationType, Integer userId);
-
- //boolean addIssueActivity(IssueActivityModel model);
-
-// void updateIssueActivityNotification(Integer issueId, boolean notificationSent);
-
- boolean addIssueAttachment(IssueAttachment attachment, byte[] data);
-
- /**
- * Updates the binary data of the attachment stored in the database.
- * @param attachmentId the id of the attachment to update
- * @param data a byte arrray of the binary data for the attachment
- * @return true if the update was successful
- */
- boolean setIssueAttachmentData(Integer attachmentId, byte[] data);
-
- /**
- * Updates the binary data of the attachment stored in the database. Used mainly
- * to take an existing attachment stored on the filesystem and move it into
- * the database.
- * @param fileName the filename listed in the database for the localtion of the attachment.
- * This is the name that was previously used to store the data on the
- * filesystem, not the original filename of the attachment.
- * @param data a byte arrray of the binary data for the attachment
- * @return true if the update was successful
- */
- boolean setIssueAttachmentData(String fileName, byte[] data);
-
-// boolean addIssueNotification(Notification notification);
-
- boolean removeIssueAttachment(Integer attachmentId);
-
- //TODO: shall we deprecate this one? why do we need to give it a userId?
- Integer removeIssueHistoryEntry(Integer entryId, Integer userId);
-
- void removeIssueRelation(Integer relationId, Integer userId);
-
- Project getIssueProject(Integer issueId);
-
- List<Component> getIssueComponents(Integer issueId);
-
- HashSet<Integer> getIssueComponentIds(Integer issueId);
-
- List<Version> getIssueVersions(Integer issueId);
-
- HashSet<Integer> getIssueVersionIds(Integer issueId);
-
- User getIssueCreator(Integer issueId);
-
- User getIssueOwner(Integer issueId);
-
- IssueRelation getIssueRelation(Integer relationId);
-
- List<IssueActivity> getIssueActivity(Integer issueId);
-
- List<IssueActivity> getIssueActivity(Integer issueId, boolean notificationSent);
-
- List<IssueAttachment> getAllIssueAttachments();
-
-// /**
-// * @deprecated use the methods getAllIssueAttachmentSize and getAllIssueAttachmentCount instead.
-// * @return
-// */
-// long[] getAllIssueAttachmentsSizeAndCount();
-
- Long getAllIssueAttachmentSize();
-
-// /**
-// * @deprecated use getAllIssueAttachmentSize instead.
-// * @return
-// */
-// Long totalSystemIssuesAttachmentSize();
-// /**
-// * @deprecated use getAllIssuesAttachmentCount instead
-// * @return
-// */
-// Long countSystemIssuesAttachments();
-
- Long getAllIssueAttachmentCount();
-
-
- IssueAttachment getIssueAttachment(Integer attachmentId);
-
- /**
- * Returns the binary data for an attachment.
- * @param attachmentId the id of the attachment to obtain the data for
- * @return a byte array containing the attachment data
- */
- byte[] getIssueAttachmentData(Integer attachmentId);
-
- List<IssueAttachment> getIssueAttachments(Integer issueId);
-
- int getIssueAttachmentCount(Integer issueId);
-
- /**
- * Returns the latest issue history entry for a particular issue.
- * @param issueId the id of the issue to return the history entry for.
- * @return the latest IssueHistory, or null if no entries could be found
- */
- IssueHistory getLastIssueHistory(Integer issueId);
-
- List<IssueHistory> getIssueHistory(Integer issueId);
-
-// /**
-// * @deprecated Moved to NotificationService
-// * Retrieves the primary issue notifications. Primary notifications
-// * are defined as the issue owner (or creator if not assigned), and any project owners.
-// * This should encompass the list of people that should be notified so that action
-// * can be taken on an issue that needs immediate attention.
-// * @param issueId the id of the issue to find notifications for
-// * @returns an array of NotificationModels
-// */
-// List<Notification> getPrimaryIssueNotifications(Integer issueId);
-//
-// /**
-// * Retrieves all notifications for an issue where the notification's user is also active.
-// * @param issueId the id of the issue to find notifications for
-// * @returns an array of NotificationModels
-// * @deprecated Moved to NotificationService
-// */
-// List<Notification> getIssueNotifications(Integer issueId);
-//
-// /**
-// * Retrieves an array of issue notifications. The notifications by default
-// * is the creator and owner of the issue, all project admins for the issue's project,
-// * and anyone else that has a notfication on file.
-// * @param issueId the id of the issue to find notifications for
-// * @param pimaryOnly only include the primary notifications
-// * @param activeOnly only include the notification if the user is currently active (not locked or deleted)
-// * @returns an array of NotificationModels
-// * @see org.itracker.services.implementations.IssueServiceImpl#getPrimaryIssueNotifications
-// * @deprecated moved to NotificationService
-// */
-// boolean removeIssueNotification(Integer notificationId);
-//
-// /**
-// * @deprecated Moved to NotificationService
-// * @param issueId
-// * @param primaryOnly
-// * @param activeOnly
-// * @return
-// */
-// List<Notification> getIssueNotifications(Integer issueId, boolean primaryOnly, boolean activeOnly);
-// /**
-// * @deprecated Moved to NotificationService
-// * @param issueId
-// * @param userId
-// * @return
-// */
-// boolean hasIssueNotification(Integer issueId, Integer userId);
-
-
- int getOpenIssueCountByProjectId(Integer projectId);
-
- int getResolvedIssueCountByProjectId(Integer projectId);
-
- int getTotalIssueCountByProjectId(Integer projectId);
-
- Date getLatestIssueDateByProjectId(Integer projectId);
-
- boolean canViewIssue(Integer issueId, User user);
-
- boolean canViewIssue(Issue issue, User user);
-
- public List<Issue> searchIssues(IssueSearchQuery queryModel, User user, Map<Integer, Set<PermissionType>> userPermissions) throws IssueSearchException;
-
-
-}
+/*
+ * This software was designed and created by Jason Carroll.
+ * Copyright (c) 2002, 2003, 2004 Jason Carroll.
+ * The author can be reached at jca...@co...
+ * ITracker website: http://www.cowsultants.com
+ * ITracker forums: http://www.cowsultants.com/phpBB/index.php
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it only under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+package org.itracker.services;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.itracker.model.Component;
+import org.itracker.model.Issue;
+import org.itracker.model.IssueActivity;
+import org.itracker.model.IssueAttachment;
+import org.itracker.model.IssueField;
+import org.itracker.model.IssueHistory;
+import org.itracker.model.IssueRelation;
+import org.itracker.model.IssueSearchQuery;
+import org.itracker.model.PermissionType;
+import org.itracker.model.Project;
+import org.itracker.model.User;
+import org.itracker.model.Version;
+import org.itracker.services.exceptions.IssueSearchException;
+import org.itracker.services.exceptions.ProjectException;
+
+public interface IssueService {
+
+ Issue getIssue(Integer issueId);
+
+ /**
+ * @deprecated Don't use due to EXPENSIVE memory use.
+ * @return
+ */
+ List<Issue> getAllIssues();
+
+
+ Long getNumberIssues();
+
+ /**
+ * Returns an array of issues that are currently at the given status.
+ * @param status the status to search for
+ * @return an array of issues with the given status
+ */
+ List<Issue> getIssuesWithStatus(int status);
+
+ /**
+ * Returns an array of issues that are currently at the given status or a status
+ * less than the given status.
+ * @param status the status to search for
+ * @return an array of issues with the given status or lower
+ */
+ List<Issue> getIssuesWithStatusLessThan(int status);
+
+ /**
+ * Returns an array of issues that are currently at the given severity.
+ * @param severity the severity to search for
+ * @return an array of issues with the given severity
+ */
+ List<Issue> getIssuesWithSeverity(int severity);
+
+ List<Issue> getIssuesByProjectId(Integer projectId);
+
+ List<Issue> getIssuesByProjectId(Integer projectId, int status);
+
+ List<Issue> getIssuesCreatedByUser(Integer userId);
+
+ List<Issue> getIssuesCreatedByUser(Integer userId, boolean availableProjectsOnly);
+
+ List<Issue> getIssuesOwnedByUser(Integer userId);
+
+ List<Issue> getIssuesOwnedByUser(Integer userId, boolean availableProjectsOnly);
+
+ List<Issue> getIssuesWatchedByUser(Integer userId);
+
+ List<Issue> getIssuesWatchedByUser(Integer userId, boolean availableProjectsOnly);
+
+ List<Issue> getUnassignedIssues();
+
+ List<Issue> getUnassignedIssues(boolean availableProjectsOnly);
+ /**
+ * Creates a new issue in a project.
+ * @param model an Issue representing the new issue information
+ * @param projectId the projectId the issue belongs to
+ * @param userId the id of registered creator of the new issue
+ * @param createdById the id of the actual creator of the issue. This would normally be the same as the userId.
+ * @return an Issue containing the newly created issue, or null if the create failed
+ */
+ Issue createIssue(Issue issue, Integer projectId, Integer userId, Integer createdById)
+ throws ProjectException;
+
+ /**
+ * Save a modified issue to the persistence layer
+ *
+ * @param issueDirty the changed, unsaved issue to update on persistency layer
+ * @param userId the user-id of the changer
+ *
+ */
+ Issue updateIssue(Issue issue, Integer userId) throws ProjectException;
+ Issue systemUpdateIssue(Issue issue, Integer userId) throws ProjectException;
+
+ /**
+ * Moves an issues from its current project to a new project.
+ * @param issue an Issue of the issue to move
+ * @param projectId the id of the target project
+ * @param userId the id of the user that is moving the issue
+ * @return an Issue of the issue after it has been moved
+ */
+ Issue moveIssue(Issue issue, Integer projectId, Integer userId);
+
+ /**
+ *
+ * @param issueId
+ * @param userId
+ * @return
+ */
+ boolean assignIssue(Integer issueId, Integer userId);
+
+ /**
+ *
+ * @param issueId
+ * @param userId
+ * @param assignedByUserId
+ * @return
+ */
+ boolean assignIssue(Integer issueId, Integer userId, Integer assignedByUserId);
+
+ /**
+ * TODO: Add Javadocs here: document this whole class.describe what is the use for this method.
+ * @param issueId
+ * @param fields
+ * @return
+ */
+ boolean setIssueFields(Integer issueId, List<IssueField> fields);
+
+ boolean setIssueComponents(Integer issueId, HashSet<Integer> componentIds, Integer userId);
+
+ boolean setIssueVersions(Integer issueId, HashSet<Integer> versionIds, Integer userId);
+
+ boolean addIssueHistory(IssueHistory history);
+
+ boolean addIssueRelation(Integer issueId, Integer relatedIssueId, int relationType, Integer userId);
+
+ //boolean addIssueActivity(IssueActivityModel model);
+
+// void updateIssueActivityNotification(Integer issueId, boolean notificationSent);
+
+ boolean addIssueAttachment(IssueAttachment attachment, byte[] data);
+
+ /**
+ * Updates the binary data of the attachment stored in the database.
+ * @param attachmentId the id of the attachment to update
+ * @param data a byte arrray of the binary data for the attachment
+ * @return true if the update was successful
+ */
+ boolean setIssueAttachmentData(Integer attachmentId, byte[] data);
+
+ /**
+ * Updates the binary data of the attachment stored in the database. Used mainly
+ * to take an existing attachment stored on the filesystem and move it into
+ * the database.
+ * @param fileName the filename listed in the database for the localtion of the attachment.
+ * This is the name that was previously used to store the data on the
+ * filesystem, not the original filename of the attachment.
+ * @param data a byte arrray of the binary data for the attachment
+ * @return true if the update was successful
+ */
+ boolean setIssueAttachmentData(String fileName, byte[] data);
+
+// boolean addIssueNotification(Notification notification);
+
+ boolean removeIssueAttachment(Integer attachmentId);
+
+ //TODO: shall we deprecate this one? why do we need to give it a userId?
+ Integer removeIssueHistoryEntry(Integer entryId, Integer userId);
+
+ void removeIssueRelation(Integer relationId, Integer userId);
+
+ Project getIssueProject(Integer issueId);
+
+ List<Component> getIssueComponents(Integer issueId);
+
+ HashSet<Integer> getIssueComponentIds(Integer issueId);
+
+ List<Version> getIssueVersions(Integer issueId);
+
+ HashSet<Integer> getIssueVersionIds(Integer issueId);
+
+ User getIssueCreator(Integer issueId);
+
+ User getIssueOwner(Integer issueId);
+
+ IssueRelation getIssueRelation(Integer relationId);
+
+ List<IssueActivity> getIssueActivity(Integer issueId);
+
+ List<IssueActivity> getIssueActivity(Integer issueId, boolean notificationSent);
+ /**
+ * @deprecated
+ * @return
+ */
+ List<IssueAttachment> getAllIssueAttachments();
+
+// /**
+// * @deprecated use the methods getAllIssueAttachmentSize and getAllIssueAttachmentCount instead.
+// * @return
+// */
+// long[] getAllIssueAttachmentsSizeAndCount();
+
+ Long getAllIssueAttachmentSize();
+
+// /**
+// * @deprecated use getAllIssueAttachmentSize instead.
+// * @return
+// */
+// Long totalSystemIssuesAttachmentSize();
+// /**
+// * @deprecated use getAllIssuesAttachmentCount instead
+// * @return
+// */
+// Long countSystemIssuesAttachments();
+
+ Long getAllIssueAttachmentCount();
+
+
+ IssueAttachment getIssueAttachment(Integer attachmentId);
+
+ /**
+ * Returns the binary data for an attachment.
+ * @param attachmentId the id of the attachment to obtain the data for
+ * @return a byte array containing the attachment data
+ */
+ byte[] getIssueAttachmentData(Integer attachmentId);
+
+ List<IssueAttachment> getIssueAttachments(Integer issueId);
+
+ int getIssueAttachmentCount(Integer issueId);
+
+ /**
+ * Returns the latest issue history entry for a particular issue.
+ * @param issueId the id of the issue to return the history entry for.
+ * @return the latest IssueHistory, or null if no entries could be found
+ */
+ IssueHistory getLastIssueHistory(Integer issueId);
+
+ List<IssueHistory> getIssueHistory(Integer issueId);
+
+// /**
+// * @deprecated Moved to NotificationService
+// * Retrieves the primary issue notifications. Primary notifications
+// * are defined as the issue owner (or creator if not assigned), and any project owners.
+// * This should encompass the list of people that should be notified so that action
+// * can be taken on an issue that needs immediate attention.
+// * @param issueId the id of the issue to find notifications for
+// * @returns an array of NotificationModels
+// */
+// List<Notification> getPrimaryIssueNotifications(Integer issueId);
+//
+// /**
+// * Retrieves all notifications for an issue where the notification's user is also active.
+// * @param issueId the id of the issue to find notifications for
+// * @returns an array of NotificationModels
+// * @deprecated Moved to NotificationService
+// */
+// List<Notification> getIssueNotifications(Integer issueId);
+//
+// /**
+// * Retrieves an array of issue notifications. The notifications by default
+// * is the creator and owner of the issue, all project admins for the issue's project,
+// * and anyone else that has a notfication on file.
+// * @param issueId the id of the issue to find notifications for
+// * @param pimaryOnly only include the primary notifications
+// * @param activeOnly only include the notification if the user is currently active (not locked or deleted)
+// * @returns an array of NotificationModels
+// * @see org.itracker.services.implementations.IssueServiceImpl#getPrimaryIssueNotifications
+// * @deprecated moved to NotificationService
+// */
+// boolean removeIssueNotification(Integer notificationId);
+//
+// /**
+// * @deprecated Moved to NotificationService
+// * @param issueId
+// * @param primaryOnly
+// * @param activeOnly
+// * @return
+// */
+// List<Notification> getIssueNotifications(Integer issueId, boolean primaryOnly, boolean activeOnly);
+// /**
+// * @deprecated Moved to NotificationService
+// * @param issueId
+// * @param userId
+// * @return
+// */
+// boolean hasIssueNotification(Integer issueId, Integer userId);
+
+
+ int getOpenIssueCountByProjectId(Integer projectId);
+
+ int getResolvedIssueCountByProjectId(Integer projectId);
+
+ int getTotalIssueCountByProjectId(Integer projectId);
+
+ Date getLatestIssueDateByProjectId(Integer projectId);
+
+ boolean canViewIssue(Integer issueId, User user);
+
+ boolean canViewIssue(Issue issue, User user);
+
+ public List<Issue> searchIssues(IssueSearchQuery queryModel, User user, Map<Integer, Set<PermissionType>> userPermissions) throws IssueSearchException;
+
+
+}
Modified: itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java 2009-03-21 18:01:36 UTC (rev 2196)
@@ -976,12 +976,15 @@
if (locale == null || locale.equals("")) {
locale = ITrackerResources.BASE_LOCALE;
}
+
Collection<Language> items = languageDAO.findByLocale(locale);
for (Iterator<Language> iter = items.iterator(); iter.hasNext();) {
Language item = (Language) iter.next();
keys.put(item.getResourceKey(), item.getResourceValue());
}
+
+
return keys;
}
Modified: itracker/trunk/src/main/java/org/itracker/services/implementations/IssueServiceImpl.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/services/implementations/IssueServiceImpl.java 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/src/main/java/org/itracker/services/implementations/IssueServiceImpl.java 2009-03-21 18:01:36 UTC (rev 2196)
@@ -1677,7 +1677,7 @@
*/
public Long getAllIssueAttachmentSize() {
- return getIssueAttachmentDAO().countAll().longValue();
+ return getIssueAttachmentDAO().totalAttachmentsSize().longValue() / 1024;
}
Modified: itracker/trunk/src/main/java/org/itracker/services/util/HTMLUtilities.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/services/util/HTMLUtilities.java 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/src/main/java/org/itracker/services/util/HTMLUtilities.java 2009-03-21 18:01:36 UTC (rev 2196)
@@ -1,163 +1,189 @@
-/*
- * This software was designed and created by Jason Carroll.
- * Copyright (c) 2002, 2003, 2004 Jason Carroll.
- * The author can be reached at jca...@co...
- * ITracker website: http://www.cowsultants.com
- * ITracker forums: http://www.cowsultants.com/phpBB/index.php
- *
- * This program is free software; you can redistribute it and/or modify
- * it only under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-package org.itracker.services.util;
-
-import org.apache.log4j.Logger;
-import org.apache.oro.text.regex.MalformedPatternException;
-import org.apache.oro.text.regex.Pattern;
-import org.apache.oro.text.regex.PatternCompiler;
-import org.apache.oro.text.regex.Perl5Compiler;
-import org.apache.oro.text.regex.Perl5Matcher;
-import org.apache.oro.text.regex.Perl5Substitution;
-import org.apache.oro.text.regex.Util;
-
-public class HTMLUtilities {
-
- private static final Logger logger = Logger.getLogger(HTMLUtilities.class);
- private static Perl5Matcher matcher = new Perl5Matcher();
- private static PatternCompiler compiler = new Perl5Compiler();
- private static Pattern pattern = null;
-
- static {
- try {
- pattern = compiler.compile("<[\\w/].*?>", Perl5Compiler.CASE_INSENSITIVE_MASK);
- } catch(MalformedPatternException mpe) {
- logger.error("Invalid pattern in HTMLUtilities. " + mpe.getMessage());
- }
- }
-
- public static String removeQuotes(String input) {
- StringBuffer sb = new StringBuffer(input.length());
- int len = input.length();
- char c;
-
- for(int i = 0; i < len; i++) {
- c = input.charAt(i);
- if (c == '\'') {
- sb.append("''");
- } else {
- sb.append(c);
- }
- }
- return sb.toString();
- }
-
- public static String handleQuotes(String input) {
- if(input == null || "".equals(input) || input.indexOf('"') == -1) {
- return input;
- }
-
- StringBuffer buf = new StringBuffer();
-
- char[] chars = input.toCharArray();
- for(int i = 0; i < chars.length; i++) {
- if(chars[i] == '"') {
- buf.append(""");
- } else {
- buf.append(chars[i]);
- }
- }
-
- return buf.toString();
- }
-
- public static String escapeNewlines(String input) {
- if(input == null || "".equals(input) || input.indexOf('\n') == -1) {
- return input;
- }
-
- StringBuffer buf = new StringBuffer();
- char[] chars = input.toCharArray();
- for(int i = 0; i < chars.length; i++) {
- if(chars[i] == '\r') {
- continue;
- } else if(chars[i] == '\n') {
- buf.append("\\n");
- } else {
- buf.append(chars[i]);
- }
- }
- return buf.toString();
- }
-
- public static String newlinesToBreaks(String input) {
- if(input == null || "".equals(input) || input.indexOf('\n') == -1) {
- return input;
- }
-
- StringBuffer buf = new StringBuffer();
- char[] chars = input.toCharArray();
- for(int i = 0; i < chars.length; i++) {
- if(chars[i] == '\r') {
- continue;
- } else if(chars[i] == '\n') {
- buf.append("<br>");
- } else {
- buf.append(chars[i]);
- }
- }
- return buf.toString();
- }
-
- public static String removeMarkup(String input) {
- String output = (input == null ? "" : input);
-
- if(pattern != null && matcher != null && output != null && ! output.equals("")) {
- output = Util.substitute(matcher, pattern, new Perl5Substitution(), output, Util.SUBSTITUTE_ALL);
- } else {
- logger.debug("Failed removing markup. Pattern = " + pattern + " Output = " + output);
- }
-
- return output;
- }
-
- public static String escapeTags(String input) {
- StringBuffer sb = new StringBuffer(input.length());
- int len = input.length();
- char c;
-
- for(int i = 0; i < len; i++) {
- c = input.charAt(i);
- if (c == '"') {
- sb.append(""");
- } else if (c == '&') {
- sb.append("&");
- } else if (c == '<') {
- sb.append("<");
- } else if (c == '>') {
- sb.append(">");
- } else {
- int ci = 0xffff & c;
- if (ci < 160 ) {
- // nothing special only 7 Bit
- sb.append(c);
- } else {
- // Not 7 Bit use the unicode system
- sb.append("&#");
- sb.append(new Integer(ci).toString());
- sb.append(';');
- }
- }
- }
-
- return sb.toString();
- }
-}
-
+/*
+ * This software was designed and created by Jason Carroll.
+ * Copyright (c) 2002, 2003, 2004 Jason Carroll.
+ * The author can be reached at jca...@co...
+ * ITracker website: http://www.cowsultants.com
+ * ITracker forums: http://www.cowsultants.com/phpBB/index.php
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it only under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+package org.itracker.services.util;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.StringTokenizer;
+
+import org.apache.log4j.Logger;
+import org.apache.oro.text.regex.MalformedPatternException;
+import org.apache.oro.text.regex.Pattern;
+import org.apache.oro.text.regex.PatternCompiler;
+import org.apache.oro.text.regex.Perl5Compiler;
+import org.apache.oro.text.regex.Perl5Matcher;
+import org.apache.oro.text.regex.Perl5Substitution;
+import org.apache.oro.text.regex.Util;
+
+public class HTMLUtilities {
+
+ private static final Logger logger = Logger.getLogger(HTMLUtilities.class);
+ private static Perl5Matcher matcher = new Perl5Matcher();
+ private static PatternCompiler compiler = new Perl5Compiler();
+ private static Pattern pattern = null;
+
+ static {
+ try {
+ pattern = compiler.compile("<[\\w/].*?>", Perl5Compiler.CASE_INSENSITIVE_MASK);
+ } catch(MalformedPatternException mpe) {
+ logger.error("Invalid pattern in HTMLUtilities. " + mpe.getMessage());
+ }
+ }
+
+ public static String removeQuotes(String input) {
+ StringBuffer sb = new StringBuffer(input.length());
+ int len = input.length();
+ char c;
+
+ for(int i = 0; i < len; i++) {
+ c = input.charAt(i);
+ if (c == '\'') {
+ sb.append("''");
+ } else {
+ sb.append(c);
+ }
+ }
+ return sb.toString();
+ }
+
+ public static String handleQuotes(String input) {
+ if(input == null || "".equals(input) || input.indexOf('"') == -1) {
+ return input;
+ }
+
+ StringBuffer buf = new StringBuffer();
+
+ char[] chars = input.toCharArray();
+ for(int i = 0; i < chars.length; i++) {
+ if(chars[i] == '"') {
+ buf.append(""");
+ } else {
+ buf.append(chars[i]);
+ }
+ }
+
+ return buf.toString();
+ }
+
+ public static String escapeNewlines(String input) {
+ if(input == null || "".equals(input) || input.indexOf('\n') == -1) {
+ return input;
+ }
+
+ StringBuffer buf = new StringBuffer();
+ char[] chars = input.toCharArray();
+ for(int i = 0; i < chars.length; i++) {
+ if(chars[i] == '\r') {
+ continue;
+ } else if(chars[i] == '\n') {
+ buf.append("\\n");
+ } else {
+ buf.append(chars[i]);
+ }
+ }
+ return buf.toString();
+ }
+
+ public static String newlinesToBreaks(String input) {
+ if(input == null || "".equals(input) || input.indexOf('\n') == -1) {
+ return input;
+ }
+
+ StringBuffer buf = new StringBuffer();
+ char[] chars = input.toCharArray();
+ for(int i = 0; i < chars.length; i++) {
+ if(chars[i] == '\r') {
+ continue;
+ } else if(chars[i] == '\n') {
+ buf.append("<br>");
+ } else {
+ buf.append(chars[i]);
+ }
+ }
+ return buf.toString();
+ }
+
+ public static String removeMarkup(String input) {
+ String output = (input == null ? "" : input);
+
+ if(pattern != null && matcher != null && output != null && ! output.equals("")) {
+ output = Util.substitute(matcher, pattern, new Perl5Substitution(), output, Util.SUBSTITUTE_ALL);
+ } else {
+ logger.debug("Failed removing markup. Pattern = " + pattern + " Output = " + output);
+ }
+
+ return output;
+ }
+
+ public static String escapeTags(String input) {
+ StringBuffer sb = new StringBuffer(input.length());
+ int len = input.length();
+ char c;
+
+ for(int i = 0; i < len; i++) {
+ c = input.charAt(i);
+ if (c == '"') {
+ sb.append(""");
+ } else if (c == '&') {
+ sb.append("&");
+ } else if (c == '<') {
+ sb.append("<");
+ } else if (c == '>') {
+ sb.append(">");
+ } else {
+ int ci = 0xffff & c;
+ if (ci < 160 ) {
+ // nothing special only 7 Bit
+ sb.append(c);
+ } else {
+ // Not 7 Bit use the unicode system
+ sb.append("&#");
+ sb.append(new Integer(ci).toString());
+ sb.append(';');
+ }
+ }
+ }
+
+ return sb.toString();
+ }
+
+ /**
+ * format a itracker date format for scal datepicker
+ *
+ * @see http://scal.fieldguidetoprogrammers.com
+ *
+ * @param format
+ * @return
+ */
+ public static final String getJSDateFormat(String format) {
+
+
+ String f = format.replace('m', 'n');
+
+
+ f = format.toLowerCase();
+
+ return f;
+
+
+ }
+
+}
+
\ No newline at end of file
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/admin/AdminHomeAction.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/admin/AdminHomeAction.java 2009-03-18 18:40:30 UTC (rev 2195)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/admin/AdminHomeAction.java 2009-03-21 18:01:36 UTC (rev 2196)
@@ -1,176 +1,212 @@
-package org.itracker.web.actions.admin;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.Set;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.struts.action.ActionForm;
-import org.apache.struts.action.ActionForward;
-import org.apache.struts.action.ActionMapping;
-import org.itracker.model.PermissionType;
-import org.itracker.services.ConfigurationService;
-import org.itracker.services.IssueService;
-import org.itracker.services.ProjectService;
-import org.itracker.services.util.ReportUtilities;
-import org.itracker.services.util.SystemConfigurationUtilities;
-import org.itracker.services.util.UserUtilities;
-import org.itracker.web.actions.base.ItrackerBaseAction;
-import org.itracker.web.util.RequestHelper;
-import org.itracker.web.util.ServletContextUtils;
-import org.itracker.web.util.SessionManager;
-
-public class AdminHomeAction extends ItrackerBaseAction {
-
- private static final Logger log = Logger.getLogger(AdminHomeAction.class);
-
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request, HttpServletResponse response)
- throws Exception {
- final Map<Integer, Set<PermissionType>> permissions = RequestHelper
- .getUserPermissions(request.getSession());
-
-
-
- if (!UserUtilities.hasPermission(permissions,
- UserUtilities.PERMISSION_USER_ADMIN)) {
-
- mapping.findForward("listprojectadmin");
- }
-
- execSetupJspEnv(request);
-
- return mapping.findForward("adminhome");
- }
-
-
- /**
- * This utility has to be called for any page forwarding to the admin-home, before forwarding. Else the page will contain no data.
- *
- * @param request
- */
- public static final void execSetupJspEnv(HttpServletRequest request) {
- Date time_millies = new Date(System.currentTimeMillis());
- // super.executeAlways(mapping, form, request, response);
-
- IssueService issueService = ServletContextUtils.getItrackerServices()
- .getIssueService();
-// ProjectService projectService = ServletContextUtils.getItrackerServices()
-// .getProjectService();
-// ReportService reportService = ServletContextUtils.getItrackerServices()
-// .getReportService();
- ConfigurationService configurationService = ServletContextUtils.getItrackerServices()
- .getConfigurationService();
-// UserService userService = ServletContextUtils.getItrackerServices().getUserService();
-
-
- ProjectService projectService2 = ServletContextUtils
- .getItrackerServices().getProjectService();
-
- String exportReport = "type=all&reportOutput=XML&reportId="
- + ReportUtilities.REPORT_EXPORT_XML;
-
- logTimeMillies("execute: looked up services", time_millies, log,
- Level.INFO);
- Integer numberOfWorkflowScripts = configurationService
- .getWorkflowScripts().size();
- request
- .setAttribute("numberOfWorkflowScripts",
- numberOfWorkflowScripts);
- logTimeMillies("execute: looked up numberOfWorkflowScripts",
- time_millies, log, Level.INFO);
-
- Integer numberDefinedKeys = configurationService
- .getNumberDefinedKeys(null);
- request.setAttribute("numberDefinedKeys", numberDefinedKeys);
- logTimeMillies("execute: looked up numberDefinedKeys", time_millies,
- log, Level.INFO);
-
- Integer numberOfStatuses = configurationService
- .getConfigurationItemsByType(
- SystemConfigurationUtilities.TYPE_STATUS).size();
- request.setAttribute("numberOfStatuses", numberOfStatuses);
- logTimeMillies("execute: looked up numberOfStatuses", time_millies,
- log, Level.INFO);
-
- Integer numberOfSeverities = configurationService
- .getConfigurationItemsByType(
- SystemConfigurationUtilities.TYPE_SEVERITY).size();
- request.setAttribute("numberOfSeverities", numberOfSeverities);
- logTimeMillies("execute: looked up numberOfSeverities", time_millies,
- log, Level.INFO);
-
- Integer numberOfResolutions = configurationService
- .getConfigurationItemsByType(
- SystemConfigurationUtilities.TYPE_RESOLUTION).size();
- request.setAttribute("numberOfResolutions", numberOfResolutions);
- logTimeMillies("execute: looked up numberOfResolutions", time_millies,
- log, Level.INFO);
-
- Integer numberOfCustomProjectFields = configurationService
- .getCustomFields().size();
- request.setAttribute("numberOfCustomProjectFields",
- numberOfCustomProjectFields);
- logTimeMillies("execute: looked up numberOfCustomProjectFields",
- time_millies, log, Level.INFO);
-
- Integer numberofActiveSesssions = SessionManager.getNumActiveSessions();
- request
- .setAttribute("numberofActiveSesssions",
- numberofActiveSesssions);
- logTimeMillies("execute: looked up numberofActiveSesssions",
- time_millies, log, Level.INFO);
-
- Long allIssueAttachmentsTotalNumber = issueService
- .getAllIssueAttachmentCount();
- request.setAttribute("allIssueAttachmentsTotalNumber",
- allIssueAttachmentsTotalNumber);
- logTimeMillies("execute: looked up allIssueAttachmentsTotalNumber",
- time_millies, log, Level.INFO);
-
- // TODO: performance issue when attachments size needs to be calculated
- // over many issues !
- // select sum(size...
[truncated message content] |
|
From: <ra...@us...> - 2009-03-18 18:40:45
|
Revision: 2195
http://itracker.svn.sourceforge.net/itracker/?rev=2195&view=rev
Author: ranks
Date: 2009-03-18 18:40:30 +0000 (Wed, 18 Mar 2009)
Log Message:
-----------
fixing invalid substitutions
Modified Paths:
--------------
itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_zh_TW.properties
Modified: itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_zh_TW.properties
===================================================================
--- itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_zh_TW.properties 2009-03-14 17:22:44 UTC (rev 2194)
+++ itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_zh_TW.properties 2009-03-18 18:40:30 UTC (rev 2195)
@@ -106,8 +106,8 @@
itracker.web.admin.editcustomfield.title.update=\u7DE8\u8F2F\u81EA\u8A02\u6B04\u4F4D
itracker.web.admin.editcustomfieldvalue.title.create=\u5EFA\u7ACB\u65B0\u7684\u81EA\u8A02\u6B04\u4F4D
itracker.web.admin.editcustomfieldvalue.title.update=\u7DE8\u8F2F\u81EA\u8A02\u6B04\u4F4D
-itracker.web.admin.editlanguage.title.create=\u5EFA\u7ACB {} \u4E4B\u8A9E\u8A00/\u5730\u5340\u8A2D\u5B9A
-itracker.web.admin.editlanguage.title.update=\u7DE8\u8F2F {} \u4E4B\u8A9E\u8A00/\u5730\u5340\u8A2D\u5B9A
+itracker.web.admin.editlanguage.title.create=\u5EFA\u7ACB {0} \u4E4B\u8A9E\u8A00/\u5730\u5340\u8A2D\u5B9A
+itracker.web.admin.editlanguage.title.update=\u7DE8\u8F2F {0} \u4E4B\u8A9E\u8A00/\u5730\u5340\u8A2D\u5B9A
itracker.web.admin.editproject.addusers=\u65B0\u589E\u4F7F\u7528\u8005
itracker.web.admin.editproject.options=\u5C08\u6848\u9078\u9805
itracker.web.admin.editproject.options.noattach=\u4E0D\u5141\u8A31\u4E0A\u50B3\u9644\u4EF6
@@ -374,8 +374,8 @@
itracker.web.error.validate.date={0} \u4E0D\u662F\u500B\u6709\u6548\u65E5\u671F
itracker.web.error.validate.email={0} \u4E0D\u662F\u6709\u6548\u7684email\u4F4F\u5740
itracker.web.error.validate.invalid={0} \u4E0D\u5408\u6CD5
-itracker.web.error.validate.maxlength={0} \u4E0D\u53EF\u8D85\u904E {} \u500B\u5B57\u3002
-itracker.web.error.validate.minlength={0} \u4E0D\u53EF\u5C11\u65BC {} \u500B\u5B57\u3002
+itracker.web.error.validate.maxlength={0} \u4E0D\u53EF\u8D85\u904E {1} \u500B\u5B57\u3002
+itracker.web.error.validate.minlength={0} \u4E0D\u53EF\u5C11\u65BC {1} \u500B\u5B57\u3002
itracker.web.error.validate.number={0} \u70BA\u4E0D\u5408\u6CD5\u7684\u6578\u5B57\u3002
itracker.web.error.validate.required={0} \u5FC5\u586B\u3002
itracker.web.error.wrongpassword=\u5BC6\u78BC\u932F\u8AA4\u3002
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-14 17:22:56
|
Revision: 2194
http://itracker.svn.sourceforge.net/itracker/?rev=2194&view=rev
Author: ranks
Date: 2009-03-14 17:22:44 +0000 (Sat, 14 Mar 2009)
Log Message:
-----------
fix site style in left navigation
Modified Paths:
--------------
itracker-skin/trunk/src/main/resources/css/maven-theme.css
Modified: itracker-skin/trunk/src/main/resources/css/maven-theme.css
===================================================================
--- itracker-skin/trunk/src/main/resources/css/maven-theme.css 2009-03-14 16:47:25 UTC (rev 2193)
+++ itracker-skin/trunk/src/main/resources/css/maven-theme.css 2009-03-14 17:22:44 UTC (rev 2194)
@@ -106,7 +106,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
#navcolumn {
- background: url(../images/background.png) repeat-x fixed center top;
+ background: url(../images/background.png) repeat-x scroll center -180px;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-14 16:47:46
|
Revision: 2193
http://itracker.svn.sourceforge.net/itracker/?rev=2193&view=rev
Author: ranks
Date: 2009-03-14 16:47:25 +0000 (Sat, 14 Mar 2009)
Log Message:
-----------
failed test fixed, history is required when issue is created
Modified Paths:
--------------
itracker/trunk/src/test/java/org/itracker/selenium/CreateIssueTest.java
Modified: itracker/trunk/src/test/java/org/itracker/selenium/CreateIssueTest.java
===================================================================
--- itracker/trunk/src/test/java/org/itracker/selenium/CreateIssueTest.java 2009-03-12 14:06:41 UTC (rev 2192)
+++ itracker/trunk/src/test/java/org/itracker/selenium/CreateIssueTest.java 2009-03-14 16:47:25 UTC (rev 2193)
@@ -1,20 +1,26 @@
package org.itracker.selenium;
-import com.dumbster.smtp.SimpleSmtpServer;
-import com.dumbster.smtp.SmtpMessage;
import java.io.IOException;
import java.util.Iterator;
+
+import org.apache.log4j.Logger;
import org.itracker.model.User;
import org.itracker.persistence.dao.UserDAO;
import org.junit.Test;
+import com.dumbster.smtp.SimpleSmtpServer;
+import com.dumbster.smtp.SmtpMessage;
+
/**
* Verifies the functionality of new issue creation.
*
* @author Andrey Sergievskiy <se...@an...>
*/
public class CreateIssueTest extends AbstractSeleniumTestCase {
- /**
+
+ private static final Logger log = Logger.getLogger(CreateIssueTest.class);
+
+ /**
* 1. Login into the system with some particular user
* (admin_test1 in our case, which already has 4 issues, 2 of them
* are unassigned).
@@ -31,6 +37,10 @@
@Test
public void testCreateUnassignedIssue() throws IOException {
closeSession();
+
+ final String descriptionValue = "Issue to be assigned.";
+ final String historyValue = "Issue to be assigned history.";
+
selenium.open("http://" + applicationHost + ":" + applicationPort + "/"
+ applicationPath);
assertTrue(selenium.isElementPresent("//.[@name='login']"));
@@ -56,7 +66,9 @@
assertTrue(selenium.isElementPresent("severity"));
assertTrue(selenium.isElementPresent("versions"));
- selenium.type("//td[@id='description']/input", "Issue to be unassigned.");
+ selenium.type("//td[@id='description']/input", descriptionValue);
+ selenium.type("history", historyValue);
+
selenium.select("//td[@id='ownerId']/select", "value=-1");
final UserDAO userDao = (UserDAO)applicationContext.getBean("userDAO");
final User user = userDao.findByLogin("admin_test1");
@@ -65,29 +77,38 @@
selenium.select("//td[@id='creatorId']/select", "value=" + userId);
final SimpleSmtpServer smtpServer = SimpleSmtpServer.start(2525);
- selenium.click("//td[@id='submit']/input");
- selenium.waitForPageToLoad(SE_TIMEOUT);
- assertEquals(smtpServer.getReceivedEmailSize(), 1);
- final Iterator<SmtpMessage> iter =
- (Iterator<SmtpMessage>)smtpServer.getReceivedEmail();
- // Checking email notification for creator.
- final SmtpMessage smtpMessage1 = iter.next();
- final String smtpMessageBody1 = smtpMessage1.getBody();
- assertTrue(smtpMessageBody1.contains("Issue to be unassigned."));
- smtpServer.stop();
+ try {
+ selenium.click("//td[@id='submit']/input");
+ selenium.waitForPageToLoad(SE_TIMEOUT);
+ assertEquals("sent notifications", 1, smtpServer.getReceivedEmailSize());
+ final Iterator<SmtpMessage> iter =
+ (Iterator<SmtpMessage>)smtpServer.getReceivedEmail();
+ // Checking email notification for creator.
+ final SmtpMessage smtpMessage1 = iter.next();
+ log.info("testCreateUnassignedIssue, raw:\n" + smtpMessage1.getBody());
+ final String smtpMessageBody1 = smtpMessage1.getBody();
+ log.info("testCreateUnassignedIssue, received:\n" + smtpMessageBody1);
+ assertTrue(smtpMessageBody1.contains(descriptionValue));
+ assertTrue(smtpMessageBody1.contains(historyValue));
+ } finally {
+ smtpServer.stop();
+ }
+
+
+
// Check that the total number of issues is 5 now (4 from db + 1 our).
assertTrue(selenium.isElementPresent("issues"));
assertEquals(5, selenium.getXpathCount("//tr[starts-with(@id, 'issue.')]"));
- assertTrue(selenium.isElementPresent("//tr[starts-with(@id, 'issue.')]/td[11][text()='Issue to be unassigned.']"));
+ assertTrue(selenium.isElementPresent("//tr[starts-with(@id, 'issue.')]/td[11][text()='" + descriptionValue + "']"));
selenium.open("http://" + applicationHost + ":" + applicationPort + "/"
+ applicationPath + "/portalhome.do");
// Check that just created issue has appeared in "Unassigned" area.
- assertTrue(selenium.isElementPresent("//tr[starts-with(@id,'unassignedIssue.')]/td[5][text()='test_name']/../td[11][text()='Issue to be unassigned.']"));
+ assertTrue(selenium.isElementPresent("//tr[starts-with(@id,'unassignedIssue.')]/td[5][text()='test_name']/../td[11][text()='" + descriptionValue + "']"));
// Check that just created issue has appeared in "Created" area.
- assertTrue(selenium.isElementPresent("xpath=//tr[starts-with(@id,'createdIssue.')]/td[5][text()='test_name']/../td[11][text()='Issue to be unassigned.']"));
+ assertTrue(selenium.isElementPresent("xpath=//tr[starts-with(@id,'createdIssue.')]/td[5][text()='test_name']/../td[11][text()='" + descriptionValue + "']"));
// Check that number of watched items is 0.
assertEquals(0, selenium.getXpathCount("//tr[starts-with(@id, 'watchedIssue.')]"));
@@ -100,6 +121,10 @@
@Test
public void testCreateAssignedIssue() throws IOException {
closeSession();
+
+ final String descriptionValue = "Issue to be unassigned.";
+ final String historyValue = "Issue to be unassigned history.";
+
selenium.open("http://" + applicationHost + ":" + applicationPort + "/"
+ applicationPath);
assertTrue(selenium.isElementPresent("//.[@name='login']"));
@@ -124,43 +149,50 @@
assertTrue(selenium.isElementPresent("creatorId"));
assertTrue(selenium.isElementPresent("severity"));
assertTrue(selenium.isElementPresent("versions"));
+
- selenium.type("//td[@id='description']/input", "Issue to be assigned.");
+ selenium.type("//input[@name='description']", descriptionValue);
+ selenium.type("history", historyValue);
final UserDAO userDao = (UserDAO)applicationContext.getBean("userDAO");
final User user = userDao.findByLogin("admin_test1");
assertTrue(null != user);
final long userId = user.getId();
selenium.select("//td[@id='ownerId']/select", "value=" + userId);
selenium.select("//td[@id='creatorId']/select", "value=" + userId);
-
final SimpleSmtpServer smtpServer = SimpleSmtpServer.start(2525);
- selenium.click("//td[@id='submit']/input");
- selenium.waitForPageToLoad(SE_TIMEOUT);
- assertEquals(smtpServer.getReceivedEmailSize(), 2);
- final Iterator<SmtpMessage> iter =
- (Iterator<SmtpMessage>)smtpServer.getReceivedEmail();
- // Checking email notification for creator.
- final SmtpMessage smtpMessage1 = iter.next();
- final String smtpMessageBody1 = smtpMessage1.getBody();
- assertTrue(smtpMessageBody1.contains("Issue to be assigned."));
- // Checking email notification for owner.
- final SmtpMessage smtpMessage2 = iter.next();
- final String smtpMessageBody2 = smtpMessage2.getBody();
- assertTrue(smtpMessageBody2.contains("Issue to be assigned."));
- smtpServer.stop();
-
+ try {
+ selenium.click("//td[@id='submit']/input");
+ selenium.waitForPageToLoad(SE_TIMEOUT);
+ assertEquals("sent notifications", 2, smtpServer.getReceivedEmailSize());
+ final Iterator<SmtpMessage> iter =
+ (Iterator<SmtpMessage>)smtpServer.getReceivedEmail();
+ // Checking email notification for creator.
+ final SmtpMessage smtpMessage1 = iter.next();
+ log.info("testCreateAssignedIssue, raw:\n " + smtpMessage1.getBody());
+ final String smtpMessageBody1 = smtpMessage1.getBody();
+ log.info("testCreateAssignedIssue, received:\n " + smtpMessageBody1);
+ assertTrue(smtpMessageBody1.contains(descriptionValue));
+ assertTrue(smtpMessageBody1.contains(historyValue));
+ // Checking email notification for owner.
+ final SmtpMessage smtpMessage2 = iter.next();
+ final String smtpMessageBody2 = smtpMessage2.getBody();
+ assertTrue(smtpMessageBody2.contains(descriptionValue));
+ assertTrue(smtpMessageBody2.contains(historyValue));
+ } finally {
+ smtpServer.stop();
+ }
// Checking that our new issue has appeared in "View Issues".
assertTrue(selenium.isElementPresent("issues"));
assertEquals(5, selenium.getXpathCount("//tr[starts-with(@id, 'issue.')]"));
- assertTrue(selenium.isElementPresent("//tr[starts-with(@id, 'issue.')]/td[11][text()='Issue to be assigned.']"));
+ assertTrue(selenium.isElementPresent("//tr[starts-with(@id, 'issue.')]/td[11][text()='" + descriptionValue + "']"));
selenium.open("http://" + applicationHost + ":" + applicationPort + "/"
+ applicationPath + "/portalhome.do");
// Checking that our new issue has not appeared in "Unassigned" area.
- assertFalse(selenium.isElementPresent("//tr[starts-with(@id,'unassignedIssue.')]/td[5][text()='test_name']/../td[11][text()='Issue to be assigned.']"));
+ assertFalse(selenium.isElementPresent("//tr[starts-with(@id,'unassignedIssue.')]/td[5][text()='test_name']/../td[11][text()='" + descriptionValue + "']"));
// Checking that our new issue has appeared in "Created" area.
- assertTrue(selenium.isElementPresent("//tr[starts-with(@id,'createdIssue.')]/td[5][text()='test_name']/../td[11][text()='Issue to be assigned.']"));
+ assertTrue(selenium.isElementPresent("//tr[starts-with(@id,'createdIssue.')]/td[5][text()='test_name']/../td[11][text()='" + descriptionValue + "']"));
// Check that "Watched" area is still empty.
assertEquals(0, selenium.getXpathCount("//tr[starts-with(@id, 'watchedIssue.')]"));
@@ -183,6 +215,8 @@
};
}
+
+
@Override
protected String[] getConfigLocations() {
return new String[]{ "application-context.xml"};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rap...@us...> - 2009-03-12 14:06:59
|
Revision: 2192
http://itracker.svn.sourceforge.net/itracker/?rev=2192&view=rev
Author: raptor-rosa
Date: 2009-03-12 14:06:41 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Added install and configuration documentations
Modified Paths:
--------------
itracker/trunk/src/site/site.xml
Added Paths:
-----------
itracker/trunk/src/site/xdoc/configuration.xml
itracker/trunk/src/site/xdoc/install.xml
Modified: itracker/trunk/src/site/site.xml
===================================================================
--- itracker/trunk/src/site/site.xml 2009-03-12 13:13:53 UTC (rev 2191)
+++ itracker/trunk/src/site/site.xml 2009-03-12 14:06:41 UTC (rev 2192)
@@ -64,8 +64,15 @@
<item name="3.0 Release Notes" href="/release-notes/itracker-3.0-stable.html" />
+
+
+ <item name="Install" href="/install.html"/>
+ <item name="Configuration" href="/configuration.html"/>
+
+ <item name="Data Migration from 2.4" href="/migration/migrate2.4-3.0.html" />
+
<item name="Screenshots" href="/screenshots/screenshots.html"/>
- <item name="Data Migration from 2.4" href="/migration/migrate2.4-3.0.html" />
+
</menu>
<!--
TODO
Added: itracker/trunk/src/site/xdoc/configuration.xml
===================================================================
--- itracker/trunk/src/site/xdoc/configuration.xml (rev 0)
+++ itracker/trunk/src/site/xdoc/configuration.xml 2009-03-12 14:06:41 UTC (rev 2192)
@@ -0,0 +1,140 @@
+<?xml version="1.0"?>
+<document>
+
+ <properties>
+ <title>Application Configuration</title>
+ </properties>
+
+ <body>
+
+ <section name="Configuration">
+There are some properties which you're able to configure for your itracker
+ <ul>
+
+ <li><strong>system_base_url</strong>:
+This property can be used to override the url determined dynamically
+by the system when a user submits an issue or self registers. This
+is mainly due to some users using private domain names that wouldn't
+be accessible to all recipiants of a notification email. This
+property is only used to create urls in emails sent to all users.
+<br /><em>default: http://localhost:8080/itracker</em>
+
+ </li>
+
+ <li><strong>jndi_override_prefix</strong>
+This property can be used to override the configuration properties
+by JNDI values e.g. exposed by the container of the application in a
+certain context
+default: don't lookup JNDI for override values
+<br /><em>default: java:comp/env/itracker</em>
+ </li>
+
+ <li><strong>mail_session_jndi_lookup</strong>
+This property defines a JNDI lookup for the mail session of the
+itracker system.
+default: don't use mailsession, instead use defined notification_smtp_host
+otification_smtp_userid and notification_smtp_password
+<br /><em>default: java:comp/env/itracker/mail/Session</em>
+ </li>
+
+ <li><strong>web_session_timeout</strong>
+This property can be used to set the web session inactivity timeout.
+This number is the number of minutes that can elapse before the users
+session times out due to inactivity.
+<br /><em>default: 30 minutes</em>
+ </li>
+
+ <li><strong>alternate_logo</strong>
+Set this if you wish to use an alternate image logo in the header of all
+pages. It must be a resolvable url. (type : String)
+<br /><em>default: /images/logo.gif</em>
+ </li>
+
+ <li><strong>default_locale</strong>
+Set to the default locale of the server. This controls the default language
+for users after they are logged in, and also the language of the login
+page before they are logged in. This HAVE TO be in the format
+language_country (eg. en_US, de_DE, pt_PT, it_IT) (type : String)
+<br /><em>default: en_US</em> </li>
+
+ <li><strong>create_super_user</strong>
+Set to true to create a default admin user if no other users exist in the
+database (type : Boolean)
+<br /><em>default: true</em>
+ </li>
+
+ <li><strong>allow_forgot_password</strong>
+Set to true to allow users to recover their passwords (type : Boolean)
+<br /><em>default: true</em>
+ </li>
+
+ <li><strong>allow_self_register</strong>
+Set to true to allow users to self register for your sever. This is a global
+setting that must be enabled for the project level options to be effective. If
+enabled, you must then go into each project you want accessible to self registered
+users, and which permissiosn you want. Currently only create and view all are
+available (view own is automatically granted), if you want other permissions, you
+must grant them using the normal user administration procedures. (type : Boolean)
+<br /><em>default: true</em>
+ </li>
+
+ <li><strong>allow_save_login</strong>
+Set to true to allow users to save their login in a cookie on their machine
+for auto login. Setting this to false will not allow any user on the system
+to use this feature. (type : Boolean)
+<br /><em>default: true</em>
+ </li>
+
+ <li><strong>authenticator_class</strong>
+This parameter sets the class to u- notification_smtp_passwordse for authentication. The class must be resident
+in the classpath that the ear is loaded in, and extend the
+org.itracker.services.authentication.PluggableAuthenticator abstract class. (type : String)
+<br /><em>default: Default-Authenticator</em>
+ </li>
+
+ <li><strong>notification_from_address</strong>
+From address for email notifications to use
+<br /><em>default: itracker@localhost</em>
+ </li>
+
+ <li><strong>notification_from_text</strong>
+From address text for email notifications to use
+<br /><em>default: ITracker Notification System</em>
+ </li>
+
+ <li><strong>notification_replyto_address</strong>
+ReplyTo address for email notifications to use
+<br /><em>default: itracker@localhost</em>
+ </li>
+
+ <li><strong>notification_smtp_host</strong>
+SMTP hostname for email notifications to use
+<br /><em>default: localhost</em>
+ </li>
+
+ <li><strong>notification_smtp_charset</strong>
+SMTP notificate character set. You might need to change this for
+some locales
+<br /><em>default: ISO-8859-1</em>
+ </li>
+
+ <li><strong>notification_smtp_password and notification_smtp_userid</strong>
+SMTP authentication userid and password if required by
+your application server
+<br />
+ </li>
+
+ <li><strong>max_attachment_size</strong>
+The maximum size of an individual issue attachment in kb.
+<br /><em>default: 512</em>
+ </li>
+
+ <li><strong>max_total_attachment_size</strong>
+The maximum total size of all attachments in kb.
+<br /><em>default: 100000</em>
+ </li>
+
+ </ul>
+ </section>
+ </body>
+</document>
Added: itracker/trunk/src/site/xdoc/install.xml
===================================================================
--- itracker/trunk/src/site/xdoc/install.xml (rev 0)
+++ itracker/trunk/src/site/xdoc/install.xml 2009-03-12 14:06:41 UTC (rev 2192)
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<document>
+
+ <properties>
+ <title>About itracker</title>
+ </properties>
+
+ <body>
+
+ <section name="Install itracker">
+ <ol>
+
+
+ <li>First you have to download and install Apache Tomcat-6 you can do this here: <a href="Download" rel="nofollow">http://tomcat.apache.org/download-60.cgi">Download Tomcat-6</a>
+If you need more instructions about Tomcat-6 take a look at this site: <a href="Information" rel="nofollow">http://tomcat.apache.org/">Information Tomcat-6</a></li>
+
+ <li>After installing Tomcat-6 you have to set up an empty mysql database for your itracker.
+If you need more instructions about Mysql take a look at this site:<a href= "Mysql" rel="nofollow">http://www.mysql.com/">Mysql</a></li>
+
+ <li>If you have all this requirements resolved, download the binary itracker file on Sourceforge. Extract it and copy the <code>itracker.war</code> file to <code>$TOMCAT_HOME/webapps</code> folder</li>
+
+ <li>You can update configurations in tomcat/webapps/itracker folder:
+ <ul>
+ <li>
+ Database Connection configuration you will find in "WEB-INF/classes/application.properties".
+ </li>
+ <li>
+
+ The Application settings are in this file:WEB-INF/configuration.properties.
+ </li>
+ </ul>
+ </li>
+
+ <li>If you have finished the configuration restart the tomcat application to change your settings. You should be able to open the url <a href="http://localhost:8080/itracker">itracker on localhost port 8080</a>
+ </li>
+
+
+
+
+ </ol>
+ </section>
+ </body>
+</document>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-12 13:13:55
|
Revision: 2191
http://itracker.svn.sourceforge.net/itracker/?rev=2191&view=rev
Author: ranks
Date: 2009-03-12 13:13:53 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
fixing encoding of filtering properties resources (defined as iso-8859-1)
Modified Paths:
--------------
itracker/trunk/pom.xml
Modified: itracker/trunk/pom.xml
===================================================================
--- itracker/trunk/pom.xml 2009-03-12 08:41:38 UTC (rev 2190)
+++ itracker/trunk/pom.xml 2009-03-12 13:13:53 UTC (rev 2191)
@@ -266,6 +266,13 @@
<update>true</update>
</configuration>
</plugin>
+ <plugin>
+ <!--groupId>org.apache.maven.plugins</groupId-->
+ <artifactId>maven-resources-plugin</artifactId>
+ <configuration>
+ <encoding>ISO-8859-1</encoding>
+ </configuration>
+ </plugin>
</plugins>
</build>
<repositories>
@@ -707,7 +714,8 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
- <version>1.0-rc-1</version> <executions>
+ <version>1.0-rc-1</version>
+ <executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rap...@us...> - 2009-03-12 08:41:48
|
Revision: 2190
http://itracker.svn.sourceforge.net/itracker/?rev=2190&view=rev
Author: raptor-rosa
Date: 2009-03-12 08:41:38 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
Added Piwiki to template
Modified Paths:
--------------
itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm
Modified: itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm
===================================================================
--- itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm 2009-03-12 08:18:12 UTC (rev 2189)
+++ itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm 2009-03-12 08:41:38 UTC (rev 2190)
@@ -399,6 +399,17 @@
<div id="credit">
<a title="R.Ø.S.A." target="_blank" href="http://www.rosa.com">
<img width="7" height="31" alt="R.Ø.S.A." src="images/rosa.gif"/>
- </a>
+ </a>
+ <!-- Piwik -->
+ <script type="text/javascript">var pkBaseURL = (("https:" == document.location.protocol) ? "https://apps.sourceforge.net/piwik/itracker/" : "http://apps.sourceforge.net/piwik/itracker/");document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
+ </script>
+ <script type="text/javascript">piwik_action_name = '';piwik_idsite = 1;piwik_url = pkBaseURL + "piwik.php";piwik_log(piwik_action_name, piwik_idsite, piwik_url);
+ </script>
+ <object>
+ <noscript>
+ <p><img src="http://apps.sourceforge.net/piwik/itracker/piwik.php?idsite=1" alt="piwik"/>
+ </p>
+ </noscript>
+ </object><!-- End Piwik Tag -->
</body>
</html>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-12 08:18:25
|
Revision: 2189
http://itracker.svn.sourceforge.net/itracker/?rev=2189&view=rev
Author: ranks
Date: 2009-03-12 08:18:12 +0000 (Thu, 12 Mar 2009)
Log Message:
-----------
fixing deployment on tomcat to re-deploy if necessery, deploy otherwise.
Modified Paths:
--------------
itracker/trunk/pom.xml
Modified: itracker/trunk/pom.xml
===================================================================
--- itracker/trunk/pom.xml 2009-03-11 18:35:07 UTC (rev 2188)
+++ itracker/trunk/pom.xml 2009-03-12 08:18:12 UTC (rev 2189)
@@ -263,6 +263,7 @@
<server>localhost</server>
<url>http://localhost:8080/manager</url>
<path>/itracker</path>
+ <update>true</update>
</configuration>
</plugin>
</plugins>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-11 18:35:13
|
Revision: 2188
http://itracker.svn.sourceforge.net/itracker/?rev=2188&view=rev
Author: ranks
Date: 2009-03-11 18:35:07 +0000 (Wed, 11 Mar 2009)
Log Message:
-----------
fixed customfield options ordering (list)
fixing edit issue - removed hard-wrap of history textarea
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldActionUtil.java
itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldFormAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/OrderCustomFieldValueAction.java
itracker/trunk/src/main/webapp/module-admin/admin_configuration/edit_customfield.jsp
itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldActionUtil.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldActionUtil.java 2009-03-11 17:31:34 UTC (rev 2187)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldActionUtil.java 2009-03-11 18:35:07 UTC (rev 2188)
@@ -2,15 +2,19 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.Dictionary;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
+import java.util.SortedMap;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
+import org.apache.commons.collections.MapUtils;
import org.apache.log4j.Logger;
import org.itracker.core.resources.ITrackerResources;
import org.itracker.model.CustomField;
@@ -20,6 +24,7 @@
import org.itracker.services.util.CustomFieldUtilities;
import org.itracker.web.forms.CustomFieldForm;
import org.itracker.web.util.Constants;
+import org.itracker.web.util.LoginUtilities;
import org.itracker.web.util.ServletContextUtils;
public class EditCustomFieldActionUtil {
@@ -30,7 +35,7 @@
ConfigurationService configurationService = ServletContextUtils
.getItrackerServices().getConfigurationService();
-
+ Locale currentLocale = LoginUtilities.getCurrentLocale(request);
CustomField customField = (CustomField) request.getSession().getAttribute(Constants.CUSTOMFIELD_KEY);
Map<String, List<String>> languages_map = configurationService.getAvailableLanguages();
@@ -77,7 +82,7 @@
NameValuePair languageNameValuePair = new NameValuePair(language,ITrackerResources.getString("itracker.locale.name", language));
languagesNameValuePair.put(languageNameValuePair, localesNameValuePair);
}
- request.setAttribute("sc", configurationService);
+// request.setAttribute("sc", configurationService);
HttpSession session = request.getSession();
String baseLocaleKey = "translations(" + ITrackerResources.BASE_LOCALE + ")";
@@ -87,14 +92,12 @@
if (logger.isDebugEnabled()) {
logger.debug("setRequestEnv: sorted values by sort order comparator: " + options);
}
- Map<CustomFieldValue, String> optionsMap = new TreeMap<CustomFieldValue, String>(CustomFieldValue.SORT_ORDER_COMPARATOR);
+
+ HashMap<Integer, String> optionsMap = new HashMap<Integer, String>();
for (CustomFieldValue option: options) {
- String optionName = CustomFieldUtilities.getCustomFieldOptionName(customField.getId(),option.getId());
- optionsMap.put(option, optionName);
+ String optionName = CustomFieldUtilities.getCustomFieldOptionName(customField.getId(),option.getId(), currentLocale);
+ optionsMap.put(option.getId(), optionName);
}
- if (logger.isDebugEnabled()) {
- logger.debug("setRequestEnv: sorted optionsMap by sort order comparator: " + optionsMap);
- }
String fieldTypeString = Integer.toString(CustomField.Type.STRING.getCode());
String fieldTypeInteger = Integer.toString(CustomField.Type.INTEGER.getCode());
@@ -117,6 +120,7 @@
request.setAttribute("baseLocaleKey", baseLocaleKey);
request.setAttribute("field", customField);
request.setAttribute("languagesNameValuePair", languagesNameValuePair);
+ request.setAttribute("options", options);
request.setAttribute("optionsMap", optionsMap);
}
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldFormAction.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldFormAction.java 2009-03-11 17:31:34 UTC (rev 2187)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/EditCustomFieldFormAction.java 2009-03-11 18:35:07 UTC (rev 2188)
@@ -81,8 +81,6 @@
if (customField == null)
throw new SystemConfigurationException("Invalid custom field id " + id);
-// customField.setName(CustomFieldUtilities.getCustomFieldName(id));
- customField.setOptions(customField.getOptions());
customFieldForm.setId(id);
customFieldForm.setFieldType(customField.getFieldType().getCode());
customFieldForm.setRequired(Boolean.toString(customField.isRequired()));
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/OrderCustomFieldValueAction.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/OrderCustomFieldValueAction.java 2009-03-11 17:31:34 UTC (rev 2187)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/admin/configuration/OrderCustomFieldValueAction.java 2009-03-11 18:35:07 UTC (rev 2188)
@@ -20,6 +20,8 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
@@ -41,143 +43,114 @@
import org.itracker.services.util.UserUtilities;
import org.itracker.web.actions.base.ItrackerBaseAction;
+public class OrderCustomFieldValueAction extends ItrackerBaseAction {
+ private static final Logger log = Logger
+ .getLogger(OrderCustomFieldValueAction.class);
+ public ActionForward execute(ActionMapping mapping, ActionForm form,
+ HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ ActionMessages errors = new ActionMessages();
-public class OrderCustomFieldValueAction extends ItrackerBaseAction {
- private static final Logger log = Logger.getLogger(OrderCustomFieldValueAction.class);
-
-
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- ActionMessages errors = new ActionMessages();
-
- if(! hasPermission(UserUtilities.PERMISSION_USER_ADMIN, request, response)) {
- return mapping.findForward("unauthorized");
- }
-
- try {
- ConfigurationService configurationService = getITrackerServices().getConfigurationService();
-
- Integer customFieldValueId = (Integer) PropertyUtils.getSimpleProperty(form, "id");
- String action = (String) PropertyUtils.getSimpleProperty(form, "action");
- if(customFieldValueId == null || customFieldValueId.intValue() <= 0) {
- throw new SystemConfigurationException("Invalid custom field value id.");
- }
-
- CustomFieldValue customFieldValue = configurationService.getCustomFieldValue(customFieldValueId);
- if(customFieldValue == null) {
- throw new SystemConfigurationException("Invalid custom field value id.");
- }
-
- CustomField customField = configurationService.getCustomField(customFieldValue.getCustomField().getId());
- if(customField == null) {
- throw new SystemConfigurationException("Invalid custom field id.");
- }
- List<CustomFieldValue> customFieldvalues = customField.getOptions();
- List<CustomFieldValue> newCustomFieldValueItems = new ArrayList<CustomFieldValue>();
-
- for(int i = 0; i < customFieldvalues.size(); i++) {
- newCustomFieldValueItems.add(customFieldvalues.get(i));
- }
-
- for(int i = 0; i < customFieldvalues.size(); i++) {
- if ( customFieldvalues.get(i) != null ) {
- CustomFieldValue firstCustomFieldValue = new CustomFieldValue();
- CustomFieldValue secondCustomFieldValue = new CustomFieldValue();
- CustomFieldValue curCustomFieldValue = (CustomFieldValue) customFieldvalues.get(i);
- int todo_i = -1;
- if ( curCustomFieldValue.getId() == customFieldValueId ) {
- if ("up".equals(action) ){
- todo_i = i - 1;
- } else {
- todo_i = i + 1;
- }
- CustomFieldValue todoCustomFieldValue = (CustomFieldValue) customFieldvalues.get(todo_i);
+ if (!hasPermission(UserUtilities.PERMISSION_USER_ADMIN, request,
+ response)) {
+ return mapping.findForward("unauthorized");
+ }
- firstCustomFieldValue.setId(curCustomFieldValue.getId());
- firstCustomFieldValue.setCreateDate(todoCustomFieldValue.getCreateDate());
- firstCustomFieldValue.setLastModifiedDate(todoCustomFieldValue.getLastModifiedDate());
-// firstCustomFieldValue.setName(todoCustomFieldValue.getName());
- firstCustomFieldValue.setValue(todoCustomFieldValue.getValue());
- firstCustomFieldValue.setCustomField(todoCustomFieldValue.getCustomField());
- firstCustomFieldValue.setSortOrder(todoCustomFieldValue.getSortOrder());
-
- secondCustomFieldValue.setId(todoCustomFieldValue.getId());
- secondCustomFieldValue.setCreateDate(curCustomFieldValue.getCreateDate());
- secondCustomFieldValue.setLastModifiedDate(curCustomFieldValue.getLastModifiedDate());
-// secondCustomFieldValue.setName(curCustomFieldValue.getName());
- secondCustomFieldValue.setValue(curCustomFieldValue.getValue());
- secondCustomFieldValue.setCustomField(curCustomFieldValue.getCustomField());
- secondCustomFieldValue.setSortOrder(curCustomFieldValue.getSortOrder());
+ try {
+ ConfigurationService configurationService = getITrackerServices()
+ .getConfigurationService();
- newCustomFieldValueItems.set(todo_i,firstCustomFieldValue);
- newCustomFieldValueItems.set(i,secondCustomFieldValue);
- }
- }
- }
-
-// newCustomFieldValueItems = configurationService.updateCustomFieldValues(customField.getId(),newCustomFieldValueItems);
-
-/* for(int i = 0; i < values.size(); i++) {
- if(values.get(i) != null && valueId.equals(values.get(i).getId())) {
- if("up".equalsIgnoreCase(action) && i > 0) {
- int tempOrder = values.get(i).getSortOrder();
- values.get(i).setSortOrder(values.get(i-1).getSortOrder());
- values.get(i-1).setSortOrder(tempOrder);
- values = configurationService.updateCustomFieldValues(customField.getId(), values);
- if("up".equalsIgnoreCase(action) && i > 0) {
- } else if("down".equalsIgnoreCase(action) && i < (values.size() - 1)) {
- tempOrder = values.get(i).getSortOrder();
- values.get(i).setSortOrder(values.get(i+1).getSortOrder());
- values.get(i+1).setSortOrder(tempOrder);
- values = configurationService.updateCustomFieldValues(customField.getId(), values);
- }
- break;
- }
- if(values.get(i) != null && valueId.equals(values.get(i).getId())) {
- if("up".equalsIgnoreCase(action) && i > 0) {
- CustomFieldValue moveUpRecord = values.get(i);
- int moveDwnInt = moveUpRecord.getId();
- CustomFieldValue moveDwnRecord = values.get(i-1);
- int moveUpInt = moveDwnRecord.getId();
- moveDwnRecord.setId(moveDwnInt);
- moveUpRecord.setId(moveUpInt);
- values.set(i, moveDwnRecord);
- values.set(i-1,moveUpRecord);
- values = configurationService.updateCustomFieldValues(customField.getId(), values);
- } else if("down".equalsIgnoreCase(action) && i < (values.size() - 1)) {
- CustomFieldValue moveUpRecord = values.get(i+1);
- int moveDwnInt = moveUpRecord.getId();
- CustomFieldValue moveDwnRecord = values.get(i);
- int moveUpInt = moveDwnRecord.getId();
- moveDwnRecord.setId(moveDwnInt);
- moveUpRecord.setId(moveUpInt);
- values.set(i, moveDwnRecord);
- values.set(i-1,moveUpRecord);
- values = configurationService.updateCustomFieldValues(customField.getId(), values);
- }
- break;
- }
-
- }
- }
-*/
- configurationService.resetConfigurationCache(SystemConfigurationUtilities.TYPE_CUSTOMFIELD);
- request.setAttribute("action",action);
- return new ActionForward(mapping.findForward("editcustomfield").getPath() + "?id=" + customField.getId() + "&action=update");
- } catch(SystemConfigurationException nfe) {
- errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.invalidcustomfieldvalue"));
- log.debug("Invalid custom field value id " + request.getParameter("id") + " specified.");
- } catch(NumberFormatException nfe) {
- errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.invalidcustomfieldvalue"));
- log.debug("Invalid custom field value id " + request.getParameter("id") + " specified.");
- } catch(Exception e) {
- errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.system"));
- log.error("System Error.", e);
- }
- if (!errors.isEmpty()) {
- saveErrors(request, errors);
- }
- return mapping.findForward("error");
- }
-
+ Integer customFieldValueId = (Integer) PropertyUtils
+ .getSimpleProperty(form, "id");
+ String action = (String) PropertyUtils.getSimpleProperty(form,
+ "action");
+ if (customFieldValueId == null
+ || customFieldValueId.intValue() <= 0) {
+ throw new SystemConfigurationException(
+ "Invalid custom field value id.");
+ }
+
+ CustomFieldValue customFieldValue = configurationService
+ .getCustomFieldValue(customFieldValueId);
+ if (customFieldValue == null) {
+ throw new SystemConfigurationException(
+ "Invalid custom field value id.");
+ }
+
+ CustomField customField = configurationService
+ .getCustomField(customFieldValue.getCustomField().getId());
+ if (customField == null) {
+ throw new SystemConfigurationException(
+ "Invalid custom field id.");
+ }
+ List<CustomFieldValue> customFieldvalues = customField.getOptions();
+ // List<CustomFieldValue> newCustomFieldValueItems = new
+ // ArrayList<CustomFieldValue>();
+
+ // newCustomFieldValueItems.addAll(customFieldvalues);
+
+ Collections.sort(customFieldvalues,
+ CustomFieldValue.SORT_ORDER_COMPARATOR);
+ Iterator<CustomFieldValue> valuesIt = customFieldvalues.iterator();
+ CustomFieldValue curCustomFieldValue, prevCustomFieldValue = null;
+ int i = 0;
+ while (valuesIt.hasNext()) {
+ curCustomFieldValue = (CustomFieldValue) valuesIt.next();
+ curCustomFieldValue.setSortOrder(i);
+
+ // int todo_i = -1;
+ if (curCustomFieldValue.getId() == customFieldValueId) {
+
+ if ("up".equals(action)) {
+ // todo_i = i - 1;
+ if (prevCustomFieldValue != null) {
+ curCustomFieldValue.setSortOrder(i - 1);
+ prevCustomFieldValue.setSortOrder(i);
+ }
+ } else {
+ // todo_i = i + 1;
+ CustomFieldValue value = valuesIt.next();
+ value.setSortOrder(i++);
+ curCustomFieldValue.setSortOrder(i);
+ curCustomFieldValue = value;
+ }
+
+ }
+ prevCustomFieldValue = curCustomFieldValue;
+ i++;
+ }
+
+// configurationService.updateCustomFieldValues(customField.getId(),
+// customFieldvalues);
+
+ configurationService.updateCustomField(customField);
+
+ configurationService
+ .resetConfigurationCache(SystemConfigurationUtilities.TYPE_CUSTOMFIELD);
+ request.setAttribute("action", action);
+ return new ActionForward(mapping.findForward("editcustomfield")
+ .getPath()
+ + "?id=" + customField.getId() + "&action=update");
+ } catch (SystemConfigurationException nfe) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ "itracker.web.error.invalidcustomfieldvalue"));
+ log.debug("Invalid custom field value id "
+ + request.getParameter("id") + " specified.");
+ } catch (NumberFormatException nfe) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ "itracker.web.error.invalidcustomfieldvalue"));
+ log.debug("Invalid custom field value id "
+ + request.getParameter("id") + " specified.");
+ } catch (Exception e) {
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
+ "itracker.web.error.system"));
+ log.error("System Error.", e);
+ }
+ if (!errors.isEmpty()) {
+ saveErrors(request, errors);
+ }
+ return mapping.findForward("error");
+ }
+
}
Modified: itracker/trunk/src/main/webapp/module-admin/admin_configuration/edit_customfield.jsp
===================================================================
--- itracker/trunk/src/main/webapp/module-admin/admin_configuration/edit_customfield.jsp 2009-03-11 17:31:34 UTC (rev 2187)
+++ itracker/trunk/src/main/webapp/module-admin/admin_configuration/edit_customfield.jsp 2009-03-11 18:35:07 UTC (rev 2188)
@@ -14,9 +14,9 @@
</html:messages>
</span>
- <br/>
+ <br/><br/><br/>
+
</logic:messagesPresent>
- <br/><br/>
<html:form action="/editcustomfield">
<html:hidden property="action"/>
@@ -84,7 +84,7 @@
<tr><td colspan="5"><html:img module="/" page="/themes/defaulttheme/images/blank.gif" width="1" height="12"/></td></tr>
<tr>
<td colspan="2" valign="top">
- <table width="100% cellspacing="0" cellpadding="0" border="0" src="../../images/blank.gif">
+ <table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr><td colspan="4" class="editColumnTitle"><it:message key="itracker.web.attr.translations"/>:</td></tr>
<tr class="listHeading"><td colspan="4"><html:img module="/" page="/themes/defaulttheme/images/blank.gif" height="2" width="1"/></td></tr>
<tr><td colspan="4"><html:img module="/" page="/themes/defaulttheme/images/blank.gif" width="1" height="4"/></td></tr>
@@ -130,27 +130,27 @@
</tr>
<tr class="listHeading"><td colspan="3"><html:img module="/" page="/themes/defaulttheme/images/blank.gif" height="2" width="1"/></td></tr>
<tr><td colspan="3"><html:img module="/" page="/themes/defaulttheme/images/blank.gif" width="1" height="4"/></td></tr>
- <c:forEach items="${optionsMap}" var="option" varStatus="i">
+ <c:forEach items="${options}" var="option" varStatus="i">
<tr>
<td class="listRowUnshaded" style="white-space: nowrap;" nowrap="nowrap">
- <it:link action="editcustomfieldvalueform" targetAction="update" paramName="id" paramValue="${option.key.id}" titleKey="itracker.web.admin.editcustomfield.option.edit.alt"><it:message key="itracker.web.admin.editcustomfield.option.edit"/></it:link>
- <it:link action="removecustomfieldvalue" targetAction="delete" paramName="id" paramValue="${option.key.id}" titleKey="itracker.web.admin.editcustomfield.option.delete.alt"><it:message key="itracker.web.admin.editcustomfield.option.delete"/></it:link>
- <%--c:if test="${i.index != 1}">
- <it:link action="ordercustomfieldvalue" targetAction="up" paramName="id" paramValue="${option.key.id}" titleKey="itracker.web.admin.editcustomfield.option.orderup.alt">
+ <it:link action="editcustomfieldvalueform" targetAction="update" paramName="id" paramValue="${option.id}" titleKey="itracker.web.admin.editcustomfield.option.edit.alt"><it:message key="itracker.web.admin.editcustomfield.option.edit"/></it:link>
+ <it:link action="removecustomfieldvalue" targetAction="delete" paramName="id" paramValue="${option.id}" titleKey="itracker.web.admin.editcustomfield.option.delete.alt"><it:message key="itracker.web.admin.editcustomfield.option.delete"/></it:link>
+ <c:if test="${i.index != 0}">
+ <it:link action="ordercustomfieldvalue" targetAction="up" paramName="id" paramValue="${option.id}" titleKey="itracker.web.admin.editcustomfield.option.orderup.alt">
<it:message key="itracker.web.admin.editcustomfield.option.orderup"/>
</it:link>
</c:if>
- <c:if test="${i.index != opt_len}">
- <it:link action="ordercustomfieldvalue" targetAction="down" paramName="id" paramValue="${option.key.id}" titleKey="itracker.web.admin.editcustomfield.option.orderdown.alt">
+ <c:if test="${i.index lt fn:length(options)-1 }">
+ <it:link action="ordercustomfieldvalue" targetAction="down" paramName="id" paramValue="${option.id}" titleKey="itracker.web.admin.editcustomfield.option.orderdown.alt">
<it:message key="itracker.web.admin.editcustomfield.option.orderdown"/>
</it:link>
- </c:if--%>
+ </c:if>
<html:img module="/" page="/themes/defaulttheme/images/blank.gif" width="5" height="1"/>
</td>
<td align="right" colspan="2" class="editColumnText">
- ${ option.value } (${ option.key.value })
+ ${ optionsMap[option.id] } (${ option.value })
</td>
</tr>
Modified: itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp
===================================================================
--- itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp 2009-03-11 17:31:34 UTC (rev 2187)
+++ itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp 2009-03-11 18:35:07 UTC (rev 2188)
@@ -777,7 +777,6 @@
<td colspan="3" class="editColumnText">
<textarea name="history"
- wrap="${wrap}"
cols="110"
rows="6"
class="editColumnText"><bean:write name="issueForm" property="history"/></textarea>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-11 17:31:58
|
Revision: 2187
http://itracker.svn.sourceforge.net/itracker/?rev=2187&view=rev
Author: ranks
Date: 2009-03-11 17:31:34 +0000 (Wed, 11 Mar 2009)
Log Message:
-----------
minor rosa credit fix (z-index)
Modified Paths:
--------------
itracker-skin/trunk/src/main/resources/css/maven-theme.css
Modified: itracker-skin/trunk/src/main/resources/css/maven-theme.css
===================================================================
--- itracker-skin/trunk/src/main/resources/css/maven-theme.css 2009-03-11 15:08:21 UTC (rev 2186)
+++ itracker-skin/trunk/src/main/resources/css/maven-theme.css 2009-03-11 17:31:34 UTC (rev 2187)
@@ -1,5 +1,3 @@
-/* @override http://www.itracker.org/css/maven-theme.css */
-
html * {
position: relative;
border: none;
@@ -270,6 +268,7 @@
}
#mainContent {
+ z-index: 1;
background-color: #FFFFFF;
background-image: url(../images/main.png);
background-repeat: repeat-x;
@@ -1233,7 +1232,7 @@
}
/**
- * Credit for R.Ø.S.A. Site Skin (http://www.rosa.com)
+ * Credit for itracker Site Skin (http://www.rosa.com)
*/
#credit {
color: #000000;
@@ -1242,7 +1241,7 @@
right: 4px;
top: 40px;
text-decoration: none;
- z-index: 0;
+ z-index: -1;
}
body>#credit {
position: fixed;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <rap...@us...> - 2009-03-11 15:08:33
|
Revision: 2186
http://itracker.svn.sourceforge.net/itracker/?rev=2186&view=rev
Author: raptor-rosa
Date: 2009-03-11 15:08:21 +0000 (Wed, 11 Mar 2009)
Log Message:
-----------
Added rosa.com credit to the itracker.org website
Modified Paths:
--------------
itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm
itracker-skin/trunk/src/main/resources/css/maven-theme.css
Modified: itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm
===================================================================
--- itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm 2009-03-10 19:39:04 UTC (rev 2185)
+++ itracker-skin/trunk/src/main/resources/META-INF/maven/site.vm 2009-03-11 15:08:21 UTC (rev 2186)
@@ -347,7 +347,8 @@
#end
#end
</head>
- <body class="composite" bgcolor="black">
+ <body class="composite" bgcolor="black">
+ </div>
<div id="mainContent">
<div id="banner">
<div id="banner01">
@@ -394,6 +395,10 @@
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-1042319-2");
pageTracker._trackPageview();
- </script>
+ </script>
+ <div id="credit">
+ <a title="R.Ø.S.A." target="_blank" href="http://www.rosa.com">
+ <img width="7" height="31" alt="R.Ø.S.A." src="images/rosa.gif"/>
+ </a>
</body>
</html>
Modified: itracker-skin/trunk/src/main/resources/css/maven-theme.css
===================================================================
--- itracker-skin/trunk/src/main/resources/css/maven-theme.css 2009-03-10 19:39:04 UTC (rev 2185)
+++ itracker-skin/trunk/src/main/resources/css/maven-theme.css 2009-03-11 15:08:21 UTC (rev 2186)
@@ -1230,4 +1230,21 @@
top: 0;
right: 0;
display: block;
-}
\ No newline at end of file
+}
+
+/**
+ * Credit for R.Ø.S.A. Site Skin (http://www.rosa.com)
+ */
+#credit {
+ color: #000000;
+ font-size: 0.7em;
+ position: absolute;
+ right: 4px;
+ top: 40px;
+ text-decoration: none;
+ z-index: 0;
+}
+body>#credit {
+ position: fixed;
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-10 19:39:19
|
Revision: 2185
http://itracker.svn.sourceforge.net/itracker/?rev=2185&view=rev
Author: ranks
Date: 2009-03-10 19:39:04 +0000 (Tue, 10 Mar 2009)
Log Message:
-----------
minor taglib cleanups on action format tags
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/web/taglib/FormatImageActionTag.java
itracker/trunk/src/main/java/org/itracker/web/taglib/FormatLinkTag.java
Modified: itracker/trunk/src/main/java/org/itracker/web/taglib/FormatImageActionTag.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/taglib/FormatImageActionTag.java 2009-03-09 22:12:25 UTC (rev 2184)
+++ itracker/trunk/src/main/java/org/itracker/web/taglib/FormatImageActionTag.java 2009-03-10 19:39:04 UTC (rev 2185)
@@ -19,7 +19,6 @@
package org.itracker.web.taglib;
import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Locale;
import javax.servlet.http.HttpSession;
@@ -29,6 +28,7 @@
import org.apache.struts.taglib.TagUtils;
import org.itracker.core.resources.ITrackerResources;
import org.itracker.model.UserPreferences;
+import org.itracker.services.util.HTMLUtilities;
import org.itracker.web.util.Constants;
public final class FormatImageActionTag extends TagSupport {
@@ -175,23 +175,21 @@
StringBuffer buf = new StringBuffer("<a href=\"");
try {
- // buf.append(RequestUtils.computeURL(pageContext, forward, null,
- // null, action, null, null, false));
- buf.append(attEscapedString(TagUtils.getInstance().computeURL(pageContext, forward,
- null, null, action, module, null, null, false)));
+ buf.append(TagUtils.getInstance().computeURL(pageContext, forward,
+ null, null, action, module, null, null, false));
} catch (MalformedURLException murle) {
- buf.append(attEscapedString(forward));
+ buf.append(HTMLUtilities.escapeTags(forward));
}
if (paramName != null && paramValue != null) {
buf.append("?" + paramName + "=" + paramValue);
hasParams = true;
}
if (caller != null) {
- buf.append((hasParams ? "&" : "?") + "caller=" + attEscapedString(caller));
+ buf.append((hasParams ? "&" : "?") + "caller=" + HTMLUtilities.escapeTags(caller));
hasParams = true;
}
if (targetAction != null) {
- buf.append((hasParams ? "&" : "?") + "action=" + attEscapedString(targetAction));
+ buf.append((hasParams ? "&" : "?") + "action=" + HTMLUtilities.escapeTags(targetAction));
hasParams = true;
}
buf.append("\"");
@@ -208,13 +206,11 @@
buf.append(">");
buf.append("<img src=\"");
try {
- // buf.append(RequestUtils.computeURL(pageContext, null, null,
- // src, null, null, null, false));
- buf.append(attEscapedString(TagUtils.getInstance().computeURL(pageContext, null,
- null, src, null, "", null, null, false)));
+ buf.append(TagUtils.getInstance().computeURL(pageContext, null,
+ null, src, null, "", null, null, false));
} catch (MalformedURLException murle) {
- buf.append(attEscapedString(src));
+ buf.append(HTMLUtilities.escapeTags(src));
}
buf.append("\"");
if (altKey != null) {
@@ -238,17 +234,7 @@
return (EVAL_PAGE);
}
- public static final String htmlEscapedString(String string) {
- if (string == null) {
- return "";
- }
- return string.replace("&", "&").replace("<", "<").replace(">", ">");
- }
- public static final String attEscapedString(String string) {
- return htmlEscapedString(string).replace("\"", "\\\"");
- }
-
public void release() {
super.release();
clearState();
@@ -265,5 +251,8 @@
textActionKey = null;
border = null;
caller = null;
+ target = null;
+ targetAction = null;
+ module = null;
}
}
Modified: itracker/trunk/src/main/java/org/itracker/web/taglib/FormatLinkTag.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/taglib/FormatLinkTag.java 2009-03-09 22:12:25 UTC (rev 2184)
+++ itracker/trunk/src/main/java/org/itracker/web/taglib/FormatLinkTag.java 2009-03-10 19:39:04 UTC (rev 2185)
@@ -27,6 +27,7 @@
import org.apache.struts.taglib.TagUtils;
import org.itracker.core.resources.ITrackerResources;
+import org.itracker.services.util.HTMLUtilities;
import org.itracker.web.util.Constants;
@@ -164,13 +165,12 @@
StringBuffer buf = new StringBuffer("<a href=\"");
try {
- // buf.append(RequestUtils.computeURL(pageContext, forward, null, null, action, null, null, false));
- buf.append(attEscapedString(TagUtils.getInstance().computeURL(pageContext, forward, null, null, action, null, null, null, false)));
+ buf.append(TagUtils.getInstance().computeURL(pageContext, forward, null, null, action, null, null, null, false));
} catch(MalformedURLException murle) {
- buf.append(attEscapedString(forward));
+ buf.append(HTMLUtilities.escapeTags(forward));
}
if(queryString != null) {
- buf.append("?" + attEscapedString(queryString));
+ buf.append("?" + HTMLUtilities.escapeTags(queryString));
hasParams = true;
}
if(paramName != null && paramValue != null) {
@@ -178,25 +178,25 @@
hasParams = true;
}
if(caller != null) {
- buf.append((hasParams ? "&" : "?") + "caller=" + attEscapedString(caller));
+ buf.append((hasParams ? "&" : "?") + "caller=" + HTMLUtilities.escapeTags(caller));
hasParams = true;
}
if(targetAction != null) {
- buf.append((hasParams ? "&" : "?") + "action=" + attEscapedString(targetAction));
+ buf.append((hasParams ? "&" : "?") + "action=" + HTMLUtilities.escapeTags(targetAction));
hasParams = true;
}
buf.append("\"");
if(target != null) {
- buf.append(" target=\"" + attEscapedString(target) + "\"");
+ buf.append(" target=\"" + HTMLUtilities.escapeTags(target) + "\"");
}
if(titleKey != null) {
- buf.append(" title=\"" + attEscapedString(ITrackerResources.getString(titleKey, locale, (arg0 == null ? "" : arg0))) + "\"");
+ buf.append(" title=\"" + HTMLUtilities.escapeTags(ITrackerResources.getString(titleKey, locale, (arg0 == null ? "" : arg0))) + "\"");
}
if(styleClass != null) {
- buf.append(" class=\"" + attEscapedString(styleClass) + "\"");
+ buf.append(" class=\"" + HTMLUtilities.escapeTags(styleClass) + "\"");
}
buf.append(">");
- buf.append(htmlEscapedString(text));
+ buf.append(HTMLUtilities.escapeTags(text));
buf.append("</a>");
// ResponseUtils.write(pageContext, buf.toString());
TagUtils.getInstance().write(pageContext, buf.toString());
@@ -204,17 +204,6 @@
return (EVAL_PAGE);
}
- public static final String htmlEscapedString(String string) {
- if (string == null) {
- return "";
- }
- return string.replace("&", "&").replace("<", "<").replace(">", ">");
- }
-
- public static final String attEscapedString(String string) {
- return htmlEscapedString(string).replace("\"", "\\\"");
- }
-
public void release() {
super.release();
clearState();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-09 22:12:32
|
Revision: 2184
http://itracker.svn.sourceforge.net/itracker/?rev=2184&view=rev
Author: ranks
Date: 2009-03-09 22:12:25 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
fixed error handling
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java 2009-03-09 22:05:37 UTC (rev 2183)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java 2009-03-09 22:12:25 UTC (rev 2184)
@@ -197,7 +197,7 @@
} catch (Exception e) {
log.warn("execute: failed to update " + issue, e);
errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.other"));
- errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(e.toString()));
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(e.getMessage(), false));
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-09 22:05:44
|
Revision: 2183
http://itracker.svn.sourceforge.net/itracker/?rev=2183&view=rev
Author: ranks
Date: 2009-03-09 22:05:37 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
Fix for issue description form-value length
Modified Paths:
--------------
itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml
itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml
Modified: itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml
===================================================================
--- itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml 2009-03-09 21:04:26 UTC (rev 2182)
+++ itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml 2009-03-09 22:05:37 UTC (rev 2183)
@@ -13,7 +13,7 @@
<generator class="native"/>
</id>
- <property name="description" type="text" length="32000">
+ <property name="description">
<column name="description" not-null="true" />
</property>
Modified: itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml
===================================================================
--- itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml 2009-03-09 21:04:26 UTC (rev 2182)
+++ itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml 2009-03-09 22:05:37 UTC (rev 2183)
@@ -22,7 +22,7 @@
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
- <var-value>32000</var-value>
+ <var-value>255</var-value>
</var>
</field>
<field property="history" depends="required,maxlength">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-09 21:04:41
|
Revision: 2182
http://itracker.svn.sourceforge.net/itracker/?rev=2182&view=rev
Author: ranks
Date: 2009-03-09 21:04:26 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
error-handling and issue-history field-type changed to text, validation enabled, limit to 32000 characters, code cleanups
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java
itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml
itracker/trunk/src/main/resources/org/itracker/model/IssueHistory.hbm.xml
itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java 2009-03-09 20:46:07 UTC (rev 2181)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/project/EditIssueAction.java 2009-03-09 21:04:26 UTC (rev 2182)
@@ -132,13 +132,10 @@
logTimeMillies("execute: got issueService", logDate, log, Level.DEBUG);
NotificationService notificationService = getITrackerServices()
.getNotificationService();
- logTimeMillies("execute: got notificationService", logDate, log, Level.DEBUG);
HttpSession session = request.getSession(true);
User currUser = (User) session.getAttribute(Constants.USER_KEY);
- logTimeMillies("execute: got currUser", logDate, log, Level.DEBUG);
Map<Integer, Set<PermissionType>> userPermissions = getUserPermissions(session);
- logTimeMillies("execute: got userPermissions", logDate, log, Level.DEBUG);
Integer currUserId = currUser.getId();
IssueForm issueForm = (IssueForm) form;
@@ -180,21 +177,27 @@
if (errors.isEmpty()) {
previousStatus = issue.getStatus();
- if (UserUtilities.hasPermission(userPermissions, project.getId(),
- UserUtilities.PERMISSION_EDIT_FULL)) {
- if (log.isDebugEnabled()) {
- log.debug("execute: process full, " + issue);
+ try {
+ if (UserUtilities.hasPermission(userPermissions, project.getId(),
+ UserUtilities.PERMISSION_EDIT_FULL)) {
+ if (log.isDebugEnabled()) {
+ log.debug("execute: process full, " + issue);
+ }
+ issue = EditIssueActionUtil.processFullEdit(issue, project, currUser, userPermissions,
+ getLocale(request), issueForm, issueService, errors);
+ logTimeMillies("execute: processed fulledit", logDate, log, Level.DEBUG);
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("execute: process limited, " + issue);
+ }
+ issue = EditIssueActionUtil.processLimitedEdit(issue, project, currUser, userPermissions,
+ getLocale(request), issueForm, issueService, errors);
+ logTimeMillies("execute: processed limited edit", logDate, log, Level.DEBUG);
}
- issue = EditIssueActionUtil.processFullEdit(issue, project, currUser, userPermissions,
- getLocale(request), issueForm, issueService, errors);
- logTimeMillies("execute: processed fulledit", logDate, log, Level.DEBUG);
- } else {
- if (log.isDebugEnabled()) {
- log.debug("execute: process limited, " + issue);
- }
- issue = EditIssueActionUtil.processLimitedEdit(issue, project, currUser, userPermissions,
- getLocale(request), issueForm, issueService, errors);
- logTimeMillies("execute: processed limited edit", logDate, log, Level.DEBUG);
+ } catch (Exception e) {
+ log.warn("execute: failed to update " + issue, e);
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("itracker.web.error.other"));
+ errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(e.toString()));
}
}
Modified: itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml
===================================================================
--- itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml 2009-03-09 20:46:07 UTC (rev 2181)
+++ itracker/trunk/src/main/resources/org/itracker/model/Issue.hbm.xml 2009-03-09 21:04:26 UTC (rev 2182)
@@ -13,8 +13,8 @@
<generator class="native"/>
</id>
- <property name="description">
- <column name="description" not-null="true" />
+ <property name="description" type="text" length="32000">
+ <column name="description" not-null="true" />
</property>
<property name="severity" index="issuebeanSeverityIdx">
Modified: itracker/trunk/src/main/resources/org/itracker/model/IssueHistory.hbm.xml
===================================================================
--- itracker/trunk/src/main/resources/org/itracker/model/IssueHistory.hbm.xml 2009-03-09 20:46:07 UTC (rev 2181)
+++ itracker/trunk/src/main/resources/org/itracker/model/IssueHistory.hbm.xml 2009-03-09 21:04:26 UTC (rev 2182)
@@ -21,7 +21,7 @@
<column name="user_id"/>
</many-to-one>
- <property name="description" >
+ <property name="description" type="text" length="32000" >
<column name="description" not-null="true"/>
</property>
Modified: itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml
===================================================================
--- itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml 2009-03-09 20:46:07 UTC (rev 2181)
+++ itracker/trunk/src/main/webapp/WEB-INF/config/validation-module-projects.xml 2009-03-09 21:04:26 UTC (rev 2182)
@@ -22,17 +22,17 @@
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
- <var-value>255</var-value>
+ <var-value>32000</var-value>
</var>
</field>
- <!-- field property="history" depends="required,maxlength">
+ <field property="history" depends="required,maxlength">
<arg0 key="itracker.web.attr.detaileddescription" />
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
- <var-value>255</var-value>
+ <var-value>32000</var-value>
</var>
- </field -->
+ </field>
<field property="attachmentDescription"
depends="validwhen,maxlength">
@@ -83,12 +83,12 @@
<var-value>255</var-value>
</var>
</field>
- <!-- field property="history" depends="validwhen,maxlength">
+ <field property="history" depends="validwhen,maxlength">
<msg key="itracker.web.error.validate.required.issuedescription" name="validwhen" />
<arg0 key="itracker.web.attr.history" />
<var>
<var-name>test</var-name>
- <!- allow empty history on edit if status not changed, or closed(500) ->
+ <!-- allow empty history on edit if status not changed, or closed(500) -->
<var-value>
(((prevStatus == status) or (status >= 500)) or (*this* != null))
</var-value>
@@ -96,9 +96,9 @@
<arg1 name="maxlength" key="${var:maxlength}" resource="false"/>
<var>
<var-name>maxlength</var-name>
- <var-value>255</var-value>
+ <var-value>32000</var-value>
</var>
- </field -->
+ </field>
<field property="attachmentDescription"
depends="validwhen,maxlength">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-09 20:46:18
|
Revision: 2181
http://itracker.svn.sourceforge.net/itracker/?rev=2181&view=rev
Author: ranks
Date: 2009-03-09 20:46:07 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
fixing output of fixed content in edit issue
Modified Paths:
--------------
itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp
Modified: itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp
===================================================================
--- itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp 2009-03-09 19:25:38 UTC (rev 2180)
+++ itracker/trunk/src/main/webapp/module-projects/edit_issue.jsp 2009-03-09 20:46:07 UTC (rev 2181)
@@ -753,7 +753,7 @@
</td>
<td style="text-align: left; white-space: normal;">
<div style="white-space: normal; overflow: auto; width: 900px">
- <it:formatHistoryEntry>${historyEntry.description}</it:formatHistoryEntry>
+ <it:formatHistoryEntry projectOptions="${project.options}">${historyEntry.description}</it:formatHistoryEntry>
</div>
</td>
</tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-09 19:26:02
|
Revision: 2180
http://itracker.svn.sourceforge.net/itracker/?rev=2180&view=rev
Author: ranks
Date: 2009-03-09 19:25:38 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
Hotfix overloading edit language keys from database failed if properties present,
temporary removed disable language links.
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/EditLanguageFormAction.java
itracker/trunk/src/main/webapp/module-admin/admin_language/list_languages.jsp
Modified: itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/EditLanguageFormAction.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/EditLanguageFormAction.java 2009-03-09 18:12:03 UTC (rev 2179)
+++ itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/EditLanguageFormAction.java 2009-03-09 19:25:38 UTC (rev 2180)
@@ -24,6 +24,7 @@
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
@@ -225,48 +226,32 @@
@SuppressWarnings("unchecked")
void putPropertiesKeys(Map<String, String> locItems, Map<String, String> items, String locale) {
try {
- Properties p;
+ Hashtable<Object, Object> p;
try {
- String path = File.separatorChar + ITrackerResources.RESOURCE_BUNDLE_NAME.replace('.', File.separatorChar) + (null != locale? "_" + locale: "") + ".properties";
+ String path = File.separatorChar + ITrackerResources.RESOURCE_BUNDLE_NAME.replace('.', File.separatorChar) + (null != locale && !(ITrackerResources.BASE_LOCALE.equals(locale))? "_" + locale: "") + ".properties";
if (log.isDebugEnabled()) {
log.debug("putPropertiesKeys: loading: " + path);
}
p = new PropertiesFileHandler(path).getProperties();
+ p = new Hashtable<Object, Object>(p);
+
if (log.isDebugEnabled()) {
- log.debug("putPropertiesKeys: loaded properties: " + new HashMap<Object, Object>(p) + " (" + p + ")");
+ log.debug("putPropertiesKeys: loaded properties: " + p);
}
} catch (Exception e) {
- log.error("putPropertiesKeys", e);
- return;
+ if (log.isDebugEnabled()) {
+ log.debug("putPropertiesKeys", e);
+ }
+ p = new Properties();
}
// overload properties by loc items from db
-// p.putAll(locItems);
- Map<Object, Object> pMap = new HashMap<Object, Object>(p);
- pMap.putAll(locItems);
+ if (log.isDebugEnabled()) {
+ log.debug("putPropertiesKeys: overloading locItems: " + locItems);
+ }
+// Map<Object, Object> pMap = new HashMap<Object, Object>(p);
+ p.putAll(locItems);
locItems.putAll(Collections.checkedMap((Map)p, String.class, String.class));
-// ResourceBundle locBundle = ITrackerResources.getBundle(ITrackerResources.getLocale(locale));
-// if (locBundle instanceof ITrackerResourceBundle) {
-// ITrackerResourceBundle bundle = (ITrackerResourceBundle)locBundle;
-// Enumeration<String> keys = locBundle.getKeys();
-// String key, value;
-// String parentLocale = ITrackerResources.getParentLocale(locale);
-// while (keys.hasMoreElements()) {
-// key = keys.nextElement();
-// if (!locItems.containsKey(key)) {
-//
-// value = (String)bundle.handleGetObject(key);
-// if (all && value != null) {
-// locItems.put(key, value);
-//
-// } else if (value != null
-// && !value.equals(items.get(key))
-// && !value.equals(ITrackerResources.getString(key, parentLocale))) {
-// locItems.put(key, value);
-// }
-// }
-// }
-// }
} catch (RuntimeException e) {
log.error("addPropertiesKeys: caught ", e);
}
Modified: itracker/trunk/src/main/webapp/module-admin/admin_language/list_languages.jsp
===================================================================
--- itracker/trunk/src/main/webapp/module-admin/admin_language/list_languages.jsp 2009-03-09 18:12:03 UTC (rev 2179)
+++ itracker/trunk/src/main/webapp/module-admin/admin_language/list_languages.jsp 2009-03-09 19:25:38 UTC (rev 2180)
@@ -33,7 +33,7 @@
<it:link action="editlanguageform" targetAction="create" paramName="locale" paramValue="${ baseLocale }" titleKey="itracker.web.admin.listlanguages.create.alt" arg0="${ baseLocaleName }"><it:message key="itracker.web.admin.listlanguages.create" arg0="${ baseLocaleName }"/></it:link>
<it:link action="createlanguagekeyform" targetAction="create" titleKey="itracker.web.admin.listlanguages.createkey.alt"><it:message key="itracker.web.admin.listlanguages.createkey"/></it:link>
<it:link action="editlanguageform" targetAction="update" paramName="locale" paramValue="${ baseLocale }" titleKey="itracker.web.admin.listlanguages.update.alt" arg0="${ baseLocaleName }"><it:message key="itracker.web.admin.listlanguages.update" arg0="${ baseLocaleName }"/></it:link>
- <it:link action="editlanguage" targetAction="disable" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.disable.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.disable"/></it:link>
+<!-- <it:link action="editlanguage" targetAction="disable" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.disable.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.disable"/></it:link>-->
<it:link action="exportlanguage" targetAction="export" paramName="locale" paramValue="${ baseLocale }" titleKey="itracker.web.admin.listlanguages.export.alt" arg0="${ baseLocaleName }"><it:message key="itracker.web.admin.listlanguages.export" arg0="${ baseLocaleName }"/></it:link>
</td>
</tr>
@@ -53,7 +53,7 @@
<td align="right">
<it:link action="editlanguageform" targetAction="create" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.create.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.create"/></it:link>
<it:link action="editlanguageform" targetAction="update" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.update.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.update"/></it:link>
- <it:link action="editlanguage" targetAction="disable" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.disable.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.disable"/></it:link>
+<!-- <it:link action="editlanguage" targetAction="disable" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.disable.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.disable"/></it:link>-->
<it:link action="exportlanguage" targetAction="export" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.export.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.export"/></it:link>
</td>
</tr>
@@ -70,7 +70,7 @@
</td>
<td align="right">
<it:link action="editlanguageform" targetAction="update" paramName="locale" paramValue="${ locale }" titleKey="itracker.web.admin.listlanguages.update.alt" arg0="${ localeName }"><it:message key="itracker.web.admin.listlanguages.update"/></it:link>
- <it:link action="editlanguage" targetAction="disable" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.disable.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.disable"/></it:link>
+<!-- <it:link action="editlanguage" targetAction="disable" paramName="locale" paramValue="${ language }" titleKey="itracker.web.admin.listlanguages.disable.alt" arg0="${ languageName }"><it:message key="itracker.web.admin.listlanguages.disable"/></it:link>-->
<it:link action="exportlanguage" targetAction="export" paramName="locale" paramValue="${ locale }" titleKey="itracker.web.admin.listlanguages.export.alt" arg0="${ localeName }"><it:message key="itracker.web.admin.listlanguages.export"/></it:link>
</td>
</tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ra...@us...> - 2009-03-09 18:12:19
|
Revision: 2179
http://itracker.svn.sourceforge.net/itracker/?rev=2179&view=rev
Author: ranks
Date: 2009-03-09 18:12:03 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
Major updates on core resources (ItrackerResources)
and language-admin section.
Minor fixes on JSPs, internationalizations, permissions.
Tests re-enabled or changed.
Fixes some charset issues when using UTF-8 database, databases should be updated manually to support UTF-8.
Language-keys will not be initialized on database, the defaults are consumed from the properties (fallback) and are overridden by database if re-defined in language-admin. (unchanged keys should be removed from database manually by querying on updated date)
Modified Paths:
--------------
itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResourceBundle.java
itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResources.java
itracker/trunk/src/main/java/org/itracker/model/Language.java
itracker/trunk/src/main/java/org/itracker/model/Permission.java
itracker/trunk/src/main/java/org/itracker/model/util/PropertiesFileHandler.java
itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java
itracker/trunk/src/main/java/org/itracker/services/implementations/NotificationServiceImpl.java
itracker/trunk/src/main/java/org/itracker/services/implementations/UserServiceImpl.java
itracker/trunk/src/main/java/org/itracker/services/util/SystemConfigurationUtilities.java
itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/EditLanguageAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/EditLanguageFormAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/admin/language/ListLanguagesAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/preferences/EditPreferencesFormAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/user/SelfRegisterAction.java
itracker/trunk/src/main/java/org/itracker/web/actions/user/SelfRegisterFormAction.java
itracker/trunk/src/main/java/org/itracker/web/forms/LanguageForm.java
itracker/trunk/src/main/java/org/itracker/web/taglib/FormatImageActionTag.java
itracker/trunk/src/main/java/org/itracker/web/taglib/FormatLinkTag.java
itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker.properties
itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_ca.properties
itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_de.properties
itracker/trunk/src/main/resources/org/itracker/core/resources/ITracker_tr.properties
itracker/trunk/src/main/webapp/error.jsp
itracker/trunk/src/main/webapp/module-admin/admin_language/edit_language.jsp
itracker/trunk/src/main/webapp/module-admin/admin_language/list_languages.jsp
itracker/trunk/src/main/webapp/module-preferences/edit_preferences.jsp
itracker/trunk/src/main/webapp/themes/defaulttheme/includes/header.jsp
itracker/trunk/src/test/java/org/itracker/core/resources/ITrackerResourcesTest.java
itracker/trunk/src/test/java/org/itracker/model/IssueAttachmentTest.java
itracker/trunk/src/test/java/org/itracker/persistence/dao/PermissionDAOImplTest.java
itracker/trunk/src/test/java/org/itracker/persistence/dao/UserDAOImplTest.java
itracker/trunk/src/test/java/org/itracker/services/implementations/ConfigurationServiceImplTest.java
itracker/trunk/src/test/java/org/itracker/services/implementations/NotificationServiceTest.java
itracker/trunk/src/test/java/org/itracker/services/implementations/ProjectServiceImplTest.java
itracker/trunk/src/test/java/org/itracker/services/implementations/UserServiceImplTest.java
itracker/trunk/src/test/java/org/itracker/services/util/IssueUtilitiesTest.java
itracker/trunk/src/test/java/org/itracker/services/util/ProjectUtilitiesTest.java
itracker/trunk/src/test/java/org/itracker/services/util/WorkflowUtilitiesTest.java
Modified: itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResourceBundle.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResourceBundle.java 2009-03-02 13:16:02 UTC (rev 2178)
+++ itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResourceBundle.java 2009-03-09 18:12:03 UTC (rev 2179)
@@ -18,212 +18,267 @@
package org.itracker.core.resources;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
-import java.util.Hashtable;
import java.util.List;
import java.util.Locale;
+import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.util.Set;
+import java.util.TreeSet;
+import org.apache.log4j.Logger;
import org.itracker.model.Language;
import org.itracker.services.exceptions.ITrackerDirtyResourceException;
public class ITrackerResourceBundle extends ResourceBundle {
-
- private HashMap<String,Object> data = new HashMap<String,Object>();
- /**
- * TODO should dataArray be re-factored out?
- */
- private Object[][] dataArray = null;
-
- static ResourceBundle loadBundle() {
- return new ITrackerResourceBundle();
- }
- static ResourceBundle loadBundle(Locale locale) {
- return new ITrackerResourceBundle(locale);
- }
- static ResourceBundle loadBundle(Locale locale, Object[][] data) {
- return new ITrackerResourceBundle(locale, data);
- }
+ private static final Logger log = Logger
+ .getLogger(ITrackerResourceBundle.class);
+ private final HashMap<String, Object> data = new HashMap<String, Object>();
+ /**
+ * TODO should dataArray be re-factored out?
+ */
+ private Object[][] dataArray = null;
+ private ResourceBundle propertiesBundle;
- static ResourceBundle loadBundle(Locale locale, List<Language> items) {
- return new ITrackerResourceBundle(locale, items);
- }
- private ITrackerResourceBundle() {
- super.setParent(ResourceBundle.getBundle(ITrackerResources.RESOURCE_BUNDLE_NAME, new Locale(ITrackerResources.getDefaultLocale())));
- }
- /**
- * @param locale
- */
- private ITrackerResourceBundle(Locale locale) {
- if (null == locale) {
- locale = new Locale(ITrackerResources.getDefaultLocale());
- }
- setParent(ResourceBundle.getBundle(ITrackerResources.RESOURCE_BUNDLE_NAME, locale));
- }
- /**
- * @param locale
- * @param data
- * @deprecated used still for testing
- */
- public ITrackerResourceBundle(Locale locale, Object[][] data) {
- this(locale);
- setContents(data);
- }
+ static ResourceBundle loadBundle() {
+ return new ITrackerResourceBundle();
+ }
- /**
- * @param locale
- * @param items
- */
- private ITrackerResourceBundle(Locale locale, List<Language> items) {
- this(locale);
- setContents(items);
- }
+ static ResourceBundle loadBundle(Locale locale) {
+ return new ITrackerResourceBundle(locale);
+ }
+ static ResourceBundle loadBundle(Locale locale, Object[][] data) {
+ return new ITrackerResourceBundle(locale, data);
+ }
- /**
- *
- * @return should be private or removed
- * @deprecated
- */
- public Object[][] getContents() {
- // Only load the array if it is requested for some reason.
- if(dataArray == null) {
- int i = 0;
- Object[][] newData = new Object[2][data.size()];
- Enumeration<String> keys = getKeys();
- while (keys.hasMoreElements()) {
- newData[0][i] = keys.nextElement();
- newData[1][i] = data.get(newData[0][i]);
+ static ResourceBundle loadBundle(Locale locale, List<Language> items) {
+ return new ITrackerResourceBundle(locale, items);
+ }
+
+ private ITrackerResourceBundle() {
+ super.setParent(ResourceBundle.getBundle(
+ ITrackerResources.RESOURCE_BUNDLE_NAME, new Locale(
+ ITrackerResources.getDefaultLocale())));
+ }
+
+ /**
+ * @param locale
+ */
+ private ITrackerResourceBundle(Locale locale) {
+ if (null == locale) {
+ locale = ITrackerResources.getLocale(ITrackerResources
+ .getDefaultLocale());
+ }
+ this.propertiesBundle = ResourceBundle.getBundle(
+ ITrackerResources.RESOURCE_BUNDLE_NAME, locale);
+
+ if (!locale.equals(ITrackerResources
+ .getLocale(ITrackerResources.BASE_LOCALE))) {
+ if (locale.getCountry().length() > 0) {
+ setParent(ITrackerResources.getBundle(new Locale(locale
+ .getLanguage())));
+ } else if (locale.getLanguage().length() > 0) {
+ setParent(ITrackerResources.getBundle(ITrackerResources
+ .getLocale(ITrackerResources.BASE_LOCALE)));
}
-
-
- this.dataArray = newData;
- }
-
- return dataArray.clone();
- }
+ }
- /**
- * @deprecated should be private
- * @param content
- */
- public void setContents(List<Language> content) {
- if(content != null ) {
- synchronized (data) {
- data.clear();
- this.dataArray = null;
- for(int i = 0; i < content.size(); i++) {
- data.put(content.get(i).getResourceKey(), content.get(i).getResourceValue());
- }
- }
- }
- }
+ }
- /**
- * @deprecated
- * @param content should be private
- */
- private void setContents(Object[][] content) {
- if(content != null && content.length == 2 && content[0].length == content[1].length) {
- synchronized (data) {
- data.clear();
- this.dataArray = null;
- for(int i = 0; i < content[0].length; i++) {
- data.put((String)content[0][i], content[1][i]);
- }
- }
- }
- }
+ public static ResourceBundle getBundle() {
+ return ITrackerResources.getBundle();
+ }
+ public static ResourceBundle getBundle(Locale locale) {
+ return ITrackerResources.getBundle(locale);
+ }
- @Override
- public Locale getLocale() {
- Locale l = super.getLocale();
- if (null == l && null != parent) {
- return parent.getLocale();
- }
- return l;
- }
+ /**
+ * @param locale
+ * @param data
+ * @deprecated used still for testing
+ */
+ public ITrackerResourceBundle(Locale locale, Object[][] data) {
+ this(locale);
+ setContents(data);
+ }
- public boolean isDirty(String key) {
- try {
- handleGetObject(key);
- } catch (ITrackerDirtyResourceException exception) {
- return true;
- }
- return false;
- }
-
- //public void updateValue(String key, Object value) {
- // synchronized (data) {
- // data.put(key, value);
- // }
- // }
-
- public void updateValue(String key, String value) {
- synchronized (data) {
- data.put(key, value);
- this.dataArray = null;
- }
- }
+ /**
+ * @param locale
+ * @param items
+ */
+ private ITrackerResourceBundle(Locale locale, List<Language> items) {
+ this(locale);
+ setContents(items);
+ }
- public void updateValue(Language model) {
- if(model != null) {
- synchronized (data) {
- data.put(model.getResourceKey(), model.getResourceValue());
- this.dataArray = null;
- }
- }
- }
-
- public void removeValue(String key, boolean markDirty) {
- if (key != null) {
- synchronized (data) {
- if(markDirty) {
- data.put(key, new DirtyKey(){});
- } else {
- data.remove(key);
- }
- this.dataArray = null;
- }
- }
- }
+ /**
+ *
+ * @return should be private or removed
+ * @deprecated
+ */
+ public Object[][] getContents() {
+ // Only load the array if it is requested for some reason.
+ if (dataArray == null) {
+ int i = 0;
+ Object[][] newData = new Object[2][data.size()];
+ Enumeration<String> keys = getKeys();
+ while (keys.hasMoreElements()) {
+ newData[0][i] = keys.nextElement();
+ newData[1][i] = data.get(newData[0][i]);
+ }
- /**
- * Implementation of ResourceBundle.handleGetObject. Returns
- * the request key from the internal data map.
- */
- public final Object handleGetObject(String key) {
- Object value = data.get(key);
- if(value instanceof DirtyKey) {
- throw new ITrackerDirtyResourceException("The requested key has been marked dirty.",
- "ITrackerResourceBundle_" + getLocale(),
- key);
- }
- return value;
- }
+ this.dataArray = newData;
+ }
- /**
- * Implementation of ResourceBundle.getKeys. Since it returns an enumeration,
- * It creates a new Hashtable, and returns that collections enumerator.
- */
- public Enumeration<String> getKeys() {
- Hashtable<String, Object> table = new Hashtable<String, Object>(data.size());
- if (null != parent) {
- Enumeration<String> keys = parent.getKeys();
- String key;
- while (keys.hasMoreElements()) {
- key = keys.nextElement();
- table.put(key, parent.getString(key));
-
+ return dataArray.clone();
+ }
+
+ /**
+ * @deprecated should be private
+ * @param content
+ */
+ public void setContents(List<Language> content) {
+ if (content != null) {
+ synchronized (data) {
+ data.clear();
+ this.dataArray = null;
+ for (int i = 0; i < content.size(); i++) {
+ data.put(content.get(i).getResourceKey(), content.get(i)
+ .getResourceValue());
+ }
}
- }
- table.putAll(data);
- return table.keys();
- }
+ }
+ }
- public static interface DirtyKey {
- }
+ /**
+ * @deprecated
+ * @param content
+ * should be private
+ */
+ private void setContents(Object[][] content) {
+ if (content != null && content.length == 2
+ && content[0].length == content[1].length) {
+ synchronized (data) {
+ data.clear();
+ this.dataArray = null;
+ for (int i = 0; i < content[0].length; i++) {
+ data.put((String) content[0][i], content[1][i]);
+ }
+ }
+ }
+ }
+
+ @Override
+ public Locale getLocale() {
+ Locale l = super.getLocale();
+ if (null == l && null != propertiesBundle) {
+ l = propertiesBundle.getLocale();
+ }
+ return l;
+ }
+
+ public boolean isDirty(String key) {
+ try {
+ handleGetObject(key);
+ } catch (ITrackerDirtyResourceException exception) {
+ return true;
+ }
+ return false;
+ }
+
+ // public void updateValue(String key, Object value) {
+ // synchronized (data) {
+ // data.put(key, value);
+ // }
+ // }
+
+ public void updateValue(String key, String value) {
+ synchronized (data) {
+ data.put(key, value);
+ this.dataArray = null;
+ }
+ }
+
+ public void updateValue(Language model) {
+ if (model != null) {
+ synchronized (data) {
+ data.put(model.getResourceKey(), model.getResourceValue());
+ this.dataArray = null;
+ }
+ }
+ }
+
+ public void removeValue(String key, boolean markDirty) {
+ if (key != null) {
+ synchronized (data) {
+ if (markDirty) {
+ data.put(key, new DirtyKey() {
+ });
+ } else {
+ data.remove(key);
+ }
+ this.dataArray = null;
+ }
+ }
+ }
+
+ /**
+ * Implementation of ResourceBundle.handleGetObject. Returns the request key
+ * from the internal data map.
+ */
+ public final Object handleGetObject(String key) {
+ Object value = data.get(key);
+ if (value instanceof DirtyKey) {
+ throw new ITrackerDirtyResourceException(
+ "The requested key has been marked dirty.",
+ "ITrackerResourceBundle_" + getLocale(), key);
+ }
+ if (null == value) {
+ try {
+ value = propertiesBundle.getObject(key);
+
+ // log.debug("handleGetObject2: "
+ // + key + "=" + value);
+ } catch (MissingResourceException e) {
+ if (log.isDebugEnabled()) {
+ log.debug("handleGetObject: " + key, e);
+ }
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Implementation of ResourceBundle.getKeys. Since it returns an
+ * enumeration, It creates a new Set, and returns that collections
+ * enumerator.
+ */
+ public Enumeration<String> getKeys() {
+ Set<String> set = new TreeSet<String>(data.keySet());
+ if (null != parent) {
+ Enumeration<String> keys = parent.getKeys();
+ String key;
+ while (keys.hasMoreElements()) {
+ key = keys.nextElement();
+ set.add(key);
+ }
+ }
+ if (null != propertiesBundle) {
+ Enumeration<String> keys = propertiesBundle.getKeys();
+ String key;
+ while (keys.hasMoreElements()) {
+ key = keys.nextElement();
+ set.add(key);
+ }
+ }
+ return Collections.enumeration(set);
+ }
+
+ public static interface DirtyKey {
+ }
}
Modified: itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResources.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResources.java 2009-03-02 13:16:02 UTC (rev 2178)
+++ itracker/trunk/src/main/java/org/itracker/core/resources/ITrackerResources.java 2009-03-09 18:12:03 UTC (rev 2179)
@@ -20,416 +20,564 @@
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.itracker.model.Language;
import org.itracker.persistence.dao.NoSuchEntityException;
import org.itracker.services.exceptions.ITrackerDirtyResourceException;
+import org.itracker.web.util.LoginUtilities;
import org.itracker.web.util.ServletContextUtils;
/**
*
* Please comment this class here. What is it for?
+ *
* @author ready
- *
+ *
*/
public class ITrackerResources {
-
- private static final Logger logger = Logger.getLogger(ITrackerResources.class);
-
- public static final String RESOURCE_BUNDLE_NAME = "org.itracker.core.resources.ITracker";
- public static final String DEFINED_LOCALES_KEY = "itracker.locales";
+ private static final Logger logger = Logger
+ .getLogger(ITrackerResources.class);
- public static final String DEFAULT_LOCALE = "en_US";
+ public static final String RESOURCE_BUNDLE_NAME = "org.itracker.core.resources.ITracker";
- public static final String BASE_LOCALE = "BASE";
+ public static final String DEFINED_LOCALES_KEY = "itracker.locales";
- public static final String NO_LOCALE = "ZZ_ZZ";
+ public static final String DEFAULT_LOCALE = "en_US";
- public static final String KEY_BASE_CUSTOMFIELD_TYPE = "itracker.web.generic.";
+ public static final String BASE_LOCALE = "BASE";
- public static final String KEY_BASE_WORKFLOW_EVENT = "itracker.workflow.field.event.";
+ public static final String NO_LOCALE = "ZZ_ZZ";
- public static final String KEY_BASE_PROJECT_STATUS = "itracker.project.status.";
+ public static final String KEY_BASE_CUSTOMFIELD_TYPE = "itracker.web.generic.";
- public static final String KEY_BASE_PERMISSION = "itracker.user.permission.";
+ public static final String KEY_BASE_WORKFLOW_EVENT = "itracker.workflow.field.event.";
- public static final String KEY_BASE_PRIORITY = "itracker.script.priority.";
+ public static final String KEY_BASE_PROJECT_STATUS = "itracker.project.status.";
- public static final String KEY_BASE_PRIORITY_LABEL = ".label";
+ public static final String KEY_BASE_PERMISSION = "itracker.user.permission.";
- public static final String KEY_BASE_PRIORITY_SIZE = "size";
+ public static final String KEY_BASE_PRIORITY = "itracker.script.priority.";
- public static final String KEY_BASE_RESOLUTION = "itracker.resolution.";
+ public static final String KEY_BASE_PRIORITY_LABEL = ".label";
- public static final String KEY_BASE_ISSUE_RELATION = "itracker.issuerelation.";
+ public static final String KEY_BASE_PRIORITY_SIZE = "size";
- public static final String KEY_BASE_SEVERITY = "itracker.severity.";
+ public static final String KEY_BASE_RESOLUTION = "itracker.resolution.";
- public static final String KEY_BASE_STATUS = "itracker.status.";
+ public static final String KEY_BASE_ISSUE_RELATION = "itracker.issuerelation.";
- public static final String KEY_BASE_USER_STATUS = "itracker.user.status.";
+ public static final String KEY_BASE_SEVERITY = "itracker.severity.";
- public static final String KEY_BASE_CUSTOMFIELD = "itracker.customfield.";
+ public static final String KEY_BASE_STATUS = "itracker.status.";
- public static final String KEY_BASE_CUSTOMFIELD_OPTION = ".option.";
+ public static final String KEY_BASE_USER_STATUS = "itracker.user.status.";
- public static final String KEY_BASE_CUSTOMFIELD_LABEL = ".label";
+ public static final String KEY_BASE_CUSTOMFIELD = "itracker.customfield.";
- private static String defaultLocale = null;
+ public static final String KEY_BASE_CUSTOMFIELD_OPTION = ".option.";
- private static HashMap<String,Locale> locales = new HashMap<String,Locale>();
+ public static final String KEY_BASE_CUSTOMFIELD_LABEL = ".label";
- private static HashMap<Locale,ResourceBundle> languages = new HashMap<Locale,ResourceBundle>();
+ public static final String KEY_BASE_LOCALE_NAME = "itracker.locale.name";
- private static boolean initialized = false;
+ private static String defaultLocale = DEFAULT_LOCALE;
- private static Object bundleLock = new Object();
+ private static HashMap<String, Locale> locales = new HashMap<String, Locale>();
-// private static ConfigurationService configurationService;
+ private static HashMap<Locale, ResourceBundle> languages = new HashMap<Locale, ResourceBundle>();
- public static Locale getLocale() {
- return getLocale(getDefaultLocale());
- }
+ private static boolean initialized = false;
- public static Locale getLocale(String localeString) {
-
- if (logger.isDebugEnabled()) {
- logger.debug("getLocale: " + localeString);
- }
- if (localeString == null || localeString.trim().equals("")) {
- return getLocale(getDefaultLocale());
- }
+ private static Object bundleLock = new Object();
- Locale locale = locales.get(localeString);
- if (locale == null && localeString != null && !localeString.trim().equals("")) {
- try {
- if (logger.isDebugEnabled()) {
- logger.debug("Creating new locale for '" + localeString + "'");
- }
- if (localeString.length() == 5) {
- locale = new Locale(localeString.substring(0, 2), localeString.substring(3));
- } else if (localeString.length() == 2) {
- locale = new Locale(localeString, "");
- } else if (localeString.equals(BASE_LOCALE)) {
- locale = new Locale("", "");
- } else {
-
- if (logger.isDebugEnabled()) {
- logger.debug("Invalid locale '" + localeString + "' specified. It must be either LN or LN_CN.");
- }
- throw new Exception("Invalid locale string");
- }
- } catch (Exception ex) {
- if (!localeString.equals(getDefaultLocale())) {
- logger.error("Failed creating new locale for '" + localeString
- + "' attempting for default locale '" + getDefaultLocale() + "'", ex);
- return getLocale(getDefaultLocale());
- } else {
- logger.error("Failed creating new default locale for '" + getDefaultLocale()
- + "' attempting for DEFAULT_LOCALE '" + DEFAULT_LOCALE + "'", ex);
- return getLocale(DEFAULT_LOCALE);
- }
- }
- locales.put(localeString, locale);
- }
- return locale;
- }
+ // private static ConfigurationService configurationService;
- public static String getDefaultLocale() {
- return (defaultLocale == null ? DEFAULT_LOCALE : defaultLocale);
- }
+ public static Locale getLocale() {
+ return getLocale(getDefaultLocale());
+ }
- public static void setDefaultLocale(String value) {
- defaultLocale = value;
- }
+ public static Locale getLocale(String localeString) {
- public static ResourceBundle getBundle() {
- return getBundle(getDefaultLocale());
- }
+// if (logger.isDebugEnabled()) {
+// logger.debug("getLocale: " + localeString);
+// }
+ if (localeString == null || localeString.trim().equals("")) {
+ return getLocale(getDefaultLocale());
+ }
- public static ResourceBundle getBundle(String locale) {
- if (locale == null || locale.equals("")) {
- locale = getDefaultLocale();
- }
+ Locale locale = locales.get(localeString);
+ if (locale == null && localeString != null
+ && !localeString.trim().equals("")) {
+ try {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Creating new locale for '" + localeString
+ + "'");
+ }
+ if (localeString.length() == 5) {
+ locale = new Locale(localeString.substring(0, 2),
+ localeString.substring(3));
+ } else if (localeString.length() == 2) {
+ locale = new Locale(localeString, "");
+ } else if (localeString.equals(BASE_LOCALE)) {
+ locale = new Locale("", "");
+ } else {
- return getBundle(getLocale(locale));
- }
+ logger
+ .error("Invalid locale '"
+ + localeString
+ + "' specified. It must be either LN or LN_CN.");
+ throw new Exception("Invalid locale string");
+ }
+ } catch (Exception ex) {
+ if (!localeString.equals(getDefaultLocale())) {
+ logger.error("Failed creating new locale for '"
+ + localeString
+ + "' attempting for default locale '"
+ + getDefaultLocale() + "'", ex);
+ return getLocale(getDefaultLocale());
+ } else {
+ logger.error("Failed creating new default locale for '"
+ + getDefaultLocale()
+ + "' attempting for DEFAULT_LOCALE '"
+ + DEFAULT_LOCALE + "'", ex);
+ return getLocale(DEFAULT_LOCALE);
+ }
+ }
+ locales.put(localeString, locale);
+ }
+ return locale;
+ }
- public static ResourceBundle getBundle(Locale locale) {
- if (locale == null) {
- locale = getLocale(getDefaultLocale());
- }
- ResourceBundle bundle = (ResourceBundle) languages.get(locale);
- if (bundle == null) {
- logger.debug("Loading new resource bundle for locale " + locale + " from the database.");
- List<Language> languageItems = ServletContextUtils.getItrackerServices().getConfigurationService().getLanguage(locale);
- bundle = ITrackerResourceBundle.loadBundle(locale, languageItems);
- if (bundle != null) {
- putBundle(locale, bundle);
- } else if (!locale.toString().equals(getDefaultLocale())) {
- bundle = getBundle(getLocale());
- }
- }
+ public static String getDefaultLocale() {
+ return (defaultLocale == null ? DEFAULT_LOCALE : defaultLocale);
+ }
- return bundle;
- }
+ public static void setDefaultLocale(String value) {
+ defaultLocale = value;
+ }
- public static ResourceBundle getEditBundle(Locale locale) {
- if (locale == null) {
- locale = getLocale(getDefaultLocale());
- }
- ResourceBundle bundle = (ResourceBundle) languages.get(locale);
- logger.debug("Loading new resource bundle for locale " + locale + " from the database.");
- List<Language> languageItems = ServletContextUtils.getItrackerServices().getConfigurationService().getLanguage(locale);
- bundle = ITrackerResourceBundle.loadBundle(locale, languageItems);
- if (bundle != null) {
- putBundle(locale, bundle);
- } else if (!locale.toString().equals(getDefaultLocale())) {
- bundle = getBundle(getLocale());
- }
+ public static String getLocaleDN(String locale, Locale displayLocale) {
+ String name;
+ if (null == displayLocale) {
+ displayLocale = getLocale();
+ }
+ try {
+ name = getBundle(displayLocale).getString(
+ KEY_BASE_LOCALE_NAME + "." + locale);
+ } catch (RuntimeException e) {
+ name = getLocaleNativeName(getLocale(locale));
+ }
- return bundle;
- }
+ return name;
+ }
- public static void putBundle(Locale locale, ResourceBundle bundle) {
- if (locale != null && bundle != null) {
- synchronized (bundleLock) {
- languages.put(locale, bundle);
- String localeString = locale.toString();
- if (localeString.length() == 5) {
- localeString = localeString.substring(0, 2) + "_" + localeString.substring(3).toUpperCase();
- }
- locales.put(localeString, locale);
- }
- }
- }
+ public static String getLocaleDN(Locale locale, Locale displayLocale) {
- /**
- * Clears a single cached resource bundle. The next time the bundle is
- * accessed, it will be reloaded and placed into the cache.
- */
- public static void clearBundle(Locale locale) {
- if (locale != null) {
- synchronized (bundleLock) {
- languages.remove(locale);
- }
- }
- }
+ if (null == displayLocale) {
+ return getLocaleNativeName(displayLocale);
+ }
+ return getLocaleDN(locale.toString(), displayLocale);
- /**
- * Clears all cached resource bundles. The next time a bundle is accessed,
- * it will be reloaded and placed into the cache.
- */
- public static void clearBundles() {
- synchronized (bundleLock) {
- languages.clear();
- }
- }
+ }
+ public static String getLocaleFullDN(Locale locale, Locale displayLocale) {
- /**
- * Clears a single key from all cached resource bundles. The key is then
- * marked that it is dirty and should be reloaded on hte next access.
- */
- public static void clearKeyFromBundles(String key, boolean markDirty) {
- if (key != null) {
- synchronized (bundleLock) {
- for (Iterator<ResourceBundle> iter = languages.values().iterator(); iter.hasNext();) {
- ((ITrackerResourceBundle) iter.next()).removeValue(key, markDirty);
- }
- }
- }
- }
+ if (null == locale) {
+ locale = new Locale("");
+ }
+ String fullName = getLocaleNativeName(locale);
+ if (null == displayLocale || locale.getLanguage().equals(displayLocale.getLanguage())) {
+ return fullName;
+ }
+ if (fullName.equals(locale.toString())) {
+ fullName = getLocaleDN(locale, displayLocale);
+ } else {
+ String localizedName = getLocaleDN(locale, displayLocale);
+ if (null != fullName && null != localizedName && !localizedName.trim().equals(fullName.trim())) {
+ return fullName.trim() + " (" + localizedName.trim() + ")";
+ } else if (null != localizedName) {
+ return localizedName.trim();
+ } else if (null != fullName) {
+ return fullName.trim();
+ }
+
+ }
+
+ return "Unknown: " + locale.toString();
- public static String getString(String key) {
- return getString(key, getLocale(defaultLocale));
- }
+ }
+ public static String getLocaleNativeName(Locale locale) {
+ try {
+ return getString(KEY_BASE_LOCALE_NAME, locale);
+// return getBundle(locale).getString(KEY_BASE_LOCALE_NAME);
+ } catch (MissingResourceException e) {
+ return locale.toString();
+// return locale.getDisplayName(locale);
+ }
+ }
- public static String getString(String key, String locale) {
- if (key == null) {
- return "";
- }
+ public static final Map<String, String> getLocaleNamesMap(Locale locale, Set<String> languageCodes,Map<String, List<String>> languagesMap ) {
+ Map<String, String> ret = new LinkedHashMap<String, String>();
+ for (String languageCode : languageCodes) {
+ List<String> languagelist = languagesMap.get(languageCode);
+
+ String name = getLocaleFullDN(ITrackerResources.getLocale(languageCode), locale);
- if (locale == null || locale.equals("")) {
- locale = getDefaultLocale();
- }
+ ret.put(languageCode, name);
+ for (String languageitem : languagelist) {
+ name = getLocaleFullDN(ITrackerResources.getLocale(languageitem), locale);
+ ret.put(languageitem, name);
+ }
- return getString(key, getLocale(locale));
- }
+ }
+ if (ret.size() == 0) {
+ ret.put(getDefaultLocale(), getLocaleNativeName(getLocale(getDefaultLocale())));
+ }
+ return ret;
+
+ }
+ public static ResourceBundle getBundle() {
+ return getBundle(getDefaultLocale());
+ }
- public static String getString(String key, Locale locale) {
- if (key == null) {
- return "";
- }
+ public static ResourceBundle getBundle(String locale) {
+ if (locale == null || locale.equals("")) {
+ locale = getDefaultLocale();
+ }
- if (locale == null) {
- locale = getLocale(getDefaultLocale());
- }
- String val;
- try {
- try {
-// if (logger.isDebugEnabled()) {
-// logger.debug("getString: " + key + " for locale " + locale);
-// }
- val = getBundle(locale).getString(key);
- if (null != val) {
+ return getBundle(getLocale(locale));
+ }
-// if (logger.isDebugEnabled()) {
-// logger.debug("getString: found " + val + " for key" + key + ", locale " + locale);
-// }
- return val;
- } else {
- val = ITrackerResources.getString(key);
+ public static ResourceBundle getBundle(Locale locale) {
+ if (locale == null) {
+ locale = getLocale(getDefaultLocale());
+ }
+ ResourceBundle bundle = (ResourceBundle) languages.get(locale);
+ if (bundle == null) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("getBundle: Loading new resource bundle for locale " + locale
+ + " from the database.");
+ }
+ List<Language> languageItems = ServletContextUtils
+ .getItrackerServices().getConfigurationService()
+ .getLanguage(locale);
+// if (locale.getLanguage().equals("")) {
+// locale = getLocale()
+// }
+ bundle = ITrackerResourceBundle.loadBundle(locale, languageItems);
+ if (logger.isDebugEnabled()) {
+ logger.debug("getBundle: got loaded for locale " + locale
+ + " with items " + languageItems + " from the database.");
+ }
+ if (bundle != null) {
+ putBundle(locale, bundle);
+ } else if (!locale.toString().equals(getDefaultLocale())) {
+ bundle = getBundle(getLocale());
+ }
+ }
-// if (logger.isDebugEnabled()) {
-// logger.debug("getString: found in base: " + val + " for key" + key);
-// }
- }
- } catch (ITrackerDirtyResourceException idre) {
+ return bundle;
+ }
-// logger.debug("Loading new key to replace dirty key " + key + " for resource bundle for locale "
-// + locale);
- Language languageItem = ServletContextUtils.getItrackerServices().getConfigurationService().getLanguageItemByKey(key, locale);
- ((ITrackerResourceBundle) getBundle(locale)).updateValue(languageItem);
- }
- return getBundle(locale).getString(key);
- } catch (NullPointerException ex) {
- logger.error("Unable to get any resources. The requested locale was " + locale, ex);
- return "MISSING BUNDLE: " + locale;
- } catch (MissingResourceException ex) {
- logger.warn("MissingResourceException caught while retrieving translation key '" + key + "' for locale "
- + locale, ex);
- return "MISSING KEY: " + key;
- } catch (NoSuchEntityException ex) {
- logger.info("getString: not found " + key + " locale: " + locale, ex);
- try {
- return getEditBundle(locale).getString(key);
- } catch (Exception ex2) {
- logger.warn("getString: caught while retrieving translation key '" + key + "' for locale "
- + locale, ex2);
- return "MISSING KEY: " + key;
- }
- }
- }
+ public static ResourceBundle getEditBundle(Locale locale) {
+ if (locale == null) {
+ locale = getLocale(getDefaultLocale());
+ }
+ ResourceBundle bundle = (ResourceBundle) languages.get(locale);
+ logger.debug("Loading new resource bundle for locale " + locale
+ + " from the database.");
+ List<Language> languageItems = ServletContextUtils
+ .getItrackerServices().getConfigurationService().getLanguage(
+ locale);
+ bundle = ITrackerResourceBundle.loadBundle(locale, languageItems);
+ if (bundle != null) {
+ putBundle(locale, bundle);
+ } else if (!locale.toString().equals(getDefaultLocale())) {
+ bundle = getBundle(getLocale());
+ }
- public static String getString(String key, Object[] options) {
- return getString(key, getLocale(getDefaultLocale()), options);
- }
+ return bundle;
+ }
- public static String getString(String key, String locale, Object[] options) {
- return getString(key, getLocale(locale), options);
- }
+ public static void putBundle(Locale locale, ResourceBundle bundle) {
+ if (locale != null && bundle != null) {
+ synchronized (bundleLock) {
+ languages.put(locale, bundle);
+// if (bundle instanceof ITrackerResourceBundle) {
+// setData((ITrackerResourceBundle)bundle);
+// }
+ String localeString = locale.toString();
+ if (localeString.length() == 5) {
+ localeString = localeString.substring(0, 2) + "_"
+ + localeString.substring(3).toUpperCase();
+ }
+ locales.put(localeString, locale);
+ }
+ }
+ }
- public static String getString(String key, Locale locale, Object[] options) {
- String message = getString(key, locale);
- return MessageFormat.format(message, options, locale);
- }
+ static void setData(ITrackerResourceBundle bundle) {
- public static String getString(String key, String locale, String option) {
- String message = getString(key, locale);
- return MessageFormat.format(message, new Object[] { option }, getLocale(locale));
- }
+ List<Language> languageItems = ServletContextUtils
+ .getItrackerServices().getConfigurationService()
+ .getLanguage(bundle.getLocale());
+ bundle.setContents(languageItems);
+ }
+ /**
+ * Clears a single cached resource bundle. The next time the bundle is
+ * accessed, it will be reloaded and placed into the cache.
+ */
+ public static void clearBundle(Locale locale) {
+ if (locale != null) {
+ synchronized (bundleLock) {
+ ResourceBundle bundle = languages.get(locale);
+// if (bundle instanceof ITrackerResourceBundle) {
+// ((ITrackerResourceBundle)bundle).
+// }
+ languages.remove(locale);
+ }
+ }
+ }
- public static String getString(String key, Locale locale, String option) {
- String message = getString(key, locale);
- return MessageFormat.format(message, new Object[] { option }, locale);
- }
+ /**
+ * Clears all cached resource bundles. The next time a bundle is accessed,
+ * it will be reloaded and placed into the cache.
+ */
+ public static void clearBundles() {
+ synchronized (bundleLock) {
- public static String getCheckForKey(String key) throws MissingResourceException {
- return getCheckForKey(key, getLocale());
- }
+ languages.clear();
+
+ }
+ }
- public static String getCheckForKey(String key, Locale locale) throws MissingResourceException {
- try {
- return getBundle(locale).getString(key);
- } catch (ITrackerDirtyResourceException idre) {
- return getString(key, locale);
- } catch (NullPointerException ex) {
- logger.error("Unable to get ResourceBundle for locale " + locale, ex);
- throw new MissingResourceException("MISSING LOCALE: " + locale, "ITrackerResources", key);
- }
- }
+ /**
+ * Clears a single key from all cached resource bundles. The key is then
+ * marked that it is dirty and should be reloaded on hte next access.
+ */
+ public static void clearKeyFromBundles(String key, boolean markDirty) {
+ if (key != null) {
+ synchronized (bundleLock) {
+ for (Iterator<ResourceBundle> iter = languages.values()
+ .iterator(); iter.hasNext();) {
+ ((ITrackerResourceBundle) iter.next()).removeValue(key,
+ markDirty);
+ }
+ }
+ }
+ }
- public static boolean isLongString(String key) {
- String value = getString(key);
- if (value.length() > 80 || value.indexOf('\n') > 0) {
- return true;
- }
- return false;
- }
+ public static String getString(String key) {
+ return getString(key, getLocale(defaultLocale));
+ }
- public static String escapeUnicodeString(String str, boolean escapeAll) {
- if(str == null) {
- return "";
- }
-
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < str.length(); i++) {
- char ch = str.charAt(i);
- if (!escapeAll && ((ch >= 0x0020) && (ch <= 0x007e))) {
- sb.append(ch);
- } else {
- sb.append('\\').append('u');
- sb.append(encodeHex((ch >> 12) & 0xF));
- sb.append(encodeHex((ch >> 8) & 0xF));
- sb.append(encodeHex((ch >> 4) & 0xF));
- sb.append(encodeHex(ch & 0xF));
- }
- }
- return sb.toString();
- }
+ public static String getString(String key, String locale) {
+ if (key == null) {
+ return "";
+ }
- public static String unescapeUnicodeString(String str) {
- StringBuffer sb = new StringBuffer();
+ if (locale == null || locale.equals("")) {
+ locale = getDefaultLocale();
+ }
- for (int i = 0; i < str.length();) {
- char ch = str.charAt(i++);
- if (ch == '\\') {
- if (str.charAt(i++) == 'u') {
- int value = 0;
- for (int j = 0; j < 4; j++) {
- value = (value << 4) + decodeHex(str.charAt(i++));
- }
- sb.append((char) value);
- } else {
- sb.append("\\" + str.charAt(i));
- }
- } else {
- sb.append(ch);
- }
- }
- return sb.toString();
- }
+ return getString(key, getLocale(locale));
+ }
- public static final String HEXCHARS = "0123456789ABCDEF";
+ public static String getString(String key, Locale locale) {
+ if (key == null) {
+ return "";
+ }
- public static char encodeHex(int value) {
- return HEXCHARS.charAt(value & 0xf);
- }
+ if (locale == null) {
+ locale = getLocale(getDefaultLocale());
+ }
+ String val;
+ try {
+ try {
+// if (logger.isDebugEnabled()) {
+// logger.debug("getString: " + key + " for locale " + locale);
+// }
+ val = getBundle(locale).getString(key);
+ if (null != val) {
- public static int decodeHex(char ch) {
- int value = -1;
+// if (logger.isDebugEnabled()) {
+// logger.debug("getString: found " + val + " for key" + key
+// + ", locale " + locale);
+// }
+ return val;
+ } else {
+ val = ITrackerResources.getString(key);
- if (ch >= '0' && ch <= '9') {
- value = ch - '0';
- } else if (ch >= 'a' && ch <= 'f') {
- value = ch - 'a' + 10;
- } else if (ch >= 'A' && ch <= 'F') {
- value = ch - 'A' + 10;
- }
+// if (logger.isDebugEnabled()) {
+// logger.debug("getString: found in base: " + val +
+// " for key" + key);
+// }
+ }
+ } catch (ITrackerDirtyResourceException idre) {
- return value;
- }
+// logger.debug("Loading new key to replace dirty key " + key +
+// " for resource bundle for locale "
+// + locale);
+ Language languageItem = ServletContextUtils
+ .getItrackerServices().getConfigurationService()
+ .getLanguageItemByKey(key, locale);
+ ResourceBundle bundle = getBundle(locale);
+ ((ITrackerResourceBundle) bundle)
+ .updateValue(languageItem);
+ val = bundle.getString(key);
+ }
+ return val;
+ } catch (NullPointerException ex) {
+ logger.error(
+ "Unable to get any resources. The requested locale was "
+ + locale, ex);
+ return "MISSING BUNDLE: " + locale;
+ } catch (MissingResourceException ex) {
+ logger.warn(
+ "MissingResourceException caught while retrieving translation key '"
+ + key + "' for locale " + locale, ex);
+ return "MISSING KEY: " + key;
+ } catch (NoSuchEntityException ex) {
+ logger.info("getString: not found " + key + " locale: " + locale,
+ ex);
+ try {
+ return getEditBundle(locale).getString(key);
+ } catch (Exception ex2) {
+ logger.warn(
+ "getString: caught while retrieving translation key '"
+ + key + "' for locale " + locale, ex2);
+ return "MISSING KEY: " + key;
+ }
+ }
+ }
-// public static void setConfigurationService(ConfigurationService configurationService) {
-// ITrackerResources.configurationService = configurationService;
-// }
+ public static String getString(String key, Object[] options) {
+ return getString(key, getLocale(getDefaultLocale()), options);
+ }
+ public static String getString(String key, String locale, Object[] options) {
+ return getString(key, getLocale(locale), options);
+ }
+
+ public static String getString(String key, Locale locale, Object[] options) {
+ String message = getString(key, locale);
+ return MessageFormat.format(message, options, locale);
+ }
+
+ public static String getString(String key, String locale, String option) {
+ String message = getString(key, locale);
+ return MessageFormat.format(message, new Object[] { option },
+ getLocale(locale));
+ }
+
+ public static String getString(String key, Locale locale, String option) {
+ String message = getString(key, locale);
+ return MessageFormat.format(message, new Object[] { option }, locale);
+ }
+
+ public static String getCheckForKey(String key)
+ throws MissingResourceException {
+ return getCheckForKey(key, getLocale());
+ }
+
+ public static String getCheckForKey(String key, Locale locale)
+ throws MissingResourceException {
+ try {
+ return getBundle(locale).getString(key);
+ } catch (ITrackerDirtyResourceException idre) {
+ return getString(key, locale);
+ } catch (NullPointerException ex) {
+ logger.error("Unable to get ResourceBundle for locale " + locale,
+ ex);
+ throw new MissingResourceException("MISSING LOCALE: " + locale,
+ "ITrackerResources", key);
+ }
+ }
+
+ public static boolean isLongString(String key) {
+ String value = getString(key);
+ if (value.length() > 80 || value.indexOf('\n') > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ public static String escapeUnicodeString(String str, boolean escapeAll) {
+ if (str == null) {
+ return "";
+ }
+
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < str.length(); i++) {
+ char ch = str.charAt(i);
+ if (!escapeAll && ((ch >= 0x0020) && (ch <= 0x007e))) {
+ sb.append(ch);
+ } else {
+ sb.append('\\').append('u');
+ sb.append(encodeHex((ch >> 12) & 0xF));
+ sb.append(encodeHex((ch >> 8) & 0xF));
+ sb.append(encodeHex((ch >> 4) & 0xF));
+ sb.append(encodeHex(ch & 0xF));
+ }
+ }
+ return sb.toString();
+ }
+
+ public static String unescapeUnicodeString(String str) {
+ StringBuffer sb = new StringBuffer();
+
+ for (int i = 0; i < str.length();) {
+ char ch = str.charAt(i++);
+ if (ch == '\\') {
+ if (str.charAt(i++) == 'u') {
+ int value = 0;
+ for (int j = 0; j < 4; j++) {
+ value = (value << 4) + decodeHex(str.charAt(i++));
+ }
+ sb.append((char) value);
+ } else {
+ sb.append("\\" + str.charAt(i));
+ }
+ } else {
+ sb.append(ch);
+ }
+ }
+ return sb.toString();
+ }
+
+ public static final String HEXCHARS = "0123456789ABCDEF";
+
+ public static char encodeHex(int value) {
+ return HEXCHARS.charAt(value & 0xf);
+ }
+
+ public static int decodeHex(char ch) {
+ int value = -1;
+
+ if (ch >= '0' && ch <= '9') {
+ value = ch - '0';
+ } else if (ch >= 'a' && ch <= 'f') {
+ value = ch - 'a' + 10;
+ } else if (ch >= 'A' && ch <= 'F') {
+ value = ch - 'A' + 10;
+ }
+
+ return value;
+ }
+
+ // public static void setConfigurationService(ConfigurationService
+ // configurationService) {
+ // ITrackerResources.configurationService = configurationService;
+ // }
+
public static boolean isInitialized() {
return initialized;
}
@@ -438,4 +586,26 @@
ITrackerResources.initialized = initialized;
}
+ public static String getParentLocale(String locale) {
+ String localeCode = locale;
+ if (localeCode == null) {
+ localeCode = getDefaultLocale();
+ } else if (localeCode.equals(getDefaultLocale())) {
+ localeCode = BASE_LOCALE;
+ } else {
+ Locale l = getLocale(locale);
+
+ if (!l.getVariant().equals("")) {
+ localeCode = l.getLanguage() + "_" + l.getCountry();
+ }
+ if (!l.getCountry().equals("")) {
+ localeCode = l.getLanguage();
+ }
+ if (!l.getLanguage().equals("")) {
+ localeCode = getDefaultLocale();
+ }
+ }
+ return localeCode;
+ }
+
}
Modified: itracker/trunk/src/main/java/org/itracker/model/Language.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/model/Language.java 2009-03-02 13:16:02 UTC (rev 2178)
+++ itracker/trunk/src/main/java/org/itracker/model/Language.java 2009-03-09 18:12:03 UTC (rev 2179)
@@ -18,6 +18,9 @@
package org.itracker.model;
+import java.util.Comparator;
+
+import org.apache.commons.lang.builder.CompareToBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/**
@@ -27,6 +30,7 @@
*/
public class Language extends AbstractEntity {
+
/**
*
*/
@@ -118,5 +122,28 @@
return new ToStringBuilder(this).append("id", getId()).append("resourceKey",
getResourceKey()).append("locale", getLocale()).append("value", getResourceValue()).toString();
}
+
+ public static final Comparator<Language> KEY_COMPARATOR = new LanguageKeyComparator();
+ private static class LanguageKeyComparator implements Comparator<Language> {
+
+ public int compare(Language o1, Language o2) {
+ return new CompareToBuilder().append(o1.getResourceKey(), o2.getResourceKey()).append(o1.getLocale(), o2.getLocale()).append(o1.getId(), o2.getId()).toComparison();
+ }
+
+ }
+
+ public static final Comparator<Language> VALUE_COMPARATOR = new LanguageValueComparator();
+
+ private static class LanguageValueComparator implements Comparator<Language> {
+
+ public int compare(Language o1, Language o2) {
+ return new CompareToBuilder()
+ .append(o1.getResourceValue(), o2.getResourceValue())
+ .append(o1.getResourceKey(), o2.getResourceKey())
+ .append(o1.getId(), o2.getId()).toComparison();
+ }
+
+ }
+
}
\ No newline at end of file
Modified: itracker/trunk/src/main/java/org/itracker/model/Permission.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/model/Permission.java 2009-03-02 13:16:02 UTC (rev 2178)
+++ itracker/trunk/src/main/java/org/itracker/model/Permission.java 2009-03-09 18:12:03 UTC (rev 2179)
@@ -44,7 +44,7 @@
/**
* The type of permission granted. TODO: use PermissionType enum
*/
- private int type;
+ private Integer type;
/**
* The project on which this permission is granted. May be <tt>null</tt>
@@ -75,7 +75,7 @@
* @param user
* grantee
*/
- public Permission(int type, User user) {
+ public Permission(Integer type, User user) {
this(type, user, null);
}
@@ -90,17 +90,17 @@
* on which permission is granted, or <tt>null</tt> for all
* projects
*/
- public Permission(int type, User user, Project project) {
+ public Permission(Integer type, User user, Project project) {
setPermissionType(type);
setUser(user);
setProject(project);
}
- public int getPermissionType() {
+ public Integer getPermissionType() {
return type;
}
- public void setPermissionType(int type) {
+ public void setPermissionType(Integer type) {
this.type = type;
}
Modified: itracker/trunk/src/main/java/org/itracker/model/util/PropertiesFileHandler.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/model/util/PropertiesFileHandler.java 2009-03-02 13:16:02 UTC (rev 2178)
+++ itracker/trunk/src/main/java/org/itracker/model/util/PropertiesFileHandler.java 2009-03-09 18:12:03 UTC (rev 2179)
@@ -40,6 +40,9 @@
public void addProperties(String resource) {
if(resource == null || resource.equals("") || ! resource.endsWith(".properties")) {
+ if (logger.isInfoEnabled()) {
+ logger.info("addProperties: skip " +resource);
+ }
return;
}
Modified: itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java
===================================================================
--- itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java 2009-03-02 13:16:02 UTC (rev 2178)
+++ itracker/trunk/src/main/java/org/itracker/services/implementations/ConfigurationServiceImpl.java 2009-03-09 18:12:03 UTC (rev 2179)
@@ -30,6 +30,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
+import java.util.ResourceBundle;
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -57,6 +58,7 @@
import org.itracker.services.util.IssueUtilities;
import org.itracker.services.util.NamingUtilites;
import org.itracker.services.util.SystemConfigurationUtilities;
+import org.jfree.util.Log;
/**
* Implementation of the ConfigurationService Interface.
@@ -843,19 +845,35 @@
}
public Language getLanguageItemByKey(String key, Locale locale) {
- Language languageItem = null;
+ Language languageItem;
+ try {
+ languageItem = languageDAO.findByKeyAndLocale(key, ITrackerResources.BASE_LOCALE);
+ } catch (RuntimeException e) {
+ languageItem = null;
+ }
- languageItem = languageDAO.findByKeyAndLocale(key, ITrackerResources.BASE_LOCALE);
-
- if (locale != null && !"".equals(locale.getLanguage())) {
- languageItem = languageDAO.findByKeyAndLocale(key, locale.getLanguage());
- if (!"".equals(locale.getCountry())) {
- try {
- languageItem = languageDAO.findByKeyAndLocale(key, locale.toString());
- } catch (Exception ex){
- }
+ if (null == locale){
+
+ locale = ITrackerResources.getLocale(ITrackerResources.BASE_LOCALE);
+
+ }
+ try {
+ return languageDAO.findByKeyAndLocale(key, locale.getLanguage());
+ } catch (RuntimeException re) {
+ if (null == languageItem) {
+ languageItem = new Language(locale.getDisplayName(), key, ITrackerResources.getBundle(locale.getLanguage()).getString(key));
+ }
+ }
+ if (!"".equals(locale.getCountry())) {
+ try {
+ return languageDAO.findByKeyAndLocale(key, locale.toString());
+ } catch (RuntimeException ex){
+ if (null == languageItem){
+ return new Language(locale.getDisplayName(), key, ITrackerResources.getBundle(locale).getString(key));
+ }
}
}
+
return languageItem;
}
@@ -998,50 +1016,54 @@
Map<String,String> language = new HashMap<String,String>();
+
+ if (locale == null) {
+ locale = new Locale("");
+ }
+
+ String localeString = (locale.toString().equals("") ? ITrackerResources.BASE_LOCALE : locale.toString());
- Collection<Language> baseItems = languageDAO.findByLocale(ITrackerResources.BASE_LOCALE);
-
- for (Iterator<Language> iterator = baseItems.iterator(); iterator.hasNext();) {
+ Collection<Language> items = languageDAO.findByLocale(localeString);
+
+ for (Iterator<Language> iterator = items.iterator(); iterator.hasNext();) {
Language item = (Language) iterator.next();
language.put(item.getResourceKey(), item.getResourceValue());
}
+// if (locale != null && !"".equals(locale.getLanguage())) {
+//
+// Collection<Language> languageItems = languageDAO.findByLocale(locale.getLanguage());
+//
+// for (Iterator<Language> iterator = languageItems.iterator(); iterator.hasNext();) {
+//
+// Language item = (Language) iterator.next();
+//
+// language.put(item.getResourceKey(), item.getResourceValue());
+//
+// }
+//
+// if (!"".equals(locale.getCountry())) {
+//
+// Collection<Language> countryItems = languageDAO.findByLocale(locale.toString());
+//
+// for (Iterator<Language> iterator = countryItems.iterator(); iterator.hasNext();) {
+//
+// Language item = (Language) iterator.next();
+//
+// language.put(item.getResourceKey(), item.getResourceValue());
+//
+// }
+//
+// }
+//
+// }
- if (locale != null && !"".equals(locale.getLanguage())) {
-
- Collection<Language> languageItems = languageDAO.findByLocale(locale.getLanguage());
-
- for (Iterator<Language> iterator = languageItems.iterator(); iterator.hasNext();) {
-
- Language item = (Language) iterator.next();
-
- language.put(item.getResourceKey(), item.getResourceValue());
-
- }
-
- if (!"".equals(locale.getCountry())) {
-
- Collection<Language> countryItems = languageDAO.findByLocale(locale.toString());
-
- for (Iterator<Language> iterator = countryItems.iterator(); iterator.hasNext();) {
-
- Language item = (Language) iterator.next();
-
- language.put(item.getResourceKey(), item.getResourceValue());
-
- }
-
- }
-
- }
-
Language[] languageArray = new Language[language.size()];
int i = 0;
- String localeString = (locale == null ? ITrackerResources.BASE_LOCALE : locale.toString());
for (Iterator<String> iterator = language.keySet().iterator(); iterator.hasNext(); i++) {
@@ -1193,36 +1215,31 @@
logger.debug("Loading database with locale " + locale);
- PropertiesFileHandler localePropertiesHandler = new PropertiesFileHandler(
- "/org/itracker/core/resources/ITracker"
- + (ITrackerResources.BASE_LOCALE.equals(locale) ? "" : "_" + locale) + ".properties");
+// PropertiesFileHandler localePropertiesHandler = new PropertiesFileHandler(
+// "/org/itracker/core/resources/ITracker"
+// + (ITrackerResources.BASE_LOCALE.equals(locale) ? "" : "_" + locale) + ".properties");
- if (localePropertiesHandler.hasProperties()) {
+// if (localePropertiesHandler.hasProperties()) {
- Properties localeProperties = localePropertiesHandler.getProperties();
+// ...
[truncated message content] |