[Piwik-svn] r202 - in trunk: . config modules modules/ViewDataTable modules/Visualization plugins plugins/Home plugins/Widgetize plugins/Widgetize/templates

svnmaster at piwik.org svnmaster at piwik.org
Sun Jan 20 01:17:37 CET 2008


Author: matt
Date: 2008-01-20 01:17:36 +0100 (Sun, 20 Jan 2008)
New Revision: 202

Added:
   trunk/plugins/Widgetize/
   trunk/plugins/Widgetize/Controller.php
   trunk/plugins/Widgetize/templates/
   trunk/plugins/Widgetize/templates/iframe.tpl
   trunk/plugins/Widgetize/templates/index.tpl
   trunk/plugins/Widgetize/templates/js_include.tpl
   trunk/plugins/Widgetize/templates/test_iframe.tpl
   trunk/plugins/Widgetize/templates/test_jsinclude.tpl
Modified:
   trunk/config/global.ini.php
   trunk/index.php
   trunk/modules/Controller.php
   trunk/modules/FrontController.php
   trunk/modules/ViewDataTable.php
   trunk/modules/ViewDataTable/Cloud.php
   trunk/modules/ViewDataTable/GenerateGraphData.php
   trunk/modules/ViewDataTable/Graph.php
   trunk/modules/ViewDataTable/Html.php
   trunk/modules/Visualization/ChartEvolution.php
   trunk/plugins/Home/Controller.php
Log:
- all piwik datatable now work in IFRAME :-) it rocks!!!
try to load /piwik/?module=Widgetize&action=testIframe

Modified: trunk/config/global.ini.php
===================================================================
--- trunk/config/global.ini.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/config/global.ini.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -53,7 +53,7 @@
 [General]
 ; Time in seconds after which an archive will be computed again. 
 ; This setting is used only for today's statistics.
-time_before_archive_considered_outdated = 600
+time_before_archive_considered_outdated = 6000
 
 ; character used to automatically create categories in the "Action" "Downloads" reports
 ; for example a URL like "example.com/blog/development/first-post" will create 

Modified: trunk/index.php
===================================================================
--- trunk/index.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/index.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -57,10 +57,9 @@
 require_once "FrontController.php";
 
 
-$controller = new Piwik_FrontController;
+Piwik_FrontController::$enableDispatch = ENABLE_DISPATCH;
+
+$controller = Piwik_FrontController::getInstance();
 $controller->init();
-if(ENABLE_DISPATCH)
-{
-	$controller->dispatch();
-}
+$controller->dispatch();
 $controller->end();

