| 1 |
<%perl> |
|---|
| 2 |
# ----------------------------------------------------------------------------- |
|---|
| 3 |
# Musicbrainz.org |
|---|
| 4 |
# Copyright (c) 2001 Robert Kaye |
|---|
| 5 |
# ----------------------------------------------------------------------------- |
|---|
| 6 |
# This software is provided "as is", without warranty of any kind, express or |
|---|
| 7 |
# implied, including but not limited to the warranties of merchantability, |
|---|
| 8 |
# fitness for a particular purpose and noninfringement. In no event shall the |
|---|
| 9 |
# authors or copyright holders be liable for any claim, damages or other |
|---|
| 10 |
# liability, whether in an action of contract, tort or otherwise, arising |
|---|
| 11 |
# from, out of or in connection with the software or the use or other |
|---|
| 12 |
# dealings in the software. |
|---|
| 13 |
# |
|---|
| 14 |
# GPL - The GNU General Public License http://www.gnu.org/licenses/gpl.txt |
|---|
| 15 |
# Permits anyone the right to use and modify the software without limitations |
|---|
| 16 |
# as long as proper credits are given and the original and modified source |
|---|
| 17 |
# code are included. Requires that the final product, software derivate from |
|---|
| 18 |
# the original source or any software utilizing a GPL component, such as |
|---|
| 19 |
# this, is also licensed under the GPL license. |
|---|
| 20 |
# ----------------------------------------------------------------------------- |
|---|
| 21 |
# |
|---|
| 22 |
# Summary: |
|---|
| 23 |
# ----------------------------------------------------------------------------- |
|---|
| 24 |
# Render the artist title box.$ |
|---|
| 25 |
# |
|---|
| 26 |
# $Id$ |
|---|
| 27 |
# |
|---|
| 28 |
</%perl> |
|---|
| 29 |
<%args> |
|---|
| 30 |
|
|---|
| 31 |
$artist |
|---|
| 32 |
$link => 1 # -- deprecated |
|---|
| 33 |
|
|---|
| 34 |
$showlinks => undef # show info links |
|---|
| 35 |
$showmodlinks => 1 # show editing links. |
|---|
| 36 |
# -- TODO: rename to showeditlinks |
|---|
| 37 |
$showratings => 0 # show ratings. |
|---|
| 38 |
|
|---|
| 39 |
</%args> |
|---|
| 40 |
<%perl> |
|---|
| 41 |
# Log on to the read only and raw databases |
|---|
| 42 |
my $mbro = $m->comp("/comp/dblogin"); |
|---|
| 43 |
my $mbraw = MusicBrainz->new(); |
|---|
| 44 |
$mbraw->Login(db => 'RAWDATA'); |
|---|
| 45 |
|
|---|
| 46 |
# preferred way of calling this component, |
|---|
| 47 |
# backwards compability. |
|---|
| 48 |
$showlinks = defined $showlinks ? $showlinks : $link; |
|---|
| 49 |
|
|---|
| 50 |
my $id = $artist->GetId; |
|---|
| 51 |
my $mbid = $artist->GetMBId; |
|---|
| 52 |
my $name = $artist->GetName; |
|---|
| 53 |
my $sortname = $artist->GetSortName; |
|---|
| 54 |
my $type = $artist->GetType; |
|---|
| 55 |
my $type_name = MusicBrainz::Server::Artist::GetTypeName($type) || ''; |
|---|
| 56 |
my $begin = $artist->GetBeginDate; |
|---|
| 57 |
my $end = $artist->GetEndDate; |
|---|
| 58 |
my $resolution = $artist->GetResolution; |
|---|
| 59 |
my $quality = ""; |
|---|
| 60 |
my $lastupdate = ""; |
|---|
| 61 |
if ($mbid) |
|---|
| 62 |
{ |
|---|
| 63 |
$quality = ModDefs::GetQualityText($artist->GetQuality); |
|---|
| 64 |
$artist->LoadLastUpdate(); |
|---|
| 65 |
$lastupdate = "(updated " . MusicBrainz::Server::DateTime::format_datetime_since($artist->GetLastUpdate()) . ")"; |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
# compile begin- and end dates |
|---|
| 69 |
$begin = MusicBrainz::Server::Validation::MakeDisplayDateStr($begin); |
|---|
| 70 |
$end = MusicBrainz::Server::Validation::MakeDisplayDateStr($end); |
|---|
| 71 |
my $date_str = ''; |
|---|
| 72 |
if ( $begin and $end ) |
|---|
| 73 |
{ |
|---|
| 74 |
$date_str = "$begin - $end"; |
|---|
| 75 |
} |
|---|
| 76 |
elsif ( $begin ) |
|---|
| 77 |
{ |
|---|
| 78 |
$date_str = "Begin: $begin"; |
|---|
| 79 |
$date_str = "Born: $begin" if $type == &MusicBrainz::Server::Artist::ARTIST_TYPE_PERSON; |
|---|
| 80 |
$date_str = "Founded: $begin" if $type == &MusicBrainz::Server::Artist::ARTIST_TYPE_GROUP; |
|---|
| 81 |
} |
|---|
| 82 |
elsif ( $end ) |
|---|
| 83 |
{ |
|---|
| 84 |
$date_str = "End: $end"; |
|---|
| 85 |
$date_str = "Deceased: $end" if $type == &MusicBrainz::Server::Artist::ARTIST_TYPE_PERSON; |
|---|
| 86 |
$date_str = "Dissolved: $end" if $type == &MusicBrainz::Server::Artist::ARTIST_TYPE_GROUP; |
|---|
| 87 |
} |
|---|
| 88 |
|
|---|
| 89 |
$m->out(qq!<script type="text/javascript" src="/scripts/ratings.js"></script>!) if $showratings; |
|---|
| 90 |
|
|---|
| 91 |
$m->out(qq!<table class="artisttitle">!); |
|---|
| 92 |
|
|---|
| 93 |
# Row 1: the artist name (link) and sortname |
|---|
| 94 |
$m->out(qq!<tr valign="top">!); |
|---|
| 95 |
$m->out(qq!<td class="icon" rowspan="2">!); |
|---|
| 96 |
$m->out(qq! <a href="/artist/$mbid.html" title="Go to the artist page"><img src="/images/aicon_lg.png" alt="" /></a></td>!); |
|---|
| 97 |
$m->out(qq!<td class="title">!); |
|---|
| 98 |
$m->out(qq! <a href="/artist/$mbid.html" title="Go to the artist page">!); |
|---|
| 99 |
$m->out(qq! <span class="mp">!) if ($artist->GetModPending); |
|---|
| 100 |
$m->out($m->interp->apply_escapes($name, 'h')); |
|---|
| 101 |
$m->out(qq! </span>!) if ($artist->GetModPending); |
|---|
| 102 |
$m->out(qq!</a>!); |
|---|
| 103 |
$m->comp("/comp/ratingsbox", entity_type => "artist", entity_id => $id, detailled => 1) if $showratings; |
|---|
| 104 |
$m->out(qq!</td></tr>!); |
|---|
| 105 |
|
|---|
| 106 |
# Info box, a) resolution b) start-end date c) artist-type d) sortname |
|---|
| 107 |
$m->out('<tr><td class="info">'); |
|---|
| 108 |
$m->out($m->interp->apply_escapes($resolution, 'h') . '<br />') if ($resolution); |
|---|
| 109 |
|
|---|
| 110 |
my @info; |
|---|
| 111 |
my $qtxt; |
|---|
| 112 |
push @info, "$date_str" |
|---|
| 113 |
if $date_str; |
|---|
| 114 |
push @info, "Type: $type_name" |
|---|
| 115 |
if $type; |
|---|
| 116 |
|
|---|
| 117 |
if ($quality) |
|---|
| 118 |
{ |
|---|
| 119 |
$qtxt = qq!<span class="mp">! |
|---|
| 120 |
if ($artist->GetQualityModPending); |
|---|
| 121 |
$qtxt .= ucfirst($quality) . " data quality"; |
|---|
| 122 |
$qtxt .= qq!</span>! |
|---|
| 123 |
if ($artist->GetQualityModPending); |
|---|
| 124 |
} |
|---|
| 125 |
|
|---|
| 126 |
push @info, $qtxt; |
|---|
| 127 |
$m->out(join(', ', @info)); |
|---|
| 128 |
$m->out('<br />') |
|---|
| 129 |
if @info; |
|---|
| 130 |
|
|---|
| 131 |
$m->out($m->interp->apply_escapes($sortname, 'h')) |
|---|
| 132 |
if ($name ne $sortname); |
|---|
| 133 |
$m->out('</td></tr>'); |
|---|
| 134 |
|
|---|
| 135 |
# Row 2: non-editing links |
|---|
| 136 |
if ($showlinks) |
|---|
| 137 |
{ |
|---|
| 138 |
$m->out(qq!<tr>!); |
|---|
| 139 |
$m->out(qq!<td colspan="2" class="links">!); |
|---|
| 140 |
$m->out(qq!Info: [ !); |
|---|
| 141 |
|
|---|
| 142 |
# $m->out(qq!<a href="!); |
|---|
| 143 |
# $m->comp("/comp/copyable-link", |
|---|
| 144 |
# id => $mbid, name => $name, |
|---|
| 145 |
# type => "artist", style => "url"); |
|---|
| 146 |
# $m->out(qq!">Permanent link</a> | !); |
|---|
| 147 |
|
|---|
| 148 |
$m->out(sprintf qq!<a href="/show/permlink.html?id=$mbid&type=artist" title="Link to this artist">Link to this</a>!, uri_escape($name)); |
|---|
| 149 |
$m->out(qq! | <a href="/show/artist/details.html?artistid=$id" title="Artist details">Details</a>!); |
|---|
| 150 |
$m->out(qq! | <a href="/show/artist/aliases.html?artistid=$id" title="Artist aliases">Aliases</a>!); |
|---|
| 151 |
$m->out(qq! | <a href="/show/artist/tags.html?id=$id">Tags</a>!); |
|---|
| 152 |
if ($id != &ModDefs::VARTIST_ID) |
|---|
| 153 |
{ |
|---|
| 154 |
$m->out(qq! | <a href="/show/artist/?artistid=$id" title="Releases of this artist">Releases</a>!); |
|---|
| 155 |
$m->out(qq! | <a href="/show/artist/appears-on.html?artistid=$id" title="All releases this artist appears on">Appears on</a>!); |
|---|
| 156 |
} |
|---|
| 157 |
else |
|---|
| 158 |
{ |
|---|
| 159 |
$m->out(qq! | <a href="/browsevarious.html">Browse releases</a>!); |
|---|
| 160 |
} |
|---|
| 161 |
if ($id != &ModDefs::VARTIST_ID) |
|---|
| 162 |
{ |
|---|
| 163 |
$m->out(qq! | <a href="/show/artist/similar.html?artistid=$id" title="Similar Artists">Similar artists</a> | !); |
|---|
| 164 |
$m->comp("/comp/googlelink", search => $name, text => "Search google", raw => 1); |
|---|
| 165 |
} |
|---|
| 166 |
if ($session{uid}) |
|---|
| 167 |
{ |
|---|
| 168 |
$m->out(qq! | <a href="/mod/search/pre/artist.html?artistid=$id" title="View edits made against this artist">View artist edits</a>!); |
|---|
| 169 |
} |
|---|
| 170 |
$m->out(qq! ]</td></tr>!); |
|---|
| 171 |
} |
|---|
| 172 |
|
|---|
| 173 |
|
|---|
| 174 |
# Row 3: editing links |
|---|
| 175 |
if ($showmodlinks) |
|---|
| 176 |
{ |
|---|
| 177 |
$m->out(qq!<tr>!); |
|---|
| 178 |
$m->out(qq!<td colspan="2" class="editlinks">!); |
|---|
| 179 |
$m->out(qq!Edit: [ !); |
|---|
| 180 |
if ($session{uid}) |
|---|
| 181 |
{ |
|---|
| 182 |
if ($id != &ModDefs::VARTIST_ID |
|---|
| 183 |
and $name !~ /^\[(unknown|data track|silence|no artist)\]$/) |
|---|
| 184 |
{ |
|---|
| 185 |
$m->out(qq!<a href="/edit/artist/edit.html?artistid=$id">Edit artist</a>!); |
|---|
| 186 |
$m->out(qq! | <a href="/edit/artist/merge.html?artistid=$id">Merge into ...</a> | !); |
|---|
| 187 |
} |
|---|
| 188 |
if ($id != &ModDefs::VARTIST_ID) |
|---|
| 189 |
{ |
|---|
| 190 |
$m->out(qq!<a href="/user/subscribe.html?artistid=$id">Subscribe</a> | !); |
|---|
| 191 |
} |
|---|
| 192 |
$m->out(qq!<a href="/edit/album/add.html?artistid=$id">Add release</a>!); |
|---|
| 193 |
|
|---|
| 194 |
if ($id == &ModDefs::VARTIST_ID) |
|---|
| 195 |
{ |
|---|
| 196 |
$m->out(qq! | <a href="/freedb/freedb.html">Import release</a>!); |
|---|
| 197 |
} |
|---|
| 198 |
else |
|---|
| 199 |
{ |
|---|
| 200 |
$m->out(sprintf qq! | <a href="/freedb/freedb.html?search=%s">Import release</a>!, uri_escape($name)); |
|---|
| 201 |
|
|---|
| 202 |
require MusicBrainz::Server::Release; |
|---|
| 203 |
#my $mb = $m->comp("/comp/dblogin"); |
|---|
| 204 |
my $al = MusicBrainz::Server::Release->new($mbro->{DBH}); |
|---|
| 205 |
if (my @non = $al->FindNonAlbum($id)) |
|---|
| 206 |
{ |
|---|
| 207 |
my $nonid = $non[0]->GetMBId; |
|---|
| 208 |
$m->out(qq! | <a href="/show/release/?mbid=$nonid">Non-album tracks</a>!); |
|---|
| 209 |
|
|---|
| 210 |
} else { |
|---|
| 211 |
$m->out(qq! | <a href="/edit/track/addnonalbum.html?artistid=$id">Add non-album tracks</a>!); |
|---|
| 212 |
} |
|---|
| 213 |
} |
|---|
| 214 |
if ($id != &ModDefs::VARTIST_ID) |
|---|
| 215 |
{ |
|---|
| 216 |
$m->out(qq! | <a href="/edit/artist/quality.html?artistid=$id">Change quality</a>!); |
|---|
| 217 |
} |
|---|
| 218 |
} |
|---|
| 219 |
else |
|---|
| 220 |
{ |
|---|
| 221 |
$m->out(qq!<a href="/login.html">Log in</a> to edit this!); |
|---|
| 222 |
} |
|---|
| 223 |
$m->out(' ] <span class="lastupdated">' . $lastupdate . "</span>"); |
|---|
| 224 |
$m->out(qq!</td></tr>!); |
|---|
| 225 |
} |
|---|
| 226 |
|
|---|
| 227 |
# Row 4: relationship links |
|---|
| 228 |
if (0 && $showmodlinks && $session{uid}) |
|---|
| 229 |
{ |
|---|
| 230 |
$m->out(qq!<tr>!); |
|---|
| 231 |
$m->out(qq!<td colspan="2" class="relationshiplinks">!); |
|---|
| 232 |
$m->out(qq!Relationships: [ !); |
|---|
| 233 |
$m->out(qq!<a href="/show/artist/?artistid=$id&addrel=1">Use this artist in a relationship</a>!); |
|---|
| 234 |
$m->out(qq! | <a href="/edit/relationship/addurl.html?type=artist&id=$id&name=! . uri_escape($name) . qq!">Relate to URL</a>!); |
|---|
| 235 |
$m->out(qq! ]</td></tr>!); |
|---|
| 236 |
} |
|---|
| 237 |
|
|---|
| 238 |
# Row 5: Collection links |
|---|
| 239 |
|
|---|
| 240 |
|
|---|
| 241 |
if($showlinks && $session{uid}) |
|---|
| 242 |
{ |
|---|
| 243 |
$m->out(qq!<tr>!); |
|---|
| 244 |
$m->out(qq!<td colspan="2" class="collection">!); |
|---|
| 245 |
$m->out(qq!Collection: [ !); |
|---|
| 246 |
if(MusicBrainz::Server::CollectionInfo::NotifyUserAboutNewFromArtist($id, $session{uid}, $mbraw->{DBH})) |
|---|
| 247 |
{ |
|---|
| 248 |
$m->out(qq!<a href="/artist/$mbid.html?artistid=$id¬ify=0">Do not notify me on new releases</a> | !); |
|---|
| 249 |
} |
|---|
| 250 |
else |
|---|
| 251 |
{ |
|---|
| 252 |
$m->out(qq!<a href="/artist/$mbid.html?artistid=$id¬ify=1">Notify me on new releases</a> | !); |
|---|
| 253 |
} |
|---|
| 254 |
|
|---|
| 255 |
if(MusicBrainz::Server::CollectionInfo::ShowMissingOfArtistToUser($id, $session{uid}, $mbraw->{DBH})) |
|---|
| 256 |
{ |
|---|
| 257 |
$m->out(qq!<a href="/artist/$mbid.html?artistid=$id&dispmissing=0">Do not display missing releases</a>!); |
|---|
| 258 |
} |
|---|
| 259 |
else |
|---|
| 260 |
{ |
|---|
| 261 |
$m->out(qq!<a href="/artist/$mbid.html?artistid=$id&dispmissing=1">Display missing releases</a>!); |
|---|
| 262 |
} |
|---|
| 263 |
$m->out(qq! ]</td></tr>!); |
|---|
| 264 |
} |
|---|
| 265 |
|
|---|
| 266 |
$m->out(qq!</table>!); |
|---|
| 267 |
|
|---|
| 268 |
</%perl> |
|---|
| 269 |
|
|---|
| 270 |
%# vi: set ts=4 sw=4 ft=mason : |
|---|