diff --git a/webtools/addons/lib/addon.class.php b/webtools/addons/lib/addon.class.php index 41e6b39dbc2..324d355453b 100644 --- a/webtools/addons/lib/addon.class.php +++ b/webtools/addons/lib/addon.class.php @@ -240,6 +240,9 @@ class AddOn extends AMO_Object CommentNote, CommentDate, CommentVote + `helpful-yes` as helpful_yes, + `helpful-no` as helpful_no, + `helpful-yes` + `helpful-no` as helpful_total FROM feedback WHERE diff --git a/webtools/addons/ratecomment.php b/webtools/addons/ratecomment.php index e69de29bb2d..722209023d6 100644 --- a/webtools/addons/ratecomment.php +++ b/webtools/addons/ratecomment.php @@ -0,0 +1,74 @@ +query(" + UPDATE + feedback + SET + `helpful-{$clean['r']}` = `helpful-{$clean['r']}` + 1 + WHERE + CommentID = {$sql['cid']} +", SQL_NONE); + +$tpl->assign( + array( 'title' => 'Rate a Comment for ' . $addon->Name, + 'content' => 'ratecomment.tpl', + 'rate' => $success, + 'addon' => $addon, + 'sidebar' => 'inc/addon-sidebar.tpl') +); + +function commentError() { + global $tpl; + $tpl->assign( + array( 'title' => 'Rate a Comment', + 'content' => 'ratecomment.tpl', + 'error' => true) + ); + $tpl->display('inc/wrappers/nonav.tpl'); + exit; +} +?> diff --git a/webtools/addons/tpl/addon.tpl b/webtools/addons/tpl/addon.tpl index 0e51f4ce105..0e414b2e435 100644 --- a/webtools/addons/tpl/addon.tpl +++ b/webtools/addons/tpl/addon.tpl @@ -36,9 +36,10 @@ Requires: {$addon->AppName} {$addon->MinAppVer} - {$addon->MaxAppVer} by {$addon->Comments[comments].CommentName}, {$addon->Comments[comments].CommentDate|date_format}
+by {$addon->Comments[comments].CommentName}, {$addon->Comments[comments].CommentDate|date_format}
+{$addon->Comments[comments].helpful_yes} out of {$addon->Comments[comments].helpful_total} viewers found this comment helpful
{$addon->Comments[comments].CommentNote}
- + {/section} diff --git a/webtools/addons/tpl/comments.tpl b/webtools/addons/tpl/comments.tpl index 4b7760d83b4..2d403f46d76 100644 --- a/webtools/addons/tpl/comments.tpl +++ b/webtools/addons/tpl/comments.tpl @@ -9,9 +9,10 @@ released on {$addon->VersionDateAdded|date_format} {section name=comments loop=$addon->Comments max=10}by {$addon->Comments[comments].CommentName}, {$addon->Comments[comments].CommentDate|date_format}
+by {$addon->Comments[comments].CommentName}, {$addon->Comments[comments].CommentDate|date_format}
+{$addon->Comments[comments].helpful_yes} out of {$addon->Comments[comments].helpful_total} viewers found this comment helpful
{$addon->Comments[comments].CommentNote}
- +Unfortunately, there has been a problem with your submission. Please go back and try again
+{else} ++{$addon->Name} {$addon->Version}, +by {$addon->UserName}, +released on {$addon->VersionDateAdded|date_format} +
+You have successfully rated this comment
+{else} +Unfortunately, there was an error rating this comment. If this problem persists, please contact the admins.
+{/if} +{/if} +