diff options
Diffstat (limited to 'templates')
-rw-r--r-- | templates/default.css | 28 | ||||
-rw-r--r-- | templates/show_album.inc | 7 | ||||
-rw-r--r-- | templates/show_object_rating.inc.php | 29 | ||||
-rw-r--r-- | templates/show_songs.inc | 3 |
4 files changed, 41 insertions, 26 deletions
diff --git a/templates/default.css b/templates/default.css index 12506f70..9594a02d 100644 --- a/templates/default.css +++ b/templates/default.css @@ -445,7 +445,7 @@ margin-right:5em; margin:0px; float: right; } -.star-rating li a{ +.star-rating li span{ display:block; width:16px; height: 15px; @@ -455,51 +455,51 @@ margin-right:5em; position: absolute; padding: 0px; } -.star-rating li a:hover{ +.star-rating li span:hover{ background: url(../images/ratings/star_rating.gif) left center; z-index: 2; left: 0px; } -li.zero-stars a:hover { +li.zero-stars span:hover { background: url(../images/ratings/x.gif); height: 15px; left: 80px; display: block; } -a.zero-stars { +span.zero-stars { background: url(../images/ratings/x_off.gif); height: 15px; left: 80px; display: block; } -a.one-stars{ +span.one-stars{ left: 0px; } -a.one-stars:hover{ +span.one-stars:hover{ width:16px; } -a.two-stars{ +span.two-stars{ left:16px; } -a.two-stars:hover{ +span.two-stars:hover{ width: 32px; } -a.three-stars{ +span.three-stars{ left: 32px; } -a.three-stars:hover{ +span.three-stars:hover{ width: 48px; } -a.four-stars{ +span.four-stars{ left: 48px; } -a.four-stars:hover{ +span.four-stars:hover{ width: 64px; } -a.five-stars{ +span.five-stars{ left: 64px; } -a.five-stars:hover{ +span.five-stars:hover{ width: 80px; } li.current-rating{ diff --git a/templates/show_album.inc b/templates/show_album.inc index e2ef6838..5fc28300 100644 --- a/templates/show_album.inc +++ b/templates/show_album.inc @@ -27,7 +27,6 @@ $web_path = conf('web_path'); // Build array of the table classes we are using $row_classes = array('even','odd'); -// Generate variables for the flash ratings //FIXME: $album_id = $album->id; $artist_id = $album->artist_id; @@ -47,7 +46,11 @@ $title = scrub_out($album->name) . ' -- ' . $album->f_artist; </div> <div style="display:table-cell;vertical-align:top;"> <?php - if (conf('ratings')) { show_rating($album->id, 'album');} // end if ratings + if (conf('ratings')) { + show_ajax_js("r_" . $album->id . "_album",array("rating_" . $album->id . "_album")); + echo "<span style=\"display:inline;\" id=\"rating_" . $album->id . "_album\">"; + show_rating($album->id, 'album');} // end if ratings + echo "</span>"; echo "<br />\n"; ?> <strong><?php echo _('Actions'); ?>:</strong><br /> diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php index 1a0cfb8e..afd6d056 100644 --- a/templates/show_object_rating.inc.php +++ b/templates/show_object_rating.inc.php @@ -21,17 +21,18 @@ /* Create some variables we are going to need */ $web_path = conf('web_path'); -$base_url = $web_path . '/ratings.php?action=set_rating&mode=' . conf('flash') . '&rating_type=' . $rating->type . '&object_id=' . $rating->id . '&username=' . $GLOBALS['user']->username; +$base_url = conf('ajax_url') . '?action=set_rating&rating_type=' . $rating->type . '&object_id=' . $rating->id . conf('ajax_info'); + //set the background to no stars echo "<ul class=\"star-rating\">\n"; /* Handle the "Not rated" possibility */ if ($rating->rating == '-1') { - echo "<li class=\"zero-stars\"><a href=\"" . $base_url . "&rating=-1\" title=\"don't play\" class=\"zero-stars\">-1</a></li>\n"; + echo "<li class=\"zero-stars\"><span onclick=\"ajaxPut('" . $base_url . "&rating=-1',r_" . $rating->id . "_" . $rating->type . ");return true;\" title=\"don't play\" class=\"zero-stars\"></span></li>\n"; } else { - echo "<li class=\"zero-stars\"><a href=\"" . $base_url . "&rating=-1\" title=\"remove rating\" class=\"zero-stars\">-1</a></li>\n"; + echo "<li class=\"zero-stars\"><span onclick=\"ajaxPut('" . $base_url . "&rating=-1',r_" . $rating->id . "_" . $rating->type . ");return true;\" title=\"remove rating\" class=\"zero-stars\"></span></li>\n"; } // decide width of rating. image is 16 px wide $width = $rating->rating*16; @@ -45,11 +46,21 @@ if ($rating->rating <= 0) { 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 . "&rating=1\" class=\"one-stars\" title=\"1 out of 5\">$score</a></li>\n"; -echo "<li> <a href=\"" . $base_url . "&rating=2\" class=\"two-stars\" title=\"2 out of 5\">$score</a></li>\n"; -echo "<li> <a href=\"" . $base_url . "&rating=3\" class=\"three-stars\" title=\"3 out of 5\">$score</a></li>\n"; -echo "<li> <a href=\"" . $base_url . "&rating=4\" class=\"four-stars\" title=\"4 out of 5\">$score</a></li>\n"; -echo "<li> <a href=\"" . $base_url . "&rating=5\" class=\"five-stars\" title=\"5 out of 5\">$score</a></li>\n"; -echo "</ul>"; ?> +<li> + <span onclick="ajaxPut('<?php echo $base_url; ?>&rating=1',r_<?php echo $rating->id; ?>_<?php echo $rating->type; ?>);return true;" class="one-stars" title="1 <?php echo _('out of'); ?> 5"></span> +</li> +<li> + <span onclick="ajaxPut('<?php echo $base_url; ?>&rating=2',r_<?php echo $rating->id; ?>_<?php echo $rating->type; ?>);return true;" class="two-stars" title="2 <?php echo _('out of'); ?> 5"></span> +</li> +<li> + <span onclick="ajaxPut('<?php echo $base_url; ?>&rating=3',r_<?php echo $rating->id; ?>_<?php echo $rating->type; ?>);return true;" class="three-stars" title="3 <?php echo _('out of'); ?> 5"></span> +</li> +<li> + <span onclick="ajaxPut('<?php echo $base_url; ?>&rating=4',r_<?php echo $rating->id; ?>_<?php echo $rating->type; ?>);return true;" class="four-stars" title="4 <?php echo _('out of'); ?> 5"></span> +</li> +<li> + <span onclick="ajaxPut('<?php echo $base_url; ?>&rating=5',r_<?php echo $rating->id; ?>_<?php echo $rating->type; ?>);return true;" class="five-stars" title="5 <?php echo _('out of'); ?> 5"></span> +</li> +</ul> diff --git a/templates/show_songs.inc b/templates/show_songs.inc index c8dbcc7c..be8f179c 100644 --- a/templates/show_songs.inc +++ b/templates/show_songs.inc @@ -145,7 +145,8 @@ foreach ($song_ids as $song_id) { <?php } ?> </td> <?php if(conf('ratings')) { ?> - <td> + <td id="rating_<?php echo $song->id; ?>_song"> + <?php show_ajax_js("r_" . $song->id . "_song",array("rating_" . $song->id . "_song")); ?> <?php show_rating($song->id,'song'); ?> </td> <?php } ?> |