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

(-)a/C4/Breeding.pm (-1 / +3 lines)
Lines 559-564 sub Z3950SearchAuth { Link Here
559
    my $subject= $pars->{subject};
559
    my $subject= $pars->{subject};
560
    my $subjectsubdiv= $pars->{subjectsubdiv};
560
    my $subjectsubdiv= $pars->{subjectsubdiv};
561
    my $srchany= $pars->{srchany};
561
    my $srchany= $pars->{srchany};
562
    my $authid= $pars->{authid};
562
563
563
    my $show_next       = 0;
564
    my $show_next       = 0;
564
    my $total_pages     = 0;
565
    my $total_pages     = 0;
Lines 708-718 sub Z3950SearchAuth { Link Here
708
                            $row_data{server}       = $servername[$k];
709
                            $row_data{server}       = $servername[$k];
709
                            $row_data{breedingid}   = $breedingid;
710
                            $row_data{breedingid}   = $breedingid;
710
                            $row_data{heading}      = $heading;
711
                            $row_data{heading}      = $heading;
712
                            $row_data{authid}       = $authid;
711
                            $row_data{heading_code}      = $heading_authtype_code;
713
                            $row_data{heading_code}      = $heading_authtype_code;
712
                            push( @breeding_loop, \%row_data );
714
                            push( @breeding_loop, \%row_data );
713
                        }
715
                        }
714
                        else {
716
                        else {
715
                            push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1});
717
                            push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'authid'=>-1});
716
                        }
718
                        }
717
                    }
719
                    }
718
                }    #if $numresults
720
                }    #if $numresults
(-)a/authorities/authorities.pl (+23 lines)
Lines 344-349 sub CreateKey { Link Here
344
    return int(rand(1000000));
344
    return int(rand(1000000));
345
}
345
}
346
346
347
=item GetMandatoryFieldZ3950
348
349
    This function return an hashref which containts all mandatory field
350
    to search with z3950 server.
351
352
=cut
353
354
sub GetMandatoryFieldZ3950($){
355
    my $authtypecode = shift;
356
357
    #Tags guessed (see GuessAuthTypeCode from AuthoritiesMarc.pm)
358
359
    return {
360
        '100'.'a' => 'authorpersonal',
361
        '110'.'a' => 'authorcorp',
362
        '111'.'a' => 'authormeetingcon',
363
        '130'.'a' => 'uniformtitle',
364
        '150'.'a' => 'topic',
365
    };
366
}
367
347
sub build_tabs {
368
sub build_tabs {
348
    my ( $template, $record, $dbh, $encoding,$input ) = @_;
369
    my ( $template, $record, $dbh, $encoding,$input ) = @_;
349
370
Lines 580-585 my ($template, $loggedinuser, $cookie) Link Here
580
$template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid,);
601
$template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid,);
581
602
582
$tagslib = GetTagsLabels(1,$authtypecode);
603
$tagslib = GetTagsLabels(1,$authtypecode);
604
$mandatory_z3950 = GetMandatoryFieldZ3950($authtypecode);
605
583
my $record=-1;
606
my $record=-1;
584
my $encoding="";
607
my $encoding="";
585
if (($authid) && !($breedingid)){
608
if (($authid) && !($breedingid)){
(-)a/cataloguing/z3950_auth_search.pl (+3 lines)
Lines 29-34 use C4::Koha; Link Here
29
my $input        = new CGI;
29
my $input        = new CGI;
30
my $dbh          = C4::Context->dbh;
30
my $dbh          = C4::Context->dbh;
31
my $error         = $input->param('error');
31
my $error         = $input->param('error');
32
my $authid  = $input->param('authid') || 0;
32
my $nameany     = $input->param('nameany');
33
my $nameany     = $input->param('nameany');
33
my $authorany     = $input->param('authorany');
34
my $authorany     = $input->param('authorany');
34
my $authorcorp     = $input->param('authorcorp');
35
my $authorcorp     = $input->param('authorcorp');
Lines 62-67 $template->param( Link Here
62
    subject      => $subject,
63
    subject      => $subject,
63
    subjectsubdiv   => $subjectsubdiv,
64
    subjectsubdiv   => $subjectsubdiv,
64
    srchany      => $srchany,
65
    srchany      => $srchany,
66
    authid => $authid,
65
);
67
);
66
68
67
if ( $op ne "do_search" ) {
69
if ( $op ne "do_search" ) {
Lines 98-103 my $pars= { Link Here
98
        subject => $subject,
100
        subject => $subject,
99
        subjectsubdiv => $subjectsubdiv,
101
        subjectsubdiv => $subjectsubdiv,
100
        srchany => $srchany,
102
        srchany => $srchany,
103
        authid => $authid,
101
};
104
};
102
Z3950SearchAuth($pars, $template);
105
Z3950SearchAuth($pars, $template);
103
output_html_with_http_headers $input, $cookie, $template->output;
106
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-toolbar.inc (-1 / +7 lines)
Lines 7-13 Link Here
7
        });
