|
|
Choosing A Webhost: |
[mb-commits] r8609 - in mb_server/branches/labels: cgi-bin htdocs/comp/layo: msg#00025audio.musicbrainz.cvs
Author: luks Date: 2006-11-03 13:08:59 +0000 (Fri, 03 Nov 2006) New Revision: 8609 Modified: mb_server/branches/labels/cgi-bin/Label.pm mb_server/branches/labels/htdocs/comp/layout/topmenu mb_server/branches/labels/htdocs/css/main.css mb_server/branches/labels/htdocs/show/label/index.html Log: Display releases for labels. Modified: mb_server/branches/labels/cgi-bin/Label.pm =================================================================== --- mb_server/branches/labels/cgi-bin/Label.pm 2006-11-03 12:23:09 UTC (rev 8608) +++ mb_server/branches/labels/cgi-bin/Label.pm 2006-11-03 13:08:59 UTC (rev 8609) @@ -822,127 +822,61 @@ # retreive the set of albums by this label. Returns an array of # references to Album objects. Refer to the Album object for details. -# The returned array is empty on error. Multiple label albums are -# also returned by this query. Use SetId() to set the id of label +# The returned array is empty on error. sub GetAlbums { - my ($this, $novlabel, $loadmeta, $onlyvlabel) = @_; - my (@albums, $sql, @row, $album, $query); - - return @albums if (defined $novlabel && $novlabel && defined $onlyvlabel && $onlyvlabel); - - $sql = Sql->new($this->{DBH}); - if (!defined $onlyvlabel || !$onlyvlabel) - { - # First, pull in the single label albums - if (defined $loadmeta && $loadmeta) - { - $query = qq/select album.id, name, modpending, GID, attributes, - language, script, tracks, discids, trmids, - firstreleasedate, coverarturl, asin, puids - from Album, Albummeta - where label=$this->{id} and albummeta.id = album.id/; - } - else - { - $query = qq/select album.id, name, modpending, GID, - attributes, language, script - from Album - where label=$this->{id}/; - } - if ($sql->Select($query)) - { - while(@row = $sql->NextRow) - { - require Album; - $album = Album->new($this->{DBH}); - $album->SetId($row[0]); - $album->SetName($row[1]); - $album->SetModPending($row[2]); - $album->SetLabel($this->{id}); - $album->SetMBId($row[3]); - $row[4] =~ s/^\{(.*)\}$/$1/; - $album->{attrs} = [ split /,/, $row[4] ]; - $album->SetLanguageId($row[5]); - $album->SetScriptId($row[6]); - - if (defined $loadmeta && $loadmeta) - { - $album->{trackcount} = $row[7]; - $album->{discidcount} = $row[8]; - $album->{trmidcount} = $row[9]; - $album->{firstreleasedate} = $row[10]||""; - $album->{coverarturl} = $row[11]||""; - $album->{asin} = $row[12]||""; - $album->{puidcount} = $row[13]||0; - } - - push @albums, $album; - undef $album; - } - } - - $sql->Finish; - } - return @albums if (defined $novlabel && $novlabel); - - # then, pull in the multiple label albums - if (defined $loadmeta && $loadmeta) - { - $query = qq/select album.id, album.label, name, modpending, GID, attributes, language, - script, tracks, discids, trmids, firstreleasedate, puids - from album, albummeta - where album.label != $this->{id} and - albummeta.id = album.id and - album.id in (select distinct albumjoin.album - from albumjoin, track - where track.label = $this->{id} and - albumjoin.track = track.id)/; - } - else - { - $query = qq/select album.id, album.label, name, modpending, GID, - attributes, language, script - from album - where album.label != $this->{id} and - album.id in (select distinct albumjoin.album - from albumjoin, track - where track.label = $this->{id} and - albumjoin.track = track.id)/; - } - - if ($sql->Select($query)) - { - while(@row = $sql->NextRow) - { - require Album; - $album = Album->new($this->{DBH}); - $album->SetId($row[0]); - $album->SetLabel($row[1]); - $album->SetName($row[2]); - $album->SetModPending($row[3]); - $album->SetMBId($row[4]); - $row[5] =~ s/^\{(.*)\}$/$1/; - $album->{attrs} = [ split /,/, $row[5] ]; - $album->SetLanguageId($row[6]); - $album->SetScriptId($row[7]); - - if (defined $loadmeta && $loadmeta) - { - $album->{trackcount} = $row[8]; - $album->{discidcount} = $row[9]; - $album->{trmidcount} = $row[10]; - $album->{firstreleasedate} = $row[11]||""; - $album->{puidcount} = $row[12]||0; - } - - push @albums, $album; - undef $album; - } - } - - $sql->Finish; - return @albums; + my ($this) = @_; + my $sql = Sql->new($this->{DBH}); + my $query = qq/ + SELECT + album.id, + artist, + name, + album.modpending, + gid, + attributes, + language, + script, + releasedate, + catno, + tracks, + discids, + trmids, + puids + FROM + release, album, albummeta + WHERE + release.album = album.id + AND albummeta.id = album.id + AND release.label = ? + /; + my @albums; + if ($sql->Select($query, $this->GetId)) + { + while(my @row = $sql->NextRow) + { + require Album; + my $album = Album->new($this->{DBH}); + $album->SetId($row[0]); + $album->SetArtist($row[1]); + $album->SetName($row[2]); + $album->SetModPending($row[3]); + $album->SetMBId($row[4]); + $row[5] =~ s/^\{(.*)\}$/$1/; + $album->{attrs} = [ split /,/, $row[5] ]; + $album->SetLanguageId($row[6]); + $album->SetScriptId($row[7]); + $album->{releasedate} = $row[8]; + $album->{catno} = $row[9]; + $album->{trackcount} = $row[10]; + $album->{discidcount} = $row[11]; + $album->{trmidcount} = $row[12]; + $album->{puidcount} = $row[13] || 0; + push @albums, $album; + } + } + $sql->Finish; + return @albums; } # Checks to see if an album by the given name exists. If no exact match is Modified: mb_server/branches/labels/htdocs/comp/layout/topmenu =================================================================== --- mb_server/branches/labels/htdocs/comp/layout/topmenu 2006-11-03 12:23:09 UTC (rev 8608) +++ mb_server/branches/labels/htdocs/comp/layout/topmenu 2006-11-03 13:08:59 UTC (rev 8609) @@ -333,6 +333,7 @@ { url => "/edit/albumreleases/index.html" }, { url => "/edit/albumreleases/editreleases.html" }, { url => "/edit/albumreleases/review.html" }, + { url => "/edit/albumreleases/selectlabel.html" }, { url => "/edit/albumreleases/cancel.html" }, { url => "/edit/albumreleases/enter.html" }, Modified: mb_server/branches/labels/htdocs/css/main.css =================================================================== --- mb_server/branches/labels/htdocs/css/main.css 2006-11-03 12:23:09 UTC (rev 8608) +++ mb_server/branches/labels/htdocs/css/main.css 2006-11-03 13:08:59 UTC (rev 8609) @@ -741,6 +741,11 @@ text-align: center } +/* catalog number */ +#CompactReleaseList td.catno { + padding: 0 0.6em +} + /* release name */ #CompactReleaseList td.rname { padding: 0 0.6em Modified: mb_server/branches/labels/htdocs/show/label/index.html =================================================================== --- mb_server/branches/labels/htdocs/show/label/index.html 2006-11-03 12:23:09 UTC (rev 8608) +++ mb_server/branches/labels/htdocs/show/label/index.html 2006-11-03 13:08:59 UTC (rev 8609) @@ -65,28 +65,73 @@ my $mb = $m->comp("/comp/dblogin"); my $label = $m->comp("/comp/loadlabel", $mb, $mbid || $labelid); - my $fCompact = 1; - my @albums; - - # We will use one of the following display modes: - # 0 - short display mode, with albums eps single and comp shown. - # 1 - short mode with all SA other than the above shown - # 2 - short mode with all VA, no SA shown - # 3 - full mode -- show everything - my $dispmode = 0; - my @dispinfo = ( - [ "album, EP, single, comp. releases", "all releases" ], - [ "all single label releases", "all releases" ], - [ "all various label releases", "all releases" ], - [ "all releases", "albums, EP, single, comp. releases" ] - ); - # Disallow viewing the DELETED_LABEL $label->GetId == &ModDefs::DLABEL_ID and return $m->comp("/comp/layout/badarguments", text => "The special label DELETED_LABEL cannot be shown."); + my @albums = $label->GetAlbums; + + # Sort by: + # 'ReleaseDate' (earliest release date first, no release date last) + # 'Name' (lowercase) + # 'Status' (release status) + # track count + # TRM count + # PUID count + # row id + my $SortAlbums = sub + { + ($a->{_releasedate_} cmp $b->{_releasedate_}) + or + ($a->{_name_sort_} cmp $b->{_name_sort_}) + or + ($a->{_disc_max_} <=> $b->{_disc_max_}) + or + ($a->{_disc_no_} <=> $b->{_disc_no_}) + or + ($a->{_attr_status} <=> $b->{_attr_status}) + or + ($a->{trackcount} cmp $b->{trackcount}) + or + ($b->{trmidcount} cmp $a->{trmidcount}) + or + ($b->{puidcount} cmp $a->{puidcount}) + or + ($a->GetId cmp $b->GetId) + }; + + for my $album (@albums) + { + # Munge name for sorting + use Encode qw( decode ); + $album->{_name_sort_} = lc decode "utf-8", $album->GetName; + $album->{_disc_max_} = 0; + $album->{_disc_no_} = 0; + # Attempt to sort "disc x [of y]" correctly + if ($album->{_name_sort_} =~ + /^(.*) # $1 <main title> + (?:[(]disc\ (\d+) # $2 (disc x + (?:\ of\ (\d+))? # $3 [of y] + (?::[^()]* # [: <disc title> + (?:[(][^()]*[)][^()]*)* # [<1 level of nested par.>] + )? # ] + [)] # ) + ) + (.*)$ # $4 [<rest of main title>] + /xi) + { + $album->{_name_sort_} = "$1 $4"; + $album->{_disc_no_} = $2; + $album->{_disc_max_} = $3 || 0; + } + # Sort albums with no release last + $album->{_releasedate_} = ($album->{releasedate} || "9999-99-99"); + } + + @albums = sort $SortAlbums @albums; + $m->comp("/comp/sidebar-notitle", pagetitle => "Label: " . $label->GetName(), ); @@ -102,22 +147,74 @@ explain => 1, ), $m->out("<br>"); - </%perl> - <center> - <p>This label has no releases.</p> - <p> - [ -% unless ($label->InUse) { - <a href="/edit/label/remove.html?labelid=<% $label->GetId %>" - >Remove this label</a> +</%perl> + +% if (@albums) +% { + <table id="CompactReleaseList"> + <tr><th colspan="9" align="left"><h2>Releases</h2></th></tr> +% for my $album (@albums) +% { +<tr> +% my $amp = $album->GetAttributeModPending; +% my $nmp = $album->GetModPending; +% if ($album->GetTrackCount) { +<td class="trk"><% $album->GetTrackCount %> <img src="/images/notes.gif" alt="Tracks" /></td> +% } else { +<td></td> +% } +% if ($album->GetDiscidCount) { +<td class="did"><% $album->GetDiscidCount %> <img src="/images/cd.gif" alt="Disc IDs" /></td> +% } else { +<td></td> +% } +% if ($album->GetTrmidCount) { +<td class="trm"><% $album->GetTrmidCount %> <img src="/images/trm.gif" alt="TRM IDs" /></td> +% } else { +<td></td> +% } +% if ($album->GetPuidCount) { +<td class="trm"><% $album->GetPuidCount %> <img src="/images/puid.gif" alt="PUIDs" /></td> +% } else { +<td></td> +% } +<td class="rst"><% + $amp ? "<span class='mp'>" : "" |n + %><% do { + my $s = $album->{_actual_attr_status}; + $s ? ($album->GetAttributeName($s)||"?$s") : "None" + } %><% + $amp ? "</span>" : "" |n +%></td> +<td class="lang"><& /comp/language, $album->GetLanguage, $album->GetScript &></td> +<td class="rdate"><& /comp/releasedate, $album->{releasedate} &></td> +<td class="catno"><% $album->{catno} %></td> +<td class="rname"> +% if ($session{tport}) { +<a href="http://127.0.0.1:<% $session{tport} %>/openalbum?id=<% $album->GetMBId %>&t=<% time %>" +style="margin-right: 1ex" +target="hiddeniframe" title="Open in Tagger" border="0"><img +src="/images/mblookup-tagger.png" border="0" alt="Open in tagger"></a> +% } +<% $nmp ? "<span class='mp'>" : "" |n %><a href="/release/<% $album->GetMBId %>.html"><% $album->GetName %></a><% $nmp ? "</span>" : "" |n %></td> +</tr> +% } +</table> % } - ] - </p> - </center> - <%perl> - -</%perl> - +% else +% { + <center> + <p>This label has no releases.</p> + <p> + [ +% unless ($label->InUse) { + <a href="/edit/label/remove.html?labelid=<% $label->GetId %>">Remove this label</a> +% } + ] + </p> + </center> +% } + <& /comp/js/diffcollapse, JSCollapseToggleIcon => 0, JSCollapse => 0 &> <& /comp/footer &>
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [mb-commits] r8608 - mb_server/branches/labels/htdocs/comp, root |
|---|---|
| Next by Date: | [mb-commits] r8610 - in mb_server/branches/labels: admin/sql htdocs/comp/ar htdocs/comp/relationship htdocs/show/label, root |
| Previous by Thread: | [mb-commits] r8608 - mb_server/branches/labels/htdocs/comp, root |
| Next by Thread: | [mb-commits] r8610 - in mb_server/branches/labels: admin/sql htdocs/comp/ar htdocs/comp/relationship htdocs/show/label, root |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |