Bugzilla – Attachment 34031 Details for
Bug 13204
Plugin housekeeping: Remove labs_theses.pl plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13204: Plugin housekeeping: Remove labs_theses.pl plugin
Bug-13204-Plugin-housekeeping-Remove-labsthesespl-.patch (text/plain), 11.69 KB, created by
Frédéric Demians
on 2014-12-01 08:51:38 UTC
(
hide
)
Description:
Bug 13204: Plugin housekeeping: Remove labs_theses.pl plugin
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2014-12-01 08:51:38 UTC
Size:
11.69 KB
patch
obsolete
>From 5ed00b33de1c6c619ab446d937be9a3ba7cba2db Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 20 Oct 2014 12:36:36 +0200 >Subject: [PATCH] Bug 13204: Plugin housekeeping: Remove labs_theses.pl plugin > >As it seems, this plugin has been created for UNIMARC field 328 >(Dissertation note). It refers to authval category LABTHE. > >The plugin seems however not to be used: it contains several critical errors. >I tried a quick fix but it was not good enough. Since the code can be >recovered from git (if needed), a real fix can always follow this patch. > >What are some problems: >[1] The path to the template is wrong. Should be cataloguing/value_builder >[2] The plugin parameter $input is not used. A new CGI object is created. >[3] Resolving errors 1 and 2 still results in premature end of script > headers. >[4] Not sure whether the plugin can effectively handle missing LABTHE values. > >Instead of keeping this in Koha, I opt for removing it for now. As additional >argument I would mention that labs_theses does not have Focus or Blur actions, >only the Click action that does not work. > >Test plan: >Git grep on labs_theses. > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> > >This antique plugin deserves to live forever in Git Historical Museum. >--- > cataloguing/value_builder/labs_theses.pl | 188 --------------------- > .../cataloguing/value_builder/labs_theses.tt | 122 ------------- > 2 files changed, 310 deletions(-) > delete mode 100755 cataloguing/value_builder/labs_theses.pl > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/labs_theses.tt > >diff --git a/cataloguing/value_builder/labs_theses.pl b/cataloguing/value_builder/labs_theses.pl >deleted file mode 100755 >index f7338cb..0000000 >--- a/cataloguing/value_builder/labs_theses.pl >+++ /dev/null >@@ -1,188 +0,0 @@ >-#!/usr/bin/perl >- >-# Copyright 2000-2002 Katipo Communications >-# >-# 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. >- >-use strict; >-#use warnings; FIXME - Bug 2505 >- >-use CGI; >- >-use C4::Output; >-use C4::Context; >-use C4::Auth; >-use C4::Output; >- >-use C4::Koha; >- >-sub plugin_parameters { >-my ($dbh,$record,$tagslib,$i,$tabloop) = @_; >-return ""; >-} >- >-sub plugin_javascript { >-my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >-my $function_name= "328".(int(rand(100000))+1); >-my $res=" >-<script type=\"text/javascript\"> >-//<![CDATA[ >- >-function Focus$function_name(subfield_managed) { >-return 1; >-} >- >-function Blur$function_name(subfield_managed) { >- return 1; >-} >- >-function Clic$function_name(i) { >- defaultvalue=document.f.field_value[i].value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=labs_theses.pl&cat_auth=LABTHE&index=\"+i+\"&result=\"+defaultvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes'); >- >-} >-//]]> >-</script> >-"; >- >-return ($function_name,$res); >-} >- >-sub plugin { >- my ($input) = @_; >- my $dbh=C4::Context->dbh; >- my $query = new CGI; >- my $op = $query->param('op'); >- my $cat_auth=$query->param('cat_auth'); >- >- my $startfrom=$query->param('startfrom'); >- $startfrom=0 if(!defined $startfrom); >- my ($template, $loggedinuser, $cookie); >- my $resultsperpage; >- my $search = $query->param('search'); >- >- if ($op eq "do_search") { >- >- $resultsperpage= $query->param('resultsperpage'); >- $resultsperpage = 19 if(!defined $resultsperpage); >-# my $upperlimit=$startfrom+$resultsperpage; >- # builds tag and subfield arrays >- my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?"; >-# $strquery .= " LIMIT $startfrom,$upperlimit"; >- >- $search=~s/\*/%/g; >- my $sth = $dbh->prepare($strquery); >- $sth->execute($cat_auth,$search); >- $search=~s/%/\*/g; >- >- >- my @results; >- my $total; >- while (my $data = $sth->fetchrow_hashref){ >- my $libjs=$data->{'lib'}; >- $libjs=~s#\'#\\\'#g; >- my $authjs=$data->{'authorised_value'}; >- $authjs=~s#\'#\\\'#g; >- push @results, {'libjs'=>$libjs, >- 'lib'=>$data->{'lib'}, >- 'authjs'=>$authjs, >- 'auth_value'=>$data->{'authorised_value'}} >- unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage)); >- $total++; >- } >- >- ($template, $loggedinuser, $cookie) = get_template_and_user( >- { >- template_name => "value_builder/labs_theses.tt", >- query => $query, >- type => 'intranet', >- authnotrequired => 0, >- debug => 1, >- } >- ); >- >- # multi page display gestion >- my $displaynext=0; >- my $displayprev=$startfrom; >- if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){ >- $displaynext = 1; >- } >- >- my @numbers = (); >- >- if ($total>$resultsperpage) >- { >- for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++) >- { >- my $highlight=0; >- ($startfrom==($i-1)) && ($highlight=1); >- push @numbers, { number => $i, >- highlight => $highlight , >- search=> $search, >- startfrom => $resultsperpage*($i-1)}; >- } >- } >- >- my $from = $startfrom+1; >- my $to; >- >- if($total < (($startfrom+1)*$resultsperpage)) >- { >- $to = $total; >- } else { >- $to = (($startfrom+1)*$resultsperpage); >- } >- $template->param(catresult => \@results, >- cat_auth=>$cat_auth, >- index => $query->param('index')."", >- startfrom=> $startfrom, >- displaynext=> $displaynext, >- displayprev=> $displayprev, >- resultsperpage => $resultsperpage, >- startfromnext => $startfrom+$resultsperpage, >- startfromprev => $startfrom-$resultsperpage, >- search=>$search, >- total=>$total, >- from=>$from, >- to=>$to, >- numbers=>\@numbers, >- resultlist=>1 >- ); >- >- } else { >- ($template, $loggedinuser, $cookie) = get_template_and_user( >- { >- template_name => "value_builder/labs_theses.tt", >- query => $query, >- type => "intranet", >- authnotrequired => 0, >- } >- ); >- >- $template->param( >- 'search'=>$query->param('search'), >- ); >- $template->param( >- 'index'=>''.$query->param('index') >- ) if ($query->param('index')); >- $template->param( >- 'cat_auth'=>$cat_auth >- ) if ($cat_auth); >- } >- output_html_with_http_headers $query, $cookie, $template->output ; >-} >- >-1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/labs_theses.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/labs_theses.tt >deleted file mode 100644 >index 2162747..0000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/labs_theses.tt >+++ /dev/null >@@ -1,122 +0,0 @@ >-[% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Labs thesis selection plugin</title> >-[% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >-function openWindow(targeturl, windowname) { >- newwin = >-window.open(targeturl,windowname,"height=480,width=640,scrollbars,resizable") >-} >-function Help() { >- newin=window.open("/cgi-bin/koha/help.pl","KohaHelp",'width=600,height=600,toolbar=false,scrollbars=yes'); >-} >-//]]> >-</script> >- >-<link rel="stylesheet" type="text/css" href="/intranet-tmpl/default/en/includes/common-style.css" /> >-<style type="text/css"> >-.catalogue { >- background-color:#ad11ad; >- color:#FFFFFF; >- background-image:none; >- text-decoration: normal; >- } >-a.catalogue:hover { >- background-color: #ad11ad; >- color: #FFFFFF; >- text-decoration: none; >- } >-</style> >-</head> >- >-<body id="cat_labs_theses" class="cat" style="padding:1em;"> >-<div id="mainbloc"> >- <h1>Laboratory search</h1> >- >- <form name="f" method="post" action="/cgi-bin/koha/cataloguing/plugin_launcher.pl"> >- <div class="bloc25"> >- <h2>Search on</h2> >- <p> >- <input type="hidden" name="plugin_name" value="labs_theses.pl"> >- <input type="hidden" name="index" value="[% index %]"> >- <input type="hidden" name="result" value="unimarc field 328 [% index %]"> >- <input type="hidden" name="op" value="do_search"> >- <input type="hidden" name="cat_auth" value="[% cat_auth %]" > >- <input type="text" name="search" value="[% search %]" size="35"> >- >- <input type="submit" value="Start search" class="button"> >- </p> >- </div> >- </form> >- >-[% IF ( resultlist ) %] >- <div class="bloc25"> >- <h2>Laboratory search results</h2> >- <div id="resultnumber"> >- <p class="resultcount"> >- [% IF ( total ) %] >- Results [% from %] to [% to %] of [% total %][% ELSE %]No results found >- [% END %] >- </p> >- </div> >- <div id="resultlist"> >- <table> >- <tr> >- <th>Laboratory</th> >- <th>Select</th> >- </tr> >- [% FOREACH catresul IN catresult %] >- [% IF ( catresul.even ) %] >- <tr class="hilighted"> >- [% ELSE %] >- <tr> >- [% END %] >- <td> >- [% catresul.lib %] >- </td> >- <td> >- <a href="javascript:SelectEntry('[% catresul.libjs |url %]','[% catresul.authjs |url %]',[% catresul.index |url %],0)" class="button">Select</a> >- <a href="javascript:SelectEntry('[% catresul.libjs |url %]','[% catresul.authjs |url %]',[% catresul.index |url %],1)" class="button">Sel&close</a> >- </td> >- </tr> >- [% END %] >- </table> >- </div> >- <div id="resultnumber"> >- <p>[% IF ( displayprev ) %] >- <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=labs_theses.pl&startfrom=[% startfromprev %]&cat_auth=[% cat_auth |url %]&search=[% search |url %]&resultsperpage=[% resultsperpage %]&type=intranet&op=do_search&index=[% anindex %]"><< Previous</a> >- [% END %] >- [% FOREACH number IN numbers %] >- [% IF ( number.highlight ) %] >- <span class="highlight">[% number.number %]</span> >- [% ELSE %] >- <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=labs_theses.pl&startfrom=[% number.startfrom %]&cat_auth=[% number.cat_auth |url %]&search=[% number.search |url %]&resultsperpage=[% number.resultsperpage %]&type=intranet&op=do_search&index=[% number.anindex %]">[% number.number %]</a> >- [% END %] >- [% END %] >- [% IF ( displaynext ) %] >- <a class="resultnumber" href="/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=labs_theses.pl&startfrom=[% startfromnext %]&cat_auth=[% cat_auth |url %]&search=[% search %]&resultsperpage=[% resultsperpage %]&type=intranet&op=do_search&index=[% anindex %]">Next>></a> >- [% END %] >- </p> >- <p class="resultcount"> >- [% IF ( total ) %] >- Results [% from %] to [% to %] of [% total %][% ELSE %]No results found >- [% END %] >- </p> >- </div> >- <script language="JavaScript" type="text/javascript"> >- function SelectEntry(myentry, mycode, myindex, wclose){ >- if (opener.document.f.field_value[myindex].value!=""){ >- opener.document.f.field_value[myindex].value=opener.document.f.field_value[myindex].value+"|"+myentry >- } else { >- opener.document.f.field_value[myindex].value=myentry >- } >- if (wclose == 1) { >- // alert("closing") >- self.close(); >- } >- } >- </script> >- </div> >-[% END %] >-</div> >-[% INCLUDE 'popup-bottom.inc' %] >-- >2.1.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 13204
:
33246
|
34031
|
34155