bug 2921 : Frankly this is a solution I take no pride in. Paging is disabled on search. This is OK if search is sufficiently focussed, but a bit untidy when it isn't.
status 2921: resolved FIXED
This commit is contained in:
parent
74e730c444
commit
ba7e48348a
transforms
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.40 $
|
||||
$Date: 2009-05-08 16:27:24 $
|
||||
$Revision: 1.41 $
|
||||
$Date: 2009-05-11 15:01:49 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
@ -72,7 +72,7 @@
|
|||
//
|
||||
// Automatically generated abstract super class for controllers for the
|
||||
// <xsl:value-of select="/adl:application/@name"/> application; generated using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.40 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.41 $', 10)"/>
|
||||
//
|
||||
// <xsl:value-of select="/adl:application/@revision"/>
|
||||
//
|
||||
|
@ -182,7 +182,7 @@
|
|||
//
|
||||
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||
// Automatically generated from application description using
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.40 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.41 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
@ -741,6 +741,7 @@
|
|||
|
||||
ICriteria search =
|
||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', @name)"/>));
|
||||
Boolean withSearchCriteria = false;
|
||||
|
||||
<xsl:for-each select="adl:property">
|
||||
<xsl:variable name="base-type">
|
||||
|
@ -758,8 +759,10 @@
|
|||
<xsl:with-param name="property" select="."/>
|
||||
<xsl:with-param name="value">Params["<xsl:value-of select="concat( 'search_', @name)"/>"]</xsl:with-param>
|
||||
</xsl:call-template>;
|
||||
}
|
||||
</xsl:otherwise>
|
||||
PropertyBag["<xsl:value-of select="concat( 'search_', @name)"/>"] = Params[ "<xsl:value-of select="concat( 'search_', @name)"/>"];
|
||||
withSearchCriteria = true;
|
||||
}
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="adl:property[@distinct='user' or @distinct='all']">
|
||||
|
@ -768,8 +771,15 @@
|
|||
|
||||
IList<<xsl:value-of select="concat( $entityns, '.', @name)"/>> instances = search.List<<xsl:value-of select="concat( $entityns, '.', @name)"/>>();
|
||||
|
||||
/* bug 2921: suppress pagination when searching, as we can't fold the search params into the pagination */
|
||||
int showRecords = instances.Count;
|
||||
|
||||
if ( ! withSearchCriteria) {
|
||||
showRecords = <xsl:value-of select="$records-per-page"/>;
|
||||
}
|
||||
|
||||
PropertyBag["instances"] =
|
||||
PaginationHelper.CreatePagination( this, instances, <xsl:value-of select="$records-per-page"/>);
|
||||
PaginationHelper.CreatePagination( this, instances, showRecords);
|
||||
|
||||
RenderViewWithFailover(view + ".vm", view + ".auto.vm");
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
Transform ADL into velocity view templates
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.57 $
|
||||
$Date: 2009-05-07 08:42:01 $
|
||||
$Revision: 1.58 $
|
||||
$Date: 2009-05-11 15:01:49 $
|
||||
-->
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
Whitespace (or lack of it) is significant! -->
|
||||
|
@ -1026,11 +1026,22 @@
|
|||
<xsl:param name="list"/>
|
||||
<div class="content">
|
||||
<div class="controls">
|
||||
<span class="pagination status">
|
||||
Showing $instances.FirstItem - $instances.LastItem of $instances.TotalItems
|
||||
</span>
|
||||
<span class="pagination status">
|
||||
Showing $instances.FirstItem - $instances.LastItem of $instances.TotalItems
|
||||
</span>
|
||||
#if ( <xsl:for-each select="adl:field">
|
||||
<xsl:variable name="field" select="."/>
|
||||
<xsl:variable name="search-name"
|
||||
select="concat('$search_', ancestor::adl:entity//adl:property[@name=$field/@property]/@name)"/>
|
||||
<xsl:value-of select="$search-name"/>
|
||||
<xsl:if test="not( position() = last())">||</xsl:if>
|
||||
</xsl:for-each> )
|
||||
<xsl:comment>Suppressing pagination in favour of search</xsl:comment>
|
||||
#else
|
||||
<span class="pagination control">
|
||||
#if($instances.HasFirst) $PaginationHelper.CreatePageLink( 1, "<<" ) #end
|
||||
#if($instances.HasFirst)
|
||||
$PaginationHelper.CreatePageLink( 1, "<<" )
|
||||
#end
|
||||
#if(!$instances.HasFirst) << #end
|
||||
</span>
|
||||
<span class="pagination control">
|
||||
|
@ -1045,6 +1056,7 @@
|
|||
#if($instances.HasLast) $PaginationHelper.CreatePageLink( $instances.LastIndex, ">>" ) #end
|
||||
#if(!$instances.HasLast) >> #end
|
||||
</span>
|
||||
#end
|
||||
<xsl:if test="$list/../adl:form">
|
||||
<span class="add">
|
||||
<a>
|
||||
|
@ -1129,8 +1141,9 @@
|
|||
</xsl:variable>
|
||||
<xsl:if test="$size != 0">
|
||||
<input>
|
||||
<xsl:variable name="search-name" select="concat('search_',$entity//adl:property[@name=$field/@property]/@name)"/>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="concat('search_',$entity//adl:property[@name=$field/@property]/@name)"/>
|
||||
<xsl:value-of select="$search-name"/>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="size">
|
||||
<xsl:choose>
|
||||
|
@ -1141,7 +1154,7 @@
|
|||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="concat( '$!search_', $entity//adl:property[@name=$field/@property]/@name)"/>
|
||||
<xsl:value-of select="concat( '$!', $search-name)"/>
|
||||
</xsl:attribute>
|
||||
</input>
|
||||
</xsl:if>
|
||||
|
@ -1807,7 +1820,7 @@
|
|||
Auto generated Velocity macro for <xsl:value-of select="@name"/>,
|
||||
generated from ADL.
|
||||
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.57 $', 10)"/>
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.58 $', 10)"/>
|
||||
Generation parameters were:
|
||||
area-name: <xsl:value-of select="$area-name"/>
|
||||
default-url: <xsl:value-of select="$default-url"/>
|
||||
|
@ -1974,6 +1987,20 @@
|
|||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- compose the list of search parameters to append to a pagination request; note that this does
|
||||
not currently work but I have some hopes that in future it will and in the meantime it costs us
|
||||
little -->
|
||||
<xsl:template name="pagination-search-params">
|
||||
<xsl:param name="form" select="."/>
|
||||
"%{<xsl:for-each select="$form/adl:field">
|
||||
<xsl:variable name="field" select="."/>
|
||||
<xsl:variable name="search-name"
|
||||
select="concat('search_',$form/ancestor::adl:entity//adl:property[@name=$field/@property]/@name)"/>
|
||||
<xsl:value-of select="concat( $search-name, '=$', $search-name)"/>
|
||||
<xsl:if test="not( position() = last())">,</xsl:if>
|
||||
</xsl:for-each>}"
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="groups">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
|
Loading…
Reference in a new issue