|
Lines 5-10
Link Here
|
| 5 |
<title>Koha › Administration › Koha usage statistics</title> |
5 |
<title>Koha › Administration › Koha usage statistics</title> |
| 6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
| 7 |
[% INCLUDE 'calendar.inc' %] |
7 |
[% INCLUDE 'calendar.inc' %] |
|
|
8 |
<link rel="stylesheet" href="[% interface %]/lib/leaflet/leaflet.css" /> |
| 9 |
<script src="[% interface %]/lib/leaflet/leaflet.js"></script> |
| 10 |
|
| 11 |
<script type="text/javascript"> |
| 12 |
//<![CDATA[ |
| 13 |
var originalOffset; |
| 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); |
| 21 |
if (fixMe) { |
| 22 |
tbh.css({ |
| 23 |
'position': 'fixed', |
| 24 |
'top': '0', |
| 25 |
'margin-left': '40%' |
| 26 |
}); |
| 27 |
} |
| 28 |
if (repositionMe) { |
| 29 |
tbh.css({ |
| 30 |
'position': 'absolute', |
| 31 |
'top': originalOffset, |
| 32 |
'margin-left': '40%' |
| 33 |
}); |
| 34 |
} |
| 35 |
}); |
| 36 |
//]]> |
| 37 |
</script> |
| 8 |
</head> |
38 |
</head> |
| 9 |
|
39 |
|
| 10 |
<body id="admin_usage_statistics" class="admin"> |
40 |
<body id="admin_usage_statistics" class="admin"> |
|
Lines 48-54
Link Here
|
| 48 |
<form id="category_form" action="/cgi-bin/koha/admin/usage_statistics.pl" method="post"> |
78 |
<form id="category_form" action="/cgi-bin/koha/admin/usage_statistics.pl" method="post"> |
| 49 |
<h1>Modify the statistics you share with the Koha community</h1> |
79 |
<h1>Modify the statistics you share with the Koha community</h1> |
| 50 |
<fieldset class="rows"> |
80 |
<fieldset class="rows"> |
| 51 |
<ol> |
81 |
<ol style="float:left;"> |
| 52 |
<li> |
82 |
<li> |
| 53 |
<label for="UsageStats">Share my Koha usage statistics: </label> |
83 |
<label for="UsageStats">Share my Koha usage statistics: </label> |
| 54 |
<select name="UsageStats" id="UsageStats"> |
84 |
<select name="UsageStats" id="UsageStats"> |
|
Lines 87-93
Link Here
|
| 87 |
</li> |
117 |
</li> |
| 88 |
<li> |
118 |
<li> |
| 89 |
<label for="UsageStatsLibraryName">Library name: </label> |
119 |
<label for="UsageStatsLibraryName">Library name: </label> |
| 90 |
<input type="text" value="[% Koha.Preference('UsageStatsLibraryName') %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" /> |
120 |
<input type="text" value="[% Koha.Preference('UsageStatsLibraryName') | html %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" /> |
| 91 |
</li> |
121 |
</li> |
| 92 |
<li> |
122 |
<li> |
| 93 |
<label for="UsageStatsLibraryType">Library type: </label> |
123 |
<label for="UsageStatsLibraryType">Library type: </label> |
|
Lines 159-166
Link Here
|
| 159 |
Your data have never been shared |
189 |
Your data have never been shared |
| 160 |
[% END %] |
190 |
[% END %] |
| 161 |
</li> |
191 |
</li> |
|
|
192 |
<li> |
| 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> |
| 196 |
</li> |
| 197 |
<li> |
| 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> |
| 203 |
[% ELSE %] |
| 204 |
<option value="1">Yes</option> |
| 205 |
<option value="0" selected="selected">No</option> |
| 206 |
[% END %] |
| 207 |
</select> |
| 208 |
</li> |
| 209 |
|
| 210 |
<li id="libraries_info"> |
| 211 |
<fieldset class="rows"> |
| 212 |
<legend>Libraries</legend> |
| 213 |
<ol> |
| 214 |
[% FOR l IN libraries %] |
| 215 |
<li> |
| 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> |
| 220 |
<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> |
| 223 |
</div> |
| 224 |
</div> |
| 225 |
</li> |
| 226 |
[% END %] |
| 227 |
</ol> |
| 228 |
</fieldset> |
| 229 |
</li> |
| 230 |
<li> |
| 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> |
| 235 |
[% ELSE %] |
| 236 |
You do not have anything public yet. |
| 237 |
[% END %] |
| 238 |
</li> |
| 239 |
|
| 162 |
</ol> |
240 |
</ol> |
| 163 |
</fieldset> |
241 |
<div style="clear:right"></div> |
|
|
242 |
<div id="mapid" style="width: 600px; height: 400px; margin-left: 40%:"></div> |
| 243 |
</fieldset> |
| 164 |
|
244 |
|
| 165 |
<fieldset class="action"> |
245 |
<fieldset class="action"> |
| 166 |
<input type="hidden" name="op" value="update" /> |
246 |
<input type="hidden" name="op" value="update" /> |
|
Lines 169-174
Link Here
|
| 169 |
</fieldset> |
249 |
</fieldset> |
| 170 |
</form> |
250 |
</form> |
| 171 |
|
251 |
|
|
|
252 |
<script> |
| 253 |
var map = L.map('mapid').setView([0,0], 1); |
| 254 |
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', { |
| 255 |
maxZoom: 18, |
| 256 |
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
| 257 |
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
| 258 |
'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
| 259 |
id: 'mapbox.streets' |
| 260 |
}).addTo(map); |
| 261 |
|
| 262 |
var default_elt = { 'text': _("Main library"), 'id': 'UsageStatsGeolocation' }; |
| 263 |
var current_elt = default_elt; |
| 264 |
|
| 265 |
// Add the title |
| 266 |
var title = L.control({position: 'topright'}); |
| 267 |
title.onAdd = function (map) { |
| 268 |
this._div = L.DomUtil.create('div', 'title'); |
| 269 |
this.update(); |
| 270 |
return this._div; |
| 271 |
}; |
| 272 |
title.update = function (props) { |
| 273 |
this._div.innerHTML = '<h4>' + _("Click on the map to set the geolocation for %s").format(current_elt.text) + '</h4>'; |
| 274 |
}; |
| 275 |
title.addTo(map); |
| 276 |
|
| 277 |
var markers = {}; |
| 278 |
function add_to_map(elt, latlng) { |
| 279 |
var marker = markers[elt.id]; |
| 280 |
if (marker) map.removeLayer(marker); |
| 281 |
marker = L.marker(latlng).addTo(map); |
| 282 |
marker.bindPopup(elt.text); |
| 283 |
marker.on('mouseover', function (e) {this.openPopup(); }); |
| 284 |
marker.on('mouseout', function (e) {this.closePopup();}); |
| 285 |
markers[elt.id] = marker; |
| 286 |
} |
| 287 |
|
| 288 |
// Init the map |
| 289 |
[% IF Koha.Preference('UsageStatsGeolocation') %] |
| 290 |
var latlng = [ [% Koha.Preference('UsageStatsGeolocation') %] ]; |
| 291 |
add_to_map( current_elt, latlng ); |
| 292 |
[% END %] |
| 293 |
[% FOR l IN libraries %] |
| 294 |
[% NEXT UNLESS l.geolocation %] |
| 295 |
add_to_map( { 'text': "[% l.branchname %]", 'id': "geolocation_[% l.branchcode %]" }, [ [% l.geolocation %] ] ); |
| 296 |
[% END %] |
| 297 |
|
| 298 |
// On click, update the geolocation and the marker |
| 299 |
map.on('click', function(e){ |
| 300 |
add_to_map( current_elt, e.latlng ); |
| 301 |
$("#" + current_elt.id).val(e.latlng.lat + ',' + e.latlng.lng); |
| 302 |
}); |
| 303 |
|
| 304 |
// Auto zoom |
| 305 |
var group = new L.featureGroup(Object.keys(markers).map(function(key){return markers[key]})); |
| 306 |
if ( group.getBounds().isValid() ) map.fitBounds(group.getBounds()); |
| 307 |
|
| 308 |
// On click on the marker icons, update the title of the map |
| 309 |
$(document).ready(function(){ |
| 310 |
$(".change_geolocation").on('click', function(e){ |
| 311 |
e.preventDefault(); |
| 312 |
if ( $(this).data('branchname') ) { |
| 313 |
current_elt = { 'text': $(this).data('branchname'), 'id': $(this).data('id') }; |
| 314 |
} else { |
| 315 |
current_elt = default_elt; |
| 316 |
} |
| 317 |
title.update(); |
| 318 |
}); |
| 319 |
$("#UsageStatsLibrariesInfo").change(); |
| 320 |
}); |
| 321 |
|
| 322 |
$("#UsageStatsLibrariesInfo").on('change', function(){ |
| 323 |
if ( $(this).val() == 1 ) $("#libraries_info").show() |
| 324 |
else $("#libraries_info").hide(); |
| 325 |
}); |
| 326 |
|
| 327 |
</script> |
| 328 |
|
| 172 |
</div> |
329 |
</div> |
| 173 |
</div> |
330 |
</div> |
| 174 |
<div class="yui-b"> |
331 |
<div class="yui-b"> |