Last modified: 2014-09-24 01:32:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11040 - Add redirecting page based wg variable(s) to page JS variables
Add redirecting page based wg variable(s) to page JS variables
Status: RESOLVED DUPLICATE of bug 32230
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Low enhancement with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
: 16028 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-08-23 13:46 UTC by Danny B.
Modified: 2014-09-24 01:32 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Four simple functions that make redirected page information available in Skin.php as JavaScript variables (1.67 KB, patch)
2007-10-04 21:56 UTC, Joshua C. Lerner
Details
Add four new JavaScript variables to makeVariablesScript() (829 bytes, patch)
2007-10-04 21:57 UTC, Joshua C. Lerner
Details
Revised patch (1.49 KB, patch)
2011-11-20 12:59 UTC, Roan Kattouw
Details

Description Danny B. 2007-08-23 13:46:13 UTC
If the page is the target of redirect (user sees "redirected from Foo" message), it would be handy to have variables

* wgRedirPageName
* wgRedirTitle
* wgRedirCanonicalNamespace
* wgRedirNamespaceNumber

as complements to existing appropriate variables.
Comment 1 AlexSm 2007-10-04 21:15:08 UTC
Would it add something that you cannot get from document.getElementById('contentSub').getElementsByTagName('a')[0] (and then maybe some API calls)?
Comment 2 Joshua C. Lerner 2007-10-04 21:56:16 UTC
Created attachment 4216 [details]
Four simple functions that make redirected page information available in Skin.php as JavaScript variables
Comment 3 Joshua C. Lerner 2007-10-04 21:57:20 UTC
Created attachment 4217 [details]
Add four new JavaScript variables to makeVariablesScript()
Comment 4 Chad H. 2008-10-27 18:41:30 UTC
*** Bug 16028 has been marked as a duplicate of this bug. ***
Comment 5 sylvain.brunerie 2009-04-12 15:41:32 UTC
@AlexSm: I think many of the "wg-" JS variables don't give informations that we cannot get by using DOM or API (wgServer, wgUserName, wgUserLanguage, wgVersion...). But it's more simple and "elegant" to use generated JS variables, isn't it?
Comment 6 p858snake 2011-04-30 00:09:48 UTC
*Bulk BZ Change: +Patch to open bugs with patches attached that are missing the keyword*
Comment 7 Sumana Harihareswara 2011-11-09 16:30:54 UTC
Adding the "need-review" keyword for patches that need review by developers.  Joshua, thank you for your patches, and sorry it's taken so long for a response on this!
Comment 8 Roan Kattouw 2011-11-20 12:59:30 UTC
Created attachment 9501 [details]
Revised patch

Attaching a revised patch.

Changes relative to the original patch:
* Applies to MW as it is now rather than as it was four years ago :)
* Introduces only one Article getter and one variable. JS only needs the full title text, we've got mw.Title to figure out the rest  (namespace number etc) on the JS side if you need it

Not committing this because it uses $wgArticle, which is very much deprecated and not used in trunk. However, RequestContext doesn't have an Article, so I'm not sure how to proceed here. Should the redirected from stuff be moved into OutputPage or something?

Thoughts?
Comment 9 Roan Kattouw 2011-11-20 13:03:49 UTC
CC Chad in the hope he'll advise re comment 8.
Comment 10 Daniel Friesen 2011-11-20 13:12:16 UTC
Maybe something along the lines of a $out->setRedirectedFrom. Perhaps that can also set the subtitle implicitly. Then Article can call the OutputPage function where needed.
Comment 11 Roan Kattouw 2011-11-20 13:12:46 UTC
(In reply to comment #10)
> Maybe something along the lines of a $out->setRedirectedFrom. Perhaps that can
> also set the subtitle implicitly. Then Article can call the OutputPage function
> where needed.
Yeah, I was thinking refactoring in that direction would probably be best.
Comment 12 Roan Kattouw 2011-11-30 12:38:47 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > Maybe something along the lines of a $out->setRedirectedFrom. Perhaps that can
> > also set the subtitle implicitly. Then Article can call the OutputPage function
> > where needed.
> Yeah, I was thinking refactoring in that direction would probably be best.
Turns out someone has already done this on bug 32230. Duping up because the patch on that bug is better.

*** This bug has been marked as a duplicate of bug 32230 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links