1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

Image art on artists edition and index display preferences

This commit is contained in:
Afterster 2014-09-15 07:37:17 +02:00
parent 2234c3a7b9
commit 66dd1ff782
13 changed files with 115 additions and 19 deletions

View file

@ -28,7 +28,7 @@ $object_type = $_GET['object_type'];
$object_id = $_GET['object_id']; $object_id = $_GET['object_id'];
$burl = ''; $burl = '';
if (isset($_GET['burl'])) { if (isset($_GET['burl'])) {
$burl = rawurldecode($_GET['burl']); $burl = base64_decode($_GET['burl']);
} }
/* Switch on Action */ /* Switch on Action */

View file

@ -1482,15 +1482,13 @@ class Art extends database_object
echo "</div>"; echo "</div>";
} }
echo "<div class=\"item_art_actions\">"; echo "<div class=\"item_art_actions\">";
$burl = substr($_SERVER['REQUEST_URI'], strlen(AmpConfig::get('raw_web_path')));
$burl = rawurlencode(ltrim($burl, '/'));
if ($GLOBALS['user']->has_access('25')) { if ($GLOBALS['user']->has_access('25')) {
echo "<a href=\"" . AmpConfig::get('web_path') . "/arts.php?action=find_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=" . $burl . "\">"; echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=find_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=' + getCurrentPage());\">";
echo UI::get_icon('edit', T_('Edit/Find Art')); echo UI::get_icon('edit', T_('Edit/Find Art'));
echo "</a>"; echo "</a>";
} }
if ($GLOBALS['user']->has_access('75')) { if ($GLOBALS['user']->has_access('75')) {
echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=clear_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=" . $burl . "');\" onclick=\"return confirm('" . T_('Do you really want to reset art?') . "');\">"; echo "<a href=\"javascript:NavigateTo('" . AmpConfig::get('web_path') . "/arts.php?action=clear_art&object_type=" . $object_type . "&object_id=" . $object_id . "&burl=' + getCurrentPage());\" onclick=\"return confirm('" . T_('Do you really want to reset art?') . "');\">";
echo UI::get_icon('delete', T_('Reset Art')); echo UI::get_icon('delete', T_('Reset Art'));
echo "</a>"; echo "</a>";
} }

View file

@ -325,6 +325,7 @@ class Recommendation
// Data newer than 6 months, use it // Data newer than 6 months, use it
if (($artist->last_update + 15768000) > time()) { if (($artist->last_update + 15768000) > time()) {
$results = array(); $results = array();
$results['id'] = $artist_id;
$results['summary'] = $artist->summary; $results['summary'] = $artist->summary;
$results['placeformed'] = $artist->placeformed; $results['placeformed'] = $artist->placeformed;
$results['yearformed'] = $artist->yearformed; $results['yearformed'] = $artist->yearformed;
@ -346,6 +347,7 @@ class Recommendation
$results['megaphoto'] = $xml->artist->image[4]; $results['megaphoto'] = $xml->artist->image[4];
if ($artist) { if ($artist) {
$results['id'] = $artist->id;
if (!empty($results['summary']) || !empty($results['megaphoto'])) { if (!empty($results['summary']) || !empty($results['megaphoto'])) {
$artist->update_artist_info($results['summary'], $results['placeformed'], $results['yearformed']); $artist->update_artist_info($results['summary'], $results['placeformed'], $results['yearformed']);

View file

@ -329,4 +329,13 @@ END;
ob_flush(); ob_flush();
flush(); flush();
} }
public static function get_logo_url()
{
if (AmpConfig::get('custom_logo')) {
return AmpConfig::get('custom_logo');
} else {
return AmpConfig::get('web_path') . AmpConfig::get('theme_path') . '/images/ampache.png';
}
}
} }

View file

@ -449,6 +449,9 @@ class Update
$update_string = '- Add limit of media count for direct play preference.<br />'; $update_string = '- Add limit of media count for direct play preference.<br />';
$version[] = array('version' => '370016','description' => $update_string); $version[] = array('version' => '370016','description' => $update_string);
$update_string = '- Add home display settings.<br />';
$version[] = array('version' => '370017','description' => $update_string);
return $version; return $version;
} }
@ -2965,7 +2968,7 @@ class Update
{ {
$retval = true; $retval = true;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " . $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('direct_play_limit','0','Limit direct play to maximum media count',25,'integer','interface')"; "VALUES ('direct_play_limit','0','Limit direct play to maximum media count',25,'integer','interface')";
$retval = Dba::write($sql) ? $retval : false; $retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id(); $id = Dba::insert_id();
@ -2974,4 +2977,51 @@ class Update
return $retval; return $retval;
} }
/**
* update 370017
*
* Add home display settings
*/
public static function update_370017()
{
$retval = true;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('home_moment_albums','1','Show Albums of the moment at home page',25,'integer','interface')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval = Dba::write($sql, array($id)) ? $retval : false;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('home_moment_videos','1','Show Videos of the moment at home page',25,'integer','interface')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval = Dba::write($sql, array($id)) ? $retval : false;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('home_recently_played','1','Show Recently Played at home page',25,'integer','interface')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval = Dba::write($sql, array($id)) ? $retval : false;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('home_now_playing','1','Show Now Playing at home page',25,'integer','interface')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'1')";
$retval = Dba::write($sql, array($id)) ? $retval : false;
$sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('custom_logo','','Custom logo url',25,'string','interface')";
$retval = Dba::write($sql) ? $retval : false;
$id = Dba::insert_id();
$sql = "INSERT INTO `user_preference` VALUES (-1,?,'')";
$retval = Dba::write($sql, array($id)) ? $retval : false;
return $retval;
}
} }