7
        });
8
8
9
        $("#z3950submit").click(function(){
9
        $("#z3950submit").click(function(){
10
            window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
10
            [% IF ( authid ) %]
11
                if (confirm(_("Please note that this Z39.50 search could replace the current record."))){
12
                    window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]","z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
13
                }
14
            [% ELSE %]
15
                window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
16
            [% END %]
11
            return false;
17
            return false;
12
        });
18
        });
13
19
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt (+31 lines)
Lines 17-25 Link Here
17
                $("#f").submit();
17
                $("#f").submit();
18
            }
18
            }
19
		});
19
		});
20
        $("#z3950submit").click(function(){
21
            if (confirm(_("Please note that this Z39.50 search could replace the current record."))){
22
                var strQuery = GetZ3950Terms();
23
                if(strQuery){
24
                    window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
25
                }
26
            }
27
            return false;
28
        });
20
	 });
29
	 });
21
30
22
/**
31
/**
32
 * check if z3950 mandatories are set or not
33
 */
34
function GetZ3950Terms(){
35
 var strQuery="&authtypecode="+document.forms['f'].authtypecode.value;
36
    var mandatories = new Array();
37
    var mandatories_label = new Array();
38
    [% FOREACH BIG_LOO IN BIG_LOOP %][% FOREACH innerloo IN BIG_LOO.innerloop %][% FOREACH subfield_loo IN innerloo.subfield_loop %][% IF ( subfield_loo.z3950_mandatory ) %]mandatories.push("[% subfield_loo.id %]");
39
        mandatories_label.push("[% subfield_loo.z3950_mandatory %]");[% END %][% END %][% END %][% END %]
40
41
    for(var i=0,len=mandatories.length; i<len ; i++){
42
        var field_value = document.getElementById(mandatories[i]).value;
43
        if( field_value ){
44
            strQuery += "&"+mandatories_label[i]+"="+field_value;
45
        }
46
    }
47
    return strQuery;
48
}
49
50
/**
23
 * check if mandatory subfields are written
51
 * check if mandatory subfields are written
24
 */
52
 */
