Advertisement
Advertisement
| 04.24.2008 at 06:56AM PDT, ID: 23350235 |
|
[x]
Attachment Details
|
||
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: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: |
#!c:\perl\bin\perl.exe
#
require 'cl_tools.pl';
&content;
print "<title>$INI{title}</title>";
print "<link href='$INI{base}/screens/$INI{style}' rel='stylesheet' type='text/css' />";
%q = qstring($ENV{QUERY_STRING});
my $dbh = &newlogin;
if ($q{COL}) { &col }
elsif ($q{LIB}) { &list }
else { &menu }
⊥
sub menu {
print <<"__END__TOP__";
<!-- This is where you enter html stuff for the top of the page -->
<center><span class="briefcitTitle">New Materials</span>
__END__TOP__
my @sort = ('Sort: Most Recent','Sort: Title','Sort: Date','Sort: Format');
my $si = 0;
my $sth = $dbh->prepare("select * from iiiloc where code rlike '^.{1,2}\$' or code = '$q{LIB}' order by name");
$sth->execute();
print "<center><table class='bibSearchtool' cellpadding='3'><tr><td>";
print "<form action='iiinew.pl'><select name='lib'>";
print "<option value='zz'>--All Libraries--";
while (my $r = $sth->fetchrow_hashref()) {
$$r{code} =~ s/ $//;
print "<option value='$$r{code}'";
print " selected" if $q{LIB} =~ /^$$r{code}/;
print ">$$r{name}"
}
print "</select>";
my $stm = $dbh->prepare("select * from iiimat order by matlabel");
$stm->execute();
print " <select name='type'>";
print " <option value=''>--All Formats--";
while (my $r = $stm->fetchrow_hashref()) {
print "<option value='$$r{matcode}'";
print " selected" if $q{TYPE} eq $$r{matcode};
print ">$$r{matlabel}"
}
print "</select> <select name='sort'>";
foreach (@sort) {
print "<option value='$si'";
print " selected" if $q{SORT} == $si;
print ">$_";
$si++
}
print "</select> <input type='submit' value='Go'>";
if ($q{COL}) { $chk = ' checked' }
else { $chk = '' }
print "<br><input type='checkbox' name='col' value='1'$chk> <span class='availLimMessage'>Limit by collection</span>";
print "</form></table></center>";
}
sub col {
&menu;
$q{LIB} =~ s/^z.+/%/;
my $sql = "select location, name, count(distinct mid) as c from main3, iiiloc where location like '$q{LIB}%'";
$sql .= " and format = '$q{TYPE}'" if $q{TYPE};
$sql .= " and code = location group by location, name order by name";
my $sth = $dbh->prepare($sql);
$sth->execute();
if ($DBI::rows == 0) { print "<script>alert('Nothing found!')</script>" }
else {
print "<table width='100%' cellpadding='3' cellspacing='0' class='browseList'><tr class='browseHeader'><td class='browseHeaderData'>Location<td class='browseHeaderData'>Entries</tr>";
while (my $r = $sth->fetchrow_hashref()) {
$$r{location} =~ tr/ /+/;
print "<tr class='browseEntry'><td class='browseEntryData'><a href='$ENV{SCRIPT_NAME}?lib=$$r{location}&type=$q{TYPE}&sort=$q{SORT}'>$$r{name}</a><td class='browseEntryEntries'>$$r{c}</tr>"
}
}
print "</table>";
}
sub list {
&menu;
$rcnt = 0;
my @order = ('iid desc, norm','norm','added desc, norm','format, norm');
$q{LIB} =~ s/^z.+//;
my $sql = "select * from main3, iiiloc, iiimat where";
if ($q{LIB}) { $sql .= " location like '$q{LIB}%' and" }
$sql .= " format='$q{TYPE}' and" if $q{TYPE};
$sql .= " code = location and matcode = format order by $order[$q{SORT}]";
my $sth = $dbh->prepare($sql);
$sth->execute();
if ($DBI::rows == 0) { print "<script>alert('Nothing found!')</script>" }
else {
while (my $r = $sth->fetchrow_hashref()) {
chop $$r{mid};
$$r{mid} =~ s/^\.//;
@data = split /\|/, $$r{data};
$$r{added} =~ s/(....)-(..)-(..)|/$2\/$3\/$1/;
push @{ $items{$$r{mid}} }, "$$r{name}|$data[4]|$$r{added}";
next if $$r{mid} eq $premid;
$premid = $$r{mid};
$rcnt++;
push @bib, "$$r{mid}|$$r{isbn}|$data[0]|$data[1]|$data[2]|$data[3]|$$r{image}|$rcnt";
last if $rcnt == 1000
}
$q{LIB} ||= 'zz';
my $start = $q{N} || 1;
$start--;
$end = $start + $INI{records} - 1;
if ($end >= $rcnt) { $end = $rcnt - 1}
$hstart = $start + 1;
$hend = $end + 1;
&pager;
print "<table width='100%'><tr class='browseHeader'><td class='browseHeaderData' align='center'>New Materials ($hstart - $hend of $rcnt)</td></tr></table>";
print "<table width='100%'>";
foreach (@bib[$start..$end]) {
my @b = split /\|/;
print "<tr class='briefcitRow'><td width='15%' rowspan='2'>";
print "<img src='$INI{cover1}=$b[1]$INI{cover2}'>" if $INI{cover1};
print "<td class='briefcitDetail' width='5%' valign='top' rowspan='2'><b>$b[7]</b>";
print "<td class='briefcitDetail' valign='top'><a href='$INI{base}/record=$b[0]'><span class='briefcitTitle'>$b[3]</a> / $b[2]</span><br>";
print "<span class='briefcitDetail'>$b[4]<br>$b[5]</span>";
print "<td class='briefcitDetail'>";
print "<img src='$b[6]'>" if $b[6];
print "<tr><td colspan='3'><span class='briefcitItems'><table width='100%' border='0' cellspacing='1' cellpadding='2' class='bibItems'>";
print "<tr class='bibItemsHeader'>";
print "<th width='40%' class='bibItemsHeader'>Location";
print "<th width='30%' class='bibItemsHeader'>Call Number";
print "<th width='30%' class='bibItemsHeader'>Date Added";
foreach (@{ $items{$b[0]} }) {
my @itms = split /\|/;
print "<tr class='bibItemsEntry'><td>$itms[0]<td>$itms[1]<td>$itms[2]";
}
print "</table></span>";
print "<tr><td colspan='4'><hr>";
}
print "</table>";
&pager;
}
}
sub pager {
$pend = $end + 2;
$q{LIB} =~ tr/ /+/;
if ($rcnt > $INI{records}) { print "<table width='100%'><tr class='browsePager'><td align='right' class='browsePager'>Result Page " }
if ($q{N} > 0) { print "<a href='javascript:history.go(-1)'>Prev</a> " }
if ($pend <= $rcnt) {
print "<a href='$ENV{SCRIPT_NAME}?lib=$q{LIB}&type=$q{TYPE}&sort=$q{SORT}&n=$pend'>Next</tr></table>";
}
print "</table>";
}
sub bottom {
print <<"__END__BOT__";
<!-- This is where you enter html stuff for the bottom of the page -->
<font face='courier'>Courtesy of <a href='http://info.infosoup.org/about.asp'>infosoup.org</a>.
__END__BOT__
}
|