Bugzilla – Attachment 7611 Details for
Bug 7520
JSON script to return advanced search types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
0001-bug_7520-Created-opac-advanced_search_types.json.patch (text/plain), 2.90 KB, created by
Srdjan Jankovic
on 2012-02-13 08:02:36 UTC
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2012-02-13 08:02:36 UTC
Size:
2.90 KB
patch
obsolete
>From 071bf2a2844bc101c9a62f1e9b22facdd9c00799 Mon Sep 17 00:00:00 2001 >From: Srdjan Jankovic <srdjan@catalyst.net.nz> >Date: Mon, 13 Feb 2012 20:27:19 +1300 >Subject: [PATCH] bug_7520: Created opac/advanced_search_types.json > >Returns json of AdvancedSearchTypes (collection codes or itemtypes). >Useful for dynamic gbuilding of the search forms. >--- > opac/advanced_search_types.json | 62 +++++++++++++++++++++++++++++++++++++++ > 1 files changed, 62 insertions(+), 0 deletions(-) > create mode 100755 opac/advanced_search_types.json > >diff --git a/opac/advanced_search_types.json b/opac/advanced_search_types.json >new file mode 100755 >index 0000000..14ccd83 >--- /dev/null >+++ b/opac/advanced_search_types.json >@@ -0,0 +1,62 @@ >+#!/usr/bin/perl >+ >+# Copyright 2012 CatalystIT Ltd >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 opac/itemtypes.json >+ >+Returns json list of itemtype, description. Suitable for building drop down lists. >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use CGI; >+use JSON; >+ >+use C4::Koha; >+use C4::Context; >+use C4::Auth; >+ >+my $input = new CGI; >+checkauth($input, C4::Context->preference("OpacPublic"), {}, "opac"); >+ >+my $dbh = C4::Context->dbh; >+my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes"); >+my ($ccl, @typesloop); >+if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') { >+ my $itemtypes = GetItemTypes; >+ my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype'; >+ @typesloop = map { >+ code => $_, >+ description => $itemtypes->{$_}->{'description'}, >+ imageurl => getitemtypeimagelocation( 'opac', $itemtypes->{$_}->{'imageurl'} ), >+ }, sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes; >+ $ccl = "$itype_or_itemtype,phr"; >+} else { >+ my $advsearchtypes = GetAuthorisedValues($advanced_search_types); >+ @typesloop = map { >+ code => $_->{authorised_value}, >+ description => $_->{'lib'}, >+ imageurl => getitemtypeimagelocation( 'opac', $_->{'imageurl'} ), >+ }, @$advsearchtypes; >+ $ccl = $advanced_search_types; >+} >+ >+print $input->header('application/json'); >+print to_json({ ccl => $advanced_search_types, types => \@typesloop }); >-- >1.6.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 7520
:
7556
|
7605
|
7606
|
7611
|
7613
|
53865
|
53867
|
60538
|
60539