View | Details | Raw Unified | Return to bug 5692
Collapse All | Expand All

(-)a/cataloguing/plugin_launcher.pl (-8 / +8 lines)
Lines 1-6 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
2
3
4
# Copyright 2000-2002 Katipo Communications
3
# Copyright 2000-2002 Katipo Communications
5
#
4
#
6
# This file is part of Koha.
5
# This file is part of Koha.
Lines 19-38 Link Here
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
19
21
use strict;
20
use strict;
21
22
#use warnings; FIXME - Bug 2505
22
#use warnings; FIXME - Bug 2505
23
use CGI;
23
use CGI;
24
use C4::Context;
24
use C4::Context;
25
use C4::Output;
25
use C4::Output;
26
26
27
my $input = new CGI;
27
my $input       = new CGI;
28
my $plugin_name="cataloguing/value_builder/".$input->param("plugin_name");
28
my $plugin_name = "cataloguing/value_builder/" . $input->param("plugin_name");
29
29
30
# opening plugin. Just check wether we are on a developper computer on a production one
30
# opening plugin. Just check wether we are on a developper computer on a production one
31
# (the cgidir differs)
31
# (the cgidir differs)
32
my $cgidir = C4::Context->intranetdir ."/cgi-bin";
32
my $cgidir = C4::Context->intranetdir . "/cgi-bin";
33
my $vbdir = "$cgidir/cataloguing/value_builder";
33
my $vbdir  = "$cgidir/cataloguing/value_builder";
34
unless (-r $vbdir and -d $vbdir) {
34
unless ( -r $vbdir and -d $vbdir ) {
35
	$cgidir = C4::Context->intranetdir;
35
    $cgidir = C4::Context->intranetdir;
36
}
36
}
37
do $cgidir."/".$plugin_name;
37
do $cgidir . "/" . $plugin_name;
38
&plugin($input);
38
&plugin($input);
(-)a/cataloguing/value_builder/unimarc_field_210c_bis.pl (+110 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2000-2002 Katipo Communications
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
=head1 SYNOPSIS
21
22
This plugin is used to map isbn/editor with collection.
23
It need :
24
  in thesaurus, a category named EDITORS
25
  in this category, datas must be entered like following :
26
  isbn separator editor separator collection.
27
  for example :
28
  2204 -- Cerf -- Cogitatio fidei
29
  2204 -- Cerf -- Le Magistere de l'Eglise
30
  2204 -- Cerf -- Lectio divina
31
  2204 -- Cerf -- Lire la Bible
32
  2204 -- Cerf -- Pour lire
33
  2204 -- Cerf -- Sources chretiennes
34
35
  when the user clic on ... on 225a line, the popup shows the list of collections from the selected editor
36
  if the biblio has no isbn, then the search if done on editor only
37
  If the biblio ha an isbn, the search is done on isbn and editor. It's faster.
38
39
=over 2
40
41
=cut
42
43
use strict;
44
45
#use warnings; FIXME - Bug 2505
46
use C4::Auth;
47
use CGI;
48
use C4::Context;
49
50
use C4::AuthoritiesMarc;
51
use C4::Output;
52
53
=head1
54
55
plugin_parameters : other parameters added when the plugin is called by the dopop function
56
57
=cut
58
59
sub plugin_parameters {
60
    my ( $dbh, $record, $tagslib, $i, $tabloop ) = @_;
61
    return "";
62
}
63
64
sub plugin_javascript {
65
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
66
    my $function_name = $field_number;
67
    my $res           = "
68
    <script type=\"text/javascript\">
69
        function Focus$function_name(subfield_managed) {
70
            return 1;
71
        }
72
    
73
        function Blur$function_name(subfield_managed) {
74
            return 1;
75
        }
76
    
77
        function Clic$function_name(index) {
78
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_210c_bis.pl&index=\"+index,\"unimarc210c\",'width=500,height=400,toolbar=false,scrollbars=no');
79
        }
80
    </script>
81
";
82
83
    return ( $function_name, $res );
84
}
85
86
sub plugin {
87
    my ($input)      = @_;
88
    my $index        = $input->param('index');
89
    my $result       = $input->param('result');
90
    my $editor_found = $input->param('editor_found');
91
    my $authoritysep = C4::Context->preference("authoritysep");
92
    warn Data::Dumper::Dumper $index;
93
94
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
95
        {   template_name   => "cataloguing/value_builder/unimarc_field_210c_bis.tmpl",
96
            query           => $input,
97
            type            => "intranet",
98
            authnotrequired => 0,
99
            flagsrequired   => { editcatalogue => '*' },
100
            debug           => 1,
101
        }
102
    );
103
104
   $template->param(
105
        index      => $index,
106
    );
107
    output_html_with_http_headers $input, $cookie, $template->output;
108
}
109
110
1;
(-)a/cataloguing/ysearch.pl (+78 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
4
5
# Copyright 2007 Tamil s.a.r.l.
6
#
7
# This file is part of Koha.
8
#
9
# Koha is free software; you can redistribute it and/or modify it under the
10
# terms of the GNU General Public License as published by the Free Software
11
# Foundation; either version 2 of the License, or (at your option) any later
12
# version.
13
#
14
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
#
18
# You should have received a copy of the GNU General Public License along
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22
=head1 ysearch.pl
23
24
25
=cut
26
27
use strict;
28
29
#use warnings; FIXME - Bug 2505
30
use CGI;
31
use C4::Context;
32
use C4::Auth qw/check_cookie_auth/;
33
34
my $input = new CGI;
35
my $query = $input->param('query');
36
my $table = $input->param('table');
37
my $field = $input->param('field');
38
39
# Prevent from disclosing data
40
die() unless ($table eq "biblioitems"); 
41
42
binmode STDOUT, ":utf8";
43
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
44
45
my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { cataloguing => '*' } );
46
if ( $auth_status ne "ok" ) {
47
    exit 0;
48
}
49
50
my $dbh = C4::Context->dbh;
51
my $sql = qq(SELECT distinct $field 
52
             FROM $table 
53
             WHERE $field LIKE ? OR $field LIKE ? or $field LIKE ?);