Modified: trunk/modules/Controller.php
===================================================================
--- trunk/modules/Controller.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/Controller.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -15,6 +15,10 @@
  */
 abstract class Piwik_Controller
 {
+	function __construct()
+	{
+	}
+	
 	function getDefaultAction()
 	{
 		return 'index';

Modified: trunk/modules/FrontController.php
===================================================================
--- trunk/modules/FrontController.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/FrontController.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -44,17 +44,41 @@
 {
 	static public $enableDispatch = true;
 	
-	function dispatch()
+	static private $instance = null;	
+	static public function getInstance()
+	{
+		if (self::$instance == null)
+		{			
+			$c = __CLASS__;
+			self::$instance = new $c();
+		}
+		return self::$instance;
+	}
+	
+	function dispatch( $module = null, $action = null, $parameters = null)
 	{
 		if( self::$enableDispatch === false)
 		{
 			return;
 		}
-		$defaultModule = 'Home';
 		
-		// load the module requested
-		$module = Piwik_Common::getRequestVar('module', $defaultModule, 'string');
+		if(is_null($module))
+		{
+			$defaultModule = 'Home';
+			// load the module requested
+			$module = Piwik_Common::getRequestVar('module', $defaultModule, 'string');
+		}
 		
+		if(is_null($action))
+		{
+			$action = Piwik_Common::getRequestVar('action', false);
+		}
+		
+		if(is_null($parameters))
+		{
+			$parameters = array();
+		}
+		
 		if(ctype_alnum($module))
 		{
 			$moduleController = PIWIK_PLUGINS_PATH . "/" . $module . "/Controller.php";
@@ -66,16 +90,16 @@
 				
 				$controller = new $controllerClassName;
 				
-				$defaultAction = $controller->getDefaultAction();
-				$action = Piwik_Common::getRequestVar('action', $defaultAction, 'string');
-				
+				
+				if($action === false)
+				{
+					$action = $controller->getDefaultAction();
+				}
 				if(method_exists($controller, $action))
 				{
 					try{
-						$controller->$action();
+						return call_user_func_array( array($controller, $action ), $parameters);
 					} catch(Piwik_Access_NoAccessException $e) {
-	//					Piwik::log("NO ACCESS EXCEPTION =>");
-						
 						Piwik_PostEvent('FrontController.NoAccessException', $e);					
 					}
 				}

Modified: trunk/modules/ViewDataTable/Cloud.php
===================================================================
--- trunk/modules/ViewDataTable/Cloud.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/ViewDataTable/Cloud.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -19,10 +19,12 @@
 class Piwik_ViewDataTable_Cloud extends Piwik_ViewDataTable
 {
 	protected $displayLogoInsteadOfLabel = false;
-	function init($currentControllerAction, 
+	function init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod )
 	{
-		parent::init($currentControllerAction, 
+		parent::init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod );
 		$this->dataTableTemplate = 'Home/templates/cloud.tpl';
 		

Modified: trunk/modules/ViewDataTable/GenerateGraphData.php
===================================================================
--- trunk/modules/ViewDataTable/GenerateGraphData.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/ViewDataTable/GenerateGraphData.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -17,10 +17,12 @@
 abstract class Piwik_ViewDataTable_GenerateGraphData extends Piwik_ViewDataTable
 {
 	
-	function init($currentControllerAction, 
+	function init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod )
 	{
-		parent::init($currentControllerAction, 
+		parent::init($currentControllerName, 
+						$currentControllerAction, 
 						$moduleNameAndMethod );
 		
 		$this->disableOffsetInformation();

Modified: trunk/modules/ViewDataTable/Graph.php
===================================================================
--- trunk/modules/ViewDataTable/Graph.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/ViewDataTable/Graph.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -19,10 +19,12 @@
 	protected $width = 400; 
 	protected $height = 250; 
 	
-	function init($currentControllerAction, 
+	function init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod )
 	{
-		parent::init($currentControllerAction, 
+		parent::init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod );
 		$this->dataTableTemplate = 'Home/templates/graph.tpl';
 		
@@ -134,10 +136,12 @@
 		
 	}
 	
-	function init($currentControllerAction, 
+	function init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod )
 	{
-		parent::init($currentControllerAction, 
+		parent::init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod );
 		
 		$this->parametersToModify['date'] = 'last30';

Modified: trunk/modules/ViewDataTable/Html.php
===================================================================
--- trunk/modules/ViewDataTable/Html.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/ViewDataTable/Html.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -20,11 +20,13 @@
 	
 	public $arrayDataTable; // phpArray
 	
-	function init($currentControllerAction, 
+	function init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod,						
 						$actionToLoadTheSubTable = null )
 	{
-		parent::init($currentControllerAction, 
+		parent::init($currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod,						
 						$actionToLoadTheSubTable);
 		$this->dataTableTemplate = 'Home/templates/datatable.tpl';

Modified: trunk/modules/ViewDataTable.php
===================================================================
--- trunk/modules/ViewDataTable.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/ViewDataTable.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -98,10 +98,12 @@
 		}
 	}
 	
-	function init( $currentControllerAction, 
+	function init( $currentControllerName,
+						$currentControllerAction, 
 						$moduleNameAndMethod, 
 						$actionToLoadTheSubTable = null)
 	{
+		$this->currentControllerName = $currentControllerName;
 		$this->currentControllerAction = $currentControllerAction;
 		$this->moduleNameAndMethod = $moduleNameAndMethod;
 		$this->actionToLoadTheSubTable = $actionToLoadTheSubTable;
@@ -110,7 +112,7 @@
 		
 		$this->method = $moduleNameAndMethod;
 		
-		
+		$this->showFooter = Piwik_Common::getRequestVar('showDataTableFooter', true);
 		$this->variablesDefault['filter_excludelowpop_default'] = 'false';
 		$this->variablesDefault['filter_excludelowpop_value_default'] = 'false';	
 	}
@@ -207,6 +209,7 @@
 		}
 		
 		
+		$javascriptVariablesToSet['module'] = $this->currentControllerName;
 		$javascriptVariablesToSet['action'] = $this->currentControllerAction;
 		
 		if(!is_null($this->actionToLoadTheSubTable))

Modified: trunk/modules/Visualization/ChartEvolution.php
===================================================================
--- trunk/modules/Visualization/ChartEvolution.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/modules/Visualization/ChartEvolution.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -29,7 +29,7 @@
 		$this->bg_colour = '#ffffff';
 		$this->set_data( $this->arrayData );
 		$this->set_x_labels( $this->arrayLabel );
-		$this->area_hollow( 2, 4, 15,'0x3357A0',  ' visits', 10 );
+		$this->area_hollow( 1, 3, 10,'0x3357A0',  ' visits', 10 );
 		
 		$this->set_tool_tip( '#x_label# <br>#val# #key# ' );
 		

Modified: trunk/plugins/Home/Controller.php
===================================================================
--- trunk/plugins/Home/Controller.php	2008-01-19 20:23:12 UTC (rev 201)
+++ trunk/plugins/Home/Controller.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -20,6 +20,11 @@
  */
 class Piwik_Home_Controller extends Piwik_Controller
 {
+	function __construct()
+	{
+		parent::__construct();
+		$this->currentControllerName = 'Home';
+	}
 	function getDefaultAction()
 	{
 		return 'redirectToIndex';
@@ -154,12 +159,14 @@
 - getOutlinks : [idSite, period, date, expanded = , idSubtable = ]
 
 		 */
-	function getActionsView($currentMethod,
+	function getActionsView($currentControllerName,
+						$currentMethod,
 						$methodToCall = 'Actions.getActions', 
 						$subMethod = 'getActionsSubDataTable')
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  	$currentMethod, 
+		$view->init(  	$currentControllerName,
+						$currentMethod, 
 						$methodToCall, 
 						$subMethod );
 		$view->setTemplate('Home/templates/datatable_actions.tpl');
@@ -240,7 +247,8 @@
 	}
 	function getDownloads($fetch = false)
 	{
-		$view = $this->getActionsView( 	__FUNCTION__,
+		$view = $this->getActionsView( 	$this->currentControllerName, 
+										__FUNCTION__,
 										'Actions.getDownloads', 
 										'getDownloadsSubDataTable' );
 		
@@ -248,7 +256,8 @@
 	}
 	function getDownloadsSubDataTable($fetch = false)
 	{
-		$view = $this->getActionsView( 	__FUNCTION__,
+		$view = $this->getActionsView( 	$this->currentControllerName, 
+										__FUNCTION__,
 										'Actions.getDownloads', 
 										'getDownloadsSubDataTable' );
 		
@@ -256,7 +265,8 @@
 	}
 	function getActions($fetch = false)
 	{
-		$view = $this->getActionsView(	__FUNCTION__,
+		$view = $this->getActionsView(	$this->currentControllerName, 
+										__FUNCTION__,
 										'Actions.getActions', 
 										'getActionsSubDataTable' );
 		
@@ -264,7 +274,8 @@
 	}
 	function getActionsSubDataTable($fetch = false)
 	{
-		$view = $this->getActionsView( 	__FUNCTION__,
+		$view = $this->getActionsView( 	$this->currentControllerName, 
+										__FUNCTION__,
 										'Actions.getActions', 
 										'getActionsSubDataTable'  );
 		
@@ -272,7 +283,8 @@
 	}
 	function getOutlinks($fetch = false)
 	{
-		$view = $this->getActionsView(	__FUNCTION__,
+		$view = $this->getActionsView(	$this->currentControllerName, 
+										__FUNCTION__,
 										'Actions.getOutlinks', 
 										'getOutlinksSubDataTable' );
 		
@@ -280,7 +292,8 @@
 	}
 	function getOutlinksSubDataTable($fetch = false)
 	{
-		$view = $this->getActionsView( 	__FUNCTION__,
+		$view = $this->getActionsView( 	$this->currentControllerName, 
+										__FUNCTION__,
 										'Actions.getOutlinks', 
 										'getOutlinksSubDataTable'  );
 		
@@ -304,14 +317,14 @@
 	{
 		require_once "ViewDataTable/Graph.php";
 		$view = Piwik_ViewDataTable::factory(null, 'graphEvolution');
-		$view->init( __FUNCTION__, "VisitsSummary.getVisits" );
+		$view->init( $this->currentControllerName, __FUNCTION__, "VisitsSummary.getVisits" );
 		return $this->renderView($view, $fetch);
 	}
 	function getLastDistinctKeywordsGraph( $fetch = false )
 	{
 		require_once "ViewDataTable/Graph.php";
 		$view = Piwik_ViewDataTable::factory(null, 'graphEvolution');
-		$view->init( __FUNCTION__, "Referers.getNumberOfDistinctKeywords" );
+		$view->init( $this->currentControllerName, __FUNCTION__, "Referers.getNumberOfDistinctKeywords" );
 		return $this->renderView($view, $fetch);
 	}
 	
@@ -331,7 +344,7 @@
 	function getVisitInformationPerServerTime( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  __FUNCTION__, 
+		$view->init( $this->currentControllerName,  __FUNCTION__, 
 								"VisitTime.getVisitInformationPerServerTime" );
 		
 		$view->setColumnsToDisplay( array(0,2) );
@@ -347,7 +360,7 @@
 	function getVisitInformationPerLocalTime( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  __FUNCTION__, 
+		$view->init( $this->currentControllerName,  __FUNCTION__, 
 								"VisitTime.getVisitInformationPerLocalTime" );
 		
 		$view->setColumnsToDisplay( array(0,2) );
@@ -366,7 +379,7 @@
 	function getNumberOfVisitsPerVisitDuration( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  __FUNCTION__, 
+		$view->init( $this->currentControllerName,  __FUNCTION__, 
 									"VisitorInterest.getNumberOfVisitsPerVisitDuration" );
 		
 		$view->setColumnsToDisplay( array(0,1) );
@@ -381,7 +394,7 @@
 	function getNumberOfVisitsPerPage( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  __FUNCTION__, 
+		$view->init( $this->currentControllerName,  __FUNCTION__, 
 									"VisitorInterest.getNumberOfVisitsPerPage" );
 		
 		$view->setColumnsToDisplay( array(0,1) );
@@ -401,7 +414,7 @@
 	function getProvider( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  __FUNCTION__, "Provider.getProvider" );
+		$view->init( $this->currentControllerName,  __FUNCTION__, "Provider.getProvider" );
 		
 		$view->setColumnsToDisplay( array(0,1) );
 		$view->setSortedColumn( 1 );
@@ -416,7 +429,7 @@
 	function getCountry( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( __FUNCTION__, "UserCountry.getCountry" );
+		$view->init( $this->currentControllerName, __FUNCTION__, "UserCountry.getCountry" );
 		$view->disableExcludeLowPopulation();
 		
 		$view->setColumnsToDisplay( array(0,1) );
@@ -434,7 +447,7 @@
 	function getContinent( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( __FUNCTION__, "UserCountry.getContinent" );
+		$view->init( $this->currentControllerName, __FUNCTION__, "UserCountry.getContinent" );
 		$view->disableExcludeLowPopulation();
 		$view->disableSearchBox();
 		$view->disableOffsetInformation();
@@ -452,7 +465,7 @@
 												$APItoCall )
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  $currentControllerAction, $APItoCall );
+		$view->init( $this->currentControllerName,  $currentControllerAction, $APItoCall );
 		$view->disableSearchBox();
 		$view->disableExcludeLowPopulation();
 		
@@ -524,7 +537,7 @@
 	function getPlugin( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  __FUNCTION__, 'UserSettings.getPlugin' );
+		$view->init( $this->currentControllerName,  __FUNCTION__, 'UserSettings.getPlugin' );
 		$view->disableSearchBox();
 		$view->disableExcludeLowPopulation();
 		$view->disableSort();
@@ -545,7 +558,7 @@
 	function getRefererType( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  	'getRefererType', 
+		$view->init( $this->currentControllerName,  	'getRefererType', 
 											'Referers.getRefererType'
 								);
 		$view->disableSearchBox();
@@ -560,7 +573,7 @@
 	function getKeywords( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( 	'getKeywords', 
+		$view->init( $this->currentControllerName, 	'getKeywords', 
 											'Referers.getKeywords', 
 											'getSearchEnginesFromKeywordId'
 								);
@@ -573,7 +586,7 @@
 	function getSearchEnginesFromKeywordId( $fetch = false )
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( 	'getSearchEnginesFromKeywordId', 
+		$view->init( $this->currentControllerName, 	'getSearchEnginesFromKeywordId', 
 											'Referers.getSearchEnginesFromKeywordId'
 								);
 		$view->disableSearchBox();
@@ -587,7 +600,7 @@
 	function getSearchEngines( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  	'getSearchEngines', 
+		$view->init( $this->currentControllerName,  	'getSearchEngines', 
 											'Referers.getSearchEngines', 
 											'getKeywordsFromSearchEngineId'
 								);
@@ -603,7 +616,7 @@
 	function getKeywordsFromSearchEngineId( $fetch = false )
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( 	'getKeywordsFromSearchEngineId', 
+		$view->init( $this->currentControllerName, 	'getKeywordsFromSearchEngineId', 
 											'Referers.getKeywordsFromSearchEngineId'
 								);
 		$view->disableSearchBox();
@@ -616,7 +629,7 @@
 	function getWebsites( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  	'getWebsites', 
+		$view->init( $this->currentControllerName,  	'getWebsites', 
 											'Referers.getWebsites',
 											'getUrlsFromWebsiteId'
 								);
@@ -633,7 +646,7 @@
 	function getCampaigns( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  	'getCampaigns', 
+		$view->init( $this->currentControllerName,  	'getCampaigns', 
 											'Referers.getCampaigns',
 											'getKeywordsFromCampaignId'
 								);
@@ -650,7 +663,7 @@
 	function getKeywordsFromCampaignId( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( 	'getKeywordsFromCampaignId', 
+		$view->init( $this->currentControllerName, 	'getKeywordsFromCampaignId', 
 											'Referers.getKeywordsFromCampaignId'
 								);
 
@@ -664,7 +677,7 @@
 	function getUrlsFromWebsiteId( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( 	'getUrlsFromWebsiteId', 
+		$view->init( $this->currentControllerName, 	'getUrlsFromWebsiteId', 
 											'Referers.getUrlsFromWebsiteId'
 								);
 		$view->disableSearchBox();
@@ -677,7 +690,7 @@
 	function getPartners( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init(  	'getPartners', 
+		$view->init( $this->currentControllerName,  	'getPartners', 
 											'Referers.getPartners',
 											'getUrlsFromPartnerId'
 								);
@@ -693,7 +706,7 @@
 	function getUrlsFromPartnerId( $fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
-		$view->init( 	'getUrlsFromPartnerId', 
+		$view->init( $this->currentControllerName, 	'getUrlsFromPartnerId', 
 											'Referers.getUrlsFromPartnerId'
 								);
 		$view->disableSearchBox();

Added: trunk/plugins/Widgetize/Controller.php
===================================================================
--- trunk/plugins/Widgetize/Controller.php	                        (rev 0)
+++ trunk/plugins/Widgetize/Controller.php	2008-01-20 00:17:36 UTC (rev 202)
@@ -0,0 +1,56 @@
+<?php
+/**
+ * Piwik - Open source web analytics
+ * 
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
+ * @version $Id: Controller.php 169 2008-01-14 05:41:15Z matt $
+ * 
+ * @package Piwik_SitesManager
+ */
+
+
+/**
+ * 
+ * @package Piwik_Widgetize
+ */
+class Piwik_Widgetize_Controller extends Piwik_Controller
+{
+	function index()
+	{
+		$view = new Piwik_View('Widgetize/templates/index.tpl');
+		echo $view->render();
+	}
+
+	// display code calling the IFRAME
+	function testIframe()
+	{
+		$view = new Piwik_View('Widgetize/templates/test_iframe.tpl');
+		$view->url1 = '?module=Widgetize&action=iframe&moduleToWidgetize=Home&actionToWidgetize=getBrowser&idSite=1&period=day&date=yesterday';
+		$view->url2 = '?module=Widgetize&action=iframe&moduleToWidgetize=Home&actionToWidgetize=getBrowser&idSite=1&period=day&date=yesterday&viewDataTable=cloud&showDataTableFooter=0';
+		
+		echo $view->render();
+	}
+	
+	
+	function testJsInclude()
+	{
+		$view = new Piwik_View('Widgetize/templates/test_jsinclude.tpl');
+		echo $view->render();
+	}
+	
+	// the code inside the IFRAME
+	function iframe()
+	{		
+		$controllerName = Piwik_Common::getRequestVar('moduleToWidgetize');
+		$actionName = Piwik_Common::getRequestVar('actionToWidgetize');
+		$parameters = array ( $fetch = true );
+		$outputDataTable='';
+		
+		$outputDataTable = Piwik_FrontController::getInstance()->dispatch( $controllerName, $actionName, $parameters);
+		
+		$view = new Piwik_View('Widgetize/templates/iframe.tpl');
+		$view->content = $outputDataTable;
+		echo $view->render();
+	}
+}
\ No newline at end of file

Added: trunk/plugins/Widgetize/templates/iframe.tpl
===================================================================
--- trunk/plugins/Widgetize/templates/iframe.tpl	                        (rev 0)
+++ trunk/plugins/Widgetize/templates/iframe.tpl	2008-01-20 00:17:36 UTC (rev 202)
@@ -0,0 +1,20 @@
+<html>
+<body>
+
+<script type="text/javascript" src="libs/jquery/jquery.js"></script>
+<script type="text/javascript" src="themes/default/common.js"></script>
+<script type="text/javascript" src="libs/jquery/jquery.dimensions.js"></script>
+<script type="text/javascript" src="libs/jquery/tooltip/jquery.tooltip.js"></script>
+<script type="text/javascript" src="libs/jquery/truncate/jquery.truncate.js"></script>
+
+<script type="text/javascript" src="libs/swfobject/swfobject.js"></script>
+
+<script type="text/javascript" src="plugins/Home/templates/datatable.js"></script>
+<link rel="stylesheet" href="libs/jquery/tooltip/jquery.tooltip.css">
+<link rel="stylesheet" href="plugins/Home/templates/datatable.css">
+
+
+{$content}
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/plugins/Widgetize/templates/index.tpl
===================================================================
--- trunk/plugins/Widgetize/templates/index.tpl	                        (rev 0)
+++ trunk/plugins/Widgetize/templates/index.tpl	2008-01-20 00:17:36 UTC (rev 202)
@@ -0,0 +1,5 @@
+<ul>
+<li><a href='?module=Widgetize&action=testIframe'>Test getCountry table in a IFRAME</li>
+
+<li><a href='?module=Widgetize&action=testJsInclude'>Test getCountry table in a JS include</a></li>
+</ul>
\ No newline at end of file

Added: trunk/plugins/Widgetize/templates/js_include.tpl
===================================================================
--- trunk/plugins/Widgetize/templates/js_include.tpl	                        (rev 0)
+++ trunk/plugins/Widgetize/templates/js_include.tpl	2008-01-20 00:17:36 UTC (rev 202)
@@ -0,0 +1,10 @@
+<html>
+<body>
+<h2>Test getCountry table in a JS include</h2>
+
+<noscript>Powered by <a href="http://piwik.org">Piwik</a></div></noscript>
+
+<p>This test is after the JS INCLUDE</p>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/plugins/Widgetize/templates/test_iframe.tpl
===================================================================
--- trunk/plugins/Widgetize/templates/test_iframe.tpl	                        (rev 0)
+++ trunk/plugins/Widgetize/templates/test_iframe.tpl	2008-01-20 00:17:36 UTC (rev 202)
@@ -0,0 +1,23 @@
+<html>
+<body>
+<h2>Test datatable in a IFRAME</h2>
+
+<iframe 
+ width="400" height="350" 
+ src="{$url1}" 
+ scrolling="no" frameborder="0" marginheight="0" marginwidth="0">
+</iframe>
+<noscript>Powered by <a href="http://piwik.org">Piwik</a></div></noscript>
+<hr>
+<h2>Test tag cloud  in a IFRAME</h2>
+<iframe 
+ width="500" height="100" 
+ src="{$url2}" 
+ scrolling="no" frameborder="0" marginheight="0" marginwidth="0">
+</iframe>
+<noscript>Powered by <a href="http://piwik.org">Piwik</a></div></noscript>
+
+<p>Note that here there is NO footer (no icons) (it's a parameter in the URL = showDataTableFooter)</p>
+
+</body>
+</html>
\ No newline at end of file

Added: trunk/plugins/Widgetize/templates/test_jsinclude.tpl
===================================================================
--- trunk/plugins/Widgetize/templates/test_jsinclude.tpl	                        (rev 0)
+++ trunk/plugins/Widgetize/templates/test_jsinclude.tpl	2008-01-20 00:17:36 UTC (rev 202)
@@ -0,0 +1,10 @@
+<html>
+<body>
+<h2>Test table in a js include</h2>
+<code>not there yet</code>
+<noscript>Powered by <a href="http://piwik.org">Piwik</a></div></noscript>
+
+<p>This text is after the Js include</p>
+
+</body>
+</html>
\ No newline at end of file



More information about the Piwik-svn mailing list