View | Details | Raw Unified | Return to bug 14608
Collapse All | Expand All

(-)a/admin/admin-home.pl (-2 / +28 lines)
Lines 22-29 use CGI qw ( -utf8 ); Link Here
22
use C4::Auth;
22
use C4::Auth;
23
use C4::Output;
23
use C4::Output;
24
24
25
26
27
my $query = new CGI;
25
my $query = new CGI;
28
my ($template, $loggedinuser, $cookie)
26
my ($template, $loggedinuser, $cookie)
29
    = get_template_and_user({template_name => "admin/admin-home.tt",
27
    = get_template_and_user({template_name => "admin/admin-home.tt",
Lines 34-37 my ($template, $loggedinuser, $cookie) Link Here
34
			     debug => 1,
32
			     debug => 1,
35
			     });
33
			     });
36
34
35
#
36
# Usage stats sharing
37
#
38
my $usageStats = C4::Context->preference("UsageStats");
39
if( $usageStats ){
40
  $template->param(usageStats => 1);
41
}
42
else{
43
  $template->param(usageStats => 0);
44
}
45
46
my $DAYS = 7; #Number of days before remind to send usage stats
47
my $today = DateTime->now->epoch;
48
my $lastDisplay;
49
if ( (C4::Context->preference("UsageStatsLastDisplay")) eq "" ){
50
	$lastDisplay = 1;
51
}
52
else{
53
	$lastDisplay = C4::Context->preference("UsageStatsLastDisplay") / 1000; #milliseconds to seconds
54
}
55
56
if( ($lastDisplay != 0) && ( $today > ($lastDisplay+ ( 60 * 60 * 24 * $DAYS)) ) ){
57
  $template->param(lastDisplay => $today);
58
}
59
else{
60
  $template->param(lastDisplay => 0);
61
}
62
37
output_html_with_http_headers $query, $cookie, $template->output;
63
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 458-463 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
458
('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
458
('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
459
('UsageStatsLibraryType', 'public', 'public|school|academic|research|private|societyAssociation|corporate|government|religiousOrg|subscription', 'The library type to be shown on the Hea Koha community website', 'Choice'),
459
('UsageStatsLibraryType', 'public', 'public|school|academic|research|private|societyAssociation|corporate|government|religiousOrg|subscription', 'The library type to be shown on the Hea Koha community website', 'Choice'),
460
('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'),
460
('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'),
461
('UsageStatsLastDisplay', '', NULL, 'The last time we propose you to share your statistics', 'Free'),
461
('UseAuthoritiesForTracings','1','0','Use authority record numbers for subject tracings instead of heading strings.','YesNo'),
462
('UseAuthoritiesForTracings','1','0','Use authority record numbers for subject tracings instead of heading strings.','YesNo'),
462
('UseBranchTransferLimits','0','','If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.','YesNo'),
463
('UseBranchTransferLimits','0','','If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.','YesNo'),
463
('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'),
464
('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (-2 / +7 lines)
Lines 1098-1104 div.first fieldset { Link Here
1098
	background : #FFF none;
1098
	background : #FFF none;
1099
 }
1099
 }
1100
 
1100
 
1101
.dialog input.approve, td input.approve {
1101
.dialog input.approve, td input.approve, button.approve {
1102
 	background : #FFF url(../../img/approve.gif) no-repeat 4px center;
1102
 	background : #FFF url(../../img/approve.gif) no-repeat 4px center;
1103
	padding : .4em .4em .4em 25px;	
1103
	padding : .4em .4em .4em 25px;	
1104
 }
1104
 }
Lines 1107-1117 td input.approve { Link Here
1107
	background-color : #FFC;
1107
	background-color : #FFC;
1108
}
1108
}
1109
1109
1110
.dialog input.deny {
1110
.dialog input.deny, button.deny {
1111
 	background : #FFF url(../../img/deny.gif) no-repeat 4px center;
1111
 	background : #FFF url(../../img/deny.gif) no-repeat 4px center;
1112
	padding : .4em .4em .4em 25px;
1112
	padding : .4em .4em .4em 25px;
1113
 }
1113
 }
1114
1114
1115
.dialog input.later, button.later {
1116
	background : #FFF url(../../img/later.png) no-repeat 4px center;
1117
	padding : .4em .4em .4em 25px;
1118
 }
1119
1115
.dialog input.save {
1120
.dialog input.save {
1116
	background: #fff url(../../img/toolbar-save.gif) no-repeat 4px center;
1121
	background: #fff url(../../img/toolbar-save.gif) no-repeat 4px center;
1117
	color:black;
1122
	color:black;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+64 lines)
Lines 1-6 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Administration</title>
2
<title>Koha &rsaquo; Administration</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript">
5
6
    function hide_message(){
7
        $('.dialog:visible').hide('slow');
8
    }
9
10
    function message_success(){
11
        var button = $('<button>')
12
            .attr('type', 'button')
13
            .addClass('approve')
14
            .html('Ok')
15
            .click(hide_message);
16
17
        $('#activate_UsageStats').html(
18
            'Usage statistics will be send.'
19
             +'<br>If you want to see the statistics generated, go to <a href="http://hea.koha-community.org">hea.koha-community.org</a>'
20
             +'<br>'
21
        ).append(button);
22
23
    }
24
25
    function set_syspref_ajax(syspref, sysvalue){
26
        return $.ajax({
27
            url: '/cgi-bin/koha/svc/config/systempreferences/'+syspref,
28
            data: { value: sysvalue },
29
            type: 'POST',
30
        });
31
    }
32
33
    (function($) {
34
        $(document).ready(function(){
35
36
            $('#activate_UsageStats button').click(function(){
37
                var jqXHR;
38
                if ($(this).hasClass('approve')) {
39
                    jqXHR = set_syspref_ajax('UsageStats', 1);
40
                    jqXHR = set_syspref_ajax('UsageStatsLastDisplay', 0);
41
                    jqXHR.done(message_success);
42
                } else if ($(this).hasClass('later')) {
43
                    jqXHR = set_syspref_ajax('UsageStats', 0);
44
                    jqXHR = set_syspref_ajax('UsageStatsLastDisplay', Date.now());
45
                    jqXHR.done(hide_message);
46
                } else if ($(this).hasClass('deny')) {
47
                    jqXHR = set_syspref_ajax('UsageStats', 0);
48
                    jqXHR = set_syspref_ajax('UsageStatsLastDisplay', 0);
49
                    jqXHR.done(hide_message);
50
                }
51
            });
52
        });
53
    })(jQuery);
54
55
</script>
4
</head>
56
</head>
5
<body id="admin_admin-home" class="admin">
57
<body id="admin_admin-home" class="admin">
6
[% INCLUDE 'header.inc' %]
58
[% INCLUDE 'header.inc' %]
Lines 8-13 Link Here
8
60
9
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Administration</div>
61
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Administration</div>
10
62
63
[% IF !usageStats && lastDisplay %]
64
    <div id="activate_UsageStats" class="dialog message">
65
        <h3>You are not sharing statistics with the community yet:</h3>
66
        <p>Please share them to help us improve your user experience.</p>
67
        <p>We are sharing data anonymously, please see which data are sent <a href="http://wiki.koha-community.org/wiki/KohaUsageStat_RFC">here</a>.</p>
68
        <h4><strong>Send stats monthly ?</strong></h4>
69
        <button type="button" class="approve">Yes, I want to share my statistics</button>
70
        <button type="button" class="later">Later</button>
71
        <button type="button" class="deny">No, I don't want to share my statistics</button>
72
    </div>
73
[% END %]
74
11
<div id="doc" class="yui-t7">
75
<div id="doc" class="yui-t7">
12
   
76
   
13
   <div id="bd">
77
   <div id="bd">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref (+5 lines)
Lines 164-166 Administration: Link Here
164
                  subscription: "subscription"
164
                  subscription: "subscription"
165
            - will be shown on the <a href="http://hea.koha-community.org">Hea Koha community website</a>.
165
            - will be shown on the <a href="http://hea.koha-community.org">Hea Koha community website</a>.
166
            - Note that this value has no effect if the UsageStats system preference is set to "Don't share"
166
            - Note that this value has no effect if the UsageStats system preference is set to "Don't share"
167
168
        -
169
            - We offered you on
170
            - pref: UsageStatsLastDisplay
171
            - to share your statistics with the community on the <a href="http://hea.koha-community.org">Hea Koha community website</a>.

Return to bug 14608