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

(-)a/C4/Breeding.pm (-1 / +3 lines)
Lines 520-525 sub Z3950SearchAuth { Link Here
520
    my $subject= $pars->{subject};
520
    my $subject= $pars->{subject};
521
    my $subjectsubdiv= $pars->{subjectsubdiv};
521
    my $subjectsubdiv= $pars->{subjectsubdiv};
522
    my $srchany= $pars->{srchany};
522
    my $srchany= $pars->{srchany};
523
    my $authid= $pars->{authid};
523
524
524
    my $show_next       = 0;
525
    my $show_next       = 0;
525
    my $total_pages     = 0;
526
    my $total_pages     = 0;
Lines 672-682 sub Z3950SearchAuth { Link Here
672
                            $row_data{server}       = $servername[$k];
673
                            $row_data{server}       = $servername[$k];
673
                            $row_data{breedingid}   = $breedingid;
674
                            $row_data{breedingid}   = $breedingid;
674
                            $row_data{heading}      = $heading;
675
                            $row_data{heading}      = $heading;
676
                            $row_data{authid}       = $authid;
675
                            $row_data{heading_code}      = $heading_authtype_code;
677
                            $row_data{heading_code}      = $heading_authtype_code;
676
                            push( @breeding_loop, \%row_data );
678
                            push( @breeding_loop, \%row_data );
677
                        }
679
                        }
678
                        else {
680
                        else {
679
                            push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1});
681
                            push(@breeding_loop,{'server'=>$servername[$k],'title'=>join(': ',$oConnection[$k]->error_x()),'breedingid'=>-1,'authid'=>-1});
680
                        }
682
                        }
681
                    }
683
                    }
682
                }    #if $numresults
684
                }    #if $numresults
(-)a/authorities/authorities.pl (+23 lines)
Lines 323-328 sub CreateKey { Link Here
323
    return int(rand(1000000));
323
    return int(rand(1000000));
324
}
324
}
325
325
326
=item GetMandatoryFieldZ3950
327
328
    This function return an hashref which containts all mandatory field
329
    to search with z3950 server.