View file

@ -185,6 +185,10 @@ function create_preference_input($name,$value)
case 'daap_backend': case 'daap_backend':
case 'upnp_backend': case 'upnp_backend':
case 'album_release_type': case 'album_release_type':
case 'home_moment_albums':
case 'home_moment_videos':
case 'home_recently_played':
case 'home_now_playing':
$is_true = ''; $is_true = '';
$is_false = ''; $is_false = '';
if ($value == '1') { if ($value == '1') {

View file

@ -264,7 +264,7 @@ $_SESSION['login'] = false;
<div id="header" class="header-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?>"><!-- This is the header --> <div id="header" class="header-<?php echo AmpConfig::get('ui_fixed') ? 'fixed' : 'float'; ?>"><!-- This is the header -->
<h1 id="headerlogo"> <h1 id="headerlogo">
<a href="<?php echo $web_path; ?>/index.php"> <a href="<?php echo $web_path; ?>/index.php">
<img src="<?php echo $web_path; ?><?php echo AmpConfig::get('theme_path'); ?>/images/ampache.png" title="<?php echo AmpConfig::get('site_title'); ?>" alt="<?php echo AmpConfig::get('site_title'); ?>" /> <img src="<?php echo UI::get_logo_url(); ?>" title="<?php echo AmpConfig::get('site_title'); ?>" alt="<?php echo AmpConfig::get('site_title'); ?>" />
</a> </a>
</h1> </h1>
<div id="headerbox"> <div id="headerbox">

View file

@ -22,11 +22,15 @@
?> ?>
<div class="item_info"> <div class="item_info">
<div class="item_art"> <?php if ($biography['id']) {
<?php if ($biography && is_array($biography)) { ?> Art::display('artist', $biography['id'], $artist->f_name, 2);
<a href="<?php echo $biography['megaphoto']; ?>" rel="prettyPhoto"><img src="<?php echo $biography['largephoto']; ?>" alt="<?php echo $artist->f_name; ?>" width="128"></a> } else { ?>
<?php } ?> <div class="item_art">
</div> <?php if ($biography && is_array($biography)) { ?>
<a href="<?php echo $biography['megaphoto']; ?>" rel="prettyPhoto"><img src="<?php echo $biography['largephoto']; ?>" alt="<?php echo $artist->f_name; ?>" width="128"></a>
<?php } ?>
</div>
<?php } ?>
<div class="item_properties"> <div class="item_properties">
<?php <?php
if ($biography && is_array($biography)) { if ($biography && is_array($biography)) {

View file

@ -31,6 +31,16 @@
<?php } ?> <?php } ?>
</div> </div>
</td> </td>
<?php
if (Art::is_enabled()) {
$name = scrub_out($libitem->full_name);
?>
<td class="cel_cover">
<?php
Art::display('artist', $libitem->id, $name, 1, AmpConfig::get('web_path') . '/artists.php?action=show&artist=' . $libitem->id);
?>
</td>
<?php } ?>
<td class="cel_artist"><?php echo $libitem->f_name_link; ?></td> <td class="cel_artist"><?php echo $libitem->f_name_link; ?></td>
<td class="cel_add"> <td class="cel_add">
<span class="cel_item_add"> <span class="cel_item_add">

View file

@ -30,6 +30,9 @@ $thcount = 8;
<thead> <thead>
<tr class="th-top"> <tr class="th-top">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>
<?php if (Art::is_enabled()) { ++$thcount; ?>
<th class="cel_cover optional"><?php echo T_('Art'); ?></th>
<?php } ?>
<th class="cel_artist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=artist&sort=name', T_('Artist'),'artist_sort_name'); ?></th> <th class="cel_artist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=artist&sort=name', T_('Artist'),'artist_sort_name'); ?></th>
<th class="cel_add essential"></th> <th class="cel_add essential"></th>
<th class="cel_songs optional"><?php echo T_('Songs'); ?></th> <th class="cel_songs optional"><?php echo T_('Songs'); ?></th>
@ -80,6 +83,9 @@ $thcount = 8;
<tfoot> <tfoot>
<tr class="th-bottom"> <tr class="th-bottom">
<th class="cel_play essential"></th> <th class="cel_play essential"></th>
<?php if (Art::is_enabled()) { ?>
<th class="cel_cover"><?php echo T_('Art'); ?></th>
<?php } ?>
<th class="cel_artist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=artist&sort=name', T_('Artist'),'artist_sort_name'); ?></th> <th class="cel_artist essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&type=artist&sort=name', T_('Artist'),'artist_sort_name'); ?></th>
<th class="cel_add essential"></th> <th class="cel_add essential"></th>
<th class="cel_songs optional"><?php echo T_('Songs'); ?></th> <th class="cel_songs optional"><?php echo T_('Songs'); ?></th>

View file

@ -76,6 +76,15 @@ function NavigateTo(url)
window.location.hash = url.substring(jsWebPath.length + 1); window.location.hash = url.substring(jsWebPath.length + 1);
} }
function getCurrentPage()
{
if (window.location.hash.length > 0) {
return btoa(window.location.hash.substring(1));
}
return btoa(window.location.href.substring(jsWebPath.length + 1));
}
function NotifyOfNewSong() function NotifyOfNewSong()
{ {
refresh_slideshow(); refresh_slideshow();

View file

@ -26,20 +26,23 @@
<!-- Randomly selected albums of the moment --> <!-- Randomly selected albums of the moment -->
<?php <?php
if (Art::is_enabled()) { if (Art::is_enabled()) {
echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_albums', 'random_albums')); if (AmpConfig::get('home_moment_albums')) {
echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_albums', 'random_albums'));
?> ?>
<div id="random_selection" class="random_selection"> <div id="random_selection" class="random_selection">
<?php UI::show_box_top(T_('Albums of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?> <?php UI::show_box_top(T_('Albums of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?>
</div> </div>
<?php <?php
if (AmpConfig::get('allow_video')) { }
echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_videos', 'random_videos')); if (AmpConfig::get('home_moment_videos') && AmpConfig::get('allow_video')) {
echo Ajax::observe('window', 'load', Ajax::action('?page=index&action=random_videos', 'random_videos'));
?> ?>
<div id="random_video_selection" class="random_selection"> <div id="random_video_selection" class="random_selection">
<?php UI::show_box_top(T_('Videos of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?> <?php UI::show_box_top(T_('Videos of the Moment')); echo T_('Loading...'); UI::show_box_bottom(); ?>
</div> </div>
<?php } ?>
<?php } ?> <?php } ?>
<?php } ?> <?php if (AmpConfig::get('home_recently_played')) { ?>
<!-- Recently Played --> <!-- Recently Played -->
<div id="recently_played"> <div id="recently_played">
<?php <?php
@ -48,6 +51,7 @@ if (AmpConfig::get('allow_video')) {
require_once AmpConfig::get('prefix') . '/templates/show_recently_played.inc.php'; require_once AmpConfig::get('prefix') . '/templates/show_recently_played.inc.php';
?> ?>
</div> </div>
<?php } ?>
<!-- Shoutbox Objects, if shoutbox is enabled --> <!-- Shoutbox Objects, if shoutbox is enabled -->
<?php if (AmpConfig::get('sociable')) { ?> <?php if (AmpConfig::get('sociable')) { ?>
<div id="shout_objects"> <div id="shout_objects">