| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <?xml version="1.0"?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:eat="http://msqr.us/xsd/ieat"
- xmlns:xweb="http://msqr.us/xsd/jaxb-web"
- exclude-result-prefixes="eat xweb">
-
- <!-- imports -->
- <xsl:import href="tmpl/default-layout.xsl"/>
- <xsl:import href="tmpl/display-recipe.xsl"/>
-
- <!-- layout variables -->
- <xsl:variable name="layout.global.nav.page" select="'vew-recipe'"/>
-
- <!-- helper vars -->
- <xsl:variable name="index-section"
- select="xweb:x-data/xweb:x-model/eat:search-results/eat:ui-index/eat:index-section[@selected = 'true']"/>
- <xsl:variable name="recipe-criteria" select="xweb:x-data/xweb:x-model/eat:search-results/eat:recipe-criteria"/>
- <xsl:variable name="recipe" select="xweb:x-data/xweb:x-model/eat:search-results/eat:recipe"/>
- <xsl:template match="xweb:x-data" mode="page-title">
- <xsl:value-of select="$recipe/eat:name"/>
- </xsl:template>
-
- <xsl:template match="xweb:x-data" mode="page-head-content">
- <xsl:if test="$acting-user">
- <!-- include the rating JavaScript -->
- <script type="text/javascript" src="{$web-context}/js/jquery-1.3.2.js" xml:space="preserve"> </script>
- <script type="text/javascript" src="{$web-context}/js/jquery.ajaxQueue.js" xml:space="preserve"> </script>
- <script type="text/javascript" src="{$web-context}/js/xweb-locale.js" xml:space="preserve"> </script>
- <script type="text/javascript" src="{$web-context}/js/ieat-util.js" xml:space="preserve"> </script>
- <script type="text/javascript" src="{$web-context}/js/ratings.js"><xsl:text> </xsl:text></script>
- <script type="text/javascript" xml:space="preserve">
- <xsl:comment>
- var W3CDOM = (document.createElement && document.getElementsByTagName);
- var STAR_SETS = new Array();
-
- function init() {
- if ( !W3CDOM ) {
- alert("Your browser does not support DOM: some features will not be available.");
- return;
- }
- popupWindows();
- STAR_SETS[0] = new StarSet('<xsl:value-of select="$web-context"/>/img/','<xsl:value-of
- select="$web-context"/>/setRating.do?recipeId=<xsl:value-of
- select="$recipe/@recipeId"/>&rating=',0,<xsl:choose xml:space="default">
- <xsl:when test="$recipe/eat:rating[@userId=$acting-user/@userId]">
- <xsl:value-of select="$recipe/eat:rating[@userId=$acting-user/@userId]/@rating"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>0</xsl:text>
- </xsl:otherwise>
- </xsl:choose>,<xsl:value-of
- select="$recipe/@recipeId"/>);
- }
- window.onload = init;
-
- //</xsl:comment>
- </script>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="xweb:x-data" mode="action-links">
- <a title="{key('i18n','link.recipe.convertSystem.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/convertRecipe.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.recipe.convertSystem')"/>
- </a>
- <xsl:text> - </xsl:text>
- <a title="{key('i18n','link.recipe.convertSize.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/alterRecipe.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.recipe.convertSize')"/>
- </a>
- <xsl:text> - </xsl:text>
- <a title="{key('i18n','link.export.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/exportRecipe.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.export')"/>
- </a>
- <xsl:if test="$acting-user">
- <xsl:text> - </xsl:text>
- <a title="{key('i18n','link.email.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/emailRecipe.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.email')"/>
- </a>
- <xsl:text> - </xsl:text>
- <a href="{$web-context}/addRecipeToMeal.do?recipeId={$recipe/@recipeId}"
- title="{key('i18n','link.recipe.addToMeal.title')}">
- <xsl:value-of select="key('i18n','link.recipe.addToMeal')"/>
- </a>
- <xsl:if test="$acting-user/@userId = $recipe/eat:owner/@userId or
- $acting-user/../@admin = 'true'">
- <xsl:text> - </xsl:text>
- <a title="{key('i18n','link.recipe.edit.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/editRecipe.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.recipe.edit')"/>
- </a>
- <xsl:text> - </xsl:text>
- <a title="{key('i18n','link.recipe.delete.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/deleteRecipe.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.recipe.delete')"/>
- </a>
- </xsl:if>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="xweb:x-data" mode="action-links-2">
- <xsl:text> </xsl:text><!-- required so show up in output template -->
- <!-- Recipe comments link -->
- <xsl:if test="key('appenv','feature.comments') = 'true'">
- <a title="{key('i18n','link.recipe.comments.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/recipeComments.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.recipe.comments')"/>
- </a>
- </xsl:if>
-
- <xsl:if test="$acting-user">
- <xsl:if test="key('appenv','feature.comments') = 'true'">
- <xsl:text> - </xsl:text>
- </xsl:if>
- <xsl:if test="key('appenv','feature.recipeimages') = 'true' and (
- $acting-user/@userId = $recipe/eat:owner/@userId or
- $acting-user/../@admin = 'true' )">
- <a title="{key('i18n','link.recipe.image.title')}">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/editRecipeImage.do?recipeId=</xsl:text>
- <xsl:value-of select="$recipe/@recipeId"/>
- <xsl:apply-templates select="$index-section" mode="href"/>
- <xsl:apply-templates select="$recipe-criteria" mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','link.recipe.image')"/>
- </a>
- <xsl:text> - </xsl:text>
- </xsl:if>
- <!-- Recipe rating widget -->
- <xsl:if test="count($recipe/eat:rating) > 0">
- <span class="rating-overall">
- <!-- Display user average -->
- <xsl:variable name="tally" select="sum($recipe/eat:rating/@rating)"/>
- <xsl:variable name="cnt" select="count($recipe/eat:rating/@rating)"/>
- <xsl:text> (</xsl:text>
- <xsl:value-of select="format-number($tally div $cnt, '0.#')"/>
- <xsl:text> • </xsl:text>
- <xsl:value-of select="$cnt"/>
- <xsl:text>)</xsl:text>
- </span>
- </xsl:if>
- <span class="rating-stars">
- <img class="star-rating" id="star.0.1" src="{$web-context}/img/star-off.png" alt="1" width="13" height="13" />
- <img class="star-rating" id="star.0.2" src="{$web-context}/img/star-off.png" alt="2" width="13" height="13" />
- <img class="star-rating" id="star.0.3" src="{$web-context}/img/star-off.png" alt="3" width="13" height="13" />
- <img class="star-rating" id="star.0.4" src="{$web-context}/img/star-off.png" alt="4" width="13" height="13" />
- <img class="star-rating" id="star.0.5" src="{$web-context}/img/star-off.png" alt="5" width="13" height="13" />
- </span>
- </xsl:if>
- </xsl:template>
-
- <xsl:template match="xweb:x-data" mode="page-body">
- <xsl:if test="$index-section">
- <div class="return-nav">
- <a class="back">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/index.do?</xsl:text>
- <xsl:apply-templates select="$index-section" mode="href-direct"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','back.to')"/>
- <xsl:text> </xsl:text>
- <span class="index-link">
- <xsl:value-of select="$index-section/@index-key"/>
- </span>
- </a>
- </div>
- </xsl:if>
-
- <xsl:if test="$recipe-criteria">
- <div class="return-nav">
- <a class="back">
- <xsl:attribute name="href">
- <xsl:value-of select="$web-context"/>
- <xsl:text>/search.do?</xsl:text>
- <xsl:apply-templates select="$recipe-criteria"
- mode="href"/>
- </xsl:attribute>
- <xsl:value-of select="key('i18n','back.to')"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="key('i18n','search.results')"/>
- </a>
- </div>
- </xsl:if>
-
- <div class="recipe-view">
- <xsl:apply-templates select="$recipe" mode="display-internal"/>
- </div>
- </xsl:template>
-
- </xsl:stylesheet>
|