feature request: poss. to manually arrange sequence of the websites (up/down function, or better even, add an item number to each website and then order by it
This would be awesome! I second this!
I can’t envision this being implemented without a use case (where, why, …).
Are we talking about MultiSites plugin (All Websites link)?
If yes, this bugged me for quite a while too… I did this little customization to add rows per page and sorting by website ID instead of name (the latter really doesn’t make much sense for my case).
And since I can’t attach .zip file, here’s the patch:
diff -c2rB MultiSites_ori//Controller.php MultiSites/Controller.php
*** MultiSites_ori//Controller.php 2010-12-23 04:29:56.000000000 +0800
--- MultiSites/Controller.php 2011-01-04 18:52:19.982000000 +0800
***************
*** 17,21 ****
class Piwik_MultiSites_Controller extends Piwik_Controller
{
! protected $orderBy = 'names';
protected $order = 'desc';
protected $evolutionBy = 'visits';
--- 17,21 ----
class Piwik_MultiSites_Controller extends Piwik_Controller
{
! protected $orderBy = 'idsite';
protected $order = 'desc';
protected $evolutionBy = 'visits';
***************
*** 50,54 ****
$ids = 'all';
! $this->period = Piwik_Common::getRequestVar('period', 'day');
$lastDate = date('Y-m-d',strtotime("-1 ".$this->period, strtotime($this->strDate)));
--- 50,54 ----
$ids = 'all';
! $this->period = Piwik_Common::getRequestVar('period', 'day');
$lastDate = date('Y-m-d',strtotime("-1 ".$this->period, strtotime($this->strDate)));
***************
*** 100,104 ****
$view->date = $this->strDate;
$view->page = $this->page;
! $view->limit = $this->limit;
$view->orderBy = $this->orderBy;
$view->order = $this->order;
--- 100,104 ----
$view->date = $this->strDate;
$view->page = $this->page;
! $view->limit = Piwik_Common::getRequestVar('limit', $this->limit);
$view->orderBy = $this->orderBy;
$view->order = $this->order;
Only in MultiSites_ori/: MultiSites.php
Only in MultiSites_ori/: images
diff -c2rB MultiSites_ori//templates/common.js MultiSites/templates/common.js
*** MultiSites_ori//templates/common.js 2010-12-18 02:44:49.000000000 +0800
--- MultiSites/templates/common.js 2011-01-04 19:13:22.593000000 +0800
***************
*** 66,70 ****
function orderBy(allSites, params)
{
! if(params['mOrderBy'] == 'names')
{
allSites.sort(function(a,b) {
--- 66,72 ----
function orderBy(allSites, params)
{
! var orderTarget = params['mOrderBy'];
!
! if(orderTarget == 'names')
{
allSites.sort(function(a,b) {
***************
*** 76,133 ****
});
}
! else if(params['mOrderBy'] == 'visits')
! {
! allSites.sort(function(a,b) {
! if (a['visits'] == b['visits']) {
! return 0;
! }
! return (a['visits'] < b['visits']) ? -1 : 1;
! });
! }
! else if(params['mOrderBy'] == 'actions')
! {
! allSites.sort(function (a,b) {
! if (a['actions'] == b['actions']) {
! return 0;
! }
! return (a['actions'] < b['actions']) ? -1 : 1;
! });
! }
! else if(params['mOrderBy'] == 'unique')
! {
! allSites.sort(function (a,b) {
! if (a['unique'] == b['unique']) {
! return 0;
! }
! return (a['unique'] < b['unique']) ? -1 : 1;
! });
! }
! else if(params['mOrderBy'] == 'uniqueSummary')
! {
! allSites.sort(function (a,b) {
! if (a['uniqueSummaryValue'] == b['uniqueSummaryValue']) {
! return 0;
! }
! return (a['uniqueSummaryValue'] - b['uniqueSummaryValue'] <= 0.01) ? -1 : 1;
! });
! }
! else if(params['mOrderBy'] == 'actionsSummary')
! {
! allSites.sort(function (a,b) {
! if (a['actionsSummaryValue'] == b['actionsSummaryValue']) {
! return 0;
! }
! return (a['actionsSummaryValue'] - b['actionsSummaryValue'] <= 0.01) ? -1 : 1;
! });
! }
! else if(params['mOrderBy'] == 'visitsSummary')
! {
! allSites.sort(function (a,b) {
! if (a['visitsSummaryValue'] == b['visitsSummaryValue']) {
! return 0;
! }
! return (a['visitsSummaryValue'] - b['visitsSummaryValue'] <= 0.01) ? -1 : 1;
! });
! }
if(params['order'] == 'asc')
--- 78,114 ----
});
}
! else if(orderTarget == 'uniqueSummary')
! {
! allSites.sort(function (a,b) {
! if (a['uniqueSummaryValue'] == b['uniqueSummaryValue']) {
! return 0;
! }
! return (a['uniqueSummaryValue'] - b['uniqueSummaryValue'] <= 0.01) ? -1 : 1;
! });
! }
! else if(orderTarget == 'actionsSummary')
! {
! allSites.sort(function (a,b) {
! if (a['actionsSummaryValue'] == b['actionsSummaryValue']) {
! return 0;
! }
! return (a['actionsSummaryValue'] - b['actionsSummaryValue'] <= 0.01) ? -1 : 1;
! });
! }
! else if(orderTarget == 'visitsSummary')
! {
! allSites.sort(function (a,b) {
! if (a['visitsSummaryValue'] == b['visitsSummaryValue']) {
! return 0;
! }
! return (a['visitsSummaryValue'] - b['visitsSummaryValue'] <= 0.01) ? -1 : 1;
! });
! }
! else
! {
! allSites.sort(function(a,b) {
! return a[orderTarget]-b[orderTarget];
! });
! }
if(params['order'] == 'asc')
***************
*** 176,182 ****
str = str.replace(/%period%/g, params['period']);
! $('#tb').append('<tr class="tables_row" id="row_'+ allSites[i].idsite+'">' + str + '</tr>');
}
!
$(".table_row").show();
$('.actions').hide();
--- 157,163 ----
str = str.replace(/%period%/g, params['period']);
! $('#tb').append('<tr class="tables_row" id="row_'+ allSites[i].idsite+'">' + str + '</tr>')
}
!
$(".table_row").show();
$('.actions').hide();
diff -c2rB MultiSites_ori//templates/index.tpl MultiSites/templates/index.tpl
*** MultiSites_ori//templates/index.tpl 2011-01-03 13:49:45.000000000 +0800
--- MultiSites/templates/index.tpl 2011-01-04 19:22:22.900000000 +0800
***************
*** 38,45 ****
<table id="mt" class="dataTable" cellspacing="0">
<thead>
! <th id="names" class="label" onClick="params = setOrderBy(this,allSites, params, 'names');">
! <span>{'General_Website'|translate}</span>
! <span class="arrow multisites_desc"></span>
! </th>
<th id="visits" class="multisites-column" style="width: 100px" onClick="params = setOrderBy(this,allSites, params, 'visits');">
<span>{'General_ColumnNbVisits'|translate}</span>
--- 38,49 ----
<table id="mt" class="dataTable" cellspacing="0">
<thead>
! <th id="idsite" class="" onClick="params = setOrderBy(this,allSites, params, 'idsite');">
! <span>ID</span>
! <span class="arrow"></span>
! </th>
! <th id="names" class="labelmultisites-column" onClick="params = setOrderBy(this,allSites, params, 'names');">
! <span>{'General_Website'|translate}</span>
! <span class="arrow multisites_desc"></span>
! </th>
<th id="visits" class="multisites-column" style="width: 100px" onClick="params = setOrderBy(this,allSites, params, 'visits');">
<span>{'General_ColumnNbVisits'|translate}</span>
***************
*** 69,72 ****
--- 73,89 ----
<tfoot>
+ <tr class="tables_row">
+ <td colspan="5" class="clean"></td>
+ <td colspan="2" class="clean">
+ <span>Items per page: </span>
+ <select class="selector" id="rowsPerPage" onchange="params['limit'] = $('#rowsPerPage').val(); prepareRows(allSites, params);">
+ <option value="10" {if $limit eq '10'} selected {/if}>10</option>
+ <option value="20" {if $limit eq '20'} selected {/if}>20</option>
+ <option value="30" {if $limit eq '30'} selected {/if}>30</option>
+ <option value="50" {if $limit eq '50'} selected {/if}>50</option>
+ <option value="100" {if $limit eq '100'} selected {/if}>100</option>
+ </select>
+ </td>
+ </tr>
<tr row_id="last" >
<td colspan="8" class="clean" style="padding: 20px">
diff -c2rB MultiSites_ori//templates/row.tpl MultiSites/templates/row.tpl
*** MultiSites_ori//templates/row.tpl 2010-09-06 03:03:28.000000000 +0800
--- MultiSites/templates/row.tpl 2011-01-04 18:49:08.719000000 +0800
***************
*** 1,7 ****
<td class="multisites-label label" >
<a title="View reports" href="index.php?module=CoreHome&action=index&date=%date%&period=%period%&idSite=%idsite%">%name%</a>
<span style="width: 10px; margin-left:3px">
! <a target="_blank" title="{'General_GoTo'|translate:"%main_url%"}" href="%main_url%"><img src="plugins/MultiSites/images/link.gif" /></a>
</span>
</td>
--- 1,10 ----
<td class="multisites-label label" >
+ <a title="View reports" href="index.php?module=CoreHome&action=index&date=%date%&period=%period%&idSite=%idsite%">%idsite%</a>
+ </td>
+ <td class="multisites-column name" >
<a title="View reports" href="index.php?module=CoreHome&action=index&date=%date%&period=%period%&idSite=%idsite%">%name%</a>
<span style="width: 10px; margin-left:3px">
! <a target="_blank" title="{'General_GoTo'|translate:"%main_url%"}" href="%main_url%"><img src="plugins/MultiSites/images/link.gif" /></a>
</span>
</td>
diff -c2rB MultiSites_ori//templates/styles.css MultiSites/templates/styles.css
*** MultiSites_ori//templates/styles.css 2010-07-27 07:13:02.000000000 +0800
--- MultiSites/templates/styles.css 2011-01-04 18:50:17.151000000 +0800
***************
*** 31,34 ****
--- 31,37 ----
}
#multisites td.multisites-label {
+ width: 70px;
+ }
+ #multisites td.multisites-column.name {
padding-left: 15px ;
text-align:left;
Use
cd plugins/MultiSites
cp blabla/downloads/MultiSites.patch .
patch -p1 -i MultiSites.patch
Or pm me your email and I’ll send the zip file of my MultiSites.
Edit: It’s important to clear your PIWIK/tmp/assets/* content to force piwik to rebuild css / js cache
On my part, i simply start the name of the site with the number i want (followed by a period and a pace).
But then, i only have 14 of them and i use their ID to order them.