Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > Outils > XMLRAD
XMLRAD Environnement de développement Web XML/XSL. Avant de poster -> F.A.Q XMLRAD
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 14/04/2005, 16h30   #1
Membre éprouvé
 
Inscription : mars 2002
Messages : 516
Détails du profil
Informations forums :
Inscription : mars 2002
Messages : 516
Points : 483
Points : 483
Envoyer un message via MSN à Sylvain James
Par défaut ListFooter : Contraignant...

Bonjour,

J'avais un problème de navigation avec le Pager de listes et en scrutant les sources xsl du framework, je me suis rendu compte d'une contrainte assez pénalisante.
Le pager actuel d'XMLRAD utilise un champ caché de formulaire (xxx_STARTINGROW) pour indiquer au framework à partir de quel enregistrement il doit "fetcher" le SGBD.
Le problème est que le nom du dit formulaire est imposé : Il s'agit de 'MainForm'. Ca m'arrange pas du tout car j'utilise un autre nom de formulaire (sachant qu'il y a plusieurs formulaires dans ma page : Insertxxx, Updatexxx, Deletexxx etc et que je ne souhaite pas changer le nom de ces formulaires).
Alors j'ai cherché dans les sources un paramètre de <xsl:template name="xslc:NavigationPad"> dans lequel j'aurais pu indiquer le nom du formulaire prenant en charge le Paging.
Peine perdue puisque 'MainForm' est imposé en dur par le framework :

