7 [% INCLUDE 'doc-head-open.inc' %]
8 <title>Koha usage statistics › Administration › Koha</title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% Asset.css("lib/leaflet/leaflet.css") | $raw %]
13 <body id="admin_usage_statistics" class="admin">
14 [% WRAPPER 'header.inc' %]
15 [% INCLUDE 'cat-search.inc' %]
18 [% WRAPPER 'sub-header.inc' %]
19 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
22 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
25 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
28 <a href="#" aria-current="page">
36 <div class="main container-fluid">
38 <div class="col-sm-10 col-sm-push-2">
41 [% FOR m IN messages %]
42 <div class="dialog [% m.type | html %]">
44 [% CASE 'error_on_update' %]
45 <span>An error occurred when updating this patron category. Perhaps it already exists</span>
46 [% CASE 'error_on_insert' %]
47 <span>An error occurred when inserting this patron category. The patron category might already exist</span>
48 [% CASE 'error_on_delete' %]
49 <span>An error occurred when deleting this patron category. Check the logs</span>
50 [% CASE 'success_on_update' %]
51 <span>Patron category updated successfully</span>
52 [% CASE 'success_on_insert' %]
53 <span>Patron category inserted successfully</span>
54 [% CASE 'success_on_delete' %]
55 <span>Patron category deleted successfully</span>
56 [% CASE 'already_exists' %]
57 <span>This patron category already exists</span>
59 <span>[% m.code | html %]</span>
64 [% IF NOT Koha.Preference('UsageStats') %]
65 <div class="dialog message">You are not sharing any data with the Koha community</div>
68 <form id="category_form" action="/cgi-bin/koha/admin/usage_statistics.pl" method="post">
69 <h1>Modify the statistics you share with the Koha community</h1>
71 <div class="col-xs-12 col-sm-6">
72 <fieldset class="rows">
75 <label for="UsageStats">Share my Koha usage statistics: </label>
76 <select name="UsageStats" id="UsageStats">
77 [% IF Koha.Preference('UsageStats') == 1 %]
78 <option value="2">Undecided</option>
79 <option value="1" selected="selected">Yes</option>
80 <option value="0">No</option>
81 [% ELSIF Koha.Preference('UsageStats') == 0 %]
82 <option value="2">Undecided</option>
83 <option value="1">Yes</option>
84 <option value="0" selected="selected">No</option>
86 <option value="2" selected="selected">Undecided</option>
87 <option value="1">Yes</option>
88 <option value="0">No</option>
93 <label for="UsageStatsCountry">Your country: </label>
94 [% SET UsageStatsCountry = Koha.Preference('UsageStatsCountry') %]
95 [% SET IsUsageStatsCountryValid = 0 %]
96 [% IF NOT UsageStatsCountry %]
97 [% SET IsUsageStatsCountryValid = 1 %]
99 [% PROCESS 'country-list.inc' %]
100 <select name="UsageStatsCountry" id="UsageStatsCountry">
101 <option value=""> </option>
102 [% FOR country IN countries %]
103 [% IF country == UsageStatsCountry %]
104 <option value="[% country | html %]" selected="selected">[% country | html %]</option>
105 [% SET IsUsageStatsCountryValid = 1 %]
107 <option value="[% country | html %]">[% country | html %]</option>
111 [% UNLESS IsUsageStatsCountryValid %]
112 Note: The value of your system preference 'UsageStatsCountry' is not valid ([% UsageStatsCountry | html %]).
113 Please select a valid one.
117 <label for="UsageStatsLibraryName">Library name: </label>
118 <input type="text" value="[% Koha.Preference('UsageStatsLibraryName') | html %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" />
121 <label for="UsageStatsLibraryType">Library type: </label>
122 [% SET UsageStatsLibraryType = Koha.Preference('UsageStatsLibraryType') %]
123 <select name="UsageStatsLibraryType" id="UsageStatsLibraryType">
124 <option value=""> </option>
125 [% IF UsageStatsLibraryType == 'public' %]
126 <option value="public" selected="selected">Public</option>
128 <option value="public">Public</option>
131 [% IF UsageStatsLibraryType == 'school' %]
132 <option value="school" selected="selected">School</option>
134 <option value="school">School</option>
136 [% IF UsageStatsLibraryType == 'academic' %]
137 <option value="academic" selected="selected">Academic</option>
139 <option value="academic">Academic</option>
141 [% IF UsageStatsLibraryType == 'research' %]
142 <option value="research" selected="selected">Research</option>
144 <option value="research">Research</option>
146 [% IF UsageStatsLibraryType == 'private' %]
147 <option value="private" selected="selected">Private</option>
149 <option value="private">Private</option>
151 [% IF UsageStatsLibraryType == 'societyAssociation' %]
152 <option value="societyAssociation" selected="selected">Society or association</option>
154 <option value="societyAssociation">Society or association</option>
156 [% IF UsageStatsLibraryType == 'corporate' %]
157 <option value="corporate" selected="selected">Corporate</option>
159 <option value="corporate">Corporate</option>
161 [% IF UsageStatsLibraryType == 'government' %]
162 <option value="government" selected="selected">Government</option>
164 <option value="government">Government</option>
166 [% IF UsageStatsLibraryType == 'religiousOrg' %]
167 <option value="religiousOrg" selected="selected">Religious organization</option>
169 <option value="religiousOrg">Religious organization</option>
171 [% IF UsageStatsLibraryType == 'subscription' %]
172 <option value="subscription" selected="selected">Subscription</option>
174 <option value="subscription">Subscription</option>
179 <label for="UsageStatsLibraryUrl">Library URL: </label>
180 <input type="text" name="UsageStatsLibraryUrl" value="[% Koha.Preference('UsageStatsLibraryUrl') | html %]" id="UsageStatsLibraryUrl" />
183 <span class="label">Last update: </span>
184 [% IF UsageStatsLastUpdateTime %]
185 [% UsageStatsLastUpdateTime | html %]
187 <span>Your data have never been shared</span>
191 <label for="UsageStatsGeolocation">Geolocation: </label>
192 <input id="UsageStatsGeolocation" name="UsageStatsGeolocation" value="[% Koha.Preference('UsageStatsGeolocation') | html %]" type="text" value="[% Koha.Preference('UsageStatsLibrariesInfo') | html %]" size="35" readonly="readonly" />
193 <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>
196 <label for="UsageStatsLibrariesInfo">Libraries informations: </label>
197 <select name="UsageStatsLibrariesInfo" id="UsageStatsLibrariesInfo">
198 [% IF Koha.Preference('UsageStatsLibrariesInfo') %]
199 <option value="1" selected="selected">Yes</option>
200 <option value="0">No</option>
202 <option value="1">Yes</option>
203 <option value="0" selected="selected">No</option>
208 <li id="libraries_info">
209 <fieldset class="rows">
210 <legend>Libraries</legend>
212 [% FOR l IN libraries %]
214 <label for="[% l.branchcode | html %]">[% l.branchname | html %]: </label>
215 <div style="float:left;">
216 <div>Country: [% l.branchcountry | html %]</div>
217 <div>Url: [% l.branchurl | html %]</div>
219 Geolocation: <input type="text" id="geolocation_[% l.branchcode | html %]" name="geolocation_[% l.branchcode | html %]" value="[% l.geolocation | html %]" size="35" readonly="readonly" />
220 <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>
229 <label for="MyPublicLink">See your public page: </label>
230 [% IF Koha.Preference('UsageStatsPublicID') %]
231 [% SET my_url = 'https://hea.koha-community.org/libraries/' _ Koha.Preference('UsageStatsPublicID') %]
232 <a href="[% my_url | url %]">[% my_url | html %]</a>
234 You do not have anything public yet.
241 <div class="col-xs-12 col-sm-6">
243 <div id="mapid" style="width:100%;height: 400px;"></div>
249 <fieldset class="action">
250 <input type="hidden" name="op" value="update" />
251 <input type="submit" value="Update your statistics usage" />
252 <a class="cancel" href="/cgi-bin/koha/admin/usage_statistics.pl">Cancel</a>
257 </div> <!-- /.col-sm-10.col-sm-push-2 -->
259 <div class="col-sm-2 col-sm-pull-10">
261 [% INCLUDE 'admin-menu.inc' %]
263 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
264 </div> <!-- /.row -->
266 [% MACRO jsinclude BLOCK %]
267 [% INCLUDE 'calendar.inc' %]
268 [% Asset.js("js/admin-menu.js") | $raw %]
269 [% Asset.js("/lib/leaflet/leaflet.js") | $raw %]
271 function positionMap() {
272 var tbh = $("#mapid");
273 var mapContainer = tbh.parent();
274 mapContainer.css('position', 'relative');
275 mapContainer.css('min-height', tbh.outerHeight(true));
276 tbh.css('position', 'absolute');
279 var offsetTop = mapContainer.offset().top;
280 var s = parseInt($(window).scrollTop(), 10);
281 tbh.css('top', '').css('bottom', '');
283 var mapContainerOffsetBottom = offsetTop + mapContainer.innerHeight();
284 if (s + tbh.outerHeight(true) > mapContainerOffsetBottom) {
285 tbh.css('bottom', 0);
287 tbh.css('top', s - offsetTop);
294 $(document).ready(function() {
295 $(window).scroll(positionMap);
299 var map = L.map('mapid').setView([0,0], 1);
301 L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', {
303 attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
304 '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
307 var default_elt = { 'text': _("Main library"), 'id': 'UsageStatsGeolocation' };
308 var current_elt = default_elt;
311 var title = L.control({position: 'topright'});
312 title.onAdd = function (map) {
313 this._div = L.DomUtil.create('div', 'title');
317 title.update = function (props) {
318 this._div.innerHTML = '<h4>' + _("Click on the map to set the geolocation for %s").format(current_elt.text) + '</h4>';
323 function add_to_map(elt, latlng) {
324 var marker = markers[elt.id];
325 if (marker) map.removeLayer(marker);
326 marker = L.marker(latlng).addTo(map);
327 marker.bindPopup(elt.text);
328 marker.on('mouseover', function (e) {this.openPopup(); });
329 marker.on('mouseout', function (e) {this.closePopup();});
330 markers[elt.id] = marker;
334 [% IF Koha.Preference('UsageStatsGeolocation') %]
335 var latlng = [ [% Koha.Preference('UsageStatsGeolocation') | html %] ];
336 add_to_map( current_elt, latlng );
338 [% FOR l IN libraries %]
339 [% NEXT UNLESS l.geolocation %]
340 add_to_map( { 'text': "[% l.branchname | html %]", 'id': "geolocation_[% l.branchcode | html %]" }, [ [% l.geolocation | html %] ] );
343 // On click, update the geolocation and the marker
344 map.on('click', function(e){
345 add_to_map( current_elt, e.latlng );
346 $("#" + current_elt.id).val(e.latlng.lat + ',' + e.latlng.lng);
350 var group = new L.featureGroup(Object.keys(markers).map(function(key){return markers[key]}));
351 if ( group.getBounds().isValid() ) map.fitBounds(group.getBounds());
353 // On click on the marker icons, update the title of the map
354 $(document).ready(function(){
355 $(".change_geolocation").on('click', function(e){
357 if ( $(this).data('branchname') ) {
358 current_elt = { 'text': $(this).data('branchname'), 'id': $(this).data('id') };
360 current_elt = default_elt;
364 $("#UsageStatsLibrariesInfo").change();
367 $("#UsageStatsLibrariesInfo").on('change', function(){
368 if ( $(this).val() == 1 ) $("#libraries_info").show()
369 else $("#libraries_info").hide();
375 [% INCLUDE 'intranet-bottom.inc' %]