330
331
=cut
332
333
sub GetMandatoryFieldZ3950($){
334
    my $authtypecode = shift;
335
336
    #Tags guessed (see GuessAuthTypeCode from AuthoritiesMarc.pm)
337
338
    return {
339
        '100'.'a' => 'authorpersonal',
340
        '110'.'a' => 'authorcorp',
341
        '111'.'a' => 'authormeetingcon',
342
        '130'.'a' => 'uniformtitle',
343
        '150'.'a' => 'topic',
344
    };
345
}
346
326
sub build_tabs {
347
sub build_tabs {
327
    my ( $template, $record, $dbh, $encoding,$input ) = @_;
348
    my ( $template, $record, $dbh, $encoding,$input ) = @_;
328
349
Lines 562-567 my ($template, $loggedinuser, $cookie) Link Here
562
$template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid,);
583
$template->param(nonav   => $nonav,index=>$myindex,authtypecode=>$authtypecode,breedingid=>$breedingid,);
563
584
564
$tagslib = GetTagsLabels(1,$authtypecode);
585
$tagslib = GetTagsLabels(1,$authtypecode);
586
$mandatory_z3950 = GetMandatoryFieldZ3950($authtypecode);
587
565
my $record=-1;
588
my $record=-1;
566
my $encoding="";
589
my $encoding="";
567
if (($authid) && !($breedingid)){
590
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 61-66 $template->param( Link Here
61
    subject      => $subject,
62
    subject      => $subject,
62
    subjectsubdiv   => $subjectsubdiv,
63
    subjectsubdiv   => $subjectsubdiv,
63
    srchany      => $srchany,
64
    srchany      => $srchany,
65
    authid => $authid,
64
);
66
);
65
67
66
if ( $op ne "do_search" ) {
68
if ( $op ne "do_search" ) {
Lines 97-102 my $pars= { Link Here
97
        subject => $subject,
99
        subject => $subject,
98
        subjectsubdiv => $subjectsubdiv,
100
        subjectsubdiv => $subjectsubdiv,
99
        srchany => $srchany,
101
        srchany => $srchany,
102
        authid => $authid,
100
};
103
};
101
Z3950SearchAuth($pars, $template);
104
Z3950SearchAuth($pars, $template);
102
output_html_with_http_headers $input, $cookie, $template->output;
105
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=800,height=500,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 (-12 / +19 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-122 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>
117
                </ol>
118
                </fieldset>
119
            </div>
120
            <div class="yui-u">
121
                <fieldset class="rows">
122
                <ol>
116
                    <li><label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
123
                    <li><label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
117
                    <li><label for="subjectsubdiv">Subject sub-division: </label> <input type="text" id="subjectsubdiv" name="subjectsubdiv" value="" /></li>
124
                    <li><label for="subjectsubdiv">Subject sub-division: </label> <input type="text" id="subjectsubdiv" name="subjectsubdiv" value="" /></li>
118
                    <li><label for="title">Title (any): </label> <input type="text" id="title"  name="title" value="[% title |html %]" /></li>
125
                    <li><label for="title">Title (any): </label> <input type="text" id="title"  name="title" value="[% title | html %]" /></li>
119
                    <li><label for="uniformtitle">Title (uniform): </label> <input type="text" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle |html %]" /></li>
126
                    <li><label for="uniformtitle">Title (uniform): </label> <input type="text" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle | html %]" /></li>
120
                </ol>
127
                </ol>
121
                </fieldset>
128
                </fieldset>
122
            </div>
129
            </div>
Lines 152-163 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
152
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
159
    <tbody>[% FOREACH breeding_loo IN breeding_loop %]
153
        [% IF ( breeding_loo.breedingid ) %]
160
        [% IF ( breeding_loo.breedingid ) %]
154
        <tr id="row[% breeding_loo.breedingid %]">
161
        <tr id="row[% breeding_loo.breedingid %]">
155
            <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>
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 %]','[% breeding_loo.authid %]'); return false">Import</a><a href="#" onclick="closemenu();return false;" title="Close this menu"> X </a></div> </td>
156
            <td>[% breeding_loo.heading %]</td>
163
            <td>[% breeding_loo.heading %]</td>
157
            <td>[% breeding_loo.heading_code %]</td>
164
            <td>[% breeding_loo.heading_code %]</td>
158
            <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">MARC</a></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>
159
            <!-- <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> -->
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> -->
160
            <td><a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a></td>
167
            <td><a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]','[% breeding_loo.authid %]'); return false">Import</a></td>
161
        </tr>
168
        </tr>
162
        [% END %]
169
        [% END %]
163
    [% END %]</tbody>
170
    [% END %]</tbody>
Lines 177-182 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
177
        <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv %]" />
184
        <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv %]" />
178
        <input type="hidden" id="heading"  name="heading" value="[% heading %]" />
185
        <input type="hidden" id="heading"  name="heading" value="[% heading %]" />
179
        <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
186
        <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
187
        <input type="hidden" name="authid" value="[% authid %]" />
180
188
181
        [% FOREACH server IN servers %]
189
        [% FOREACH server IN servers %]
182
        <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
190
        <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
Lines 192-198 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
192
        <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
        <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" />
193
    </form>
201
    </form>
194
202
195
<p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
203
<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>
196
    [% ELSE %]
204
    [% ELSE %]
197
        [% IF ( errconn ) %]
205
        [% IF ( errconn ) %]
198
            <div class="dialog alert">
206
            <div class="dialog alert">
Lines 205-211 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : Link Here
205
            </div>
213
            </div>
206
         [% END %]
214
         [% END %]
207
   <div class="dialog message">Nothing found.</div>
215
   <div class="dialog message">Nothing found.</div>
208
    <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
216
    <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>
209
    [% END %]
217
    [% END %]
210
218
211
[% END %]
219
[% END %]
212
- 

Return to bug 11961