From 33d943b9d0696f66a191beba4b1587b51381aafa Mon Sep 17 00:00:00 2001
From: benakamoorthi <benaka.moorthi@gmail.com>
Date: Sat, 25 Aug 2012 09:51:26 +0000
Subject: [PATCH] Refs #2742, add idSubtable parameter to imageGraphUrl if it
 is present in the url.

git-svn-id: http://dev.piwik.org/svn/trunk@6872 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 plugins/ImageGraph/ImageGraph.php                          | 7 +++++++
 ...torTwoVisits__subtable__API.getProcessedReport_week.xml | 2 +-
 ...stomVariables__subtable__API.getProcessedReport_day.xml | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/plugins/ImageGraph/ImageGraph.php b/plugins/ImageGraph/ImageGraph.php
index 64213b46de..c32325344a 100644
--- a/plugins/ImageGraph/ImageGraph.php
+++ b/plugins/ImageGraph/ImageGraph.php
@@ -128,6 +128,13 @@ class Piwik_ImageGraph extends Piwik_Plugin
 				$parameters['date'] = $dateForSinglePeriodGraph;
 			}
 			
+			// add the idSubtable if it exists
+			$idSubtable = Piwik_Common::getRequestVar('idSubtable', false);
+			if ($idSubtable !== false)
+			{
+				$parameters['idSubtable'] = $idSubtable;
+			}
+			
 			$report['imageGraphUrl'] = $urlPrefix . Piwik_Url::getQueryStringFromParameters($parameters);
 		}
 			
diff --git a/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml b/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml
index d3ae531063..72398027cb 100755
--- a/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml
+++ b/tests/integration/expected/test_OneVisitorTwoVisits__subtable__API.getProcessedReport_week.xml
@@ -26,7 +26,7 @@
 		</metricsDocumentation>
 		<documentation>This report contains information about the page URLs that have been visited. &lt;br /&gt; The table is organized hierarchically, the URLs are displayed as a folder structure.&lt;br /&gt;Use the plus and minus icons on the left to navigate.</documentation>
 		<actionToLoadSubTables>getPageUrls</actionToLoadSubTables>
-		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageUrls&amp;period=week&amp;date=2010-03-06</imageGraphUrl>
+		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=Actions&amp;apiAction=getPageUrls&amp;period=week&amp;date=2010-03-06&amp;idSubtable=1650</imageGraphUrl>
 		<uniqueId>Actions_getPageUrls</uniqueId>
 
 	</metadata>
diff --git a/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml b/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml
index 31eef13c85..873e322d9a 100755
--- a/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml
+++ b/tests/integration/expected/test_twoVisitsWithCustomVariables__subtable__API.getProcessedReport_day.xml
@@ -36,7 +36,7 @@
 			<exit_rate>The percentage of visits that left the website after viewing this page.</exit_rate>
 
 		</metricsDocumentation>
-		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=CustomVariables&amp;apiAction=getCustomVariablesValuesFromNameId&amp;period=day&amp;date=2010-01-03</imageGraphUrl>
+		<imageGraphUrl>index.php?module=API&amp;method=ImageGraph.get&amp;idSite=1&amp;apiModule=CustomVariables&amp;apiAction=getCustomVariablesValuesFromNameId&amp;period=day&amp;date=2010-01-03&amp;idSubtable=8</imageGraphUrl>
 		<uniqueId>CustomVariables_getCustomVariablesValuesFromNameId</uniqueId>
 
 	</metadata>
-- 
GitLab