[mb-commits] r9854 - in mb_server/trunk: cgi-bin cgi-bin/MusicBrainz/Server cgi-bin/MusicBrainz/Server/Moderation htdocs/cdi htdocs/comp/release_editor
root at musicbrainz.org
root at musicbrainz.org
Thu May 29 21:21:29 UTC 2008
Author: robert
Date: 2008-05-29 21:21:29 +0000 (Thu, 29 May 2008)
New Revision: 9854
Modified:
mb_server/trunk/cgi-bin/Insert.pm
mb_server/trunk/cgi-bin/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE.pm
mb_server/trunk/cgi-bin/MusicBrainz/Server/Release.pm
mb_server/trunk/cgi-bin/TableBase.pm
mb_server/trunk/htdocs/cdi/enter.html
mb_server/trunk/htdocs/comp/release_editor/entermoderations-add
mb_server/trunk/htdocs/comp/release_editor/form
mb_server/trunk/htdocs/comp/release_editor/init-addrelease
Log:
Allow a releasembid argument to the cdi/enter.html for submitting pre-assigned mbids
Modified: mb_server/trunk/cgi-bin/Insert.pm
===================================================================
--- mb_server/trunk/cgi-bin/Insert.pm 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/cgi-bin/Insert.pm 2008-05-29 21:21:29 UTC (rev 9854)
@@ -142,6 +142,7 @@
# artist_begindate [optional]
# artist_enddate [optional]
# album name or albumid [required]
+# albumid_supplied [optional] (for use with album ids supplied from peeps like the BBC)
# attributes -> ref to array [optional]
# languageid [optional]
# scriptid [optional]
@@ -203,6 +204,8 @@
}
my $forcenewalbum = $info->{forcenewalbum};
+
+ # This is now possible with allowing some users to submit MBIDs
if ($forcenewalbum && exists $info->{albumid})
{
die "Insert failed: you cannot force a new album and provide an albumid.\n";
@@ -270,7 +273,6 @@
if (!exists $info->{artist_only})
{
-
# Try and resolve/check the album name
if (exists $info->{albumid})
{
@@ -367,12 +369,14 @@
$al->SetName($album);
$al->SetArtist($artistid);
if (exists $info->{attrs})
- {
- $al->SetAttributes(@{ $info->{attrs} });
+ {
+ $al->SetAttributes(@{ $info->{attrs} });
}
$al->SetLanguageId($language) if $language;
$al->SetScriptId($script) if $script;
- $albumid = $al->Insert;
+ my $albumid_supplied;
+ $albumid_supplied = $info->{albumid_supplied} if (exists $info->{albumid_supplied});
+ $albumid = $al->Insert($albumid_supplied);
if (!defined $albumid)
{
die "Insert failed: cannot insert new album.\n";
@@ -562,7 +566,7 @@
}
# insert track using the verified track artist
- $mar->SetId($track_artistid);
+ $mar->SetId($ar->GetId);
$trackid = $tr->Insert($al, $mar);
$track->{track_insertid} = $trackid if ($tr->GetNewInsert());
}
Modified: mb_server/trunk/cgi-bin/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE.pm
===================================================================
--- mb_server/trunk/cgi-bin/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE.pm 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/cgi-bin/MusicBrainz/Server/Moderation/MOD_ADD_RELEASE.pm 2008-05-29 21:21:29 UTC (rev 9854)
@@ -66,6 +66,7 @@
# |--- Attributes (default: none) (OPTIONAL)
# |--- Language (OPTIONAL)
# |--- Script (OPTIONAL)
+ # |--- ReleaseId (OPTIONAL -- only for MBID Submitters)
# \--- for tracks 1..n:
# |--- Track/n/ - name
# |--- Artist/n/ - ??? id or name ???
@@ -116,6 +117,10 @@
$info{'cdindexid'} = $new{'CDIndexId'};
$info{'toc'} = $new{'TOC'};
}
+ if (exists $new{'ReleaseId'} && $new{'ReleaseId'})
+ {
+ $info{'albumid_supplied'} = $new{'ReleaseId'};
+ }
if ($new{'NonAlbum'})
{
Modified: mb_server/trunk/cgi-bin/MusicBrainz/Server/Release.pm
===================================================================
--- mb_server/trunk/cgi-bin/MusicBrainz/Server/Release.pm 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/cgi-bin/MusicBrainz/Server/Release.pm 2008-05-29 21:21:29 UTC (rev 9854)
@@ -420,14 +420,14 @@
# set before this function is called.
sub Insert
{
- my ($this) = @_;
+ my ($this, $albumid) = @_;
$this->{new_insert} = 0;
return undef if (!exists $this->{artist} || $this->{artist} eq '');
return undef if (!exists $this->{name} || $this->{name} eq '');
my $sql = Sql->new($this->{DBH});
- my $id = $this->CreateNewGlobalId();
+ my $id = $albumid ? $albumid : $this->CreateNewGlobalId();
my $attrs = "{" . join(',', @{ $this->{attrs} }) . "}";
my $page = $this->CalculatePageIndex($this->{name});
my $lang = $this->GetLanguageId();
Modified: mb_server/trunk/cgi-bin/TableBase.pm
===================================================================
--- mb_server/trunk/cgi-bin/TableBase.pm 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/cgi-bin/TableBase.pm 2008-05-29 21:21:29 UTC (rev 9854)
@@ -74,7 +74,15 @@
sub SetId
{
- $_[0]->{id} = $_[1];
+ if (MusicBrainz::Server::Validation::IsGUID($_[1]))
+ {
+ $_[0]->{mbid} = $_[1];
+ delete $_[0]->{id};
+ }
+ else
+ {
+ $_[0]->{id} = $_[1];
+ }
}
sub GetName
Modified: mb_server/trunk/htdocs/cdi/enter.html
===================================================================
--- mb_server/trunk/htdocs/cdi/enter.html 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/htdocs/cdi/enter.html 2008-05-29 21:21:29 UTC (rev 9854)
@@ -32,6 +32,7 @@
$artistid => 0
$tracks => undef
$hasmultipletrackartists => undef
+ $releasembid => ""
# cd-toc attach /bare/cdlookup.html
$discid => ""
@@ -65,12 +66,6 @@
# check volatile preferences (like autoeditor flag)
$m->comp("/comp/user/check-volatile-preferences", %ARGS);
- # make sure we got a valid releaseid parameter
- MusicBrainz::Server::Validation::IsNonNegInteger($artistid)
- or MusicBrainz::Server::Validation::IsGUID($artistid)
- or return $m->comp("/comp/layout/badarguments",
- text => "The argument <strong>artistid</strong> is missing or has a wrong format.");
-
# make sure we got a valid tracks parameter
MusicBrainz::Server::Validation::IsNonNegInteger($tracks) && $tracks
or return $m->comp("/comp/layout/badarguments",
@@ -85,6 +80,23 @@
my $mb = $m->comp("/comp/dblogin");
$ARGS{"mb"} = $mb;
+ if (MusicBrainz::Server::Validation::IsGUID($artistid))
+ {
+ my $obj = $m->comp("/comp/loadartist", $mb, $artistid);
+ $artistid = $obj->GetId;
+ }
+
+ # make sure we got a valid artistid parameter
+ MusicBrainz::Server::Validation::IsNonNegInteger($artistid)
+ or return $m->comp("/comp/layout/badarguments",
+ text => "The argument <strong>artistid</strong> is missing or has a wrong format.");
+
+ if (!UserStuff->IsMBIDSubmitter($session{"privs"}) || !MusicBrainz::Server::Validation::IsGUID($releasembid))
+ {
+ $releasembid = "";
+ $ARGS{releasembid} = "";
+ }
+
# SETUP FORM STATE
# ---------------------------------------------------------------
# initialise the submit buttons, and un-muddle the "submitvalue"
Modified: mb_server/trunk/htdocs/comp/release_editor/entermoderations-add
===================================================================
--- mb_server/trunk/htdocs/comp/release_editor/entermoderations-add 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/htdocs/comp/release_editor/entermoderations-add 2008-05-29 21:21:29 UTC (rev 9854)
@@ -37,6 +37,7 @@
# release
$releasename => undef
+ $releasembid => undef
$attr_status => undef
$attr_type => undef
$attr_language => undef
@@ -183,6 +184,7 @@
$new .= "TOC=$toc\n" if ($toc ne "");
$new .= "FreedbId=$freedbid\n" if ($freedbid ne "");
$new .= "FreedbCat=$freedbcat\n" if ($freedbcat ne "");
+ $new .= "ReleaseId=$releasembid\n" if ($releasembid ne "");
$new .= $trackdata;
sub _EncodeText
Modified: mb_server/trunk/htdocs/comp/release_editor/form
===================================================================
--- mb_server/trunk/htdocs/comp/release_editor/form 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/htdocs/comp/release_editor/form 2008-05-29 21:21:29 UTC (rev 9854)
@@ -47,6 +47,9 @@
$releaseid => ""
$releasename => ""
+ # For submitting the MBID for a release in case someone like the BBC already assigned one
+ $releasembid=> ""
+
</%args>
<%perl>
@@ -57,7 +60,6 @@
return sprintf("tr%d_%s", $i, $name);
}
-
my (%checkfields, %checkattributes, %checklanguage, %checkreleases);
%checkfields = %{ $ARGS{"v::fields"} } if (ref $ARGS{"v::fields"} eq "HASH");
@@ -135,6 +137,15 @@
</div></td>
</tr>
+% if ($releasembid)
+% {
+ <tr>
+ <td colspan="7">
+ NOTE: Using user supplied id <b><% $releasembid %></b> for this release.
+ </td>
+ </tr>
+% }
+
<%perl>
# -------------------------------------------------------------------------
@@ -644,4 +655,3 @@
%# vi: set ts=4 sw=4 ft=mason :
-
Modified: mb_server/trunk/htdocs/comp/release_editor/init-addrelease
===================================================================
--- mb_server/trunk/htdocs/comp/release_editor/init-addrelease 2008-05-28 20:46:10 UTC (rev 9853)
+++ mb_server/trunk/htdocs/comp/release_editor/init-addrelease 2008-05-29 21:21:29 UTC (rev 9854)
@@ -49,11 +49,6 @@
# LOAD ARTIST
# ---------------------------------------------------------------
# load release artist from database
- if (MusicBrainz::Server::Validation::IsGUID($artistid))
- {
- my $obj = $m->comp("/comp/loadartist", $mb, $artistid);
- $artistid = $obj->GetId;
- }
$orig{"artistid"} = $artistid;
$orig{"artistname"} = $artistname;
$orig{"artistresolution"} = $artistresolution;
More information about the MusicBrainz-commits
mailing list