|
View unanswered posts | View active topics
It is currently Wed Jun 19, 2013 3:27 am
Due to enormous amounts of spam, the forum has been set to read-only mode.
| Author |
Message |
|
LotsOCds
Joined: Fri Nov 14, 2003 6:15 pm Posts: 1425
|
 Re: Country Flags
Not sure what is the problem, but attached below is a group of templates from v9.40 with the changes in them. Let me know if you have any problems with them.
You do not have the required permissions to view the files attached to this post.
_________________ Cheers, Dave
|
| Wed Aug 01, 2012 6:10 am |
|
 |
|
seam-splitter
Joined: Mon Aug 22, 2011 7:35 am Posts: 15
|
 Re: Country Flags
thanks so much Dave! i forgot to insert the code into the "common.xsl" explorer template. using your file solved the problem! perfect! thanks again, timo
|
| Wed Aug 01, 2012 6:22 am |
|
 |
|
jepe
Joined: Wed Sep 28, 2005 9:08 pm Posts: 29 Location: Luxembourg
|
 Re: Country Flags
 Hello Dave, many thanks dealing this templates, very helpful to make my Catraxx more perfect. Jean-Paul
_________________ Current version: Catraxx 8.32
|
| Wed Aug 01, 2012 6:47 pm |
|
 |
|
Michael S. Wallack
Joined: Sun Mar 30, 2003 3:49 pm Posts: 175 Location: Carmel, Indiana, USA
|
 Re: Country Flags
I'd still really, really, really love to see Fredrik implement a feature to allow country flags to be displayed in the standard browse display (just like the graphics for stars in the rating field).
|
| Thu Aug 02, 2012 3:59 pm |
|
 |
|
hamsen
Joined: Sat Nov 22, 2003 7:47 pm Posts: 2547 Location: Denmark
|
 Re: Country Flags
