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

(-)a/cataloguing/value_builder/unimarc_leader_authorities.pl (+86 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Copyright (C) 2013 Vitor Fernandes , adapted for UNIMARC by George Veranis
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Koha::Util::FrameworkPlugin qw(wrapper);
23
use C4::Auth;
24
use CGI qw ( -utf8 );
25
use C4::Context;
26
use C4::Output;
27
28
29
sub plugin_javascript {
30
    my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_;
31
    my $res           = "
32
        <script type='text/javascript'>
33
            function Clic$field_number(i) {
34
                var defaultvalue;
35
                try {
36
                    defaultvalue = document.getElementById(i).value;
37
                } catch(e) {
38
                    alert('error when getting '+i);
39
                    return;
40
                }
41
                window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_leader_authorities.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc_field_000\",'width=1000,height=600,toolbar=false,scrollbars=yes');
42
            }
43
        </script>
44
";
45
46
    return ( $field_number, $res );
47
}
48
49
50
sub plugin {
51
    my ($input) = @_;
52
    my $index  = $input->param('index');
53
    my $result = $input->param('result');
54
55
    my $dbh = C4::Context->dbh;
56
57
    #my $defaultlanguage = C4::Context->preference("UNIMARCField100Language");
58
    # $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3);
59
60
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
61
        {
62
            template_name => "cataloguing/value_builder/unimarc_leader_authorities.tt",
63
            query         => $input,
64
            type          => "intranet",
65
            authnotrequired => 0,
66
            flagsrequired   => { editcatalogue => '*' },
67
            debug           => 1,
68
        }
69
    );
70
    $result = "     nz  a22     3  4500" unless $result;
71
   
72
73
    my $f5  = substr( $result, 5, 1 ); $f5  = wrapper( $f5 ) if $f5;
74
    my $f6  = substr( $result, 6, 1 ); $f6  = wrapper( $f6 ) if $f6;
75
    my $f9  = substr( $result, 9, 1 ); $f9  = wrapper( $f9 ) if $f9;
76
    my $f17  = substr( $result, 17, 1 ); $f17  = wrapper( $f17 ) if $f17;
77
78
    $template->param(
79
        index     => $index,
80
        "f5$f5"   => 1,
81
        "f6$f6"   => 1,
82
        "f9$f9"   => 1,
83
        "f17$f17"   => 1,
84
);
85
    output_html_with_http_headers $input, $cookie, $template->output;
86
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_leader_authorities.tt (-1 / +202 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>UNIMARC leader builder</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
<body id="cat_unimarc_leader_authorities" class="cat" style="padding:1em;">
6
<h3>000 - Leader</h3>
7
<form name="f_pop" onsubmit="report()" action="">
8
<input name="plugin_name" value="unimarc_leader_authorities.pl" type="hidden">
9
10
<table>
11
	<tr>
12
		<td>1-4 Record length</td>
13
		<td>(auto-calculated)</td>
14
	</tr>
15
	<tr>
16
		<td><label for="f5">5- Record status</label></td>
17
		<td>
18
			<select name="f5" id="f5" size="1">            
19
			[% IF ( f5c ) %]
20
				<option value="c" selected="selected">c - Corrected or revised</option>
21
			[% ELSE %]
22
				<option value="c">c - Corrected or revised</option>
23
			[% END %]
24
			[% IF ( f5d ) %]
25
				<option value="d" selected="selected">d - Deleted</option>
26
			[% ELSE %]
27
				<option value="d">d - Deleted</option>
28
			[% END %]
29
			[% IF ( f5n ) %]
30
				<option value="n" selected="selected">n - New</option>
31
			[% ELSE %]
32
				<option value="n">n - New</option>
33
			[% END %]
34
			</select>
35
		</td>
36
	</tr>
37
	<tr>
38
		<td><label for="f6">6- Type of record</label></td>
39
		<td>
40
			<select name="f6" id="f6" size="1">			
41
			[% IF ( f6x ) %]
42
				<option value="x" selected="selected">x - Authority entry record</option>
43
			[% ELSE %]
44
				<option value="x">x - Authority entry record</option>
45
			[% END %]
46
47
			[% IF ( f6y ) %]
48
				<option value="y" selected="selected">y - Reference entry record</option>
49
			[% ELSE %]
50
				<option value="y">y - Reference entry record</option>
51
			[% END %]
52
53
			[% IF ( f6z ) %]
54
				<option value="z" selected="selected">z - General explanatory entry record</option>
55
			[% ELSE %]
56
				<option value="z">z - General explanatory entry record</option>
57
			[% END %]
58
			
59
			</select>
60
		</td>
61
	</tr>
62
	<tr>
63
		<td><label for="f7">7-8 Undefined</label></td>
64
 		<td></td>
65
	</tr>	
66
67
	<tr>
68
		<td><label for="f9">9- Type of entity</label></td>
69
		<td>
70
			<select name="f9" id="f9" size="1">			
71
			[% IF ( f9 ) %]
72
				<option value=" " selected="selected"> - Series</option>
73
			[% ELSE %]
74
				<option value=" "> - Series</option>
75
			[% END %]
76
77
			[% IF ( f9a ) %]
78
				<option value="a" selected="selected">a - Personal name entry</option>
79
			[% ELSE %]
80
				<option value="a">a - Personal name entry</option>
81
			[% END %]
82
83
			[% IF ( f9b ) %]
84
				<option value="b" selected="selected">b - Corporate name entry</option>
85
			[% ELSE %]
86
				<option value="b">b - Corporate name entry</option>
87
			[% END %]
88
89
			[% IF ( f9c ) %]
90
				<option value="c" selected="selected">c - Territorial o geographical name</option>
91
			[% ELSE %]
92
				<option value="c">c - Territorial o geographical name</option>
93
			[% END %]
94
95
			[% IF ( f9d ) %]
96
				<option value="d" selected="selected">d - Trademark</option>
97
			[% ELSE %]
98
				<option value="d">d - Trademark</option>
99
			[% END %]
100
101
			[% IF ( f9e ) %]
102
				<option value="e" selected="selected">e - Family name</option>
103
			[% ELSE %]
104
				<option value="e">e - Family name</option>
105
			[% END %]
106
107
			[% IF ( f9f ) %]
108
				<option value="f" selected="selected">f - Uniform name</option>
109
			[% ELSE %]
110
				<option value="f">f - Uniform name</option>
111
			[% END %]
112
113
			[% IF ( f9g ) %]
114
				<option value="g" selected="selected">g - Collective uniform name</option>
115
			[% ELSE %]
116
				<option value="g">g - Collective uniform name</option>
117
			[% END %]
118
119
			[% IF ( f9h ) %]
120
				<option value="h" selected="selected">h - Name/title</option>
121
			[% ELSE %]
122
				<option value="h">h - Name/title</option>
123
			[% END %]
124
125
			[% IF ( f9i ) %]
126
				<option value="i" selected="selected">i - Name/collective uniform title</option>
127
			[% ELSE %]
128
				<option value="i">i - Name/collective uniform title</option>
129
			[% END %]
130
131
			[% IF ( f9j ) %]
132
				<option value="j" selected="selected">j - Topical subject</option>
133
			[% ELSE %]
134
				<option value="j">j - Topical subject</option>
135
			[% END %]
136
137
			[% IF ( f9k ) %]
138
				<option value="k" selected="selected">k - Place access</option>
139
			[% ELSE %]
140
				<option value="k">k - Place access</option>
141
			[% END %]
142
143
			[% IF ( f9l ) %]
144
				<option value="l" selected="selected">l - Form, genre or physical characteristics</option>
145
			[% ELSE %]
146
				<option value="l">l - Form, genre or physical characteristics</option>
147
			[% END %]
148
			
149
			</select>
150
		</td>
151
	</tr>
152
	<tr>
153
		 <td><label for="f10">10-16 indicator/subfields/size</label></td>
154
		<td>(auto-calculated)</td>
155
	</tr>
156
157
	<tr>
158
		<td><label for="f17">17- Encoding level</label></td>
159
		<td>
160
			<select name="f17" id="f17" size="1">            
161
				[% IF ( f17space ) %]
162
					<option value=" " selected="selected"> - Full</option>
163
				[% ELSE %]
164
					<option value=" ">  - Full</option>
165
				[% END %]
166
				[% IF ( f183 ) %]
167
					<option value="3" selected="selected">3- Partial</option>
168
				[% ELSE %]
169
					<option value="3">3- Partial</option>
170
				[% END %]
171
			</select>
172
		</td>
173
	</tr>
174
175
	<tr>
176
	 <td>18-19 Undefined</td>
177
	 <td></td>
178
	</tr>
179
	
180
	<tr>
181
		<td>20-24 Entry map &amp; lengths</td>
182
		<td>(auto-filled)</td>
183
	</tr>
184
</table>
185
<fieldset class="action"><input type="submit" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset>
186
</form>
187
<script type="text/javascript">
188
//<![CDATA[
189
function report() {
190
	    var doc   = opener.document; 
191
            var field = doc.getElementById("[% index %]");
192
        
193
            field.value ='     '+document.f_pop.f5.value+document.f_pop.f6.value+'  '+document.f_pop.f9.value+'22     '+document.f_pop.f17.value+'  '+'45  ';
194
195
			self.close();
196
			return false;
197
	}
198
//]]>
199
</script>
200
201
[% INCLUDE 'popup-bottom.inc' %]
202

Return to bug 24698