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