Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

MOD: "updated" files show up in "what's new"

Quote Reply
MOD: "updated" files show up in "what's new"
This is a trivial mod to allow files that have been modified to show up on the "what's New" list. You can flag them as 'updated' by checking the 'isChanged' field in the template.

But, the purpose is so that links that have been changed are also set up to be re-viewed by people, not only links that are newly added.

Just replace the following lines in nph-build.cgi with the changed lines here. I listed the two whole clauses, but really only 2 lines have been changed(one changed, one added).

Code:
# Let's get all the new links and order them alphabetically, grouped by
# category. (isChanged added to pull out updated links)
$sth = $LINKDB->prepare (qq!
SELECT Links.*, Category.Name
FROM Links, Category
WHERE (Links.isNew = 'Yes' or Links.isChanged = 'Yes') AND Links.CategoryID = Category.ID
ORDER BY $LINKS{build_sort_order_new}
LIMIT 1000
!);
$sth->execute();
($sth->rows > 1000) and print "\tWarning: Max New links limit of 1,000 exceeded!\n";

# Build the html organized by date then by category.
$OUT{'total'} = 0;
while ($link = $sth->fetchrow_hashref) {
## The following line is added
## to prevent the updated link from building on it's old date.
($link->{isChanged} eq 'Yes') && ($link->{'Add_Date'} = $link->{'Mod_Date'});
${$link_output{$link->{'Add_Date'}}}{$link->{'Name'}} .= &site_html_link ($link);
$span_totals{$link->{'Add_Date'}}++;
$OUT{'total'}++;
}
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/

Quote Reply
Re: [pugdog] MOD: "updated" files show up in "what's new" In reply to
Hello,

Any idea, on how I could get this mod to work with the current version of Links SQL?

Thanks!
Quote Reply
Re: [Demolitioncrew] MOD: "updated" files show up in "what's new" In reply to
Hi,

<G> I actually don't remember this mod, but 3 years is a long time.

The principle would be the same.

You want to find all links that are isNew or isChanged, rather than just the links that are isNew.

It would seem in Links::Build::build_new_index you would want to change the line:

my $sth = $link_db->select ( }, ['Add_Date', 'COUNT(*)'] );


to

Code:


my $cond = GT::SQL::Condition->new (
'isNew', '=', 'Yes',
'isChanged', '=', 'Yes'


);

$cond->bool ('OR');

my $cond_2 GT::SQL::Condition->new (

$cond,

'isValidated', '=', 'Yes'

);
my $sth = $link_db->select ( $cond_2, ['Add_Date', 'Mod_Date', 'isChanged', 'COUNT(*)'] );


Then, change the loop:

while (my ($date, $count) = $sth->fetchrow_array) {
to

while (my ($date, $mod_date, $is_changed, $count) = $sth->fetchrow_array) {
if ($is_changed eq 'Yes') {
$date = $mod_date;
} ### change the value of the $date field.



You would need to make the same changes in the build_new_subpage subroutine right after the one above.

Probably, just this line:

my $sth = $link_db->select ( { Add_Date => $date, isNew => 'Yes', isValidated => 'Yes' } );

Code:
my $cond = GT::SQL::Condition->new (
'isNew', '=', 'Yes',
'isChanged', '=', 'Yes'
);
$cond->bool ('OR');
my $cond_1 = GT::SQL::Condition->new (
'Add_Date', '=', $date,
'Mod_Date', '=', $date'
);
$cond->bool ('OR');
my $cond_2 GT::SQL::Condition->new (
$cond,
$cond1,
'isValidated', '=', 'Yes'
);
my $sth = $link_db->select ( $cond_2 );



This may not work <G>.... it's just where it seems the main test for the building, and the actual select statements are made.

I'm *SURE* it will take some playing with, but once played with, it might be able to be stuffed into a plugin, if there is a way way to hook around these routines, but I don't see one, from these routines.

Just some off the top ideas, that probably won't work as written <G>


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] MOD: "updated" files show up in "what's new" In reply to
THanks :)

I'll give it a shot!