4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Administration › Koha usage statistics</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% INCLUDE 'calendar.inc' %]
8 <link rel="stylesheet" href="[% interface %]/lib/leaflet/leaflet.css" />
9 <script src="[% interface %]/lib/leaflet/leaflet.js"></script>
11 <script type="text/javascript">
14 $(window).scroll(function () {
15 var tbh = $("#mapid");
16 var offsetTop = tbh.offset().top;
17 var s = parseInt($(window).scrollTop(), 10);
18 var fixMe = (s > offsetTop);
19 if ( !originalOffset ) originalOffset = tbh.position().top;
20 var repositionMe = (s < originalOffset);
30 'position': 'absolute',
31 'top': originalOffset,
40 <body id="admin_usage_statistics" class="admin">
41 [% INCLUDE 'header.inc' %]
42 [% INCLUDE 'cat-search.inc' %]
44 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Usage statistics</div>
46 <div id="doc3" class="yui-t2">
51 [% FOR m IN messages %]
52 <div class="dialog [% m.type %]">
54 [% CASE 'error_on_update' %]
55 An error occurred when updating this patron category. Perhaps it already exists.
56 [% CASE 'error_on_insert' %]
57 An error occurred when inserting this patron category. The patron category might already exist.
58 [% CASE 'error_on_delete' %]
59 An error occurred when deleting this patron category. Check the logs.
60 [% CASE 'success_on_update' %]
61 Patron category updated successfully.
62 [% CASE 'success_on_insert' %]
63 Patron category inserted successfully.
64 [% CASE 'success_on_delete' %]
65 Patron category deleted successfully.
66 [% CASE 'already_exists' %]
67 This patron category already exists.
74 [% IF NOT Koha.Preference('UsageStats') %]
75 <div class="dialog message">You are not sharing any data with the Koha community</div>
78 <form id="category_form" action="/cgi-bin/koha/admin/usage_statistics.pl" method="post">
79 <h1>Modify the statistics you share with the Koha community</h1>
80 <fieldset class="rows">
81 <ol style="float:left;">
83 <label for="UsageStats">Share my Koha usage statistics: </label>
84 <select name="UsageStats" id="UsageStats">
85 [% IF Koha.Preference('UsageStats') %]
86 <option value="1" selected="selected">Yes</option>
87 <option value="0">No</option>
89 <option value="1">Yes</option>
90 <option value="0" selected="selected">No</option>
95 <label for="UsageStatsCountry">Your country: </label>
96 [% SET UsageStatsCountry = Koha.Preference('UsageStatsCountry') %]
97 [% SET IsUsageStatsCountryValid = 0 %]
98 [% IF NOT UsageStatsCountry %]
99 [% SET IsUsageStatsCountryValid = 1 %]
101 [% PROCESS 'country-list.inc' %]
102 <select name="UsageStatsCountry" id="UsageStatsCountry">
103 <option value=""> </option>
104 [% FOR country IN countries %]
105 [% IF country == UsageStatsCountry %]
106 <option value="[% country %]" selected="selected">[% country %]</option>
107 [% SET IsUsageStatsCountryValid = 1 %]
109 <option value="[% country %]">[% country %]</option>
113 [% UNLESS IsUsageStatsCountryValid %]
114 Note: The value of your system preference 'UsageStatsCountry' is not valid ([% UsageStatsCountry %]).
115 Please select a valid one.
119 <label for="UsageStatsLibraryName">Library name: </label>
120 <input type="text" value="[% Koha.Preference('UsageStatsLibraryName') | html %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" />
123 <label for="UsageStatsLibraryType">Library type: </label>
124 [% SET UsageStatsLibraryType = Koha.Preference('UsageStatsLibraryType') %]
125 <select name="UsageStatsLibraryType" id="UsageStatsLibraryType">
126 <option value=""> </option>
127 [% IF UsageStatsLibraryType == 'public' %]
128 <option value="public" selected="selected">Public</option>
130 <option value="public">Public</option>
133 [% IF UsageStatsLibraryType == 'school' %]
134 <option value="school" selected="selected">School</option>
136 <option value="school">School</option>
138 [% IF UsageStatsLibraryType == 'academic' %]
139 <option value="academic" selected="selected">Academic</option>
141 <option value="academic">Academic</option>
143 [% IF UsageStatsLibraryType == 'research' %]
144 <option value="research" selected="selected">Research</option>
146 <option value="research">Research</option>
148 [% IF UsageStatsLibraryType == 'private' %]
149 <option value="private" selected="selected">Private</option>
151 <option value="private">Private</option>
153 [% IF UsageStatsLibraryType == 'societyAssociation' %]
154 <option value="societyAssociation" selected="selected">Society or association</option>
156 <option value="societyAssociation">Society or association</option>
158 [% IF UsageStatsLibraryType == 'corporate' %]
159 <option value="corporate" selected="selected">Corporate</option>
161 <option value="corporate">Corporate</option>
163 [% IF UsageStatsLibraryType == 'government' %]
164 <option value="government" selected="selected">Government</option>
166 <option value="government">Government</option>
168 [% IF UsageStatsLibraryType == 'religiousOrg' %]
169 <option value="religiousOrg" selected="selected">Religious organization</option>
171 <option value="religiousOrg">Religious organization</option>
173 [% IF UsageStatsLibraryType == 'subscription' %]
174 <option value="subscription" selected="selected">Subscription</option>
176 <option value="subscription">Subscription</option>
181 <label for="UsageStatsLibraryUrl">Library URL: </label>
182 <input type="text" name="UsageStatsLibraryUrl" value="[% Koha.Preference('UsageStatsLibraryUrl') %]" id="UsageStatsLibraryUrl" />
185 <span class="label">Last update: </span>
186 [% IF UsageStatsLastUpdateTime %]
187 [% UsageStatsLastUpdateTime %]
189 Your data have never been shared
193 <label for="UsageStatsGeolocation">Geolocation: </label>
194 <input id="UsageStatsGeolocation" name="UsageStatsGeolocation" value="[% Koha.Preference('UsageStatsGeolocation') %]" type="text" value="[% Koha.Preference('UsageStatsLibrariesInfo') %]" size="35" readonly="readonly" />
195 <a href="#" class="change_geolocation" data-branchname="" data-id="UsageStatsGeolocation"><img src="[% interface %]/lib/leaflet/images/marker-icon.png" title="Set geolocation" style="max-height: 2em;" /></a>
198 <label for="UsageStatsLibrariesInfo">Libraries informations: </label>
199 <select name="UsageStatsLibrariesInfo" id="UsageStatsLibrariesInfo">
200 [% IF Koha.Preference('UsageStatsLibrariesInfo') %]
201 <option value="1" selected="selected">Yes</option>
202 <option value="0">No</option>
204 <option value="1">Yes</option>
205 <option value="0" selected="selected">No</option>
210 <li id="libraries_info">
211 <fieldset class="rows">
212 <legend>Libraries</legend>
214 [% FOR l IN libraries %]
216 <label for="[% l.branchcode %]">[% l.branchname %]: </label>
217 <div style="float:left;">
218 <div>Country: [% l.branchcountry %]</div>
219 <div>Url: [% l.branchurl %]</div>
221 Geolocation: <input type="text" id="geolocation_[% l.branchcode %]" name="geolocation_[% l.branchcode %]" value="[% l.geolocation %]" size="35" readonly="readonly" />
222 <a href="#" class="change_geolocation" data-branchname="[% l.branchname %]" data-id="geolocation_[% l.branchcode %]"><img src="[% interface %]/lib/leaflet/images/marker-icon.png" title="Set geolocation for [% l.branchname %]" style="max-height: 2em;" /></a>
231 <label for="MyPublicLink">See your public page: </label>
232 [% IF Koha.Preference('UsageStatsPublicID') %]
233 [% SET my_url = 'http://hea.koha-community.org/libraries/' _ Koha.Preference('UsageStatsPublicID') %]
234 <a href="[% my_url %]">[% my_url %]</a>
236 You do not have anything public yet.
241 <div style="clear:right"></div>
242 <div id="mapid" style="width: 600px; height: 400px; margin-left: 40%:"></div>
245 <fieldset class="action">
246 <input type="hidden" name="op" value="update" />
247 <input type="submit" value="Update your statistics usage" />
248 <a class="cancel" href="/cgi-bin/koha/admin/usage_statistics.pl">Cancel</a>
253 var map = L.map('mapid').setView([0,0], 1);
255 L.tileLayer('https://a.tile.openstreetmap.org/{z}/{x}/{y}.png', {
257 attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
258 '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'
261 var default_elt = { 'text': _("Main library"), 'id': 'UsageStatsGeolocation' };
262 var current_elt = default_elt;
265 var title = L.control({position: 'topright'});
266 title.onAdd = function (map) {
267 this._div = L.DomUtil.create('div', 'title');
271 title.update = function (props) {
272 this._div.innerHTML = '<h4>' + _("Click on the map to set the geolocation for %s").format(current_elt.text) + '</h4>';
277 function add_to_map(elt, latlng) {
278 var marker = markers[elt.id];
279 if (marker) map.removeLayer(marker);
280 marker = L.marker(latlng).addTo(map);
281 marker.bindPopup(elt.text);
282 marker.on('mouseover', function (e) {this.openPopup(); });
283 marker.on('mouseout', function (e) {this.closePopup();});
284 markers[elt.id] = marker;
288 [% IF Koha.Preference('UsageStatsGeolocation') %]
289 var latlng = [ [% Koha.Preference('UsageStatsGeolocation') %] ];
290 add_to_map( current_elt, latlng );
292 [% FOR l IN libraries %]
293 [% NEXT UNLESS l.geolocation %]
294 add_to_map( { 'text': "[% l.branchname %]", 'id': "geolocation_[% l.branchcode %]" }, [ [% l.geolocation %] ] );
297 // On click, update the geolocation and the marker
298 map.on('click', function(e){
299 add_to_map( current_elt, e.latlng );
300 $("#" + current_elt.id).val(e.latlng.lat + ',' + e.latlng.lng);
304 var group = new L.featureGroup(Object.keys(markers).map(function(key){return markers[key]}));
305 if ( group.getBounds().isValid() ) map.fitBounds(group.getBounds());
307 // On click on the marker icons, update the title of the map
308 $(document).ready(function(){
309 $(".change_geolocation").on('click', function(e){
311 if ( $(this).data('branchname') ) {
312 current_elt = { 'text': $(this).data('branchname'), 'id': $(this).data('id') };
314 current_elt = default_elt;
318 $("#UsageStatsLibrariesInfo").change();
321 $("#UsageStatsLibrariesInfo").on('change', function(){
322 if ( $(this).val() == 1 ) $("#libraries_info").show()
323 else $("#libraries_info").hide();
331 [% INCLUDE 'admin-menu.inc' %]
334 [% INCLUDE 'intranet-bottom.inc' %]