Hi Dave
In common.xsl / format-artist you have this test:
<xsl:if test="boolean(lookupdata)">
meaning that flags are only displayed if lookupdata is present. That means no flag when using f.ex. album.xsl.
???
_________________ Kind regards Thomas Hamstrup HAP Software (http://www.hamstrup.dk)
Using Windows 8 PRO 64-bit and CATraxx 9.44
|
| Mon Aug 06, 2012 12:59 pm |
|
 |
|
LotsOCds
Joined: Fri Nov 14, 2003 6:15 pm Posts: 1425
|
 Re: Country Flags
Thomas,
When the country flag code was originally written in 2008 the XML from Album.xsl did not include the artist's country. Thus the requirement to add datalookup to Album.xsl (see the templates a few posts up on July 31, 2012). This has worked fine for me and others over the years and it still does.
Somewhere along the line the artist's country got added to the XML from Album.xsl. So now it is possible for country flags to work in Album.xsl without using datalookup. Try this Common.xsl file. It should work when lookupdata is required and when it is not. Let me know if you encounter any problems.
You do not have the required permissions to view the files attached to this post.
_________________ Cheers, Dave
|
| Mon Aug 06, 2012 3:34 pm |
|
 |
|
hamsen
Joined: Sat Nov 22, 2003 7:47 pm Posts: 2547 Location: Denmark
|
 Re: Country Flags
Yes, I just realized that. I didn't see you had added lookupdata to album.xsl.
_________________ Kind regards Thomas Hamstrup HAP Software (http://www.hamstrup.dk)
Using Windows 8 PRO 64-bit and CATraxx 9.44
|
| Mon Aug 06, 2012 4:38 pm |
|
 |
|
hamsen
Joined: Sat Nov 22, 2003 7:47 pm Posts: 2547 Location: Denmark
|
 Re: Country Flags
Hi Dave I have a different setup of countryflags. Mainly to avoid duplicating code. The template that displays the flag:You can select on which side to display the flag. You can decide whether a border is present or not. You can also pass a fieldvalue to display along the flag (f.ex. from country.xsl). Unfortunately I can't find a solution if the fieldvalue is HREF'ed. The template "format-artist" looks like this:
 |
 |
 |
 |
Code:
<xsl:template name="format-artist"> <xsl:param name="artists"/> <xsl:param name="showflag" select="'left'"/> <xsl:param name="hyperlink" select="'True'"/> <xsl:param name="newwindow" select="'False'"/> <xsl:param name="separator1" select="', '"/> <xsl:param name="separator2" select="' & '"/> <xsl:param name="showsortby" select="'False'"/> <xsl:param name="templatefile" select="'ArtistPerson.xsl'"/> <xsl:param name="favoriteplaylink" select="'False'"/> <xsl:param name="favoriteplaylink_ratingvalue" select="'5'"/> <xsl:for-each select="$artists/artist"> <xsl:if test="position() > 1"> <xsl:choose> <xsl:when test="count(role) > 0"> <!-- add role --> <xsl:text> </xsl:text><xsl:value-of select="role"/><xsl:text> </xsl:text> </xsl:when> <xsl:otherwise> <!-- no role, add separator --> <xsl:if test="position() < last() "> <xsl:value-of select="$separator1"/> </xsl:if> <xsl:if test="position() = last() "> <xsl:value-of select="$separator2"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:if> <xsl:variable name="fieldvalue"> <xsl:choose> <xsl:when test="$showsortby='True'"> <xsl:value-of select="sortby"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="name"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:if test="$showflag='left'"> <xsl:call-template name="showcountryflag"> <xsl:with-param name="country" select="country"/> <xsl:with-param name="showflag" select="$showflag"/> </xsl:call-template> </xsl:if> <xsl:choose> <xsl:when test="$hyperlink='True'"> <xsl:choose> <xsl:when test="$templatefile='IMAGECAROUSEL'"> <a href="CMD:IMAGECAROUSEL:Album,Image1,-1,{/data/record/albumdata/albumid/@unformatted},True,True,0,1,Play Album,"{name}",Album.Artist={name}"><xsl:value-of select="$fieldvalue"/></a> </xsl:when> <xsl:when test="$newwindow='True'"> <a href="{$templatefile}?ID={@id}" target="_blank"><xsl:value-of select="$fieldvalue"/></a> <xsl:if test="lookupdata/birthname!=''"> <xsl:text> (</xsl:text> <xsl:apply-templates select="lookupdata/birthname"/> <xsl:text>)</xsl:text> </xsl:if> </xsl:when> <xsl:otherwise> <a href="{$templatefile}?ID={@id}"><xsl:value-of select="$fieldvalue"/></a> <xsl:if test="lookupdata/birthname!=''"> <xsl:text> (</xsl:text> <xsl:apply-templates select="lookupdata/birthname"/> <xsl:text>)</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:if test="$favoriteplaylink='True'"> <xsl:text> </xsl:text> <a href="PLAYFILTER:Track.PersonalRating={$favoriteplaylink_ratingvalue}@Track.Artist={name}@orderby=Album.Released, Album.Title, Track.Position@validate=yes,1,1@xslparam:doctitle={name} Favorites"><img src="favorites.gif" border="0"/></a> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:value-of select="$fieldvalue"/> <xsl:if test="lookupdata/birthname!=''"> <xsl:text> (</xsl:text> <xsl:apply-templates select="lookupdata/birthname"/> <xsl:text>)</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:if test="$showflag='right'"> <xsl:call-template name="showcountryflag"> <xsl:with-param name="country" select="country"/> <xsl:with-param name="showflag" select="$showflag"/> </xsl:call-template> </xsl:if> </xsl:for-each> </xsl:template>
|
 |
 |
 |
 |
The call from album.xsl:The call from country.xsl:I would like your comments on this setup.
_________________ Kind regards Thomas Hamstrup HAP Software (http://www.hamstrup.dk)
Using Windows 8 PRO 64-bit and CATraxx 9.44
Last edited by hamsen on Sun Aug 12, 2012 6:40 pm, edited 1 time in total.
|
| Fri Aug 10, 2012 7:22 am |
|
 |
|
LotsOCds
Joined: Fri Nov 14, 2003 6:15 pm Posts: 1425
|
 Re: Country Flags
Creating a separate template makes sense for what you want to do here. Sorry but I don't understand. Do you want to pass a link as the fieldvalue or create a link from the fieldvalue? This should work fine. Since you pass the country explicitly to showcountryflags there is no concern with the XML structure. I did notice a typo in the IMG styles in the template.
_________________ Cheers, Dave
|
| Fri Aug 10, 2012 8:13 am |
|
 |
|
hamsen
Joined: Sat Nov 22, 2003 7:47 pm Posts: 2547 Location: Denmark
|
 Re: Country Flags
In format-artist I wanted to get rid of the test for left/right. You got me thinking, and the solution was right in front of me.
 |
 |
 |
 |
Code:
<xsl:template name="format-artist-X"> <xsl:param name="artists"/> <xsl:param name="showflag" select="'left'"/> <xsl:param name="hyperlink" select="'True'"/> <xsl:param name="newwindow" select="'False'"/> <xsl:param name="separator1" select="', '"/> <xsl:param name="separator2" select="' & '"/> <xsl:param name="showsortby" select="'False'"/> <xsl:param name="templatefile" select="'ArtistPerson.xsl'"/> <xsl:param name="favoriteplaylink" select="'False'"/> <xsl:param name="favoriteplaylink_ratingvalue" select="'5'"/> <xsl:for-each select="$artists/artist"> <xsl:if test="position() > 1"> <xsl:choose> <xsl:when test="count(role) > 0"> <!-- add role --> <xsl:text> </xsl:text><xsl:value-of select="role"/><xsl:text> </xsl:text> </xsl:when> <xsl:otherwise> <!-- no role, add separator --> <xsl:if test="position() < last() "> <xsl:value-of select="$separator1"/> </xsl:if> <xsl:if test="position() = last() "> <xsl:value-of select="$separator2"/> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:if> <xsl:variable name="fieldvalue"> <xsl:choose> <xsl:when test="$showsortby='True'"> <xsl:value-of select="sortby"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="name"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="$hyperlink='True'"> <xsl:choose> <xsl:when test="$templatefile='IMAGECAROUSEL'"> <a href="CMD:IMAGECAROUSEL:Album,Image1,-1,{/data/record/albumdata/albumid/@unformatted},True,True,0,1,Play Album,"{name}",Album.Artist={name}"><xsl:value-of select="$fieldvalue"/></a> </xsl:when> <xsl:when test="$newwindow='True'"> <a href="{$templatefile}?ID={@id}" target="_blank"> <xsl:call-template name="showcountryflag"> <xsl:with-param name="country" select="country"/> <xsl:with-param name="fieldvalue" select="$fieldvalue"/> <xsl:with-param name="showflag" select="$showflag"/> </xsl:call-template> </a> <xsl:if test="lookupdata/birthname!=''"> <xsl:text> (</xsl:text> <xsl:apply-templates select="lookupdata/birthname"/> <xsl:text>)</xsl:text> </xsl:if> </xsl:when> <xsl:otherwise> <a href="{$templatefile}?ID={@id}"> <xsl:call-template name="showcountryflag"> <xsl:with-param name="country" select="country"/> <xsl:with-param name="fieldvalue" select="$fieldvalue"/> <xsl:with-param name="showflag" select="$showflag"/> </xsl:call-template> </a> <xsl:if test="lookupdata/birthname!=''"> <xsl:text> (</xsl:text> <xsl:apply-templates select="lookupdata/birthname"/> <xsl:text>)</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> <xsl:if test="$favoriteplaylink='True'"> <xsl:text> </xsl:text> <a href="PLAYFILTER:Track.PersonalRating={$favoriteplaylink_ratingvalue}@Track.Artist={name}@orderby=Album.Released, Album.Title, Track.Position@validate=yes,1,1@xslparam:doctitle={name} Favorites"><img src="favorites.gif" border="0"/></a> </xsl:if> </xsl:when> <xsl:otherwise> <xsl:call-template name="showcountryflag"> <xsl:with-param name="country" select="country"/> <xsl:with-param name="fieldvalue" select="$fieldvalue"/> <xsl:with-param name="showflag" select="$showflag"/> </xsl:call-template> <xsl:if test="lookupdata/birthname!=''"> <xsl:text> (</xsl:text> <xsl:apply-templates select="lookupdata/birthname"/> <xsl:text>)</xsl:text> </xsl:if> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template>
|
 |
 |
 |
 |
Thanks Dave. It's nice to get to the b uttom of this subject!
_________________ Kind regards Thomas Hamstrup HAP Software (http://www.hamstrup.dk)
Using Windows 8 PRO 64-bit and CATraxx 9.44
|
| Fri Aug 10, 2012 9:07 am |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|