Bugzilla – Attachment 155817 Details for
Bug 34817
New framework plugin callnumber_colors.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34817: Framework plugin callnumber_colors
Bug-34817-Framework-plugin-callnumbercolors.patch (text/plain), 2.48 KB, created by
Marcel de Rooy
on 2023-09-18 12:56:17 UTC
(
hide
)
Description:
Bug 34817: Framework plugin callnumber_colors
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-09-18 12:56:17 UTC
Size:
2.48 KB
patch
obsolete
>From 604b3f6fc4b9f54f9d7c92be81d037836e1306ba Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 18 Sep 2023 12:22:33 +0200 >Subject: [PATCH] Bug 34817: Framework plugin callnumber_colors >Content-Type: text/plain; charset=utf-8 > >Test plan: >Add this to your IntranetUserCSS: > .callnumber_green { background-color: green; } /* callnumber_colors.pl framework plugin */ > .callnumber_red { background-color: red; } /* callnumber_colors.pl framework plugin */ >Goto Administration/MARC bib framework. Add callnumber_colors.pl as plugin to 952$o. >Goto Cataloguing/Edit items. >Test the plugin with a new and existing item. Test response on existing >callnumber, not existing, clearing field. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../value_builder/callnumber_colors.pl | 47 +++++++++++++++++++ > 1 file changed, 47 insertions(+) > create mode 100755 cataloguing/value_builder/callnumber_colors.pl > >diff --git a/cataloguing/value_builder/callnumber_colors.pl b/cataloguing/value_builder/callnumber_colors.pl >new file mode 100755 >index 0000000000..f62c0f34ab >--- /dev/null >+++ b/cataloguing/value_builder/callnumber_colors.pl >@@ -0,0 +1,47 @@ >+#!/usr/bin/perl >+ >+use Modern::Perl; >+ >+my $builder = sub { >+ my ($params) = @_; >+ my $field_number = $params->{id}; >+ >+ my $res = " >+<script type=\"text/javascript\" charset=\"utf-8\"> >+//<![CDATA[ >+ >+function Change$field_number() { >+ var cn_value = jQuery('#$field_number').val(); >+ var itemnumber = jQuery('input[name=\"itemnumber\"]').val(); >+ if ( cn_value == '' ) change_color(); >+ else api_item_count( cn_value, itemnumber, change_color ); >+ return 1; >+} >+ >+function change_color (color) { >+ jQuery('#$field_number').removeClass( 'callnumber_green callnumber_red' ); >+ if ( color ) jQuery('#$field_number').addClass( 'callnumber_' + color ); >+} >+ >+function api_item_count ( cn_value, itemnumber, callback ) { >+ var condition = JSON.stringify( >+ itemnumber ? >+ { 'callnumber': cn_value, 'itemnumber': { '-not_like' : itemnumber } } : >+ { 'callnumber': cn_value } ); >+ jQuery.ajax({ >+ method: 'GET', >+ url: '/api/v1/items?q=' + condition, >+ }).done(function (data) { >+ console.log( cn_value + ': ' + data.length ); >+ callback( data.length ? 'red' : 'green' ); >+ }).fail(function () { >+ alert('An error occurred when checking callnumber'); >+ }); >+} >+ >+//]]> >+</script>"; >+ return $res; >+}; >+ >+return { builder => $builder }; >-- >2.30.2
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 34817
: 155817