Bugzilla – Attachment 55773 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 message on the Administration page to share statistics
Bug-14608--Add-a-message-on-the-Administration-pag.patch (text/plain), 12.47 KB, created by
Julian Maurice
on 2016-09-23 13:47:15 UTC
(
hide
)
Description:
Bug 14608 : Add a message on the Administration page to share statistics
Filename:
MIME Type:
Creator:
Julian Maurice
Created:
2016-09-23 13:47:15 UTC
Size:
12.47 KB
patch
obsolete
>From b28f1451b7ac74412c9af25183ed8c3a4a02ef0a Mon Sep 17 00:00:00 2001 >From: Julian FIOL <julian.fiol@biblibre.com> >Date: Tue, 21 Jul 2015 09:37:50 +0200 >Subject: [PATCH] Bug 14608 : Add a message on the Administration page to share > statistics > >This patch add a message on the Administration page to share your usage >statistics to hea.koha-community.org > >If you click on : > > 'Yes' : It set the 'UsageStats' syspref to 1 (activate sharing) > and the 'UsageStatsLastDisplay' syspref to 0. > > 'Later' : It set the 'UsageStats' syspref to 0 and the > 'UsageStatsLastDisplay' syspref to the today's date and it > will show again the message after 7 days. > > 'No' : It set the 'UsageStats' syspref to 0 and the > 'UsageStatsLastDisplay' syspref to 0. > >This patch also add the possibility to enable the sharing feature from >the web installer. > >If you click on: > > 'Yes' : It set the 'UsageStats' syspref to 1 (activate sharing) > and the 'UsageStatsLastDisplay' syspref to 0. > > 'Later' : It set the 'UsageStats' syspref to 0 and the > 'UsageStatsLastDisplay' syspref to the today's date. A > message on the Administration page will offer you again the > possibility of sharing your stats in 7 days. > > 'No' : It set the 'UsageStats' syspref to 0 and the > 'UsageStatsLastDisplay' syspref to 0. >--- > admin/admin-home.pl | 28 +++++++++ > installer/data/mysql/atomicupdate/14608.sql | 2 + > installer/data/mysql/sysprefs.sql | 1 + > installer/install.pl | 16 ++++++ > .../prog/en/modules/admin/admin-home.tt | 64 +++++++++++++++++++++ > .../prog/en/modules/installer/step3.tt | 34 ++++++++--- > koha-tmpl/intranet-tmpl/prog/img/later.png | Bin 0 -> 1359 bytes > 7 files changed, 137 insertions(+), 8 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/14608.sql > create mode 100644 koha-tmpl/intranet-tmpl/prog/img/later.png > >diff --git a/admin/admin-home.pl b/admin/admin-home.pl >index 08c6ed1..7e7bcbc 100755 >--- a/admin/admin-home.pl >+++ b/admin/admin-home.pl >@@ -34,4 +34,32 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+# >+# Usage stats sharing >+# >+my $usageStats = C4::Context->preference("UsageStats"); >+if( $usageStats ){ >+ $template->param(usageStats => 1); >+} >+else{ >+ $template->param(usageStats => 0); >+} >+ >+my $DAYS = 7; #Number of days before remind to send usage stats >+my $today = DateTime->now->epoch; >+my $lastDisplay; >+if ( (C4::Context->preference("UsageStatsLastDisplay")) eq "" ){ >+ $lastDisplay = 1; >+} >+else{ >+ $lastDisplay = C4::Context->preference("UsageStatsLastDisplay") / 1000; #milliseconds to seconds >+} >+ >+if( ($lastDisplay != 0) && ( $today > ($lastDisplay+ ( 60 * 60 * 24 * $DAYS)) ) ){ >+ $template->param(lastDisplay => $today); >+} >+else{ >+ $template->param(lastDisplay => 0); >+} >+ > output_html_with_http_headers $query, $cookie, $template->output; >diff --git a/installer/data/mysql/atomicupdate/14608.sql b/installer/data/mysql/atomicupdate/14608.sql >new file mode 100644 >index 0000000..d421f4f >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/14608.sql >@@ -0,0 +1,2 @@ >+INSERT INTO systempreferences (variable, value, options, explanation, type ) >+VALUES ('UsageStatsLastDisplay', '', NULL, 'The last time we offered you to share your statistics', 'Free'); >\ No newline at end of file >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index b0346dc..1bae88d 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -525,6 +525,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'), > ('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'), > ('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'), >+('UsageStatsLastDisplay', '', NULL, 'The last time we offered you to share your statistics', 'Free'), > ('UseAuthoritiesForTracings','1','0','Use authority record numbers for subject tracings instead of heading strings.','YesNo'), > ('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'), > ('UseControlNumber','0','','If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','YesNo'), >diff --git a/installer/install.pl b/installer/install.pl >index cc67557..ef57b53 100755 >--- a/installer/install.pl >+++ b/installer/install.pl >@@ -193,6 +193,22 @@ elsif ( $step && $step == 3 ) { > elsif ( $op && $op eq 'finish' ) { > $installer->set_version_syspref(); > >+ # >+ # Share usage stats with Hea >+ # >+ if($query->param('hea') eq "1"){ >+ C4::Context->set_preference('UsageStats', 1); >+ C4::Context->set_preference('UsageStatsLastDisplay', 0); >+ } >+ elsif($query->param('hea') eq "-1"){ >+ C4::Context->set_preference('UsageStats', 0); >+ C4::Context->set_preference('UsageStatsLastDisplay', ((DateTime->now->epoch) * 1000)); >+ } >+ elsif($query->param('hea') eq "0"){ >+ C4::Context->set_preference('UsageStats', 0); >+ C4::Context->set_preference('UsageStatsLastDisplay', 0); >+ } >+ > # Installation is finished. > # We just deny anybody access to install > # And we redirect people to mainpage. >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 bd951bc..5298889 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 >@@ -2,6 +2,58 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Administration</title> > [% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript"> >+ >+ function hide_message(){ >+ $('.dialog:visible').hide('slow'); >+ } >+ >+ function message_success(){ >+ var button = $('<button>') >+ .attr('type', 'button') >+ .addClass('approve') >+ .html('Ok') >+ .click(hide_message); >+ >+ $('#activate_UsageStats').html( >+ 'Usage statistics will be send.' >+ +'<br>If you want to see the statistics generated, go to <a href="http://hea.koha-community.org">hea.koha-community.org</a>' >+ +'<br>' >+ ).append(button); >+ >+ } >+ >+ function set_syspref_ajax(syspref, sysvalue){ >+ return $.ajax({ >+ url: '/cgi-bin/koha/svc/config/systempreferences/'+syspref, >+ data: { value: sysvalue }, >+ type: 'POST', >+ }); >+ } >+ >+ (function($) { >+ $(document).ready(function(){ >+ >+ $('#activate_UsageStats button').click(function(){ >+ var jqXHR; >+ if ($(this).hasClass('approve')) { >+ jqXHR = set_syspref_ajax('UsageStats', 1); >+ jqXHR = set_syspref_ajax('UsageStatsLastDisplay', 0); >+ jqXHR.done(message_success); >+ } else if ($(this).hasClass('later')) { >+ jqXHR = set_syspref_ajax('UsageStats', 0); >+ jqXHR = set_syspref_ajax('UsageStatsLastDisplay', Date.now()); >+ jqXHR.done(hide_message); >+ } else if ($(this).hasClass('deny')) { >+ jqXHR = set_syspref_ajax('UsageStats', 0); >+ jqXHR = set_syspref_ajax('UsageStatsLastDisplay', 0); >+ jqXHR.done(hide_message); >+ } >+ }); >+ }); >+ })(jQuery); >+ >+</script> > </head> > <body id="admin_admin-home" class="admin"> > [% INCLUDE 'header.inc' %] >@@ -9,6 +61,18 @@ > > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Administration</div> > >+[% IF !usageStats && lastDisplay %] >+ <div id="activate_UsageStats" class="dialog message"> >+ <h3>You are not sharing statistics with the community yet:</h3> >+ <p>Please share them to help us improve your user experience.</p> >+ <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> >+ <h4><strong>Send stats monthly ?</strong></h4> >+ <button type="button" class="approve"><i class="fa fa-check"></i> Yes, I want to share my statistics</button> >+ <button type="button" class="later"><i class="fa fa-clock-o"></i> Later</button> >+ <button type="button" class="deny"><i class="fa fa-ban"></i> No, I don't want to share my statistics</button> >+ </div> >+[% END %] >+ > <div id="doc" class="yui-t7"> > <div id="bd"> > <div id="yui-main" class="sysprefs"> >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 3ae276f..23d8ac1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt >@@ -171,15 +171,33 @@ > [% END %] > </ul> > [% END %] >- <h3>All done!</h3> >- <p>Installation complete.<br /> >- <p>Click on 'Finish' to complete and load the Koha Staff Interface. >- <form name="finish"> >- <input type="hidden" name="step" value="3" /> >- <input type="hidden" name="op" value="finish" /> >- <input type="submit" value="Finish" /></form> >+ >+ <form name="finish"> >+ >+ <div id="activate_UsageStats" class="dialog message"> >+ <h3>Activate Hea ?</h3> >+ <p>Please help us improve your user experience by sharing your statistics with community. >+ <br>We share sharing data anonymously, please see which data are sent <a href=http://wiki.koha-community.org/wiki/KohaUsageStat_RFC>here</a>. >+ </p> >+ <input type="radio" name="hea" value="1" checked /> Yes, I want to share my statistics <br/> >+ <input type="radio" name="hea" value="-1" /> Later <br/> >+ <input type="radio" name="hea" value="0" /> No, I don't want to share my statistics <br/> >+ >+ <p>If you want to see the statistics generated, go to <a href=http://hea.koha-community.org/>hea.koha-community.org</a></p> >+ </div> >+ >+ <h3>All done!</h3> >+ <p>Installation complete.<br /> >+ <p>Click on 'Finish' to complete and load the Koha Staff Interface. >+ >+ <input type="hidden" name="step" value="3" /> >+ <input type="hidden" name="op" value="finish" /> >+ <input type="submit" value="Finish" /> >+ </p> > </p> >- </p> >+ </form> >+ >+ > [% END %] > > >diff --git a/koha-tmpl/intranet-tmpl/prog/img/later.png b/koha-tmpl/intranet-tmpl/prog/img/later.png >new file mode 100644 >index 0000000000000000000000000000000000000000..45892ce1bd79b4212a75925e9cb409b302b026de >GIT binary patch >literal 1359 >zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|$r9IylHmNblJdl&R0hYC{G?O` >z&)mfH)S%SFl*+=BsWuD@%nF$y5hW46K32*3xq68pHF_1f1wh>l3^w)^1&PVosU-?Y >zsp*+{wo31J?^jaDOtDo8H}y5}EpSfF$n>ZxN)4{^3rViZPPR-@vbR&PsjvbXkegbP >zs8ErclUHn2VXFi-*9yo63F|8<fR&VF+bTgE72zA8;GAESs$i;Tpqp%9W}skZsAp(w >zVs37(qhMrUXrOOkq;F`XYiMp|Y-D9%pa2C*K--E^(yW49+@N*=dA3R!B_#z``ugSN >z<$C4Ddih1^`i7R4mLM~XjC6r2bc-wVN)jt{^NN*WCb*;)Cl_TFlw{`TDS%8&Ov*1U >zu~h=P6yk;40=Thx#n4~^2AF<DVu8M)o&m^9FonLp_?717!c`ZS1f?R}i`C%bkjjEo >z{h-w1{L-RiV8o><gRCmBaxO|uEXgkl$<NP$g<?QPeo20DMt*^UbFisGcxGNoet9ui >zwXd(0XI^nhVqS8pr;Du;P`_SgW{Q=uv5B#{xtoETk*TYpp{uc_i=%;yrIWFNv6~4n >z@J(QPUGkGlb5rw5V0u#!dJS>v1to;s0-((<sYRJ(sVQzn`MC;U4_js8bc?GiPV=C8 >zQ*gS))eWa!eV}9XLD7m7%`hQg+5s`)i5AF#C;QYqU|KH%ChD>bhiwcDj7L3P978H@ >zwM_BWa19h`>o4x#E>Jn$TTM-Ehi0>Po+k55Mdr%X9v+`Pi+J97c+Q+@FriT*&`pnd >zy^3+?6WxB!%Fp_LmxmocxN7~kxa#-+-)+9OfBn?wXANT(aa?H%n!vA9z*%;HX$CX@ >zFNYb<8j?KCX#$yl<f0b{uerhLt(*2~dX3ihlg|1I%s(8p^7nAeI?yB5#TM+9!uzE$ >z^uv;t%Z}_X9?kSDU~^J4-_l&vm+r_K5vEkMLo}vA?gHCA4KpsKC2oZhZy5D&u&X{e >z7bqOLpD|TSoaL^}^_ekWj11o?C2er-?~9r6NXT^As?*vt{x9{G*W0OmEnv}wr0qO) >z|JUA{;cM-o`$#ssOy;)i_8k}BCCs>G!nW$_p98KZlIweA?4G#POj?~~!l0({kIzp= >zX_EefA091EcU~+!xNYZ-+&{8M-+b8qe#wp33C*2i`_}(=ns=UqBV9So=iV~;nx=@T >zd;i-#m}F%i)I{w&HF?U672J{M_^vkU6!6bGx>JGI<U%&%S25|M$>*-$=Vp_=yL*|W >ztA^LprQ5zf2vJ-1_?GhmA)Sv$y_a10x$T6ccVKGwj=%CRKWzL^slYa;Io9r({Ifqo >Z2@IS%Nzb+$vYi7Jah|SzF6*2UngB&f<^li! > >literal 0 >HcmV?d00001 > >-- >2.1.4
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