Bugzilla – Attachment 52645 Details for
Bug 16602
Remove the use of "onclick" from several templates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16602 - Remove the use of "onclick" from several templates
Bug-16602---Remove-the-use-of-onclick-from-several.patch (text/plain), 11.52 KB, created by
Jonathan Druart
on 2016-06-21 13:02:59 UTC
(
hide
)
Description:
Bug 16602 - Remove the use of "onclick" from several templates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-06-21 13:02:59 UTC
Size:
11.52 KB
patch
obsolete
>From f6dda6002d658a71ade7b9192006937d50aed8f9 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 11 May 2016 08:56:15 -0400 >Subject: [PATCH] Bug 16602 - Remove the use of "onclick" from several > templates >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This patch removes the use of "onclick" from several templates, instead >defining click events in JavaScript. > >Also changed: Some markup corrections. > >To test, apply the patch and: > >- Go to Circulation -> Upload offline circulation file > - Browse for an offline circulation file. > - Clicking the 'Upload file' button should work correctly. > - After uploading a file, both the 'Add to offline circulation > queue' and 'Apply directly' buttons should work to trigger their > corresponding processes (keeping Bug 16603 in mind). > >- Go to Patrons -> Patron lists. > - For any patron list containing patrons, click the 'Print patron > cards' menu item. This should trigger a modal window which exports > the correct list. > >- Go to Tools -> Batch item modification. > - Submit a batch of items for modification. > - Clicking the 'Save' button should trigger the background job and the > items should be successfully modified. > >- Go to Tools -> Batch item deletion. > - Submit a batch of items for deletion. > - Clicking the 'Delete' button should trigger the background job and > the items should be successfully deleted. > >- Go to Tools -> Calendar. > - Trigger the 'Add new holiday' panel by clicking a day on the > calendar which has no holiday defined. > - Clicking the 'Cancel' link should hide the panel. > - Trigger the 'Edit this holiday' panel by clicking a day which has a > holiday defined. > - Clicking the 'Cancel' link should hide the panel. > >Signed-off-by: Frédéric Demians <f.demians@tamil.fr> > Everything works as previously. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../prog/en/modules/offline_circ/process_koc.tt | 19 ++++++++++++++++--- > .../prog/en/modules/patron_lists/lists.tt | 11 ++++++++--- > .../prog/en/modules/tools/batchMod-del.tt | 9 +++++++-- > .../prog/en/modules/tools/batchMod-edit.tt | 8 +++++--- > .../intranet-tmpl/prog/en/modules/tools/holidays.tt | 13 ++++++++++--- > 5 files changed, 46 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt >index 6fdf5ce..a126288 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/offline_circ/process_koc.tt >@@ -10,6 +10,17 @@ var xhr; > $(document).ready(function(){ > $("#enqueuefile").hide(); > $("#processfile").hide(); >+ $("#upload_file").on("click",function(){ >+ StartUpload(); >+ }); >+ $("#queueformsubmit").on("click",function(){ >+ var processfile = document.getElementById("processfile"); >+ return CheckForm( processfile ); >+ }); >+ $("#mainformsubmit").on("click",function(){ >+ var enqueuefile = document.getElementById("enqueuefile"); >+ return CheckForm( enqueuefile ); >+ }); > }); > > function StartUpload() { >@@ -89,11 +100,13 @@ function CheckForm(f) { > <h2>Upload offline circulation data</h2> > > <div id="fileuploadform"> >- <form method="post" action="[% SCRIPT_NAME %]" enctype="multipart/form-data"> >+ <form method="post" action="/cgi-bin/koha/offline_circ/process_koc.pl" enctype="multipart/form-data" class="validated"> > <fieldset class="brief"> > <ol><li><label for="fileToUpload">Choose .koc file: </label> >- <input type="file" id="fileToUpload" size="50" name="fileToUpload" /></li></ol> >- <fieldset class="action"><input type="button" class="submit" value="Upload file" onclick="StartUpload();return false;" /></fieldset> >+ <input class="required" required="required" type="file" id="fileToUpload" size="50" name="fileToUpload" /> >+ <span class="required">Required</span> >+ </li></ol> >+ <fieldset class="action"><input type="button" class="submit" value="Upload file" id="upload_file" /></fieldset> > </fieldset> > </form> > <div id="fileuploadstatus" style="display:none">Upload progress: <progress id="fileuploadprogress" min="0" max="100" value="0"></progress> <span class="fileuploadpercent">0</span>%</div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >index 8dd0b60..f8c0a03 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/patron_lists/lists.tt >@@ -20,6 +20,11 @@ > var list = $(this).data("list-name"); > return confirmDelete( _("Are you sure you want to delete the list %s?").format(list) ); > }); >+ $(".print_cards").on("click",function(e){ >+ e.preventDefault(); >+ var patron_list_id = $(this).data("patron_list_id"); >+ GB_showCenter(_("Print patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?patronlist_id=" + patron_list_id, 400, 800); >+ }); > }); > //]]> > </script> >@@ -71,18 +76,18 @@ > <li><a class="delete_patron" href="/cgi-bin/koha/patron_lists/delete.pl?patron_list_id=[% l.patron_list_id %]" data-list-name="[% l.name %]"><i class="fa fa-trash"></i> Delete list</a></li> > [% IF ( l.patron_list_patrons_rs.count ) %] > <li class="divider"></li> >- <li><a href="#" onclick='GB_showCenter(_("Print patron cards from list"), "/cgi-bin/koha/patroncards/print.pl?patronlist_id=[% l.patron_list_id %]", 400, 800);return false;'><i class="fa fa-print"></i> Print patron cards</a></li> >+ <li><a href="#" class="print_cards" data-patron_list_id="[% l.patron_list_id %]"><i class="fa fa-print"></i> Print patron cards</a></li> > [% IF CAN_user_tools_edit_patrons %] > <li> > <a href="/cgi-bin/koha/tools/modborrowers.pl?patron_list_id=[% l.patron_list_id %]&op=show"> >- <i class="fa fa-pencil"></i> Batch edit patrons</i> >+ <i class="fa fa-pencil"></i> Batch edit patrons > </a> > </li> > [% END %] > [% IF CAN_user_tools_delete_anonymize_patrons %] > <li> > <a href="/cgi-bin/koha/tools/cleanborrowers.pl?step=2&patron_list_id=[% l.patron_list_id %]&checkbox=borrower"> >- <i class="fa fa-trash"></i> Batch delete patrons</i> >+ <i class="fa fa-trash"></i> Batch delete patrons > </a> > </li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >index c813469..e339e3a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-del.tt >@@ -15,6 +15,11 @@ var allColumns = new Array([% FOREACH item_header_loo IN item_header_loop %]'[% > for( x=0; x<allColumns.length; x++ ){ > allColumns[x] = Number(allColumns[x]) + 2; > } >+$(document).ready(function(){ >+ $("#mainformsubmit").on("click",function(){ >+ return submitBackgroundJob(this.form); >+ }); >+}); > //]]> > </script> > <!--[if IE]> >@@ -137,9 +142,9 @@ for( x=0; x<allColumns.length; x++ ){ > </div> > <input type="checkbox" name="del_records" id="del_records" /> <label for="del_records">Delete records if no items remain.</label> > [% IF too_many_items %] >- <input type="submit" name="mainformsubmit" value="Delete ALL submitted items" onclick="return submitBackgroundJob(this.form);" /> >+ <input type="submit" id="mainformsubmit" name="mainformsubmit" value="Delete ALL submitted items" /> > [% ELSE %] >- <input type="submit" name="mainformsubmit" value="Delete selected items" onclick="return submitBackgroundJob(this.form);" /> >+ <input type="submit" id="mainformsubmit" name="mainformsubmit" value="Delete selected items" /> > [% END %] > > <a href="/cgi-bin/koha/tools/batchMod.pl?del=1" class="cancel">Cancel</a> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >index 8d46d53..67bd83f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >@@ -31,7 +31,9 @@ $(document).ready(function(){ > $("#"+row).html(""); > } > }); >- >+ $("#mainformsubmit").on("click",function(){ >+ return submitBackgroundJob(this.form); >+ }); > }); > //]]> > </script> >@@ -235,8 +237,8 @@ $(document).ready(function(){ > <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div> > <div id="jobfailed"></div> > </div> >- <input type="submit" name="mainformsubmit" value="Save" onclick="return submitBackgroundJob(this.form);" /> >- <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel" onclick="history.back();return false;">Cancel</a> >+ <input type="submit" id="mainformsubmit" value="Save" /> >+ <a href="/cgi-bin/koha/tools/batchMod.pl" class="cancel">Cancel</a> > </fieldset> > </div> > [% ELSE %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >index 1f15b64..fbb4e65 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/holidays.tt >@@ -191,7 +191,14 @@ > dateChanged($(this).datepicker("getDate")); > }, > defaultDate: new Date("[% keydate %]") >- }); >+ }); >+ $(".hidePanel").on("click",function(){ >+ if( $(this).hasClass("showHoliday") ){ >+ hidePanel("showHoliday"); >+ } else { >+ hidePanel("newHoliday"); >+ } >+ }) > }); > //]]> > </script> >@@ -309,7 +316,7 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > </ol> > <fieldset class="action"> > <input type="submit" name="submit" value="Save" /> >- <a href="#" class="cancel" onclick=" hidePanel('showHoliday');">Cancel</a> >+ <a href="#" class="cancel hidePanel showHoliday">Cancel</a> > </fieldset> > </fieldset> > </form> >@@ -380,7 +387,7 @@ td.repeatableyearly a.ui-state-default { background: #FFCC66 none; color : Bl > </li></ol> > <fieldset class="action"> > <input type="submit" name="submit" value="Save" /> >- <a href="#" class="cancel" onclick=" hidePanel('newHoliday');">Cancel</a> >+ <a href="#" class="cancel hidePanel newHoliday">Cancel</a> > </fieldset> > </fieldset> > </form> >-- >2.8.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16602
:
51845
|
51893
| 52645