Bugzilla – Attachment 59949 Details for
Bug 14608
HEA : add possibility of sharing usage statistics in Administration page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14608: Add a page to configure shared statistics
Bug-14608-Add-a-page-to-configure-shared-statistic.patch (text/plain), 14.35 KB, created by
Chris Cormack
on 2017-02-06 21:22:50 UTC
(
hide
)
Description:
Bug 14608: Add a page to configure shared statistics
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2017-02-06 21:22:50 UTC
Size:
14.35 KB
patch
obsolete
>From 159f8724f6cb113fb8558be2bec887d5fd2648cd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Dec 2016 22:29:53 +0000 >Subject: [PATCH] Bug 14608: Add a page to configure shared statistics > >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 <mtompset@hotmail.com> >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > admin/usage_statistics.pl | 58 ++++ > .../prog/en/modules/admin/usage_statistics.tt | 372 +++++++++++++++++++++ > 2 files changed, 430 insertions(+) > create mode 100755 admin/usage_statistics.pl > 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 <http://www.gnu.org/licenses>. >+ >+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/modules/admin/usage_statistics.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt >new file mode 100644 >index 0000000000..4b943eabf8 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/usage_statistics.tt >@@ -0,0 +1,372 @@ >+[% USE Koha %] >+[% USE KohaDates %] >+[% USE Price %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Administration › Koha usage statistics</title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+</head> >+ >+<body id="admin_usage_statistics" class="admin"> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'patrons-admin-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Usage statistics</div> >+ >+<div id="doc3" class="yui-t2"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ >+[% FOR m IN messages %] >+ <div class="dialog [% m.type %]"> >+ [% 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 %] >+ </div> >+[% END %] >+ >+[% IF NOT Koha.Preference('UsageStats') %] >+ <div class="dialog message">You are not sharing any data with the Koha community</div> >+[% END %] >+ >+ <form id="category_form" action="/cgi-bin/koha/admin/usage_statistics.pl" method="post"> >+ <h1>Modify the statistics you share with the Koha community</h1> >+ <fieldset class="rows"> >+ <ol> >+ <li> >+ <span class="label">Share my Koha usage statistics: </span> >+ <select name="UsageStats"> >+ [% IF Koha.Preference('UsageStats') %] >+ <option value="1" selected="selected">Yes</option> >+ <option value="0">No</option> >+ [% ELSE %] >+ <option value="1">Yes</option> >+ <option value="0" selected="selected">No</option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <span class="label">Your country: </span> >+ [% SET UsageStatsCountry = Koha.Preference('UsageStatsCountry') %] >+ [% SET IsUsageStatsCountryValid = 0 %] >+ [% IF NOT UsageStatsCountry %] >+ [% SET IsUsageStatsCountryValid = 1 %] >+ [% END %] >+ <select name="UsageStatsCountry"> >+ <option value=""></option> >+ [% FOR country IN [ >+"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", >+] %] >+ [% IF country == UsageStatsCountry %] >+ <option value="[% country %]" selected="selected">[% country %]</option> >+ [% SET IsUsageStatsCountryValid = 1 %] >+ [% ELSE %] >+ <option value="[% country %]">[% country %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ [% UNLESS IsUsageStatsCountryValid %] >+ Note: The value of your system preference 'UsageStatsCountry' is not valid ([% UsageStatsCountry %]). >+ Please select a valid one. >+ [% END %] >+ </li> >+ <li> >+ <span class="label">Library name: </span> >+ <input type="text" value="[% Koha.Preference('UsageStatsLibraryName') %]" name="UsageStatsLibraryName" /> >+ </li> >+ <li> >+ <span class="label">Library type: </span> >+ [% SET UsageStatsLibraryType = Koha.Preference('UsageStatsLibraryType') %] >+ <select name="UsageStatsLibraryType"> >+ <option value=""></option> >+ [% IF UsageStatsLibraryType == 'public' %] >+ <option value="public" selected="selected">Public</option> >+ [% ELSE %] >+ <option value="public">Public</option> >+ [% END %] >+ >+ [% IF UsageStatsLibraryType == 'school' %] >+ <option value="school" selected="selected">School</option> >+ [% ELSE %] >+ <option value="school">School</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'academic' %] >+ <option value="academic" selected="selected">Academic</option> >+ [% ELSE %] >+ <option value="academic">Academic</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'research' %] >+ <option value="research" selected="selected">Research</option> >+ [% ELSE %] >+ <option value="research">Research</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'private' %] >+ <option value="private" selected="selected">Private</option> >+ [% ELSE %] >+ <option value="private">Private</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'societyAssociation' %] >+ <option value="societyAssociation" selected="selected">Society or association</option> >+ [% ELSE %] >+ <option value="societyAssociation">Society or association</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'corporate' %] >+ <option value="corporate" selected="selected">Corporate</option> >+ [% ELSE %] >+ <option value="corporate">Corporate</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'government' %] >+ <option value="government" selected="selected">Government</option> >+ [% ELSE %] >+ <option value="government">Government</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'religiousOrg' %] >+ <option value="religiousOrg" selected="selected">Religious organization</option> >+ [% ELSE %] >+ <option value="religiousOrg">Religious organization</option> >+ [% END %] >+ [% IF UsageStatsLibraryType == 'subscription' %] >+ <option value="subscription" selected="selected">Subscription</option> >+ [% ELSE %] >+ <option value="subscription">Subscription</option> >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <span class="label">Library URL: </span> >+ <input type="text" name="UsageStatsLibraryUrl" value="[% Koha.Preference('UsageStatsLibraryUrl') %]" /> >+ </li> >+ <li> >+ <span class="label">Last update: </span> >+ [% IF UsageStatsLastUpdateTime %] >+ [% UsageStatsLastUpdateTime %] >+ [% ELSE %] >+ Your data have never been shared >+ [% END %] >+ </li> >+ </ol> >+ </fieldset> >+ >+ <fieldset class="action"> >+ <input type="hidden" name="op" value="update" /> >+ <input type="submit" value="Update your statistics usage" /> >+ <a class="cancel" href="/cgi-bin/koha/admin/usage_statistics.pl">Cancel</a> >+ </fieldset> >+ </form> >+ >+</div> >+</div> >+<div class="yui-b"> >+[% INCLUDE 'admin-menu.inc' %] >+</div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14608
:
41212
|
41213
|
41712
|
41713
|
55773
|
58340
|
58341
|
58342
|
58968
|
58969
|
58970
|
58971
|
59949
|
59950
|
59951
|
59952
|
61031
|
61201
|
61202
|
61203
|
61204
|
61205