summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-18 08:12:28 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-01-18 08:12:28 +0000
commit5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5 (patch)
treec31fecc94908b9b3804f12b13effd0b3a852b934 /templates
parent5d66022a37df7e568aa9e60750465236e35fc212 (diff)
downloadampache-5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5.tar.gz
ampache-5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5.tar.bz2
ampache-5f8db40a3247a38644a8aa07e62b1e6e4a71b1f5.zip
fixed javascript on ratings images... kinda there is still a bug but it is just visual
Diffstat (limited to 'templates')
-rw-r--r--templates/menustyle.inc77
-rw-r--r--templates/show_object_rating.inc.php62
2 files changed, 107 insertions, 32 deletions
diff --git a/templates/menustyle.inc b/templates/menustyle.inc
index e9a999eb..aa4fa5b7 100644
--- a/templates/menustyle.inc
+++ b/templates/menustyle.inc
@@ -123,6 +123,83 @@
#sidebar li:hover ul, #sidebar li.sfhover ul {
left: auto; /* this calls the submenu back when the parent li is hovered. */
}
+/*star rating styles */
+ /* styles for the star rater */
+ .star-rating{
+ list-style:none;
+ margin: 0px;
+ padding:0px;
+ width: 80px;
+ height: 15px;
+ position: relative;
+ background: url(<?php echo conf('web_path'); ?>/images/ratings/star_rating.gif) top left repeat-x;
+ }
+ .star-rating li{
+ padding:0px;
+ margin:0px;
+ /*\*/
+ float: right;
+ /* */
+ }
+ .star-rating li a{
+ display:block;
+ width:16px;
+ height: 15px;
+ text-decoration: none;
+ text-indent: -9000px;
+ z-index: 20;
+ position: absolute;
+ padding: 0px;
+ }
+ .star-rating li a:hover{
+ background: url(<?php echo conf('web_path'); ?>/images/ratings/star_rating.gif) left center;
+ z-index: 2;
+ left: 0px;
+ }
+ .star-rating a.zero-stars {
+ background: url(<?php echo conf('web_path'); ?>/images/ratings/x_off.gif);
+ position: absolute;
+ height: 15px;
+ display: block;
+ }
+ .star-rating a.one-stars{
+ left: 0px;
+ }
+ .star-rating a.one-stars:hover{
+ width:16px;
+ }
+ .star-rating a.two-stars{
+ left:16px;
+ }
+ .star-rating a.two-stars:hover{
+ width: 32px;
+ }
+ .star-rating a.three-stars{
+ left: 32px;
+ }
+ .star-rating a.three-stars:hover{
+ width: 48px;
+ }
+ .star-rating a.four-stars{
+ left: 48px;
+ }
+ .star-rating a.four-stars:hover{
+ width: 64px;
+ }
+ .star-rating a.five-stars{
+ left: 64px;
+ }
+ .star-rating a.five-stars:hover{
+ width: 80px;
+ }
+ .star-rating li.current-rating{
+ background: url(<?php echo conf('web_path'); ?>/images/ratings/star_rating.gif) left bottom;
+ position: absolute;
+ height: 15px;
+ display: block;
+ text-indent: -9000px;
+ z-index: 1;
+ }
-->
</style>
diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php
index 831b6b40..a440d919 100644
--- a/templates/show_object_rating.inc.php
+++ b/templates/show_object_rating.inc.php
@@ -19,42 +19,40 @@
*/
if ($type != 'song') {
- echo "<strong>" . _("Rating") . ":</strong>";
+ echo _('Rating') . ":";
}
/* Create some variables we are going to need */
$web_path = conf('web_path');
$base_url = $web_path . '/ratings.php?action=set_rating&amp;mode=' . conf('flash') . '&amp;rating_type=' . $rating->type . '&amp;object_id=' . $rating->id . '&amp;username=' . $GLOBALS['user']->username;
-$score = '0';
-
-/* count up to 6 */
-while ($score < 6) {
- /* Handle the "Not rated" possibility */
- if ($score == '0' AND $rating->rating == '-1') {
- echo "<img src=\"" . $web_path . "/images/ratings/x.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- $found_on = true;
- }
- elseif ($score == '0' AND $rating->rating == '0') {
- echo "<img src=\"" . $web_path . "/images/ratings/x_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- $found_on = true;
- }
- elseif ($score == '0') {
- echo "<a href=\"" . $base_url . "&amp;rating=$score\">\n\t";
- echo "<img src=\"" . $web_path . "/images/ratings/x_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- echo "</a>";
- }
- elseif ($score == $rating->rating) {
- echo "<img src=\"" . $web_path . "/images/ratings/star.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n";
- $found_on = true;
- }
- elseif (!$found_on) {
- echo "<a href=\"" . $base_url . "&amp;rating=$score\">\n\t<img src=\"" . $web_path . "/images/ratings/star.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n</a>\n";
- }
- else {
- echo "<a href=\"" . $base_url . "&amp;rating=$score\">\n\t<img src=\"" . $web_path . "/images/ratings/star_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\" />\n</a>\n";
- }
- /* Next! */
- $score++;
-} // end while
+
+//set the background to no stars
+echo "<ul class=\"star-rating\">\n";
+
+/* Handle the "Not rated" possibility */
+if ($rating->rating == '-1') {
+ echo "<li><a href=\"" . $base_url . "&amp;rating=-1\" title=\"don't play\" class=\"zero-stars\">-1</a></li>\n";
+}
+else {
+ echo "<li><a href=\"" . $base_url . "&amp;rating=-1\" title=\"remove rating\" class=\"zero-stars\">-1</a></li>\n";
+}
+// decide width of rating. image is 16 px wide
+$width = $rating->rating*16;
+if ($width < 0) $width = 0;
+
+//set the current rating background
+echo "<li class=\"current-rating\" style=\"width:${width}px\" >Current rating: ";
+if ($rating->rating <= 0) {
+ echo "not rated yet </li>\n";
+}
+else echo "$rating->rating of 5</li>\n";
+
+//it did not like my "1-star", "2-star" ... css styles, and I changed it to this after I realized star1... would have worked :\
+echo "<li> <a href=\"" . $base_url . "&amp;rating=1\" class=\"one-stars\" title=\"1 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=2\" class=\"two-stars\" title=\"2 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=3\" class=\"three-stars\" title=\"3 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=4\" class=\"four-stars\" title=\"4 out of 5\">$score</a></li>\n";
+echo "<li> <a href=\"" . $base_url . "&amp;rating=5\" class=\"five-stars\" title=\"5 out of 5\">$score</a></li>\n";
+echo "</ul>";
?>