Fix von Sören, damit die Datumsangaben in den Object Lists korrekt an die gewählte Sprache angepasst werden. Zusaetzlich muss das theme angepasst werden!
git-svn-id: https://svn.libreccm.org/ccm/trunk@545 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e855c3e199
commit
ec4bc5fa78
|
|
@ -36,12 +36,14 @@ import com.arsdigita.web.URL;
|
|||
import com.arsdigita.web.ParameterMap;
|
||||
import com.arsdigita.web.Web;
|
||||
// Quasimodo: End
|
||||
import java.text.DateFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -224,7 +226,9 @@ public class DataCollectionRenderer extends LockableImpl {
|
|||
private void outputValue(final Element item, final Object value,
|
||||
final String name,
|
||||
final String[] paths, final int depth) {
|
||||
if( null == value ) return;
|
||||
if (null == value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value instanceof DataAssociation) {
|
||||
DataAssociation assoc = (DataAssociation) value;
|
||||
|
|
@ -235,21 +239,19 @@ public class DataCollectionRenderer extends LockableImpl {
|
|||
}
|
||||
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
else if( value instanceof DataObject ) {
|
||||
} else if (value instanceof DataObject) {
|
||||
try {
|
||||
Object newValue = ((DataObject) value).get(paths[depth]);
|
||||
outputValue(item, newValue, name, paths, depth + 1);
|
||||
} catch (PersistenceException ex) {
|
||||
valuePersistenceError(ex, paths, depth);
|
||||
}
|
||||
}
|
||||
|
||||
else if( depth == paths.length ) {
|
||||
} else if (depth == paths.length) {
|
||||
Element attribute = Navigation.newElement("attribute");
|
||||
attribute.addAttribute("name", name);
|
||||
attribute.setText(value.toString());
|
||||
|
||||
// Special handling of Date - see ccm-core/src/com/arsdigita/domain/DomainObjectXMLRenderer.java
|
||||
if (value instanceof Date) {
|
||||
Date date = (Date) value;
|
||||
Calendar calDate = Calendar.getInstance();
|
||||
|
|
@ -260,11 +262,21 @@ public class DataCollectionRenderer extends LockableImpl {
|
|||
attribute.addAttribute("hour", Integer.toString(calDate.get(Calendar.HOUR_OF_DAY)));
|
||||
attribute.addAttribute("minute", Integer.toString(calDate.get(Calendar.MINUTE)));
|
||||
attribute.addAttribute("second", Integer.toString(calDate.get(Calendar.SECOND)));
|
||||
|
||||
// Quasimodo: BEGIN
|
||||
// Add attributes for date and time
|
||||
Locale negLocale = com.arsdigita.dispatcher.DispatcherHelper.getNegotiatedLocale();
|
||||
DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, negLocale);
|
||||
DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, negLocale);
|
||||
attribute.addAttribute("date", dateFormatter.format(date));
|
||||
attribute.addAttribute("time", timeFormatter.format(date));
|
||||
// Quasimodo: END
|
||||
|
||||
}
|
||||
item.addContent(attribute);
|
||||
} else {
|
||||
valuePersistenceError(null, paths, depth);
|
||||
}
|
||||
|
||||
else valuePersistenceError( null, paths, depth );
|
||||
}
|
||||
|
||||
private void valuePersistenceError( PersistenceException ex,
|
||||
|
|
@ -273,12 +285,17 @@ public class DataCollectionRenderer extends LockableImpl {
|
|||
msg.append("Attribute ");
|
||||
for (int i = 0; i <= depth; i++) {
|
||||
msg.append(paths[i]);
|
||||
if( i != depth ) msg.append( '.' );
|
||||
if (i != depth) {
|
||||
msg.append('.');
|
||||
}
|
||||
}
|
||||
msg.append(" doesn't exist");
|
||||
|
||||
if( null == ex ) s_log.warn( msg.toString() );
|
||||
else s_log.warn( msg.toString(), ex );
|
||||
if (null == ex) {
|
||||
s_log.warn(msg.toString());
|
||||
} else {
|
||||
s_log.warn(msg.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
protected void generateItemXML(Element item,
|
||||
|
|
|
|||
Loading…
Reference in New Issue