[mb-commits] branch, beta, updated. Merge branch 'i18n-nop-context' into beta i18n: Don't return @ _ for N_l and N...
MusicBrainz Git Server <[email protected]>
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1TTIHP-00028s-On@wiley> |
The branch, beta has been updated
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=7d7de8cd4a19ffae08ebecddb83d2ce7bcd4eb9e (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=925d608dc00a35980209ebfcb3aefbc75bf3f8c0 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=e45d57056871ca9a1b3039fc82bafe40dd9f78c3 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=a8c30a6e8a8cded736cd8e7ac595a9ce6695a774 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=8fdb7babc1e13cd1a0545d9fce6c118fdec7f9f2 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=2a4fb5811d7f78dc0070821e6fb7544871e2fa2c (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=63da3f207595ca755727dd27bf1f61d4b8445a75 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=6535477a0716780760bf0a04dbc52f25c8dc60ca (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=531934141169ec6319ff9591c074dbc06f09fdc6 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=4705a4fcb0b606b3eb18cffafb6360832cfade3d (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=02426cad487eba91f9cb474306deb33ed02be03b (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=c56ac700a26540d5e391ecfb48a89db44ce23eba (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=95a14716a0547b02afc86c73016c6958b9440485 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=3f7ff55f5e47d9cd4fb1cce3c5ea858012417b20 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=9a7383a8d554a3aa15e5de2e8f591333db00a766 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=99fe39cb66fca9edb677f9ac5b68b38665aafe9d (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=2204dd36f7e56686cdef4f1efde972a8055ca01e (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=df6269130c644a2af247d5a3ac1d76305ecb8bcb (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=3b7f76f1230cfb3e7a90130df02335dcf92ab98a (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=978cd72ba777b7c548c027752745f9df188b18cd (commit)
from http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=7682138b507e4a50fbd3252ec3b001e4bf027ab3 (commit)
Summary of changes:
admin/sql/caa/CreateViews.sql | 2 +-
lib/MusicBrainz/Server.pm | 3 +-
lib/MusicBrainz/Server/Data/Blog.pm | 5 +-
.../Server/Entity/AutoEditorElection.pm | 26 ++--
lib/MusicBrainz/Server/Filters.pm | 20 ++
lib/MusicBrainz/Server/Role/Translation.pm | 71 ++++---
lib/MusicBrainz/Server/Translation.pm | 21 ++-
root/components/common-macros.tt | 8 +
root/elections/index.tt | 2 +-
root/elections/show.tt | 10 +-
root/recording/delete.tt | 3 +-
root/release/sidebar.tt | 4 +-
root/static/scripts/edit/MB/Control/URLCleanup.js | 3 +-
.../guess-case/MB/GuessCase/Mode/Classical.js | 225 --------------------
.../scripts/guess-case/MB/GuessCase/Modes.js | 2 +-
.../release-editor/MB/Control/ReleaseRecordings.js | 45 ++--
root/static/scripts/tests/GuessCase.js | 5 -
root/static/scripts/tests/all.html | 1 -
18 files changed, 141 insertions(+), 315 deletions(-)
delete mode 100644 root/static/scripts/guess-case/MB/GuessCase/Mode/Classical.js
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 7d7de8cd4a19ffae08ebecddb83d2ce7bcd4eb9e
Merge: a8c30a6 925d608
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:18:03 2012 -0700
Merge branch 'i18n-nop-context' into beta
* Remerge, since it's been rereviewed
commit 925d608dc00a35980209ebfcb3aefbc75bf3f8c0
Author: Ian McEwen <[email protected]>
Date: Thu Oct 18 15:33:12 2012 -0700
i18n: Don't return @_ for N_l and N_lp, just N_ln
diff --git a/lib/MusicBrainz/Server/Role/Translation.pm b/lib/MusicBrainz/Server/Role/Translation.pm
index 966b818..ec49e40 100644
--- a/lib/MusicBrainz/Server/Role/Translation.pm
+++ b/lib/MusicBrainz/Server/Role/Translation.pm
@@ -5,51 +5,60 @@ use Locale::Messages qw( dgettext dpgettext dngettext );
parameter domain => ( required => 1, isa => 'Str' );
role {
- my $params = shift;
+ my $params = shift;
- method 'nop_gettext' => sub
- {
- # just return the first argument to the caller
- shift;
- return shift;
- };
+ method 'nop_gettext' => sub
+ {
+ # Just return the first argument to the caller
+ # Used for N_l and N_lp
+ shift;
+ return shift;
+ };
- method 'gettext' => sub
- {
- my ($self, $msgid, $vars) = @_;
+ method 'nop_ngettext' => sub
+ {
+ # Just return the arguments to the caller
+ # Used for N_ln
+ shift;
+ return @_;
+ };
- my %vars = %$vars if (ref $vars eq "HASH");
+ method 'gettext' => sub
+ {
+ my ($self, $msgid, $vars) = @_;
- $self->_bind_domain($params->domain) unless $self->bound;
+ my %vars = %$vars if (ref $vars eq "HASH");
- $msgid =~ s/\r*\n\s*/ /xmsg if defined($msgid);
+ $self->_bind_domain($params->domain) unless $self->bound;
- return $self->_expand(dgettext($params->domain => $msgid), %vars) if $msgid;
- };
+ $msgid =~ s/\r*\n\s*/ /xmsg if defined($msgid);
- method 'pgettext' => sub
- {
- my ($self, $msgid, $msgctxt, $vars) = @_;
+ return $self->_expand(dgettext($params->domain => $msgid), %vars) if $msgid;
+ };
- my %vars = %$vars if (ref $vars eq "HASH");
+ method 'pgettext' => sub
+ {
+ my ($self, $msgid, $msgctxt, $vars) = @_;
- $self->_bind_domain($params->domain) unless $self->bound;
+ my %vars = %$vars if (ref $vars eq "HASH");
- $msgid =~ s/\r*\n\s*/ /xmsg if defined($msgid);
+ $self->_bind_domain($params->domain) unless $self->bound;
- return $self->_expand(dpgettext($params->domain => $msgctxt, $msgid), %vars) if $msgid;
- };
+ $msgid =~ s/\r*\n\s*/ /xmsg if defined($msgid);
- method 'ngettext' => sub
- {
- my ($self, $msgid, $msgid_plural, $n, $vars) = @_;
+ return $self->_expand(dpgettext($params->domain => $msgctxt, $msgid), %vars) if $msgid;
+ };
- my %vars = %$vars if (ref $vars eq "HASH");
+ method 'ngettext' => sub
+ {
+ my ($self, $msgid, $msgid_plural, $n, $vars) = @_;
- $self->_bind_domain($params->domain) unless $self->bound;
+ my %vars = %$vars if (ref $vars eq "HASH");
- $msgid =~ s/\r*\n\s*/ /xmsg if defined($msgid);
+ $self->_bind_domain($params->domain) unless $self->bound;
- return $self->_expand(dngettext($params->domain => $msgid, $msgid_plural, $n), %vars);
- };
+ $msgid =~ s/\r*\n\s*/ /xmsg if defined($msgid);
+
+ return $self->_expand(dngettext($params->domain => $msgid, $msgid_plural, $n), %vars);
+ };
};
diff --git a/lib/MusicBrainz/Server/Translation.pm b/lib/MusicBrainz/Server/Translation.pm
index ce7f69b..9796ce1 100644
--- a/lib/MusicBrainz/Server/Translation.pm
+++ b/lib/MusicBrainz/Server/Translation.pm
@@ -37,10 +37,23 @@ has 'bound' => (
default => 0
);
-sub N_l { __PACKAGE__->instance->nop_gettext(@_) }
-sub l { __PACKAGE__->instance->gettext(@_) }
-sub lp { __PACKAGE__->instance->pgettext(@_) }
-sub ln { __PACKAGE__->instance->ngettext(@_) }
+# N_ functions are no-ops which return their arguments
+# They only exist so the strings get into the catalogs
+# There is one for each because the call signatures
+# and what should appear in the catalogs differ.
+#
+# Normal translation, singular string.
+# Takes one string argument and optionally a hashref of arguments to interpolate
+sub l { __PACKAGE__->instance->gettext(@_) }
+sub N_l { __PACKAGE__->instance->nop_gettext(@_) }
+# Singular translation with context
+# Takes one string to translate, a string of context, and an optional hashref
+sub lp { __PACKAGE__->instance->pgettext(@_) }
+sub N_lp { __PACKAGE__->instance->nop_gettext(@_) }
+# Plural translation (context can be within the string)
+# Takes a singlular string, a plural string, and an optional hashref
+sub ln { __PACKAGE__->instance->ngettext(@_) }
+sub N_ln { __PACKAGE__->instance->nop_ngettext(@_) }
sub _bind_domain
{
commit e45d57056871ca9a1b3039fc82bafe40dd9f78c3
Author: Ian McEwen <[email protected]>
Date: Sun Oct 7 16:42:24 2012 -0700
i18n: add contexts to autoeditor election statuses
diff --git a/lib/MusicBrainz/Server/Entity/AutoEditorElection.pm b/lib/MusicBrainz/Server/Entity/AutoEditorElection.pm
index 6d32dd7..f107bfd 100644
--- a/lib/MusicBrainz/Server/Entity/AutoEditorElection.pm
+++ b/lib/MusicBrainz/Server/Entity/AutoEditorElection.pm
@@ -5,7 +5,7 @@ use namespace::autoclean;
use MusicBrainz::Server::Entity::Types;
use MusicBrainz::Server::Constants qw( :election_status );
use MusicBrainz::Server::Types qw( DateTime AutoEditorElectionStatus );
-use MusicBrainz::Server::Translation qw( N_l );
+use MusicBrainz::Server::Translation qw( N_lp );
extends 'MusicBrainz::Server::Entity';
@@ -86,21 +86,21 @@ sub is_closed
# XXX not translatable
our %STATUS_NAMES = (
- $ELECTION_SECONDER_1 => N_l('Awaiting 1st seconder'),
- $ELECTION_SECONDER_2 => N_l('Awaiting 2nd seconder'),
- $ELECTION_OPEN => N_l('Voting open since {date}'),
- $ELECTION_ACCEPTED => N_l('Accepted at {date}'),
- $ELECTION_REJECTED => N_l('Declined at {date}'),
- $ELECTION_CANCELLED => N_l('Cancelled at {date}'),
+ $ELECTION_SECONDER_1 => N_lp('Awaiting 1st seconder', 'autoeditor election status'),
+ $ELECTION_SECONDER_2 => N_lp('Awaiting 2nd seconder', 'autoeditor election status'),
+ $ELECTION_OPEN => N_lp('Voting open since {date}', 'autoeditor election status'),
+ $ELECTION_ACCEPTED => N_lp('Accepted at {date}', 'autoeditor election status'),
+ $ELECTION_REJECTED => N_lp('Declined at {date}', 'autoeditor election status'),
+ $ELECTION_CANCELLED => N_lp('Cancelled at {date}', 'autoeditor election status'),
);
our %SHORT_STATUS_NAMES = (
- $ELECTION_SECONDER_1 => N_l('Awaiting 1st seconder'),
- $ELECTION_SECONDER_2 => N_l('Awaiting 2nd seconder'),
- $ELECTION_OPEN => N_l('Voting open'),
- $ELECTION_ACCEPTED => N_l('Accepted'),
- $ELECTION_REJECTED => N_l('Declined'),
- $ELECTION_CANCELLED => N_l('Cancelled'),
+ $ELECTION_SECONDER_1 => N_lp('Awaiting 1st seconder', 'autoeditor election status (short)'),
+ $ELECTION_SECONDER_2 => N_lp('Awaiting 2nd seconder', 'autoeditor election status (short)'),
+ $ELECTION_OPEN => N_lp('Voting open', 'autoeditor election status (short)'),
+ $ELECTION_ACCEPTED => N_lp('Accepted', 'autoeditor election status (short)'),
+ $ELECTION_REJECTED => N_lp('Declined', 'autoeditor election status (short)'),
+ $ELECTION_CANCELLED => N_lp('Cancelled', 'autoeditor election status (short)'),
);
sub status_name
diff --git a/root/elections/index.tt b/root/elections/index.tt
index 8540f71..1a41926 100644
--- a/root/elections/index.tt
+++ b/root/elections/index.tt
@@ -17,7 +17,7 @@
[%- FOR election IN elections -%]
<tr[% ' class="ev"' IF loop.count % 2 == 0 %]>
<td>[% link_editor(election.candidate) %]</td>
- <td>[% l(election.status_name_short) %]</td>
+ <td>[% lp(election.status_name_short, 'autoeditor election status (short)') %]</td>
<td>[% UserDate.format(election.propose_time) %]</td>
<td>[% IF election.close_time %][% UserDate.format(election.close_time) %][% ELSE %]-[% END %]</td>
<td><a href="[% c.uri_for_action("/elections/show", [ election.id ]) %]">[% l('View details') %]</a></td>
diff --git a/root/elections/show.tt b/root/elections/show.tt
index 805d356..d241c7b 100644
--- a/root/elections/show.tt
+++ b/root/elections/show.tt
@@ -39,18 +39,18 @@
<dd>
[% IF election.is_open || election.is_pending %]
[% IF election.is_open;
- l(election.status_name, { date => UserDate.format(election.open_time) }) | html;
+ lp(election.status_name, 'autoeditor election status', { date => UserDate.format(election.open_time) }) | html;
ELSIF election.is_pending;
- l(election.status_name) | html;
+ lp(election.status_name, 'autoeditor election status') | html;
END %] ([%- expiration_time(election.current_expiration_time) -%])
[% ELSIF election.is_closed %]
[%- IF election.close_time -%]
- [% l(election.status_name, { date => UserDate.format(election.close_time) }) | html %]
+ [% lp(election.status_name, 'autoeditor election status', { date => UserDate.format(election.close_time) }) | html %]
[%- ELSE -%]
- [% l(election.status_name_short) | html %]
+ [% lp(election.status_name_short, 'autoeditor election status (short)') | html %]
[%- END -%]
[% ELSE %]
- [% l(election.status_name) | html %]
+ [% lp(election.status_name, 'autoeditor election status') | html %]
[% END %]
</dd>
</dl>
commit a8c30a6e8a8cded736cd8e7ac595a9ce6695a774
Merge: 8fdb7ba 978cd72
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:15:01 2012 -0700
Merge branch 'mbs-5206-purge-classical-gc' into beta
commit 8fdb7babc1e13cd1a0545d9fce6c118fdec7f9f2
Merge: 2a4fb58 3f7ff55
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:14:55 2012 -0700
Merge branch 'mbs-5456-middle-click-event' into beta
commit 2a4fb5811d7f78dc0070821e6fb7544871e2fa2c
Merge: 63da3f2 99fe39c
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:14:49 2012 -0700
Merge branch 'mbs-5454-broken-doc-link' into beta
commit 63da3f207595ca755727dd27bf1f61d4b8445a75
Merge: 6535477 df62691
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:14:43 2012 -0700
Merge branch 'mbs-5292-index-listing-view' into beta
commit 6535477a0716780760bf0a04dbc52f25c8dc60ca
Merge: 5319341 02426ca
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:14:35 2012 -0700
Merge branch 'mbs-5488-5489-ssl-coverart' into beta
commit 531934141169ec6319ff9591c074dbc06f09fdc6
Merge: 4705a4f 95a1471
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:14:30 2012 -0700
Merge branch 'mbs-5471-RE-recording-search' into beta
commit 4705a4fcb0b606b3eb18cffafb6360832cfade3d
Merge: 7682138 c56ac70
Author: Ian McEwen <[email protected]>
Date: Tue Oct 30 13:14:24 2012 -0700
Merge branch 'mbs-5464-blog-cache' into beta
commit 02426cad487eba91f9cb474306deb33ed02be03b
Author: Ian McEwen <[email protected]>
Date: Mon Oct 29 15:48:39 2012 -0700
MBS-5488/5489: collapse amazon and generic https cleanups into one filter
diff --git a/lib/MusicBrainz/Server.pm b/lib/MusicBrainz/Server.pm
index 615def9..3ad051e 100644
--- a/lib/MusicBrainz/Server.pm
+++ b/lib/MusicBrainz/Server.pm
@@ -58,7 +58,6 @@ __PACKAGE__->config(
'language' => \&MusicBrainz::Server::Filters::language,
'locale' => \&MusicBrainz::Server::Filters::locale,
'gravatar' => \&MusicBrainz::Server::Filters::gravatar,
- 'amazon_https' => \&MusicBrainz::Server::Filters::amazon_https,
'coverart_https' => \&MusicBrainz::Server::Filters::coverart_https
},
RECURSION => 1,
diff --git a/lib/MusicBrainz/Server/Filters.pm b/lib/MusicBrainz/Server/Filters.pm
index a511e0e..4c567d0 100644
--- a/lib/MusicBrainz/Server/Filters.pm
+++ b/lib/MusicBrainz/Server/Filters.pm
@@ -221,17 +221,24 @@ sub gravatar {
return sprintf '//gravatar.com/avatar/%s?d=mm', md5_hex(lc(trim($email)));
}
-sub amazon_https {
+sub _amazon_https {
my $url = shift;
$url =~ s,http://ecx\.images-amazon\.com/,https://images-na.ssl-images-amazon.com/,;
return $url;
}
-sub coverart_https {
+sub _generic_https {
my $url = shift;
# list only those sites that support https
$url =~ s,http://(www\.cdbaby\.com|www\.ozon\.ru|www\.archive\.org)/,https://$1/,;
return $url;
}
+sub coverart_https {
+ my $url = shift;
+ $url = _amazon_https($url);
+ $url = _generic_https($url);
+ return $url;
+}
+
1;
diff --git a/root/components/common-macros.tt b/root/components/common-macros.tt
index f70dc96..9355756 100644
--- a/root/components/common-macros.tt
+++ b/root/components/common-macros.tt
@@ -117,7 +117,7 @@ END; -%]
[%- MACRO cover_art_url(url) BLOCK;
IF c.req.secure;
- url | amazon_https | coverart_https;
+ url | coverart_https;
ELSE;
url;
END;
commit c56ac700a26540d5e391ecfb48a89db44ce23eba
Author: Ian McEwen <[email protected]>
Date: Mon Oct 29 15:25:04 2012 -0700
MBS-5464: change blog cache to 3 hours
diff --git a/lib/MusicBrainz/Server/Data/Blog.pm b/lib/MusicBrainz/Server/Data/Blog.pm
index 4655b5a..32f7c24 100644
--- a/lib/MusicBrainz/Server/Data/Blog.pm
+++ b/lib/MusicBrainz/Server/Data/Blog.pm
@@ -8,7 +8,7 @@ use Try::Tiny;
with 'MusicBrainz::Server::Data::Role::Context';
-Readonly my $BLOG_CACHE_TIMEOUT => 60 * 60 * 24; # 1 day
+Readonly my $BLOG_CACHE_TIMEOUT => 60 * 60 * 3; # 3 hours
sub get_latest_entries {
my ($self) = @_;
commit 95a14716a0547b02afc86c73016c6958b9440485
Author: Ian McEwen <[email protected]>
Date: Mon Oct 29 15:22:56 2012 -0700
MBS-5471: move guard inside function
diff --git a/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js b/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js
index a5499bc..9445f43 100644
--- a/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js
+++ b/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js
@@ -35,35 +35,36 @@ MB.Control.ReleaseRecordingsSelect = function ($container, artistname, callback)
self.$comment = self.$container.find ('tr.clientmatch span.comment');
self.renderReleaseGroups = function ($target, gid, rgs) {
+ if (rgs) {
+ $target.empty ();
- $target.empty ();
+ var first = true;
+ $.each (rgs.results, function (idx, item) {
+ var a;
- var first = true;
- $.each (rgs.results, function (idx, item) {
- var a;
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ $target.append (", ");
+ }
- if (first)
- {
- first = false;
- }
- else
- {
- $target.append (", ");
- }
+ a = '<a target="_blank" href="/release-group/' + item.gid +
+ '">' + MB.utility.escapeHTML (item.name) + '</a>';
- a = '<a target="_blank" href="/release-group/' + item.gid +
- '">' + MB.utility.escapeHTML (item.name) + '</a>';
+ $target.append ($(a));
+ });
- $target.append ($(a));
- });
+ if (rgs.hits > rgs.results.length)
+ {
+ $target.append (
+ $('<a target="_blank" href="/recording/' + gid + '/">...</a>'));
+ }
- if (rgs.hits > rgs.results.length)
- {
- $target.append (
- $('<a target="_blank" href="/recording/' + gid + '/">...</a>'));
+ return rgs.results.length;
}
-
- return rgs.results.length;
};
self.selected = function (event) {
@@ -78,9 +79,7 @@ MB.Control.ReleaseRecordingsSelect = function ($container, artistname, callback)
self.$gid.val (data.gid);
self.$artist.text (data.artist);
self.$length.text (data.length);
- if (data.appears_on) {
- self.renderReleaseGroups (self.$appears, data.gid, data.appears_on);
- }
+ self.renderReleaseGroups (self.$appears, data.gid, data.appears_on);
self.$container.find ('tr.clientmatch').show ();
@@ -330,15 +329,13 @@ MB.Control.ReleaseRecordingsDisc = function (parent, disc, fieldset) {
var rr_track = MB.Control.ReleaseRecordingsTrack (self, disc, idx, $track.eq(0));
self.tracks.push (rr_track);
- if (trk.recording.appears_on) {
- var appears = rr_track.select.renderReleaseGroups (
- $bubble.find ('tr.servermatch span.appears'),
- trk.recording.gid, trk.recording.appears_on);
+ var appears = rr_track.select.renderReleaseGroups (
+ $bubble.find ('tr.servermatch span.appears'),
+ trk.recording.gid, trk.recording.appears_on);
- if (appears)
- {
- $bubble.find ('tr.servermatch.releaselist').show ();
- }
+ if (appears)
+ {
+ $bubble.find ('tr.servermatch.releaselist').show ();
}
$bubble.find ('input.servermatch').attr ('checked', true).trigger ('change');
commit 3f7ff55f5e47d9cd4fb1cce3c5ea858012417b20
Author: Ian McEwen <[email protected]>
Date: Sat Oct 20 14:00:35 2012 -0700
MBS-5456: fire the url-changed function on input/propertychange events to catch more cases
diff --git a/root/static/scripts/edit/MB/Control/URLCleanup.js b/root/static/scripts/edit/MB/Control/URLCleanup.js
index b8d7e2e..b08abab 100644
--- a/root/static/scripts/edit/MB/Control/URLCleanup.js
+++ b/root/static/scripts/edit/MB/Control/URLCleanup.js
@@ -519,7 +519,8 @@ MB.Control.URLCleanup = function (sourceType, typeControl, urlControl) {
self.urlControl
.change(urlChanged)
- .keyup(urlChanged);
+ .keyup(urlChanged)
+ .bind('input propertychange', urlChanged);
self.urlControl.parents('form').submit(urlChanged);
commit 99fe39cb66fca9edb677f9ac5b68b38665aafe9d
Author: Ian McEwen <[email protected]>
Date: Sat Oct 20 02:52:10 2012 -0700
MBS-5454: remove link to nonexistent docs, preferring more useful/general inline docs
diff --git a/root/recording/delete.tt b/root/recording/delete.tt
index 8d44ea1..885084b 100644
--- a/root/recording/delete.tt
+++ b/root/recording/delete.tt
@@ -2,7 +2,8 @@
<h2>[% l('Remove Recording') %]</h2>
[%- IF can_delete -%]
[%- WRAPPER 'layout/guidelines.tt' -%]
- [%- create_guideline(l('Please review the {doc_remove|remove recording edit-type} documentation before entering this edit.', {doc_remove => doc_link('Remove_Recording_Edit')})) -%]
+ [%- create_guideline(l('Please make sure you\'re not removing a legitimate {doc_standalone|standalone recording}. If this recording duplicates another, please {doc_merge|merge rather than delete}.',
+ {doc_standalone => doc_link('Standalone_Recording'), doc_merge => doc_link('Merge_Rather_Than_Delete')})) -%]
[%- END -%]
<p>
[%- l('Are you sure you wish to remove the recording {recording} from MusicBrainz?', { recording => link_entity(recording) }) -%]
commit 2204dd36f7e56686cdef4f1efde972a8055ca01e
Author: Ian McEwen <[email protected]>
Date: Thu Oct 18 01:51:07 2012 -0700
MBS-5464: expire the blog:entries cache key after 24 hours
diff --git a/lib/MusicBrainz/Server/Data/Blog.pm b/lib/MusicBrainz/Server/Data/Blog.pm
index 1c7d20e..4655b5a 100644
--- a/lib/MusicBrainz/Server/Data/Blog.pm
+++ b/lib/MusicBrainz/Server/Data/Blog.pm
@@ -2,11 +2,14 @@ package MusicBrainz::Server::Data::Blog;
use Moose;
use namespace::autoclean;
+use Readonly;
use XML::RSS::Parser::Lite;
use Try::Tiny;
with 'MusicBrainz::Server::Data::Role::Context';
+Readonly my $BLOG_CACHE_TIMEOUT => 60 * 60 * 24; # 1 day
+
sub get_latest_entries {
my ($self) = @_;
@@ -24,7 +27,7 @@ sub get_latest_entries {
$entry_parser = XML::RSS::Parser::Lite->new;
$entry_parser->parse($xml->content);
- $cache->set($key => $entry_parser);
+ $cache->set($key => $entry_parser, $BLOG_CACHE_TIMEOUT);
}
return $entry_parser;
commit df6269130c644a2af247d5a3ac1d76305ecb8bcb
Author: Ian McEwen <[email protected]>
Date: Wed Oct 17 22:37:36 2012 -0700
MBS-5292: for the sake of mirrors without edits, use an outer join in creating index_listing
* Previously, we did an inner join on the edit table, which meant that
mirrors that did not import the edit table simply got no results.
* Since this view is used to display cover art on the release coverart
page, this is very inconvenient.
* Where edits exist, this will not behave differently; where they
aren't, the view won't accurately show the approved vs. not-approved
values for pieces of art, but otherwise the display will be the same.
diff --git a/admin/sql/caa/CreateViews.sql b/admin/sql/caa/CreateViews.sql
index a014219..a96a329 100644
--- a/admin/sql/caa/CreateViews.sql
+++ b/admin/sql/caa/CreateViews.sql
@@ -22,6 +22,6 @@ SELECT cover_art.*,
JOIN cover_art_archive.art_type ON cover_art_type.type_id = art_type.id
WHERE cover_art_type.id = cover_art.id) AS types
FROM cover_art_archive.cover_art
-JOIN musicbrainz.edit ON edit.id = cover_art.edit;
+LEFT JOIN musicbrainz.edit ON edit.id = cover_art.edit;
COMMIT;
commit 3b7f76f1230cfb3e7a90130df02335dcf92ab98a
Author: Ian McEwen <[email protected]>
Date: Wed Oct 17 02:00:17 2012 -0700
MBS-5471: ReleaseRecordings.js' renderReleaseGroups is erroring; therefore, we conditionalize it
diff --git a/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js b/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js
index 89d62b6..a5499bc 100644
--- a/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js
+++ b/root/static/scripts/release-editor/MB/Control/ReleaseRecordings.js
@@ -78,7 +78,9 @@ MB.Control.ReleaseRecordingsSelect = function ($container, artistname, callback)
self.$gid.val (data.gid);
self.$artist.text (data.artist);
self.$length.text (data.length);
- self.renderReleaseGroups (self.$appears, data.gid, data.appears_on);
+ if (data.appears_on) {
+ self.renderReleaseGroups (self.$appears, data.gid, data.appears_on);
+ }
self.$container.find ('tr.clientmatch').show ();
@@ -328,13 +330,15 @@ MB.Control.ReleaseRecordingsDisc = function (parent, disc, fieldset) {
var rr_track = MB.Control.ReleaseRecordingsTrack (self, disc, idx, $track.eq(0));
self.tracks.push (rr_track);
- var appears = rr_track.select.renderReleaseGroups (
- $bubble.find ('tr.servermatch span.appears'),
- trk.recording.gid, trk.recording.appears_on);
+ if (trk.recording.appears_on) {
+ var appears = rr_track.select.renderReleaseGroups (
+ $bubble.find ('tr.servermatch span.appears'),
+ trk.recording.gid, trk.recording.appears_on);
- if (appears)
- {
- $bubble.find ('tr.servermatch.releaselist').show ();
+ if (appears)
+ {
+ $bubble.find ('tr.servermatch.releaselist').show ();
+ }
}
$bubble.find ('input.servermatch').attr ('checked', true).trigger ('change');
commit 978cd72ba777b7c548c027752745f9df188b18cd
Author: Ian McEwen <[email protected]>
Date: Fri Oct 12 02:14:10 2012 -0700
MBS-5206: Classical Guess Case: die die die
diff --git a/root/static/scripts/guess-case/MB/GuessCase/Mode/Classical.js b/root/static/scripts/guess-case/MB/GuessCase/Mode/Classical.js
deleted file mode 100644
index 61eccde..0000000
--- a/root/static/scripts/guess-case/MB/GuessCase/Mode/Classical.js
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- This file is part of MusicBrainz, the open internet music database.
- Copyright (c) 2005 Stefan Kestenholz (keschte)
- Copyright (C) 2010 MetaBrainz Foundation
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-MB.GuessCase = (MB.GuessCase) ? MB.GuessCase : {};
-MB.GuessCase.Mode = (MB.GuessCase.Mode) ? MB.GuessCase.Mode : {};
-
-// Tests:
-// ---
-// Piano concerto "test" in b-flat minor, No. 2 opuss 2
-// Test in b minor, No. 2 opuss 2
-// Test in b flat minor, No. 2 opuss 2
-// Test "Asdf" in Bb major, BWV 12 2. test
-// Piano concerto "Test" in A# major No #2 Opus 2 14. murggs
-
-/**
- * Models the "Classical" GuessCase mode.
- **/
-MB.GuessCase.Mode.Classical = function () {
- var self = MB.GuessCase.Mode.Base ();
-
- self.setConfig(
- 'Classical',
- 'First word titled, lowercase for <i>most</i> of the other '
- + 'words. Read the [url]description[/url] for more details.',
- '/doc/GuessCaseMode/ClassicalMode');
-
- self.getUpperCaseWords = function() {
- return [ "bwv", "d", "rv", "j", "hob", "hwv", "wwo", "kv" ];
- };
-
- /**
- * Handle all the classical mode specific quirks.
- * Note: this function is run before release and track guess
- * types (not for artist)
- **/
- self.preProcessTitles = function(is) {
-
- if (!gc.re.PREPROCESS_FIXLIST_XC) {
- gc.re.PREPROCESS_FIXLIST_XC = [
-
- // correct tone indication.
- , self.fix ("Handle -sharp.", /(\b)(\s|-)sharp(\s)/i, "-sharp")
- , self.fix ("Handle -flat.", /(\b)(\s|-)flat(\s)/i, "-flat")
-
- // expand short tone notation. maybe restrict
- // to uppercase tone only?
- , self.fix ("Expand C# -> C-sharp", /(\s[ACDFG])#(\s)/i, "-sharp")
- , self.fix ("Expand Cb -> C-flat", /(\s[ABCDEG])b(\s)/i, "-flat")
-
- // common misspellings
- , self.fix ("adiago (adagio)", "adiago", "adagio")
- , self.fix ("pocco (poco)", "pocco", "poco"),
- , self.fix ("contabile (cantabile)", "contabile", "cantabile")
- , self.fix ("sherzo (scherzo)", "sherzo", "scherzo")
- , self.fix ("allergro (allegro)", "allergro", "allegro")
- , self.fix ("adante (andante)", "adante", "andante")
- , self.fix ("largetto (larghetto)", "largetto", "larghetto")
- , self.fix ("allgro (allegro)", "allgro", "allegro")
- , self.fix ("tocatta (toccata)", "tocatta", "toccata")
- , self.fix ("allegreto (allegretto)", "allegreto", "allegretto")
- , self.fix ("attaca (attacca)", "attaca", "attacca")
-
- // detect one word combinations of work numbers and their number
- , self.fix ("split worknumber combination", /(\b)(BWV|D|RV|J|Hob|HWV|WwO|KV)(\d+)(\b|$)/i, "$2 $3")
-
- // detect one word combinations of work numbers and their number
- , self.fix ("split op. number combination", /(\b)(Op)(\d+)(\b|$)/i, "$2 $3")
- , self.fix ("split no. number combination", /(\b)(No|N)(\d+)(\b|$)/i, "$2 $3")
- ];
- }
-
- return self.runFixes(is, gc.re.PREPROCESS_FIXLIST_XC);
- };
-
- /**
- * Handle all the classical mode specific quirks.
- * Note: this function is run before release and track guess
- * types (not for artist)
- **/
- self.runPostProcess = function(is) {
-
- if (!gc.re.POSTPROCESS_FIXLIST_XC) {
- gc.re.POSTPROCESS_FIXLIST_XC = [
-
- // correct opus/number
- , self.fix ("Handle Op.", /(\b)[\s,]+(Op|Opus|Opera)[\s\.#]+($|\b)/i, ", Op. " )
- , self.fix ("Handle No.", /(\b)[\s,]+(N|No|Num|Nr)[\s\.#]+($|\b)/i, ", No. " )
-
- // correct K. -> KV
- , self.fix ("Handle K. -> KV", /(\b)[\s,]+K[\.\s]+($|\b)/i, ", KV " )
-
- // correct whitespace and comma for work catalog
- // BWV D RV J Hob HWV WwO (Work without Opera) KV
- , self.fix ("Fix whitespace and comma for work catalog", /(\b)[\s,]+(BWV|D|RV|J|Hob|HWV|WwO|KV)\s($|\b)/i, ", $2 " )
-
- // correct tone indication
- , self.fix ("Handle -sharp.", /(\b)(\s|-)sharp(\s)/i, "-sharp")
- , self.fix ("Handle -flat.", /(\b)(\s|-)flat(\s)/i, "-flat")
- ];
- }
-
- return self.runFixes(is, gc.re.POSTPROCESS_FIXLIST_XC);
- };
-
- /**
- * Classical mode specific replacements of movement numbers.
- * - Converts decimal numbers (followed by a dot) to roman numerals.
- * - Adds a colon before existing roman numerals
- **/
- self.runFinalChecks = function(is) {
-
- if (!gc.re.DECIMALTOROMAN) {
- gc.re.DECIMALTOROMAN = /[\s,:\-]+(\d+)\.[\s]+/i;
- }
- var matcher = null
- var os = is;
- if ((matcher = os.match(gc.re.DECIMALTOROMAN)) != null) {
- var mindex = matcher.index;
- var mlenght = matcher[0].length;
- var firstPart = os.substring(0, mindex);
- var lastPart = os.substring(mindex + mlenght, os.length);
- var parts = []; // compile the vinyl designation.
-
- // strip trailing punctuation from first part, colon is added afterwards.
- firstPart = firstPart.replace(/[\s,:\-\/]+$/gi, "");
-
- parts.push(firstPart); // add string before the matched part
- parts.push(": "); // add colon
- parts.push(gc.u.convertToRomanNumeral(matcher[1])); // add roman representation.
- parts.push(". "); // add dot after roman numeral
- parts.push(lastPart); // add string after the matched part
- os = parts.join("");
- }
-
- // add a leading colon to a roman numeral
- // if there is none.
- if (!gc.re.ADD_COLON_TO_ROMAN) {
- gc.re.ADD_COLON_TO_ROMAN = /([^:])\s+([ivx]+)[\s|\.]+/i;
- }
- if ((matcher = os.match(gc.re.ADD_COLON_TO_ROMAN)) != null) {
- var mindex = matcher.index;
- var mlenght = matcher[0].length;
- var firstPart = os.substring(0, mindex);
- var lastPart = os.substring(mindex + mlenght, os.length);
- var parts = []; // compile the vinyl designation.
- parts.push(firstPart); // add string before the matched part
- parts.push(matcher[1]); // re-add the first match that was _not_ a colon.
- parts.push(": "); // add colon
- parts.push(matcher[2]); // re-add roman numeral
- parts.push(". "); // add dot after roman numeral
- parts.push(lastPart); // add string after the matched part
- os = parts.join("");
- }
-
- return os;
- };
-
- /**
- * Delegate function for Mode specific word handling.
- * This is mostly used for context based titling changes.
- *
- * @return false, such that the normal word handling can
- * take place for the current word, if that should
- * not be done, return true.
- **/
- self.doWord = function() {
-
- var ipos = gc.i.getPos();
- var cw = gc.i.getCurrentWord();
- var pw = gc.i.getWordAtIndex(ipos-1);
- var ppw = gc.i.getPreviousWord(ipos-2);
- var opos = gc.o.getLength();
- var foundToneIndication = false;
-
- // if the current word is one of flat|sharp, and the
- // previous word is a hyphen, title the word before
- // is a tone indication.
- if (cw.match(/flat|sharp/i) && pw == "-") {
- opos = opos-2;
- foundToneIndication = true;
-
- // if the current word is one of the major|minor variants
- // and the word before the previous is not flat|sharp,
- // the word before is a tone indication.
- } else if (cw.match(/minor|major|minore|maggiore|mineur/i) &&
- ppw.match(/flat|sharp/) == null) {
- opos = opos-1;
- foundToneIndication = true;
-
- // if the current word is one of the german variants
- // the word before is a tone indication.
- } else if (cw.match(/Moll|Dur/i)) {
- opos = opos-2;
- gc.f.forceCaps = true;
- foundToneIndication = true;
- }
- if (foundToneIndication) {
- var w = gc.o.getWordAtIndex(opos);
-
- gc.o.capitalizeWordAtIndex(opos, true);
- }
-
- return false;
- };
-
- return self;
-};
diff --git a/root/static/scripts/guess-case/MB/GuessCase/Modes.js b/root/static/scripts/guess-case/MB/GuessCase/Modes.js
index 96edea2..3eda210 100644
--- a/root/static/scripts/guess-case/MB/GuessCase/Modes.js
+++ b/root/static/scripts/guess-case/MB/GuessCase/Modes.js
@@ -64,7 +64,7 @@ MB.GuessCase.Modes = function (language) {
self.dropdown = $('#gc-mode');
self.dropdown.empty ();
- $.each (['English', 'Sentence', 'French', 'Classical'], function (idx, mode) {
+ $.each (['English', 'Sentence', 'French'], function (idx, mode) {
if (typeof MB.GuessCase.Mode[mode] !== "undefined")
{
self.modes.push (MB.GuessCase.Mode[mode] (self));
diff --git a/root/static/scripts/tests/GuessCase.js b/root/static/scripts/tests/GuessCase.js
index 3959741..71ed76b 100644
--- a/root/static/scripts/tests/GuessCase.js
+++ b/root/static/scripts/tests/GuessCase.js
@@ -151,11 +151,6 @@ MB.tests.GuessCase.Modes = function() {
mode: "French", roman: false, keepuppercase: false
},
{
- input: "Concerto d-Moll nach Antonio Vivaldi op 3 nr 11 bwv596: V. allergro",
- expected: "Concerto D-Moll nach antonio vivaldi, Op. 3, No. 11, BWV 596: V. Allegro",
- mode: "Classical", roman: true, keepuppercase: false
- },
- {
input: "American Way ft. Kelis",
expected: "American Way (feat. Kelis)",
mode: "English", roman: true, keepuppercase: false
diff --git a/root/static/scripts/tests/all.html b/root/static/scripts/tests/all.html
index e0ec2d5..58d4e4a 100644
--- a/root/static/scripts/tests/all.html
+++ b/root/static/scripts/tests/all.html
@@ -23,7 +23,6 @@
<script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Handler/Work.js"></script>
<script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Mode/Artist.js"></script>
<script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Mode/Base.js"></script>
- <script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Mode/Classical.js"></script>
<script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Mode/English.js"></script>
<script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Mode/French.js"></script>
<script type="text/javascript" charset="utf-8" src="../guess-case/MB/GuessCase/Mode/Sentence.js"></script>
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server