Bugzilla – Attachment 66950 Details for
Bug 17893
Move JavaScript to the footer on staff client catalog pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17893 - Move JavaScript to the footer on staff client catalog pages
Bug-17893---Move-JavaScript-to-the-footer-on-staff.patch (text/plain), 85.79 KB, created by
Owen Leonard
on 2017-09-07 16:53:06 UTC
(
hide
)
Description:
Bug 17893 - Move JavaScript to the footer on staff client catalog pages
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-09-07 16:53:06 UTC
Size:
85.79 KB
patch
obsolete
>From 85fd15b40ff8f007907da30c7c5e65b8e3f44a6e Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 12 Jun 2017 11:49:37 +0000 >Subject: [PATCH] Bug 17893 - Move JavaScript to the footer on staff client > catalog pages > >This patch modifies multiple catalog-related pages in order to move >embedded JavaScript to the footer. > >The JavaScript previously embedded in cat-toolbar.inc is moved to a >separate file (catalog.js). > >To test, apply the patch and test JavaScript-driven interactions on all >modified pages, including JS which isn't page-specific (menus, help, >etc). The functionality of the catalog toolbar should be tested on each >page. > >- Bibliographic detail pages (standard, MARC, labeled MARC, ISBD). >- Advanced search page >- Local cover image viewer >- Item search page >- Item detail page >- Search history page >- Checkout history page > >https://bugs.koha-community.org/show_bug.cgi?id=17839 > >Signed-off-by: Lee Jamison <ldjamison@marywood.edu> >--- > .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 129 +---- > .../prog/en/includes/catalog-strings.inc | 30 + > .../prog/en/modules/catalogue/ISBDdetail.tt | 29 +- > .../prog/en/modules/catalogue/MARCdetail.tt | 48 +- > .../prog/en/modules/catalogue/advsearch.tt | 52 +- > .../prog/en/modules/catalogue/detail.tt | 606 ++++++++++----------- > .../prog/en/modules/catalogue/imageviewer.tt | 42 +- > .../prog/en/modules/catalogue/issuehistory.tt | 30 +- > .../prog/en/modules/catalogue/itemsearch.tt | 476 ++++++++-------- > .../prog/en/modules/catalogue/labeledMARCdetail.tt | 49 +- > .../prog/en/modules/catalogue/moredetail.tt | 22 +- > .../prog/en/modules/catalogue/search-history.tt | 218 ++++---- > koha-tmpl/intranet-tmpl/prog/js/catalog.js | 112 ++++ > 13 files changed, 938 insertions(+), 905 deletions(-) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/catalog-strings.inc > create mode 100644 koha-tmpl/intranet-tmpl/prog/js/catalog.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index 3d6b23b..5833978 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -1,130 +1,3 @@ >- <script type="text/javascript"> >- //<![CDATA[ >- [% IF ( CAN_user_editcatalogue_edit_catalogue ) %] >- /* this function open a popup to search on z3950 server. */ >- function PopupZ3950() { >- var strQuery = GetZ3950Terms(); >- if(strQuery){ >- window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); >- } >- } >- function PopupZ3950Confirmed() { >- if (confirm(_("Please note that this external search could replace the current record."))){ >- PopupZ3950(); >- } >- } >- >- /* provide Z3950 search points */ >- function GetZ3950Terms(){ >- var strQuery="&frameworkcode="; >- [% FOREACH z3950_search_param IN z3950_search_params %] >- strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]"; >- [% END %] >- return strQuery; >- } >- [% END %] >- function addToCart() { addRecord('[% biblionumber %]'); } >- function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=[% biblionumber %]','Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes'); >- } >- function printBiblio() {window.print(); } >-[% IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >- function confirm_deletion() { >- var count = [% count %]; >- var holdcount = [% holdcount %]; >- var countorders = [% countorders %]; >- var countdeletedorders = [% countdeletedorders %]; >- var is_confirmed; >- if (count > 0){ >- is_confirmed = alert( _("%s item(s) are attached to this record. You must delete all items before deleting this record.").format(count) ); >- } >- else if (countorders > 0){ >- [% IF ( CAN_user_acquisition_order_manage ) %] >- is_confirmed = confirm( _("Warning: This record is used in %s order(s). Deleting it could cause serious issues on acquisition module. Are you sure you want to delete this record?").format(countorders) ); >- [% ELSE %] >- is_confirmed = alert( _("%s order(s) are using this record. You need order managing permissions to delete this record.").format(countorders) ); >- [% END %] >- } >- else if (countdeletedorders > 0){ >- [% IF ( CAN_user_acquisition_order_manage ) %] >- is_confirmed = confirm( _("%s deleted order(s) are using this record. Are you sure you want to delete this record?").format(countdeletedorders) ); >- [% ELSE %] >- is_confirmed = alert( _("%s deleted order(s) are using this record. You need order managing permissions to delete this record.").format(countdeletedorders) ); >- [% END %] >- } >- else if ( holdcount > 0 ) { >- is_confirmed = confirm( _("%s holds(s) for this record. Are you sure you want to delete this record?").format(holdcount) ); >- } else { >- is_confirmed = confirm(_("Are you sure you want to delete this record?")); >- } >- if (is_confirmed) { >- window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=[% biblionumber %]"; >- } else { >- return false; >- } >- } >-[% END %] >- >-[% IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) %] >- function confirm_items_deletion() { >- var count = [% count %]; >- var holdcount = [% holdcount %]; >- >- if ( holdcount > 0 ) { >- alert( _("%s hold(s) on this record. You must delete all holds before deleting all items.").format(holdcount) ); >- } else if ( count > 0 ) { >- if( confirm( _("Are you sure you want to delete the %s attached items?").format(count) ) ) { >- window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=[% biblionumber %]"; >- } else { >- return false; >- } >- } else { >- alertNoItems(); >- return false; >- } >- } >- function alertNoItems(){ >- alert(_("This record has no items.")); >- } >-[% END %] >- $(document).ready(function() { >- $("#z3950copy").click(function(){ >- PopupZ3950(); >- return false; >- }); >- $("#deletebiblio").click(function(){ >- confirm_deletion(); >- return false; >- }); >- $("#deleteallitems").click(function(){ >- confirm_items_deletion(); >- return false; >- }); >- $("#printbiblio").click(function(){ >- printBiblio(); >- return false; >- }); >- $("#addtocart").click(function(){ >- addToCart(); >- $(".btn-group").removeClass("open"); >- return false; >- }); >- $("#addtoshelf").click(function(){ >- addToShelf(); >- $(".btn-group").removeClass("open"); >- return false; >- }); >- $("#export").remove(); // Hide embedded export form if JS menus available >- $("#deletebiblio").tooltip(); >- $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled") >- .on("click",function(e){ >- e.preventDefault(); >- alertNoItems(); >- }) >- .tooltip(); >- }); >- //]]> >- </script> >- > <div id="toolbar" class="btn-toolbar"> > > [% IF ( CAN_user_editcatalogue_edit_catalogue || CAN_user_editcatalogue_edit_items || >@@ -195,7 +68,7 @@ CAN_user_serials_create_subscription ) %] > [% IF ( count ) %] > <li class="disabled"><a id="deletebiblio" data-toggle="tooltip" data-placement="left" title="[% count %] item(s) are attached to this record. You must delete all items before deleting this record." href="#">Delete record</a></li> > [% ELSE %] >- <li><a id="deletebiblio" href="#">Delete record</a></li> >+ <li><a id="deletebiblio" data-order-manage="[% CAN_user_acquisition_order_manage %]" href="#">Delete record</a></li> > [% END %] > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/catalog-strings.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/catalog-strings.inc >new file mode 100644 >index 0000000..5e92ac0 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/catalog-strings.inc >@@ -0,0 +1,30 @@ >+<script type="text/javascript"> >+ /* Strings for translation */ >+ var MSG_REPLACE_RECORD = _("Please note that this external search could replace the current record."); >+ var MSG_DELETE_ALL_ITEMS = _("%s item(s) are attached to this record. You must delete all items before deleting this record."); >+ var CONFIRM_USED_IN_ORDERS = _("Warning: This record is used in %s order(s). Deleting it could cause serious issues on acquisition module. Are you sure you want to delete this record?"); >+ var MSG_USED_IN_ORDERS = _("%s order(s) are using this record. You need order managing permissions to delete this record."); >+ var CONFIRM_IN_DELETED_ORDERS = _("%s deleted order(s) are using this record. Are you sure you want to delete this record?"); >+ var MSG_IN_DELTED_ORDERS = _("%s deleted order(s) are using this record. You need order managing permissions to delete this record."); >+ var CONFIRM_DELETION_HOLDS = _("%s holds(s) for this record. Are you sure you want to delete this record?"); >+ var CONFIRM_RECORD_DELETION = _("Are you sure you want to delete this record?"); >+ var MSG_DELETE_ALL_HOLDS = _("%s hold(s) on this record. You must delete all holds before deleting all items."); >+ var CONFIRM_DELETE_ITEMS = _("Are you sure you want to delete the %s attached items?"); >+ var MSG_NO_ITEMS = _("This record has no items."); >+ >+ /* Some required variables from the template */ >+ var biblionumber = [% biblionumber %]; >+ var count = [% count %]; >+ var holdcount = [% holdcount %]; >+ var countorders = [% countorders %]; >+ var countdeletedorders = [% countdeletedorders %]; >+ >+ /* provide Z3950 search points */ >+ function GetZ3950Terms(){ >+ var strQuery="&frameworkcode="; >+ [% FOREACH z3950_search_param IN z3950_search_params %] >+ strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]"; >+ [% END %] >+ return strQuery; >+ } >+</script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt >index abe3ea2..eb76911 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/ISBDdetail.tt >@@ -1,23 +1,13 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › > [% IF ( unknownbiblionumber ) %] > Unknown record > [% ELSE %] >- ISBD details for [% title | html %] >+ ISBD details > [% END %] > </title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'browser-strings.inc' %] >-<!--[if lt IE 9]> >-<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >-<![endif]--> >-<script type="text/javascript" src="[% interface %]/js/browser.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >- var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >- browser.show(); >-//]]> >-</script> > </head> > <body id="catalog_ISBDdetail" class="catalog"> > >@@ -28,7 +18,7 @@ > [% IF ( unknownbiblionumber ) %] > Unknown record > [% ELSE %] >- ISBD details for <i>[% biblionumber %]</i> >+ ISBD details > [% END %] > </div> > >@@ -55,5 +45,16 @@ > </div> > </div> > [% END %] >-</div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'catalog-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/catalog.js"></script> >+ [% INCLUDE 'browser-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/js/browser.js"></script> >+ <script type="text/javascript"> >+ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >+ browser.show(); >+ </script> >+[% END %] >+<!-- the main div is closed in intranet-bottom.inc --> > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >index 004d77f..abc6266 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › > [% IF ( unknownbiblionumber ) %] >@@ -7,31 +8,8 @@ > [% END %] > </title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'browser-strings.inc' %] >-<!--[if lt IE 9]> >-<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >-<![endif]--> >-<script type="text/javascript" src="[% interface %]/js/browser.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >- var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >- browser.show(); >- >- $(document).ready(function() { >- $('#bibliotabs').tabs(); >- $("#Frameworks").on("change",function(){ >- Changefwk(this); >- }); >- }); >- >-function Changefwk(FwkList) { >- var fwk = FwkList.options[FwkList.selectedIndex].value; >- window.location = "MARCdetail.pl?biblionumber=[% biblionumber %]&frameworkcode="+fwk; >-} >- >-//]]> >-</script> > </head> >+ > <body id="catalog_MARCdetail" class="catalog"> > > [% INCLUDE 'header.inc' %] >@@ -197,4 +175,26 @@ function Changefwk(FwkList) { > </div> > [% END %] > </div> >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'catalog-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/catalog.js"></script> >+ [% INCLUDE 'browser-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/js/browser.js"></script> >+ <script type="text/javascript"> >+ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >+ browser.show(); >+ >+ $(document).ready(function() { >+ $('#bibliotabs').tabs(); >+ $("#Frameworks").on("change",function(){ >+ Changefwk(this); >+ }); >+ }); >+ >+ function Changefwk(FwkList) { >+ var fwk = FwkList.options[FwkList.selectedIndex].value; >+ window.location = "MARCdetail.pl?biblionumber=[% biblionumber %]&frameworkcode="+fwk; >+ } >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >index 6a7e045..8425f59 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -1,27 +1,10 @@ > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › Advanced search</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> >-<script type="text/JavaScript" language="JavaScript"> >- /** >- * Function add_field(); >- * This function allows to display a new field to search. >- */ >- function add_field() { >- var ButtonPlus = document.getElementById("ButtonPlus"); >- var line = ButtonPlus.parentNode; >- var dad = line.parentNode; >- dad.appendChild(line.cloneNode(true)); >- line.removeChild(ButtonPlus); >- } >- $(document).ready(function() { >- $("input[name=q]:eq(0)").focus(); >- $('#advsearches').tabs(); >- $('#toolbar').fixFloat(); >- }); >-</script> > </head> >+ > <body id="catalog_advsearch" class="catalog"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'adv-search.inc' %] >@@ -253,7 +236,7 @@ > </fieldset> > > <fieldset id="select-libs"> >- <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop" onchange='if(this.value != ""){document.getElementById("categoryloop").disabled=true;} else {document.getElementById("categoryloop").disabled=false;}'> >+ <p><label for="branchloop">Individual libraries:</label><select name="limit" id="branchloop"> > <option value="">All libraries</option> > [%# FIXME Should not we filter the libraries displayed? %] > [% PROCESS options_for_libraries libraries => Branches.all( selected => selected_branchcode, unfiltered => 1 ) %] >@@ -286,4 +269,33 @@ > </form> > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> >+ <script type="text/JavaScript"> >+ /** >+ * Function add_field(); >+ * This function allows to display a new field to search. >+ */ >+ function add_field() { >+ var ButtonPlus = document.getElementById("ButtonPlus"); >+ var line = ButtonPlus.parentNode; >+ var dad = line.parentNode; >+ dad.appendChild(line.cloneNode(true)); >+ line.removeChild(ButtonPlus); >+ } >+ $(document).ready(function() { >+ $("input[name=q]:eq(0)").focus(); >+ $('#advsearches').tabs(); >+ $('#toolbar').fixFloat(); >+ $("#branchloop").on("change",function(){ >+ if( this.value != ""){ >+ document.getElementById("categoryloop").disabled=true; >+ } else { >+ document.getElementById("categoryloop").disabled=false; >+ } >+ }); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 1c26c37..be5932b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -23,8 +23,8 @@ > [% END %] > [% END %] > >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >-[% INCLUDE 'greybox.inc' %] > <title>Koha › Catalog › > [% IF ( unknownbiblionumber ) %] > Unknown record >@@ -32,316 +32,8 @@ > Details for [% title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] > [% END %] > </title> >- >-[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectProfile') && ( normalized_isbn || normalized_upc ) ) %] >- <script type="text/javascript" src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script> >-[% END %] >- >-[% INCLUDE 'doc-head-close.inc' %]<script type="text/JavaScript"> >-//<![CDATA[ >-// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html >-function verify_images() { >- $("#bookcoverimg").each(function(i){ >- $(this).find('img').each(function(i){ >- if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { >- w = this.width; >- h = this.height; >- if ((w == 1) || (h == 1)) { >- $("#amazon-bookcoverimg").remove(); >- $(".yui-gb").attr("class","yui-g"); >- } else if ((this.complete != null) && (!this.complete)) { >- $("#amazon-bookcoverimg").remove(); >- $(".yui-gb").attr("class","yui-g"); >- } >- } >- }); >- if( $(this).find('img').length < 1 ) $(this).remove(); >- }); >- $("#editions img").each(function(i){ >- if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { >- w = this.width; >- h = this.height; >- if ((w == 1) || (h == 1)) { >- this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >- } else if ((this.complete != null) && (!this.complete)) { >- this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >- } >- } >- }); >-} >- >- function removeLocalImage(imagenumber) { >- >- $.ajax({ >- url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + [% biblionumber %] + "&imagenumber=" + imagenumber, >- success: function(data) { >- $(data).each( function(i) { >- if ( this.deleted == 1 ) { >- $('#imagenumber-' + this.imagenumber).remove(); >- } >- if ( $('ul.thumbnails > li').length == 0 ) { >- showNoImageMessage(); >- } >- }); >- }, >- error: function(data) { >- alert(_("An error occurred on deleting this image")); >- } >- }); >- >- } >- >- function showNoImageMessage() { >- >- var no_images_msg = _("No images have been uploaded for this bibliographic record yet."); >- no_images_msg = '<p>' + no_images_msg + '</p>'; >- [% IF ( CAN_user_tools_upload_local_cover_images ) %] >- var please_upload = _("Please select the image file to upload. %sUpload%s").format( >- "<a class='btn btn-default btn-xs' href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&filetype=image'><i class='fa fa-upload' aria-hidden='true'></i> ", >- "</a>"); >- no_images_msg += "<p id='upload_image'>" + please_upload + '</p>'; >- [% END %] >- >- $('#images').html(no_images_msg); >- } >- >- [% IF StaffDetailItemSelection %] >- >- function itemSelectionBuildDeleteLink(div) { >- var itemnumbers = new Array(); >- $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { >- itemnumbers.push($(this).val()); >- }); >- if (itemnumbers.length > 0) { >- var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1'; >- url += '&itemnumber=' + itemnumbers.join('&itemnumber='); >- url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; >- $('a.itemselection_action_delete').attr('href', url); >- } else { >- return false; >- } >- return true >- } >- >- function itemSelectionBuildModifyLink(div) { >- var itemnumbers = new Array(); >- $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { >- itemnumbers.push($(this).val()); >- }); >- if (itemnumbers.length > 0) { >- var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; >- url += '&itemnumber=' + itemnumbers.join('&itemnumber='); >- url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; >- $('a.itemselection_action_modify').attr('href', url); >- } else { >- return false; >- } >- return true; >- } >- >- function itemSelectionBuildActionLinks(tab) { >- var div = $("#" + tab); >- var delete_link_ok = itemSelectionBuildDeleteLink(div); >- var modify_link_ok = itemSelectionBuildModifyLink(div); >- if (modify_link_ok || delete_link_ok) { >- $('.itemselection_actions', div).show(); >- } else { >- $('.itemselection_actions', div).hide(); >- } >- } >- >- $(document).ready(function() { >- >- $('table.items_table').each(function() { >- var div = $(this).parent().attr("id"); >- itemSelectionBuildActionLinks(div); >- }); >- >- $("input[name='itemnumber'][type='checkbox']").change(function() { >- var div = $(this).parents('table').parent().parent().attr("id"); >- itemSelectionBuildActionLinks(div); >- }); >- >- $(".SelectAll").on("click",function(e){ >- e.preventDefault(); >- var tab = $(this).data("tab"); >- $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true); >- itemSelectionBuildActionLinks(tab); >- }); >- >- $(".ClearAll").on("click",function(e){ >- e.preventDefault(); >- var tab = $(this).data("tab"); >- $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false); >- itemSelectionBuildActionLinks(tab); >- }); >- >- }); >- [% END %] >- >- $(document).ready(function() { >- $('#bibliodetails').tabs(); >- [% IF count == 0 %] >- $('#bibliodetails').tabs("option", "active", 3); >- [% END %] >- $('#search-form').focus(); >- $('.thumbnails > li > a > span.remove').click(function() { >- var result = confirm(_("Are you sure you want to delete this cover image?")); >- >- if ( result == true ) { >- var imagenumber = $(this).parent().parent().attr('id').split('-')[1]; >- removeLocalImage(imagenumber); >- } >- >- return false; >- }); >- [%# inject no images message %] >- [% IF ( LocalCoverImages && ! localimages.0 ) %] >- showNoImageMessage(); >- [% END %] >- [% IF LocalCoverImages %] >- KOHA.LocalCover.GetCoverFromBibnumber(true); >- [% END %] >- $("body").on("click",".previewMARC", function(e){ >- e.preventDefault(); >- var page = $(this).attr("href"); >- $("#marcPreview .modal-body").load(page + " table"); >- $('#marcPreview').modal({show:true}); >- }); >- $("#marcPreview").on("hidden", function(){ >- $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >- }); >- [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectProfile') && ( normalized_isbn || normalized_upc ) ) %] >- novSelect.loadContentForQuery( >- { >- ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]', >- ISBN : '[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]', >- version : '2.1' >- }, >- '[% Koha.Preference('NovelistSelectProfile') %]', >- '[% Koha.Preference('NovelistSelectPassword') %]', >- function(d){ >- if ( d.length > 0 ){ //If no content >- $(".NovelistSelect").show(); >- } >- }); >- [% END %] >- >- }); >- >- [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() { >- verify_images(); >- });[% END %] >-//]]> >-</script> >+[% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> >-[% INCLUDE 'browser-strings.inc' %] >-<!--[if lt IE 9]> >-<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >-<![endif]--> >-<script type="text/javascript" src="[% interface %]/js/browser.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >- var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >- browser.show(); >- >- function activate_filters(id) { >- var table = $("#" + id + " table"); >- if (table.length == 1) { >- filters_row = table.find('thead tr.filters_row'); >- >- var aoColumns = []; >- filters_row.find('th').each(function() { >- if(this.className === "NoSort"){ >- aoColumns.push(null); >- } else { >- aoColumns.push('text'); >- } >- }); >- >- if (table.find('thead tr.columnFilter').length == 0) { >- table.dataTable().columnFilter({ >- 'sPlaceHolder': 'head:after' >- , 'aoColumns': aoColumns >- }); >- filters_row.addClass('columnFilter'); >- } >- filters_row.show(); >- } >- >- $('#' + id + '_activate_filters') >- .html('<i class="fa fa-filter"></i> ' + _("Deactivate filters") ) >- .unbind('click') >- .click(function() { >- deactivate_filters(id); >- return false; >- }); >- } >- >- function deactivate_filters(id) { >- filters_row = $("#" + id + " table").find('thead tr.filters_row'); >- >- filters_row.find('input[type="text"]') >- .val('') // Empty filter text boxes >- .trigger('keyup') // Filter (display all rows) >- .trigger('blur'); // Reset value to the column name >- filters_row.hide(); >- >- $('#' + id + '_activate_filters') >- .html('<i class="fa fa-filter"></i> ' + _("Activate filters") ) >- .unbind('click') >- .click(function() { >- activate_filters(id); >- return false; >- }); >- } >- >- $(document).ready(function() { >- var ids = ['holdings', 'otherholdings']; >- for (var i in ids) { >- var id = ids[i]; >- var table = $('#' + id + ' table'); >- >- // Duplicate the table header row for columnFilter >- thead_row = table.find('thead tr'); >- clone = thead_row.clone().addClass('filters_row'); >- clone.find("th.NoSort").html(''); >- thead_row.before(clone); >- >- // Enable sorting >- table.dataTable($.extend(true, {}, dataTablesDefaults, { >- 'sDom': 't', >- 'bPaginate': false, >- 'bAutoWidth': false, >- "aoColumnDefs": [ >- { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] } >- ] >- })); >- >- // Show a link to activate filtering >- link = $('<a>') >- .attr('href', '#') >- .attr('id', id + '_activate_filters'); >- $("." + id + "_table_controls").prepend(link); >- deactivate_filters(id); >- } >- [% IF Koha.Preference('AcquisitionDetails') %] >- $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { >- 'sDom': 't', >- 'bPaginate': false, >- 'bAutoWidth': false, >- "aaSorting": [[ 4, "desc" ]], >- "aoColumnDefs": [ >- { "aTargets": "title-string", "sType": "title-string" } >- ] >- })); >- >- [% END %] >- }); >-//]]> >-</script> > </head> > > <body id="catalog_detail" class="catalog"> >@@ -1154,4 +846,298 @@ function verify_images() { > [% END %] > </div> > >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'catalog-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/catalog.js"></script> >+ [% INCLUDE 'greybox.inc' %] >+ <script type="text/javascript"> >+ // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html >+ function verify_images() { >+ $("#bookcoverimg").each(function(i){ >+ $(this).find('img').each(function(i){ >+ if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { >+ w = this.width; >+ h = this.height; >+ if ((w == 1) || (h == 1)) { >+ $("#amazon-bookcoverimg").remove(); >+ $(".yui-gb").attr("class","yui-g"); >+ } else if ((this.complete != null) && (!this.complete)) { >+ $("#amazon-bookcoverimg").remove(); >+ $(".yui-gb").attr("class","yui-g"); >+ } >+ } >+ }); >+ if( $(this).find('img').length < 1 ) $(this).remove(); >+ }); >+ $("#editions img").each(function(i){ >+ if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { >+ w = this.width; >+ h = this.height; >+ if ((w == 1) || (h == 1)) { >+ this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >+ } else if ((this.complete != null) && (!this.complete)) { >+ this.src = 'https://images-na.ssl-images-amazon.com/images/G/01/x-site/icons/no-img-sm.gif'; >+ } >+ } >+ }); >+ } >+ >+ function removeLocalImage(imagenumber) { >+ $.ajax({ >+ url: "/cgi-bin/koha/svc/cover_images?action=delete&biblionumber=" + biblionumber + "&imagenumber=" + imagenumber, >+ success: function(data) { >+ $(data).each( function(i) { >+ if ( this.deleted == 1 ) { >+ $('#imagenumber-' + this.imagenumber).remove(); >+ } >+ if ( $('ul.thumbnails > li').length == 0 ) { >+ showNoImageMessage(); >+ } >+ }); >+ }, >+ error: function(data) { >+ alert(_("An error occurred on deleting this image")); >+ } >+ }); >+ } >+ >+ function showNoImageMessage() { >+ var no_images_msg = _("No images have been uploaded for this bibliographic record yet."); >+ no_images_msg = '<p>' + no_images_msg + '</p>'; >+ [% IF ( CAN_user_tools_upload_local_cover_images ) %] >+ var please_upload = _("Please select the image file to upload. %sUpload%s").format("<a class='btn btn-default btn-xs' href='/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=" + biblionumber + "&filetype=image'><i class='fa fa-upload' aria-hidden='true'></i> ","</a>"); >+ no_images_msg += "<p id='upload_image'>" + please_upload + '</p>'; >+ [% END %] >+ $('#images').html(no_images_msg); >+ } >+ >+ [% IF StaffDetailItemSelection %] >+ function itemSelectionBuildDeleteLink(div) { >+ var itemnumbers = new Array(); >+ $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { >+ itemnumbers.push($(this).val()); >+ }); >+ if (itemnumbers.length > 0) { >+ var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1'; >+ url += '&itemnumber=' + itemnumbers.join('&itemnumber='); >+ url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; >+ $('a.itemselection_action_delete').attr('href', url); >+ } else { >+ return false; >+ } >+ return true >+ } >+ >+ function itemSelectionBuildModifyLink(div) { >+ var itemnumbers = new Array(); >+ $("input[name='itemnumber'][type='checkbox']:checked", div).each(function() { >+ itemnumbers.push($(this).val()); >+ }); >+ if (itemnumbers.length > 0) { >+ var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; >+ url += '&itemnumber=' + itemnumbers.join('&itemnumber='); >+ url += '&src=' + '[% "/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber" |uri %]'; >+ $('a.itemselection_action_modify').attr('href', url); >+ } else { >+ return false; >+ } >+ return true; >+ } >+ >+ function itemSelectionBuildActionLinks(tab) { >+ var div = $("#" + tab); >+ var delete_link_ok = itemSelectionBuildDeleteLink(div); >+ var modify_link_ok = itemSelectionBuildModifyLink(div); >+ if (modify_link_ok || delete_link_ok) { >+ $('.itemselection_actions', div).show(); >+ } else { >+ $('.itemselection_actions', div).hide(); >+ } >+ } >+ >+ $(document).ready(function() { >+ $('table.items_table').each(function() { >+ var div = $(this).parent().attr("id"); >+ itemSelectionBuildActionLinks(div); >+ }); >+ >+ $("input[name='itemnumber'][type='checkbox']").change(function() { >+ var div = $(this).parents('table').parent().parent().attr("id"); >+ itemSelectionBuildActionLinks(div); >+ }); >+ >+ $(".SelectAll").on("click",function(e){ >+ e.preventDefault(); >+ var tab = $(this).data("tab"); >+ $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true); >+ itemSelectionBuildActionLinks(tab); >+ }); >+ >+ $(".ClearAll").on("click",function(e){ >+ e.preventDefault(); >+ var tab = $(this).data("tab"); >+ $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false); >+ itemSelectionBuildActionLinks(tab); >+ }); >+ }); >+ [% END %] >+ >+ $(document).ready(function() { >+ $('#bibliodetails').tabs(); >+ [% IF count == 0 %] >+ $('#bibliodetails').tabs("option", "active", 3); >+ [% END %] >+ $('#search-form').focus(); >+ $('.thumbnails > li > a > span.remove').click(function() { >+ var result = confirm(_("Are you sure you want to delete this cover image?")); >+ >+ if ( result == true ) { >+ var imagenumber = $(this).parent().parent().attr('id').split('-')[1]; >+ removeLocalImage(imagenumber); >+ } >+ >+ return false; >+ }); >+ [%# inject no images message %] >+ [% IF ( LocalCoverImages && ! localimages.0 ) %] >+ showNoImageMessage(); >+ [% END %] >+ [% IF LocalCoverImages %] >+ KOHA.LocalCover.GetCoverFromBibnumber(true); >+ [% END %] >+ $("body").on("click",".previewMARC", function(e){ >+ e.preventDefault(); >+ var page = $(this).attr("href"); >+ $("#marcPreview .modal-body").load(page + " table"); >+ $('#marcPreview').modal({show:true}); >+ }); >+ $("#marcPreview").on("hidden", function(){ >+ $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); >+ }); >+ [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectProfile') && ( normalized_isbn || normalized_upc ) ) %] >+ novSelect.loadContentForQuery({ >+ ClientIdentifier : '[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]', >+ ISBN : '[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]', >+ version : '2.1' >+ }, >+ '[% Koha.Preference('NovelistSelectProfile') %]', >+ '[% Koha.Preference('NovelistSelectPassword') %]', >+ function(d){ >+ if ( d.length > 0 ){ //If no content >+ $(".NovelistSelect").show(); >+ } >+ }); >+ [% END %] >+ >+ }); >+ >+ [% IF ( AmazonCoverImages || LocalCoverImages ) %]$(window).load(function() { >+ verify_images(); >+ });[% END %] >+ </script> >+ [% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectProfile') && ( normalized_isbn || normalized_upc ) ) %] >+ <script type="text/javascript" src="https://imageserver.ebscohost.com/novelistselect/ns2init.js"></script> >+ [% END %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> >+ [% INCLUDE 'browser-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/js/browser.js"></script> >+ <script type="text/javascript"> >+ var browser = KOHA.browser('[% searchid %]', parseInt(biblionumber, 10)); >+ browser.show(); >+ >+ function activate_filters(id) { >+ var table = $("#" + id + " table"); >+ if (table.length == 1) { >+ filters_row = table.find('thead tr.filters_row'); >+ >+ var aoColumns = []; >+ filters_row.find('th').each(function() { >+ if(this.className === "NoSort"){ >+ aoColumns.push(null); >+ } else { >+ aoColumns.push('text'); >+ } >+ }); >+ >+ if (table.find('thead tr.columnFilter').length == 0) { >+ table.dataTable().columnFilter({ >+ 'sPlaceHolder': 'head:after' >+ , 'aoColumns': aoColumns >+ }); >+ filters_row.addClass('columnFilter'); >+ } >+ filters_row.show(); >+ } >+ >+ $('#' + id + '_activate_filters') >+ .html('<i class="fa fa-filter"></i> ' + _("Deactivate filters") ) >+ .unbind('click') >+ .click(function() { >+ deactivate_filters(id); >+ return false; >+ }); >+ } >+ >+ function deactivate_filters(id) { >+ filters_row = $("#" + id + " table").find('thead tr.filters_row'); >+ >+ filters_row.find('input[type="text"]') >+ .val('') // Empty filter text boxes >+ .trigger('keyup') // Filter (display all rows) >+ .trigger('blur'); // Reset value to the column name >+ filters_row.hide(); >+ >+ $('#' + id + '_activate_filters') >+ .html('<i class="fa fa-filter"></i> ' + _("Activate filters") ) >+ .unbind('click') >+ .click(function() { >+ activate_filters(id); >+ return false; >+ }); >+ } >+ >+ $(document).ready(function() { >+ var ids = ['holdings', 'otherholdings']; >+ for (var i in ids) { >+ var id = ids[i]; >+ var table = $('#' + id + ' table'); >+ >+ // Duplicate the table header row for columnFilter >+ thead_row = table.find('thead tr'); >+ clone = thead_row.clone().addClass('filters_row'); >+ clone.find("th.NoSort").html(''); >+ thead_row.before(clone); >+ >+ // Enable sorting >+ table.dataTable($.extend(true, {}, dataTablesDefaults, { >+ 'sDom': 't', >+ 'bPaginate': false, >+ 'bAutoWidth': false, >+ "aoColumnDefs": [ >+ { "bSortable": false, "bSearchable": false, 'aTargets': [ 'NoSort' ] } >+ ] >+ })); >+ >+ // Show a link to activate filtering >+ link = $('<a>') >+ .attr('href', '#') >+ .attr('id', id + '_activate_filters'); >+ $("." + id + "_table_controls").prepend(link); >+ deactivate_filters(id); >+ } >+ [% IF Koha.Preference('AcquisitionDetails') %] >+ $("#orders").dataTable($.extend(true, {}, dataTablesDefaults, { >+ 'sDom': 't', >+ 'bPaginate': false, >+ 'bAutoWidth': false, >+ "aaSorting": [[ 4, "desc" ]], >+ "aoColumnDefs": [ >+ { "aTargets": "title-string", "sType": "title-string" } >+ ] >+ })); >+ [% END %] >+ }); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >index 7e6fffd..09ea60f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt >@@ -1,26 +1,8 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › Details for [% biblio.title |html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield %][% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% IF ( LocalCoverImages == 1 ) %] >-<script type="text/JavaScript"> >-//<![CDATA[ >- >-$(document).ready(function(){ >- showCover([% imagenumber %]); >- $(".show_cover").on("click",function(e){ >- e.preventDefault(); >- var coverimg = $(this).data("coverimg"); >- showCover(coverimg); >- }); >-}); >- >-function showCover(img) { >- $('.thumbnail').attr('class', 'thumbnail'); >- $('#largeCoverImg').attr('src', '/cgi-bin/koha/catalogue/image.pl?imagenumber=' + img); >- $('#' + img + '.thumbnail').attr('class', 'thumbnail selected'); >-} >-//]]> >-</script> > <style type="text/css"> > #largeCoverImg { > border : 1px solid #CCCCCC; >@@ -105,4 +87,26 @@ img.thumbnail { > [% INCLUDE 'biblio-view-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'catalog-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/catalog.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ showCover([% imagenumber %]); >+ $(".show_cover").on("click",function(e){ >+ e.preventDefault(); >+ var coverimg = $(this).data("coverimg"); >+ showCover(coverimg); >+ }); >+ }); >+ >+ function showCover(img) { >+ $('.thumbnail').attr('class', 'thumbnail'); >+ $('#largeCoverImg').attr('src', '/cgi-bin/koha/catalogue/image.pl?imagenumber=' + img); >+ $('#' + img + '.thumbnail').attr('class', 'thumbnail selected'); >+ } >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >index b1245b7..83c60cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/issuehistory.tt >@@ -1,23 +1,13 @@ > [% USE Koha %] > [% USE KohaDates %] > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › Checkout history for [% biblio.title |html %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript" id="js"> >-$(document).ready(function() { >- $("#table_issues").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "sType": "title-string", "aTargets" : [ "title-string" ] } >- ], >- "aaSorting": [[ 4, "desc" ]], >- "sPaginationType": "full_numbers" >- })); >-}); </script> >- > </head> >+ > <body id="catalog_issuehistory" class="catalog"> > > [% INCLUDE 'header.inc' %] >@@ -103,4 +93,20 @@ $(document).ready(function() { > [% INCLUDE 'biblio-view-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+[% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" id="js"> >+ $(document).ready(function() { >+ $("#table_issues").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "sType": "title-string", "aTargets" : [ "title-string" ] } >+ ], >+ "aaSorting": [[ 4, "desc" ]], >+ "sPaginationType": "full_numbers" >+ })); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index 10a48a7..4b9fcee 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -98,247 +98,14 @@ > > [%# Page starts here %] > >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › Item search</title> > [% INCLUDE 'doc-head-close.inc' %] >- <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >- [% INCLUDE 'datatables.inc' %] >- <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> >- <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/itemsearchform.css" /> >- <script type="text/javascript"> >- //<![CDATA[ >- var authorised_values = [% authorised_values_json %]; >- >- function loadAuthorisedValuesSelect(select) { >- var selected = select.find('option:selected'); >- var category = selected.data('authorised-values-category'); >- var form_field_value = select.siblings('.form-field-value'); >- if (category && category in authorised_values) { >- var values = authorised_values[category]; >- var html = '<select name="q" class="form-field-value">\n'; >- for (i in values) { >- var value = values[i]; >- html += '<option value="' + value.authorised_value + '">' + value.lib + '</option>\n'; >- } >- html += '</select>\n'; >- var new_form_field_value = $(html); >- new_form_field_value.val(form_field_value.val()); >- form_field_value.replaceWith(new_form_field_value); >- } else { >- if (form_field_value.prop('tagName').toLowerCase() == 'select') { >- html = '<input name="q" type="text" class="form-field-value" />'; >- var new_form_field_value = $(html); >- form_field_value.replaceWith(new_form_field_value); >- } >- } >- } >- >- function addNewField( link ) { >- var form_field = $('div.form-field-select-text').last(); >- var copy = form_field.clone(true); >- copy.find('input,select').not('[type="hidden"]').each(function() { >- $(this).val(''); >- }); >- copy.find('.form-field-conjunction').prop('disabled', false); >- form_field.after(copy); >- link.remove(); >- copy.find('select.form-field-column').change(); >- } >- >- function submitForm($form) { >- var tr = '' >- + ' <tr>' >- + ' <th>' + _("Title") + '</th>' >- + ' <th>' + _("Publication date") + '</th>' >- + ' <th>' + _("Publisher") + '</th>' >- + ' <th>' + _("Collection") + '</th>' >- + ' <th>' + _("Barcode") + '</th>' >- + ' <th>' + _("Call number") + '</th>' >- + ' <th>' + _("Home library") + '</th>' >- + ' <th>' + _("Current location") + '</th>' >- + ' <th>' + _("Shelving location") + '</th>' >- + ' <th>' + _("Inventory number") + '</th>' >- + ' <th>' + _("Status") + '</th>' >- + ' <th>' + _("Checkouts") + '</th>' >- + ' <th></th>' >- + ' </tr>' >- var table = '' >- + '<table id="results">' >- + ' <thead>' + tr + tr + '</thead>' >- + ' <tbody></tbody>' >- + '</table>'; >- >- var advSearchLink = $('<a>') >- .attr('href', '/cgi-bin/koha/catalogue/search.pl') >- .html(_("Go to advanced search")); >- var editSearchLink = $('<a>') >- .attr('href', '#') >- .html(_("Edit search")) >- .addClass('btn btn-default btn-xs') >- .on('click', function(e) { >- e.preventDefault(); >- $('#item-search-block').show(); >- }); >- >- var csvExportLink = $('<a>') >- .attr('href', '#') >- .html(_("Export results to CSV")) >- .addClass('btn btn-default btn-xs') >- .on('click', function(e) { >- e.preventDefault(); >- $('#format-csv').prop('checked', true); >- $('#itemsearchform').submit(); >- $('#format-html').prop('checked', true); >- }); >- var barcodesExportLink = $('<a>') >- .attr('href', '#') >- .html(_("Export results to barcodes file")) >- .addClass('btn btn-default btn-xs') >- .on('click', function(e) { >- e.preventDefault(); >- $('#format-barcodes').prop('checked', true); >- $('#itemsearchform').submit(); >- $('#format-html').prop('checked', true); >- }); >- >- var editSearchAndExportLinks = $('<p>') >- .append(editSearchLink) >- .append(' | ') >- .append(csvExportLink) >- .append(' ') >- .append(barcodesExportLink); >- >- var results_heading = $('<div>').addClass('results-heading') >- .append("<h1>" + _("Item search results") + "</h1>") >- .append($('<p>').append(advSearchLink)) >- .append(editSearchAndExportLinks); >- $('#results-wrapper').empty() >- .append(results_heading) >- .append(table); >- >- var params = []; >- $form.find('select').not(':disabled').find('option:selected').each(function () { >- var name = $(this).parents('select').first().attr('name'); >- var value = $(this).val(); >- params.push({ 'name': name, 'value': value }); >- }); >- $form.find('input[type="text"],input[type="hidden"]').not(':disabled').each(function () { >- params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >- }); >- $form.find('input[type="radio"]:checked').each(function() { >- params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >- }); >- >- $('#results').dataTable($.extend(true, {}, dataTablesDefaults, { >- 'bDestroy': true, >- 'bServerSide': true, >- 'bProcessing': true, >- 'sAjaxSource': '/cgi-bin/koha/catalogue/itemsearch.pl', >- 'fnServerData': function(sSource, aoData, fnCallback) { >- aoData.push( { 'name': 'format', 'value': 'json' } ); >- for (i in params) { >- aoData.push(params[i]); >- } >- $.ajax({ >- 'dataType': 'json', >- 'type': 'POST', >- 'url': sSource, >- 'data': aoData, >- 'success': function(json){ >- fnCallback(json); >- } >- }); >- }, >- 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', >- 'aoColumns': [ >- { 'sName': 'title' }, >- { 'sName': 'publicationyear' }, >- { 'sName': 'publishercode' }, >- { 'sName': 'ccode' }, >- { 'sName': 'barcode' }, >- { 'sName': 'itemcallnumber' }, >- { 'sName': 'homebranch' }, >- { 'sName': 'holdingbranch' }, >- { 'sName': 'location' }, >- { 'sName': 'stocknumber' }, >- { 'sName': 'notforloan' }, >- { 'sName': 'issues' }, >- { 'sName': 'checkbox', 'bSortable': false } >- ], >- "sPaginationType": "full_numbers" >- })).columnFilter({ >- 'sPlaceHolder': 'head:after', >- 'aoColumns': [ >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'select', 'values': [% ccodes.json %] }, >- { 'type': 'text' }, >- { 'type': 'text' }, >- { 'type': 'select', 'values': [% branches.json %] }, >- { 'type': 'select', 'values': [% branches.json %] }, >- [% IF locations.size %] >- { 'type': 'select', 'values': [% locations.json %] }, >- [% ELSE %] >- null, >- [% END %] >- { 'type': 'text' }, >- [% IF notforloans.size %] >- { 'type': 'select', 'values': [% notforloans.json %] }, >- [% ELSE %] >- null, >- [% END %] >- { 'type': 'text' }, >- null >- ] >- }); >- } >- >- $(document).ready(function () { >- $('#toolbar').fixFloat(); >- // Add the "New field" link. >- var form_field = $('div.form-field-select-text').last() >- var NEW_FIELD = _("New field"); >- var button_field_new = $('<a href="#" class="button-field-new" title="Add a new field"><i class="fa fa-plus"></i> ' + NEW_FIELD + '</a>'); >- button_field_new.click(function(e) { >- e.preventDefault(); >- addNewField( $(this) ); >- }); >- form_field.append(button_field_new); >- >- // If a field is linked to an authorised values list, display the list. >- $('div.form-field-select-text select').change(function() { >- loadAuthorisedValuesSelect($(this)); >- }).change(); >- >- // Prevent user to select the 'All ...' option with other options. >- $('div.form-field-select').each(function() { >- $(this).find('select').filter(':last').change(function() { >- values = $(this).val(); >- if (values.length > 1) { >- var idx = $.inArray('', values); >- if (idx != -1) { >- values.splice(idx, 1); >- $(this).val(values); >- } >- } >- }); >- }); >- >- $('#itemsearchform').submit(function() { >- var searchform = $(this); >- var format = searchform.find('input[name="format"]:checked').val(); >- if (format == 'html') { >- submitForm(searchform); >- $("#item-search-block").hide(); >- return false; >- } >- }); >- }); >- //]]> >- </script> >+ <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> > </head> >+ > <body id="catalog_itemsearch" class="catalog"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'home-search.inc' %] >@@ -426,4 +193,239 @@ > <div id="doc3" class="yui-t7"> > <div id="results-wrapper"></div> > >- [% INCLUDE 'intranet-bottom.inc' %] >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script> >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.fixFloat.js"></script> >+ <script type="text/javascript"> >+ var authorised_values = [% authorised_values_json %]; >+ >+ function loadAuthorisedValuesSelect(select) { >+ var selected = select.find('option:selected'); >+ var category = selected.data('authorised-values-category'); >+ var form_field_value = select.siblings('.form-field-value'); >+ if (category && category in authorised_values) { >+ var values = authorised_values[category]; >+ var html = '<select name="q" class="form-field-value">\n'; >+ for (i in values) { >+ var value = values[i]; >+ html += '<option value="' + value.authorised_value + '">' + value.lib + '</option>\n'; >+ } >+ html += '</select>\n'; >+ var new_form_field_value = $(html); >+ new_form_field_value.val(form_field_value.val()); >+ form_field_value.replaceWith(new_form_field_value); >+ } else { >+ if (form_field_value.prop('tagName').toLowerCase() == 'select') { >+ html = '<input name="q" type="text" class="form-field-value" />'; >+ var new_form_field_value = $(html); >+ form_field_value.replaceWith(new_form_field_value); >+ } >+ } >+ } >+ >+ function addNewField( link ) { >+ var form_field = $('div.form-field-select-text').last(); >+ var copy = form_field.clone(true); >+ copy.find('input,select').not('[type="hidden"]').each(function() { >+ $(this).val(''); >+ }); >+ copy.find('.form-field-conjunction').prop('disabled', false); >+ form_field.after(copy); >+ link.remove(); >+ copy.find('select.form-field-column').change(); >+ } >+ >+ function submitForm($form) { >+ var tr = '' >+ + ' <tr>' >+ + ' <th>' + _("Title") + '</th>' >+ + ' <th>' + _("Publication date") + '</th>' >+ + ' <th>' + _("Publisher") + '</th>' >+ + ' <th>' + _("Collection") + '</th>' >+ + ' <th>' + _("Barcode") + '</th>' >+ + ' <th>' + _("Call number") + '</th>' >+ + ' <th>' + _("Home library") + '</th>' >+ + ' <th>' + _("Current location") + '</th>' >+ + ' <th>' + _("Shelving location") + '</th>' >+ + ' <th>' + _("Inventory number") + '</th>' >+ + ' <th>' + _("Status") + '</th>' >+ + ' <th>' + _("Checkouts") + '</th>' >+ + ' <th></th>' >+ + ' </tr>' >+ var table = '' >+ + '<table id="results">' >+ + ' <thead>' + tr + tr + '</thead>' >+ + ' <tbody></tbody>' >+ + '</table>'; >+ >+ var advSearchLink = $('<a>') >+ .attr('href', '/cgi-bin/koha/catalogue/search.pl') >+ .html(_("Go to advanced search")); >+ var editSearchLink = $('<a>') >+ .attr('href', '#') >+ .html(_("Edit search")) >+ .addClass('btn btn-default btn-xs') >+ .on('click', function(e) { >+ e.preventDefault(); >+ $('#item-search-block').show(); >+ }); >+ >+ var csvExportLink = $('<a>') >+ .attr('href', '#') >+ .html(_("Export results to CSV")) >+ .addClass('btn btn-default btn-xs') >+ .on('click', function(e) { >+ e.preventDefault(); >+ $('#format-csv').prop('checked', true); >+ $('#itemsearchform').submit(); >+ $('#format-html').prop('checked', true); >+ }); >+ var barcodesExportLink = $('<a>') >+ .attr('href', '#') >+ .html(_("Export results to barcodes file")) >+ .addClass('btn btn-default btn-xs') >+ .on('click', function(e) { >+ e.preventDefault(); >+ $('#format-barcodes').prop('checked', true); >+ $('#itemsearchform').submit(); >+ $('#format-html').prop('checked', true); >+ }); >+ >+ var editSearchAndExportLinks = $('<p>') >+ .append(editSearchLink) >+ .append(' | ') >+ .append(csvExportLink) >+ .append(' ') >+ .append(barcodesExportLink); >+ >+ var results_heading = $('<div>').addClass('results-heading') >+ .append("<h1>" + _("Item search results") + "</h1>") >+ .append($('<p>').append(advSearchLink)) >+ .append(editSearchAndExportLinks); >+ $('#results-wrapper').empty() >+ .append(results_heading) >+ .append(table); >+ >+ var params = []; >+ $form.find('select').not(':disabled').find('option:selected').each(function () { >+ var name = $(this).parents('select').first().attr('name'); >+ var value = $(this).val(); >+ params.push({ 'name': name, 'value': value }); >+ }); >+ $form.find('input[type="text"],input[type="hidden"]').not(':disabled').each(function () { >+ params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >+ }); >+ $form.find('input[type="radio"]:checked').each(function() { >+ params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >+ }); >+ >+ $('#results').dataTable($.extend(true, {}, dataTablesDefaults, { >+ 'bDestroy': true, >+ 'bServerSide': true, >+ 'bProcessing': true, >+ 'sAjaxSource': '/cgi-bin/koha/catalogue/itemsearch.pl', >+ 'fnServerData': function(sSource, aoData, fnCallback) { >+ aoData.push( { 'name': 'format', 'value': 'json' } ); >+ for (i in params) { >+ aoData.push(params[i]); >+ } >+ $.ajax({ >+ 'dataType': 'json', >+ 'type': 'POST', >+ 'url': sSource, >+ 'data': aoData, >+ 'success': function(json){ >+ fnCallback(json); >+ } >+ }); >+ }, >+ 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r', >+ 'aoColumns': [ >+ { 'sName': 'title' }, >+ { 'sName': 'publicationyear' }, >+ { 'sName': 'publishercode' }, >+ { 'sName': 'ccode' }, >+ { 'sName': 'barcode' }, >+ { 'sName': 'itemcallnumber' }, >+ { 'sName': 'homebranch' }, >+ { 'sName': 'holdingbranch' }, >+ { 'sName': 'location' }, >+ { 'sName': 'stocknumber' }, >+ { 'sName': 'notforloan' }, >+ { 'sName': 'issues' }, >+ { 'sName': 'checkbox', 'bSortable': false } >+ ], >+ "sPaginationType": "full_numbers" >+ })).columnFilter({ >+ 'sPlaceHolder': 'head:after', >+ 'aoColumns': [ >+ { 'type': 'text' }, >+ { 'type': 'text' }, >+ { 'type': 'text' }, >+ { 'type': 'select', 'values': [% ccodes.json %] }, >+ { 'type': 'text' }, >+ { 'type': 'text' }, >+ { 'type': 'select', 'values': [% branches.json %] }, >+ { 'type': 'select', 'values': [% branches.json %] }, >+ [% IF locations.size %] >+ { 'type': 'select', 'values': [% locations.json %] }, >+ [% ELSE %] >+ null, >+ [% END %] >+ { 'type': 'text' }, >+ [% IF notforloans.size %] >+ { 'type': 'select', 'values': [% notforloans.json %] }, >+ [% ELSE %] >+ null, >+ [% END %] >+ { 'type': 'text' }, >+ null >+ ] >+ }); >+ } >+ >+ $(document).ready(function () { >+ $('#toolbar').fixFloat(); >+ // Add the "New field" link. >+ var form_field = $('div.form-field-select-text').last() >+ var NEW_FIELD = _("New field"); >+ var button_field_new = $('<a href="#" class="button-field-new" title="Add a new field"><i class="fa fa-plus"></i> ' + NEW_FIELD + '</a>'); >+ button_field_new.click(function(e) { >+ e.preventDefault(); >+ addNewField( $(this) ); >+ }); >+ form_field.append(button_field_new); >+ >+ // If a field is linked to an authorised values list, display the list. >+ $('div.form-field-select-text select').change(function() { >+ loadAuthorisedValuesSelect($(this)); >+ }).change(); >+ >+ // Prevent user to select the 'All ...' option with other options. >+ $('div.form-field-select').each(function() { >+ $(this).find('select').filter(':last').change(function() { >+ values = $(this).val(); >+ if (values.length > 1) { >+ var idx = $.inArray('', values); >+ if (idx != -1) { >+ values.splice(idx, 1); >+ $(this).val(values); >+ } >+ } >+ }); >+ $('#itemsearchform').submit(function() { >+ var searchform = $(this); >+ var format = searchform.find('input[name="format"]:checked').val(); >+ if (format == 'html') { >+ submitForm(searchform); >+ $("#item-search-block").hide(); >+ return false; >+ } >+ }); >+ }); >+ }); >+ </script> >+[% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >index c56a3cc..55ebca9 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/labeledMARCdetail.tt >@@ -1,3 +1,4 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > > <title>Koha › Catalog › >@@ -9,28 +10,6 @@ > </title> > > [% INCLUDE 'doc-head-close.inc' %] >- >- [% INCLUDE 'browser-strings.inc' %] >- <!--[if lt IE 9]> >- <script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >- <![endif]--> >- <script type="text/javascript" src="[% interface %]/js/browser.js"></script> >- <script type="text/javascript"> >- //<![CDATA[ >- var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >- browser.show(); >- $(document).ready(function() { >- $("#Frameworks").on("change",function(){ >- Changefwk(this); >- }); >- }); >- function Changefwk(FwkList) >- { >- var fwk = FwkList.options[FwkList.selectedIndex].value; >- window.location = "labeledMARCdetail.pl?biblionumber=[% biblionumber %]&frameworkcode="+fwk; >- } >- //]]> >- </script> > </head> > > <body id="catlaog_labeledMARCdetail" class="catalog"> >@@ -94,4 +73,28 @@ > </div> > [% END %] > </div> >- [% INCLUDE 'intranet-bottom.inc' %] >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'catalog-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/catalog.js"></script> >+ [% INCLUDE 'browser-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/js/browser.js"></script> >+ <script type="text/javascript"> >+ //<![CDATA[ >+ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >+ browser.show(); >+ $(document).ready(function() { >+ $("#Frameworks").on("change",function(){ >+ Changefwk(this); >+ }); >+ }); >+ function Changefwk(FwkList) >+ { >+ var fwk = FwkList.options[FwkList.selectedIndex].value; >+ window.location = "labeledMARCdetail.pl?biblionumber=[% biblionumber %]&frameworkcode="+fwk; >+ } >+ //]]> >+ </script> >+[% END %] >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index b04fd39..7c7acfe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -1,20 +1,10 @@ > [% USE Koha %] > [% USE Branches %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Catalog › Item details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <style type="text/css">h3{padding-top: 1em; border-top: 2px solid #CCCCCC;}#exportLabelexportModal_{border-top: 0px;}</style> >-[% INCLUDE 'browser-strings.inc' %] >-<!--[if lt IE 9]> >-<script type="text/javascript" src="[% interface %]/lib/shims/json2.min.js"></script> >-<![endif]--> >-<script type="text/javascript" src="[% interface %]/js/browser.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >- var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >- browser.show(); >-//]]> >-</script> > </head> > <body id="catalog_moredetail" class="catalog"> > [% USE KohaDates %] >@@ -282,4 +272,14 @@ > [% INCLUDE 'biblio-view-menu.inc' %] > </div> > </div> >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'catalog-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/catalog.js"></script> >+ [% INCLUDE 'browser-strings.inc' %] >+ <script type="text/javascript" src="[% interface %]/js/browser.js"></script> >+ <script type="text/javascript"> >+ var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); >+ browser.show(); >+ </script> >+[% END %] > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt >index f55d4fc..a1bcd46 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/search-history.tt >@@ -1,117 +1,12 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > [% USE Koha %] > [% USE KohaDates %] > <title>Koha › Catalog › Search history</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >-<script type="text/javascript"> >-//<![CDATA[ >-$(document).ready(function() { >- // We show table ordered by descending dates by default >- // (so that the more recent query is shown first) >- $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aaSorting": [[ 1, "desc" ]], >- "aoColumnDefs": [ >- { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >- { "aTargets": [ 1 ], "sType": "title-string" }, >- ], >- "sPaginationType": "full_numbers" >- })); >- >- $('#tabs').tabs(); >- >- // DataTables removes hidden rows from the DOM, so we can't expect a >- // "regular" submit to work and we need to build another form containing >- // all form elements, and then submit this form. >- $('#tabs form').submit(function(e) { >- e.preventDefault(); >- >- var form = $(this); >- var table = form.find('table').dataTable(); >- >- var new_form = $('<form>') >- .attr('action', form.attr('action')) >- .attr('method', form.attr('method')); >- form.find('input[type="hidden"]') >- .add(table.$('input:checkbox:checked')) >- .each(function() { >- var input = $('<input type="hidden">') >- .attr('name', $(this).attr('name')) >- .attr('value', $(this).attr('value')); >- new_form.append(input); >- }); >- $(document.body).append(new_form); >- new_form.submit(); >- }); >- >- $(".CheckNone").click(function(e){ >- e.preventDefault(); >- var form = $(this).parents("form").first(); >- form.find('table input[type="checkbox"]').prop('checked', false); >- enableCheckboxActions(form); >- }); >- $(".CheckAll").click(function(e){ >- e.preventDefault(); >- var form = $(this).parents("form").first(); >- form.find('table input[type="checkbox"]').prop('checked', true); >- enableCheckboxActions(form); >- }); >- >- $('#tabs table').on('click', 'input:checkbox', function() { >- var form = $(this).parents("form").first(); >- enableCheckboxActions(form); >- }); >- >- $(".action_delete").click(function(e){ >- e.preventDefault(); >- var form = $(this).parents("form").first(); >- var table = form.find('table').dataTable(); >- var ids = table.$("input:checkbox:checked"); >- if ( $(ids).length < 1 ) { >- return false; >- } >- >- var msg; >- if (ids.length == 1) { >- msg = _("Are you sure you want to delete the selected search history entry?"); >- } else { >- msg = _("Are you sure you want to delete the %s selected search history entries?").format(ids.length); >- } >- >- if ( confirm(msg) ) { >- form.submit(); >- } >- return false; >- }); >- >- $('#tabs form').each(function() { >- enableCheckboxActions($(this)); >- }); >-}); >- >-function enableCheckboxActions(form){ >- // Enable/disable controls if checkboxes are checked >- var table = form.find('table').dataTable(); >- var checked_count = table.$("input:checkbox:checked").length; >- if (checked_count) { >- if (checked_count == 1) { >- form.find(".selections").html(_("With selected search: ")); >- } else { >- form.find(".selections").html(_("With %s selected searches: ").format(checked_count)); >- } >- form.find(".selections-toolbar .links a").removeClass("disabled"); >- } else { >- form.find(".selections").html(_("Select searches to: ")); >- form.find(".selections-toolbar .links a").addClass("disabled"); >- } >-} >- >-//]]> >- >-</script> > </head> >+ > <body id="catalogue_search-history" class="catalogue"> > > [% INCLUDE 'header.inc' %] >@@ -295,4 +190,113 @@ function enableCheckboxActions(form){ > </div> > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >+ <script type="text/javascript"> >+ //<![CDATA[ >+ $(document).ready(function() { >+ // We show table ordered by descending dates by default >+ // (so that the more recent query is shown first) >+ $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aaSorting": [[ 1, "desc" ]], >+ "aoColumnDefs": [ >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >+ { "aTargets": [ 1 ], "sType": "title-string" }, >+ ], >+ "sPaginationType": "full_numbers" >+ })); >+ >+ $('#tabs').tabs(); >+ >+ // DataTables removes hidden rows from the DOM, so we can't expect a >+ // "regular" submit to work and we need to build another form containing >+ // all form elements, and then submit this form. >+ $('#tabs form').submit(function(e) { >+ e.preventDefault(); >+ >+ var form = $(this); >+ var table = form.find('table').dataTable(); >+ >+ var new_form = $('<form>') >+ .attr('action', form.attr('action')) >+ .attr('method', form.attr('method')); >+ form.find('input[type="hidden"]') >+ .add(table.$('input:checkbox:checked')) >+ .each(function() { >+ var input = $('<input type="hidden">') >+ .attr('name', $(this).attr('name')) >+ .attr('value', $(this).attr('value')); >+ new_form.append(input); >+ }); >+ $(document.body).append(new_form); >+ new_form.submit(); >+ }); >+ >+ $(".CheckNone").click(function(e){ >+ e.preventDefault(); >+ var form = $(this).parents("form").first(); >+ form.find('table input[type="checkbox"]').prop('checked', false); >+ enableCheckboxActions(form); >+ }); >+ $(".CheckAll").click(function(e){ >+ e.preventDefault(); >+ var form = $(this).parents("form").first(); >+ form.find('table input[type="checkbox"]').prop('checked', true); >+ enableCheckboxActions(form); >+ }); >+ >+ $('#tabs table').on('click', 'input:checkbox', function() { >+ var form = $(this).parents("form").first(); >+ enableCheckboxActions(form); >+ }); >+ >+ $(".action_delete").click(function(e){ >+ e.preventDefault(); >+ var form = $(this).parents("form").first(); >+ var table = form.find('table').dataTable(); >+ var ids = table.$("input:checkbox:checked"); >+ if ( $(ids).length < 1 ) { >+ return false; >+ } >+ >+ var msg; >+ if (ids.length == 1) { >+ msg = _("Are you sure you want to delete the selected search history entry?"); >+ } else { >+ msg = _("Are you sure you want to delete the %s selected search history entries?").format(ids.length); >+ } >+ >+ if ( confirm(msg) ) { >+ form.submit(); >+ } >+ return false; >+ }); >+ >+ $('#tabs form').each(function() { >+ enableCheckboxActions($(this)); >+ }); >+ }); >+ >+ function enableCheckboxActions(form){ >+ // Enable/disable controls if checkboxes are checked >+ var table = form.find('table').dataTable(); >+ var checked_count = table.$("input:checkbox:checked").length; >+ if (checked_count) { >+ if (checked_count == 1) { >+ form.find(".selections").html(_("With selected search: ")); >+ } else { >+ form.find(".selections").html(_("With %s selected searches: ").format(checked_count)); >+ } >+ form.find(".selections-toolbar .links a").removeClass("disabled"); >+ } else { >+ form.find(".selections").html(_("Select searches to: ")); >+ form.find(".selections-toolbar .links a").addClass("disabled"); >+ } >+ } >+ >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/js/catalog.js b/koha-tmpl/intranet-tmpl/prog/js/catalog.js >new file mode 100644 >index 0000000..19ccd52 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/js/catalog.js >@@ -0,0 +1,112 @@ >+/* IF ( CAN_user_editcatalogue_edit_catalogue ) */ >+ /* this function open a popup to search on z3950 server. */ >+ function PopupZ3950() { >+ var strQuery = GetZ3950Terms(); >+ if(strQuery){ >+ window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=" + biblionumber + strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes'); >+ } >+ } >+ function PopupZ3950Confirmed() { >+ if (confirm( MSG_REPLACE_RECORD )){ >+ PopupZ3950(); >+ } >+ } >+/* END IF( CAN_user_editcatalogue_edit_catalogue ) */ >+ >+function addToCart() { addRecord( biblionumber ); } >+function addToShelf() { window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumber=' + biblionumber,'Add_to_virtualshelf','width=500,height=400,toolbar=false,scrollbars=yes'); >+} >+function printBiblio() {window.print(); } >+ >+/* IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */ >+ >+function confirm_deletion() { >+ var order_manage_permission = $(this).data("order-manage"); >+ var is_confirmed; >+ if (count > 0){ >+ is_confirmed = alert( MSG_DELETE_ALL_ITEMS.format(count) ); >+ } else if (countorders > 0){ >+ if( order_manage_permission ){ >+ is_confirmed = confirm( CONFIRM_RECORD_USED_IN_ORDERS.format(countorders) ); >+ } else { >+ is_confirmed = alert( MSG_RECORD_USED_IN_ORDERS.format(countorders) ); >+ } >+ } else if (countdeletedorders > 0){ >+ if( order_manage_permission ){ >+ is_confirmed = confirm( CONFIRM_IN_DELETED_ORDERS.format(countdeletedorders) ); >+ } else { >+ is_confirmed = alert( MSG_IN_DELTED_ORDERS.format(countdeletedorders) ); >+ } >+ } else if ( holdcount > 0 ) { >+ is_confirmed = confirm( CONFIRM_DELETION_HOLDS.format(holdcount) ); >+ } else { >+ is_confirmed = confirm( CONFIRM_RECORD_DELETION ); >+ } >+ if (is_confirmed) { >+ window.location="/cgi-bin/koha/cataloguing/addbiblio.pl?op=delete&biblionumber=" + biblionumber; >+ } else { >+ return false; >+ } >+} >+ >+/* END IF CAN_user_editcatalogue_edit_catalogue or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */ >+ >+/* IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */ >+ >+function confirm_items_deletion() { >+ if ( holdcount > 0 ) { >+ alert( MSG_DELETE_ALL_HOLDS.format(holdcount) ); >+ } else if ( count > 0 ) { >+ if( confirm( CONFIRM_DELETE_ITEMS.format(count) ) ) { >+ window.location="/cgi-bin/koha/cataloguing/additem.pl?op=delallitems&biblionumber=" + biblionumber; >+ } else { >+ return false; >+ } >+ } else { >+ alertNoItems(); >+ return false; >+ } >+} >+ >+function alertNoItems(){ >+ alert( MSG_NO_ITEMS ); >+} >+ >+/* END IF CAN_user_editcatalogue_edit_items or ( frameworkcode == 'FA' and CAN_user_editcatalogue_fast_cataloging ) */ >+ >+$(document).ready(function() { >+ $("#z3950copy").click(function(){ >+ PopupZ3950(); >+ return false; >+ }); >+ $("#deletebiblio").click(function(){ >+ confirm_deletion(); >+ return false; >+ }); >+ $("#deleteallitems").click(function(){ >+ confirm_items_deletion(); >+ return false; >+ }); >+ $("#printbiblio").click(function(){ >+ printBiblio(); >+ return false; >+ }); >+ $("#addtocart").click(function(){ >+ addToCart(); >+ $(".btn-group").removeClass("open"); >+ return false; >+ }); >+ $("#addtoshelf").click(function(){ >+ addToShelf(); >+ $(".btn-group").removeClass("open"); >+ return false; >+ }); >+ $("#export").remove(); // Hide embedded export form if JS menus available >+ $("#deletebiblio").tooltip(); >+ $("#batchedit-disabled,#batchdelete-disabled,#deleteallitems-disabled") >+ .on("click",function(e){ >+ e.preventDefault(); >+ alertNoItems(); >+ }) >+ .tooltip(); >+ }); >-- >2.1.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 17893
:
64603
|
64677
|
66950
|
66962