__section__
default
__description__

__title__

__page__
stats
__lang__
en_US
__name__
report
__template__
[%
   # handy sprintf-style formats
   USE format;
   mbytes = format("%0.1f MB");
   ints = format("%8d");
   ints2 = format("%5d");
   ints3 = format("%6d");
   pcts = format("%8d");
   pctsf = format("%.1f");
   flts = format("%.1f");
   flts2 = format("%5.2f");
   dlrs = format("%7.2f");

   MACRO mbyte(bytes) BLOCK;
      bytes = bytes / (1024*1024);
      mbytes(bytes);
   END;

%]

[% reports = {
      'main'      => 'Main Report',
      'mod'       => 'Moderation Report',
      'subscribe' => 'Subscription Report',
      'messages'  => 'Messages Report',
      'rss'	  => 'RSS Report',
}

relocate_plugin = Slash.getObject('Slash::Relocate');
IF relocate_plugin;
	reports.relocate="Relocated Page Report";
END; 

%]

[% SWITCH form.report;

   CASE 'main';
      reportblock = BLOCK;
      skid     = form.stats_skid || '0';

      stats = Slash.getObject('Slash::Stats');
      stats_data_big = stats.getAllStats({ skid => skid, days => 1}).${skid};
      stats_data_key = stats_data_big.keys.sort.0;
      stats_data = stats_data_big.${stats_data_key};

%]

[%
      PROCESS graphs gtitle => 'Pages';
      PROCESS graphs gtitle => 'Hits';
      PROCESS graphs gtitle => 'Total Users';
      PROCESS graphs gtitle => 'Comment Scores';
      PROCESS graphs gtitle => 'Total Bytes';
      PROCESS graphs gtitle => 'Section Pages';
      END;


   CASE 'messages';
      reportblock = BLOCK;
      PROCESS graphs gtitle => 'Message Types';
      END;

   CASE 'mod';
      reportblock = BLOCK;
      skid     = form.stats_skid || '0';

      stats = Slash.getObject('Slash::Stats');
      stats_data_big = stats.getAllStats({ skid => skid, days => 1}).${skid};
      stats_data_key = stats_data_big.keys.sort.0;
      stats_data = stats_data_big.${stats_data_key};
%]

[%
      PROCESS graphs gtitle => 'Comment Scores';
      PROCESS graphs gtitle => 'Total Comments';
      PROCESS graphs gtitle => 'Total Comments By Source';
      PROCESS graphs gtitle => 'Comment IPIDs';
      PROCESS graphs gtitle => 'Total Moderations';
      PROCESS graphs gtitle => 'Total Metamoderations';
      END;

   CASE 'subscribe';
      reportblock = BLOCK;
      type        = 'area';
      skid     = '0';
      form.stats_days = form.stats_days || 1;

      stats = Slash.getObject('Slash::Stats');
      stats_data_big = stats.getAllStats({ skid => skid, days => 1}).${skid};
      stats_data_key = stats_data_big.keys.sort.0;
      stats_data = stats_data_big.${stats_data_key};
%]

[%
      PROCESS graphs gtitle => 'New Subscriptions';
      PROCESS graphs gtitle => 'Total Subscribers';
      PROCESS graphs gtitle => 'Total Renewing Subscribers';
      PROCESS graphs gtitle => 'Subscriber Pages';
      END;
   
   CASE 'relocate';
      reportblock = BLOCK;
      type        = 'area';
      skid     = '0';
      days        = form.stats_days || 7;

      stats       = Slash.getObject('Slash::Stats');
      stats_data_big = stats.getAllStats({ skid => skid, days => days, name_pre => "relocate_" }).${skid};
      stats_data_key = stats_data_big.keys.sort.0;
      stats_data     = stats_data_big.${stats_data_key};
%]

[%
      "Relocated links<br>";
      FOREACH key = stats_data_big.names.sort;
         "$key<br>";
         PROCESS make_graph
            skid  => '0',
            type     => 'area',
            statdata => [ key ];
         "<p>";
       END;

      END;
   CASE 'rss';
      reportblock = BLOCK;
      type        = 'line';
      skid     = '0';
      form.stats_days = form.stats_days || 1;

      stats = Slash.getObject('Slash::Stats');
      stats_data_big = stats.getAllStats({ skid => skid, days => 1}).${skid};
      stats_data_key = stats_data_big.keys.sort.0;
      stats_data = stats_data_big.${stats_data_key};
%]

[%
      PROCESS graphs gtitle => 'RSS Pages';
      PROCESS graphs gtitle => 'Pages From RSS';
      PROCESS graphs gtitle => 'RSS UIDS';
      PROCESS graphs gtitle => 'From RSS UIDS';
      PROCESS graphs gtitle => 'RSS IPIDS';
      PROCESS graphs gtitle => 'From RSS IPIDS';
   END;

END %]

[% PROCESS titlebar title => ((reports.${form.report} || 'Available Reports') _ ' for ' _ constants.sitename), width => '100%' %]

<form method="post" action="[% env.script_name %]">
   <fieldset>
   <legend>Reports</legend>
   [% PROCESS formLabel value => "Reports" %]
   [% Slash.createSelect('report', reports, form.report, 1) %]
   &nbsp;&nbsp;Range: [% PROCESS stats_days %]
   &nbsp;&nbsp;Sections: [% Slash.createSelect('stats_skid', skins, form.stats_skid, 1) %]

   <input type="hidden" name="op" value="report">
   <input type="submit">
   </fieldset>
</form>

[% reportblock %]
__seclev__
1000
__version__
$Id: report;stats;default,v 1.36 2005/10/04 19:52:42 tvroom Exp $
