1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 10:19:25 +02:00

#136 done. External links improved. Ability to edit artist/album directly from their page.

This commit is contained in:
SUTJael 2014-03-24 20:58:38 +01:00
parent 01691feded
commit 1ef3cdf388
16 changed files with 122 additions and 80 deletions

View file

@ -212,7 +212,6 @@ switch ($_REQUEST['action']) {
case 'show':
default:
$album = new Album($_REQUEST['album']);
$album->allow_group_disks = true;
$album->format();
if (!count($album->album_suite)) {

View file

@ -440,17 +440,15 @@ class Album extends database_object
$this->f_link_src = $web_path . '/albums.php?action=show&album=' . scrub_out($this->id);
$this->f_name_link = "<a href=\"" . $this->f_link_src . "\" title=\"" . scrub_out($this->full_name) . "\">" . scrub_out($this->f_name);
// Looking to combine disks
// Looking if we need to combine or display disks
if ($this->disk && (!$this->allow_group_disks || ($this->allow_group_disks && !AmpConfig::get('album_group')))) {
$this->f_name_link .= " <span class=\"discnb\">[" . T_('Disk') . " " . $this->disk . "]</span>";
} elseif ($this->disk && $this->allow_group_disks && AmpConfig::get('album_group') && count($this->album_suite) > 1) {
$this->f_name_link .= " <span class=\"discnb\">[#" . count($this->album_suite) . "]</span>";
}
$this->f_name_link .="</a>";
$this->f_link = $this->f_name_link;
$this->f_title = $this->full_name; // FIXME: Legacy?
$this->f_title = $this->full_name;
if ($this->artist_count == '1') {
$artist = trim(trim($this->artist_prefix) . ' ' . trim($this->artist_name));
$this->f_artist_name = $artist;

View file

@ -148,7 +148,7 @@ class Artist extends database_object
* gets the album ids that this artist is a part
* of
*/
public function get_albums($catalog = null)
public function get_albums($catalog = null, $ignoreAlbumGroups = false)
{
$catalog_where = "";
$catalog_join = "LEFT JOIN `catalog` ON `catalog`.`id` = `song`.`catalog`";
@ -173,7 +173,11 @@ class Artist extends database_object
$sql_sort = '`album`.`name` DESC';
}
$sql_group = "COALESCE(`album`.`mbid`, `album`.`id`)";
$sql_group_type = '`album`.`id`';
if (!$ignoreAlbumGroups && AmpConfig::get('album_group')) {
$sql_group_type = '`album`.`mbid`';
}
$sql_group = "COALESCE($sql_group_type, `album`.`id`)";
$sql = "SELECT `album`.`id` FROM album LEFT JOIN `song` ON `song`.`album`=`album`.`id` $catalog_join " .
"WHERE `song`.`artist`='$this->id' $catalog_where GROUP BY $sql_group ORDER BY $sql_sort";
@ -477,7 +481,7 @@ class Artist extends database_object
Tag::update_tag_list($tags_comma, 'artist', $current_id);
if ($override_childs) {
$albums = $this->get_albums();
$albums = $this->get_albums(null, true);
foreach ($albums as $album_id) {
$album = new Album($album_id);
$album->update_tags($tags_comma, $override_childs);

View file

@ -175,20 +175,25 @@ function showEditDialog(edit_type, edit_id, edit_form_id, edit_title, refresh_ro
type : 'POST',
data : $(parent.editFormId).serializeArray(),
success : function(resp){
var new_id = $.trim(resp.lastChild.textContent);
$("#editdialog").dialog("close");
// resp should contain the new identifier, otherwise we take the same as the edited item
if (new_id == '') {
new_id = parent.editId;
}
if (parent.refreshAction != '') {
var new_id = $.trim(resp.lastChild.textContent);
var url = jsAjaxServer + '/refresh_updated.server.php?action=' + parent.refreshAction + '&id=' + new_id;
// Reload only table
$('#' + parent.refreshRowPrefix + parent.editId).load(url, function() {
// Update the current row identifier with new id
$('#' + parent.refreshRowPrefix + parent.editId).attr("id", parent.refreshRowPrefix + new_id);
});
// resp should contain the new identifier, otherwise we take the same as the edited item
if (new_id == '') {
new_id = parent.editId;
}
var url = jsAjaxServer + '/refresh_updated.server.php?action=' + parent.refreshAction + '&id=' + new_id;
// Reload only table
$('#' + parent.refreshRowPrefix + parent.editId).load(url, function() {
// Update the current row identifier with new id
$('#' + parent.refreshRowPrefix + parent.editId).attr("id", parent.refreshRowPrefix + new_id);
});
} else {
location.reload(true);
}
},
error : function(resp){
$("#editdialog").dialog("close");

View file

@ -79,10 +79,14 @@ switch ($_REQUEST['action']) {
foreach ($sres as $id) {
$album = new Album($id);
$album->format();
$a_title = $album->f_title;
if ($album->disk) {
$a_title .= " [" . T_('Disk') . " " . $album->disk . "]";
}
$results[] = array(
'type' => T_('Albums'),
'link' => $album->f_link_src,
'label' => $album->f_title,
'label' => $a_title,
'value' => $album->f_title,
'rels' => $album->f_artist,
);

View file

@ -72,23 +72,23 @@ if (AmpConfig::get('show_played_times')) {
<ul>
<?php if (AmpConfig::get('directplay')) { ?>
<li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&album_id=' . $album->id,'play', T_('Play'),'directplay_full_' . $album->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&album_id=' . $album->id, T_('Play'),'directplay_full_text_' . $album->id); ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'),'play', T_('Play'),'directplay_full_' . $album->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'), T_('Play'),'directplay_full_text_' . $album->id); ?>
</li>
<?php } ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
<li>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&album_id=' . $album->id . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&album_id=' . $album->id . '&append=true', T_('Play last'),'addplay_album_text_' . $album->id); ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
<?php echo Ajax::text('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true', T_('Play last'),'addplay_album_text_' . $album->id); ?>
</li>
<?php } ?>
<li>
<?php echo Ajax::button('?action=basket&type=album&id=' . $album->id,'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?>
<?php echo Ajax::text('?action=basket&type=album&id=' . $album->id, T_('Add to temporary playlist'), 'play_full_text_' . $album->id); ?>
<?php echo Ajax::button('?action=basket&type=album&' . $album->get_http_album_query_ids('id'),'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?>
<?php echo Ajax::text('?action=basket&type=album&' . $album->get_http_album_query_ids('id'), T_('Add to temporary playlist'), 'play_full_text_' . $album->id); ?>
</li>
<li>
<?php echo Ajax::button('?action=basket&type=album_random&id=' . $album->id,'random', T_('Random to temporary playlist'),'play_random_' . $album->id); ?>
<?php echo Ajax::text('?action=basket&type=album_random&id=' . $album->id, T_('Random to temporary playlist'), 'play_random_text_' . $album->id); ?>
<?php echo Ajax::button('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'),'random', T_('Random to temporary playlist'),'play_random_' . $album->id); ?>
<?php echo Ajax::text('?action=basket&type=album_random&' . $album->get_http_album_query_ids('id'), T_('Random to temporary playlist'), 'play_random_text_' . $album->id); ?>
</li>
<li>
<a onclick="submitNewItemsOrder('<?php echo $album->id; ?>', 'reorder_songs_table_<?php echo $album->id; ?>', 'song_',
@ -123,6 +123,16 @@ if (AmpConfig::get('show_played_times')) {
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=album&id=<?php echo $album->id; ?>"><?php echo T_('Share'); ?></a>
</li>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<li>
<a id="<?php echo 'edit_album_'.$c_album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>
<a id="<?php echo 'edit_album_'.$c_album->id ?>" onclick="showEditDialog('album_row', '<?php echo $album->id ?>', '<?php echo 'edit_album_'.$album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
<?php echo T_('Edit Album'); ?>
</a>
</li>
<?php } ?>
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo $web_path; ?>/batch.php?action=album&amp;id=<?php echo $album->id; ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>

View file

@ -70,13 +70,13 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
</li>
<?php if (Access::check('interface','75')) { ?>
<li>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&<?php echo $album->get_http_album_query_ids('album_id'); ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo UI::get_icon('delete', T_('Reset Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&<?php echo $album->get_http_album_query_ids('album_id'); ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo T_('Reset Album Art'); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo UI::get_icon('delete', T_('Reset Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=clear_art&album_id=<?php echo $album->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to reset album art?'); ?>');"><?php echo T_('Reset Album Art'); ?></a>
</li>
<?php } ?>
<li>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&<?php echo $album->get_http_album_query_ids('album_id'); ?>"><?php echo UI::get_icon('view', T_('Find Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&<?php echo $album->get_http_album_query_ids('album_id'); ?>"><?php echo T_('Find Album Art'); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo UI::get_icon('view', T_('Find Album Art')); ?></a>
<a href="<?php echo $web_path; ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>"><?php echo T_('Find Album Art'); ?></a>
</li>
<?php if (Access::check_function('batch_download')) { ?>
<li>
@ -114,14 +114,19 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
<?php echo UI::get_icon('save', T_('Save Tracks Order')); ?>
</a>
<?php if (AmpConfig::get('sociable')) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=show_add_shout&type=album&<?php echo $c_album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('comment', T_('Post Shout')); ?></a>
<a href="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=show_add_shout&type=album&id=<?php echo $c_album->id; ?>"><?php echo UI::get_icon('comment', T_('Post Shout')); ?></a>
<?php } ?>
<?php if (AmpConfig::get('share')) { ?>
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=album&<?php echo $c_album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=album&id=<?php echo $c_album->id; ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo $web_path; ?>/batch.php?action=album&<?php echo $c_album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<a id="<?php echo 'edit_album_'.$c_album->id ?>" onclick="showEditDialog('album_row', '<?php echo $c_album->id ?>', '<?php echo 'edit_album_'.$c_album->id ?>', '<?php echo T_('Album edit') ?>', '', '')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>
<?php } ?>
</div>
<div id='reordered_list_<?php echo $album_id; ?>'>
<?php
@ -135,5 +140,5 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')&nbsp;-&nbsp;' .
$browse->show_objects(null, true); // true argument is set to show the reorder column
$browse->store();
?>
</div>
</div><br />
<?php } ?>

View file

@ -62,12 +62,12 @@ if (Art::is_enabled()) {
<td class="cel_userflag" id="userflag_<?php echo $album->id; ?>_album"><?php Userflag::show($album->id, 'album'); ?></td>
<?php } ?>
<td class="cel_action">
<?php if (AmpConfig::get('sociable')) { ?>
<?php if (AmpConfig::get('sociable') && (!$album->allow_group_disks || ($album->allow_group_disks && !count($album->album_suite)))) { ?>
<a href="<?php echo AmpConfig::get('web_path'); ?>/shout.php?action=show_add_shout&type=album&amp;id=<?php echo $album->id; ?>">
<?php echo UI::get_icon('comment', T_('Post Shout')); ?>
</a>
<?php } ?>
<?php if (AmpConfig::get('share')) { ?>
<?php if (AmpConfig::get('share') && (!$album->allow_group_disks || ($album->allow_group_disks && !count($album->album_suite)))) { ?>
<a href="<?php echo $web_path; ?>/share.php?action=show_create&type=album&<?php echo $album->get_http_album_query_ids('id'); ?>"><?php echo UI::get_icon('share', T_('Share')); ?></a>
<?php } ?>
<?php if (Access::check_function('batch_download')) { ?>

View file

@ -103,18 +103,26 @@ if (AmpConfig::get('show_played_times')) {
<?php echo Ajax::button('?action=basket&type=artist_random&id=' . $artist->id,'random', T_('Random all to temporary playlist'),'random_' . $artist->id); ?>
<?php echo Ajax::text('?action=basket&type=artist_random&id=' . $artist->id, T_('Random all to temporary playlist'),'random_text_' . $artist->id); ?>
</li>
<?php if (Access::check('interface','50')) { ?>
<!--<?php if (Access::check('interface','50')) { ?>
<li>
<a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&amp;artist=<?php echo $artist->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo UI::get_icon('cog', T_('Update from tags')); ?></a>
<a href="<?php echo $web_path; ?>/artists.php?action=update_from_tags&amp;artist=<?php echo $artist->id; ?>" onclick="return confirm('<?php echo T_('Do you really want to update from tags?'); ?>');"><?php echo T_('Update from tags'); ?></a>
</li>
<?php } ?>
<?php } ?>-->
<?php if (Access::check_function('batch_download')) { ?>
<li>
<a href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo UI::get_icon('batch_download', T_('Download')); ?></a>
<a href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo T_('Download'); ?></a>
</li>
<?php } ?>
<?php if (Access::check('interface','50')) { ?>
<a id="<?php echo 'edit_artist_'.$artist->id ?>" onclick="showEditDialog('artist_row', '<?php echo $artist->id ?>', '<?php echo 'edit_artist_'.$artist->id ?>', '<?php echo T_('Artist edit') ?>', '', '')">
<?php echo UI::get_icon('edit', T_('Edit')); ?>
</a>
<a id="<?php echo 'edit_artist_'.$artist->id ?>" onclick="showEditDialog('artist_row', '<?php echo $artist->id ?>', '<?php echo 'edit_artist_'.$artist->id ?>', '<?php echo T_('Artist edit') ?>', '', '')">
<?php echo T_('Edit Artist'); ?>
</a>
<?php } ?>
<li>
<input type="checkbox" id="show_artist_artCB" <?php echo $string = Art::is_enabled() ? 'checked="checked"' : ''; ?>/> <?php echo T_('Show Art'); ?>
<?php echo Ajax::observe('show_artist_artCB', 'click', Ajax::action('?page=browse&action=show_art&browse_id=' . $browse->id,'')); ?>

View file

@ -43,12 +43,12 @@ if ($albums) {
</div>
<div class="play_album">
<?php if (AmpConfig::get('directplay')) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&album_id[]=' . $album->id,'play', T_('Play'),'play_album_' . $album->id); ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id'),'play', T_('Play'),'play_album_' . $album->id); ?>
<?php if (Stream_Playlist::check_autoplay_append()) { ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&album_id[]=' . $album->id . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
<?php echo Ajax::button('?page=stream&action=directplay&playtype=album&' . $album->get_http_album_query_ids('album_id') . '&append=true','play_add', T_('Play last'),'addplay_album_' . $album->id); ?>
<?php } ?>
<?php } ?>
<?php echo Ajax::button('?action=basket&type=album&id=' . $album->id,'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?>
<?php echo Ajax::button('?action=basket&type=album&' . $album->get_http_album_query_ids('id'),'add', T_('Add to temporary playlist'),'play_full_' . $album->id); ?>
</div>
<?php
if (AmpConfig::get('ratings')) {

View file

@ -21,20 +21,20 @@
*/
?>
<div id="sb_Subsearch">
<form name="search" method="post" action="<?php echo $web_path; ?>/search.php?type=song" enctype="multipart/form-data" style="Display:inline">
<form name="search" method="post" action="<?php echo $web_path; ?>/search.php?type=song" enctype="multipart/form-data" style="Display:inline">
<input type="text" name="rule_1_input" id="searchString"/>
<input type="hidden" name="action" value="search" />
<input type="hidden" name="rule_1_operator" value="0" />
<input type="hidden" name="rule_1_operator" value="0" />
<input type="hidden" name="object_type" value="song" />
<select name="rule_1" id="searchStringRule">
<option value="anywhere"><?php echo T_('Anywhere')?></option>
<option value="title"><?php echo T_('Title')?></option>
<option value="album"><?php echo T_('Album')?></option>
<option value="artist"><?php echo T_('Artist')?></option>
<option value="playlist_name"><?php echo T_('Playlist')?></option>
<option value="tag"><?php echo T_('Tag')?></option>
</select>
<select name="rule_1" id="searchStringRule">
<option value="anywhere"><?php echo T_('Anywhere')?></option>
<option value="title"><?php echo T_('Title')?></option>
<option value="album"><?php echo T_('Album')?></option>
<option value="artist"><?php echo T_('Artist')?></option>
<option value="playlist_name"><?php echo T_('Playlist')?></option>
<option value="tag"><?php echo T_('Tag')?></option>
</select>
<input class="button" type="submit" value="<?php echo T_('Search'); ?>" id="searchBtn" />
<a href="<?php echo $web_path; ?>/search.php?type=song" class="button" id="advSearchBtn"><?php echo T_('Advanced Search'); ?></a>
</form>
<a href="<?php echo $web_path; ?>/search.php?type=song" class="button" id="advSearchBtn"><?php echo T_('Advanced Search'); ?></a>
</form>
</div>

View file

@ -552,15 +552,15 @@ a.button{padding:1px 3px;}
.external_links {
text-align: right;
opacity: 0.3;
}
.external_links:hover {
opacity: 1;
}
.external_links a {
margin: 0px 5px 0px 0px;
opacity: 0.3;
}
.external_links a:hover {
opacity: 1;
}
#artist_summary {

View file

@ -854,15 +854,15 @@ span.nodata {
.external_links {
text-align: right;
opacity: 0.3;
}
.external_links:hover {
opacity: 1;
}
.external_links a {
margin: 0px 5px 0px 0px;
opacity: 0.3;
}
.external_links a:hover {
opacity: 1;
}
#artist_summary {

View file

@ -565,15 +565,15 @@ input[type=checkbox] { border:0;background:none; }
.external_links {
text-align: right;
opacity: 0.3;
}
.external_links:hover {
opacity: 1;
}
.external_links a {
margin: 0px 5px 0px 0px;
opacity: 0.3;
}
.external_links a:hover {
opacity: 1;
}
#artist_summary {

View file

@ -719,15 +719,15 @@ right: expression(-this.parentNode.offsetWidth%2+"px");
.external_links {
text-align: right;
opacity: 0.3;
}
.external_links:hover {
opacity: 1;
}
.external_links a {
margin: 0px 5px 0px 0px;
opacity: 0.3;
}
.external_links a:hover {
opacity: 1;
}
#artist_summary {

View file

@ -1144,6 +1144,15 @@ div.box.box_rules {
width: 100%;
}
.album_group_disks_title {
float: left;
margin-right: 30px;
}
.album_group_disks_actions {
}
/***********************************************
Content (Tag cloud)
***********************************************/
@ -1312,15 +1321,15 @@ span.fatalerror {
.external_links {
text-align: right;
opacity: 0.3;
}
.external_links:hover {
opacity: 1;
}
.external_links a {
margin: 0px 5px 0px 0px
margin: 0px 5px 0px 0px;
opacity: 0.3;
}
.external_links a:hover {
opacity: 1;
}
#artist_summary {