Skip to content

Commit

Permalink
adding all sites dashboard/roster
Browse files Browse the repository at this point in the history
changing default page to all sites roster. #592.
  • Loading branch information
padams committed Jan 28, 2012
1 parent d3f6cb8 commit 9bf4acc
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 53 deletions.
4 changes: 2 additions & 2 deletions modules/base/classes/settings.php
Expand Up @@ -654,7 +654,7 @@ private function getDefaultSettingsArray() {
'reserved_words' => array('do' => 'action'),
'login_view' => 'base.login',
'not_capable_view' => 'base.error',
'start_page' => 'base.reportDashboard',
'start_page' => 'base.sites',
'default_action' => 'base.loginForm',
'default_page' => '', // move to site settings
'default_cache_expiration_period' => 604800,
Expand Down Expand Up @@ -686,7 +686,7 @@ private function getDefaultSettingsArray() {
'edit_modules'
),
'analyst' => array('view_reports', 'view_reports_ecommerce'),
'viewer' => array('view_reports'),
'viewer' => array('view_site_list', 'view_reports'),
'everyone' => array()
),
'numGoals' => 15,
Expand Down
12 changes: 7 additions & 5 deletions modules/base/sites.php
Expand Up @@ -17,6 +17,7 @@
//

require_once(OWA_BASE_DIR.'/owa_adminController.php');
require_once(OWA_BASE_DIR.'/owa_reportController.php');
require_once(OWA_BASE_DIR.'/owa_view.php');

/**
Expand All @@ -31,12 +32,12 @@
* @since owa 1.0.0
*/

