http://www.mediawiki.org/wiki/Special:Code/MediaWiki/69094

Revision: 69094
Author:   jojo
Date:     2010-07-06 13:45:06 +0000 (Tue, 06 Jul 2010)

Log Message:
-----------
follow redirects in popup code

Modified Paths:
--------------
    trunk/extensions/Collection/Collection.php
    trunk/extensions/Collection/js/bookcreator.js

Modified: trunk/extensions/Collection/Collection.php
===================================================================
--- trunk/extensions/Collection/Collection.php  2010-07-06 13:45:05 UTC (rev 
69093)
+++ trunk/extensions/Collection/Collection.php  2010-07-06 13:45:06 UTC (rev 
69094)
@@ -320,6 +320,12 @@
        $json = new Services_JSON();
        $result = array();
        $imagePath = "$wgScriptPath/extensions/Collection/images";
+       $t = Title::newFromText( $title );
+       if ( $t->isRedirect() ) {
+               $a = new Article( $t, 0 );
+               $t = $a->followRedirect();
+               $title = $t->getPrefixedText();
+       }
        if ( CollectionSession::findArticle( $title ) == - 1 ) {
                $result['action'] = 'add';
                $result['text'] = wfMsg( 'coll-add_linked_article' );
@@ -329,6 +335,7 @@
                $result['text'] = wfMsg( 'coll-remove_linked_article' );
                $result['img'] = "$imagePath/silk-remove.png";
        }
+       $result['title'] = $title;
        $r = new AjaxResponse( $json->encode( $result ) );
        $r->setContentType( 'application/json' );
        return $r;

Modified: trunk/extensions/Collection/js/bookcreator.js
===================================================================
--- trunk/extensions/Collection/js/bookcreator.js       2010-07-06 13:45:05 UTC 
(rev 69093)
+++ trunk/extensions/Collection/js/bookcreator.js       2010-07-06 13:45:06 UTC 
(rev 69094)
@@ -106,7 +106,7 @@
                                .text('\u00a0' + result.text)
                                .prepend(img)
                                .unbind('click')
-                               .click(function(e) { 
addremove_article(result.action, title); });
+                               .click(function(e) { 
addremove_article(result.action, result.title); });
                        popup_div
                                .css({left: mouse_pos.x + 2 + 'px',
                                                        top: mouse_pos.y + 2 + 
'px'})



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to