fixed dplicate tag detection
git-svn-id: http://yolanda.mister-muffin.de/svn@273 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
fa1b8fb203
commit
b8381595b2
2 changed files with 10 additions and 14 deletions
|
@ -21,24 +21,11 @@ while(($subject) = $sth->fetchrow_array())
|
||||||
#strip whitespaces
|
#strip whitespaces
|
||||||
$val =~ s/^\s*(.*?)\s*$/$1/;
|
$val =~ s/^\s*(.*?)\s*$/$1/;
|
||||||
if(length($val) >= 4)
|
if(length($val) >= 4)
|
||||||
{
|
|
||||||
#check if some clever guy has written a tag multiple times
|
|
||||||
$found = 0;
|
|
||||||
foreach my $tmpval (@subject)
|
|
||||||
{
|
|
||||||
if($val eq $tmpval)
|
|
||||||
{
|
|
||||||
$found = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#only add tag if it is not been entered twice or more
|
|
||||||
if(!$found)
|
|
||||||
{
|
{
|
||||||
%hash->{$val}++;
|
%hash->{$val}++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$sth->finish();
|
$sth->finish();
|
||||||
|
|
||||||
#sort by count
|
#sort by count
|
||||||
|
|
|
@ -25,6 +25,15 @@ if($userinfo->{'username'})
|
||||||
{
|
{
|
||||||
if($query->param('DC.Title')&&$query->param('DC.Subject')&&$query->param('DC.Description'))
|
if($query->param('DC.Title')&&$query->param('DC.Subject')&&$query->param('DC.Description'))
|
||||||
{
|
{
|
||||||
|
#remove duplicates from tags
|
||||||
|
@subject = split(' ', $query->param('DC.Subject'));
|
||||||
|
@unique{ @subject } = ();
|
||||||
|
foreach $tag (keys %unique)
|
||||||
|
{
|
||||||
|
$subject.=$tag." ";
|
||||||
|
}
|
||||||
|
$page->{'uploadform'}->{'DC.Subject'} = $ubject;
|
||||||
|
|
||||||
$page->{'innerresults'} = [''];
|
$page->{'innerresults'} = [''];
|
||||||
|
|
||||||
my @args = ();
|
my @args = ();
|
||||||
|
|
Loading…
Reference in a new issue