[Piwik-svn] r366 - in trunk: misc/testJavascriptTracker plugins/Actions plugins/Provider tests tests/modules

svnmaster at piwik.org svnmaster at piwik.org
Wed Mar 12 18:03:46 CET 2008


Author: matt
Date: 2008-03-12 18:03:39 +0100 (Wed, 12 Mar 2008)
New Revision: 366

Modified:
   trunk/misc/testJavascriptTracker/index.php
   trunk/misc/testJavascriptTracker/page2.php
   trunk/plugins/Actions/API.php
   trunk/plugins/Actions/Actions.php
   trunk/plugins/Actions/Controller.php
   trunk/plugins/Provider/Controller.php
   trunk/tests/config_test.php
   trunk/tests/modules/PHP_Related.test.php
Log:
- refs #40: removed slash at the beginning of URL. Changed table output now output to datatable instead of dataTable_actions and also includes link to outlink

Modified: trunk/misc/testJavascriptTracker/index.php
===================================================================
--- trunk/misc/testJavascriptTracker/index.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/misc/testJavascriptTracker/index.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -36,7 +36,7 @@
 <script type="text/javascript">
 <!--
 piwik_action_name = '';
-piwik_idsite = 3;
+piwik_idsite = 1;
 piwik_url = '<?php echo $urlPiwik; ?>/piwik.php';
 piwik_log(piwik_action_name, piwik_idsite,piwik_url);
 //-->

Modified: trunk/misc/testJavascriptTracker/page2.php
===================================================================
--- trunk/misc/testJavascriptTracker/page2.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/misc/testJavascriptTracker/page2.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -35,7 +35,7 @@
 <script type="text/javascript">
 <!--
 piwik_action_name = '';
-piwik_idsite = 3;
+piwik_idsite = 1;
 piwik_url = '<?php echo $urlPiwik; ?>/piwik.php';
 piwik_log(piwik_action_name, piwik_idsite,piwik_url);
 //-->

Modified: trunk/plugins/Actions/API.php
===================================================================
--- trunk/plugins/Actions/API.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/plugins/Actions/API.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -72,8 +72,10 @@
 	}
 
 	public function getOutlinks( $idSite, $period, $date, $expanded = false, $idSubtable = false )
-	{
-		return $this->getDataTable('Actions_outlink', $idSite, $period, $date, $expanded, $idSubtable );
+	{		
+		$dataTable = $this->getDataTable('Actions_outlink', $idSite, $period, $date, $expanded, $idSubtable );
+		$dataTable->queueFilter('Piwik_DataTable_Filter_ColumnCallbackAddDetail', array('label', 'url', create_function('$url', 'return $url;')));
+		return $dataTable;
 	}
 }
 

Modified: trunk/plugins/Actions/Actions.php
===================================================================
--- trunk/plugins/Actions/Actions.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/plugins/Actions/Actions.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -189,16 +189,18 @@
 	
 	static public function getActionCategoryFromName($name)
 	{
+		$isUrl = false; 
 		// case the name is an URL we dont clean the name the same way
 		if(Piwik_Common::isUrl($name))
 		{
 			$split = array($name);
+			$isUrl = true;
 		}
 		else
 		{
 			$split = explode(self::$actionCategoryDelimiter, $name);
 		}
-		return $split;
+		return array( $isUrl, $split);
 	}
 	
 	
@@ -209,7 +211,9 @@
 		while( $row = $query->fetch() )
 		{
 			// split the actions by category
-			$aActions = $this->getActionCategoryFromName($row['name']);
+			$returned = $this->getActionCategoryFromName($row['name']);
+			$aActions = $returned[1];
+			$isUrl = $returned[0];
 			
 			// we work on the root table of the given TYPE (either ACTION or DOWNLOAD or OUTLINK etc.)
 			$currentTable =& $this->actionsTablesByType[$row['type']];
@@ -221,16 +225,20 @@
 				$actionCategory = $aActions[$level];
 				$currentTable =& $currentTable[$actionCategory];
 			}
