Lines 5-10
Link Here
|
5 |
<ul class="dropdown-menu"> |
5 |
<ul class="dropdown-menu"> |
6 |
<li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li> |
6 |
<li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li> |
7 |
<li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li> |
7 |
<li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li> |
|
|
8 |
[% IF Koha.Preference('Mana')==1 %] |
9 |
<li id="newsql"><a href="" data-toggle="modal" data-target="#mana_search_result">New SQL from Mana</a> </li> |
10 |
[% END %] |
8 |
</ul> |
11 |
</ul> |
9 |
</div> |
12 |
</div> |
10 |
[% END %] |
13 |
[% END %] |
Lines 60-71
Link Here
|
60 |
[% END %] |
63 |
[% END %] |
61 |
</div> |
64 |
</div> |
62 |
|
65 |
|
|
|
66 |
|
67 |
[% IF Koha.Preference('Mana')==1 %] |
68 |
<div id="mana_search_result" class="modal fade container-fluid" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="width: 100%; left:0%; margin-left: auto; display: none;"> |
69 |
<div class="modal-dialog modal-lg"> |
70 |
<div class="modal-content"> |
71 |
<div class="modal-header"> |
72 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
73 |
<h3 id="mana_search_result_label"> Mana Search</h3> |
74 |
</div> |
75 |
<div> |
76 |
<form id="search_form" style="margin-left: 5%"> |
77 |
Please enter a few key words: |
78 |
<input type=text id=mana_search_field> |
79 |
<input type=button class="mana_search_button" value="Search"> |
80 |
</form> |
81 |
<div class="modal-body"> |
82 |
</div> |
83 |
</div> |
84 |
</div> |
85 |
</div> |
86 |
</div> |
87 |
[% END %] |
88 |
|
89 |
|
90 |
|
63 |
<script type="text/javascript"> |
91 |
<script type="text/javascript"> |
64 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); |
92 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); |
65 |
|
|
|
66 |
$(document).ready(function(){ |
93 |
$(document).ready(function(){ |
67 |
$(".delete").on("click",function(){ |
94 |
$(".delete").on("click",function(){ |
68 |
return confirmDelete(MSG_CONFIRM_DELETE); |
95 |
return confirmDelete(MSG_CONFIRM_DELETE); |
69 |
}); |
96 |
}); |
70 |
}); |
97 |
}); |
71 |
</script> |
98 |
</script> |
|
|
99 |
|
100 |
<script type="text/javascript"> |
101 |
$(document).ready( function(){ |
102 |
$(".mana_search_button").on("click",function(){ |
103 |
mana_search($("#mana_search_field").val()); |
104 |
}); |
105 |
}); |
106 |
|
107 |
$('#search_form').on( "submit", function(event) { |
108 |
event.preventDefault(); |
109 |
mana_search($(this).children("#mana_search_field").val()); |
110 |
}); |
111 |
|
112 |
function mana_increment(mana_id, resourcename, fieldvalue, stepvalue = 1){ |
113 |
$.ajax( { |
114 |
type: "POST", |
115 |
url: "/cgi-bin/koha/svc/mana/addvaluetofield", |
116 |
data: {id: mana_id, field: fieldvalue, resource: resourcename, step: stepvalue}, |
117 |
datatype: "json", |
118 |
}).done( function() { |
119 |
}).fail( function(){ alert("") }); |
120 |
} |
121 |
|
122 |
function mana_use( mana_id ){ |
123 |
$.ajax( { |
124 |
type:"POST", |
125 |
url: "/cgi-bin/koha/svc/mana/use", |
126 |
data: {id:mana_id, resource: 'report', saveinbase: 1}, |
127 |
dataType: "json", |
128 |
}) |
129 |
.done( function (result){ |
130 |
if ( result.errmsg ){ |
131 |
alert( result.errmsg ); |
132 |
} |
133 |
else{ |
134 |
window.location = ("/cgi-bin/koha/reports/guided_reports.pl?reports=").concat(result.id).concat("&phase=Show%20SQL&mana_success=1"); |
135 |
} |
136 |
}) |
137 |
.fail( function ( foo, msg, longmsg, bla ){ |
138 |
}); |
139 |
} |
140 |
|
141 |
function mana_search( textquery ){ |
142 |
$.ajax({ |
143 |
type: "POST", |
144 |
url: "/cgi-bin/koha/svc/mana/search", |
145 |
data: {biblionumber: $("#biblionumber").val(), resource: 'report', id: textquery, usecomments: 1}, |
146 |
dataType: "html", |
147 |
}) |
148 |
.done( function( result ) { |
149 |
$("#mana_search_result .modal-body").html(result); |
150 |
$("#mana_search_result_label").text("Results from Mana Knowledge Base"); |
151 |
$("#mana_results_datatable").dataTable($.extend(true, {}, dataTablesDefaults,{ |
152 |
"sPaginationType":"four_button", |
153 |
"autoWidth": false, |
154 |
"columnDefs": [ |
155 |
{ "width": "35%", "targets": 1 } |
156 |
], |
157 |
"aoColumnDefs": [ |
158 |
{ 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, |
159 |
{ "sType": "title-string", "aTargets" : [ "title-string" ] }, |
160 |
{ 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } |
161 |
] |
162 |
})); |
163 |
if($("td.dataTables_empty").length == 0){ |
164 |
$("#mana_search").show(); |
165 |
} |
166 |
|
167 |
$( "select[class='actionreport1']" ).show(); |
168 |
$( "button[class='actionreport2']" ).hide(); |
169 |
$("#CommentButton").on("click", function(){ |
170 |
var resource_type = "report"; |
171 |
var target_id = $("#selected_id").val(); |
172 |
var manamsg = $("#manamsg").val(); |
173 |
mana_comment(target_id, manamsg, resource_type); |
174 |
$("#comment_box").modal("hide"); |
175 |
}); |
176 |
|
177 |
$(".showbutton").on("click", function(){ |
178 |
$(this).parent().hide(); |
179 |
$(this).parent().next().show(); |
180 |
}); |
181 |
|
182 |
$("a[class='hidebutton']").on("click", function(){ |
183 |
$(this).parent().hide(); |
184 |
$(this).parent().prev().show(); |
185 |
}); |
186 |
|
187 |
$("#commentCloseButton").on("click", function(){ |
188 |
$("#comment_box").modal("hide"); |
189 |
}); |
190 |
|
191 |
$(".actionreport1").on("click", function(){ |
192 |
$("#selectedcomment").val($(this).val()); |
193 |
$(this).parent("select").hide(); |
194 |
$(this).parent("select").next().show(); |
195 |
}); |
196 |
|
197 |
$(".actionreport2").on("click", function(){ |
198 |
$(this).hide(); |
199 |
$(this).prev().show(); |
200 |
mana_increment($("#selectedcomment").val(), 'resource_comment', 'nb', -1); |
201 |
}); |
202 |
}).fail( function( result ){ |
203 |
}); |
204 |
} |
205 |
|
206 |
function mana_comment( target_id, manamsg, resource_type ){ |
207 |
$.ajax( { |
208 |
type: "POST", |
209 |
url: "/cgi-bin/koha/svc/mana/share", |
210 |
data: {message: manamsg, resource: resource_type , resource_id: target_id}, |
211 |
datatype: "json", |
212 |
}) |
213 |
} |
214 |
|
215 |
|
216 |
|
217 |
</script> |