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

(-)a/admin/admin-home.pl (+28 lines)
Lines 34-37 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
34
    }
34
    }
35
);
35
);
36
36
37
#
38
# Usage stats sharing
39
#
40
my $usageStats = C4::Context->preference("UsageStats");
41
if( $usageStats ){
42
  $template->param(usageStats => 1);
43
}
44
else{
45
  $template->param(usageStats => 0);
46
}
47
48
my $DAYS = 7; #Number of days before remind to send usage stats
49
my $today = DateTime->now->epoch;
50
my $lastDisplay;
51
if ( (C4::Context->preference("UsageStatsLastDisplay")) eq "" ){
52
	$lastDisplay = 1;
53
}
54
else{
55
	$lastDisplay = C4::Context->preference("UsageStatsLastDisplay") / 1000; #milliseconds to seconds
56
}
57
58
if( ($lastDisplay != 0) && ( $today > ($lastDisplay+ ( 60 * 60 * 24 * $DAYS)) ) ){
59
  $template->param(lastDisplay => $today);
60
}
61
else{
62
  $template->param(lastDisplay => 0);
63
}
64
37
output_html_with_http_headers $query, $cookie, $template->output;
65
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/atomicupdate/14608.sql (+2 lines)
Line 0 Link Here
1
INSERT INTO systempreferences (variable, value, options, explanation, type )
2
VALUES ('UsageStatsLastDisplay', '', NULL, 'The last time we offered you to share your statistics', 'Free');
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 525-530 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
525
('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
525
('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
526
('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'),
526
('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'),
527
('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'),
527
('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'),
528
('UsageStatsLastDisplay', '', NULL, 'The last time we offered you to share your statistics', 'Free'),
528
('UseAuthoritiesForTracings','1','0','Use authority record numbers for subject tracings instead of heading strings.','YesNo'),
529
('UseAuthoritiesForTracings','1','0','Use authority record numbers for subject tracings instead of heading strings.','YesNo'),
529
('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'),
530
('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'),
530
('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'),
531
('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'),
(-)a/installer/install.pl (+16 lines)
Lines 193-198 elsif ( $step && $step == 3 ) { Link Here
193
    elsif ( $op && $op eq 'finish' ) {
193
    elsif ( $op && $op eq 'finish' ) {
194
        $installer->set_version_syspref();
194
        $installer->set_version_syspref();
195
195
196
        #
197
        # Share usage stats with Hea
198
        #
199
        if($query->param('hea') eq "1"){
200
            C4::Context->set_preference('UsageStats', 1);
201
            C4::Context->set_preference('UsageStatsLastDisplay', 0);
202
        }
203
        elsif($query->param('hea') eq "-1"){
204
            C4::Context->set_preference('UsageStats', 0);
205
            C4::Context->set_preference('UsageStatsLastDisplay', ((DateTime->now->epoch) * 1000));
206
        }
207
        elsif($query->param('hea') eq "0"){
208
            C4::Context->set_preference('UsageStats', 0);
209
            C4::Context->set_preference('UsageStatsLastDisplay', 0);
210
        }
211
196
        # Installation is finished.
212
        # Installation is finished.
197
        # We just deny anybody access to install
213
        # We just deny anybody access to install
198
        # And we redirect people to mainpage.
214
        # And we redirect people to mainpage.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt (+64 lines)
Lines 2-7 Link Here
2
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Administration</title>
3
<title>Koha &rsaquo; Administration</title>
4
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'doc-head-close.inc' %]
5
<script type="text/javascript">
6
7
    function hide_message(){
8
        $('.dialog:visible').hide('slow');
9
    }
10
11
    function message_success(){
12
        var button = $('<button>')
13
            .attr('type', 'button')
14
            .addClass('approve')
15
            .html('Ok')
16
            .click(hide_message);
17
18
        $('#activate_UsageStats').html(
19
            'Usage statistics will be send.'
20
             +'<br>If you want to see the statistics generated, go to <a href="http://hea.koha-community.org">hea.koha-community.org</a>'
21
             +'<br>'
22
        ).append(button);
23
24
    }
25
26
    function set_syspref_ajax(syspref, sysvalue){
27
        return $.ajax({
28
            url: '/cgi-bin/koha/svc/config/systempreferences/'+syspref,
29
            data: { value: sysvalue },
30
            type: 'POST',
31
        });
32
    }
33
34
    (function($) {
35
        $(document).ready(function(){
36
37
            $('#activate_UsageStats button').click(function(){
38
                var jqXHR;
39
                if ($(this).hasClass('approve')) {
40
                    jqXHR = set_syspref_ajax('UsageStats', 1);
41
                    jqXHR = set_syspref_ajax('UsageStatsLastDisplay', 0);
42
                    jqXHR.done(message_success);
43
                } else if ($(this).hasClass('later')) {
44
                    jqXHR = set_syspref_ajax('UsageStats', 0);
45
                    jqXHR = set_syspref_ajax('UsageStatsLastDisplay', Date.now());
46
                    jqXHR.done(hide_message);
47
                } else if ($(this).hasClass('deny')) {
48
                    jqXHR = set_syspref_ajax('UsageStats', 0);
49
                    jqXHR = set_syspref_ajax('UsageStatsLastDisplay', 0);
50
                    jqXHR.done(hide_message);
51
                }
52
            });
53
        });
54
    })(jQuery);
55
56
</script>
5
</head>
57
</head>
6
<body id="admin_admin-home" class="admin">
58
<body id="admin_admin-home" class="admin">
7
[% INCLUDE 'header.inc' %]
59
[% INCLUDE 'header.inc' %]
Lines 9-14 Link Here
9
61
10
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Administration</div>
62
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; Administration</div>
11
63
64
[% IF !usageStats && lastDisplay %]
65
    <div id="activate_UsageStats" class="dialog message">
66
        <h3>You are not sharing statistics with the community yet:</h3>
67
        <p>Please share them to help us improve your user experience.</p>
68
        <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>
69
        <h4><strong>Send stats monthly ?</strong></h4>
70
        <button type="button" class="approve"><i class="fa fa-check"></i> Yes, I want to share my statistics</button>
71
        <button type="button" class="later"><i class="fa fa-clock-o"></i> Later</button>
72
        <button type="button" class="deny"><i class="fa fa-ban"></i> No, I don't want to share my statistics</button>
73
    </div>
74
[% END %]
75
12
<div id="doc" class="yui-t7">
76
<div id="doc" class="yui-t7">
13
    <div id="bd">
77
    <div id="bd">
14
        <div id="yui-main" class="sysprefs">
78
        <div id="yui-main" class="sysprefs">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt (-8 / +26 lines)
Lines 171-185 Link Here
171
    [% END %]
171
    [% END %]
172
    </ul>
172
    </ul>
173
    [% END %]
173
    [% END %]
174
    <h3>All done!</h3>
174
175
    <p>Installation complete.<br />
175
    <form name="finish">
176
        <p>Click on 'Finish' to complete and load the Koha Staff Interface.
176
177
        <form name="finish">
177
        <div id="activate_UsageStats" class="dialog message">
178
        <input type="hidden" name="step" value="3" />
178
            <h3>Activate Hea ?</h3>
179
        <input type="hidden" name="op" value="finish" />
179
            <p>Please help us improve your user experience by sharing your statistics with community.
180
        <input type="submit" value="Finish" /></form>
180
                <br>We share sharing data anonymously, please see which data are sent <a href=http://wiki.koha-community.org/wiki/KohaUsageStat_RFC>here</a>.
181
            </p>
182
            <input type="radio" name="hea" value="1" checked /> Yes, I want to share my statistics <br/>
183
            <input type="radio" name="hea" value="-1" /> Later <br/>
184
            <input type="radio" name="hea" value="0" /> No, I don't want to share my statistics <br/>
185
186
            <p>If you want to see the statistics generated, go to <a href=http://hea.koha-community.org/>hea.koha-community.org</a></p>
187
        </div>
188
189
        <h3>All done!</h3>
190
        <p>Installation complete.<br />
191
            <p>Click on 'Finish' to complete and load the Koha Staff Interface.
192
193
            <input type="hidden" name="step" value="3" />
194
            <input type="hidden" name="op" value="finish" />
195
            <input type="submit" value="Finish" />
196
            </p>
181
        </p>
197
        </p>
182
    </p>
198
    </form>
199
200
183
[% END %]
201
[% END %]
184
202
185
203

Return to bug 14608