-			$actionNameBefore = $aActions[$end];
+			$actionName = $aActions[$end];
 			
 			// create a new element in the array for the page
 			// we are careful to prefix the pageName with some value so that if a page has the same name
 			// as a category we don't overwrite or do other silly things
 			
-			// we know that the concatenation of a space and the name of the action
-			// will always be unique as all the action names have been trimmed before reaching this point
-			$actionName = '/' . $actionNameBefore;
-			
+			// if the page name is not a URL we add a / before
+			if( !$isUrl )
+			{
+				// we know that the concatenation of a space and the name of the action
+				// will always be unique as all the action names have been trimmed before reaching this point
+				$actionName = '/' . $actionName;
+			}
+						
 			// currentTable is now the array element corresponding the the action
 			// at this point we may be for example at the 4th level of depth in the hierarchy
 			$currentTable =& $currentTable[$actionName];

Modified: trunk/plugins/Actions/Controller.php
===================================================================
--- trunk/plugins/Actions/Controller.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/plugins/Actions/Controller.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -40,13 +40,22 @@
 		
 		return $this->renderView($view, $fetch);
 	}
+	
 	function getOutlinks($fetch = false)
 	{
-		$view = $this->getActionsView(	$this->pluginName, 
-										__FUNCTION__,
-										'Actions.getOutlinks', 
-										'getOutlinksSubDataTable' );
 		
+		$view = Piwik_ViewDataTable::factory();
+		$view->init(  	$this->pluginName, 
+						__FUNCTION__,
+						'Actions.getOutlinks' );
+		
+		$view->setColumnsToDisplay( array(0,2,3) );
+		$view->setSortedColumn( 'nb_hits', 'desc' );
+		$view->setSortedColumn( 1 );
+		$view->disableExcludeLowPopulation();
+		$view->setLimit( 15 );
+		
+		$view->main();
 		return $this->renderView($view, $fetch);
 	}
 	function getOutlinksSubDataTable($fetch = false)

Modified: trunk/plugins/Provider/Controller.php
===================================================================
--- trunk/plugins/Provider/Controller.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/plugins/Provider/Controller.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -7,7 +7,7 @@
 	/**
 	 * Provider
 	 */
-	function getProvider()
+	function getProvider($fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory();
 		$view->init( 'Provider',  __FUNCTION__, "Provider.getProvider" );
@@ -17,7 +17,7 @@
 		$view->setLimit( 5 );
 		
 		$view->main();
-		echo $view->render();
+		return $this->renderView($view, $fetch);
 	}
 	
 }

Modified: trunk/tests/config_test.php
===================================================================
--- trunk/tests/config_test.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/tests/config_test.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -71,7 +71,6 @@
 require_once 'Zend/Config.php';
 require_once 'Zend/Db.php';
 require_once 'Zend/Db/Table.php';
-require_once 'Zend/Debug.php';
 require_once 'Config.php';
 require_once 'Timer.php';
 require_once 'API/APIable.php';

Modified: trunk/tests/modules/PHP_Related.test.php
===================================================================
--- trunk/tests/modules/PHP_Related.test.php	2008-03-12 17:00:23 UTC (rev 365)
+++ trunk/tests/modules/PHP_Related.test.php	2008-03-12 17:03:39 UTC (rev 366)
@@ -24,6 +24,15 @@
 	public function tearDown()
 	{
 	}
+	
+	function test_listEach()
+	{
+		$array = array('key' => 'elem2');
+		list($elem1,$elem2) = each($array);
+		
+		$this->assertEqual($elem1, 'key');
+		$this->assertEqual($elem2, 'elem2');
+	}
 	function test_TMP()
 	{
 		echo md5('root'.md5('nintendo'));



More information about the Piwik-svn mailing list