Gossamer Forum
Home : Products : Links 2.0 : Customization :

REVIEW.CGI

(Page 4 of 5)
> > > >
Quote Reply
Re: REVIEW.CGI In reply to
I'm with Tiggr & MikeB. I have external rate-it links scattered out all over the web and I can't mess with that, but I would like to install review-it.

Any help?

------------------
Will
Webmaster
FishHoo! Search index for Fishermen
www.fishhoo.com
Quote Reply
Re: REVIEW.CGI In reply to
I'm going to use this as is for a separate installation, but I'm with the "review only" folks for my main site. The external ratings feature has become too important of a promo tool for me. Besides, starting all the ratings over at this point is just not a good option (it took too long to build up the ratings I have).

How about it Widgetz? Can we convince you to put another pot of coffee on and take a look at what would need to be stripped out so it will just generate reviews?
Quote Reply
Re: REVIEW.CGI In reply to
Hi!
I only want to add the reviews, but I don't want to change the ratings-system! Is there a way to do this with this mod? Because it's the best review-system I found for links. But I have a lot of ratings, and I don't want to loose them!

I realy would need a way to install only the review-system, without a new ratings-system.

bye
Tiggr

------------------
visit http://larp-welt.de/
the resource for german live roleplaying

Quote Reply
Re: REVIEW.CGI In reply to
Never mind, I figured it out.

[This message has been edited by XanthisHP (edited August 18, 1999).]
Quote Reply
Re: REVIEW.CGI In reply to
Hi guys!

I know this one is probably a lamre, but here it goes:

When I execute install.cgi everything goes fine, except the creation of the templates. I receive a permission denied error. Any suggestions?

------

Nevermind Smile I figured it out........ I had to CHMOD the templates directory to 777 first, then back to 666.

Thanx!

Michael G. Bronner
emMGee Graf-X, Web Design
www.emmgee.com

[This message has been edited by MikeB (edited August 18, 1999).]
Quote Reply
Re: REVIEW.CGI In reply to
Where should i put the grraphics (stars) and where in the code can i change this directory

i get this linking to the graphics:

<img src="/images/rategifs/rate0.gif" width="102" height="18" alt="0" border="0">

they did not copy to my site if install.cgi was meant to make them.


---/mike B

you probably need to change the permission of the template files. Set it to 777 to make sure it works, and also do it on the directory Templates. that should work.
Quote Reply
Re: REVIEW.CGI In reply to
I have the same intent as Tiggr: I only need to install the review mod, not the ratings mod........ any ideas?

Thanks,
Michael G. Bronner
emMGee Graf-X, Web Design
www.emmgee.com
Quote Reply
Re: REVIEW.CGI In reply to
hi.. stripping out the rating system is quite easy.. it would make the code much shorter also.. and EASIER to install. hehe

about the 500 error.. you can upload LWP yourself and say

use "/path/to/lwp/"; i think....

anyways.. right now i have to make 2 mods.. about the images.. the image DIR is configurable through links.cfg..

hmm... whatelse.. anyways.. if i missed anything.. i'll get back to it later..

jerry
Quote Reply
Re: REVIEW.CGI In reply to
MOD 1 (for review.cgi)
======================
Description: This will let you have the number of reviews on the html pages by adding a new field just like the rating and votes field..
======================
file: links.def
======================

Under this:
Code:
Votes => [19, 'numer', 10, 10, 1, 0, '^\d+$'],

add this:

Code:
Reviews => [20, 'numer', 10, 10, 1, 0, '^\d+$'],

(change the field number to the correct one)

add this to the list of field numbers a few lines down..

Code:
$db_reviews = 20;

(change the number to whatever yours is..)

in nph-build.cgi...

find this line:

Code:
$total{$id} += $values[4];

below it add:

Code:
$review{$id}++ if ($values[5]);

then find this a few lines down..

Code:
if (exists $votes{$id}) {
$rating{$id} = ($total{$id}/$votes{$id});
$rating{$id} = sprintf ("%.2f", $rating{$id});
print "\tUpdating rating to $rating{$id} for link id $id\n" if ($values[$db_rating] != $rating{$id});
$values[$db_rating] = $rating{$id};
$values[$db_votes] = $votes{$id};
}

and below that.. add:

Code:
if ($values[$db_reviews] != $review{$id}) {
print "\tUpdating reviews to $review{$id} for link id $id\n";
$values[$db_reviews] = $review{$id};
}

now you have to add that extra field in links.db!! Smile

jerry
Quote Reply
Re: REVIEW.CGI In reply to
About LWP:

It is not uploadable, it has to be compiled as a module with perl itself.

Root access is required.

Isn't it an idea to make the scripts downloadable?? I think I'm not the only one without LWP

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: REVIEW.CGI In reply to
do you guys realize it can't display a graph without the ratings?? hehe. i guess your in it for the database then?

jerry
Quote Reply
Re: REVIEW.CGI In reply to
lwp is uploadable.. beleive me Smile

i've done it on hypermart when they didn't have it.. now they do.. as a matter of fact.. links uses an uploaded version of lwp I THINK..

jerry
Quote Reply
Re: REVIEW.CGI In reply to
MOD 2
====================
taking out the ratings..
====================

first in review.cgi..

delete:

Code:
foreach (@rating_fields) {
unless (($in{$db_cols[$_]} =~ /^\d\d?/) and ($in{$db_cols[$_]} >= 1) and ($in{$db_cols[$_]} <= 10)) {
&site_html_review_failure ("Your $db_cols[$_] '$in{$db_cols[$_]}' is invalid.") and return;
}
}
if ($in{$db_cols[$db_review]}) {
($in{$db_cols[$db_contact_name]}) or &site_html_review_failure ("$db_cols[$db_contact_name] (Can not be left blank with Review)") and return;
($in{$db_cols[$db_contact_email]}) or &site_html_review_failure ("$db_cols[$db_contact_email] (Can not be left blank with Review)") and return;
}

then in site_html.pl or site_html_templates.pl

