implemented dc in videos.pl
git-svn-id: http://yolanda.mister-muffin.de/svn@99 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
9e2639bde3
commit
e72249358b
2 changed files with 23 additions and 10 deletions
|
@ -84,7 +84,7 @@ elsif($query->param('sort'))
|
||||||
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr;
|
my $dbh = DBI->connect("DBI:mysql:$database:$dbhost", $dbuser, $dbpass) or die $dbh->errstr;
|
||||||
|
|
||||||
#prepare query
|
#prepare query
|
||||||
my $sth = $dbh->prepare(qq{select id, title, description, userid, timestamp from videos order by timestamp desc }) or die $dbh->errstr;
|
my $sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ) from videos order by timestamp desc }) or die $dbh->errstr;
|
||||||
|
|
||||||
#execute it
|
#execute it
|
||||||
$sth->execute($query->param('query')) or die $dbh->errstr;
|
$sth->execute($query->param('query')) or die $dbh->errstr;
|
||||||
|
|
|
@ -25,21 +25,26 @@ if($query->param('title') or $query->param('id'))
|
||||||
if($query->param('id'))
|
if($query->param('id'))
|
||||||
{
|
{
|
||||||
#prepare query
|
#prepare query
|
||||||
$sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ) from videos where id = ? }) or die $dbh->errstr;
|
$sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ),
|
||||||
|
creator, subject, contributor, source, language, coverage, rights, license
|
||||||
|
from videos where id = ? }) or die $dbh->errstr;
|
||||||
#execute it
|
#execute it
|
||||||
$rowcount = $sth->execute($query->param('id')) or die $dbh->errstr;
|
$rowcount = $sth->execute($query->param('id')) or die $dbh->errstr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#prepare query
|
#prepare query
|
||||||
$sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ) from videos where title = ? }) or die $dbh->errstr;
|
$sth = $dbh->prepare(qq{select id, title, description, userid, from_unixtime( timestamp ),
|
||||||
|
creator, subject, contributor, source, language, coverage, rights, license
|
||||||
|
from videos where title = ? }) or die $dbh->errstr;
|
||||||
#execute it
|
#execute it
|
||||||
$rowcount = $sth->execute($query->param('title')) or die $dbh->errstr;
|
$rowcount = $sth->execute($query->param('title')) or die $dbh->errstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($rowcount == 1)
|
if($rowcount == 1)
|
||||||
{
|
{
|
||||||
my ($id, $title, $description, $userid, $timestamp) = $sth->fetchrow_array();
|
my ($id, $title, $description, $userid, $timestamp, $creator, $subject,
|
||||||
|
$contributor, $source, $language, $coverage, $rights, $license,) = $sth->fetchrow_array();
|
||||||
|
|
||||||
#before code cleanup, this was a really obfuscated array/hash creation
|
#before code cleanup, this was a really obfuscated array/hash creation
|
||||||
push @{ $page->{'video'} },
|
push @{ $page->{'video'} },
|
||||||
|
@ -51,13 +56,21 @@ if($query->param('title') or $query->param('id'))
|
||||||
{
|
{
|
||||||
'rdf:about' => "./videos/$id",
|
'rdf:about' => "./videos/$id",
|
||||||
'dc:title' => [$title],
|
'dc:title' => [$title],
|
||||||
'dc:date' => [$timestamp],
|
'dc:creator' => [$creator],
|
||||||
|
'dc:subject' => [$subject],
|
||||||
|
'dc:description' => [$description],
|
||||||
'dc:publisher' => [get_username_from_id($userid)],
|
'dc:publisher' => [get_username_from_id($userid)],
|
||||||
'dc:description'=> [$description]
|
'dc:contributor' => [$contributor],
|
||||||
|
'dc:date' => [$timestamp],
|
||||||
|
'dc:identifier' => ["./videos/$id"],
|
||||||
|
'dc:source' => [$source],
|
||||||
|
'dc:language' => [$language],
|
||||||
|
'dc:coverage' => [$coverage],
|
||||||
|
'dc:rights' => [$rights]
|
||||||
},
|
},
|
||||||
'cc:License' =>
|
'cc:License' =>
|
||||||
{
|
{
|
||||||
'rdf:about' => 'http://creativecommons.org/licenses/GPL/2.0/'
|
'rdf:about' => $license
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue