Update of /cvsroot/sitesampler/sitesampler/SiteSampler/Report
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16322/SiteSampler/Report
Modified Files:
Urls.pm Viewer.pm
Log Message:
committing the diffs thatI found on the laptop. I am sure that this will make the tip very unstable - so be sure to check it out and wreck your currently runnning good system :)
Index: Viewer.pm
===================================================================
RCS file: /cvsroot/sitesampler/sitesampler/SiteSampler/Report/Viewer.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Viewer.pm 4 Jul 2005 03:09:54 -0000 1.5
--- Viewer.pm 28 Aug 2005 18:46:59 -0000 1.6
***************
*** 51,64 ****
$self->section_footer;
! $self->report_section('months',$report->hits->monthly);
! $self->report_section('daysofmonth',$report->hits->daily);
! $self->report_section('daysofweek',$report->hits->weekdays);
! $self->report_section('hoursofday',$report->hits->hourly);
! $self->report_section('urls',$report->urls);
# $self->report_section('internal_referers',$report->referers->internal);
! $self->report_section('direct_referers',$report->referers->direct);
! $self->report_section('search_referers',$report->referers->search_engine);
! $self->report_section('solicitations',$report->solicitations);
=cutcode
--- 51,64 ----
$self->section_footer;
! $self->report_section('months',$report->hits->monthly,'Monthly','Month');
! $self->report_section('daysofmonth',$report->hits->daily,'Daily','Day of Month');
! $self->report_section('daysofweek',$report->hits->weekdays,'Days of Week','Weekday');
! $self->report_section('hoursofday',$report->hits->hourly,'Hourly','Hour of Day');
! $self->report_section('urls',$report->urls,'Requested Pages','URL');
# $self->report_section('internal_referers',$report->referers->internal);
! $self->report_section('direct_referers',$report->referers->direct,'Referring Pages - Direct','URL');
! $self->report_section('search_referers',$report->referers->search_engine,'Referring Pages - Search Engine','');
! $self->report_section('solicitations',$report->solicitations,'Points of Solicitation','URL');
=cutcode
***************
*** 71,87 ****
=cut
! $self->report_section('domains',$report->domains);
# $self->report_section('profiles',$report->profiles);
! $self->report_section('plugins',$report->plugins);
! $self->report_section('os',$report->os);
! $self->report_section('user_agent',$report->user_agents);
! $self->report_section('mon_width',$report->monitors->widths);
! $self->report_section('mon_height',$report->monitors->heights);
! $self->report_section('mon_res',$report->monitors->depths);
! $self->report_section('mon_config',$report->monitors->resolutions);
! $self->report_section('mon_col_depth',$report->monitors->configs);
return($self->out);
--- 71,87 ----
=cut
! $self->report_section('domains',$report->domains,'Countries','Country');
# $self->report_section('profiles',$report->profiles);
! $self->report_section('plugins',$report->plugins,'Plugins','Plugin Name');
! $self->report_section('os',$report->os,'Operating Systems','OS');
! $self->report_section('user_agent',$report->user_agents,'Browsers','Browser');
! $self->report_section('mon_width',$report->monitors->widths,'Monitor Widths','Width (pixels)');
! $self->report_section('mon_height',$report->monitors->heights,'Monitor Heights','Height (pixels)');
! $self->report_section('mon_col_depth',$report->monitors->depths,'Monitor Color Depths','Color Depth (millions of colors)');
! $self->report_section('mon_res',$report->monitors->resolutions,'Monitor Resolutions','Resolution (W x H)');
! $self->report_section('mon_config',$report->monitors->configs,'Montior Configurations','Configuration (W x H x Depth)');
return($self->out);
***************
*** 97,103 ****
sub report_section{
my $self = shift;
! my($anchor_label,$obj) = @_;
$self->a_name($anchor_label);
! $self->draw_table($obj);
$self->section_footer;
}
--- 97,103 ----
sub report_section{
my $self = shift;
! my($anchor_label,$obj,$table_heading,$table_item_title) = @_;
$self->a_name($anchor_label);
! $self->draw_table($obj,$table_heading,$table_item_title);
$self->section_footer;
}
***************
*** 107,114 ****
sub draw_table{
my $self = shift;
! my($obj) = @_;
my $template = HTML::Template->new(scalarref => \$self->table_template);
! $template->param($self->report_data($obj));
push(@{$self->out},$template->output);
--- 107,114 ----
sub draw_table{
my $self = shift;
! my($obj,$table_heading,$table_item_title) = @_;
my $template = HTML::Template->new(scalarref => \$self->table_template);
! $template->param($self->report_data($obj,$table_heading,$table_item_title));
push(@{$self->out},$template->output);
***************
*** 117,125 ****
sub report_data{
my $self = shift;
! my($obj) = @_;
my $report_data = {};
! $report_data->{table_heading} = $obj->table_heading;
! $report_data->{table_item_title} = $obj->table_item_title;
my @obj_ids = $obj->obj_ids_max_hits;
--- 117,125 ----
sub report_data{
my $self = shift;
! my($obj,$table_heading,$table_item_title) = @_;
my $report_data = {};
! $report_data->{table_heading} = $table_heading;
! $report_data->{table_item_title} = $table_item_title;
my @obj_ids = $obj->obj_ids_max_hits;
***************
*** 136,140 ****
$obj_data->{unique_users} = $obj->total_users;
$obj_data->{percent_unique_users} = sprintf("%.3f",($tuu ? ($obj_data->{unique_users}/$tuu) * 100 : 0));
! $obj_data->{obj_name} = $obj->name;
push(@$object_rows,$obj_data);
}
--- 136,141 ----
$obj_data->{unique_users} = $obj->total_users;
$obj_data->{percent_unique_users} = sprintf("%.3f",($tuu ? ($obj_data->{unique_users}/$tuu) * 100 : 0));
! # we hyperlink the object if it is a url
! $obj_data->{obj_name} = _link_it($obj->name);
push(@$object_rows,$obj_data);
}
***************
*** 143,146 ****
--- 144,163 ----
}
+ sub _link_it{
+ my($str) = @_;
+ if(_is_uri($str)){
+ $str = qq|<a href="$str" target="urlwin">$str</a>|;
+ }
+ return($str);
+ }
+
+ sub _is_uri{
+ my($uri) = @_;
+ my($scheme, $authority, $path, $query, $fragment) =
+ $uri =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
+ return undef unless($scheme && $authority);
+ return(1);
+ }
+
sub table_template{
my $self = shift;
***************
*** 161,165 ****
<TMPL_LOOP NAME=OBJECT_ROWS>
<tr class="th5">
! <td class="th2" align="left"><a href="<TMPL_VAR name=OBJ_NAME>" target="urlwin"><TMPL_VAR name=OBJ_NAME></a></td>
<td><TMPL_VAR name=UNIQUE_USERS></td>
<td><TMPL_VAR name=PERCENT_UNIQUE_USERS></td>
--- 178,182 ----
<TMPL_LOOP NAME=OBJECT_ROWS>
<tr class="th5">
! <td class="th2" align="left"><TMPL_VAR name=OBJ_NAME></td>
<td><TMPL_VAR name=UNIQUE_USERS></td>
<td><TMPL_VAR name=PERCENT_UNIQUE_USERS></td>
***************
*** 174,177 ****
--- 191,277 ----
}
+ =weird_code
+ sub draw_url_table{
+ my $self = shift;
+ my($obj) = @_;
+
+ my $template = HTML::Template->new(scalarref => \$self->url_table_template);
+ $template->param($self->url_report_data($obj));
+
+ push(@{$self->out},$template->output);
+ }
+
+ sub url_report_data{
+ my $self = shift;
+ my $report_data = {};
+ for my $url ($obj->fetch_objs){
+
+ }
+ }
+
+ sub _url_report_data{
+ my $self = shift;
+ my($obj) = @_;
+ my $report_data = {};
+
+ $report_data->{table_heading} = $obj->table_heading;
+ $report_data->{table_item_title} = $obj->table_item_title;
+
+ my @obj_ids = $obj->obj_ids_max_hits;
+ my $tuu = $obj->report->users->total_unique_users;
+ my $total_hits = $obj->report->hits->total_hits;
+
+ my $object_rows = [];
+ for my $obj_id (@obj_ids){
+ my $obj_data = {};
+ my $obj = $obj->get_obj($obj_id);
+ next unless($obj);
+ $obj_data->{obj_hits} = $obj->total_hits;
+ $obj_data->{percent_hits} = sprintf("%.3f",$total_hits ? ($obj_data->{obj_hits}/$total_hits) * 100 : 0);
+ $obj_data->{unique_users} = $obj->total_users;
+ $obj_data->{percent_unique_users} = sprintf("%.3f",($tuu ? ($obj_data->{unique_users}/$tuu) * 100 : 0));
+ # we hyperlink the object if it is a url
+ $obj_data->{obj_name} = $obj->name;
+ push(@$object_rows,$obj_data);
+ }
+ $report_data->{OBJECT_ROWS} = $object_rows;
+ return($report_data);
+ }
+
+ sub url_table_template{
+ my $self = shift;
+
+ my $template = qq|
+ <TMPL_LOOP NAME=URL_TABLES>
+ <table class="blank2">
+ <tr>
+ <th colspan=5><TMPL_VAR name=TABLE_HEADING></th>
+ </tr>
+ <tr>
+ <td class="th2" width="20%" bgcolor="#7EACD3"><TMPL_VAR name=TABLE_ITEM_TITLE></td>
+ <td class="th2" width="15%" bgcolor="#FFB055">Unique Visitors</td>
+ <td class="th2" width="15%" bgcolor="#FFB055">% Unique Visitors</td>
+ <td class="th2" width="15%" bgcolor="#66F0FF">Page Views</td>
+ <td class="th2" width="15%" bgcolor="#66F0FF">% Page Views</td>
+ </tr>
+
+ <TMPL_LOOP NAME=OBJECT_ROWS>
+ <tr class="th5">
+ <td class="th2" align="left"><TMPL_VAR name=OBJ_NAME></td>
+ <td><TMPL_VAR name=UNIQUE_USERS></td>
+ <td><TMPL_VAR name=PERCENT_UNIQUE_USERS></td>
+ <td><TMPL_VAR name=OBJ_HITS></td>
+ <td><TMPL_VAR name=PERCENT_HITS></td>
+ </tr>
+ </TMPL_LOOP>
+ </table>
+ </TMPL_LOOP>
+ |;
+ return($template);
+
+ }
+
+ =cut
+
# general summary table for viewing html
sub general_summary_table{
***************
*** 192,198 ****
$gen_sum_data->{total_page_views} = $report->hits->total_hits;
$gen_sum_data->{total_visitors} = $report->users->total_unique_users;
! $gen_sum_data->{total_sessions} = 0 ;#$self->report->sessions->total_sessions;
! $gen_sum_data->{total_abandoned} = 0 ;#$self->report->sessions->total_abandoned;
! my $total_sessions_started = 0 ;#($total_sessions + $total_abandoned);
$gen_sum_data->{percent_sessions_abandoned}
--- 292,298 ----
$gen_sum_data->{total_page_views} = $report->hits->total_hits;
$gen_sum_data->{total_visitors} = $report->users->total_unique_users;
! $gen_sum_data->{total_sessions} = 0; #$self->report->sessions->total_sessions;
! $gen_sum_data->{total_abandoned} = 0; #$self->report->sessions->total_abandoned;
! my $total_sessions_started = 0; #($total_sessions + $total_abandoned);
$gen_sum_data->{percent_sessions_abandoned}
Index: Urls.pm
===================================================================
RCS file: /cvsroot/sitesampler/sitesampler/SiteSampler/Report/Urls.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Urls.pm 18 Jul 2005 01:36:38 -0000 1.5
--- Urls.pm 28 Aug 2005 18:46:59 -0000 1.6
***************
*** 3,6 ****
--- 3,7 ----
use Data::Dumper;
use File::Path;
+ use SiteSampler::Urls::Collection;
use SiteSampler::Report::Urls::Url;
use SiteSampler::Report::Base;
***************
*** 45,49 ****
=cut
-
sub url_key{'urls'}
--- 46,49 ----
***************
*** 51,64 ****
my $self = shift;
my($log_entry) = @_;
! my($client_url,$qstr) = split(/\?/,$log_entry->client_url);
! my $url_obj = $self->add_obj($client_url);
$url_obj->add_user($log_entry->user_id);
}
sub obj_count_hash_key{'urls'}
sub base_class_suffix{'Url'}
!
! sub table_heading{'Requested Pages'}
! sub table_item_title{'URL'}
1;
--- 51,99 ----
my $self = shift;
my($log_entry) = @_;
! my($url_path,$qstr) = split(/\?/,$url,2);
! my $collection = $self->add_collection($log_entry->client_url);
! my $url_obj = $collection->add_obj($qstr);
$url_obj->add_user($log_entry->user_id);
}
+ # will create a new collection
+ # if the collection does not already exist
+
+ sub add_collection{
+ my $self = shift;
+ my($url_path) = @_;
+ my($url_path,$qstr) = split(/\?/,$url,2);
+ unless($self->collection($url_path)){
+ $collection_class = ref($self).'::'.$self->collection_class_suffix
+ $self->{$url_path} = $collection_class->new($url_path);
+ }
+ return $self->collection($url_path);
+ }
+
+ sub collection{
+ my $self = shift;
+ my($url_path) = @_;
+ my $collection;
+ if($url_path && exists($self->{$url_path})){
+ $collection = $self->{$url_path};
+ }
+ return $collection;
+ }
+
+ sub get_obj{
+ my $self = shift;
+ my($obj_id) = @_;
+ my($url,$qstr) = split(/\?/,$obj_id,2);
+
+ return(
+ (my $collection = $self->collection($url))
+ ? $collection->get_obj($qstr);
+ : undef
+ );
+ }
+
sub obj_count_hash_key{'urls'}
sub base_class_suffix{'Url'}
! sub collection_class_suffix{'Collection'};
1;
|