Hi
I want to delete duplicates - 100 at a time.
I have changed the admin.cgi and 100 display.
I would like the checkbox of the highest value to be checked automatically - so I then just click the delete button.
Below is the code from Admin_HTML.pm, Anyone any ideas on what to change. Say the highest ID of the duplicated links.
sub html_check_duplicates {
# --------------------------------------------------------
# This routine checks to see if there are any duplicate links.
#
my ($in, $db, $duplicates) = @_;
my ($footer, $set, $link, $id, $title, $cat, $key);
$footer = &html_footer ($in, $db);
print qq|
<html>
<head>
<title>$TITLE: Check Duplicate Links.</title>
</head>
<body bgcolor="#DDDDDD">
<form action="$SCRIPT_URL" METHOD="POST">
<input type=hidden name="db" value="$DATABASE">
<input type=hidden name="do" value="delete_records">
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$TITLE: Check Duplicate Links</b>
</td></tr>
</table>
<blockquote><p><$FONT>
|;
if (keys %$duplicates == 0) {
print qq~ No duplicates found.
<p>
<table border=0 bgcolor="#DDDDDD" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td> $footer</td></tr>
</table>
</blockquote>
~;
}
else {
print qq~
<p>To delete the offending links, click on the checkboxes and click delete:</p>
<TABLE BORDER=1>
~;
$key = $db->{'db_key'};
my $count = 0;
foreach $set (keys %$duplicates) {
print qq~<tr><td colspan=2><$FONT><b>$set</b></font></td></tr>
<tr><td> </td>
<td>
~;
foreach $link (@{${$duplicates}{$set}}) {
$link = $db->array_to_hash ($link);
$id = $link->{$db->{'db_key'}};
$title = $link->{'Title'};
$cat = &get_category_name ($link->{'CategoryID'});
print qq~<input type=checkbox name="delete" value="$id"> <$FONT>(<a href="$SCRIPT_URL?db=Links&do=view_records&$key=$id&ww=1" target="_blank">$id</a> ) $title in <em>$cat</em><br>~;
}
print qq~</td></tr>~;
$count++;
}
my $offset = $in->param('offset') | | 0;
print "<tr><td colspan=2 align=center>";
($count >= 9) and print " <$FONT><b><a href='$SCRIPT_URL?db=Links&do=check_duplicates&offset=", ($offset+10), "'>Next 10</a></b></FONT> ";
($count >= 9) and print " <$FONT><b><a href='$SCRIPT_URL?db=Links&do=check_duplicates&offset=", ($offset-10 > 0) ? ($offset-10) : 0, "'>Prev 10</a></b></FONT> ";
print qq~
</td></tr>
</table>
<p>
</blockquote>
<table border=0 bgcolor="#DDDDDD" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td>
<p><center><INPUT TYPE="SUBMIT" VALUE="Delete Checked $OBJECT(s)"> <INPUT TYPE="RESET" VALUE="Reset Form"></center></p>
$footer
</td></tr>
</table>
~;
}
print qq~
</body>
</html>
~;
}
Cheers
Tony
PS Or is there a quicker way from SQL Monitor
[This message has been edited by chilli (edited January 15, 2000).]
I want to delete duplicates - 100 at a time.
I have changed the admin.cgi and 100 display.
I would like the checkbox of the highest value to be checked automatically - so I then just click the delete button.
Below is the code from Admin_HTML.pm, Anyone any ideas on what to change. Say the highest ID of the duplicated links.
sub html_check_duplicates {
# --------------------------------------------------------
# This routine checks to see if there are any duplicate links.
#
my ($in, $db, $duplicates) = @_;
my ($footer, $set, $link, $id, $title, $cat, $key);
$footer = &html_footer ($in, $db);
print qq|
<html>
<head>
<title>$TITLE: Check Duplicate Links.</title>
</head>
<body bgcolor="#DDDDDD">
<form action="$SCRIPT_URL" METHOD="POST">
<input type=hidden name="db" value="$DATABASE">
<input type=hidden name="do" value="delete_records">
<table border=1 bgcolor="#FFFFFF" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td colspan=2 bgcolor="navy">
<FONT FACE="MS Sans Serif, arial,helvetica" size=1 COLOR="#FFFFFF">
<b>$TITLE: Check Duplicate Links</b>
</td></tr>
</table>
<blockquote><p><$FONT>
|;
if (keys %$duplicates == 0) {
print qq~ No duplicates found.
<p>
<table border=0 bgcolor="#DDDDDD" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td> $footer</td></tr>
</table>
</blockquote>
~;
}
else {
print qq~
<p>To delete the offending links, click on the checkboxes and click delete:</p>
<TABLE BORDER=1>
~;
$key = $db->{'db_key'};
my $count = 0;
foreach $set (keys %$duplicates) {
print qq~<tr><td colspan=2><$FONT><b>$set</b></font></td></tr>
<tr><td> </td>
<td>
~;
foreach $link (@{${$duplicates}{$set}}) {
$link = $db->array_to_hash ($link);
$id = $link->{$db->{'db_key'}};
$title = $link->{'Title'};
$cat = &get_category_name ($link->{'CategoryID'});
print qq~<input type=checkbox name="delete" value="$id"> <$FONT>(<a href="$SCRIPT_URL?db=Links&do=view_records&$key=$id&ww=1" target="_blank">$id</a> ) $title in <em>$cat</em><br>~;
}
print qq~</td></tr>~;
$count++;
}
my $offset = $in->param('offset') | | 0;
print "<tr><td colspan=2 align=center>";
($count >= 9) and print " <$FONT><b><a href='$SCRIPT_URL?db=Links&do=check_duplicates&offset=", ($offset+10), "'>Next 10</a></b></FONT> ";
($count >= 9) and print " <$FONT><b><a href='$SCRIPT_URL?db=Links&do=check_duplicates&offset=", ($offset-10 > 0) ? ($offset-10) : 0, "'>Prev 10</a></b></FONT> ";
print qq~
</td></tr>
</table>
<p>
</blockquote>
<table border=0 bgcolor="#DDDDDD" cellpadding=5 cellspacing=3 width=500 valign=top>
<tr><td>
<p><center><INPUT TYPE="SUBMIT" VALUE="Delete Checked $OBJECT(s)"> <INPUT TYPE="RESET" VALUE="Reset Form"></center></p>
$footer
</td></tr>
</table>
~;
}
print qq~
</body>
</html>
~;
}
Cheers
Tony
PS Or is there a quicker way from SQL Monitor
[This message has been edited by chilli (edited January 15, 2000).]