Skip to content
Extraits de code Groupes Projets
Valider 2878fe3f rédigé par mattpiwik's avatar mattpiwik
Parcourir les fichiers

Added the alpha Openads plugin that

- remove some steps from the installation process
- add a new step before the last one that reads from the openads plugin the list of websites/users/access/super user and saves them in piwik instead of using the normal "adding a new website" etc.

Added a menu in the interface try it!!! it looks better now, the interface is not a huge page anymore :-)
and it took 15 lines of jquery to generate the menu automatically, i love this lib!

git-svn-id: http://dev.piwik.org/svn/trunk@106 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 644cfb00
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -25,7 +25,6 @@ current = en ...@@ -25,7 +25,6 @@ current = en
default = en default = en
[Plugins] [Plugins]
enabled[] = Installation
enabled[] = Login enabled[] = Login
enabled[] = UsersManager enabled[] = UsersManager
enabled[] = SitesManager enabled[] = SitesManager
...@@ -41,6 +40,9 @@ enabled[] = VisitTime ...@@ -41,6 +40,9 @@ enabled[] = VisitTime
enabled[] = VisitorInterest enabled[] = VisitorInterest
enabled[] = ExamplePlugin enabled[] = ExamplePlugin
;enabled[] = Openads
enabled[] = Installation
[Plugins_LogStats] [Plugins_LogStats]
enabled[] = Provider enabled[] = Provider
......
Aucun aperçu pour ce type de fichier
...@@ -29,6 +29,7 @@ var minDateDay = {$minDateDay}; ...@@ -29,6 +29,7 @@ var minDateDay = {$minDateDay};
<style type="text/css">@import url(libs/jquery/jquery-calendar.css);</style> <style type="text/css">@import url(libs/jquery/jquery-calendar.css);</style>
{literal} {literal}
<style> <style>
h1 { h1 {
...@@ -92,9 +93,74 @@ tr td.label img.plusMinus { ...@@ -92,9 +93,74 @@ tr td.label img.plusMinus {
color:#8D92AA; color:#8D92AA;
} }
#generatedMenu span {
text-decoration:underline;
color:blue;
cursor:pointer;
}
#generatedMenu span:hover {
background:#DDEAF4 none repeat scroll 0%;
color:#333333;
}
#generatedMenu span {
border-bottom:medium none;
color:#000000;
font-size:14px;
font-weight:normal;
margin:0pt;
padding:3px 5px;
}
#generatedMenu span:hover{
color:#006699;
}
#generatedMenu span {
border-bottom:1px solid #6699CC;
color:#00019B;
text-decoration:none;
}
</style> </style>
<script>
$(document).ready( function(){
var allH2 = new Array;
var indexAllH2 = 0;
// foreach each div with a class section we add this DIV ID to the menu array
$('.section')
.hide()
.each( function(){
$(this).prepend("<h2>"+ $(this).attr('id') +"</h2>");
allH2[indexAllH2++] = $(this).attr('id');
});
// we generate the HTML of the menu
var htmlMenu = '';
for(i in allH2)
{
htmlMenu += " <span>"+allH2[i] +"</span> <small>#</small>";
}
// we fill the span MENU with the HTML generated above
$('#generatedMenu')
.html( htmlMenu )
.each( function() {
// then for each element of this menu we add a click event
// that shows the associated DIV
$('span',this).click( function() {
$('.section').hide();
$('#'+$(this).text()).toggle();
})
});
// we show the first section by default
$('.section').slice(0,1).show();
});
</script>
{/literal} {/literal}
<h1>Piwik reports</h1> <h1>Piwik reports</h1>
<div id="calendar"></div> <div id="calendar"></div>
...@@ -105,102 +171,111 @@ tr td.label img.plusMinus { ...@@ -105,102 +171,111 @@ tr td.label img.plusMinus {
{include file="Home/templates/sites_select.tpl"}<br> {include file="Home/templates/sites_select.tpl"}<br>
</div> </div>
<h2>Visits summary</h2> <span id="generatedMenu"></span>
<p>{$nbUniqVisitors} unique visitors</p>
<p>{$nbVisits} visits</p>
<p>{$nbActions} actions (page views)</p>
<p>{$sumVisitLength|sumtime} total time spent by the visitors</p>
<p>{$maxActions} max actions</p>
<p>{$bounceCount} visitors have bounced (left the site directly)</p>
<h2>User Country</h2>
<h3>Country</h3>
{$dataTableCountry}
<h3>Continent</h3>
{$dataTableContinent}
<h2>Provider</h2>
{$dataTableProvider}
<h2>Referers</h2>
<h3>Referer Type</h3> <div class="section" id="Visits_summary">
{$dataTableRefererType} <p>{$nbUniqVisitors} unique visitors</p>
<p>{$nbVisits} visits</p>
<h3>Search Engines</h3> <p>{$nbActions} actions (page views)</p>
<p>{$numberDistinctSearchEngines} distinct search engines</p> <p>{$sumVisitLength|sumtime} total time spent by the visitors</p>
{$dataTableSearchEngines} <p>{$maxActions} max actions</p>
<p>{$bounceCount} visitors have bounced (left the site directly)</p>
<h3>Keywords</h3> </div>
<p>{$numberDistinctKeywords} distinct keywords</p>
{$dataTableKeywords}
<h3>Websites</h3>
<p>{$numberDistinctWebsites} distinct websites</p>
<p>{$numberDistinctWebsitesUrls} distinct websites URLs</p>
{$dataTableWebsites}
<h3>Partners</h3>
<p>{$numberDistinctPartners} distinct partners</p>
<p>{$numberDistinctPartnersUrls} distinct partners URLs</p>
{$dataTablePartners}
<h3>Campaigns</h3>
<p>{$numberDistinctCampaigns} distinct campaigns</p>
{$dataTableCampaigns}
<h2>Actions</h2> <div class="section" id="User_Country">
<h3>Actions</h3> <h3>Country</h3>
{$dataTableActions} {$dataTableCountry}
<h3>Downloads</h3> <h3>Continent</h3>
{$dataTableDownloads} {$dataTableContinent}
<h3>Outlinks</h3> </div>
{$dataTableOutlinks}
<h2>User Settings</h2> <div class="section" id="Provider">
<h3>Configurations</h3> {$dataTableProvider}
{$dataTableConfiguration} </div>
<h3>Resolutions</h3> <div class="section" id="Referers">
{$dataTableResolution} <h3>Referer Type</h3>
{$dataTableRefererType}
<h3>Search Engines</h3>
<p>{$numberDistinctSearchEngines} distinct search engines</p>
{$dataTableSearchEngines}
<h3>Keywords</h3>
<p>{$numberDistinctKeywords} distinct keywords</p>
{$dataTableKeywords}
<h3>Websites</h3>
<p>{$numberDistinctWebsites} distinct websites</p>
<p>{$numberDistinctWebsitesUrls} distinct websites URLs</p>
{$dataTableWebsites}
<h3>Partners</h3>
<p>{$numberDistinctPartners} distinct partners</p>
<p>{$numberDistinctPartnersUrls} distinct partners URLs</p>
{$dataTablePartners}
<h3>Campaigns</h3>
<p>{$numberDistinctCampaigns} distinct campaigns</p>
{$dataTableCampaigns}
</div>
<h3>Operating systems</h3> <div class="section" id="Actions">
{$dataTableOS} <h3>Actions</h3>
{$dataTableActions}
<h3>Downloads</h3>
{$dataTableDownloads}
<h3>Outlinks</h3>
{$dataTableOutlinks}
</div>
<h3>Browsers</h3> <div class="section" id="User_Settings">
{$dataTableBrowser} <h3>Configurations</h3>
{$dataTableConfiguration}
<h3>Resolutions</h3>
{$dataTableResolution}
<h3>Operating systems</h3>
{$dataTableOS}
<h3>Browsers</h3>
{$dataTableBrowser}
<h3>Browser families</h3>
{$dataTableBrowserType}
<h3>Wide Screen</h3>
{$dataTableWideScreen}
<h3>Plugins</h3>
{$dataTablePlugin}
</div>
<h3>Browser families</h3>
{$dataTableBrowserType}
<h3>Wide Screen</h3> <div class="section" id="Frequency">
{$dataTableWideScreen} <p>{$nbVisitsReturning} returning visits</p>
<p>{$nbActionsReturning} actions by the returning visits</p>
<p>{$maxActionsReturning} maximum actions by a returning visit</p>
<p>{$sumVisitLengthReturning|sumtime} total time spent by returning visits</p>
<p>{$bounceCountReturning} times that a returning visit has bounced</p>
</div>
<h3>Plugins</h3> <div class="section" id="Visit_Time">
{$dataTablePlugin} <h3>Visit per local time</h3>
{$dataTableVisitInformationPerLocalTime}
<h3>Visit per server time</h3>
{$dataTableVisitInformationPerServerTime}
</div>
<div class="section" id="Visitor_Interest">
<h3>Visits per visit duration</h3>
{$dataTableNumberOfVisitsPerVisitDuration}
<h3>Visits per number of pages</h3>
{$dataTableNumberOfVisitsPerPage}
</div>
<h2>Frequency</h2>
<p>{$nbVisitsReturning} returning visits</p>
<p>{$nbActionsReturning} actions by the returning visits</p>
<p>{$maxActionsReturning} maximum actions by a returning visit</p>
<p>{$sumVisitLengthReturning|sumtime} total time spent by returning visits</p>
<p>{$bounceCountReturning} times that a returning visit has bounced</p>
<h2>Visit Time</h2> <br><br><br><hr width="300px" align="left">
<h3>Visit per local time</h3> <p><small>{$totalTimeGeneration} seconds to generate the page</p>
{$dataTableVisitInformationPerLocalTime} \ No newline at end of file
<h3>Visit per server time</h3>
{$dataTableVisitInformationPerServerTime}
<h2>Visitor Interest</h2>
<h3>Visits per visit duration</h3>
{$dataTableNumberOfVisitsPerVisitDuration}
<h3>Visits per number of pages</h3>
{$dataTableNumberOfVisitsPerPage}
<br><hr>
<p>{$totalTimeGeneration} seconds to generate the page</p>
\ No newline at end of file
...@@ -2,9 +2,12 @@ ...@@ -2,9 +2,12 @@
require_once "Installation/Controller.php"; require_once "Installation/Controller.php";
class Piwik_Installation extends Piwik_Plugin class Piwik_Installation extends Piwik_Plugin
{ {
protected $installationControllerName = 'Piwik_Installation_Controller';
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
} }
public function getInformation() public function getInformation()
...@@ -30,12 +33,24 @@ class Piwik_Installation extends Piwik_Plugin ...@@ -30,12 +33,24 @@ class Piwik_Installation extends Piwik_Plugin
return $hooks; return $hooks;
} }
public function setControllerToLoad( $newControllerName )
{
$this->installationControllerName = $newControllerName;
}
protected function getInstallationController()
{
return new $this->installationControllerName();
}
function startInstallation() function startInstallation()
{ {
Piwik_PostEvent('Installation.startInstallation', $this);
//Piwik::redirectToModule('Installation', 'welcome'); //Piwik::redirectToModule('Installation', 'welcome');
$step = Piwik_Common::getRequestVar('action', 'welcome', 'string'); $step = Piwik_Common::getRequestVar('action', 'welcome', 'string');
$controller = new Piwik_Installation_Controller; $controller = $this->getInstallationController();
if(in_array($step, $controller->getInstallationSteps())) if(in_array($step, $controller->getInstallationSteps()))
{ {
$controller->$step(); $controller->$step();
......
...@@ -3,7 +3,8 @@ require_once "View.php"; ...@@ -3,7 +3,8 @@ require_once "View.php";
require_once "Installation/View.php"; require_once "Installation/View.php";
class Piwik_Installation_Controller extends Piwik_Controller class Piwik_Installation_Controller extends Piwik_Controller
{ {
protected $steps = array( // public so plugins can modify it
public $steps = array(
'welcome', 'welcome',
'systemCheck', 'systemCheck',
'databaseSetup', 'databaseSetup',
...@@ -23,7 +24,10 @@ class Piwik_Installation_Controller extends Piwik_Controller ...@@ -23,7 +24,10 @@ class Piwik_Installation_Controller extends Piwik_Controller
{ {
$_SESSION['currentStepDone'] = ''; $_SESSION['currentStepDone'] = '';
} }
Piwik_PostEvent('InstallationController.construct', $this);
} }
public function getInstallationSteps() public function getInstallationSteps()
{ {
return $this->steps; return $this->steps;
...@@ -229,15 +233,8 @@ class Piwik_Installation_Controller extends Piwik_Controller ...@@ -229,15 +233,8 @@ class Piwik_Installation_Controller extends Piwik_Controller
$name = urlencode($form->getSubmitValue('name')); $name = urlencode($form->getSubmitValue('name'));
$url = urlencode($form->getSubmitValue('url')); $url = urlencode($form->getSubmitValue('url'));
// connect to the database using the DB infos currently in the session $this->initObjectsToCallAPI();
$this->createDbFromSessionInformation();
// create the fake access to grant super user privilege
Zend_Registry::set('access', new Piwik_FakeAccess_SetSuperUser);
// we need to create the logs otherwise the API request throws an exception
Piwik::createLogObject();
require_once "API/Request.php"; require_once "API/Request.php";
$request = new Piwik_API_Request(" $request = new Piwik_API_Request("
method=SitesManager.addSite method=SitesManager.addSite
...@@ -320,6 +317,19 @@ class Piwik_Installation_Controller extends Piwik_Controller ...@@ -320,6 +317,19 @@ class Piwik_Installation_Controller extends Piwik_Controller
protected function initObjectsToCallAPI()
{
// connect to the database using the DB infos currently in the session
$this->createDbFromSessionInformation();
// create the fake access to grant super user privilege
Zend_Registry::set('access', new Piwik_FakeAccess_SetSuperUser);
// we need to create the logs otherwise the API request throws an exception
Piwik::createLogObject();
}
protected function writeConfigFileFromSession() protected function writeConfigFileFromSession()
{ {
$configFile = "; file automatically generated during the piwik installation process\n"; $configFile = "; file automatically generated during the piwik installation process\n";
......
<?php
class Piwik_Openads extends Piwik_Plugin
{
public function __construct()
{
parent::__construct();
}
public function getInformation()
{
$info = array(
// name must be the className prefix!
'name' => 'OpenAds Integration',
'description' => 'Installing piwik from openads, importing openads users & websites,
sharing authentication',
'author' => 'Piwik',
'homepage' => 'http://piwik.org/',
'version' => '0.1',
'translationAvailable' => false,
);
return $info;
}
function install()
{
}
function uninstall()
{
}
function getListHooksRegistered()
{
$hooks = array(
'Installation.startInstallation' => 'installationInit',
'InstallationController.construct' => 'installationControllerInit'
);
return $hooks;
}
// triggered in constructor of the Installation plugin
function installationInit( $notification )
{
$installPlugin = $notification->getNotificationObject();
require_once "Openads/Controller.php";
$installPlugin->setControllerToLoad( 'Piwik_Openads_Controller');
}
function installationControllerInit($notification)
{
$installationController = $notification->getNotificationObject();
$install = $installationController;
// we remove two steps from the installation
unset($install->steps[array_search('generalSetup', $install->steps)]);
unset($install->steps[array_search('firstWebsiteSetup', $install->steps)]);
unset($install->steps[array_search('displayJavascriptCode', $install->steps)]);
$install->steps = array_values($install->steps);
// we add the openads integration just before the last step
$lastStepIndex = count($install->steps) - 1;
$install->steps[$lastStepIndex + 1] = $install->steps[$lastStepIndex];
$install->steps[$lastStepIndex] = 'openadsIntegration';
}
}
<?php
class Piwik_Openads_Controller extends Piwik_Installation_Controller
{
function __construct()
{
parent::__construct();
}
function openadsIntegration()
{
$view = new Piwik_Install_View(
'Openads/templates/openadsIntegration.tpl',
$this->getInstallationSteps(),
__FUNCTION__
);
$view->showNextStep = true;
$superUserInfos = array(
'login' => 'openads_root',
'password' => 'openads_pwd',
'email' => 'openads_email',
);
$_SESSION['superuser_infos'] = $superUserInfos;
// we load the DB/config/etc. in order to call the API
$this->initObjectsToCallAPI();
// we load the websites from opeands and add them to piwik
$sitesToAdd = array();
foreach($sitesToAdd as $site)
{
$request = new Piwik_API_Request("
method=SitesManager.addSite
&name=$name
&urls=$url
&format=original
");
}
// we load the users from opeands and add them to piwik
$usersToAdd = array();
foreach($usersToAdd as $user)
{
$userLogin = $user['login'];
$userLogin = $user['login'];
$password = 'fake password because it is not necessary the auth will not be used.';
$email = '';
$alias = '';
//addUser( $userLogin, $password, $email, $alias = false )
$request = new Piwik_API_Request("
method=UsersManager.addUser
&userLogin=$userLogin
&password=$password
&email=$email
&alias=$alias
&format=original
");
}
$_SESSION['currentStepDone'] = __FUNCTION__;
echo $view->render();
}
}
\ No newline at end of file
<h1>Openads integration</h1>
<p>Setting the Super User access...</p>
<p>Importing websites from Openads...</p>
<p>Importing users from Openads...</p>
<p>Mapping user access from Opeands...</p>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter