This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
XL2MARC.pm
78 lines (65 loc) · 1.92 KB
/
XL2MARC.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# Name: XL2MARC.pm
# Version: 0.1 (Nov. 2008)
#
# Description: Converts MS-Excel data into MARC outputs. Handles file upload and uses two modules for conversion.
package XL2MARC;
use CGI::Pretty qw/:html3/;
use base 'CGI::Application';
use strict;
# Disable in production use
use warnings;
use XLView qw/wizard_conv custom_conv/;
use MARCView qw/marc_wizard marc_custom/;
# Set upload limit (bandwidth consideration)
$CGI::POST_MAX = 1024 * 500; # 500kb
# Setup the application
sub setup {
my $self = shift;
$self->start_mode('upload');
$self->run_modes(
'upload' => 'upload_file',
'wizard_view' => 'marc_wizard',
'custom_view' => 'marc_custom',
'Wizard' => 'wizard_conv',
'Custom' => 'custom_conv'
);
}
# First screen for uploading Excel file
sub upload_file {
my $self = shift;
# Create CGI object
my $q = $self->query();
my $output = '';
$output .= $q->start_html(
-title => 'Excel to MARC',
-Style => { 'src' => '/marc/marc.css' },
-BGCOLOR => '#94B6D8'
);
$output .= $q->h2('Excel to MARC');
$output .= "<div align=\"center\" class=\"upload\">\n";
$output .= $q->start_multipart_form();
$output .= $q->filefield( 'uploaded_file', 50 );
$output .= $q->p;
$output .= $q->checkbox( 'headers', 'checked', 'ON',
'First row contains column headers' );
$output .= $q->p;
$output .= $q->radio_group(
-name => 'rm',
-value => [ 'Wizard', 'Custom' ],
-default => ['Wizard']
);
$output .= $q->p;
$output .= $q->submit( -class => 'button', -value => 'Submit' );
$output .= $q->end_form;
$output .= "</div>";
# $output .= $footer;
$output .= $self->footer();
$output .= $q->end_html;
return $output;
}
# Page footer to be added in each screen
sub footer {
my $footer = "<br/>© 2008 Saiful Amin.\n";
return $footer;
}
1;