54
$sql .= qq( ORDER BY $field);
55
my $sth = $dbh->prepare($sql);
56
$sth->execute("$query%", "% $query%", "%-$query%");
57
58
while ( my $rec = $sth->fetchrow_hashref ) {
59
    print nsb_clean($rec->{$field}) . "\n";
60
}
61
62
sub nsb_clean {
63
    my $NSB = '\x88' ;        # NSB : begin Non Sorting Block
64
    my $NSE = '\x89' ;        # NSE : Non Sorting Block end
65
    my $NSB2 = '\x98' ;        # NSB : begin Non Sorting Block
66
    my $NSE2 = '\x9C' ;        # NSE : Non Sorting Block end
67
    # handles non sorting blocks
68
    my ($string) = @_ ;
69
    $_ = $string ;
70
    s/$NSB//g ;
71
    s/$NSE//g ;
72
    s/$NSB2//g ;
73
    s/$NSE2//g ;
74
    $string = $_ ;
75
76
    return($string) ;
77
}
78
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_210c_bis.tmpl (-1 / +75 lines)
Line 0 Link Here
0
- 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
4
<head>
5
    <title>UNIMARC_Field 225a builder</title>
6
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
    <script type="text/javascript" src="<!-- TMPL_VAR NAME="yuipath" -->/utilities/utilities.js"></script> 
8
    <script type="text/javascript" src="<!-- TMPL_VAR NAME="yuipath" -->/datasource/datasource.js"></script> 
9
    <script type="text/javascript" src="<!-- TMPL_VAR NAME="yuipath" -->/autocomplete/autocomplete-min.js"></script>
10
    <link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR NAME="themelang" -->/css/staff-global.css" />
11
12
</head>
13
<body>
14
<div id="header_search">
15
<script type="text/javascript">
16
//<![CDATA[
17
YAHOO.util.Event.onContentReady("header_search", function() {
18
    new function() {
19
        // Define a custom formatter function
20
        this.fnCustomFormatter = function(oResultItem, sQuery) {
21
            var name        = oResultItem[0];
22
            var aMarkup = [
23
                "<div class=\"sample-result\">",
24
                name,
25
                "<\/div>"];
26
            return (aMarkup.join(""));
27
        };
28
29
        // Instantiate one XHR DataSource and define schema as an array:
30
        //     ["Record Delimiter",
31
        //     "Field Delimiter"]
32
        this.oACDS = new YAHOO.widget.DS_XHR("/cgi-bin/koha/cataloguing/ysearch.pl", ["\n", "\t"]);
33
        this.oACDS.scriptQueryAppend = "table=biblioitems&field=publishercode";
34
        this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
35
        this.oACDS.maxCacheEntries = 60;
36
        this.oACDS.queryMatchSubset = false;
37
    
38
        // Instantiate first AutoComplete
39
        var myInput = document.getElementById('findvalue');
40
        var myContainer = document.getElementById('yvaluecontainer');
41
        this.oAutoComp = new YAHOO.widget.AutoComplete(myInput,myContainer,this.oACDS);
42
        //this.oAutoComp.delimChar = ";";
43
        this.oAutoComp.queryDelay = 1;
44
        this.oAutoComp.formatResult = this.fnCustomFormatter;
45
        this.oAutoComp.maxResultsDisplayed = 1000;
46
}
47
});    
48
//]]>
49
</script>
50
    <div id="mainbloc">
51
52
<div id="plugin">
53
<div class="autocomplete">
54
        <form name="f_pop" onsubmit="javascript:report()" action="">
55
            <div id="borrowerautocomplete" class="autocomplete">
56
                <input autocomplete="off" id="findvalue" name="findvalue" size="40" class="focus" type="text" /><br /><br /> 
57
		<input id="ysearchsubmit" type="submit" class="submit" value="Submit" />
58
                <div id="yvaluecontainer"></div>
59
            </div>
60
        </form>
61
    </div>
62
</div>    
63
</div>
64
    <script type="text/javascript">
65
        function report() {
66
            var doc   = opener.document; 
67
            var field = doc.getElementById("<!-- TMPL_VAR NAME='index'-->");
68
            field.value =  document.f_pop.findvalue.value;
69
70
            window.close();
71
            return false;
72
        }
73
    </script>
74
</body>
75
</html>

Return to bug 5692