delete sub get_rating_graph...
delete sub get_rating_image (unless you want to use it for links.. much shorter than pheonix's)

then change your sub get_reviews to:

Code:
sub get_reviews {
my ($id) = @_;
my (@values, $reviews);
require "$db_lib_path/review.def";

open (DB, "<$db_file_name") or &cgierr ("Can't open review file '$db_file_name'. Reason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB> ) {
/^#/ and next LINE;
/^\s*$/ and next LINE;
chomp;
@values = &split_decode($_);
if ($values[$db_linkid] eq $id) {
($values[$db_review]) and (push (@reviews, @values)) and ($reviews++);
}
}
close DB;

if ($reviews) {
@reviews = &build_sorthit (@reviews);

$totalpages = int($reviews/$reviews_per_page);
if ($totalpages < $reviews/$reviews_per_page) { $totalpages++; }
if ($page > $totalpages) { $page = 1; }

$displayed1 = ($page-1) * $reviews_per_page + 1;
$displayed2 = $reviews_per_page * $page;
$displayed2 = $displayed2 - ($displayed2 - $reviews) if ($page == $totalpages);

my $prev_page = $page-1;
my $next_page = $page+1;

$span = qq~<font color="#c0c0c0"><b>< Previous</b></font>~ if ($prev_page == 0);
$span = qq~<a href="$build_review_url?$links_key=$id"><b>< Previous</b></a>~ if ($prev_page == 1);
$span = qq~<a href="$build_review_url?$links_key=$id&page=$prev_page"><b>< Previous</b></a>~ if ($prev_page > 1);
$span .= qq~ <font color="#808080">/</font> ~;
if ($page == $totalpages) { $span .= qq~<font color="#c0c0c0"><b>Next ></b></font>~; }
else { $span .= qq~<a href="$build_review_url?$links_key=$id&page=$next_page"><b>Next ></b></a>~; }

@reviews = @reviews[(($#db_cols+1)*($reviews_per_page*($page-1))) .. $#reviews] if ($page > 1);

for ($i = 0; $i < $reviews_per_page; $i++) {
%tmp = &array_to_hash ($i, @reviews);
last if ($tmp{$db_key} eq "");
$results .= &site_html_review (%tmp);
}
}
}

now.... in site_html_review_form.. you are going to get alot of unknown tags.. just delete each one of them from the list.. except for the ones for review.. and take them out of the template..

for people not using templates.. it should just show up blank on the page.. delete them as you find them! Smile

now in nph-build.cgi you are going to have to change your update_ratings to the old one..

here is the code..

Code:
sub build_update_ratings {
# --------------------------------------------------------
# Updates the ratings of each link.
#

# Let's collect the ratings.
my ($id, %rating, %votes, @values, $input);
opendir (HITS, $db_rates_path) or &cgierr ("unable to open ratings directory: $db_rates_path. Reason: $!");
while (defined ($id = readdir HITS)) {
next unless ($id =~ /^\d+$/);
open (HIT, "$db_rates_path/$id") or &cgierr ("unable to open rating counter: $db_rates_path/$id. Reason: $!");
my $input = <HIT>;
chomp $input;
($votes{$id}, $rating{$id}) = split /\s/, $input;
close HIT;
}
closedir HITS;

# Update the links database.
my $output = '';
INLINE: {
local ($^I, @ARGV) = ('.bak', $db_links_name);
LINE: while (<> ) {
/^#/ and print OUT and next LINE; # Skip comment Lines.
/^\s*$/ and next LINE; # Skip blank lines.
chomp; # Remove trailing new line.
@values = split /\Q$db_delim\E/;
$id = $values[0];

if (exists $votes{$id}) {
$values[$db_rating] = (($values[$db_rating] * $values[$db_votes]) + $rating{$id}) /
($values[$db_votes] + $votes{$id});
$values[$db_rating] = sprintf ("%.2f", $values[$db_rating]);
$values[$db_votes] = $values[$db_votes] + $votes{$id};
$output .= "\tUpdating rating to $values[$db_rating] for link id $id\n";
}
print &join_encode(&array_to_hash(0, @values));
}
}
print $output;

# Delete the ratings.
foreach (keys %votes) {
unlink ("$db_rates_path/$_") or &cgierr ("unable to remove rating: $db_rates_path/$_. Reason: $!");
}
}

then in review.def you need to take out the Rating field...

and also this line:

Code:
# Rating Fields
@rating_fields = (4);

that should be all......

jerry
Quote Reply
Re: REVIEW.CGI In reply to
oh yea.. you want to put back the rate.cgi .. if you don't have it.. look in your backup dir for the one the install.cgi backed up..

and the rates folder in /admin/data/
chmod it to 777.

jerry
Quote Reply
Re: REVIEW.CGI In reply to
If LWP is uploadable you have to tell me which scripts to upload and how to use it.

I picked up the archive and it included only instructions on how to compile it.

Let me know how you did this on Hypermart if you want. I tried a few things but can't get it to work.

Jeroen

------------------
Free 4U2: a searchable directory of free stuff
http://www.free4u2.com

When something does not function properly, hit it hard.....
.....When it breaks it had to be replaced anyway.


Quote Reply
Re: REVIEW.CGI In reply to
OOPs.. i forgot but if you want it to be a review only..

you need to do this

Code:
'Contact Name' => [2, 'alpha', 40, 75, 1, \&admin_name, ''],
'Contact Email' => [3, 'alpha', 40, 75, 1, \&admin_email, '.+@.+\..+'],
Review => [4, 'alpha', '40x3', 500, 1, '', ''],

it changes it to require these fields..

jerry
Quote Reply
Re: REVIEW.CGI In reply to
there is a report of EMAILING the validation email for this.. i myself know how to take it out.. and made an easy way for this mod which was in the instructions.. but someone said it doesn't work..

anyone else? (this is only if you validate manually)

jerry
Quote Reply
Re: REVIEW.CGI In reply to
Same here. I did the normal Review.cgi mod, then up-moded it to review only. When i manually validated my test review, i received no email.



------------------
Michael G. Bronner
emMGee Graf-X, Web Design
www.emmgee.com
Quote Reply
Re: REVIEW.CGI In reply to
I have been having a problem with the email. I am using the full script but when a confirmation should be sent this is what gets sent :

Unkown Tag: Title

that is the sole contents of the email.

any ideas?

------------------
-------------------------
http://www.freeontheweb.com/
Reviewed and rated resources for webmasters
-------------------------
Quote Reply
Re: REVIEW.CGI In reply to
what i wanted to make it like was to not have the email at all..

but anyways.. i think you skipped step six or something.. there is a part in admin_html.pl that you need to add for it to not do it..

jerry
Quote Reply
Re: REVIEW.CGI In reply to
Thanks for the strip down Jerry!
Quote Reply
Re: REVIEW.CGI In reply to
YES! It worked on the first try! I know we don't know each other that well but, "I love you man. (Can I have your Bud Lite?)" Wink
Quote Reply
Re: REVIEW.CGI In reply to
yea.. it seems after awhile everyone is getting the install on the first try..

cause of a few bug fixes i guess..

jerry
Quote Reply
Re: REVIEW.CGI In reply to
How do we display the reviews on the detailed pages???

Thanks alot Jerry -> Your script is the best!
Quote Reply
Re: REVIEW.CGI In reply to
Oops. Spoke to soon.
CGI ERROR
==========================================
Error Message : unable to open ratings directory: . Reason: No such file or directory
The directory does exist though, and that's the problem.
> > > >