Update of /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib In directory james.mmbase.org:/tmp/cvs-serv23107
Modified Files: IndexTag.java SizeTag.java Log Message: Made these work in dynamic includes/tagfile (to make e.g. a generic my:paging tag) See also: http://cvs.mmbase.org/viewcvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib Index: IndexTag.java =================================================================== RCS file: /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/IndexTag.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- IndexTag.java 27 Feb 2008 10:49:01 -0000 1.23 +++ IndexTag.java 3 Feb 2009 13:12:27 -0000 1.24 @@ -22,7 +22,7 @@ * The index of current item of a list. * * @author Michiel Meeuwissen - * @version $Id: IndexTag.java,v 1.23 2008/02/27 10:49:01 michiel Exp $ + * @version $Id: IndexTag.java,v 1.24 2009/02/03 13:12:27 michiel Exp $ */ public class IndexTag extends ListReferrerTag implements Writer, QueryContainerReferrer { @@ -59,7 +59,8 @@ } else if (parentListId != Attribute.NULL) { index = getList().getIndex() + getOffset();; } else { - Tag tag = findLoopOrQuery(null, true); + Tag tag = findLoopOrQuery(null, false); + if (tag != null) { if (tag instanceof QueryContainer) { Query query = ((QueryContainer) tag).getQuery(); index = query.getOffset() / query.getMaxNumber() + offset.getInt(this, 0); @@ -71,6 +72,11 @@ index += -status.getBegin() + offset.getInt(this, 0); } } + } else { + Query query = getQuery(container); + index = query.getOffset() / query.getMaxNumber() + offset.getInt(this, 0); + + } } helper.setValue(index); Index: SizeTag.java =================================================================== RCS file: /var/cvs/applications/taglib/src/org/mmbase/bridge/jsp/taglib/SizeTag.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -b -r1.28 -r1.29 --- SizeTag.java 27 Feb 2008 10:49:01 -0000 1.28 +++ SizeTag.java 3 Feb 2009 13:12:27 -0000 1.29 @@ -23,7 +23,7 @@ * The size of a list or of a nodelistcontainer (then the query is consulted). * * @author Michiel Meeuwissen - * @version $Id: SizeTag.java,v 1.28 2008/02/27 10:49:01 michiel Exp $ + * @version $Id: SizeTag.java,v 1.29 2009/02/03 13:12:27 michiel Exp $ */ public class SizeTag extends ListReferrerTag implements Writer, QueryContainerReferrer { @@ -71,7 +71,8 @@ } else if (parentListId != Attribute.NULL) { listProviderSize(getList()); } else { - Tag tag = findLoopOrQuery(null, true); + Tag tag = findLoopOrQuery(null, false); + if (tag != null) { if (tag instanceof TreeContainerTag) { helper.setValue(((TreeContainerTag)tag).getTree().size()); } else if (tag instanceof QueryContainer) { @@ -79,6 +80,10 @@ } else { listProviderSize((LoopTag) tag); } + } else { + Query q = getQuery(container); + helper.setValue(Queries.count(q)); + } } if (getId() != null) { _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs