[mb-commits] branch, beta, updated. Merge remote-tracking branch 'navap/mbs-5288-mediawiki-api' into beta MBS-528...
MusicBrainz Git Server <[email protected]>
| Newsgroups | gmane.comp.audio.musicbrainz.cvs |
|---|---|
| Message-ID | <E1TiNes-00024f-5C@wiley> |
The branch, beta has been updated
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=6e3ab21b83217ae87cb6070f1aa7e29e30644985 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=5e33a8a5a45d29370ac17e6971e25fa097ce0c2b (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=df36c4c6cb43233546e793c5b624f531e3a3920b (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=1fecf9a26fdc60e49d9e64c980e91c480a7d4361 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=e3ad930fcfc5bb89cd9b144cfb45fc015a9ceb08 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=78c6355bea3bd8bc5a0a1063ec57f862dbd24cd7 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=5f9d8852579fa4a8868c3b7ff7a35c7761482e23 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=ddcbc529ef700c032be08871bfe8d19285d2d31b (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=31aa5f7e064a34f414c237e601ef7aab4f529e01 (commit)
via http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=642022a2be24684eb246e7cd9bbd4dd2e794141d (commit)
from http://git.musicbrainz.org/gitweb/?p=musicbrainz-server/core.git;a=commit;h=9e92f83f4ad82c0d7c3a29d441b66811be287dd8 (commit)
Summary of changes:
lib/DBDefs/Default.pm | 2 +-
lib/MusicBrainz/Server/Controller/Admin/WikiDoc.pm | 11 +-
.../Server/Controller/WS/js/WikiDocVersion.pm | 39 ------
lib/MusicBrainz/Server/Data/WikiDoc.pm | 24 ----
lib/MusicBrainz/Server/Data/WikiDocIndex.pm | 12 +-
root/admin/wikidoc/index.tt | 129 ++++++-------------
6 files changed, 53 insertions(+), 164 deletions(-)
delete mode 100644 lib/MusicBrainz/Server/Controller/WS/js/WikiDocVersion.pm
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 6e3ab21b83217ae87cb6070f1aa7e29e30644985
Merge: 9e92f83 5e33a8a
Author: Oliver Charles <[email protected]>
Date: Tue Dec 11 11:05:20 2012 +0000
Merge remote-tracking branch 'navap/mbs-5288-mediawiki-api' into beta
* navap/mbs-5288-mediawiki-api:
MBS-5288: Update based on review feedback
Use natatime instead of splice
Use sort_by instead of a for loop
Always show actions to transclusion editors
Fix doc links
Make it clear what's wrong
Only show transclusion notice to transclusion editors
MBS-5228: (Re)implement MediaWiki API for transclusion table
commit 5e33a8a5a45d29370ac17e6971e25fa097ce0c2b
Author: Pavan Chander <[email protected]>
Date: Sat Dec 1 19:45:20 2012 -0500
MBS-5288: Update based on review feedback
diff --git a/root/admin/wikidoc/index.tt b/root/admin/wikidoc/index.tt
index ae086ac..bf0ddb7 100644
--- a/root/admin/wikidoc/index.tt
+++ b/root/admin/wikidoc/index.tt
@@ -18,12 +18,12 @@
whatever page is associated with it. Make sure to double check your work
when updating a page!') %]
</p>
+ [% END %]
- [% IF wiki_unreachable %]
- <p style="font-weight: bold; color: red;">
- [% l('There was a problem accessing the wiki API.') %]
- </p>
- [% END %]
+ [% IF wiki_unreachable %]
+ <p style="font-weight: bold; color: red;">
+ [% l('There was a problem accessing the wiki API.') %]
+ </p>
[% END %]
<table class="tbl wiki-pages">
@@ -31,8 +31,8 @@
<tr>
<th>[% l('Page name') %]</th>
<th class="c">[% l('Transcluded version') %]</th>
- [% IF c.user.is_wiki_transcluder %]
<th class="c">[% l('Wiki version') %]</th>
+ [% IF c.user.is_wiki_transcluder %]
<th class="c">[% l('Actions') %]</th>
[% END %]
</tr>
@@ -44,18 +44,18 @@
<td class="c transcluded-version"[% ' style="text-align:right"' IF updates_required && c.user.is_wiki_transcluder %]>
[% page.version %]
</td>
- [% IF c.user.is_wiki_transcluder %]
- <td>
- [% IF page.wiki_version != page.version %]
- <span style="color: red;" class="wiki-version">
- [%~ page.wiki_version || l('Error!') ~%]
- </span>
- [% IF page.wiki_version && (page.wiki_version != page.version) %]
- (<a href="http://[% wiki_server %]/[% page.id | html %]?diff=[% page.wiki_version %]&oldid=[% page.version %]">[% l('diff') %]</a>)
- [% END %]
+ <td>
+ [% IF page.wiki_version != page.version %]
+ <span style="color: red;" class="wiki-version">
+ [%~ page.wiki_version || l('Error!') ~%]
+ </span>
+ [% IF page.wiki_version && (page.wiki_version != page.version) %]
+ (<a href="http://[% wiki_server %]/[% page.id | html %]?diff=[% page.wiki_version %]&oldid=[% page.version %]">[% l('diff') %]</a>)
[% END %]
- </td>
+ [% END %]
+ </td>
+ [% IF c.user.is_wiki_transcluder %]
<td class="c nowrap">
[
<a href="[% c.uri_for_action('/admin/wikidoc/edit', { page => page.id }) | html %]">[% l('Update') %]</a> |
commit df36c4c6cb43233546e793c5b624f531e3a3920b
Merge: 1fecf9a 667064e
Author: Pavan Chander <[email protected]>
Date: Sat Dec 1 19:01:02 2012 -0500
Merge branch 'master' into mbs-5288-mediawiki-api
Conflicts:
lib/MusicBrainz/Server/Controller/WS/js/WikiDocVersion.pm
lib/MusicBrainz/Server/Data/WikiDoc.pm
lib/MusicBrainz/Server/Data/WikiDocIndex.pm
diff --cc lib/DBDefs/Default.pm
index 2b14927,e160034..f17b613
--- a/lib/DBDefs/Default.pm
+++ b/lib/DBDefs/Default.pm
@@@ -157,9 -120,9 +120,9 @@@ sub WIKITRANS_SERVER { "wiki.musicb
# The path to MediaWiki's api.php file. This is required to automatically
# determine which documentation pages need to be updated in the
# transclusion table.
-sub WIKITRANS_SERVER_API { "wiki.musicbrainz.org/-/api.php" }
+sub WIKITRANS_SERVER_API { "wiki.musicbrainz.org/api.php" }
- sub WIKITRANS_INDEX_FILE { MB_SERVER_ROOT() . "/root/static/wikidocs/index.txt" }
+ sub WIKITRANS_INDEX_FILE { my $self = shift; $self->MB_SERVER_ROOT . "/root/static/wikidocs/index.txt" }
sub WIKITRANS_INDEX_URL { "http://musicbrainz.org/static/wikidocs/index.txt" }
# To enable documentation search on your server, create your own Google Custom
diff --cc lib/MusicBrainz/Server/Data/WikiDocIndex.pm
index 08b8621,0f902ac..fa87374
--- a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
@@@ -137,19 -135,19 +137,19 @@@ sub get_wiki_version
{
my ($self, $index) = @_;
- my @keys = keys %$index;
+ my @keys = sort_by { lc($_) } keys %$index;
my @wiki_pages;
- while (@keys) {
- # The API can only process 50 pages at a time, lets be conservative.
- my $query = join ('|', splice(@keys, 0, 40));
+ # Query the API with 50 pages at a time
+ my $it = natatime 50, @keys;
+ while (my @queries = $it->()) {
- if (!defined &DBDefs::WIKITRANS_SERVER_API) {
+ if (!defined DBDefs->WIKITRANS_SERVER_API) {
warn 'WIKITRANS_SERVER_API must be defined within DBDefs.pm';
return undef;
}
- my $doc_url = sprintf "http://%s?action=query&prop=info&format=xml&titles=%s", &DBDefs::WIKITRANS_SERVER_API, join('|', @queries);
- my $doc_url = sprintf "http://%s?action=query&prop=info&format=xml&titles=%s", DBDefs->WIKITRANS_SERVER_API, $query;
++ my $doc_url = sprintf "http://%s?action=query&prop=info&format=xml&titles=%s", DBDefs->WIKITRANS_SERVER_API, join('|', @queries);
my $ua = LWP::UserAgent->new(max_redirect => 0, timeout => 5);
$ua->env_proxy;
commit 1fecf9a26fdc60e49d9e64c980e91c480a7d4361
Author: Pavan Chander <[email protected]>
Date: Mon Oct 8 20:14:52 2012 -0400
Use natatime instead of splice
diff --git a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
index 0ce34c2..08b8621 100644
--- a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
@@ -4,6 +4,7 @@ use Moose;
use namespace::autoclean;
use Readonly;
use List::UtilsBy qw( sort_by );
+use List::MoreUtils qw ( natatime);
use LWP::Simple qw();
use LWP::UserAgent;
use XML::Simple;
@@ -139,15 +140,16 @@ sub get_wiki_versions
my @keys = sort_by { lc($_) } keys %$index;
my @wiki_pages;
- while (@keys) {
- my $query = join ('|', splice(@keys, 0, 50));
+ # Query the API with 50 pages at a time
+ my $it = natatime 50, @keys;
+ while (my @queries = $it->()) {
if (!defined &DBDefs::WIKITRANS_SERVER_API) {
warn 'WIKITRANS_SERVER_API must be defined within DBDefs.pm';
return undef;
}
- my $doc_url = sprintf "http://%s?action=query&prop=info&format=xml&titles=%s", &DBDefs::WIKITRANS_SERVER_API, $query;
+ my $doc_url = sprintf "http://%s?action=query&prop=info&format=xml&titles=%s", &DBDefs::WIKITRANS_SERVER_API, join('|', @queries);
my $ua = LWP::UserAgent->new(max_redirect => 0, timeout => 5);
$ua->env_proxy;
commit e3ad930fcfc5bb89cd9b144cfb45fc015a9ceb08
Author: Pavan Chander <[email protected]>
Date: Mon Oct 8 19:46:40 2012 -0400
Use sort_by instead of a for loop
diff --git a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
index 1cd8fd8..0ce34c2 100644
--- a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
@@ -3,6 +3,7 @@ package MusicBrainz::Server::Data::WikiDocIndex;
use Moose;
use namespace::autoclean;
use Readonly;
+use List::UtilsBy qw( sort_by );
use LWP::Simple qw();
use LWP::UserAgent;
use XML::Simple;
@@ -135,11 +136,7 @@ sub get_wiki_versions
{
my ($self, $index) = @_;
- my @keys;
- foreach my $key (sort { lc $a cmp lc $b } keys %$index) {
- push @keys, $key;
- }
-
+ my @keys = sort_by { lc($_) } keys %$index;
my @wiki_pages;
while (@keys) {
commit 78c6355bea3bd8bc5a0a1063ec57f862dbd24cd7
Author: Pavan Chander <[email protected]>
Date: Mon Oct 8 19:35:42 2012 -0400
Always show actions to transclusion editors
diff --git a/root/admin/wikidoc/index.tt b/root/admin/wikidoc/index.tt
index 999b4fd..ae086ac 100644
--- a/root/admin/wikidoc/index.tt
+++ b/root/admin/wikidoc/index.tt
@@ -32,11 +32,8 @@
<th>[% l('Page name') %]</th>
<th class="c">[% l('Transcluded version') %]</th>
[% IF c.user.is_wiki_transcluder %]
- [% IF updates_required %]
- <th class="c">[% l('Wiki version') %]</th>
- [% END %]
-
- <th class="c">[% l('Actions') %]</th>
+ <th class="c">[% l('Wiki version') %]</th>
+ <th class="c">[% l('Actions') %]</th>
[% END %]
</tr>
</thead>
@@ -48,18 +45,16 @@
[% page.version %]
</td>
[% IF c.user.is_wiki_transcluder %]
- [% IF updates_required %]
- <td>
- [% IF page.wiki_version != page.version %]
- <span style="color: red;" class="wiki-version">
- [%~ page.wiki_version || l('ERROR!') ~%]
- </span>
- [% IF page.wiki_version && (page.wiki_version != page.version) %]
- (<a href="http://[% wiki_server %]/[% page.id | uri %]?diff=[% page.wiki_version %]&oldid=[% page.version %]">[% l('diff') %]</a>)
- [% END %]
+ <td>
+ [% IF page.wiki_version != page.version %]
+ <span style="color: red;" class="wiki-version">
+ [%~ page.wiki_version || l('Error!') ~%]
+ </span>
+ [% IF page.wiki_version && (page.wiki_version != page.version) %]
+ (<a href="http://[% wiki_server %]/[% page.id | html %]?diff=[% page.wiki_version %]&oldid=[% page.version %]">[% l('diff') %]</a>)
[% END %]
- </td>
- [% END %]
+ [% END %]
+ </td>
<td class="c nowrap">
[
commit 5f9d8852579fa4a8868c3b7ff7a35c7761482e23
Author: Pavan Chander <[email protected]>
Date: Mon Oct 8 19:35:13 2012 -0400
Fix doc links
diff --git a/root/admin/wikidoc/index.tt b/root/admin/wikidoc/index.tt
index c8d5887..999b4fd 100644
--- a/root/admin/wikidoc/index.tt
+++ b/root/admin/wikidoc/index.tt
@@ -43,7 +43,7 @@
<tbody>
[% FOR page IN pages %]
<tr[% ' class="ev"' IF loop.count % 2 == 0 %]>
- <td class="title"><a href="[% c.uri_for_action('/doc/show', page.id) %]">[% page.id | html %]</a></td>
+ <td class="title"><a href="[% doc_link(page.id) %]">[% page.id | html %]</a></td>
<td class="c transcluded-version"[% ' style="text-align:right"' IF updates_required && c.user.is_wiki_transcluder %]>
[% page.version %]
</td>
commit ddcbc529ef700c032be08871bfe8d19285d2d31b
Author: Pavan Chander <[email protected]>
Date: Mon Oct 8 19:33:27 2012 -0400
Make it clear what's wrong
diff --git a/lib/MusicBrainz/Server/Controller/Admin/WikiDoc.pm b/lib/MusicBrainz/Server/Controller/Admin/WikiDoc.pm
index 14b3ef2..5c5f58a 100644
--- a/lib/MusicBrainz/Server/Controller/Admin/WikiDoc.pm
+++ b/lib/MusicBrainz/Server/Controller/Admin/WikiDoc.pm
@@ -25,18 +25,15 @@ sub index : Path Args(0)
if (defined $wiki_pages[$i] && $pages[$i]->{id} eq $wiki_pages[$i]->{id}) {
$pages[$i]->{wiki_version} = $wiki_pages[$i]->{wiki_version};
- # We want to know if updates are required so
- # that we can update the template accordingly.
+ # We want to know if updates are required so that we can update the template accordingly.
$updates_required = 1 if $pages[$i]->{version} != $pages[$i]->{wiki_version};
} else {
- # Should not reach here.
if ($wiki_pages[$i]->{id}) {
- # If we reached here there was a sorting problem.
+ # API returned data, but in a different order than expected
$c->log->error("'$pages[$i]->{id}' from the transclusion table doesn't match '$wiki_pages[$i]->{id}' from the wiki");
} else {
- # If we reached here there was a problem accessing the api data.
- # Enable updates_required to let the user know there was a problem.
- $updates_required = 1;
+ # Problem accessing the api data
+ $c->stash->{wiki_unreachable} = 1;
}
}
}
diff --git a/root/admin/wikidoc/index.tt b/root/admin/wikidoc/index.tt
index 2eec5de..c8d5887 100644
--- a/root/admin/wikidoc/index.tt
+++ b/root/admin/wikidoc/index.tt
@@ -18,6 +18,12 @@
whatever page is associated with it. Make sure to double check your work
when updating a page!') %]
</p>
+
+ [% IF wiki_unreachable %]
+ <p style="font-weight: bold; color: red;">
+ [% l('There was a problem accessing the wiki API.') %]
+ </p>
+ [% END %]
[% END %]
<table class="tbl wiki-pages">
commit 31aa5f7e064a34f414c237e601ef7aab4f529e01
Author: Pavan Chander <[email protected]>
Date: Mon Oct 8 19:32:06 2012 -0400
Only show transclusion notice to transclusion editors
diff --git a/root/admin/wikidoc/index.tt b/root/admin/wikidoc/index.tt
index b29c048..2eec5de 100644
--- a/root/admin/wikidoc/index.tt
+++ b/root/admin/wikidoc/index.tt
@@ -6,19 +6,19 @@
{ doc => doc_link('WikiDocs') }) %]
</p>
- [% IF c.user.is_wiki_transcluder %]
- <ul>
- <li><a href="[% c.uri_for_action('/admin/wikidoc/create') %]">[% l('Add a new entry') %]</a></li>
- <li><a href="[% c.uri_for_action('/admin/wikidoc/history') %]">[% l('View transclusion history') %]</a></li>
- </ul>
- [% END %]
+ [% IF c.user.is_wiki_transcluder %]
+ <ul>
+ <li><a href="[% c.uri_for_action('/admin/wikidoc/create') %]">[% l('Add a new entry') %]</a></li>
+ <li><a href="[% c.uri_for_action('/admin/wikidoc/history') %]">[% l('View transclusion history') %]</a></li>
+ </ul>
- <p>
- [% l('<strong>Note:</strong> MediaWiki does not check to see if the version
- number matches the page name, it will take the version number and provide
- whatever page is associated with it. Make sure to double check your work
- when updating a page!') %]
- </p>
+ <p>
+ [% l('<strong>Note:</strong> MediaWiki does not check to see if the version
+ number matches the page name, it will take the version number and provide
+ whatever page is associated with it. Make sure to double check your work
+ when updating a page!') %]
+ </p>
+ [% END %]
<table class="tbl wiki-pages">
<thead>
commit 642022a2be24684eb246e7cd9bbd4dd2e794141d
Author: Pavan Chander <[email protected]>
Date: Sun Oct 7 02:16:40 2012 -0400
MBS-5228: (Re)implement MediaWiki API for transclusion table
Also remove the JS hack
diff --git a/lib/DBDefs.pm.default b/lib/DBDefs.pm.default
index 94b6264..2b14927 100644
--- a/lib/DBDefs.pm.default
+++ b/lib/DBDefs.pm.default
@@ -157,7 +157,7 @@ sub WIKITRANS_SERVER { "wiki.musicbrainz.org" }
# The path to MediaWiki's api.php file. This is required to automatically
# determine which documentation pages need to be updated in the
# transclusion table.
-sub WIKITRANS_SERVER_API { "wiki.musicbrainz.org/-/api.php" }
+sub WIKITRANS_SERVER_API { "wiki.musicbrainz.org/api.php" }
sub WIKITRANS_INDEX_FILE { MB_SERVER_ROOT() . "/root/static/wikidocs/index.txt" }
sub WIKITRANS_INDEX_URL { "http://musicbrainz.org/static/wikidocs/index.txt" }
diff --git a/lib/MusicBrainz/Server/Controller/WS/js/WikiDocVersion.pm b/lib/MusicBrainz/Server/Controller/WS/js/WikiDocVersion.pm
deleted file mode 100644
index 2f555dc..0000000
--- a/lib/MusicBrainz/Server/Controller/WS/js/WikiDocVersion.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-package MusicBrainz::Server::Controller::WS::js::WikiDocVersion;
-use Moose;
-use Text::Trim qw( trim );
-
-
-BEGIN { extends 'MusicBrainz::Server::ControllerBase::WS::js' }
-
-my $ws_defs = Data::OptList::mkopt([
- "wikidocversion" => {
- method => 'GET',
- required => [ qw(title) ],
- }
-]);
-
-with 'MusicBrainz::Server::WebService::Validator' =>
-{
- defs => $ws_defs,
- version => 'js',
- default_serialization_type => 'json',
-};
-
-sub version : Chained('root') PathPart('wikidocversion') {
- my ($self, $c) = @_;
-
- my $title = trim $c->stash->{args}->{title};
-
- unless ($title) {
- $c->detach('bad_req');
- }
-
- my $output = $c->model('WikiDoc')->get_version ($title);
-
- $output->{server} = &DBDefs::WIKITRANS_SERVER;
-
- $c->res->content_type($c->stash->{serializer}->mime_type . '; charset=utf-8');
- $c->res->body($c->stash->{serializer}->serialize('generic', $output));
-};
-
-1;
diff --git a/lib/MusicBrainz/Server/Data/WikiDoc.pm b/lib/MusicBrainz/Server/Data/WikiDoc.pm
index d3f3dcf..924e2e1 100644
--- a/lib/MusicBrainz/Server/Data/WikiDoc.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDoc.pm
@@ -145,30 +145,6 @@ sub _load_page
return $self->_create_page($id, $version, $content, $index);
}
-sub get_version
-{
- my ($self, $id) = @_;
-
- my $doc_url = sprintf "http://%s/?title=%s", &DBDefs::WIKITRANS_SERVER, $id;
- my $response = $self->c->lwp->get($doc_url);
-
- my $content = $response->decoded_content;
-
- my $ret = { canonical => $id, version => undef };
-
- if ($content =~ /var wgPageName = "(.*)"/)
- {
- $ret->{canonical} = $1;
- }
-
- if ($content =~ /var wgCurRevisionId = "([0-9]*)"/)
- {
- $ret->{version} = $1;
- }
-
- return $ret;
-}
-
sub get_page
{
my ($self, $id, $version, $index) = @_;
diff --git a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
index 2fad8ea..1cd8fd8 100644
--- a/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
+++ b/lib/MusicBrainz/Server/Data/WikiDocIndex.pm
@@ -135,12 +135,15 @@ sub get_wiki_versions
{
my ($self, $index) = @_;
- my @keys = keys %$index;
+ my @keys;
+ foreach my $key (sort { lc $a cmp lc $b } keys %$index) {
+ push @keys, $key;
+ }
+
my @wiki_pages;
while (@keys) {
- # The API can only process 50 pages at a time, lets be conservative.
- my $query = join ('|', splice(@keys, 0, 40));
+ my $query = join ('|', splice(@keys, 0, 50));
if (!defined &DBDefs::WIKITRANS_SERVER_API) {
warn 'WIKITRANS_SERVER_API must be defined within DBDefs.pm';
diff --git a/root/admin/wikidoc/index.tt b/root/admin/wikidoc/index.tt
index 3292712..b29c048 100644
--- a/root/admin/wikidoc/index.tt
+++ b/root/admin/wikidoc/index.tt
@@ -1,54 +1,3 @@
-[%- BLOCK layout_head -%]
-<script type="text/javascript">//<![CDATA[
- $('document').ready(function() {
-
- var update_wiki_version = function ($row) {
-
- var oldid = $.trim ($row.find ('.transcluded-version').text ());
- var title = $.trim ($row.find ('.title').text ());
- var $version = $row.find ('.wiki-version');
-
- if (MB.utility.isNullOrEmpty (title) || MB.utility.isNullOrEmpty (oldid))
- {
- return;
- }
-
- $.getJSON ('/ws/js/wikidocversion?title=' + title, function (data) {
- $version.empty ().removeClass ('error');
-
- if (data.version === null)
- {
- $version.text ("Does not exist!").addClass ('error');
- }
- else if (parseInt (data.version) !== parseInt(oldid) ||
- data.canonical !== title)
- {
- var linkname = data.canonical === title ? 'diff' : data.canonical;
-
- var $a = $('<a>' + linkname + '</a>')
- .attr ('target', '_blank')
- .attr ('href', 'http://' + data.server + '/' + data.canonical +
- '?diff=' + data.version + '&oldid=' + oldid);
-
- $version.text (data.version + ' (').append ($a).append (')');
- }
- });
-
- };
-
-
- $('#show-wiki-versions').bind ('click.mb', function () {
-
- $('table.wiki-pages').find ('tr').each (function (idx, row) {
- update_wiki_version ($(row));
- });
-
- });
-
- });
-//]]></script>
-[%- END -%]
-
[% WRAPPER "layout.tt" title=l('Transclusion Table') full_width=1 %]
<div id="content">
<h1>[% l('Transclusion Table') %]</h1>
@@ -71,45 +20,48 @@
when updating a page!') %]
</p>
- <p>
- <span class="buttons" style="float: right;">
- <button id="show-wiki-versions">[% l('Get wiki versions') %]</button>
- </span>
- [% l('Use this button to fetch page versions from the wiki.') %]
- </p>
-
<table class="tbl wiki-pages">
<thead>
<tr>
<th>[% l('Page name') %]</th>
<th class="c">[% l('Transcluded version') %]</th>
- [% IF updates_required %]
- <th class="c">[% l('Wiki version') %]</th>
- [% END %]
[% IF c.user.is_wiki_transcluder %]
- <th class="c">[% l('Actions') %]</th>
- [% END %]
+ [% IF updates_required %]
+ <th class="c">[% l('Wiki version') %]</th>
+ [% END %]
+
+ <th class="c">[% l('Actions') %]</th>
+ [% END %]
</tr>
</thead>
<tbody>
[% FOR page IN pages %]
<tr[% ' class="ev"' IF loop.count % 2 == 0 %]>
<td class="title"><a href="[% c.uri_for_action('/doc/show', page.id) %]">[% page.id | html %]</a></td>
- <td class="c transcluded-version"[% ' style="text-align:right"' IF updates_required %]>
+ <td class="c transcluded-version"[% ' style="text-align:right"' IF updates_required && c.user.is_wiki_transcluder %]>
[% page.version %]
</td>
- [% IF updates_required %]
- <td><span class="wiki-version">?</span></td>
- [% END %]
-
[% IF c.user.is_wiki_transcluder %]
- <td class="c nowrap">
- [
- <a href="[% c.uri_for_action('/admin/wikidoc/edit', { page => page.id }) | html %]">[% l('Update') %]</a> |
- <a href="[% c.uri_for_action('/admin/wikidoc/delete', { page => page.id }) | html %]">[% l('Remove') %]</a> |
- <a href="http://[% wiki_server %]/[% page.id | html %]">[% l('View on wiki') %]</a>
- ]
- </td>
+ [% IF updates_required %]
+ <td>
+ [% IF page.wiki_version != page.version %]
+ <span style="color: red;" class="wiki-version">
+ [%~ page.wiki_version || l('ERROR!') ~%]
+ </span>
+ [% IF page.wiki_version && (page.wiki_version != page.version) %]
+ (<a href="http://[% wiki_server %]/[% page.id | uri %]?diff=[% page.wiki_version %]&oldid=[% page.version %]">[% l('diff') %]</a>)
+ [% END %]
+ [% END %]
+ </td>
+ [% END %]
+
+ <td class="c nowrap">
+ [
+ <a href="[% c.uri_for_action('/admin/wikidoc/edit', { page => page.id }) | html %]">[% l('Update') %]</a> |
+ <a href="[% c.uri_for_action('/admin/wikidoc/delete', { page => page.id }) | html %]">[% l('Remove') %]</a> |
+ <a href="http://[% wiki_server %]/[% page.id | html %]">[% l('View on wiki') %]</a>
+ ]
+ </td>
[% END %]
</tr>
[% END %]
-----------------------------------------------------------------------
hooks/post-receive
--
mb_server