From 9f01cbfe652ee22f3a97dfc3e94f493c6b78e7ab Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 20 Dec 2016 22:29:53 +0000 Subject: [PATCH] Bug 14608 - HEA : add possibility of sharing usage statistics [squashed] This patch set adds: - a reference to Hea at the end of the installation process - a link to the new page from the admin home page - a new page to easily configure shared statistics Signed-off-by: Mark Tompsett Signed-off-by: Chris Cormack Signed-off-by: Marcel de Rooy Signed-off-by: Brendan A Gallagher Signed-off-by: Katrin Fischer Signed-off-by: Mason James --- admin/usage_statistics.pl | 58 ++++++ .../prog/en/includes/country-list.inc | 196 ++++++++++++++++++ .../prog/en/modules/admin/admin-home.tt | 2 + .../prog/en/modules/admin/usage_statistics.tt | 178 ++++++++++++++++ .../prog/en/modules/installer/step3.tt | 4 + 5 files changed, 438 insertions(+) create mode 100755 admin/usage_statistics.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt diff --git a/admin/usage_statistics.pl b/admin/usage_statistics.pl new file mode 100755 index 0000000000..4573321758 --- /dev/null +++ b/admin/usage_statistics.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + +use Modern::Perl; + +use CGI qw ( -utf8 ); +use C4::Auth; +use C4::Output; +use Koha::DateUtils qw( dt_from_string output_pref ); + +my $query = new CGI; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "admin/usage_statistics.tt", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { parameters => '*' }, + debug => 1, + } +); + +my $op = $query->param('op') || q||; + +if ( $op eq 'update' ) { + my $UsageStats = $query->param('UsageStats'); + my $UsageStatsCountry = $query->param('UsageStatsCountry'); + my $UsageStatsLibraryName = $query->param('UsageStatsLibraryName'); + my $UsageStatsLibraryType = $query->param('UsageStatsLibraryType'); + my $UsageStatsLibraryUrl = $query->param('UsageStatsLibraryUrl'); + C4::Context->set_preference('UsageStats', $UsageStats); + C4::Context->set_preference('UsageStatsCountry', $UsageStatsCountry); + C4::Context->set_preference('UsageStatsLibraryName', $UsageStatsLibraryName); + C4::Context->set_preference('UsageStatsLibraryType', $UsageStatsLibraryType); + C4::Context->set_preference('UsageStatsLibraryUrl', $UsageStatsLibraryUrl); + +} + +if ( C4::Context->preference('UsageStatsLastUpdateTime') ) { + my $dt = DateTime->from_epoch( epoch => C4::Context->preference('UsageStatsLastUpdateTime')); + $template->param(UsageStatsLastUpdateTime => output_pref($dt) ); +} + +output_html_with_http_headers $query, $cookie, $template->output; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc new file mode 100644 index 0000000000..30d44e5f83 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/country-list.inc @@ -0,0 +1,196 @@ +[% SET countries = [ +"Afghanistan", +"Albania", +"Algeria", +"Andorra", +"Angola", +"Antigua & Deps", +"Argentina", +"Armenia", +"Australia", +"Austria", +"Azerbaijan", +"Bahamas", +"Bahrain", +"Bangladesh", +"Barbados", +"Belarus", +"Belgium", +"Belize", +"Benin", +"Bhutan", +"Bolivia", +"Bosnia Herz.", +"Botswana", +"Brazil", +"Brunei", +"Bulgaria", +"Burkina", +"Burundi", +"Cambodia", +"Cameroon", +"Canada", +"Cape Verde", +"Centr. Afr. Rep", +"Chad", +"Chile", +"China", +"Colombia", +"Comoros", +"Congo", +"Costa Rica", +"Croatia", +"Cuba", +"Cyprus", +"Czech Republic", +"Denmark", +"Djibouti", +"Dominica", +"Dominican Rep.", +"East Timor", +"Ecuador", +"Egypt", +"El Salvador", +"Equator. Guinea", +"Eritrea", +"Estonia", +"Ethiopia", +"Fiji", +"Finland", +"France", +"Gabon", +"Gambia", +"Georgia", +"Germany", +"Ghana", +"Greece", +"Grenada", +"Guatemala", +"Guinea", +"Guinea-Bissau", +"Guyana", +"Haiti", +"Honduras", +"Hungary", +"Iceland", +"India", +"Indonesia", +"Iran", +"Iraq", +"Ireland", +"Israel", +"Italy", +"Ivory Coast", +"Jamaica", +"Japan", +"Jordan", +"Kazakhstan", +"Kenya", +"Kiribati", +"Korea North", +"Korea South", +"Kosovo", +"Kuwait", +"Kyrgyzstan", +"Laos", +"Latvia", +"Lebanon", +"Lesotho", +"Liberia", +"Libya", +"Liechtenstein", +"Lithuania", +"Luxembourg", +"Macedonia", +"Madagascar", +"Malawi", +"Malaysia", +"Maldives", +"Mali", +"Malta", +"Marshall Isl.", +"Mauritania", +"Mauritius", +"Mexico", +"Micronesia", +"Moldova", +"Monaco", +"Mongolia", +"Montenegro", +"Morocco", +"Mozambique", +"Myanmar", +"Namibia", +"Nauru", +"Nepal", +"Netherlands", +"New Zealand", +"Nicaragua", +"Niger", +"Nigeria", +"Norway", +"Oman", +"Pakistan", +"Palau", +"Panama", +"Papua N. Guinea", +"Paraguay", +"Peru", +"Philippines", +"Poland", +"Portugal", +"Qatar", +"Romania", +"Russian Fed.", +"Rwanda", +"St Kitts & Nev.", +"St Lucia", +"Saint Vincent", +"Samoa", +"San Marino", +"Sao Tome", +"Saudi Arabia", +"Senegal", +"Serbia", +"Seychelles", +"Sierra Leone", +"Singapore", +"Slovakia", +"Slovenia", +"Solomon Islands", +"Somalia", +"South Africa", +"Spain", +"Sri Lanka", +"Sudan", +"Suriname", +"Swaziland", +"Sweden", +"Switzerland", +"Syria", +"Taiwan", +"Tajikistan", +"Tanzania", +"Thailand", +"Togo", +"Tonga", +"Trinidad & Tob.", +"Tunisia", +"Turkey", +"Turkmenistan", +"Tuvalu", +"Uganda", +"Ukraine", +"UAE", +"United Kingdom", +"USA", +"Uruguay", +"Uzbekistan", +"Vanuatu", +"Vatican City", +"Venezuela", +"Vietnam", +"Yemen", +"Zambia", +"Zimbabwe", +] %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt index bd951bc178..eead6163b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt @@ -120,6 +120,8 @@
SMS cellular providers
Define a list of cellular providers for sending SMS messages via email.
[% END %] +
Share your usage statistics
+
Share with the Koha community the usage statistics of your Koha installation.
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt new file mode 100644 index 0000000000..2850dfd60e --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt @@ -0,0 +1,178 @@ +[% USE Koha %] +[% USE KohaDates %] +[% USE Price %] +[% INCLUDE 'doc-head-open.inc' %] +Koha › Administration › Koha usage statistics +[% INCLUDE 'doc-head-close.inc' %] +[% INCLUDE 'calendar.inc' %] + + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
+
+
+
+ +[% FOR m IN messages %] +
+ [% SWITCH m.code %] + [% CASE 'error_on_update' %] + An error occurred when updating this patron category. Perhaps it already exists. + [% CASE 'error_on_insert' %] + An error occurred when inserting this patron category. The patron category might already exist. + [% CASE 'error_on_delete' %] + An error occurred when deleting this patron category. Check the logs. + [% CASE 'success_on_update' %] + Patron category updated successfully. + [% CASE 'success_on_insert' %] + Patron category inserted successfully. + [% CASE 'success_on_delete' %] + Patron category deleted successfully. + [% CASE 'already_exists' %] + This patron category already exists. + [% CASE %] + [% m.code %] + [% END %] +
+[% END %] + +[% IF NOT Koha.Preference('UsageStats') %] +
You are not sharing any data with the Koha community
+[% END %] + +
+

Modify the statistics you share with the Koha community

+
+
    +
  1. + + +
  2. +
  3. + + [% SET UsageStatsCountry = Koha.Preference('UsageStatsCountry') %] + [% SET IsUsageStatsCountryValid = 0 %] + [% IF NOT UsageStatsCountry %] + [% SET IsUsageStatsCountryValid = 1 %] + [% END %] + [% PROCESS 'country-list.inc' %] + + [% UNLESS IsUsageStatsCountryValid %] + Note: The value of your system preference 'UsageStatsCountry' is not valid ([% UsageStatsCountry %]). + Please select a valid one. + [% END %] +
  4. +
  5. + + +
  6. +
  7. + + [% SET UsageStatsLibraryType = Koha.Preference('UsageStatsLibraryType') %] + +
  8. +
  9. + + +
  10. +
  11. + Last update: + [% IF UsageStatsLastUpdateTime %] + [% UsageStatsLastUpdateTime %] + [% ELSE %] + Your data have never been shared + [% END %] +
  12. +
+
+ +
+ + + Cancel +
+
+ +
+
+
+[% INCLUDE 'admin-menu.inc' %] +
+
+[% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt index b74c88806e..8c380663a4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt @@ -173,6 +173,10 @@ [% END %]

All done!

Installation complete.
+

+ You can help the Koha community by sharing your statistics with us. +
If you wish to share some of your data, please enable the functionality in the "Share your usage statistics" section of the admin module. +

Click on 'Finish' to complete and load the Koha Staff Interface.

-- 2.39.5