diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-12-25 10:04:27 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-12-25 10:04:27 +0000 |
commit | 27158141ee1a14b7d23ae8997d2c41b49fc904d9 (patch) | |
tree | 2180fff67d21ffdbab32f2105cff3c7275b6b511 /templates | |
parent | 5415c2e847032896907946c98d68a254399e4416 (diff) | |
download | ampache-27158141ee1a14b7d23ae8997d2c41b49fc904d9.tar.gz ampache-27158141ee1a14b7d23ae8997d2c41b49fc904d9.tar.bz2 ampache-27158141ee1a14b7d23ae8997d2c41b49fc904d9.zip |
initial ratings mojo, some stylesheet fixes, changed user preferences again and a db update
Diffstat (limited to 'templates')
-rw-r--r-- | templates/footer.inc | 1 | ||||
-rw-r--r-- | templates/header.inc | 1 | ||||
-rw-r--r-- | templates/show_album.inc | 16 | ||||
-rw-r--r-- | templates/show_login_form.inc | 8 | ||||
-rw-r--r-- | templates/show_object_rating.inc.php | 53 | ||||
-rw-r--r-- | templates/show_preference_box.inc.php | 78 | ||||
-rw-r--r-- | templates/show_preferences.inc | 88 | ||||
-rw-r--r-- | templates/show_songs.inc | 15 | ||||
-rw-r--r-- | templates/style.inc | 28 |
9 files changed, 213 insertions, 75 deletions
diff --git a/templates/footer.inc b/templates/footer.inc index 894bb74a..b35db223 100644 --- a/templates/footer.inc +++ b/templates/footer.inc @@ -1,3 +1,4 @@ +</td></tr></table> </div> <!-- end id="content"--> </div> <!-- end id="maincontainer"--> </body> diff --git a/templates/header.inc b/templates/header.inc index 7eceff3d..635330d8 100644 --- a/templates/header.inc +++ b/templates/header.inc @@ -64,4 +64,5 @@ $location = get_location(); <?php require_once(conf('prefix') . '/templates/sidebar.inc.php'); ?> </div> <div id="content"> + <table><tr><td> <!-- Start Main Page --> diff --git a/templates/show_album.inc b/templates/show_album.inc index ad445246..d16a9cf3 100644 --- a/templates/show_album.inc +++ b/templates/show_album.inc @@ -28,7 +28,14 @@ $row_classes = array('even','odd'); //FIXME: I hate having to create this here again... LAME -$user = new User($_SESSION['userdata']['username']); +$user = $GLOBALS['user']; + +// Generate variables for the flash ratings +//FIXME: +$album_id=$album->id; +$artist_id=$album->artist_id; +$username=$user->username; + ?> <br /> <table class="border" cellspacing="1" cellpadding="3" border="0"> @@ -49,6 +56,12 @@ $user = new User($_SESSION['userdata']['username']); ?> </td> <td valign="top"> + <?php + if (conf('ratings')) { + show_rating($album->id,'artist'); + } // end if flash + echo "<br />\n"; + ?> <b>Actions:</b><br /> <a href="<?php echo conf('web_path'); ; ?>/song.php?action=m3u&album=<?php echo $album->id; ; ?>"><?php echo _("Play Album"); ; ?></a><br /> <a href="<?php echo conf('web_path'); ; ?>/song.php?action=m3u&album_random=<?php echo $album->id; ; ?>"><?php echo _("Play Random from Album"); ; ?></a><br /> @@ -60,7 +73,6 @@ $user = new User($_SESSION['userdata']['username']); <?php if( batch_ok() ) { ?> <a href="<?php echo conf('web_path'); ; ?>/batch.php?action=alb&id=<?php echo $album->id; ; ?>"><?php echo _("Download"); ?></a><br /> <?php } ?> - </td> </tr> </table> diff --git a/templates/show_login_form.inc b/templates/show_login_form.inc index c7351854..09612512 100644 --- a/templates/show_login_form.inc +++ b/templates/show_login_form.inc @@ -69,14 +69,10 @@ if (preg_match($subject,$_SERVER['HTTP_HOST'])) { </form> <p align="center"> <a href="http://validator.w3.org/check/referer"> - <img style="padding:0;border:0;width:68px;height:19px" - src="http://www.w3.org/Icons/valid-xhtml10" - alt="Valid XHTML 1.0!" /> + <img style="padding:0;border:0;" src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" /> </a> <a href="http://jigsaw.w3.org/css-validator/check/referer"> - <img style="padding:0;border:0;width:68px;height:19px" - src="http://jigsaw.w3.org/css-validator/images/vcss" - alt="Valid CSS!" /> + <img style="padding:0;border:0;" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" /> </a> </p> <?php if ($show_copyright == 1) { ?> diff --git a/templates/show_object_rating.inc.php b/templates/show_object_rating.inc.php new file mode 100644 index 00000000..5b95868b --- /dev/null +++ b/templates/show_object_rating.inc.php @@ -0,0 +1,53 @@ +<?php +/* + + Copyright 2001 - 2006 Ampache.org + All Rights Reserved + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + + +if ($type != 'song') { + echo "<strong>" . _("Rating") . ":</strong>"; +} + +/* Create some variables we are going to need */ +$base_url = conf('web_path') . '/ratings.php?action=set_rating&mode=' . conf('flash') . '&rating_type=' . $rating->type . '&object_id=' . $rating->id . '&username=' . $GLOBALS['user']->username; +$score = '0'; + +/* count up to 6 */ +while ($score < 6) { + /* Handle the "Not rated" possibility */ + if ($score == '0' AND $score === $rating->rating) { + echo "<img src=\"" . conf('web_path') . "/images/ratings/x.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n"; + } + elseif ($score == '0') { + echo "<a href=\"" . $base_url . "&rating=$score\">\n"; + echo "\t<img src=\"" . conf('web_path') . "/images/ratings/x_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n"; + echo "</a>"; + } + elseif ($score === $rating->rating) { + echo "<img src=\"" . conf('web_path') . "/images/ratings/star.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n"; + } + else { + echo "<a href=\"" . $base_url . "&rating=$score\">\n\t<img src=\"" . conf('web_path') . "/images/ratings/star_off.gif\" border=\"0\" alt=\"" . get_rating_name($score) . "\">\n</a>\n"; + } + /* Next! */ + $score++; +} // end while + +?> diff --git a/templates/show_preference_box.inc.php b/templates/show_preference_box.inc.php new file mode 100644 index 00000000..3435f2ac --- /dev/null +++ b/templates/show_preference_box.inc.php @@ -0,0 +1,78 @@ +<?php +/* + + Copyright (c) 2001 - 2006 Ampache.org + All rights reserved + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ + +/*! + @header Show Preferences + @discussion shows a single preference box + +*/ + +/* I'm cheating a little here, check to see if we want to show the + * Apply to All button on this page + */ +if ($GLOBALS['user']->has_access(100) AND conf('use_auth')) { + $show_apply_to_all = true; +} + +?> + + +<table class="border" border="0" cellpadding="0" cellspacing="0" width="100%"> +<tr class="odd"> + <th colspan="3" class="header2" align="left"><?php echo $preferences['title']; ?></th> +</tr> +<tr class="table-header"> + <th><?php echo _("Preference"); ?></th> + <th><?php echo _("Value"); ?></th> + <?php if ($show_apply_to_all) { ?> + <th><?php echo _("Apply to All"); ?></th> + <?php } ?> +</tr> +<?php + foreach ($preferences['prefs'] as $pref) { +?> +<tr class="<?php echo flip_class(); ?>"> + <td><?php echo _($pref['description']); ?></td> + <td><table> + <tr> + <td><?php create_preference_input($pref['name'],$pref['value']); ?></td> + <?php if(preg_match('/Color/',$pref['description'])) { ?> + <td> + <table width="40" border="3" style="border-collapse: collapse;" bgcolor="<?php echo $pref['value'];?>"> + <tr style="height:20px;"> + <td></td> + </tr> + </table> + </td> + <?php } else { ?> + <td></td> + <?php } ?> + </tr> + </table> + </td> + + <?php if ($show_apply_to_all) { ?> + <td align="center"><input type="checkbox" name="check_<?php echo $pref['name']; ?>" value="1" /></td> + <?php } ?> +</tr> +<?php } ?> +</table> diff --git a/templates/show_preferences.inc b/templates/show_preferences.inc index 4b3944a2..d3277db2 100644 --- a/templates/show_preferences.inc +++ b/templates/show_preferences.inc @@ -35,65 +35,47 @@ if ($GLOBALS['user']->has_access(100) AND $user_id == '-1' AND conf('use_auth')) ?> -<div class="header1"> + +<table class="text-box"> +<tr><td> +<span class="header1"> <?php echo _("Editing"); ?> <?php echo $fullname; ?> <?php echo _("preferences"); ?> - <?php if ($user->has_access(100)) { ?> + <?php if ($GLOBALS['user']->has_access(100)) { ?> [<a href="<?php echo conf('web_path'); ?>/admin/preferences.php?action=fix_preferences&user_id=<?php echo $user_id; ?>"><?php echo _("Rebuild Preferences"); ?></a>] <?php } ?> -</div> +</span> + + <form method="post" name="preferences" action="<?php echo conf('web_path'); ?><?php echo $target; ?>" enctype="multipart/form-data"> -<table class="border" border="0" cellpadding="0" cellspacing="0"> -<tr class="table-header"> - <th><?php echo _("Preference"); ?></th> - <th><?php echo _("Value"); ?></th> - <?php if ($show_apply_to_all) { ?> - <th><?php echo _("Type"); ?></th> - <th><?php echo _("Apply to All"); ?></th> +<table cellspacing="10"> +<tr> + <td valign="top"><?php show_preference_box($preferences['theme']); ?></td> + <?php if (isset($preferences['system'])) { ?> + <td valign="top"><?php show_preference_box($preferences['system']); ?></td> + <?php } else { ?> + <td valign="top"> </td> <?php } ?> </tr> -<?php - foreach ($preferences as $pref) { - if ($pref->type == "system") { - $table_break = 1; - } - if ($pref->type == "user" AND $table_break == '1') { - $table_break = 0; - ?> - <tr class="table-header"> - <td colspan="4" style="background:<?php echo conf('bg_color1'); ?>;"> </td> - </tr> - <?php - } -?> -<tr class="<?php echo flip_class(); ?>"> - <td><?php echo _($pref->description); ?></td> - <td><table> - <tr> - <td><?php create_preference_input($pref->name,$pref->value); ?></td> - <?php if(preg_match('/Color/',$pref->description)) { ?> - <td><table width="40" border="3" style="border-collapse: collapse;" bgcolor="<?php echo $pref->value;?>"><tr style="height:20px;"><td></td></tr></table></td> - <?php } else { ?> - <td></td> - <?php } ?> - </tr> - </table> - </td> - - <?php if ($show_apply_to_all) { ?> - <td><?php echo $pref->type; ?></td> - <td align="center"><input type="checkbox" name="check_<?php echo $pref->name; ?>" value="1" /></td> - <?php } ?> +<tr> + <td valign="top"><?php show_preference_box($preferences['streaming']); ?></td> + <td> </td> </tr> -<?php } ?> -<tr class="<?php echo flip_class(); ?>"> - <td colspan="4"> - <input class="button" type="submit" value="<?php echo _("Update Preferences"); ?>" /> - <input type="hidden" name="action" value="update_preferences" /> - <input type="hidden" name="user_id" value="<?php echo $user_id; ?>" /> - - <input class="button" type="submit" name="action" value="<?php echo _("Cancel"); ?>" /> - </td> +<tr> + <td valign="top"><?php show_preference_box($preferences['interface']); ?></td> + <td> </td> </tr> +<tr> + <td valign="top"><?php show_preference_box($preferences['options']); ?></td> + <td> </td> +</tr> +</table> + + <input class="button" type="submit" value="<?php echo _("Update Preferences"); ?>" /> + <input type="hidden" name="action" value="update_preferences" /> + <input type="hidden" name="user_id" value="<?php echo $user_id; ?>" /> + + <input class="button" type="submit" name="action" value="<?php echo _("Cancel"); ?>" /> + + </form> +</td></tr> </table> -</form> -<br /><br /> diff --git a/templates/show_songs.inc b/templates/show_songs.inc index 2f006009..5dd22f10 100644 --- a/templates/show_songs.inc +++ b/templates/show_songs.inc @@ -22,6 +22,10 @@ $web_path = conf('web_path'); show_clear(); + +// Need to set the username for the song ratings. +$username=$GLOBALS['user']->username; + ?> <form name="songs" method="post" enctype="multipart/form-data" action="#"> <table border="0"> @@ -40,6 +44,9 @@ show_clear(); <th><?php echo _("Genre"); ?></th> <th><?php echo _("Flag"); ?></th> <th><?php echo _("Action"); ?></th> + <?php if (conf('ratings') || conf('ratings')=="false") { ?> + <th><?php echo _("Rating"); ?></th> + <? } ?> </tr> <?php /* FIXME: don't even get me started with how many things are wrong with this code */ @@ -57,7 +64,8 @@ show_clear(); // Still needed crap $totalsize += $song->size; $totaltime += $song->time; - if ($song->status == "disabled") { $text_class = "class=\"disabled\""; } + if ($song->status == "disabled") { $text_class = "class=\"disabled\""; } + include("get_song_ratings.inc"); ?> <tr class="<?php echo flip_class(); ?>"> <td align="center"> @@ -119,6 +127,11 @@ show_clear(); | <a href="<?php echo $web_path; ?>/play/index.php?song=<?php echo $song->id; ?>&uid=<?php echo $user->username . "&sid=" . session_id(); ?>&fn=<?php echo rawurlencode($song->f_artist_full . " - " . $song->title . "." . $song->type); ?>"><?php echo _("Direct Link"); ?></a> <?php } ?> </td> + <?php if(conf('ratings')) { ?> + <td> + <?php show_rating($song->id,'song'); ?> + </td> + <? } ?> </tr> <?php }// foreach loop diff --git a/templates/style.inc b/templates/style.inc index 44fe274b..cf8cdec1 100644 --- a/templates/style.inc +++ b/templates/style.inc @@ -280,12 +280,14 @@ */ #maincontrainer { - margin: 0px; + margin:0px; } #topbar { + margin-left: 5px; + margin-top: 5px; height: 80px; - background-color: #888888; + background-color: <?php echo conf('bg_color1'); ?>; } #topbarright { @@ -299,7 +301,7 @@ { clear: both; height: 100%; - margin-left: 0px; + margin-left: 5px; margin-top:0px; float: left; width: 170px; @@ -326,15 +328,15 @@ { display: block; padding: 5px 10px; - color: #000; - background-color: #666; + color: <?php echo conf('font_color1'); ?>; + background-color: <?php echo conf('row_color2'); ?>; text-decoration: none; } #sidebar a:hover { - color: #000; - background-color: #ccc; + color: <?php echo conf('font_color1'); ?>; + background-color: <?php echo conf('row_color3'); ?>; text-decoration: none; } @@ -345,8 +347,8 @@ display: block; padding: 5px 5px 5px 30px; width: 125px; - color: #000; - background-color: #ccc; + color: <?php echo conf('font_color1'); ?>; + background-color: <?php echo conf('row_color1'); ?>; text-decoration: none; } @@ -358,16 +360,16 @@ .subnavbutton { - background-color: #ddd; + background-color: <?php echo conf('row_color1'); ?>; text-align:center; text-decoration: none; - color: #000; + color: <?php echo conf('font_color2'); ?>; } #sidebar ul ul a:hover { - color: #000; - background-color: #ddd; + color: <?php echo conf('font_color2'); ?>; + background-color: <?php echo conf('row_color3'); ?>; text-decoration: none; } #content |