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

(-)a/cataloguing/value_builder/unimarc_field_225a_bis.pl (+63 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
=head1 SYNOPSIS
19
20
This plugin is used to fill 225$a with a value already existing in
21
biblioitems.collectiontitle
22
23
=cut
24
25
use Modern::Perl;
26
27
use C4::Auth;
28
use CGI qw( -utf8 );
29
use C4::Context;
30
31
use C4::Output;
32
33
sub plugin_javascript {
34
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
35
    my $function_name = $field_number;
36
    my $res           = "
37
    <script type=\"text/javascript\">
38
        function Clic$function_name(index) {
39
            window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_225a_bis.pl&index=\"+index,\"unimarc225a\",'width=500,height=400,toolbar=false,scrollbars=no');
40
        }
41
    </script>
42
";
43
44
    return ( $function_name, $res );
45
}
46
47
sub plugin {
48
    my ($input) = @_;
49
    my $index   = $input->param('index');
50
51
    my ($template, $loggedinuser, $cookie) = get_template_and_user({
52
        template_name   => "cataloguing/value_builder/unimarc_field_225a_bis.tt",
53
        query           => $input,
54
        type            => "intranet",
55
        authnotrequired => 0,
56
        flagsrequired   => { editcatalogue => '*' },
57
        debug           => 1,
58
    });
59
60
    $template->param(index => $index);
61
62
    output_html_with_http_headers $input, $cookie, $template->output;
63
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_225a_bis.tt (-1 / +63 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; UNIMARC field 225a builder</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
<style type="text/css">
5
    #custom-doc {
6
        width:37.85em;
7
        min-width:492px;
8
        margin:auto;
9
        text-align:left;
10
    }
11
</style>
12
13
</head>
14
<body id="cat_unimarc_field_225a_bis" class="cat">
15
16
  <div id="custom-doc" class="yui-t7">
17
    <div id="bd">
18
      <h1>UNIMARC field 225a builder</h1>
19
      <div class="autocomplete">
20
        <form>
21
          <div id="fieldautocomplete" class="autocomplete">
22
            <fieldset>
23
              <input autocomplete="off" id="findvalue" name="findvalue" size="40" class="focus" type="text" />
24
              <fieldset class="action">
25
                <input type="submit" class="submit" value="Choose" />
26
              </fieldset>
27
            </fieldset>
28
          </div>
29
        </form>
30
      </div>
31
    </div>
32
  </div>
33
34
  <script>
35
    //<![CDATA[
36
    $(document).ready(function(){
37
        $("#findvalue").autocomplete({
38
            source: "/cgi-bin/koha/cataloguing/ysearch.pl?table=biblioitems&field=collectiontitle",
39
            minLength: 3,
40
            select: function(event, ui) {
41
                $("#findvalue").val(ui.item.fieldvalue);
42
                return false;
43
            }
44
        })
45
        .data("ui-autocomplete")._renderItem = function(ul, item) {
46
            return $("<li></li>")
47
                .data("ui-autocomplete-item", item)
48
                .append("<a>" + item.fieldvalue + "</a>")
49
                .appendTo(ul);
50
        };
51
52
        $('form').submit(function() {
53
            var field = opener.document.getElementById("[% index %]");
54
            field.value = $('#findvalue').val();
55
56
            window.close();
57
            return false;
58
        });
59
    });
60
    //]]>
61
  </script>
62
63
[% INCLUDE 'popup-bottom.inc' %]

Return to bug 14793