7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha › Administration › Koha usage statistics</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% Asset.css("lib/leaflet/leaflet.css") | $raw %]
13 <body id="admin_usage_statistics" class="admin">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
26 <a href="#" aria-current="page">
33 <div class="main container-fluid">
35 <div class="col-sm-10 col-sm-push-2">
38 [% FOR m IN messages %]
39 <div class="dialog [% m.type | html %]">
41 [% CASE 'error_on_update' %]
42 An error occurred when updating this patron category. Perhaps it already exists.
43 [% CASE 'error_on_insert' %]
44 An error occurred when inserting this patron category. The patron category might already exist.
45 [% CASE 'error_on_delete' %]
46 An error occurred when deleting this patron category. Check the logs.
47 [% CASE 'success_on_update' %]
48 Patron category updated successfully.
49 [% CASE 'success_on_insert' %]
50 Patron category inserted successfully.
51 [% CASE 'success_on_delete' %]
52 Patron category deleted successfully.
53 [% CASE 'already_exists' %]
54 This patron category already exists.
61 [% IF NOT Koha.Preference('UsageStats') %]
62 <div class="dialog message">You are not sharing any data with the Koha community</div>
65 <form id="category_form" action="/cgi-bin/koha/admin/usage_statistics.pl" method="post">
66 <h1>Modify the statistics you share with the Koha community</h1>
68 <div class="col-xs-12 col-sm-6">
69 <fieldset class="rows">
72 <label for="UsageStats">Share my Koha usage statistics: </label>
73 <select name="UsageStats" id="UsageStats">
74 [% IF Koha.Preference('UsageStats') == 1 %]
75 <option value="2">Undecided</option>
76 <option value="1" selected="selected">Yes</option>
77 <option value="0">No</option>
78 [% ELSIF Koha.Preference('UsageStats') == 0 %]
79 <option value="2">Undecided</option>
80 <option value="1">Yes</option>
81 <option value="0" selected="selected">No</option>
83 <option value="2" selected="selected">Undecided</option>
84 <option value="1">Yes</option>
85 <option value="0">No</option>
90 <label for="UsageStatsCountry">Your country: </label>
91 [% SET UsageStatsCountry = Koha.Preference('UsageStatsCountry') %]
92 [% SET IsUsageStatsCountryValid = 0 %]
93 [% IF NOT UsageStatsCountry %]
94 [% SET IsUsageStatsCountryValid = 1 %]
96 [% PROCESS 'country-list.inc' %]
97 <select name="UsageStatsCountry" id="UsageStatsCountry">
98 <option value=""> </option>
99 [% FOR country IN countries %]
100 [% IF country == UsageStatsCountry %]
101 <option value="[% country | html %]" selected="selected">[% country | html %]</option>
102 [% SET IsUsageStatsCountryValid = 1 %]
104 <option value="[% country | html %]">[% country | html %]</option>
108 [% UNLESS IsUsageStatsCountryValid %]
109 Note: The value of your system preference 'UsageStatsCountry' is not valid ([% UsageStatsCountry | html %]).
110 Please select a valid one.
114 <label for="UsageStatsLibraryName">Library name: </label>
115 <input type="text" value="[% Koha.Preference('UsageStatsLibraryName') | html %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" />
118 <label for="UsageStatsLibraryType">Library type: </label>
119 [% SET UsageStatsLibraryType = Koha.Preference('UsageStatsLibraryType') %]
120 <select name="UsageStatsLibraryType" id="UsageStatsLibraryType">
121 <option value=""> </option>
122 [% IF UsageStatsLibraryType == 'public' %]
123 <option value="public" selected="selected">Public</option>
125 <option value="public">Public</option>
128 [% IF UsageStatsLibraryType == 'school' %]
129 <option value="school" selected="selected">School</option>
131 <option value="school">School</option>
133 [% IF UsageStatsLibraryType == 'academic' %]
134 <option value="academic" selected="selected">Academic</option>
136 <option value="academic">Academic</option>
138 [% IF UsageStatsLibraryType == 'research' %]
139 <option value="research" selected="selected">Research</option>
141 <option value="research">Research</option>
143 [% IF UsageStatsLibraryType == 'private' %]
144 <option value="private" selected="selected">Private</option>
146 <option value="private">Private</option>
148 [% IF UsageStatsLibraryType == 'societyAssociation' %]
149 <option value="societyAssociation" selected="selected">Society or association</option>
151 <option value="societyAssociation">Society or association</option>
153 [% IF UsageStatsLibraryType == 'corporate' %]
154 <option value="corporate" selected="selected">Corporate</option>
156 <option value="corporate">Corporate</option>
158 [% IF UsageStatsLibraryType == 'government' %]
159 <option value="government" selected="selected">Government</option>
161 <option value="government">Government</option>
163 [% IF UsageStatsLibraryType == 'religiousOrg' %]
164 <option value="religiousOrg" selected="selected">Religious organization</option>
166 <option value="religiousOrg">Religious organization</option>
168 [% IF UsageStatsLibraryType == 'subscription' %]
169 <option value="subscription" selected="selected">Subscription</option>
171 <option value="subscription">Subscription</option>
176 <label for="UsageStatsLibraryUrl">Library URL: </label>
177 <input type="text" name="UsageStatsLibraryUrl" value="[% Koha.Preference('UsageStatsLibraryUrl') | html %]" id="UsageStatsLibraryUrl" />
180 <span class="label">Last update: </span>
181 [% IF UsageStatsLastUpdateTime %]
182 [% UsageStatsLastUpdateTime | html %]
184 Your data have never been shared
188 <label for="UsageStatsGeolocation">Geolocation: </label>
189 <input id="UsageStatsGeolocation" name="UsageStatsGeolocation" value="[% Koha.Preference('UsageStatsGeolocation') | html %]" type="text" value="[% Koha.Preference('UsageStatsLibrariesInfo') | html %]" size="35" readonly="readonly" />
190 <a href="#" class="change_geolocation" data-branchname="" data-id="UsageStatsGeolocation"><img src="[% interface | html %]/lib/leaflet/images/marker-icon.png" title="Set geolocation" style="max-height: 2em;" /></a>
193 <label for="UsageStatsLibrariesInfo">Libraries informations: </label>
194 <select name="UsageStatsLibrariesInfo" id="UsageStatsLibrariesInfo">
195 [% IF Koha.Preference('UsageStatsLibrariesInfo') %]
196 <option value="1" selected="selected">Yes</option>
197 <option value="0">No</option>
199 <option value="1">Yes</option>
200 <option value="0" selected="selected">No</option>
205 <li id="libraries_info">
206 <fieldset class="rows">
207 <legend>Libraries</legend>
209 [% FOR l IN libraries %]
211 <label for="[% l.branchcode | html %]">[% l.branchname | html %]: </label>
212 <div style="float:left;">
213 <div>Country: [% l.branchcountry | html %]</div>
214 <div>Url: [% l.branchurl | html %]</div>
216 Geolocation: <input type="text" id="geolocation_[% l.branchcode | html %]" name="geolocation_[% l.branchcode | html %]" value="[% l.geolocation | html %]" size="35" readonly="readonly" />
217 <a href="#" class="change_geolocation" data-branchname="[% l.branchname | html %]" data-id="geolocation_[% l.branchcode | html %]"><img src="[% interface | html %]/lib/leaflet/images/marker-icon.png" title="Set geolocation for [% l.branchname | html %]" style="max-height: 2em;" /></a>
226 <label for="MyPublicLink">See your public page: </label>
227 [% IF Koha.Preference('UsageStatsPublicID') %]
228 [% SET my_url = 'https://hea.koha-community.org/libraries/' _ Koha.Preference('UsageStatsPublicID') %]
229 <a href="[% my_url | url %]">[% my_url | html %]</a>
231 You do not have anything public yet.
238 <div class="col-xs-12 col-sm-6">
240 <div id="mapid" style="width:100%;height: 400px;"></div>
246 <fieldset class="action">
247 <input type="hidden" name="op" value="update" />
248 <input type="submit" value="Update your statistics usage" />
249 <a class="cancel" href="/cgi-bin/koha/admin/usage_statistics.pl">Cancel</a>
254 </div> <!-- /.col-sm-10.col-sm-push-2 -->
256 <div class="col-sm-2 col-sm-pull-10">
258 [% INCLUDE 'admin-menu.inc' %]
260 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
261 </div> <!-- /.row -->
263 [% MACRO jsinclude BLOCK %]
264 [% INCLUDE 'calendar.inc' %]
265 [% Asset.js("js/admin-menu.js") | $raw %]
266 [% Asset.js("/lib/leaflet/leaflet.js") | $raw %]
268 function positionMap() {
269 var tbh = $("#mapid");
270 var mapContainer = tbh.parent();
271 mapContainer.css('position', 'relative');
272 mapContainer.css('min-height', tbh.outerHeight(true));
273 tbh.css('position', 'absolute');
276 var offsetTop = mapContainer.offset().top;
277 var s = parseInt($(window).scrollTop(), 10);
278 tbh.css('top', '').css('bottom', '');
280 var mapContainerOffsetBottom = offsetTop + mapContainer.innerHeight();
281 if (s + tbh.outerHeight(true) > mapContainerOffsetBottom) {
282 tbh.css('bottom', 0);
284 tbh.css('top', s - offsetTop);
291 $(document).ready(function() {
292 $(window).scroll(positionMap);
296 var map = L.map('mapid').setView([0,0], 1);
298 L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', {
300 attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
301 '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
304 var default_elt = { 'text': _("Main library"), 'id': 'UsageStatsGeolocation' };
305 var current_elt = default_elt;
308 var title = L.control({position: 'topright'});
309 title.onAdd = function (map) {
310 this._div = L.DomUtil.create('div', 'title');
314 title.update = function (props) {
315 this._div.innerHTML = '<h4>' + _("Click on the map to set the geolocation for %s").format(current_elt.text) + '</h4>';
320 function add_to_map(elt, latlng) {
321 var marker = markers[elt.id];
322 if (marker) map.removeLayer(marker);
323 marker = L.marker(latlng).addTo(map);
324 marker.bindPopup(elt.text);
325 marker.on('mouseover', function (e) {this.openPopup(); });
326 marker.on('mouseout', function (e) {this.closePopup();});
327 markers[elt.id] = marker;
331 [% IF Koha.Preference('UsageStatsGeolocation') %]
332 var latlng = [ [% Koha.Preference('UsageStatsGeolocation') | html %] ];
333 add_to_map( current_elt, latlng );
335 [% FOR l IN libraries %]
336 [% NEXT UNLESS l.geolocation %]
337 add_to_map( { 'text': "[% l.branchname | html %]", 'id': "geolocation_[% l.branchcode | html %]" }, [ [% l.geolocation | html %] ] );
340 // On click, update the geolocation and the marker
341 map.on('click', function(e){
342 add_to_map( current_elt, e.latlng );
343 $("#" + current_elt.id).val(e.latlng.lat + ',' + e.latlng.lng);
347 var group = new L.featureGroup(Object.keys(markers).map(function(key){return markers[key]}));
348 if ( group.getBounds().isValid() ) map.fitBounds(group.getBounds());
350 // On click on the marker icons, update the title of the map
351 $(document).ready(function(){
352 $(".change_geolocation").on('click', function(e){
354 if ( $(this).data('branchname') ) {
355 current_elt = { 'text': $(this).data('branchname'), 'id': $(this).data('id') };
357 current_elt = default_elt;
361 $("#UsageStatsLibrariesInfo").change();
364 $("#UsageStatsLibrariesInfo").on('change', function(){
365 if ( $(this).val() == 1 ) $("#libraries_info").show()
366 else $("#libraries_info").hide();
372 [% INCLUDE 'intranet-bottom.inc' %]