2005-08-18 01:23:48 +04:00
|
|
|
#!/usr/bin/perl -w
|
2005-10-11 22:44:16 +04:00
|
|
|
# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*-
|
|
|
|
|
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1
|
2005-08-18 01:23:48 +04:00
|
|
|
#
|
2005-10-11 22:44:16 +04:00
|
|
|
# The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
# 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
2005-08-18 01:23:48 +04:00
|
|
|
#
|
2005-10-11 22:44:16 +04:00
|
|
|
# Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
# for the specific language governing rights and limitations under the
|
|
|
|
# License.
|
2005-08-18 01:23:48 +04:00
|
|
|
#
|
|
|
|
# The Original Code is Litmus.
|
|
|
|
#
|
2005-10-11 22:44:16 +04:00
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# the Mozilla Corporation.
|
2006-01-25 20:03:40 +03:00
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2006
|
2005-10-11 22:44:16 +04:00
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
|
|
|
# Chris Cooper <ccooper@deadsquid.com>
|
|
|
|
# Zach Lipton <zach@zachlipton.com>
|
2005-08-18 01:23:48 +04:00
|
|
|
#
|
2005-10-11 22:44:16 +04:00
|
|
|
# ***** END LICENSE BLOCK *****
|
2005-08-18 01:23:48 +04:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use Litmus;
|
2005-10-11 22:44:16 +04:00
|
|
|
use Litmus::Auth;
|
2005-08-18 01:23:48 +04:00
|
|
|
use Litmus::Error;
|
|
|
|
use Litmus::DB::Product;
|
|
|
|
|
|
|
|
use CGI;
|
|
|
|
use Time::Piece::MySQL;
|
|
|
|
|
2006-08-02 00:50:15 +04:00
|
|
|
Litmus->init();
|
2006-01-08 06:56:10 +03:00
|
|
|
my $c = Litmus->cgi();
|
2005-08-18 01:23:48 +04:00
|
|
|
|
|
|
|
print $c->header();
|
|
|
|
|
2005-08-18 01:36:19 +04:00
|
|
|
# find the number of testcases in the database
|
2006-06-05 08:07:29 +04:00
|
|
|
my $numtests = Litmus::DB::Testcase->count_all();
|
|
|
|
|
|
|
|
# find the number of subgroups in the database
|
|
|
|
my $numsubgroups = Litmus::DB::Subgroup->count_all();
|
|
|
|
|
|
|
|
# find the number of testgroups in the database
|
|
|
|
my $numtestgroups = Litmus::DB::Testgroup->count_all();
|
2005-08-18 01:36:19 +04:00
|
|
|
|
|
|
|
# find the number of users in the database
|
2005-08-18 03:35:30 +04:00
|
|
|
my $numusers = Litmus::DB::User->count_all();
|
2005-08-18 01:36:19 +04:00
|
|
|
|
2005-08-23 09:25:03 +04:00
|
|
|
# find the number of results in the database:
|
|
|
|
my $numresults = Litmus::DB::Testresult->count_all();
|
|
|
|
|
2005-08-18 01:23:48 +04:00
|
|
|
# get a list of the top 15 testers of all time, sorted by the number
|
|
|
|
# of test results submitted:
|
2006-06-05 08:07:29 +04:00
|
|
|
my @toptesters = Litmus::DB::User->search_TopTesters();
|
2005-08-18 01:23:48 +04:00
|
|
|
|
|
|
|
my $vars = {
|
2005-10-11 22:44:16 +04:00
|
|
|
title => "Statistics",
|
2005-08-18 01:36:19 +04:00
|
|
|
numtests => $numtests,
|
2006-06-05 08:07:29 +04:00
|
|
|
numsubgroups => $numsubgroups,
|
|
|
|
numtestgroups => $numtestgroups,
|
2005-08-18 01:36:19 +04:00
|
|
|
numusers => $numusers,
|
2005-08-23 09:25:03 +04:00
|
|
|
numresults => $numresults,
|
2005-08-18 01:36:19 +04:00
|
|
|
toptesters => \@toptesters,
|
2005-08-18 01:23:48 +04:00
|
|
|
};
|
|
|
|
|
2005-10-11 22:44:16 +04:00
|
|
|
my $cookie = Litmus::Auth::getCookie();
|
|
|
|
$vars->{"defaultemail"} = $cookie;
|
|
|
|
$vars->{"show_admin"} = Litmus::Auth::istrusted($cookie);
|
|
|
|
|
2005-08-18 01:23:48 +04:00
|
|
|
Litmus->template()->process("stats/stats.html.tmpl", $vars) ||
|
|
|
|
internalError(Litmus->template()->error());
|
|
|
|
|