Code :
<xsl:attribute name="onclick"><![CDATA[SetField('MainForm', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$DoubleStepBack"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute>
Je vais modifier les sources de xslc.xsl mais si Delos pouvait prendre en compte un nouveau paramètre qui résoudrait la question, ça serait plus confortable.

Sylvain
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web

Mon Blog : http://blog.developpez.com/index.php?blog=89
Mes Articles : http://sjames.developpez.com/
Rubrique XMLRAD: http://xmlrad.developpez.com
Sylvain James est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/04/2005, 17h49   #2
Membre éprouvé
 
Inscription : mars 2002
Messages : 516
Détails du profil
Informations forums :
Inscription : mars 2002
Messages : 516
Points : 483
Points : 483
Envoyer un message via MSN à Sylvain James
Je propose un add-on à xslc.xsl pour résoudre le problème, afin de pouvoir appeler le Pager ainsi :

<xsl:call-template name="xslc:ListFooter">
<xsl:with-param name="colspan">9</xsl:with-param>
<xsl:with-param name="Form">FormInsertPARTICIPATION</xsl:with-param>
<xsl:with-param name="OnClick">document.FormInsertPARTICIPATION.submit();</xsl:with-param>
</xsl:call-template>

Le correctif (en gras) :

<xsl:template name="xslc:NavigationPad">
<xsl:param name="Form"/>
<xsl:param name="CommonURL">
<xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>/<xsl:value-of select="/document/XMLC_Params/XMLC_Action"/>?<xsl:if test="/document/XMLC_Params/XMLC_NavigationParams!=''">
<xsl:value-of select="/document/XMLC_Params/XMLC_NavigationParams"/>&amp;</xsl:if>
<xsl:value-of select="@RecordName"/>_StartingRow=</xsl:param>
<xsl:param name="URLParams"/>
<xsl:param name="OnClick"/>
<xsl:param name="DisplayPreviousArrows">1</xsl:param>
<xsl:param name="DisplayNextArrows">1</xsl:param>
<xsl:param name="StartingRow" select="@StartingRow"/>
<xsl:param name="EOF" select="@EOF"/>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<xsl:if test="$DisplayPreviousArrows = '1' and $StartingRow != '0'">
<xsl:variable name="DoubleStepBack">
<xsl:choose>
<xsl:when test="(@StartingRow)-(2*@MaxRows)+2>0">
<xsl:value-of select="(@StartingRow)-(2*@MaxRows)+2"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="StepBack">
<xsl:choose>
<xsl:when test="(@StartingRow)-(@MaxRows)+1>0">
<xsl:value-of select="(@StartingRow)-(@MaxRows)+1"/>
</xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<td style="border: 0px; padding-right: 5px;">
<a>
<xsl:choose>
<xsl:when test="$OnClick != ''">
<xsl:attribute name="href">.</xsl:attribute>
<xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$DoubleStepBack"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$DoubleStepBack"/><xsl:value-of select="$URLParams"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<img alt="{/document/Locales/DoublePrevious}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_left.gif"/>
</a>
</td>
<td style="border: 0px; padding-right: 5px;">
<a>
<xsl:choose>
<xsl:when test="$OnClick != ''">
<xsl:attribute name="href">.</xsl:attribute>
<xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$StepBack"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$StepBack"/><xsl:value-of select="$URLParams"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<img alt="{/document/Locales/Previous}" border="0" src="{$XMLC_PictosPath}ico_step_left.gif"/>
</a>
</td>
</xsl:if>
<xsl:if test="$DisplayNextArrows = '1' and $EOF != '1'">
<xsl:variable name="DoubleStepForward">
<xsl:value-of select="(@LastRow)+(@MaxRows)-1"/>
</xsl:variable>
<td style="border: 0px; padding-right: 5px;">
<a>
<xsl:choose>
<xsl:when test="$OnClick != ''">
<xsl:attribute name="href">.</xsl:attribute>
<xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="@LastRow"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="@LastRow"/><xsl:value-of select="$URLParams"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<img alt="{/document/Locales/More}" border="0" src="{$XMLC_PictosPath}ico_step_right.gif"/>
</a>
</td>
<td style="border: 0px; padding-right: 5px;">
<a>
<xsl:choose>
<xsl:when test="$OnClick != ''">
<xsl:attribute name="href">.</xsl:attribute>
<xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$DoubleStepForward"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$DoubleStepForward"/><xsl:value-of select="$URLParams"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<img alt="{/document/Locales/DoubleMore}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_right.gif"/>
</a>
</td>
</xsl:if>
</tr>
</table>
</xsl:template>
<xsl:template name="xslc:IndexNavigation">
<xsl:param name="Form"/>
<xsl:param name="CommonURL">
<xsl:value-of select="/document/XMLC_Params/XMLC_ScriptName"/>/<xsl:value-of select="/document/XMLC_Params/XMLC_Action"/>?<xsl:if test="/document/XMLC_Params/XMLC_NavigationParams!=''">
<xsl:value-of select="/document/XMLC_Params/XMLC_NavigationParams"/>&amp;</xsl:if>
<xsl:value-of select="@RecordName"/>_StartingRow=</xsl:param>
<xsl:param name="URLParams"/>
<xsl:param name="OnClick"/>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="clOverBackground" style="border: 0px; padding-right: 5px;">
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">1</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">2</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">3</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">4</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">5</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">6</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">7</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">8</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">9</xsl:with-param>
</xsl:call-template>
<xsl:call-template name="xslc:IndexNavigationNo">
<xsl:with-param name="Form" select="$Form"/>
<xsl:with-param name="CommonURL" select="$CommonURL"/>
<xsl:with-param name="URLParams" select="$URLParams"/>
<xsl:with-param name="OnClick" select="$OnClick"/>
<xsl:with-param name="IndexNo">10</xsl:with-param>
</xsl:call-template>
</td>
</tr>
</table>
</xsl:template>
<xsl:template name="xslc:IndexNavigationNo">
<xsl:param name="Form"/>
<xsl:param name="CommonURL"/>
<xsl:param name="URLParams"/>
<xsl:param name="OnClick"/>
<xsl:param name="IndexNo"/>
<xsl:variable name="StartingRow_1" select="@MaxRows * $IndexNo - @MaxRows - (1*($IndexNo - 1))"/>
<xsl:variable name="StartingRow">
<xsl:choose>
<xsl:when test="$StartingRow_1 &lt; 0">0</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$StartingRow_1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="@StartingRow = $StartingRow">
<b>
<xsl:value-of select="$IndexNo"/>
</b>
</xsl:when>
<xsl:otherwise>
<a>
<xsl:choose>
<xsl:when test="$OnClick != ''">
<xsl:attribute name="href">.</xsl:attribute>
<xsl:attribute name="onclick"><![CDATA[SetField(']]><xsl:value-of select="$Form"/><![CDATA[', ']]><xsl:value-of select="@RecordName"/><![CDATA[_StartingRow', ']]><xsl:value-of select="$StartingRow"/><![CDATA['); ]]><xsl:value-of select="$OnClick"/><![CDATA[return false;]]></xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="href"><xsl:value-of select="$CommonURL"/><xsl:value-of select="$StartingRow"/><xsl:value-of select="$URLParams"/></xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$IndexNo"/>
</a>
</xsl:otherwise>
</xsl:choose> </xsl:template>
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web

Mon Blog : http://blog.developpez.com/index.php?blog=89
Mes Articles : http://sjames.developpez.com/
Rubrique XMLRAD: http://xmlrad.developpez.com
Sylvain James est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/04/2005, 00h03   #3
RDM
Membre Expert
 
Inscription : mars 2002
Messages : 1 426
Détails du profil
Informations forums :
Inscription : mars 2002
Messages : 1 426
Points : 1 546
Points : 1 546
Envoyer un message via ICQ à RDM
interessant. mais j'en profiterais pour mettre le paramètre facultatif en mettant la valeur par défaut MainForm
__________________
RDM
Tout Est Relatif
Rubrique XMLRAD: http://xmlrad.developpez.com
FAQ XMLRAD: http://xmlrad.developpez.com/faq/
RDM est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/04/2005, 00h27   #4
Membre éprouvé
 
Inscription : mars 2002
Messages : 516
Détails du profil
Informations forums :
Inscription : mars 2002
Messages : 516
Points : 483
Points : 483
Envoyer un message via MSN à Sylvain James
Citation:
Envoyé par RDM
interessant. mais j'en profiterais pour mettre le paramètre facultatif en mettant la valeur par défaut MainForm
ah oui, + 1

Code :
1
2
3
<xsl:template name="xslc:NavigationPad"> 
  <xsl:param name="Form"/>MainForm</xsl:param>
  ...
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web

Mon Blog : http://blog.developpez.com/index.php?blog=89
Mes Articles : http://sjames.developpez.com/
Rubrique XMLRAD: http://xmlrad.developpez.com
Sylvain James est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/04/2005, 10h41   #5
Membre éclairé
 
Inscription : janvier 2003
Messages : 284
Détails du profil
Informations forums :
Inscription : janvier 2003
Messages : 284
Points : 311
Points : 311
Envoyer un message via MSN à Nicolas.Cogi
Pas de problème pour l'ajout du paramètre dans xslc:NavigationPad, d'après l'équipe de dev. Ca sera donc dispo dans la future release.

Si ca t'embete pas, ils feront un copier/coller de ton code
__________________
Nicolas
Nicolas.Cogi est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/04/2005, 12h39   #6
Membre éprouvé
 
Inscription : mars 2002
Messages : 516
Détails du profil
Informations forums :
Inscription : mars 2002
Messages : 516
Points : 483
Points : 483
Envoyer un message via MSN à Sylvain James
Citation:
Envoyé par Nicolas.Cogi
Pas de problème pour l'ajout du paramètre dans xslc:NavigationPad, d'après l'équipe de dev. Ca sera donc dispo dans la future release.

Si ca t'embete pas, ils feront un copier/coller de ton code
Au contraire, tu m'en vois ravi ;-)
Bien content car j'aurais pas besoin de mettre à jour les futures releases de la lib xsl.

Thanks !
__________________
.NET / ASP.NET MVC / Delphi / XMLRAD / XSL / Technos Web

Mon Blog : http://blog.developpez.com/index.php?blog=89
Mes Articles : http://sjames.developpez.com/
Rubrique XMLRAD: http://xmlrad.developpez.com
Sylvain James est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h16.


 
 
 
 
Partenaires

Hébergement Web