Bugzilla – Attachment 16441 Details for
Bug 8278
Replace YUI autocomplete in UNIMARC 210c plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin
SIGNED-OFF-Bug-8278---Replace-YUI-autocomplete-in-.patch (text/plain), 7.19 KB, created by
Bernardo Gonzalez Kriegel
on 2013-03-19 19:47:31 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 8278 - Replace YUI autocomplete in UNIMARC 210c plugin
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2013-03-19 19:47:31 UTC
Size:
7.19 KB
patch
obsolete
>From 421038f24cdd4e4984d06fcd198459cad571801f Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 8 Mar 2013 12:56:24 -0500 >Subject: [PATCH] [SIGNED-OFF] Bug 8278 - Replace YUI autocomplete in UNIMARC > 210c plugin >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >This plugin, for pseudo-authority-control of publisher information, >used YUI autocomplete to pull existing publisher data from the >biblioitems table. Despite its name it is not UNIMARC-specific. >It assumes publisher name data is saved in biblioitems. > >This patch converts the autocomplete to jQueryUI. The search >script has been amended to return valid JSON. The template has >been modified to enable the jQueryUI autocomplete and to add >structure more consistent with other popups. > >To test, link the publisher name field in your MARC structure to >the unimarc_field_210c_bis.pl plugin. Open a MARC record for >editing and click the "tag editor" link to launch the plugin. >Type the first few letters of a publisher which exists in your >database. You should get an autocomplete menu of publishers >which match your search. Select one and click the "choose" >button to fill the field in the MARC editor. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >Comment: work as described. No errors. > >Test: link 260b to plugin. Edit record and search first letters >of present editors. Menú appears and can select and fill value. > >Why plugin 210c_bis talk about field 225a? >--- > cataloguing/ysearch.pl | 10 ++- > .../value_builder/unimarc_field_210c_bis.tt | 91 ++++++++------------ > 2 files changed, 46 insertions(+), 55 deletions(-) > >diff --git a/cataloguing/ysearch.pl b/cataloguing/ysearch.pl >index 77144e1..8255016 100755 >--- a/cataloguing/ysearch.pl >+++ b/cataloguing/ysearch.pl >@@ -31,7 +31,7 @@ use C4::Charset; > use C4::Auth qw/check_cookie_auth/; > > my $input = new CGI; >-my $query = $input->param('query'); >+my $query = $input->param('term'); > my $table = $input->param('table'); > my $field = $input->param('field'); > >@@ -54,8 +54,14 @@ $sql .= qq( ORDER BY $field); > my $sth = $dbh->prepare($sql); > $sth->execute("$query%", "% $query%", "%-$query%"); > >+print "["; >+my $i = 0; > while ( my $rec = $sth->fetchrow_hashref ) { >- print nsb_clean($rec->{$field}) . "\n"; >+ if($i > 0){ print ","; } >+ print "{\"fieldvalue\":\"" . nsb_clean($rec->{$field}) . "\"" . >+ "}"; >+ $i++; > } >+print "]"; > > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt >index 1eedf4c..af5cdf6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tt >@@ -1,65 +1,51 @@ >-<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN" >- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> >-<html xmlns="http://www.w3.org/1999/xhtml"> >-<head> >- <title>UNIMARC field 225a builder</title> >- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> >- <script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script> >- <script type="text/javascript" src="[% yuipath %]/datasource/datasource.js"></script> >- <script type="text/javascript" src="[% yuipath %]/autocomplete/autocomplete-min.js"></script> >- <link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" /> >- >-</head> >-<body id="cat_unimarc_field_210c_bis" class="cat"> >-<div id="header_search"> >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › UNIMARC field 225a builder</title> >+[% INCLUDE 'doc-head-close.inc' %] >+<style type="text/css"> >+ #custom-doc { width:37.85em;*width:36.93em;min-width:492px; margin:auto; text-align:left; } >+</style> > <script type="text/javascript"> > //<![CDATA[ >-YAHOO.util.Event.onContentReady("header_search", function() { >- new function() { >- // Define a custom formatter function >- this.fnCustomFormatter = function(oResultItem, sQuery) { >- var name = oResultItem[0]; >- var aMarkup = [ >- "<div class=\"sample-result\">", >- name, >- "<\/div>"]; >- return (aMarkup.join("")); >- }; >+$(document).ready(function(){ >+ $( "#findvalue" ).autocomplete({ >+ source: "/cgi-bin/koha/cataloguing/ysearch.pl?table=biblioitems&field=publishercode", >+ minLength: 3, >+ select: function( event, ui ) { >+ $( "#findvalue" ).val( ui.item.fieldvalue ); >+ return false; >+ } >+ }) >+ .data( "autocomplete" )._renderItem = function( ul, item ) { >+ return $( "<li></li>" ) >+ .data( "item.autocomplete", item ) >+ .append( "<a>" + item.fieldvalue + "</a>" ) >+ .appendTo( ul ); >+ }; > >- // Instantiate one XHR DataSource and define schema as an array: >- // ["Record Delimiter", >- // "Field Delimiter"] >- this.oACDS = new YAHOO.widget.DS_XHR("/cgi-bin/koha/cataloguing/ysearch.pl", ["\n", "\t"]); >- this.oACDS.scriptQueryAppend = "table=biblioitems&field=publishercode"; >- this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT; >- this.oACDS.maxCacheEntries = 60; >- this.oACDS.queryMatchSubset = false; >- >- // Instantiate first AutoComplete >- var myInput = document.getElementById('findvalue'); >- var myContainer = document.getElementById('yvaluecontainer'); >- this.oAutoComp = new YAHOO.widget.AutoComplete(myInput,myContainer,this.oACDS); >- //this.oAutoComp.delimChar = ";"; >- this.oAutoComp.queryDelay = 1; >- this.oAutoComp.formatResult = this.fnCustomFormatter; >- this.oAutoComp.maxResultsDisplayed = 1000; >-} >-}); >+}); > //]]> > </script> >- <div id="mainbloc"> > >-<div id="plugin"> >+</head> >+<body id="cat_unimarc_field_210c_bis" class="cat"> >+ >+<div id="custom-doc" class="yui-t7"> >+ <div id="bd"> >+ >+<h1>UNIMARC field 225a builder</h1> > <div class="autocomplete"> > <form name="f_pop" onsubmit="javascript:report()" action=""> >- <div id="borrowerautocomplete" class="autocomplete"> >- <input autocomplete="off" id="findvalue" name="findvalue" size="40" class="focus" type="text" /><br /><br /> >- <input id="ysearchsubmit" type="submit" class="submit" value="Submit" /> >- <div id="yvaluecontainer"></div> >+ <div id="fieldautocomplete" class="autocomplete"> >+ <fieldset> >+ <input autocomplete="off" id="findvalue" name="findvalue" size="40" class="focus" type="text" /> >+ <fieldset class="action"> >+ <input type="submit" class="submit" value="Choose" /> >+ </fieldset> >+ </fieldset> > </div> > </form> > </div> >-</div> >+</div> > </div> > <script type="text/javascript"> > function report() { >@@ -71,5 +57,4 @@ YAHOO.util.Event.onContentReady("header_search", function() { > return false; > } > </script> >-</body> >-</html> >+[% INCLUDE 'popup-bottom.inc' %] >\ No newline at end of file >-- >1.7.9.5
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 8278
:
15997
|
16441
|
17110
|
17189
|
17475
|
17480
|
17597
|
17937
|
18002
|
18003
|
18004
|
18005