Lines 67-72
function load_group_subgroups () {
Link Here
|
67 |
} |
67 |
} |
68 |
} |
68 |
} |
69 |
|
69 |
|
|
|
70 |
function share() { |
71 |
window.location="/cgi-bin/koha/reports/guided_reports.pl?phase=Save"; |
72 |
} |
73 |
|
70 |
$(document).ready(function(){ |
74 |
$(document).ready(function(){ |
71 |
$('#limit').change(function() { |
75 |
$('#limit').change(function() { |
72 |
$('#limitselect').submit(); |
76 |
$('#limitselect').submit(); |
Lines 77-82
$(".goback").on("click",function(e){
Link Here
|
77 |
window.history.back(); |
81 |
window.history.back(); |
78 |
}); |
82 |
}); |
79 |
|
83 |
|
|
|
84 |
$(".mana_search_button").on("click",function(){ |
85 |
mana_search($(this).prev().val()); |
86 |
}); |
87 |
|
88 |
$(".ShareButton").on("click", function(){ |
89 |
if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){ |
90 |
$("#shared_infos").hide(); |
91 |
$("#ManaShareButton").hide(); |
92 |
$("#noterror").show(); |
93 |
} |
94 |
else{ |
95 |
$("#shared_id").html($(this).closest("tr").find(".report_id").text()); |
96 |
$("#shared_name").html($(this).closest("tr").find(".report_name").text()); |
97 |
$("#shared_sql").html($(this).closest("tr").find(".report_sql").val()); |
98 |
$("#shared_type").html($(this).closest("tr").find(".report_type").text()); |
99 |
$("#shared_group").html($(this).closest("tr").find(".report_group").text()); |
100 |
$("#shared_notes").html($(this).closest("tr").find(".report_notes").text()); |
101 |
} |
102 |
}); |
103 |
|
104 |
$('#search_form').submit(function () { |
105 |
return false; |
106 |
}); |
107 |
|
80 |
$("#addColumn").on("click",function(){ |
108 |
$("#addColumn").on("click",function(){ |
81 |
addColumn(); |
109 |
addColumn(); |
82 |
}); |
110 |
}); |
Lines 254-260
$("#delColumn").on("click",function(){
Link Here
|
254 |
}); |
282 |
}); |
255 |
[% END %] |
283 |
[% END %] |
256 |
}); |
284 |
}); |
257 |
//]]> |
285 |
|
|
|
286 |
function mana_increment(mana_id, resourcename, fieldvalue, stepvalue = 1){ |
287 |
$.ajax( { |
288 |
type: "POST", |
289 |
url: "/cgi-bin/koha/svc/mana/addvaluetofield", |
290 |
data: {id: mana_id, field: fieldvalue, resource: resourcename, step: stepvalue}, |
291 |
datatype: "json", |
292 |
}).done( function() { |
293 |
}).fail( function(){ }); |
294 |
} |
295 |
|
296 |
function mana_use( mana_id ){ |
297 |
$.ajax( { |
298 |
type:"POST", |
299 |
url: "/cgi-bin/koha/svc/mana/use", |
300 |
data: {id:mana_id, resource: 'report', saveinbase: 1}, |
301 |
dataType: "json", |
302 |
}) |
303 |
.done( function (result){ |
304 |
window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL"); |
305 |
}) |
306 |
.fail( function ( foo, msg, longmsg){ |
307 |
}); |
308 |
} |
309 |
|
310 |
function mana_search( textquery ){ |
311 |
$.ajax({ |
312 |
type: "POST", |
313 |
url: "/cgi-bin/koha/svc/mana/search", |
314 |
data: {biblionumber: $("#biblionumber").val(), resource: 'report', id: textquery, usecomments: 1}, |
315 |
dataType: "html", |
316 |
}) |
317 |
.done( function( result ) { |
318 |
$("#mana_search_result .modal-body").html(result); |
319 |
$("#mana_search_result_label").text("Results from Mana Knowledge Base"); |
320 |
$("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{ |
321 |
"sPaginationType":"four_button", |
322 |
"autoWidth": false, |
323 |
"columnDefs": [ |
324 |
{ "width": "35%", "targets": 1 } |
325 |
], |
326 |
"aoColumnDefs": [ |
327 |
{ 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, |
328 |
{ "sType": "title-string", "aTargets" : [ "title-string" ] }, |
329 |
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } |
330 |
] |
331 |
})); |
332 |
if($("td.dataTables_empty").length == 0){ |
333 |
$("#mana_search").show(); |
334 |
} |
335 |
|
336 |
$( "select[class='actionreport1']" ).show(); |
337 |
$( "button[class='actionreport2']" ).hide(); |
338 |
$("#CommentButton").on("click", function(){ |
339 |
var resource_type = "report"; |
340 |
var target_id = $("#selected_id").val(); |
341 |
var manamsg = $("#manamsg").val(); |
342 |
mana_comment(target_id, manamsg, resource_type); |
343 |
$("#comment_box").modal("hide"); |
344 |
}); |
345 |
|
346 |
$(".showbutton").on("click", function(){ |
347 |
$(this).parent().hide(); |
348 |
$(this).parent().next().show(); |
349 |
}); |
350 |
|
351 |
$("a[class='hidebutton']").on("click", function(){ |
352 |
$(this).parent().hide(); |
353 |
$(this).parent().prev().show(); |
354 |
}); |
355 |
|
356 |
$("#commentCloseButton").on("click", function(){ |
357 |
$("#comment_box").modal("hide"); |
358 |
}); |
359 |
|
360 |
$(".actionreport1").on("click", function(){ |
361 |
$("#selectedcomment").val($(this).val()); |
362 |
$(this).parent("select").hide(); |
363 |
$(this).parent("select").next().show(); |
364 |
}); |
365 |
|
366 |
$(".actionreport2").on("click", function(){ |
367 |
$(this).hide(); |
368 |
$(this).prev().show(); |
369 |
mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1); |
370 |
}); |
371 |
}).fail( function( result ){ |
372 |
}); |
373 |
} |
374 |
|
375 |
function mana_comment( target_id, manamsg, resource_type ){ |
376 |
$.ajax( { |
377 |
type: "POST", |
378 |
url: "/cgi-bin/koha/svc/mana/share", |
379 |
data: {message: manamsg, resource: resource_type , resource_id: target_id}, |
380 |
datatype: "json", |
381 |
}) |
382 |
} |
383 |
|
384 |
|
385 |
|
258 |
</script> |
386 |
</script> |
259 |
</head> |
387 |
</head> |
260 |
<body id="rep_guided_reports_start" class="rep"> |
388 |
<body id="rep_guided_reports_start" class="rep"> |
Lines 338-348
canned reports and writing custom SQL reports.</p>
Link Here
|
338 |
</form> |
466 |
</form> |
339 |
[% END %] |
467 |
[% END %] |
340 |
|
468 |
|
|
|
469 |
<<<<<<< be4951d946ddf3f143ff8901144c5eb70d83bbde |
341 |
[% IF report_converted %] |
470 |
[% IF report_converted %] |
342 |
<div class="dialog message"> |
471 |
<div class="dialog message"> |
343 |
The report "[% report_converted %]" has been converted. |
472 |
The report "[% report_converted %]" has been converted. |
344 |
</div> |
473 |
</div> |
345 |
[% END %] |
474 |
[% END %] |
|
|
475 |
======= |
476 |
<div id="mana_search_result" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;"> |
477 |
<div class="modal-dialog modal-lg"> |
478 |
<div class="modal-content"> |
479 |
<div class="modal-header"> |
480 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
481 |
<h3 id="mana_search_result_label"> Mana Search</h3> |
482 |
</div> |
483 |
<div> |
484 |
<form id="search_form" style="margin-left: 5%"> |
485 |
Please enter a few key words: |
486 |
<input type=text id=mana_search_field> |
487 |
<input type=button class="mana_search_button" value="Search"> |
488 |
</form> |
489 |
<div class="modal-body"> |
490 |
</div> |
491 |
</div> |
492 |
</div> |
493 |
</div> |
494 |
</div> |
495 |
|
496 |
>>>>>>> Bug 17047 SQL reports management with Mana-KB |
346 |
|
497 |
|
347 |
[% IF ( saved1 ) %] |
498 |
[% IF ( saved1 ) %] |
348 |
[% IF ( savedreports ) %]<h1>Saved reports</h1> |
499 |
[% IF ( savedreports ) %]<h1>Saved reports</h1> |
Lines 361-366
canned reports and writing custom SQL reports.</p>
Link Here
|
361 |
<option value="">All</option> |
512 |
<option value="">All</option> |
362 |
</select> |
513 |
</select> |
363 |
</div> |
514 |
</div> |
|
|
515 |
<div style="display:inline-block"> |
516 |
[% IF (manamsg == 'success') %] |
517 |
<div id="mana_search" class="dialog message"> |
518 |
<p> Shared successfully! Thanks for your help.</p> |
519 |
</div> |
520 |
[% ELSIF (manamsg == 'fail') %] |
521 |
<div id="mana_search" class="dialog message"> |
522 |
<p> An error occured while sharing, please try again later.</p> |
523 |
</div> |
524 |
[% END %] |
525 |
|
526 |
[% IF (Koha.Preference('Mana') == 1) %] |
527 |
<div id="mana_search" class="dialog message"> |
528 |
<p> You want more reports? Check the Mana Knowledge Base <p> <a style="cursor:pointer" data-toggle="modal" data-target="#mana_search_result">Quick Search</a></p> |
529 |
</div> |
530 |
[% END %] |
531 |
|
532 |
</script> |
533 |
<h1> [% savedreport.sql %]</h1> |
364 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post"> |
534 |
<form action="/cgi-bin/koha/reports/guided_reports.pl" id="reports_form" method="post"> |
365 |
<input type="hidden" name="phase" value="Delete Multiple" /> |
535 |
<input type="hidden" name="phase" value="Delete Multiple" /> |
366 |
<table id="table_reports"> |
536 |
<table id="table_reports"> |
Lines 387-409
canned reports and writing custom SQL reports.</p>
Link Here
|
387 |
<tbody> |
557 |
<tbody> |
388 |
[% FOREACH savedreport IN savedreports %] |
558 |
[% FOREACH savedreport IN savedreports %] |
389 |
[% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %] |
559 |
[% UNLESS ( loop.odd ) %]<tr class="odd">[% ELSE %]<tr>[% END %] |
390 |
<td> |
560 |
<td class="report_checkbox"> |
391 |
[% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS --> |
561 |
[% IF ( CAN_user_reports_delete_reports ) %] <!-- not break CSS --> |
392 |
<input type="checkbox" name="ids" value="[% savedreport.id %]" /> |
562 |
<input type="checkbox" name="ids" value="[% savedreport.id %]" /> |
393 |
[% END %] |
563 |
[% END %] |
|
|
564 |
<input hidden class="report_sql" value="[% savedreport.savedsql %]"> |
394 |
</td> |
565 |
</td> |
395 |
<td><label for="ids">[% savedreport.id %]</label></td> |
566 |
<td class="report_id"><label for="ids">[% savedreport.id %]</label></td> |
396 |
<td> |
567 |
<td class="report_name"> |
397 |
[% IF ( savedreport.report_name ) %] |
568 |
[% IF ( savedreport.report_name ) %] |
398 |
[% savedreport.report_name %] |
569 |
[% savedreport.report_name %] |
399 |
[% ELSE %] |
570 |
[% ELSE %] |
400 |
[ no name ] |
571 |
[ no name ] |
401 |
[% END %] |
572 |
[% END %] |
402 |
</td> |
573 |
</td> |
403 |
<td>[% savedreport.type %]</td> |
574 |
<td class="report_type">[% savedreport.type %]</td> |
404 |
<td>[% savedreport.groupname %]</td> |
575 |
<td class="report_group">[% savedreport.groupname %]</td> |
405 |
<td>[% savedreport.subgroupname %]</td> |
576 |
<td>[% savedreport.subgroupname %]</td> |
406 |
<td>[% savedreport.notes %]</td> |
577 |
<td class="report_notes">[% savedreport.notes %]</td> |
407 |
<td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td> |
578 |
<td>[% savedreport.borrowersurname %][% IF ( savedreport.borrowerfirstname ) %], [% savedreport.borrowerfirstname %][% END %] ([% savedreport.borrowernumber %])</td> |
408 |
<td><span title="[% savedreport.date_created %]">[% savedreport.date_created | $KohaDates %]</span></td> |
579 |
<td><span title="[% savedreport.date_created %]">[% savedreport.date_created | $KohaDates %]</span></td> |
409 |
<td><span title="[% savedreport.last_modified %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span></td> |
580 |
<td><span title="[% savedreport.last_modified %]">[% savedreport.last_modified | $KohaDates with_hours => 1 %]</span></td> |
Lines 443-448
canned reports and writing custom SQL reports.</p>
Link Here
|
443 |
<li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li> |
614 |
<li><a href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Edit%20SQL"><i class="fa fa-pencil"></i> Edit</a></li> |
444 |
<li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li> |
615 |
<li><a title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&sql=[% savedreport.savedsql |uri %]&reportname=[% savedreport.report_name |uri %]&notes=[% savedreport.notes |uri %]"><i class="fa fa-copy"></i> Duplicate</a></li> |
445 |
[% END %] |
616 |
[% END %] |
|
|
617 |
[% IF (Koha.Preference('Mana') == 1) %] |
618 |
<li><a class="ShareButton" data-toggle="modal" href="#mana_share_report" title="Share your report with Mana Knowledge Base"><i class="fa fa-share-alt"></i> Share</a></li> |
619 |
[% END %] |
446 |
<li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id %]"><i class="fa fa-clock-o"></i> Schedule</a></li> |
620 |
<li><a href="/cgi-bin/koha/tools/scheduler.pl?id=[% savedreport.id %]"><i class="fa fa-clock-o"></i> Schedule</a></li> |
447 |
[% IF ( CAN_user_reports_delete_reports ) %] |
621 |
[% IF ( CAN_user_reports_delete_reports ) %] |
448 |
<li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li> |
622 |
<li><a class="confirmdelete" title="Delete this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% savedreport.id %]&phase=Delete%20Saved"><i class="fa fa-trash"></i> Delete</a></li> |
Lines 455-460
canned reports and writing custom SQL reports.</p>
Link Here
|
455 |
[% END %] |
629 |
[% END %] |
456 |
</tbody> |
630 |
</tbody> |
457 |
</table> |
631 |
</table> |
|
|
632 |
</div> |
458 |
[% IF ( CAN_user_reports_delete_reports ) %] |
633 |
[% IF ( CAN_user_reports_delete_reports ) %] |
459 |
<fieldset class="action"> |
634 |
<fieldset class="action"> |
460 |
<input type="submit" value="Delete selected" /> |
635 |
<input type="submit" value="Delete selected" /> |
Lines 495-500
canned reports and writing custom SQL reports.</p>
Link Here
|
495 |
[% END %] |
670 |
[% END %] |
496 |
[% END %] |
671 |
[% END %] |
497 |
|
672 |
|
|
|
673 |
<div id="mana_share_report" class="modal fade" tabindex="-1" role="dialog" arialabelledby="mana_share_modal_label" style="display: none;"> |
674 |
<div class="modal-dialog"> |
675 |
<div class="modal-content"> |
676 |
<div class="modal-header"> |
677 |
<h3 id="mana_share_modal_label">Share with Mana</h3> |
678 |
</div> |
679 |
<div class="modal-body"> |
680 |
[% IF (mana_id) %] |
681 |
<div class="alert"> |
682 |
<p>Your subscription is already linked with a Mana subscription model. Share it if you have made modifications, otherwise it will do nothing.</p> |
683 |
</div> |
684 |
[% END %] |
685 |
[% IF ( languages_loop ) %] |
686 |
[% UNLESS ( one_language_enabled ) %] |
687 |
<label id="noteerror" type="hidden">Please enter a report name and descriptive note before sharing (minimum 20 characters)</label> |
688 |
<div id="shared_infos" class="rows"> |
689 |
<li> <span class="label">Id: </span><div id="shared_id"></div> |
690 |
</li> |
691 |
<li> <span class="label">Name: </span><div id="shared_name"></div> |
692 |
</li> |
693 |
<li> <span class="label">SQL: </span><div id="shared_sql"></div> |
694 |
</li> |
695 |
<li> <span class="label">Group: </span><div id="shared_group"></div> |
696 |
</li> |
697 |
<li> <span class="label">Type: </span><div id="shared_type"></div> |
698 |
</li> |
699 |
<li> <span class="label">Notes: </span><div id="shared_notes"></div> |
700 |
</li> |
701 |
|
702 |
</div> |
703 |
<div class="rows"> |
704 |
<form method="post" id="mana_share_form" action="/cgi-bin/koha/reports/guided_reports.pl?phase=Share" class="validated" > |
705 |
<input type="hidden" name="phase" value="Share"> |
706 |
|
707 |
<fieldset> |
708 |
<label for="mana_language">Language:</label> |
709 |
<select id="mana_language" name="mana_language"> |
710 |
[% FOREACH languages_loo IN languages_loop %] |
711 |
[% IF ( languages_loo.group_enabled ) %] |
712 |
[% IF ( languages_loo.plural ) %] |
713 |
[% FOREACH sublanguages_loo IN languages_loo.sublanguages_loop %] |
714 |
[% IF ( sublanguages_loo.enabled ) %] |
715 |
[% IF ( sublanguages_loo.sublanguage_current ) %] |
716 |
<option value="[% languages_loo.rfc4646_subtag %]" selected> |
717 |
[% sublanguages_loo.native_description %] |
718 |
[% sublanguages_loo.script_description %] |
719 |
[% sublanguages_loo.region_description %] |
720 |
|
721 |
[% sublanguages_loo.variant_description %] |
722 |
([% sublanguages_loo.rfc4646_subtag %]) |
723 |
</option> |
724 |
[% ELSE %] |
725 |
<option value="[% languages_loo.rfc4646_subtag %]"> |
726 |
[% sublanguages_loo.native_description %] |
727 |
[% sublanguages_loo.script_description %] |
728 |
[% sublanguages_loo.region_description %] |
729 |
[% sublanguages_loo.variant_description %] |
730 |
([% sublanguages_loo.rfc4646_subtag %]) |
731 |
</option> |
732 |
[% END %] |
733 |
[% END %] |
734 |
[% END %] |
735 |
[% ELSE %] |
736 |
[% IF ( languages_loo.group_enabled ) %] |
737 |
[% IF ( languages_loo.current ) %] |
738 |
<option value="[% languages_loo.rfc4646_subtag %]" selected> |
739 |
[% IF ( languages_loo.native_description ) %] |
740 |
[% languages_loo.native_description %] |
741 |
[% ELSE %] |
742 |
[% languages_loo.rfc4646_subtag %] |
743 |
[% END %] |
744 |
</option> |
745 |
[% ELSE %] |
746 |
<option value="[% languages_loo.rfc4646_subtag %]"> |
747 |
[% IF ( languages_loo.native_description ) %] |
748 |
[% languages_loo.native_description %] |
749 |
[% ELSE %] |
750 |
[% languages_loo.rfc4646_subtag %] |
751 |
[% END %] |
752 |
</option> |
753 |
[% END %] |
754 |
[% END %] |
755 |
[% END %] |
756 |
[% END %] |
757 |
[% END %] |
758 |
</select> |
759 |
<input type="hidden" id="reportid" name="reportid" value="[% savedreport.id %]"/> |
760 |
</fieldset> |
761 |
</form> |
762 |
</div> |
763 |
[% END %] |
764 |
[% END %] |
765 |
</div> |
766 |
<div class="modal-footer"> |
767 |
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> |
768 |
[% IF one_language_enabled==0 %] |
769 |
<button id="ManaShareButton" type="submit" form="mana_share_form" class="btn btn-primary">Share</button> |
770 |
[% ELSE %] |
771 |
<div id="ManaShareButton" class="btn-group"><a class="btn btn-primary"'onclick="share()">Share</a></div> |
772 |
[% END %] |
773 |
</div> |
774 |
</div> |
775 |
</div> |
776 |
</div> |
777 |
|
498 |
|
778 |
|
499 |
[% IF ( build1 ) %] |
779 |
[% IF ( build1 ) %] |
500 |
[% IF ( cache_error) %] |
780 |
[% IF ( cache_error) %] |