Lines 72-78
function Blur$function_name(subfield_managed) {
Link Here
|
72 |
|
72 |
|
73 |
function Clic$function_name(i) { |
73 |
function Clic$function_name(i) { |
74 |
defaultvalue=document.getElementById(\"$field_number\").value; |
74 |
defaultvalue=document.getElementById(\"$field_number\").value; |
75 |
newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); |
75 |
//Retrieve full leader string and pass it to the 008 tag editor |
|
|
76 |
var leader_value = \$(\"input[id^='tag_000']\").val(); |
77 |
var leader_parameter = \"\"; |
78 |
if (leader_value){ |
79 |
//Only add the parameter to the URL if there is a value to add |
80 |
leader_parameter = \"&leader=\"+leader_value; |
81 |
} |
82 |
newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); |
76 |
|
83 |
|
77 |
} |
84 |
} |
78 |
//]]> |
85 |
//]]> |
Lines 90-95
sub plugin {
Link Here
|
90 |
my ($input) = @_; |
97 |
my ($input) = @_; |
91 |
my $index = $input->param('index'); |
98 |
my $index = $input->param('index'); |
92 |
my $result = $input->param('result'); |
99 |
my $result = $input->param('result'); |
|
|
100 |
my $leader = $input->param('leader'); |
101 |
|
102 |
my $material_configuration; |
103 |
if ($leader && length($leader) == '24') { |
104 |
#MARC 21 Material Type Configuration |
105 |
#Field 008/18-34 Configuration |
106 |
#If Leader/06 = a and Leader/07 = a, c, d, or m: Books |
107 |
#If Leader/06 = a and Leader/07 = b, i, or s: Continuing Resources |
108 |
#If Leader/06 = t: Books |
109 |
#If Leader/06 = c, d, i, or j: Music |
110 |
#If Leader/06 = e, or f: Maps |
111 |
#If Leader/06 = g, k, o, or r: Visual Materials |
112 |
#If Leader/06 = m: Computer Files |
113 |
#If Leader/06 = p: Mixed Materials |
114 |
#http://www.loc.gov/marc/bibliographic/bdleader.html |
115 |
my $material_configuration_mapping = { |
116 |
a => { |
117 |
a => 'BKS', |
118 |
c => 'BKS', |
119 |
d => 'BKS', |
120 |
m => 'BKS', |
121 |
b => 'CR', |
122 |
i => 'CR', |
123 |
s => 'CR', |
124 |
}, |
125 |
t => 'BKS', |
126 |
c => 'MU', |
127 |
d => 'MU', |
128 |
i => 'MU', |
129 |
j => 'MU', |
130 |
e => 'MP', |
131 |
f => 'MP', |
132 |
g => 'VM', |
133 |
k => 'VM', |
134 |
o => 'VM', |
135 |
r => 'VM', |
136 |
m => 'CF', |
137 |
p => 'MX', |
138 |
}; |
139 |
my $leader06 = substr($leader, 6, 1); |
140 |
my $leader07 = substr($leader, 7, 1); |
141 |
#Retrieve material type using leader06 |
142 |
$material_configuration = $material_configuration_mapping->{$leader06}; |
143 |
#If the value returned is a ref (i.e. leader06 is 'a'), then use leader07 to get the actual material type |
144 |
if ( ($material_configuration) && (ref($material_configuration) eq 'HASH') ){ |
145 |
$material_configuration = $material_configuration->{$leader07}; |
146 |
} |
147 |
} |
93 |
|
148 |
|
94 |
my $dbh = C4::Context->dbh; |
149 |
my $dbh = C4::Context->dbh; |
95 |
|
150 |
|
Lines 123-128
sub plugin {
Link Here
|
123 |
index => $index, |
178 |
index => $index, |
124 |
result => $result, |
179 |
result => $result, |
125 |
errorXml => $errorXml, |
180 |
errorXml => $errorXml, |
|
|
181 |
material_configuration => $material_configuration, |
126 |
); |
182 |
); |
127 |
output_html_with_http_headers $input, $cookie, $template->output; |
183 |
output_html_with_http_headers $input, $cookie, $template->output; |
128 |
} |
184 |
} |