Bugzilla – Attachment 20684 Details for
Bug 9294
Move JavaScript out of circulation template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
SIGNED OFF: Bug-9294-Move-JavaScript-out-of-circulation-template.patch
0001-Bug-9294-Move-JavaScript-out-of-circulation-template.patch (text/plain), 13.74 KB, created by
Campbell Reid-Tait
on 2013-08-28 04:12:11 UTC
(
hide
)
Description:
SIGNED OFF: Bug-9294-Move-JavaScript-out-of-circulation-template.patch
Filename:
MIME Type:
Creator:
Campbell Reid-Tait
Created:
2013-08-28 04:12:11 UTC
Size:
13.74 KB
patch
obsolete
>From 5b79d3538df553550f1c81cf6658a5d5885aef90 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 15 Aug 2013 16:14:50 -0400 >Subject: [PATCH] Bug 9294 - Move JavaScript out of circulation template > >This patch creates a new js file, js/pages/circulation.js, and begins >the process of moving JavaScript into it from circulation.tt. I have >started the process by focusing on sections which are least dependent on >template variables. > >To test, load a patron for checkout who has something checked out. >There should be no JavaScript errors: > - Tabs should work. > - Showing and hiding the "Add message" form should work. > - The "specify due date" datepicker should work. > - Controls for selecting checkboxes in the checkouts table should work > >Signed-off-by: Campbell Reid-Tait <campbellreidtait@gmail.com> >--- > .../intranet-tmpl/prog/en/js/pages/circulation.js | 139 ++++++++++++++++++ > .../prog/en/modules/circ/circulation.tt | 153 +------------------- > 2 files changed, 146 insertions(+), 146 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js >new file mode 100644 >index 0000000..80e61ca >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/pages/circulation.js >@@ -0,0 +1,139 @@ >+$(document).ready(function() { >+ $('#patronlists').tabs(); >+ var allcheckboxes = $(".checkboxed"); >+ $("#renew_all").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=items]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); >+ }); >+ $("#CheckAllitems").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=items]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; >+ }); >+ $("#CheckNoitems").on("click",function(){ >+ allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; >+ }); >+ $("#CheckAllreturns").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=barcodes]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; >+ }); >+ $("#CheckNoreturns" ).on("click",function(){ >+ allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; >+ }); >+ >+ $("#CheckAllexports").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=biblionumbers]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=items]"); >+ return false; >+ }); >+ $("#CheckNoexports").on("click",function(){ >+ allcheckboxes.unCheckCheckboxes(":input[name*=biblionumbers]"); >+ return false; >+ }); >+ >+ $("#relrenew_all").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=items]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); >+ }); >+ $("#relCheckAllitems").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=items]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; >+ }); >+ $("#relCheckNoitems").on("click",function(){ >+ allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; >+ }); >+ $("#relCheckAllreturns").on("click",function(){ >+ allcheckboxes.checkCheckboxes(":input[name*=barcodes]"); >+ allcheckboxes.unCheckCheckboxes(":input[name*=items]"); return false; >+ }); >+ $("#relCheckNoreturns").on("click",function(){ >+ allcheckboxes.unCheckCheckboxes(":input[name*=barcodes]"); return false; >+ }); >+ $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+MSG_ADD_MESSAGE+"</a>"); >+ $("#borrower_messages .cancel").on("click",function(){ >+ $("#add_message_form").hide(); >+ $("#addmessage").show(); >+ }); >+ $("#addmessage").on("click",function(){ >+ $(this).hide(); >+ $("#add_message_form").show(); >+ }); >+ >+ $("input.radio").on("click",function(){ >+ radioCheckBox($(this)); >+ }); >+ >+ $("#newduedate").datetimepicker({ >+ minDate: 1, // require that renewal date is after today >+ hour: 23, >+ minute: 59 >+ }); >+ $("#duedatespec").datetimepicker({ >+ onClose: function(dateText, inst) { $("#barcode").focus(); }, >+ hour: 23, >+ minute: 59 >+ }); >+ $("#export_submit").on("click",function(){ >+ var export_format = $("#export_formats").val(); >+ export_checkouts(export_format); >+ return false; >+ }); >+ // Clicking the table cell checks the checkbox inside it >+ $("td").on("click",function(e){ >+ if(e.target.tagName.toLowerCase() == 'td'){ >+ $(this).find("input:checkbox:visible").each( function() { >+ if($(this).attr("checked")){ >+ $(this).removeAttr("checked"); >+ } else { >+ $(this).attr("checked","checked"); >+ radioCheckBox($(this)); >+ } >+ }); >+ } >+ }); >+}); >+ >+function export_checkouts(format) { >+ if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){ >+ alert(MSG_EXPORT_SELECT_CHECKOUTS); >+ return; >+ } >+ >+ $("input:checkbox[name='biblionumbers']").each( function(){ >+ var input_item = $(this).siblings("input:checkbox"); >+ if ( $(this).is(":checked") ) { >+ $(input_item).attr("checked", "checked"); >+ } else { >+ $(input_item).attr("checked", ""); >+ } >+ } ); >+ >+ if (format == 'iso2709_995') { >+ format = 'iso2709'; >+ $("#dont_export_item").val(0); >+ } else if (format == 'iso2709') { >+ $("#dont_export_item").val(1); >+ } >+ document.issues.action="/cgi-bin/koha/tools/export.pl"; >+ document.getElementById("export_format").value = format; >+ document.issues.submit(); >+ >+ /* Reset form action to its initial value */ >+ document.issues.action="/cgi-bin/koha/reserve/renewscript.pl"; >+ >+} >+ >+function validate1(date) { >+ var today = new Date(); >+ if ( date < today ) { >+ return true; >+ } else { >+ return false; >+ } >+} >+ >+// prevent adjacent checkboxes from being checked simultaneously >+function radioCheckBox(box){ >+ if($(this).attr("checked")){ >+ $(this).removeAttr("checked"); >+ } >+ } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index f19a8af..4732176 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -19,8 +19,11 @@ > <script type="text/javascript" src="[% themelang %]/js/datatables.js"></script>[% END %] > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> > <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script> >+<script type="text/javascript" src="[% themelang %]/js/pages/circulation.js"></script> > <script type="text/javascript"> > //<![CDATA[ >+var MSG_ADD_MESSAGE = _("Add a new message"); >+var MSG_EXPORT_SELECT_CHECKOUTS = _("You must select checkout(s) to export"); > [% IF ( UseTablesortForCirc && dateformat == 'metric' ) %]dt_add_type_uk_date();[% END %] > [% IF ( borrowernumber ) %]if($.cookie("holdfor") != [% borrowernumber %]){ $.cookie("holdfor",null, { path: "/", expires: 0 }); }[% ELSE %]$.cookie("holdfor",null, { path: "/", expires: 0 });[% END %] > [% UNLESS ( borrowernumber ) %][% UNLESS ( CGIselectborrower ) %]window.onload=function(){ $('#findborrower').focus(); };[% END %][% END %] >@@ -79,56 +82,6 @@ > return printx_window('qslip'); } > });[% END %] > >- >-var allcheckboxes = $(".checkboxed"); >- $("#renew_all").click(function(){ >- $(allcheckboxes).checkCheckboxes(":input[name*=items]"); >- $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); >- }); >- $("#CheckAllitems").click(function(){ >- $(allcheckboxes).checkCheckboxes(":input[name*=items]"); >- $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; >- }); >- $("#CheckNoitems").click(function(){ >- $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; >- }); >- $("#CheckAllreturns").click(function(){ >- $(allcheckboxes).checkCheckboxes(":input[name*=barcodes]"); >- $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; >- }); >- $("#CheckNoreturns" ).click(function(){ >- $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; >- }); >- >- $("#CheckAllexports").click(function(){ >- $(".checkboxed").checkCheckboxes(":input[name*=biblionumbers]"); >- $(".checkboxed").unCheckCheckboxes(":input[name*=items]"); >- return false; >- }); >- $("#CheckNoexports").click(function(){ >- $(".checkboxed").unCheckCheckboxes(":input[name*=biblionumbers]"); >- return false; >- }); >- >- $("#relrenew_all").click(function(){ >- $(allcheckboxes).checkCheckboxes(":input[name*=items]"); >- $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); >- }); >- $("#relCheckAllitems").click(function(){ >- $(allcheckboxes).checkCheckboxes(":input[name*=items]"); >- $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; >- }); >- $("#relCheckNoitems").click(function(){ >- $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; >- }); >- $("#relCheckAllreturns").click(function(){ >- $(allcheckboxes).checkCheckboxes(":input[name*=barcodes]"); >- $(allcheckboxes).unCheckCheckboxes(":input[name*=items]"); return false; >- }); >- $("#relCheckNoreturns").click(function(){ >- $(allcheckboxes).unCheckCheckboxes(":input[name*=barcodes]"); return false; >- }); >- > [% IF ( CAN_user_circulate_override_renewals ) %] > [% IF ( AllowRenewalLimitOverride ) %] > $( '#override_limit' ).click( function () { >@@ -140,102 +93,7 @@ var allcheckboxes = $(".checkboxed"); > } ).attr( 'checked', false ); > [% END %] > [% END %] >- // Clicking the table cell checks the checkbox inside it >- $("td").click(function(e){ >- if(e.target.tagName.toLowerCase() == 'td'){ >- $(this).find("input:checkbox:visible").each( function() { >- if($(this).attr("checked")){ >- $(this).removeAttr("checked"); >- } else { >- $(this).attr("checked","checked"); >- radioCheckBox($(this)); >- } >- }); >- } >- }); >- // prevent adjacent checkboxes from being checked simultaneously >- function radioCheckBox(box){ >- box.parents("td").siblings().find("input:checkbox:visible").each(function(){ >- if($(this).attr("checked")){ >- $(this).removeAttr("checked"); >- } >- }); >- } >- >- $("#messages ul").after("<a href=\"#\" id=\"addmessage\">"+_("Add a new message")+"</a>"); >- $("#borrower_messages .cancel").click(function(){ >- $("#add_message_form").hide(); >- $("#addmessage").show(); >- }); >- $("#addmessage").click(function (){ >- $(this).hide(); >- $("#add_message_form").show(); >- }); >- >- $("input.radio").click(function(){ >- radioCheckBox($(this)); >- }); >- >- $("#newduedate").datetimepicker({ >- minDate: 1, // require that renewal date is after today >- hour: 23, >- minute: 59 >- }); >- $("#duedatespec").datetimepicker({ >- onClose: function(dateText, inst) { $("#barcode").focus(); }, >- hour: 23, >- minute: 59 >- }); >- $("#export_submit").click(function(){ >- var export_format = $("#export_formats").val(); >- export_checkouts(export_format); >- return false; >- }) > }); >- >-function export_checkouts(format) { >- if ($("input:checkbox[name='biblionumbers'][checked]").length < 1){ >- alert(_("You must select a checkout to export")); >- return; >- } >- >- $("input:checkbox[name='biblionumbers']").each( function(){ >- var input_item = $(this).siblings("input:checkbox"); >- if ( $(this).is(":checked") ) { >- $(input_item).attr("checked", "checked"); >- } else { >- $(input_item).attr("checked", ""); >- } >- } ); >- >- if (format == 'iso2709_995') { >- format = 'iso2709'; >- $("#dont_export_item").val(0); >- } else if (format == 'iso2709') { >- $("#dont_export_item").val(1); >- } else { >- [% UNLESS ( export_with_csv_profile ) %] >- alert(_("You must define a csv profile for export (in tools>CSV export profiles) and fill the ExportWithCsvProfile system preference")); >- return false; >- [% END %] >- } >- document.issues.action="/cgi-bin/koha/tools/export.pl"; >- document.getElementById("export_format").value = format; >- document.issues.submit(); >- >- /* Reset form action to its initial value */ >- document.issues.action="/cgi-bin/koha/reserve/renewscript.pl"; >- >-}; >- >-function validate1(date) { >- var today = new Date(); >- if ( date < today ) { >- return true; >- } else { >- return false; >- } >-}; > //]]> > </script> > </head> >@@ -1025,7 +883,10 @@ No patron matched <span class="ex">[% message %]</span> > <select name="export_formats" id="export_formats"> > <option value="iso2709_995">ISO2709 with items</option> > <option value="iso2709">ISO2709 without items</option> >- <option value="csv">CSV</option> >+ [% IF ( export_with_csv_profile ) %] >+ <option value="csv">CSV</option> >+ [% END %] >+ > </select> > <label for="export_remove_fields">Don't export fields:</label> <input type="text" id="export_remove_fields" name="export_remove_fields" value="[% export_remove_fields %]" title="Use for iso2709 exports" /> > <input type="hidden" name="op" value="export" /> >-- >1.7.10.4 >
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 9294
:
14154
|
14251
|
14417
|
16127
|
16303
|
20382
|
20684
|
21090
|
21091
|
21092