From 7867994e7f49aae668f16e3432813002b8b8cc51 Mon Sep 17 00:00:00 2001 From: Hector Castro Date: Mon, 11 Apr 2016 15:49:29 -0600 Subject: [PATCH] Bug 16243: Add reference manager software (Mendeley and EasyBib) to OPAC Mendeley provides a mechanism for export bib records to a personal account in a free reference manager and academic social network (similar to Zotero) EasyBib Generate citations in MLA, APA & Chicago formats for bibliographies To test: - Apply patch - Run perl installer/data/mysql/updatedatabase.pl - On master, search for the syspref OpacReferenceManager - Enable the two options - Do a search for books - Notice about the new option 'Export to Reference Manager' in search results - Create an account in Mendeley (Is free) - Click in new option and notice that you can save bib references in Mendeley - Click in new option Cite on EasyBib, you will see the records selected in EasyBib NOTE: Fixed according with QA comment Sponsored-by: Universidad de El Salvador --- .../bug_16243-add_reference_managers.sql | 1 + installer/data/mysql/sysprefs.sql | 3 +- .../prog/en/modules/admin/preferences/opac.pref | 6 ++ .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 57 +++++++++++++++- koha-tmpl/opac-tmpl/bootstrap/images/easybib.png | Bin 0 -> 415 bytes koha-tmpl/opac-tmpl/bootstrap/images/mendeley.png | Bin 0 -> 572 bytes .../opac-tmpl/bootstrap/js/reference_manager.js | 72 ++++++++++++++++++++ opac/opac-downloadcart.pl | 1 + 8 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_16243-add_reference_managers.sql create mode 100644 koha-tmpl/opac-tmpl/bootstrap/images/easybib.png create mode 100644 koha-tmpl/opac-tmpl/bootstrap/images/mendeley.png create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/reference_manager.js diff --git a/installer/data/mysql/atomicupdate/bug_16243-add_reference_managers.sql b/installer/data/mysql/atomicupdate/bug_16243-add_reference_managers.sql new file mode 100644 index 0000000..1cc7be8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_16243-add_reference_managers.sql @@ -0,0 +1 @@ +INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacReferenceManager','mendeley,easybib','Select reference manager software options that should be available from OPAC detail, basket and list pages.','','multiple'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ef4c3f0..05e0f3d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -532,5 +532,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('XSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on intranet','Free'), ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), -('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), +('OpacReferenceManager','mendeley,easybib','','Select reference manager software options that should be available from OPAC detail, basket and list pages.','multiple') ; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index b041ddf..299aaef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -258,6 +258,12 @@ OPAC: type: htmlarea class: code - + - 'Select reference manager software options that should be available from OPAC detail, basket and list pages:' + - pref: OpacReferenceManager + multiple: + mendeley: Mendeley (Reference Manager Software) + easybib: EasyBib (Free Bibliography Generator) + - - pref: OpacAddMastheadLibraryPulldown choices: yes: Add diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 061ceed..c210c88 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -160,7 +160,6 @@ [% END %] - [% IF ( TagsInputEnabled && loggedinusername ) %] @@ -176,6 +175,26 @@ [% END %] + [% SET reference_manager_options = Koha.Preference('OpacReferenceManager').split(',') %] + [% IF reference_manager_options.size %] + | + + [% END %] @@ -981,4 +1000,40 @@ $("input.newtag").on('keydown', function(e){ }); //]]> +[% IF Koha.Preference( 'OpacReferenceManager' ) %] + + + + + + +[% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/images/easybib.png b/koha-tmpl/opac-tmpl/bootstrap/images/easybib.png new file mode 100644 index 0000000000000000000000000000000000000000..c77e18b07259d60321c0b829e8fc7bc0ca49529b GIT binary patch literal 415 zcmV;Q0bu@#P)@!zhCVG|-DOr;p6&@lK0wqm*jv`M8FDf0s9EPaawT_GV5d;$Bk zb~1L8O%MVTBp8Fj&R&~Yka3oo0~fyg9XOo-y`4NxRTZFub zvh;7a#yD)*;{B`!bGSyoA>a%jJ9SPTCj)%Y>*>8-5hj7jgrZk}@P)p5OFM((w zQKKXff0ArkT7rWGp}1tVlbayA3NCKCw38w@iEY5aA%U)4N`}&{DU<1jRRxrw^ zyf+qYL&8vD9mqR#$ZPjtEc$v<-Ps*Vw6f`*p_n8+swJ>PYBkElyTaR_U#36rzxi77 z1bb1+SH*3T2^^X)sK~tFFg&WlirGpjoE_7Z*|p=A)9lYr>FcfImWQV(C(6w$C7QY( zt@DF2Wqxl!T1p8xG4M)5#+KdG>VKD4jh&Aq#OG%E^DlKkRWx_hOJ+VR6v>VItYBq+ ziK1uLRx)eL#PfwhgmhZL^wL6Ke$qZ_{C8YY3?%r~Bk<$KYeqW|0Cs;;lPu~iHZ zk|Y&fn-_mR`BR)yAQ2~jk=&T1z##mCag#bXj}iSEy@>$=JOxkKJvr-n(f4Ehy?t^< ztea}xN++Gu-?b0BEytw?Y1u9js+(IkN55dNYXnRyOsjZK+Fsj;nFVeu;?tfYNFm`d z-7vVX)K)codfrSZeBc=OT7`OAQN>3?Lp_(EneEa|1fIb=0R{jzbsz2X(L5pm0000< KMNUMnLSTZ|qXJg| literal 0 HcmV?d00001 diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/reference_manager.js b/koha-tmpl/opac-tmpl/bootstrap/js/reference_manager.js new file mode 100644 index 0000000..8188dc8 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/js/reference_manager.js @@ -0,0 +1,72 @@ +//Invoke for Mendeley Reference Manager + +function getMendeleyModal(){ + document.getElementsByTagName('body')[0].appendChild(document.createElement('script')).setAttribute('src','https://www.mendeley.com/minified/bookmarklet.js'); +} + +$(document).ready(function(){ + $( "#mendeley_modal" ).click(function( event ){ + event.preventDefault(); + getMendeleyModal(); + return false; + }); +}); + +//EasyBib + +$(document).ready(function(){ + + $("#CheckAllEasy").click(function(){ + $( ".easycheck" ).prop( "checked", true ); + }); + + $("#CheckNoneEasy").click(function(){ + $( ".easycheck" ).prop( "checked", false ); + }); + + $("#easybib_modal").click(function(){ + $( ".cb" ).each(function( index ) { + var value = $( this ).val(); + var id = "biblionumber" + value; + var checkbox = ""; + $( checkbox ).appendTo( "#content" ); + + $( ".title" ).each(function( i ) { + var title = $( this ).text(); + var href = $( this ).attr("href"); + var url = "/cgi-bin/koha/opac-detail.pl?biblionumber=" + value + "&query_desc="; + if ( href == url){ + var label = ""; + $( label ).appendTo( "#content" ); + $( "
" ).appendTo( "#content" ); + $( "
" ).appendTo( "#content" ); + } + }); + }); + }); +}); + +$( "#easybib_form" ).submit(function( event ) { + event.preventDefault(); + var recordSelected = []; + var totalSeleceted; + $.each($(".easycheck:checked"), function(){ + recordSelected.push($(this).val()); + }); + if ( recordSelected.length > 0 ) { + totalSeleceted = recordSelected.join( "/" ); + $.ajax({ + url: "/cgi-bin/koha/opac-downloadcart.pl", + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + type: "post", + data: { format: "ris", bib_list: totalSeleceted }, + success: function( data ){ + $( "#mytest" ).html(data); + $( "#ris_form" ).submit(); + $( ".closebtn" ).click(); + } + }); + } else { + alert (_("Please select at least one title to cite on EasyBib") ); + } +}); diff --git a/opac/opac-downloadcart.pl b/opac/opac-downloadcart.pl index c5574e3..78ed9c1 100755 --- a/opac/opac-downloadcart.pl +++ b/opac/opac-downloadcart.pl @@ -90,6 +90,7 @@ if ($bib_list && $format) { print $query->header( -type => ($type) ? $type : 'application/octet-stream', -'Content-Transfer-Encoding' => 'binary', + -charset => 'utf-8', -attachment => ($extension) ? "cart.$format.$extension" : "cart.$format" ); print $output; -- 1.7.10.4