class owa_sitesController extends owa_adminController {
class owa_sitesController extends owa_reportController {

function __construct($params) {
$this->setRequiredCapability('edit_sites');
return parent::__construct($params);

parent::__construct($params);
$this->setRequiredCapability('view_site_list');
}

function action() {
Expand All @@ -45,7 +46,8 @@ function action() {
$sites = $this->getSitesAllowedForCurrentUser();
$this->set('tracked_sites', $sites);
$this->setSubview('base.sites');
$this->setView('base.options');
$this->setView('base.adminPage');
$this->set('title', 'Sites Roster');
}
}

Expand Down
13 changes: 13 additions & 0 deletions modules/base/templates/genericAdminPage.php
@@ -0,0 +1,13 @@
<div id="<?php echo $dom_id;?>" class="owa_reportContainer">

<div class="reportSectionContainer">
<div id="owa_timePeriodControl" class="owa_reportPeriod" style="float:right;"></div>
<div id="liveViewSwitch" style="width:auto;float:right; padding-right:30px;"></div>
<div class="owa_reportTitle"><?php echo $title;?><span class="titleSuffix"><?php echo $this->get('titleSuffix');?></span></div>

<div class="clear"></div>
<?php echo $subview;?>

</div>

</div>
2 changes: 1 addition & 1 deletion modules/base/templates/header.tpl
Expand Up @@ -4,7 +4,7 @@
&nbsp
<span class="owa_navigation">
<UL>
<LI><a href="<?php echo $this->makeLink(array('do' => 'base.reportDashboard'), true);?>">Reports</a></LI>
<LI><a href="<?php echo $this->makeLink(array('do' => 'base.sites'));?>">Reporting</a></LI>
<LI><a href="<?php echo $this->makeLink(array('do' => 'base.optionsGeneral'));?>">Administration</a></LI>
<LI><a href="http://wiki.openwebanalytics.com">Help</a></LI>
<LI><a href="http://trac.openwebanalytics.com">Report a Bug</a></LI>
Expand Down
111 changes: 66 additions & 45 deletions modules/base/templates/sites.tpl
@@ -1,50 +1,71 @@
<DIV class="panel_headline"><?php echo $headline;?></DIV>
<DIV id="panel">
<P>Below is the list of Web Sites that can be tracked. A site must appear in this list
if it is to be tracked/reported separately.</P>

<fieldset>
<legend>Tracked Web Sites <span class="legend_link">(<a href="<?php echo $this->makeLink(array('do' => 'base.sitesProfile'));?>">Add a Site</a>)<span></legend>
<P>Below is the list of Web Sites that can be tracked. A site must appear in this list if it is to be tracked/reported separately.</P>


<TABLE width="100%" border="0" class="management">
<thead>
<TR>
<TH>Name & Description</TH>

<TH>Options</TH>
</TR>
</thead>
<tbody>
<?php if ($tracked_sites): ?>
<?php foreach ($tracked_sites as $site):?>
<TR>
<TD>
<span style="font-size:14px; font-weight:bold;">
<a href="<?php echo $this->makeLink( array('do' => 'base.reportDashboard', 'siteId' => $site->get('site_id') ), false );?>"><?php $this->out( $site->get('name') );?></a>
</span><BR>
<?php if ($site->get('description') != ''):?>
<span class="info_text"><?php $this->out( $site->get('description') );?></span><BR>
<?php endif;?>
<span class="info_text"><?php $this->out( $site->get('domain') );?></span><BR>
</TD>

<TD>
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesProfile', 'siteId' => $site->get('site_id'), 'edit' => true ) );?>">Edit</a> |
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesDelete', 'siteId' => $site->get('site_id') ), false, false, false, true );?>">Delete</a> |
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesInvocation', 'siteId' => $site->get('site_id') ) );?>">Get Tracking Code</a> |
<a href="<?php echo $this->makeLink( array('do' => 'base.optionsGoals', 'siteId' => $site->get('site_id') ) );?>">Goals</a>
</TD>

</TR>
<?php endforeach;?>
<?php else: ?>
<TR>
<TD>There are no tracked sites. <a href="<?php echo $this->makeLink(array('do' => 'base.sitesProfile'));?>">Add a site</a>.</TD>
</TR>
<?php endif;?>
</tbody>
</TABLE>
<p class="legend_link">(<a href="<?php echo $this->makeLink(array('do' => 'base.sitesProfile'));?>">Add a Site</a>)</p>

</fieldset>
<?php if ($tracked_sites): ?>
<?php foreach ($tracked_sites as $site):?>
<div class="owa_reportSectionContent" style="min-width:500px;">
<TABLE width="" border="0" class="management">
<thead></thead>
<tbody>
<TR>

<td style="width:150px;" valign="">
<?php $this->getSiteThumbnail( $site->get( 'domain' ), 150 );?>
</td>

<td valign="">
<span style="font-size:14px; font-weight:bold;">
<a href="<?php echo $this->makeLink( array('do' => 'base.reportDashboard', 'siteId' => $site->get('site_id') ), false );?>"><?php $this->out( $site->get('name') );?></a>
</span><BR>
<?php if ($site->get('description') != ''):?>
<span class="info_text"><?php $this->out( $site->get('description') );?></span><BR>
<?php endif;?>
<span class="externalUrl"><?php $this->out( $site->get('domain') );?></span><BR><BR>
<div>
<a href="<?php echo $this->makeLink( array('do' => 'base.reportDashboard', 'siteId' => $site->get('site_id') ), false );?>">View Reports</a> |
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesProfile', 'siteId' => $site->get('site_id'), 'edit' => true ) );?>">Edit Profile</a> |
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesInvocation', 'siteId' => $site->get('site_id') ) );?>">Get Tracking Code</a> |
<a href="<?php echo $this->makeLink( array('do' => 'base.optionsGoals', 'siteId' => $site->get('site_id') ) );?>">Goals</a>
|
<a href="<?php echo $this->makeLink( array('do' => 'base.sitesDelete', 'siteId' => $site->get('site_id') ), false, false, false, true );?>">Delete</a>
</div>
</td>
<td>
<!-- stats -->
<div id="trend-metrics-<?php echo $site->get('site_id'); ?>"></div>
<script>
var aurl = '<?php echo $this->makeApiLink(array(
'do' => 'getResultSet',
'metrics' => 'visits,pageViews,bounceRate',
'dimensions' => 'date',
'sort' => 'date',
'format' => 'json',
'period' => 'last_thirty_days',
'constraints' => urlencode('siteId=='.$site->get('site_id'))
), true); ?>';
var rsh = new OWA.resultSetExplorer('site-trend');
//rsh.asyncQueue.push(['makeAreaChart', [{x: 'date', y: 'visits'}], 'trend-chart']);
rsh.options.metricBoxes.width = '150px';
rsh.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics-<?php echo $site->get('site_id'); ?>']);
rsh.load(aurl);
</script>



</td>
</TR>
</tbody>
</TABLE>
</div>
<?php endforeach;?>
<?php else: ?>

There are no tracked sites. <a href="<?php echo $this->makeLink(array('do' => 'base.sitesProfile'));?>">Add a site</a>.</TD>

<?php endif;?>
5 changes: 5 additions & 0 deletions owa_template.php
Expand Up @@ -1023,6 +1023,11 @@ function getLatestActions( $startDate, $endDate, $siteId, $visitorId = '', $sess
$t->set_template('widget_latestActions.php');
return $t->fetch();
}

public function getSiteThumbnail( $domain, $width = '200' ) {

echo sprintf('<img src="http://s.wordpress.com/mshots/v1/%s?w=%s" width="%s">', urlencode($domain .'/'), $width, $width );
}
}


Expand Down
16 changes: 16 additions & 0 deletions owa_view.php
Expand Up @@ -767,4 +767,20 @@ function render() {
}
}

class owa_adminPageView extends owa_view {

function render() {

// Set Page title
$this->t->set('page_title', $this->get('title'));

// Set Page headline
$this->body->set('title', $this->get('title'));
$this->body->set('titleSuffix', $this->get('titleSuffix'));
$this->body->set_template('genericAdminPage.php');
$this->setJs('owa.reporting', 'base/js/owa.reporting-combined-min.js');
$this->setCss("base/css/owa.reporting-css-combined.css");
}
}

?>

0 comments on commit 9bf4acc

Please sign in to comment.