New files, and changes to add associated webstes to a biblio.
Adds a new table to database - so installer needs updating again.
This commit is contained in:
parent
1b7a2530e6
commit
4915ed786c
9 changed files with 291 additions and 4 deletions
|
@ -19,7 +19,7 @@ $VERSION = 0.01;
|
|||
&getallorders &getrecorders &updatecurrencies &getorder &getcurrency &updaterecorder
|
||||
&updatecost &checkitems &modnote &getitemtypes &getbiblio
|
||||
&getbiblioitem &getitemsbybiblioitem &isbnsearch &keywordsearch
|
||||
&websitesearch);
|
||||
&websitesearch &addwebsite &updatewebsite &deletewebsite);
|
||||
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
|
||||
|
||||
# your exported package globals go here,
|
||||
|
@ -1342,4 +1342,58 @@ biblio.biblionumber = biblioitems.biblionumber and (";
|
|||
} # sub websitesearch
|
||||
|
||||
|
||||
sub addwebsite {
|
||||
my ($website) = @_;
|
||||
my $dbh = C4Connect;
|
||||
my $query;
|
||||
|
||||
$website->{'biblionumber'} = $dbh->quote($website->{'biblionumber'});
|
||||
$website->{'title'} = $dbh->quote($website->{'title'});
|
||||
$website->{'description'} = $dbh->quote($website->{'description'});
|
||||
$website->{'url'} = $dbh->quote($website->{'url'});
|
||||
|
||||
$query = "Insert into websites set
|
||||
biblionumber = $website->{'biblionumber'},
|
||||
title = $website->{'title'},
|
||||
description = $website->{'description'},
|
||||
url = $website->{'url'}";
|
||||
|
||||
$dbh->do($query);
|
||||
|
||||
$dbh->disconnect;
|
||||
} # sub website
|
||||
|
||||
|
||||
sub updatewebsite {
|
||||
my ($website) = @_;
|
||||
my $dbh = C4Connect;
|
||||
my $query;
|
||||
|
||||
$website->{'title'} = $dbh->quote($website->{'title'});
|
||||
$website->{'description'} = $dbh->quote($website->{'description'});
|
||||
$website->{'url'} = $dbh->quote($website->{'url'});
|
||||
|
||||
$query = "Update websites set
|
||||
title = $website->{'title'},
|
||||
description = $website->{'description'},
|
||||
url = $website->{'url'}
|
||||
where websitenumber = $website->{'websitenumber'}";
|
||||
|
||||
$dbh->do($query);
|
||||
|
||||
$dbh->disconnect;
|
||||
} # sub updatewebsite
|
||||
|
||||
|
||||
sub deletewebsite {
|
||||
my ($websitenumber) = @_;
|
||||
my $dbh = C4Connect;
|
||||
my $query = "Delete from websites where websitenumber = $websitenumber";
|
||||
|
||||
$dbh->do($query);
|
||||
|
||||
$dbh->disconnect;
|
||||
} # sub deletewebsite
|
||||
|
||||
|
||||
END { } # module clean-up code here (global destructor)
|
||||
|
|
24
C4/Search.pm
24
C4/Search.pm
|
@ -21,7 +21,7 @@ $VERSION = 0.02;
|
|||
&borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
|
||||
&getboracctrecord &ItemType &itemissues &subject &subtitle
|
||||
&addauthor &bibitems &barcodes &findguarantees &allissues &systemprefs
|
||||
&findguarantor);
|
||||
&findguarantor &getwebsites);
|
||||
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
|
||||
|
||||
# your exported package globals go here,
|
||||
|
@ -1167,6 +1167,28 @@ sub barcodes{
|
|||
return(@barcodes);
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub getwebsites {
|
||||
my ($biblionumber) = @_;
|
||||
my $dbh = C4Connect;
|
||||
my $query = "Select * from websites where biblionumber = $biblionumber";
|
||||
my $sth = $dbh->prepare($query);
|
||||
my $count = 0;
|
||||
my @results;
|
||||
|
||||
$sth->execute;
|
||||
while (my $data = $sth->fetchrow_hashref) {
|
||||
$results[$count] = $data;
|
||||
$count++;
|
||||
} # while
|
||||
|
||||
$sth->finish;
|
||||
$dbh->disconnect;
|
||||
return($count, @results);
|
||||
} # sub getwebsites
|
||||
|
||||
|
||||
END { } # module clean-up code here (global destructor)
|
||||
|
||||
=head1 NAME
|
||||
|
|
24
addwebsite.pl
Executable file
24
addwebsite.pl
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use C4::Acquisitions;
|
||||
use CGI;
|
||||
|
||||
my $input = new CGI;
|
||||
my $biblionumber = $input->param('biblionumber');
|
||||
my $website = {
|
||||
biblionumber => $biblionumber,
|
||||
title => $input->param('title')?$input->param('title'):"",
|
||||
description => $input->param('description')?$input->param('description'):"",
|
||||
url => $input->param('url')?$input->param('url'):""
|
||||
}; # my $website
|
||||
|
||||
|
||||
if (! $biblionumber) {
|
||||
print $input->redirect("/catalogue/");
|
||||
|
||||
} else {
|
||||
&addwebsite($website);
|
||||
|
||||
print $input->redirect("modwebsites.pl?biblionumber=$biblionumber");
|
||||
} # else
|
|
@ -799,3 +799,15 @@ CREATE TABLE users (
|
|||
level smallint(6)
|
||||
);
|
||||
|
||||
#
|
||||
# Table structure for table 'websites'
|
||||
#
|
||||
|
||||
CREATE TABLE websites (
|
||||
websitenumber int(11) NOT NULL auto_increment,
|
||||
biblionumber int(11) NOT NULL default '0',
|
||||
title text,
|
||||
description text,
|
||||
url varchar(255),
|
||||
PRIMARY KEY (websitenumber)
|
||||
) TYPE=ISAM PACK_KEYS=1;
|
||||
|
|
21
deletewebsite.pl
Executable file
21
deletewebsite.pl
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use C4::Acquisitions;
|
||||
use CGI;
|
||||
|
||||
my $input = new CGI;
|
||||
my $biblionumber = $input->param('biblionumber');
|
||||
my $websitenumber = $input->param('websitenumber');
|
||||
|
||||
if (! $biblionumber) {
|
||||
print $input->redirect("/catalogue/");
|
||||
|
||||
} elsif (! $websitenumber) {
|
||||
print $input->param("modwebsite.pl?biblionumber=$biblionumber");
|
||||
|
||||
} else {
|
||||
&deletewebsite($websitenumber);
|
||||
|
||||
print $input->redirect("modwebsites.pl?biblionumber=$biblionumber");
|
||||
} # else
|
50
detail.pl
50
detail.pl
|
@ -11,11 +11,11 @@ use C4::Output;
|
|||
my $input = new CGI;
|
||||
my $type = $input->param('type');
|
||||
my $bib = $input->param('bib');
|
||||
my $title = $input->param('title');
|
||||
my @items = &ItemInfo(undef, $bib, $type);
|
||||
my @temp = split('\t', $items[0]);
|
||||
my $dat = &bibdata($bib);
|
||||
my $count = @items;
|
||||
my $dat = &bibdata($bib);
|
||||
my ($websitecount, @websites) = &getwebsites($bib);
|
||||
my ($authorcount, $addauthor) = &addauthor($bib);
|
||||
my $additional = $addauthor->[0]->{'author'};
|
||||
my $main;
|
||||
|
@ -272,6 +272,27 @@ if ($type ne 'opac') {
|
|||
<td>$dat->{'abstract'}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p />
|
||||
<table border="1" cellspacing="0" cellpadding="5" width="90%">
|
||||
<tr valign="top">
|
||||
<td bgcolor="$main" background="/images/background-mem.gif"><b>Links to Associated Websites<b></td>
|
||||
</tr>
|
||||
EOF
|
||||
|
||||
for (my $i = 0; $i < $websitecount; $i++) {
|
||||
$websites[$i]->{'url'} =~ s/^http:\/\///;
|
||||
print << "EOF";
|
||||
<tr>
|
||||
<td><b>Title:</b> $websites[$i]->{'title'}<br>
|
||||
<b>Description:</b> $websites[$i]->{'description'}<br>
|
||||
<b>URL:</b> http://$websites[$i]->{'url'}<br>
|
||||
</td>
|
||||
</tr>
|
||||
EOF
|
||||
} # for
|
||||
|
||||
print << "EOF";
|
||||
</table>
|
||||
EOF
|
||||
} else {
|
||||
if ($dat->{'abstract'} ne '') {
|
||||
|
@ -284,6 +305,31 @@ EOF
|
|||
<td>$dat->{'abstract'}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p />
|
||||
EOF
|
||||
} # if
|
||||
if ($websitecount) {
|
||||
print << "EOF";
|
||||
<table border="1" cellspacing="0" cellpadding="5" width="90%">
|
||||
<tr valign="top">
|
||||
<td bgcolor="$main" background="/images/background-mem.gif"><b>Link to Associated Websites</b></td>
|
||||
</tr>
|
||||
EOF
|
||||
|
||||
for (my $i = 0; $i < $websitecount; $i++) {
|
||||
$websites[$i]->{'url'} =~ s/^http:\/\///;
|
||||
print << "EOF";
|
||||
<tr>
|
||||
<td><b>Title:</b> $websites[$i]->{'title'}<br>
|
||||
<b>Description:</b> $websites[$i]->{'description'}<br>
|
||||
<b>URL:</b> http://$websites[$i]->{'url'}<br>
|
||||
</td>
|
||||
</tr>
|
||||
EOF
|
||||
} # for
|
||||
|
||||
print << "EOF";
|
||||
</table>
|
||||
EOF
|
||||
} # if
|
||||
} # else
|
||||
|
|
|
@ -62,6 +62,7 @@ $dewey = ~ s/\.$//;
|
|||
$data->{'title'} = &tidyhtml($data->{'title'});
|
||||
|
||||
print << "EOF";
|
||||
<a href="modwebsites.pl?biblionumber=$data->{'biblionumber'}">Modify Website Links</a>
|
||||
<form action="updatebiblio.pl" method="post">
|
||||
<input type="hidden" name="biblionumber" value="$data->{'biblionumber'}">
|
||||
<input type="hidden" name="biblioitemnumber" value="$data=>{'biblioitemnumber'}">
|
||||
|
|
75
modwebsites.pl
Executable file
75
modwebsites.pl
Executable file
|
@ -0,0 +1,75 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
use C4::Search;
|
||||
use CGI;
|
||||
use C4::Output;
|
||||
|
||||
my $input = new CGI;
|
||||
my $biblionumber = $input->param('biblionumber');
|
||||
my ($count, @websites) = &getwebsites($biblionumber);
|
||||
|
||||
if ($biblionumber eq '') {
|
||||
print $input->redirect("/catalogue/");
|
||||
} # if
|
||||
|
||||
print $input->header;
|
||||
print startpage();
|
||||
print startmenu();
|
||||
|
||||
print << "EOF";
|
||||
<p />
|
||||
<a href="detail.pl?type=intra&bib=$biblionumber">Return to Details Page</a>
|
||||
EOF
|
||||
|
||||
for (my $i = 0; $i < $count; $i++) {
|
||||
print << "EOF"
|
||||
<p />
|
||||
<form action="updatewebsite.pl" method="post">
|
||||
<input type="hidden" name="biblionumber" value="$biblionumber">
|
||||
<input type="hidden" name="websitenumber" value="$websites[$i]->{'websitenumber'}">
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>Title</td>
|
||||
<td><input type="text" name="title" value="$websites[$i]->{'title'}"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>Description</td>
|
||||
<td><textarea name="description" cols="40" rows="4">$websites[$i]->{'description'}</textarea></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>URL</td>
|
||||
<td><input type="text" name="url" value="$websites[$i]->{'url'}"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" value="Update this Website Link"> <input type="submit" name="delete" value="Delete this Website link">
|
||||
</form>
|
||||
EOF
|
||||
} # for
|
||||
|
||||
print << "EOF";
|
||||
<p />
|
||||
<h2><b>Add another Website Link</b></h2>
|
||||
<form action="addwebsite.pl" method="post">
|
||||
<input type="hidden" name="biblionumber" value="$biblionumber">
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>Title</td>
|
||||
<td><input type="text" name="title"></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>Description</td>
|
||||
<td><textarea name="description" cols="40" rows="4"></textarea></td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td>URL</td>
|
||||
<td><input type="text" name="url"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" value="Add this Website Link">
|
||||
</form>
|
||||
EOF
|
||||
|
||||
print endmenu();
|
||||
print endpage();
|
32
updatewebsite.pl
Executable file
32
updatewebsite.pl
Executable file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use C4::Acquisitions;
|
||||
use CGI;
|
||||
|
||||
my $input = new CGI;
|
||||
my $biblionumber = $input->param('biblionumber');
|
||||
my $websitenumber = $input->param('websitenumber');
|
||||
my $website = {
|
||||
biblionumber => $biblionumber,
|
||||
websitenumber => $websitenumber,
|
||||
title => $input->param('title')?$input->param('title'):"",
|
||||
description => $input->param('description')?$input->param('description'):"",
|
||||
url => $input->param('url')?$input->param('url'):""
|
||||
}; # my $website
|
||||
|
||||
|
||||
if ($input->param('delete')) {
|
||||
print $input->redirect("deletewebsite.pl?biblionumber=$biblionumber&websitenumber=$websitenumber");
|
||||
|
||||
} elsif (! $biblionumber) {
|
||||
print $input->redirect("/catalogue/");
|
||||
|
||||
} elsif (! $websitenumber) {
|
||||
print $input->redirect("modwebsites.pl?biblionumber=$biblionumber");
|
||||
|
||||
} else {
|
||||
&updatewebsite($website);
|
||||
|
||||
print $input->redirect("modwebsites.pl?biblionumber=$biblionumber");
|
||||
} # else
|
Loading…
Reference in a new issue