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

(-)a/cataloguing/value_builder/marc21_field_008_classifications.pl (+97 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
use Modern::Perl;
19
use C4::Auth;
20
use CGI qw ( -utf8 );
21
use C4::Context;
22
23
use C4::Search;
24
use C4::Output;
25
use Koha::Util::FrameworkPlugin qw|date_entered|;
26
27
use constant FIXLEN_DATA_ELTS => 'baaaaaaa';
28
29
my $builder = sub {
30
    my ( $params ) = @_;
31
    my $function_name = $params->{id};
32
    my $dateentered = date_entered();
33
    my $defaultval = FIXLEN_DATA_ELTS;
34
    my $res="
35
<script type=\"text/javascript\">
36
//<![CDATA[
37
38
function Focus$function_name(event) {
39
    if (!document.getElementById(event.data.id).value) {
40
    var authtype=document.forms['f'].elements['authtypecode'].value;
41
    var fieldval='$dateentered$defaultval';
42
        document.getElementById(event.data.id).value=fieldval;
43
    }
44
    return 1;
45
}
46
47
function Click$function_name(event) {
48
    var authtype=document.forms['f'].elements['authtypecode'].value;
49
    defaultvalue=document.getElementById(event.data.id).value;
50
    newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_classifications.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
51
}
52
53
//]]>
54
</script>
55
";
56
57
    return $res;
58
};
59
60
my $launcher = sub {
61
    my ( $params ) = @_;
62
    my $input = $params->{cgi};
63
    my $index = $input->param('index');
64
    my $result = $input->param('result');
65
    my $authtype = $input->param('authtypecode') || '';
66
67
    my $defaultval = FIXLEN_DATA_ELTS;
68
69
    my ($template, $loggedinuser, $cookie) = get_template_and_user({
70
        template_name => "cataloguing/value_builder/marc21_field_008_classifications.tt",
71
        query => $input,
72
        type => "intranet",
73
        authnotrequired => 0,
74
        flagsrequired => { editcatalogue => '*' },
75
        debug => 1,
76
    });
77
    my $dateentered = date_entered();
78
    $result = "$dateentered$defaultval" unless $result;
79
    my @f;
80
    for (0,6..13) {
81
        $f[$_]=substr($result,$_,$_==0?6:1);
82
    }
83
    $template->param(index => $index);
84
85
    $f[0] = $dateentered if !$f[0] || $f[0]=~/\s/;
86
    $template->param(f1 => $f[0]);
87
88
    for (6..13) {
89
        $template->param(
90
            "f$_" => $f[$_],
91
            "f$_".($f[$_] eq '|'? 'pipe': $f[$_]) => $f[$_],
92
        );
93
    }
94
    output_html_with_http_headers $input, $cookie, $template->output;
95
};
96
97
return { builder => $builder, launcher => $launcher };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008_classifications.tt (-1 / +219 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Classifications &rsaquo; 008 builder</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
<body id="cat_marc21_field_008_classifications" class="cat" style="padding:1em;">
6
<h3> 008 Fixed-length data elements</h3>
7
<form name="f_pop" onsubmit="report()" action="">
8
<input type="hidden" name="plugin_name" value="marc21_field_008_classifications.pl" />
9
<input name="f1" value="[% f1 %]" type="hidden" />
10
<table>
11
    <tr>
12
        <td>00-05- Date entered on file</td>
13
        <td>[% f1 %]</td>
14
    </tr>
15
    <tr>
16
        <td><label for="f6">06- Kind of record</label></td>
17
        <td>
18
            <select name="f6" id="f6" size="1">
19
            [% IF ( f6a ) %]
20
                <option value="a" selected="selected">a- Schedule record</option>
21
            [% ELSE %]
22
                <option value="a">a- Schedule record</option>
23
            [% END %]
24
            [% IF ( f6b ) %]
25
                <option value="b" selected="selected">b- Table record</option>
26
            [% ELSE %]
27
                <option value="b">b- Table record</option>
28
            [% END %]
29
            [% IF ( f6c ) %]
30
                <option value="c" selected="selected">c- Index term record</option>
31
            [% ELSE %]
32
                <option value="c">c- Index term record</option>
33
            [% END %]
34
            </select>
35
        </td>
36
    </tr>
37
    <tr>
38
        <td><label for="f7">07- Type of number</label></td>
39
        <td>
40
            <select name="f7" id="f7" size="1">
41
            [% IF ( f7a ) %]
42
                <option value="a" selected="selected">a- Single number</option>
43
            [% ELSE %]
44
                <option value="a">a- Single number</option>
45
            [% END %]
46
            [% IF ( f7b ) %]
47
                <option value="b" selected="selected">b- Defined number span</option>
48
            [% ELSE %]
49
                <option value="b">b- Defined number span</option>
50
            [% END %]
51
            [% IF ( f7c ) %]
52
                <option value="c" selected="selected">c- Summary number span</option>
53
            [% ELSE %]
54
                <option value="c">c- Summary number span</option>
55
            [% END %]
56
            [% IF ( f7n ) %]
57
                <option value="n" selected="selected">n- Not applicable</option>
58
            [% ELSE %]
59
                <option value="n">n - Not applicable</option>
60
            [% END %]
61
            </select>
62
        </td>
63
    </tr>
64
    <tr>
65
        <td><label for="f8">08- Classification validity</label></td>
66
        <td>
67
            <select name="f8" id="f8" size="1">
68
            [% IF ( f8a ) %]
69
                <option value="a" selected="selected">a- Valid</option>
70
            [% ELSE %]
71
                <option value="a">a- Valid</option>
72
            [% END %]
73
            [% IF ( f8b ) %]
74
                <option value="b" selected="selected">b- First number of span invalid</option>
75
            [% ELSE %]
76
                <option value="b">b- First number of span invalid</option>
77
            [% END %]
78
            [% IF ( f8c ) %]
79
                <option value="c" selected="selected">c- Last number of span invalid</option>
80
            [% ELSE %]
81
                <option value="c">c- Last number of span invalid</option>
82
            [% END %]
83
            [% IF ( f8d ) %]
84
                <option value="d" selected="selected">d- Completely invalid</option>
85
            [% ELSE %]
86
                <option value="d">d- Completely invalid</option>
87
            [% END %]
88
            [% IF ( f8e ) %]
89
                <option value="e" selected="selected">e- Obsolete</option>
90
            [% ELSE %]
91
                <option value="e">e- Obsolete</option>
92
            [% END %]
93
            [% IF ( f8n ) %]
94
                <option value="n" selected="selected">n- Not applicable</option>
95
            [% ELSE %]
96
                <option value="n">n - Not applicable</option>
97
            [% END %]
98
            </select>
99
        </td>
100
    </tr>
101
    <tr>
102
        <td><label for="f9">09- Standard or optional designation</label></td>
103
        <td>
104
            <select name="f9" id="f9" size="1">
105
            [% IF ( f9a ) %]
106
                <option value="a" selected="selected">a- Standard</option>
107
            [% ELSE %]
108
                <option value="a">a- Standard</option>
109
            [% END %]
110
            [% IF ( f9b ) %]
111
                <option value="b" selected="selected">b- Optional</option>
112
            [% ELSE %]
113
                <option value="b">b- Optional</option>
114
            [% END %]
115
            [% IF ( f9n ) %]
116
                <option value="n" selected="selected">n- Not applicable</option>
117
            [% ELSE %]
118
                <option value="n">n - Not applicable</option>
119
            [% END %]
120
            </select>
121
        </td>
122
    </tr>
123
    <tr>
124
        <td><label for="f10">10- Record update in process</label></td>
125
        <td>
126
            <select name="f10" id="f10" size="1">
127
            [% IF ( f10a ) %]
128
                <option value="a" selected="selected">a- Record can be used</option>
129
            [% ELSE %]
130
                <option value="a">a- Record can be used</option>
131
            [% END %]
132
            [% IF ( f10b ) %]
133
                <option value="b" selected="selected">b- Record is being updated</option>
134
            [% ELSE %]
135
                <option value="b">b- Record is being updated</option>
136
            [% END %]
137
            </select>
138
        </td>
139
    </tr>
140
    <tr>
141
        <td><label for="f11">11- Level of establishment</label></td>
142
        <td>
143
            <select name="f11" id="f11" size="1">
144
            [% IF ( f11a ) %]
145
                <option value="a" selected="selected">a- Fully established</option>
146
            [% ELSE %]
147
                <option value="a">a- Fully established</option>
148
            [% END %]
149
            [% IF ( f11c ) %]
150
                <option value="c" selected="selected">c- Provisional</option>
151
            [% ELSE %]
152
                <option value="c">c- Provisional</option>
153
            [% END %]
154
            </select>
155
        </td>
156
    </tr>
157
    <tr>
158
        <td><label for="f12">12- Synthesized number indication</label></td>
159
        <td>
160
            <select name="f12" id="f12" size="1">
161
            [% IF ( f12a ) %]
162
                <option value="a" selected="selected">a- Not synthesized</option>
163
            [% ELSE %]
164
                <option value="a">a- Not synthesized</option>
165
            [% END %]
166
            [% IF ( f12b ) %]
167
                <option value="b" selected="selected">b- Synthesized</option>
168
            [% ELSE %]
169
                <option value="b">b- Synthesized</option>
170
            [% END %]
171
            [% IF ( f12n ) %]
172
                <option value="n" selected="selected">n- Not applicable</option>
173
            [% ELSE %]
174
                <option value="n">n - Not applicable</option>
175
            [% END %]
176
            </select>
177
        </td>
178
    </tr>
179
    <tr>
180
        <td><label for="f13">13- Display controller</label></td>
181
        <td>
182
            <select name="f13" id="f13" size="1">
183
            [% IF ( f13a ) %]
184
                <option value="a" selected="selected">a- Displayed in standard schedules or tables</option>
185
            [% ELSE %]
186
                <option value="a">a- Displayed in standard schedules or tables</option>
187
            [% END %]
188
            [% IF ( f13b ) %]
189
                <option value="b" selected="selected">b- Extended display</option>
190
            [% ELSE %]
191
                <option value="b">b- Extended display</option>
192
            [% END %]
193
            </select>
194
        </td>
195
    </tr>
196
</table>
197
<fieldset class="action"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
198
</form>
199
<script type="text/javascript">//<![CDATA[
200
    function report() {
201
        var doc   = opener.document;
202
        var field = doc.getElementById("[% index %]");
203
        field.value =
204
            document.f_pop.f1.value+
205
            document.f_pop.f6.value+
206
            document.f_pop.f7.value+
207
            document.f_pop.f8.value+
208
            document.f_pop.f9.value+
209
            document.f_pop.f10.value+
210
            document.f_pop.f11.value+
211
            document.f_pop.f12.value+
212
            document.f_pop.f13.value;
213
        self.close();
214
        return false;
215
    }
216
    //]]>
217
</script>
218
219
[% INCLUDE 'popup-bottom.inc' %]

Return to bug 17233