|
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 281-287
Link Here
|
| 281 |
</li> |
311 |
</li> |
| 282 |
<li> |
312 |
<li> |
| 283 |
<label for="UsageStatsLibraryName">Library name: </label> |
313 |
<label for="UsageStatsLibraryName">Library name: </label> |
| 284 |
<input type="text" value="[% Koha.Preference('UsageStatsLibraryName') %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" /> |
314 |
<input type="text" value="[% Koha.Preference('UsageStatsLibraryName') | html %]" name="UsageStatsLibraryName" id="UsageStatsLibraryName" /> |
| 285 |
</li> |
315 |
</li> |
| 286 |
<li> |
316 |
<li> |
| 287 |
<label for="UsageStatsLibraryType">Library type: </label> |
317 |
<label for="UsageStatsLibraryType">Library type: </label> |
|
Lines 353-360
Link Here
|
| 353 |
Your data have never been shared |
383 |
Your data have never been shared |
| 354 |
[% END %] |
384 |
[% END %] |
| 355 |
</li> |
385 |
</li> |
|
|
386 |
<li> |
| 387 |
<label for="UsageStatsGeolocation">Geolocation: </label> |
| 388 |
<input id="UsageStatsGeolocation" name="UsageStatsGeolocation" value="[% Koha.Preference('UsageStatsGeolocation') %]" type="text" value="[% Koha.Preference('UsageStatsLibrariesInfo') %]" size="35" readonly="readonly" /> |
| 389 |
<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> |
| 390 |
</li> |
| 391 |
<li> |
| 392 |
<label for="UsageStatsLibrariesInfo">Libraries informations: </label> |
| 393 |
<select name="UsageStatsLibrariesInfo" id="UsageStatsLibrariesInfo"> |
| 394 |
[% IF Koha.Preference('UsageStatsLibrariesInfo') %] |
| 395 |
<option value="1" selected="selected">Yes</option> |
| 396 |
<option value="0">No</option> |
| 397 |
[% ELSE %] |
| 398 |
<option value="1">Yes</option> |
| 399 |
<option value="0" selected="selected">No</option> |
| 400 |
[% END %] |
| 401 |
</select> |
| 402 |
</li> |
| 403 |
|
| 404 |
<li id="libraries_info"> |
| 405 |
<fieldset class="rows"> |
| 406 |
<legend>Libraries</legend> |
| 407 |
<ol> |
| 408 |
[% FOR l IN libraries %] |
| 409 |
<li> |
| 410 |
<label for="[% l.branchcode %]">[% l.branchname %]: </label> |
| 411 |
<div style="float:left;"> |
| 412 |
<div>Country: [% l.branchcountry %]</div> |
| 413 |
<div>Url: [% l.branchurl %]</div> |
| 414 |
<div> |
| 415 |
Geolocation: <input type="text" id="geolocation_[% l.branchcode %]" name="geolocation_[% l.branchcode %]" value="[% l.geolocation %]" size="35" readonly="readonly" /> |
| 416 |
<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> |
| 417 |
</div> |
| 418 |
</div> |
| 419 |
</li> |
| 420 |
[% END %] |
| 421 |
</ol> |
| 422 |
</fieldset> |
| 423 |
</li> |
| 424 |
<li> |
| 425 |
<label for="MyPublicLink">See your public page: </label> |
| 426 |
[% IF Koha.Preference('UsageStatsPublicID') %] |
| 427 |
[% SET my_url = 'http://hea.koha-community.org/libraries/' _ Koha.Preference('UsageStatsPublicID') %] |
| 428 |
<a href="[% my_url %]">[% my_url %]</a> |
| 429 |
[% ELSE %] |
| 430 |
You do not have anything public yet. |
| 431 |
[% END %] |
| 432 |
</li> |
| 433 |
|
| 356 |
</ol> |
434 |
</ol> |
| 357 |
</fieldset> |
435 |
<div style="clear:right"></div> |
|
|
436 |
<div id="mapid" style="width: 600px; height: 400px; margin-left: 40%:"></div> |
| 437 |
</fieldset> |
| 358 |
|
438 |
|
| 359 |
<fieldset class="action"> |
439 |
<fieldset class="action"> |
| 360 |
<input type="hidden" name="op" value="update" /> |
440 |
<input type="hidden" name="op" value="update" /> |
|
Lines 363-368
Link Here
|
| 363 |
</fieldset> |
443 |
</fieldset> |
| 364 |
</form> |
444 |
</form> |
| 365 |
|
445 |
|
|
|
446 |
<script> |
| 447 |
var map = L.map('mapid').setView([0,0], 1); |
| 448 |
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', { |
| 449 |
maxZoom: 18, |
| 450 |
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
| 451 |
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
| 452 |
'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
| 453 |
id: 'mapbox.streets' |
| 454 |
}).addTo(map); |
| 455 |
|
| 456 |
var default_elt = { 'text': _("Main library"), 'id': 'UsageStatsGeolocation' }; |
| 457 |
var current_elt = default_elt; |
| 458 |
|
| 459 |
// Add the title |
| 460 |
var title = L.control({position: 'topright'}); |
| 461 |
title.onAdd = function (map) { |
| 462 |
this._div = L.DomUtil.create('div', 'title'); |
| 463 |
this.update(); |
| 464 |
return this._div; |
| 465 |
}; |
| 466 |
title.update = function (props) { |
| 467 |
this._div.innerHTML = '<h4>' + _("Click on the map to set the geolocation for %s").format(current_elt.text) + '</h4>'; |
| 468 |
}; |
| 469 |
title.addTo(map); |
| 470 |
|
| 471 |
var markers = {}; |
| 472 |
function add_to_map(elt, latlng) { |
| 473 |
var marker = markers[elt.id]; |
| 474 |
if (marker) map.removeLayer(marker); |
| 475 |
marker = L.marker(latlng).addTo(map); |
| 476 |
marker.bindPopup(elt.text); |
| 477 |
marker.on('mouseover', function (e) {this.openPopup(); }); |
| 478 |
marker.on('mouseout', function (e) {this.closePopup();}); |
| 479 |
markers[elt.id] = marker; |
| 480 |
} |
| 481 |
|
| 482 |
// Init the map |
| 483 |
[% IF Koha.Preference('UsageStatsGeolocation') %] |
| 484 |
var latlng = [ [% Koha.Preference('UsageStatsGeolocation') %] ]; |
| 485 |
add_to_map( current_elt, latlng ); |
| 486 |
[% END %] |
| 487 |
[% FOR l IN libraries %] |
| 488 |
[% NEXT UNLESS l.geolocation %] |
| 489 |
add_to_map( { 'text': "[% l.branchname %]", 'id': "geolocation_[% l.branchcode %]" }, [ [% l.geolocation %] ] ); |
| 490 |
[% END %] |
| 491 |
|
| 492 |
// On click, update the geolocation and the marker |
| 493 |
map.on('click', function(e){ |
| 494 |
add_to_map( current_elt, e.latlng ); |
| 495 |
$("#" + current_elt.id).val(e.latlng.lat + ',' + e.latlng.lng); |
| 496 |
}); |
| 497 |
|
| 498 |
// Auto zoom |
| 499 |
var group = new L.featureGroup(Object.keys(markers).map(function(key){return markers[key]})); |
| 500 |
if ( group.getBounds().isValid() ) map.fitBounds(group.getBounds()); |
| 501 |
|
| 502 |
// On click on the marker icons, update the title of the map |
| 503 |
$(document).ready(function(){ |
| 504 |
$(".change_geolocation").on('click', function(e){ |
| 505 |
e.preventDefault(); |
| 506 |
if ( $(this).data('branchname') ) { |
| 507 |
current_elt = { 'text': $(this).data('branchname'), 'id': $(this).data('id') }; |
| 508 |
} else { |
| 509 |
current_elt = default_elt; |
| 510 |
} |
| 511 |
title.update(); |
| 512 |
}); |
| 513 |
$("#UsageStatsLibrariesInfo").change(); |
| 514 |
}); |
| 515 |
|
| 516 |
$("#UsageStatsLibrariesInfo").on('change', function(){ |
| 517 |
if ( $(this).val() == 1 ) $("#libraries_info").show() |
| 518 |
else $("#libraries_info").hide(); |
| 519 |
}); |
| 520 |
|
| 521 |
</script> |
| 522 |
|
| 366 |
</div> |
523 |
</div> |
| 367 |
</div> |
524 |
</div> |
| 368 |
<div class="yui-b"> |
525 |
<div class="yui-b"> |