Bug 17083: Remove more event attributes from tools templates

This patch removes event attributes from several tool-related templates.
Events are defined instead in the JavaScript.

To test, apply the patch and:

- Go to Tools -> Label creator -> Manage -> Layouts and edit any layout.
  - In the "Font" setting, choose any font which includes the word
    "italic" or "oblique" in the name. Doing so should disable the
    "Oblique title" checkbox.
- Go to Tools -> Batch patron deletion/anonymization.
  - Submit the form without making any changes. You should be prompted
    to select an action.
- Go to Tools -> Inventory.
  - Select a batch of barcodes to upload.
  - Submit the form without selecting any filters. This should trigger a
    warning.
  - Also changed: Added Font Awesome icons to the "Select all" and
    "Clear all" links on the inventory results view.
- Go to Tools -> Notices and Slips.
  - Click "New notice"
  - Change the selection under "Koha module." The page should reload
    with the correct available message body fields. For instance,
    selecting "Holds" should make available reserves.* columns.
- Go to Tools -> Upload.
  - In the search form, enter a search term and click the 'Search'
    button. The form should submit.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Event attributes removed

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2016-08-05 15:01:55 -04:00 committed by Kyle M Hall
parent 3d84252c04
commit 12beaef4b3
5 changed files with 34 additions and 27 deletions

View file

@ -10,11 +10,14 @@
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Tools &rsaquo; Label creator &rsaquo; Layouts &rsaquo; [% IF ( layout_id ) %]Edit ([% layout_id %])[% ELSE %]New[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/JavaScript" language="JavaScript">
<script type="text/JavaScript">
//<![CDATA[
$(document).ready(function() {
$("input[name='layout_choice']").change( function() { layout_method() } );
layout_method();
$("#font").on("change",function(){
checkOblique();
});
});
function layout_method() {
if( $("input[name='layout_choice']:checked").val() == 'layout_string' ) {
@ -173,7 +176,7 @@
</li>
<li>
<label for="font">Font: </label>
<select name="font" id="font" onchange="checkOblique()">
<select name="font" id="font">
[% FOREACH font_type IN font_types %]
[% IF ( font_type.selected ) %]
<option value="[% font_type.type %]" selected="selected">[% font_type.name %]</option>

View file

@ -6,7 +6,11 @@
[% INCLUDE 'doc-head-close.inc' %]
[% INCLUDE 'calendar.inc' %]
<script type="text/javascript">
// <![CDATA[
$(document).ready(function(){
$("#delete_patrons_form").on("submit",function(){
return checkForm( this );
});
});
/**
* checkForm(form)
* This function check the form is correctly filled.
@ -20,7 +24,7 @@
}
if((form.checkbox[1].checked)){
if(!(form.date2.value)){
alert(_("please enter a date!"));
alert(_("Please enter a date!"));
return false;
}
}
@ -30,22 +34,6 @@
}
return true;
}
/**
* checkForm2(form)
* This function check the form2 is correctly filled.
*/
function checkForm2(form) {
return true;
}
$(document).ready(function() {
$('#selectlibrary').find("input:submit").hide();
$('#branch').change(function() {
$('#selectlibrary').submit();
});
});
// ]]>
</script>
</head>
@ -90,7 +78,7 @@
<p>This tool allows you to delete patrons and anonymize checkout history. For deleting patrons, any combination of limits can be used.</p>
</div>
<div id="step1">
<form name="f1" onsubmit="return checkForm(this);" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
<form name="f1" id="delete_patrons_form" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
<fieldset>
<legend>Delete patrons</legend>
<h3><input id="checkborrower" type="checkbox" name="checkbox" value="borrower" /><label for="checkborrower"> Verify you want to delete patrons</label></h3>
@ -167,7 +155,7 @@
[% IF step == 2 %]
<!-- STEP 2 START -->
<div id="step2">
<form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post" onsubmit="return checkForm2(this);">
<form name="f2" action="/cgi-bin/koha/tools/cleanborrowers.pl" method="post">
<fieldset>
<legend>Warnings</legend>
<ul>

View file

@ -86,6 +86,9 @@ $(document).ready(function(){
$(".checkboxed").unCheckCheckboxes();
return false;
});
$("#inventory_form").on("submit",function(){
return checkForm();
});
});
//]]>
</script>
@ -120,7 +123,7 @@ $(document).ready(function(){
[% END %]
[% UNLESS op %]
<div class="yui-g">
<form method="post" action="/cgi-bin/koha/tools/inventory.pl" enctype="multipart/form-data" onsubmit="return checkForm()">
<form method="post" id="inventory_form" action="/cgi-bin/koha/tools/inventory.pl" enctype="multipart/form-data">
<fieldset class="rows">
<legend>Use a barcode file</legend>
<ol>
@ -231,7 +234,7 @@ $(document).ready(function(){
<input type="hidden" name="datelastseen" value="[% datelastseen %]" />
[% UNLESS compareinv2barcd %]
<div><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div>
<div><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
[% END %]
<table id="inventoryt">
@ -299,7 +302,7 @@ $(document).ready(function(){
</table>
<div class="spacer"></div>
[% UNLESS compareinv2barcd %]
<div style="padding : .3em 0"><a href="#" class="checkall">[Select all]</a> <a href="#" class="clearall">[Clear all]</a></div>
<div style="padding : .3em 0"><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
<input type="submit" id="markseenandquit" value="Mark seen and quit" />
<input type="submit" value="Mark seen and continue &gt;&gt;" id="markseenandcontinuebutton" />
<input type="submit" value="Continue without marking &gt;&gt;" id="continuewithoutmarkingbutton" class="submit" />

View file

@ -27,6 +27,15 @@ $(document).ready(function() {
});
[% END %]
$("#newmodule").on("change",function(){
if( $("#branch").val() == ""){
var branchcode = "*";
} else {
var branchcode = $("#branch").val();
}
window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
});
$("#submit_form").click( function(event) {
event.preventDefault();
var at_least_one_exists = 0;
@ -291,7 +300,7 @@ $(document).ready(function() {
<label for="module">Koha module:</label>
<input type="hidden" name="oldmodule" value="[% module %]" />
[% IF adding %]
<select name="module" id="module" onchange="javascript:window.location.href = unescape(window.location.pathname)+'?op=add_form&amp;module='+this.value+'&amp;content='+window.document.forms['Aform'].elements['content'].value;">
<select name="module" id="newmodule">
[% ELSE %]
<select name="module" id="module">
[% END %]

View file

@ -138,7 +138,7 @@
[% BLOCK newsearch %]
<form id="newsearch">
<fieldset class="action">
<button onclick="SubmitMe('new'); return false;">New search</button>
<button id="new_search">New search</button>
</fieldset>
</form>
[% IF plugin %]
@ -337,6 +337,10 @@ $(document).ready(function() {
var record_id = $(this).data("record-id");
DeleteEntry( record_id );
});
$("#new_search").on("click",function(e){
e.preventDefault();
SubmitMe('new');
});
});
//]]>
</script>