[mb-commits] r10093 - in mb_server/branches/Discographies-BRANCH: cgi-bin/MusicBrainz/Server cgi-bin/MusicBrainz/Server/Handlers/WS/1 htdocs/comp

root at musicbrainz.org root at musicbrainz.org
Fri Jul 11 22:06:06 UTC 2008


Author: niklas
Date: 2008-07-11 22:06:06 +0000 (Fri, 11 Jul 2008)
New Revision: 10093

Modified:
   mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/CollectionInfo.pm
   mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Collection.pm
   mb_server/branches/Discographies-BRANCH/htdocs/comp/collection
Log:
authentication working?

Modified: mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/CollectionInfo.pm
===================================================================
--- mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/CollectionInfo.pm	2008-07-11 21:21:08 UTC (rev 10092)
+++ mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/CollectionInfo.pm	2008-07-11 22:06:06 UTC (rev 10093)
@@ -102,6 +102,7 @@
 	my ($this, $artistId) = @_;
 	
 	
+	
 	# create Sql objects
 	require Sql;
 	my $rosql = Sql->new($this->{RODBH});
@@ -112,31 +113,37 @@
 	my $result = $rawsql->SelectSingleColumnArray($query);
 	
 	
-	
-	# get MBID's for all releases in collection
-	my $mbids; # for storing the result
-	
-	eval
+	if(@{$result} == 0) # 0 results
 	{
-		$rosql->Begin();
-		
-		my $releaseQuery='SELECT gid FROM album WHERE id IN(' . join(',', @{$result}) . ')';
-	
-		$mbids = $rosql->SelectListOfLists($releaseQuery);
-	};
-	
-	if($@)
-	{
-		print $@;
-		$rosql->Commit();
+		return [];
 	}
 	else
-	{
-		$rosql->Commit();
+	{	
+		# get MBID's for all releases in collection
+		my $mbids; # for storing the result
+		
+		eval
+		{
+			$rosql->Begin();
+			
+			my $releaseQuery='SELECT gid FROM album WHERE id IN(' . join(',', @{$result}) . ')';
+		
+			$mbids = $rosql->SelectListOfLists($releaseQuery);
+		};
+		
+		if($@)
+		{
+			print $@;
+			$rosql->Commit();
+		}
+		else
+		{
+			$rosql->Commit();
+		}
+		
+		
+		return $mbids;
 	}
-	
-	
-	return $mbids;
 }
 
 

Modified: mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Collection.pm
===================================================================
--- mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Collection.pm	2008-07-11 21:21:08 UTC (rev 10092)
+++ mb_server/branches/Discographies-BRANCH/cgi-bin/MusicBrainz/Server/Handlers/WS/1/Collection.pm	2008-07-11 22:06:06 UTC (rev 10093)
@@ -39,15 +39,20 @@
 	$mbraw->Login(db => 'RAWDATA');
 	
 	my $sqlraw = Sql->new($mbraw->{DBH});
+	my $sqlro = Sql->new($mbro->{DBH});
 	
+	
+	# get user id for logged on user
+	my $userId = $sqlro->SelectSingleValue("SELECT id FROM moderator WHERE name='". $r->user ."'");
+	
 	# get collection_info id
-	my $collectionIdQuery="SELECT id FROM collection_info WHERE moderator='". $r->user ."'";
+	my $collectionIdQuery = "SELECT id FROM collection_info WHERE moderator='". $userId ."'";
 	my $collectionId=$sqlraw->SelectSingleValue($collectionIdQuery);
 	
 	
 	
 	# instantiate Collection object
-	my $collection=MusicBrainz::Server::Collection->new($mbro->{DBH}, $mbraw->{DBH}, $collectionId);
+	my $collection = MusicBrainz::Server::Collection->new($mbro->{DBH}, $mbraw->{DBH}, $collectionId);
 	
 	# add albums, if the array is not empty...
 	if(@addAlbums){ $collection->AddAlbums(@addAlbums); }

Modified: mb_server/branches/Discographies-BRANCH/htdocs/comp/collection
===================================================================
--- mb_server/branches/Discographies-BRANCH/htdocs/comp/collection	2008-07-11 21:21:08 UTC (rev 10092)
+++ mb_server/branches/Discographies-BRANCH/htdocs/comp/collection	2008-07-11 22:06:06 UTC (rev 10093)
@@ -61,6 +61,7 @@
 	
 	my $artistname = $sql->SelectSingleValue("SELECT name FROM artist WHERE id='" . $release->GetArtist() . "'");
 	
+	
 	print '<tr class="'.('ev', 'od')[$rownum % 2].'">';
 	print '<td>'.$artistname.'</td>';
 	print '<td>'.$release->GetName().'</td>';




More information about the MusicBrainz-commits mailing list