Changeset 5053


Ignore:
Timestamp:
Aug 18, 2009, 11:52:16 AM (13 years ago)
Author:
Nicklas Nordborg
Message:

References #108: Logging the change history of an item

  • Changed default sort order to sort by descending time, eg. most recent change first.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/clients/web/net/sf/basedb/clients/web/Base.java

    r4989 r5053  
    5858import net.sf.basedb.core.ItemResultIterator;
    5959import net.sf.basedb.core.Unit;
     60import net.sf.basedb.core.ItemContext.SortDirection;
    6061import net.sf.basedb.core.query.EntityQuery;
    6162import net.sf.basedb.core.query.Restrictions;
     
    884885    Create a default <code>ItemContext</code> with settings for default
    885886    visible columns and sort property. 'MINE' and 'SHARED' objects are set to be included.
    886     @param sortProperty The property, as a String, to sort on.
     887    @param sortProperty The property, as a String, to sort on. If it starts with
     888      a '-', the sort is made in descending order (and the minus is removed)
    887889    @param defaultColumns The visible columns as a comma separated String.
    888890    @return an {@link net.sf.basedb.core.ItemContext} object
     
    890892  public static ItemContext createDefaultContext(String sortProperty, String defaultColumns)
    891893  {
    892     ItemContext cc = new ItemContext(sortProperty, ItemContext.SortDirection.ASC, 30, 0);
     894    SortDirection sortDirection = SortDirection.ASC;
     895    if (sortProperty.startsWith("-"))
     896    {
     897      sortDirection = SortDirection.DESC;
     898      sortProperty = sortProperty.substring(1);
     899    }
     900    ItemContext cc = new ItemContext(sortProperty, sortDirection, 30, 0);
    893901    cc.setSetting("columns", defaultColumns);
    894902    cc.setObject("defaultColumns", defaultColumns);
  • trunk/www/common/history/index.jsp

    r5048 r5053  
    6363<%!
    6464  private static final ItemContext defaultContext =
    65     Base.createDefaultContext("$hst.time", "time,changeType,user,changeInfo");
     65    Base.createDefaultContext("-$hst.time", "time,changeType,user,changeInfo");
    6666  private static final Item itemType = Item.CHANGEHISTORY;
    6767%>
Note: See TracChangeset for help on using the changeset viewer.