Changeset 12928 for trunk/cic-hcap
- Timestamp:
- 2006-09-29T11:05:13+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cic-hcap/perllib/plugins/CICPlug.pm
r12919 r12928 1246 1246 $anchor_name = $letter; 1247 1247 } 1248 &write_static_browser_macros_chunk($letter, $anchor_name, \@letter_ids, $id_to_name_mapping, $id_to_extra_mapping);1248 print BROWSER_MACROFILE &get_static_browser_macro_chunk($letter, $anchor_name, \@letter_ids, $id_to_name_mapping, $id_to_extra_mapping); 1249 1249 } 1250 1250 print BROWSER_MACROFILE "</table>\n"; … … 1254 1254 1255 1255 1256 sub write_static_browser_macros_chunk1256 sub get_static_browser_macro_chunk 1257 1257 { 1258 1258 my $chunk_title = shift(@_); … … 1262 1262 my $id_to_extra_mapping = shift(@_); 1263 1263 1264 print BROWSER_MACROFILE"<tr><td width=\"50%\"><br />";1264 my $static_browser_macro_chunk = "<tr><td width=\"50%\"><br />"; 1265 1265 if (defined($anchor_name) && $anchor_name ne "") { 1266 print BROWSER_MACROFILE"<a name=\"$anchor_name\"/>";1267 } 1268 print BROWSER_MACROFILE"<span style=\"color: black;\"><b>$chunk_title</b></span></td><td width=\"50%\"></td></tr>";1266 $static_browser_macro_chunk .= "<a name=\"$anchor_name\"/>"; 1267 } 1268 $static_browser_macro_chunk .= "<span style=\"color: black;\"><b>$chunk_title</b></span></td><td width=\"50%\"></td></tr>"; 1269 1269 1270 1270 my %full_name_to_id_mapping; … … 1280 1280 my $half_point = ((scalar(@full_names) % 2 == 0) ? scalar(@full_names) / 2 : (scalar(@full_names) + 1) / 2); 1281 1281 for (my $i = 0; $i < $half_point; $i++) { 1282 print BROWSER_MACROFILE"<tr>";1282 $static_browser_macro_chunk .= "<tr>"; 1283 1283 1284 1284 my $id = $full_name_to_id_mapping{$full_names[$i]}; 1285 1285 my $name = $id_to_name_mapping->{$id}; 1286 1286 my $extra = $id_to_extra_mapping->{$id} || ""; 1287 print BROWSER_MACROFILE"<td valign=\"top\"><a href=\"_gwcgi_?a=d&d=$id\">" . &html_safe($name) . "</a>" . &html_safe($extra) . "</td>";1288 1289 print BROWSER_MACROFILE"<td valign=\"top\">";1287 $static_browser_macro_chunk .= "<td valign=\"top\"><a href=\"_gwcgi_?a=d&d=$id\">" . &html_safe($name) . "</a>" . &html_safe($extra) . "</td>"; 1288 1289 $static_browser_macro_chunk .= "<td valign=\"top\">"; 1290 1290 if (defined($full_names[$i+$half_point])) { 1291 1291 $id = $full_name_to_id_mapping{$full_names[$i+$half_point]}; 1292 1292 $name = $id_to_name_mapping->{$id}; 1293 1293 $extra = $id_to_extra_mapping->{$id} || ""; 1294 print BROWSER_MACROFILE "<a href=\"_gwcgi_?a=d&d=$id\">" . &html_safe($name) . "</a>" . &html_safe($extra); 1295 } 1296 print BROWSER_MACROFILE "</td>"; 1297 1298 print BROWSER_MACROFILE "</tr>"; 1299 } 1294 $static_browser_macro_chunk .= "<a href=\"_gwcgi_?a=d&d=$id\">" . &html_safe($name) . "</a>" . &html_safe($extra); 1295 } 1296 $static_browser_macro_chunk .= "</td>"; 1297 1298 $static_browser_macro_chunk .= "</tr>"; 1299 } 1300 1301 return $static_browser_macro_chunk; 1300 1302 } 1301 1303 … … 1357 1359 1358 1360 foreach my $state (sort(keys(%state_name_to_abbr_mapping))) { 1359 my $state_ abbr = $state_name_to_abbr_mapping{$state};1360 print BROWSER_MACROFILE "\n_cicstate" . $state_abbr . "_ {";1361 my $state_sans_spaces = $state; 1362 $state_sans_spaces =~ s/ //g; 1361 1363 my @state_ids = (); 1362 1364 if (defined($state_to_ids_mapping->{$state})) { 1363 1365 @state_ids = @{$state_to_ids_mapping->{$state}}; 1364 1366 } 1365 my $state_ sans_spaces = $state;1366 $state_sans_spaces =~ s/ //g; 1367 &write_static_browser_macros_chunk($state, $state_sans_spaces, \@state_ids, $id_to_name_mapping, undef);1367 my $state_abbr = $state_name_to_abbr_mapping{$state}; 1368 1369 my $state_static_browser_macro_chunk = &get_static_browser_macro_chunk($state, $state_sans_spaces, \@state_ids, $id_to_name_mapping, undef); 1368 1370 if (!defined($state_to_ids_mapping->{$state})) { 1369 print BROWSER_MACROFILE "<tr><td colspan=\"2\" valign=\"top\">No institutions for this state</td></tr>"; 1370 } 1371 $state_static_browser_macro_chunk .= "<tr><td colspan=\"2\" valign=\"top\">No institutions for this state</td></tr>"; 1372 } 1373 1374 # Write out the normal macro chunk 1375 print BROWSER_MACROFILE "\n_cicstate" . $state_abbr . "_ {"; 1376 print BROWSER_MACROFILE $state_static_browser_macro_chunk; 1371 1377 print BROWSER_MACROFILE "}\n"; 1378 1379 # Write out a Javascript safe version 1380 print BROWSER_MACROFILE "\n_cicstate" . $state_abbr . "js_ {"; 1381 print BROWSER_MACROFILE &javascript_safe($state_static_browser_macro_chunk); 1382 print BROWSER_MACROFILE "}\n"; 1372 1383 } 1373 1384 … … 1376 1387 1377 1388 1389 sub javascript_safe 1390 { 1391 my $text = shift(@_); 1392 $text =~ s/<\//<\\\\\//g; 1393 return $text; 1394 } 1395 1396 1378 1397 1;
Note:
See TracChangeset
for help on using the changeset viewer.