ad_general_link_format_rating

one of the documented procedures in this installation of the ACS
Usage:
ad_general_link_format_rating   db   link_id   { rating_url "" }
What it does:
Form for entering rating.
Defined in: /web/philip/tcl/ad-general-links.tcl

Source code:



    set user_id [ad_get_user_id]

    set user_rating [database_to_tcl_string_or_null $db "select rating from general_link_user_ratings where user_id = $user_id and link_id = $link_id"]

    if {[empty_string_p $rating_url]} {
	set rating_url "link-rate.tcl"
    }

    set rating_html "<form method=post action=\"$rating_url\">
    [export_form_vars link_id]
    <select name=rating>
    "
    set current_rating 0
    while { $current_rating <= 10 } {
	if { $user_rating == $current_rating } {
	    append rating_html "<option value=\"$current_rating\" selected>$current_rating "
	} else {
	    append rating_html "<option type=radio name=rating value=\"$current_rating\">$current_rating "
	}

	incr current_rating
    }
    append rating_html "</select>"
    if {[empty_string_p $user_rating]} {
	append rating_html "<input type=submit value=\"Rate Link\"> - you have not rated this link; would you like to?</form>"
    } else {
	append rating_html "<input type=submit value=\"Change Rating\"> - you have given this link a rating of $user_rating; would you like to change this rating?</form>"
    }


philg@mit.edu