[mb-commits] r9975 - in mb_server/branches/Discographies-BRANCH: cgi-bin htdocs/user

root at musicbrainz.org root at musicbrainz.org
Wed Jul 9 15:21:57 UTC 2008


Author: niklas
Date: 2008-07-09 15:21:57 +0000 (Wed, 09 Jul 2008)
New Revision: 9975

Modified:
   mb_server/branches/Discographies-BRANCH/cgi-bin/CollectionPreference.pm
   mb_server/branches/Discographies-BRANCH/htdocs/user/collectionpreferences.html
Log:
more work on preferences

Modified: mb_server/branches/Discographies-BRANCH/cgi-bin/CollectionPreference.pm
===================================================================
--- mb_server/branches/Discographies-BRANCH/cgi-bin/CollectionPreference.pm	2008-07-09 02:19:05 UTC (rev 9974)
+++ mb_server/branches/Discographies-BRANCH/cgi-bin/CollectionPreference.pm	2008-07-09 15:21:57 UTC (rev 9975)
@@ -20,19 +20,20 @@
 sub new
 {
 	my ($this, $rawdbh, $userId) = @_;
-	#my $prefs;
-	#$prefs->{'asd'}='asdasd';
-	#$prefs->{'qwe'}='qweqwe';
-	my %prefs = ('asd'=>'asdasd', 'qwe'=>'qweqwe', 'tyu'=>'tyutyu',);
-	use Data::Dumper;
-	print Dumper(%prefs);
-	print '<br/>'.Dumper(keys %prefs).'<br/>';
-	#my %prefs = (KEY => 'email_notify_release', DEFAULT => 1, CHECK => \&check_boo);
-	print 'RAWDBH:'.Dumper($rawdbh);
+	
+	
 	# get collection id
 	my $sql=Sql->new($rawdbh);
 	my $query="SELECT id FROM collection_info WHERE moderator='$userId'";
 	my $collectionId=$sql->SelectSingleValue($query);
+	
+	# select artist id's of artists to display missing releases of
+	my $artistsQuery="SELECT artist FROM collection_discography_artist_join WHERE collection_info='". $collectionId ."'";
+	my $artistsMissing=$sql->SelectSingleColumnArray($artistsQuery);
+	
+	print 'missing:'.Dumper($artistsMissing);
+	
+	
 	print Dumper($userId);
 	
 	print 'collectionId: '.$collectionId.'<br/><br/>';
@@ -41,7 +42,8 @@
 	{
 		RAWDBH			=> $rawdbh,
 		prefs			=> {},
-		collectionId	=> $collectionId
+		collectionId	=> $collectionId,
+		artistsMissing	=>	$artistsMissing
 	}, $this);
 	
 	$object->addpref('emailnotifications', 0, \&check_bool);
@@ -314,5 +316,13 @@
 #	};
 }
 
+sub ArtistInMissingList
+{
+	my ($this, $artistId) = @_;
+	#print '<br/>list:'.Dumper($this->{prefs});
+	#return exists $this->{artistsMissing}->{$artistId};
+	return 1;
+}
+
 1;
 

Modified: mb_server/branches/Discographies-BRANCH/htdocs/user/collectionpreferences.html
===================================================================
--- mb_server/branches/Discographies-BRANCH/htdocs/user/collectionpreferences.html	2008-07-09 02:19:05 UTC (rev 9974)
+++ mb_server/branches/Discographies-BRANCH/htdocs/user/collectionpreferences.html	2008-07-09 15:21:57 UTC (rev 9975)
@@ -76,6 +76,14 @@
 				
 				for my $artist (@{$artists})
 				{
+					if($preferences->ArtistInMissingList($artist->{id}))
+					{
+						#print $artist->{id} .'in list';
+					}
+					else
+					{
+						#print $artist->{id} .'not in list';
+					}
 					print '<input type="checkbox" name="artistwatchmissing_'. $artistIndex.'"';
 					print $preferences->get('artistwatchmissing_'.$artistIndex) ? ' checked' : "";
 					print '/>'. $artist->{name} .'<br/>';




More information about the MusicBrainz-commits mailing list