diff --git a/AdvancedSearch.php b/AdvancedSearch.php index 1e7df18063283c6d48a257316dac6ff43fc77abe..3a2fde30557ea38b19a9899a8e7a112862be2f13 100644 --- a/AdvancedSearch.php +++ b/AdvancedSearch.php @@ -172,7 +172,8 @@ else if(value == 'unwanted') unwanted.push(key); }); getRecipes(wanted, unwanted, maxUnsatisfied, allowMissing, allowUnwanted, function(e) { - notifyParent(e); + if(maxUnsatisfied > 0) notifyParentScore(e); + else notifyParent(e); }); } @@ -184,6 +185,15 @@ }; window.top.postMessage(data, [data.event, data.value]); } + + function notifyParentScore(e) // Send a message to the parent window, asking to display the recipe #e + { + var data = { + event: 'recipelistscore', + value: e + }; + window.top.postMessage(data, [data.event, data.value]); + } function appendIngredient(ing, status) { diff --git a/Home.php b/Home.php index d72643b7a4ad5bf29dee2be33526a277285bff18..cd7534457113daa7570f906c4964da668bb8ec2e 100644 --- a/Home.php +++ b/Home.php @@ -61,7 +61,11 @@ } else if(m_event == 'recipelist') { - switchView('RecipeList.php?ids=' + m_value); + switchView('RecipeList.php?ids=' + m_value + '&showscore=false'); + } + else if(m_event == 'recipelistscore') + { + switchView('RecipeList.php?ids=' + m_value + '&showscore=true'); } else if(m_event == 'hierarchyDisplay') { diff --git a/RecipeList.php b/RecipeList.php index 0e7a5ec3e936b57402be8eaf37bb49d98a366e2d..308de0cc3f05a4498bcbb74570be205a68bfe6f8 100644 --- a/RecipeList.php +++ b/RecipeList.php @@ -15,6 +15,8 @@ include "Donnees.inc.php"; include "scripts/Functions.php"; + + $showScore = $_GET['showscore'] == 'true' ? true : false; if ($_GET['ids'] == '') echo '<h1>No recipe found</h1>'; @@ -32,7 +34,7 @@ echo '<div class="extra">'; echo '<img class="toggleFavourite" src="images/favourite.png" >'; - echo '<p class="unsatisfied">Non satisfiés : ' . $re[1] . '</p>'; + if($showScore) echo '<p class="unsatisfied">Non satisfiés : ' . $re[1] . '</p>'; echo '</div>'; echo '<div class="listElement" onclick="showRecipe(' . intval($re[0]) . ');">';