25
function AreMandatoriesNotOk(){
53
function AreMandatoriesNotOk(){
Lines 177-182 function confirmnotdup(redirect){ Link Here
177
205
178
    <div id="toolbar" class="btn-toolbar">
206
    <div id="toolbar" class="btn-toolbar">
179
        <div class="btn-group"><a href="#" id="addauth" class="btn btn-small" accesskey="w"><i class="icon-hdd"></i> Save</a></div>
207
        <div class="btn-group"><a href="#" id="addauth" class="btn btn-small" accesskey="w"><i class="icon-hdd"></i> Save</a></div>
208
        <div class="btn-group">
209
            <a class="btn btn-small" id="z3950submit" href="#"><i class="icon-search"></i> Z39.50 search</a>
210
        </div>
180
    </div>
211
    </div>
181
212
182
<div id="authoritytabs" class="toptabs numbered">
213
<div id="authoritytabs" class="toptabs numbered">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt (-10 / +11 lines)
Lines 7-14 Link Here
7
[% INCLUDE 'datatables.inc' %]
7
[% INCLUDE 'datatables.inc' %]
8
<script type="text/javascript">
8
<script type="text/javascript">
9
//<![CDATA[
9
//<![CDATA[
10
function Import(Breeding,AuthType) {
10
function Import(Breeding,AuthType,authid) {
11
    opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType;
11
    opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+authid;
12
    window.close();
12
    window.close();
13
    return false;
13
    return false;
14
}
14
}
Lines 103-108 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
103
        <h2>Z39.50 Authority search points</h2>
103
        <h2>Z39.50 Authority search points</h2>
104
        <form method="post" action="z3950_auth_search.pl" name="f" class="checkboxed">
104
        <form method="post" action="z3950_auth_search.pl" name="f" class="checkboxed">
105
        <input type="hidden" name="op" id="op" value="do_search" />
105
        <input type="hidden" name="op" id="op" value="do_search" />
106
        <input type="hidden" name="authid" value="[% authid %]" />
106
        <div class="yui-g">
107
        <div class="yui-g">
107
            <div class="yui-u first">
108
            <div class="yui-u first">
108
                <fieldset class="rows">
109
                <fieldset class="rows">
Lines 110-118 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
110
                    <li><label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
111
                    <li><label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
111
                    <li><label for="nameany">Name (any): </label> <input type="text" id="nameany" name="nameany" value="" /></li>
112
                    <li><label for="nameany">Name (any): </label> <input type="text" id="nameany" name="nameany" value="" /></li>
112
                    <li><label for="authorany">Author (any): </label> <input type="text" id="authorany" name="authorany" value="" /></li>
113
                    <li><label for="authorany">Author (any): </label> <input type="text" id="authorany" name="authorany" value="" /></li>
113
                    <li><label for="authorpersonal">Author (personal): </label> <input type="text" id="authorpersonal" name="authorpersonal" value="" /></li>
114
                    <li><label for="authorpersonal">Author (personal): </label> <input type="text" id="authorpersonal" name="authorpersonal" value="[% authorpersonal |html %]" /></li>
114
                    <li><label for="authorcorp">Author (corporate): </label> <input type="text" id="authorcorp" name="authorcorp" value="" /></li>
115
                    <li><label for="authorcorp">Author (corporate): </label> <input type="text" id="authorcorp" name="authorcorp" value="[% authorcorp |html %]" /></li>
115
                    <li><label for="authormeetingcon">Author (meeting/conference): </label> <input type="text" id="authormeetingcon" name="authormeetingcon" value="" /></li>
116
                    <li><label for="authormeetingcon">Author (meeting/conference): </label> <input type="text" id="authormeetingcon" name="authormeetingcon" value="[% authormeetingcon |html %]" /></li>
116
                </ol>
117
                </ol>
117
                </fieldset>
118
                </fieldset>
118
            </div>
119
            </div>
Lines 159-170 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
159
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
160
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
160
        [% IF ( breeding_loo.breedingid ) %]
161
        [% IF ( breeding_loo.breedingid ) %]
161
        <tr id="row[% breeding_loo.breedingid %]">
162
        <tr id="row[% breeding_loo.breedingid %]">
162
            <td>[% breeding_loo.server %] <div class="linktools"><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" rel="gb_page_center[600,500]">Preview MARC</a> <a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a><a href="#" onclick="closemenu();return false;" title="Close this menu"> X </a></div> </td>
163
            <td>[% breeding_loo.server %] <div class="linktools"><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" rel="gb_page_center[600,500]">Preview MARC</a> <a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]','[% breeding_loo.authid %]'); return false">Import</a><a href="#" onclick="closemenu();return false;" title="Close this menu"> X </a></div> </td>
163
            <td>[% breeding_loo.heading %]</td>
164
            <td>[% breeding_loo.heading %]</td>
164
            <td>[% breeding_loo.heading_code %]</td>
165
            <td>[% breeding_loo.heading_code %]</td>
165
            <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">MARC</a></td>
166
            <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">MARC</a></td>
166
            <!-- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> -->
167
            <!-- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> -->
167
            <td><a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a></td>
168
            <td><a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]','[% breeding_loo.authid %]'); return false">Import</a></td>
168
        </tr>
169
        </tr>
169
        [% END %]
170
        [% END %]
170
    [% END %]</tbody>
171
    [% END %]</tbody>
Lines 184-189 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
184
        <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv %]" />
185
        <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv %]" />
185
        <input type="hidden" id="heading"  name="heading" value="[% heading %]" />
186
        <input type="hidden" id="heading"  name="heading" value="[% heading %]" />
186
        <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
187
        <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
188
        <input type="hidden" name="authid" value="[% authid %]" />
187
189
188
        [% FOREACH server IN servers %]
190
        [% FOREACH server IN servers %]
189
        <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
191
        <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
Lines 199-205 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
199
        <br />Go to page : <input id="goto_page" name="goto_page" value="[% current_page %]" size="4" /><input type="submit" name="changepage_goto" onclick="return validate_goto_page();" value="Go" />
201
        <br />Go to page : <input id="goto_page" name="goto_page" value="[% current_page %]" size="4" /><input type="submit" name="changepage_goto" onclick="return validate_goto_page();" value="Go" />
200
    </form>
202
    </form>
201
203
202
<p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
204
<p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="hidden" name="authid" value="[% authid %]" /><input type="submit" value="Try Another Search"/></form></p>
203
    [% ELSE %]
205
    [% ELSE %]
204
        [% IF ( errconn ) %]
206
        [% IF ( errconn ) %]
205
            <div class="dialog alert">
207
            <div class="dialog alert">
Lines 212-218 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
212
            </div>
214
            </div>
213
         [% END %]
215
         [% END %]
214
   <div class="dialog message">Nothing found.</div>
216
   <div class="dialog message">Nothing found.</div>
215
    <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
217
    <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="hidden" name="authid" value="[% authid %]" /><input type="submit" value="Try Another Search"/></form></p>
216
    [% END %]
218
    [% END %]
217
219
218
[% END %]
220
[% END %]
219
- 

Return to bug 11961